Commit 54436b45 authored by jbauman's avatar jbauman Committed by Commit bot

Avoid scaling overlays on systems that don't support them.

Most systems that only support direct (unscaled) overlays are Intel
Cherry Trail. On these systems we want to make sure overlay swapchains
are the size they appear onscreen, so that no scaling is necessary.
Otherwise they may be displayed using compositing in DWM, which can be
much less efficient.

BUG=725208
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2895783002
Cr-Commit-Position: refs/heads/master@{#473828}
parent 3d8a59be
...@@ -108,6 +108,8 @@ class PresentationHistory { ...@@ -108,6 +108,8 @@ class PresentationHistory {
gfx::Size g_overlay_monitor_size; gfx::Size g_overlay_monitor_size;
bool g_supports_scaled_overlays = true;
// This is the raw support info, which shouldn't depend on field trial state. // This is the raw support info, which shouldn't depend on field trial state.
bool HardwareSupportsOverlays() { bool HardwareSupportsOverlays() {
if (!gl::GLSurfaceEGL::IsDirectCompositionSupported()) if (!gl::GLSurfaceEGL::IsDirectCompositionSupported())
...@@ -165,6 +167,8 @@ bool HardwareSupportsOverlays() { ...@@ -165,6 +167,8 @@ bool HardwareSupportsOverlays() {
continue; continue;
g_overlay_monitor_size = g_overlay_monitor_size =
gfx::Rect(monitor_desc.DesktopCoordinates).size(); gfx::Rect(monitor_desc.DesktopCoordinates).size();
g_supports_scaled_overlays =
!!(flags & DXGI_OVERLAY_SUPPORT_FLAG_SCALING);
return true; return true;
} }
} }
...@@ -512,7 +516,9 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain( ...@@ -512,7 +516,9 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain(
gfx::Rect bounds_rect = params.rect; gfx::Rect bounds_rect = params.rect;
gfx::Size ceiled_input_size = gfx::ToCeiledSize(params.contents_rect.size()); gfx::Size ceiled_input_size = gfx::ToCeiledSize(params.contents_rect.size());
gfx::Size swap_chain_size = bounds_rect.size(); gfx::Size swap_chain_size = bounds_rect.size();
swap_chain_size.SetToMin(ceiled_input_size);
if (g_supports_scaled_overlays)
swap_chain_size.SetToMin(ceiled_input_size);
// YUY2 surfaces must have an even width. // YUY2 surfaces must have an even width.
if (swap_chain_size.width() % 2 == 1) if (swap_chain_size.width() % 2 == 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment