Commit 00f3d447 authored by Dale Curtis's avatar Dale Curtis Committed by Chromium LUCI CQ

Add mechanism for disabling sw overlays. Disable for AMD.

Since software overlays are controlled by a base::Feature, we need a
new static method on DirectCompositionSurfaceWin for disabling the
software overlay path using an internal static variable.

R=zmo

Bug: 1161215, 1160217
Change-Id: I3299a4f80881d45444dfbebaaf4bce2b581f2322
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2617000
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841717}
parent 51ad5ae4
......@@ -3675,6 +3675,18 @@
"features": [
"disable_accelerated_vp9_decode"
]
},
{
"id": 364,
"cr_bugs": [1161215, 1160217],
"description": "Software overlays fail to work reliably on AMD devices",
"os": {
"type": "win"
},
"vendor_id": "0x1002",
"features": [
"disable_direct_composition_sw_video_overlays"
]
}
]
}
......@@ -27,6 +27,7 @@ disable_decode_swap_chain
disable_delayed_copy_nv12
disable_depth_texture
disable_direct_composition
disable_direct_composition_sw_video_overlays
disable_direct_composition_video_overlays
disable_discard_framebuffer
disable_dual_source_blending_support
......
......@@ -608,6 +608,10 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
#if defined(OS_WIN)
if (gpu_feature_info_.IsWorkaroundEnabled(DISABLE_DECODE_SWAP_CHAIN))
gl::DirectCompositionSurfaceWin::DisableDecodeSwapChain();
if (gpu_feature_info_.IsWorkaroundEnabled(
DISABLE_DIRECT_COMPOSITION_SW_VIDEO_OVERLAYS)) {
gl::DirectCompositionSurfaceWin::DisableSoftwareOverlays();
}
#endif
return true;
......
......@@ -41,6 +41,8 @@ bool g_supports_overlays = false;
bool g_decode_swap_chain_disabled = false;
// Whether to force the nv12 overlay support.
bool g_force_nv12_overlay_support = false;
// Whether software overlays have been disabled.
bool g_disable_sw_overlays = false;
// The lock to guard g_overlay_caps_valid and g_supports_overlays.
base::Lock& GetOverlayLock() {
......@@ -58,6 +60,12 @@ void SetSupportsOverlays(bool support) {
g_supports_overlays = support;
}
bool SupportsSoftwareOverlays() {
return base::FeatureList::IsEnabled(
features::kDirectCompositionSoftwareOverlays) &&
!g_disable_sw_overlays;
}
bool OverlayCapsValid() {
base::AutoLock auto_lock(GetOverlayLock());
return g_overlay_caps_valid;
......@@ -252,8 +260,7 @@ void GetGpuDriverOverlayInfo(bool* supports_overlays,
base::UmaHistogramBoolean("GPU.DirectComposition.HardwareOverlaysSupported",
*supports_overlays);
if (*supports_overlays || !base::FeatureList::IsEnabled(
features::kDirectCompositionSoftwareOverlays)) {
if (*supports_overlays || !SupportsSoftwareOverlays()) {
return;
}
......@@ -463,6 +470,11 @@ void DirectCompositionSurfaceWin::DisableOverlays() {
RunOverlayHdrGpuInfoUpdateCallback();
}
// static
void DirectCompositionSurfaceWin::DisableSoftwareOverlays() {
g_disable_sw_overlays = true;
}
// static
void DirectCompositionSurfaceWin::InvalidateOverlayCaps() {
SetOverlayCapsValid(false);
......@@ -473,9 +485,7 @@ bool DirectCompositionSurfaceWin::AreScaledOverlaysSupported() {
UpdateOverlaySupport();
if (g_overlay_format_used == DXGI_FORMAT_NV12) {
return (g_nv12_overlay_support_flags & DXGI_OVERLAY_SUPPORT_FLAG_SCALING) ||
(SupportsOverlays() &&
base::FeatureList::IsEnabled(
features::kDirectCompositionSoftwareOverlays));
(SupportsOverlays() && SupportsSoftwareOverlays());
} else if (g_overlay_format_used == DXGI_FORMAT_YUY2) {
return !!(g_yuy2_overlay_support_flags & DXGI_OVERLAY_SUPPORT_FLAG_SCALING);
} else {
......
......@@ -62,6 +62,9 @@ class GL_EXPORT DirectCompositionSurfaceWin : public GLSurfaceEGL,
// current GPU process' lifetime.
static void DisableOverlays();
// Similar to the above but disables software overlay support.
static void DisableSoftwareOverlays();
// Indicate the overlay caps are invalid.
static void InvalidateOverlayCaps();
......
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