Skip to content

Commit

Permalink
Add mechanism for disabling sw overlays. Disable for AMD.
Browse files Browse the repository at this point in the history
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: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841717}
  • Loading branch information
dalecurtis authored and Chromium LUCI CQ committed Jan 9, 2021
1 parent 51ad5ae commit 00f3d44
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
12 changes: 12 additions & 0 deletions gpu/config/gpu_driver_bug_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
]
}
1 change: 1 addition & 0 deletions gpu/config/gpu_workaround_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions gpu/ipc/service/gpu_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 15 additions & 5 deletions ui/gl/direct_composition_surface_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -463,6 +470,11 @@ void DirectCompositionSurfaceWin::DisableOverlays() {
RunOverlayHdrGpuInfoUpdateCallback();
}

// static
void DirectCompositionSurfaceWin::DisableSoftwareOverlays() {
g_disable_sw_overlays = true;
}

// static
void DirectCompositionSurfaceWin::InvalidateOverlayCaps() {
SetOverlayCapsValid(false);
Expand All @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions ui/gl/direct_composition_surface_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 00f3d44

Please sign in to comment.