Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XB1] Cap framerate at 60fps for 4k HDR videos #2551

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions starboard/shared/uwp/application_uwp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ const Platform::String ^ kGenericPnpMonitorAqs = ref new Platform::String(
L"True");

const uint32_t kYuv420BitsPerPixelForHdr10Mode = 24;
const uint32_t kHdr4kRefreshRateMaximum = 60;
const uint32_t k4kResolutionWidth = 3840;
const uint32_t k4kResolutionHeight = 2160;

// Per Microsoft, HdcpProtection::On means HDCP 1.x required.
const HdcpProtection kHDCPProtectionMode = HdcpProtection::On;
Expand Down Expand Up @@ -983,17 +986,32 @@ void ApplicationUwp::UpdateDisplayPreferredMode() {

preferred_display_mode_hdmi_ = hdmi_display_info->GetCurrentDisplayMode();
for (auto mode : hdmi_display_info->GetSupportedDisplayModes()) {
if (mode->ResolutionWidthInRawPixels ==
preferred_display_mode_hdmi_->ResolutionWidthInRawPixels &&
mode->ResolutionHeightInRawPixels ==
preferred_display_mode_hdmi_->ResolutionHeightInRawPixels &&
mode->Is2086MetadataSupported && mode->IsSmpte2084Supported &&
mode->BitsPerPixel >= kYuv420BitsPerPixelForHdr10Mode &&
mode->ColorSpace == HdmiDisplayColorSpace::BT2020) {
if (!preferred_display_mode_hdr_ ||
preferred_display_mode_hdr_->RefreshRate < mode->RefreshRate) {
preferred_display_mode_hdr_ = mode;
}
// Check that resolution matches the preferred display mode.
if (mode->ResolutionWidthInRawPixels !=
preferred_display_mode_hdmi_->ResolutionWidthInRawPixels ||
mode->ResolutionHeightInRawPixels !=
preferred_display_mode_hdmi_->ResolutionHeightInRawPixels) {
continue;
}
// Verify HDR metadata and transfer function are supported.
if (!mode->Is2086MetadataSupported || !mode->IsSmpte2084Supported) {
continue;
}
// Verify we have enough bits per pixel and the correct color space for HDR.
if (mode->BitsPerPixel < kYuv420BitsPerPixelForHdr10Mode ||
mode->ColorSpace != HdmiDisplayColorSpace::BT2020) {
continue;
}
// We don't serve 4k HDR videos over 60fps, skipping display modes that will
// consume more power than needed.
if (mode->ResolutionWidthInRawPixels >= k4kResolutionWidth &&
mode->ResolutionHeightInRawPixels >= k4kResolutionHeight &&
mode->RefreshRate > kHdr4kRefreshRateMaximum) {
continue;
}
if (!preferred_display_mode_hdr_ ||
preferred_display_mode_hdr_->RefreshRate < mode->RefreshRate) {
preferred_display_mode_hdr_ = mode;
}
}
}
Expand Down
Loading