Commit b7c98d05 authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Work around where BRGA8 overlays are supported but not reported.

On Intel GPUs where YUV hardware overlays are supported, BRGA8
overlays seem to be supported, but the system fails to report
that.

BUG=1119491
TEST=manual, gpu_unittests
R=magchen@chromium.org

Change-Id: I304aef3731f142c13c945ca22ce0df81afbcd21d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2364580
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarMaggie Chen <magchen@chromium.org>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799901}
parent 84714fcf
......@@ -3487,6 +3487,18 @@
"features": [
"force_rgb10a2_overlay_support_flags"
]
},
{
"id": 347,
"cr_bugs": [1119491],
"description": "Intel GPUs fail to report BGRA8 overlay support",
"os": {
"type": "win"
},
"vendor_id": "0x8086",
"features": [
"enable_bgra8_overlays_with_yuv_overlay_support"
]
}
]
}
......@@ -61,6 +61,7 @@ dont_use_eglclientwaitsync_with_timeout
dont_use_loops_to_initialize_variables
emulate_abs_int_function
emulate_isnan_on_float
enable_bgra8_overlays_with_yuv_overlay_support
etc1_power_of_two_only
exit_on_context_lost
flush_on_framebuffer_change
......
......@@ -82,13 +82,18 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) {
return success;
}
void InitializePlatformOverlaySettings(GPUInfo* gpu_info) {
void InitializePlatformOverlaySettings(GPUInfo* gpu_info,
const GpuFeatureInfo& gpu_feature_info) {
#if defined(OS_WIN)
// This has to be called after a context is created, active GPU is identified,
// and GPU driver bug workarounds are computed again. Otherwise the workaround
// |disable_direct_composition| may not be correctly applied.
// Also, this has to be called after falling back to SwiftShader decision is
// finalized because this function depends on GL is ANGLE's GLES or not.
if (gpu_feature_info.IsWorkaroundEnabled(
gpu::ENABLE_BGRA8_OVERLAYS_WITH_YUV_OVERLAY_SUPPORT)) {
gl::DirectCompositionSurfaceWin::EnableBGRA8OverlaysWithYUVOverlaySupport();
}
DCHECK(gpu_info);
CollectHardwareOverlayInfo(&gpu_info->overlay_info);
#elif defined(OS_ANDROID)
......@@ -483,7 +488,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
}
}
InitializePlatformOverlaySettings(&gpu_info_);
InitializePlatformOverlaySettings(&gpu_info_, gpu_feature_info_);
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Driver may create a compatibility profile context when collect graphics
......@@ -675,7 +680,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
}
}
InitializePlatformOverlaySettings(&gpu_info_);
InitializePlatformOverlaySettings(&gpu_info_, gpu_feature_info_);
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Driver may create a compatibility profile context when collect graphics
......
......@@ -102,6 +102,10 @@ UINT g_yuy2_overlay_support_flags = 0;
UINT g_bgra8_overlay_support_flags = 0;
UINT g_rgb10a2_overlay_support_flags = 0;
// When this is set, if NV12 or YUY2 overlays are supported, set BGRA8 overlays
// as supported as well.
bool g_enable_bgra8_overlays_with_yuv_overlay_support = false;
void SetOverlaySupportFlagsForFormats(UINT nv12_flags,
UINT yuy2_flags,
UINT bgra8_flags,
......@@ -219,6 +223,13 @@ void GetGpuDriverOverlayInfo(bool* supports_overlays,
*overlay_format_used = DXGI_FORMAT_YUY2;
*supports_overlays = true;
}
if (g_enable_bgra8_overlays_with_yuv_overlay_support) {
if (FlagsSupportsOverlays(*nv12_overlay_support_flags))
*bgra8_overlay_support_flags = *nv12_overlay_support_flags;
else if (FlagsSupportsOverlays(*yuy2_overlay_support_flags))
*bgra8_overlay_support_flags = *yuy2_overlay_support_flags;
}
if (*supports_overlays) {
DXGI_OUTPUT_DESC monitor_desc = {};
if (SUCCEEDED(output3->GetDesc(&monitor_desc))) {
......@@ -654,6 +665,13 @@ void DirectCompositionSurfaceWin::SetOverlayHDRGpuInfoUpdateCallback(
g_overlay_hdr_gpu_info_callback = std::move(callback);
}
// static
void DirectCompositionSurfaceWin::EnableBGRA8OverlaysWithYUVOverlaySupport() {
// This has to be set before initializing overlay caps.
DCHECK(!OverlayCapsValid());
g_enable_bgra8_overlays_with_yuv_overlay_support = true;
}
bool DirectCompositionSurfaceWin::Initialize(GLSurfaceFormat format) {
d3d11_device_ = QueryD3D11DeviceObjectFromANGLE();
if (!d3d11_device_) {
......
......@@ -99,6 +99,11 @@ class GL_EXPORT DirectCompositionSurfaceWin : public GLSurfaceEGL,
static void SetOverlayHDRGpuInfoUpdateCallback(
OverlayHDRInfoUpdateCallback callback);
// On Intel GPUs where YUV overlays are supported, BGRA8 overlays are
// supported as well but IDXGIOutput3::CheckOverlaySupport() returns
// unsupported. So allow manually enabling BGRA8 overlay support.
static void EnableBGRA8OverlaysWithYUVOverlaySupport();
// GLSurfaceEGL implementation.
bool Initialize(GLSurfaceFormat format) override;
void Destroy() override;
......
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