-
Notifications
You must be signed in to change notification settings - Fork 134
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
[UWP] Prefere 60Hz display mode instead of 120Hz #4798
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,7 +147,7 @@ const Platform::String ^ kGenericPnpMonitorAqs = ref new Platform::String( | |
L"True"); | ||
|
||
const uint32_t kYuv420BitsPerPixelForHdr10Mode = 24; | ||
const uint32_t kHdr4kRefreshRateMaximum = 60; | ||
const uint32_t kRefreshRateMaximum = 60; | ||
const uint32_t k4kResolutionWidth = 3840; | ||
const uint32_t k4kResolutionHeight = 2160; | ||
|
||
|
@@ -976,6 +976,8 @@ void ApplicationUwp::UpdateDisplayPreferredMode() { | |
ScopedLock lock(preferred_display_mode_mutex_); | ||
preferred_display_mode_hdmi_ = nullptr; | ||
preferred_display_mode_hdr_ = nullptr; | ||
Windows::Graphics::Display::Core::HdmiDisplayMode ^ | ||
preferred_display_mode_sdr_ = nullptr; | ||
if (!ApiInformation::IsTypePresent( | ||
"Windows.Graphics.Display.Core.HdmiDisplayInformation")) { | ||
return; | ||
|
@@ -988,13 +990,23 @@ void ApplicationUwp::UpdateDisplayPreferredMode() { | |
|
||
preferred_display_mode_hdmi_ = hdmi_display_info->GetCurrentDisplayMode(); | ||
for (auto mode : hdmi_display_info->GetSupportedDisplayModes()) { | ||
// 120Hz is not supported in UWP apps even though the app can select 120Hz display mode. | ||
// Microsoft Support recommend that UWPs do not select 120Hz display mode. | ||
if (mode->RefreshRate > kRefreshRateMaximum) { | ||
continue; | ||
} | ||
// Check that resolution matches the preferred display mode. | ||
if (mode->ResolutionWidthInRawPixels != | ||
preferred_display_mode_hdmi_->ResolutionWidthInRawPixels || | ||
mode->ResolutionHeightInRawPixels != | ||
preferred_display_mode_hdmi_->ResolutionHeightInRawPixels) { | ||
continue; | ||
} | ||
if (preferred_display_mode_hdmi_->RefreshRate > kRefreshRateMaximum && | ||
(!preferred_display_mode_sdr_ || | ||
preferred_display_mode_sdr_->RefreshRate < mode->RefreshRate)) { | ||
preferred_display_mode_sdr_ = mode; | ||
} | ||
// Verify HDR metadata and transfer function are supported. | ||
if (!mode->Is2086MetadataSupported || !mode->IsSmpte2084Supported) { | ||
continue; | ||
|
@@ -1004,18 +1016,14 @@ void ApplicationUwp::UpdateDisplayPreferredMode() { | |
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; | ||
} | ||
} | ||
preferred_display_mode_hdmi_ = preferred_display_mode_sdr_ | ||
? preferred_display_mode_sdr_ | ||
: preferred_display_mode_hdmi_; | ||
Comment on lines
+1024
to
+1026
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In theory if we change display mode, we should also set new currently mode: |
||
} | ||
|
||
bool ApplicationUwp::DispatchNextEvent() { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory it could happen that we don't find any different mode so preferred_display_mode_hdmi_ would have 120Hz on the end anyways but in practice, I think it's not possible (if device support 120Hz it should also support 60Hz).
to cover it we would need use 60Hz as a default refresh rate:
https://github.com/youtube/cobalt/blob/25.lts.1%2B/starboard/shared/uwp/application_uwp.h#L145