0

Remove disable_direct_composition GPU workaround

The only workaround entry is for a bug that's likely related to video
overlays rather than direct composition as a whole. The other linked
bug doesn't even seem related to direct composition.

However, we still need to disable direct composition for things like
RenderDoc so (re)introduce the --disable-direct-composition command
line flag.

Bug: 41241478
Change-Id: Ibf4ce1aa5a6266a7459993c95f9d38697733aca8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6324950
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: David Yeung <dayeung@chromium.org>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1432806}
This commit is contained in:
Sunny Sachanandani
2025-03-14 09:55:12 -07:00
committed by Chromium LUCI CQ
parent b8833a89a0
commit a149973062
15 changed files with 25 additions and 23 deletions

@ -39,6 +39,7 @@ specific_include_rules = {
"+gpu/config/gpu_finch_features.h", "+gpu/config/gpu_finch_features.h",
"+gpu/config/gpu_switches.h", "+gpu/config/gpu_switches.h",
"+media/media_buildflags.h", "+media/media_buildflags.h",
"+ui/gl/gl_switches.h",
], ],
"bitmap_allocation.cc" : [ "bitmap_allocation.cc" : [
# Only used to pass Mojo handles, not to communicate with the viz service. # Only used to pass Mojo handles, not to communicate with the viz service.

@ -21,6 +21,7 @@
#include "gpu/config/gpu_finch_features.h" #include "gpu/config/gpu_finch_features.h"
#include "gpu/config/gpu_switches.h" #include "gpu/config/gpu_switches.h"
#include "media/media_buildflags.h" #include "media/media_buildflags.h"
#include "ui/gl/gl_switches.h"
#if BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h" #include "base/android/build_info.h"
@ -645,14 +646,11 @@ bool ShouldRemoveRedirectionBitmap() {
// bitmap via a blit swap chain. DWM_SYSTEMBACKDROP_TYPE is only available // bitmap via a blit swap chain. DWM_SYSTEMBACKDROP_TYPE is only available
// on Win11 22H2+, therefore limit the bitmap removal to those versions or // on Win11 22H2+, therefore limit the bitmap removal to those versions or
// higher so that an appropriate background replacement is available. // higher so that an appropriate background replacement is available.
// Note: the DISABLE_DIRECT_COMPOSITION command line check is a workaround for // Note: the disable-direct-composition command line check is a workaround for
// https://crbug.com/40276881. Additionally, Direct Composition is only // https://crbug.com/40276881.
// blocklisted for Windows 10 so this feature would not be enabled at the same
// time.
return base::win::GetVersion() >= base::win::Version::WIN11_22H2 && return base::win::GetVersion() >= base::win::Version::WIN11_22H2 &&
!base::CommandLine::ForCurrentProcess()->HasSwitch( !base::CommandLine::ForCurrentProcess()->HasSwitch(
gpu::GpuDriverBugWorkaroundTypeToString( switches::kDisableDirectComposition) &&
gpu::DISABLE_DIRECT_COMPOSITION)) &&
base::FeatureList::IsEnabled(kRemoveRedirectionBitmap); base::FeatureList::IsEnabled(kRemoveRedirectionBitmap);
} }
#endif #endif

@ -28,13 +28,13 @@ Here are the steps to profile the WebGL application [Aquarium](https://webglsamp
``` ```
cd C:\Program Files\IntelSWTools\GPA\Streams cd C:\Program Files\IntelSWTools\GPA\Streams
gpa-injector.exe --injection-mode 1 -t "%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" -L capture -L hud-layer -- --no-sandbox --disable_direct_composition=1 https://webglsamples.org/aquarium/aquarium.html gpa-injector.exe --injection-mode 1 -t "%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" -L capture -L hud-layer -- --no-sandbox --disable-direct-composition https://webglsamples.org/aquarium/aquarium.html
``` ```
Note that Note that
- `-t` specifies the binary file of the graphics application. - `-t` specifies the binary file of the graphics application.
- `-L hud-layer` (optional) enables the HUD of Intel&reg; GPA, where we can see some statistics (for example, the number of frames we have collected) of Intel&reg; GPA. - `-L hud-layer` (optional) enables the HUD of Intel&reg; GPA, where we can see some statistics (for example, the number of frames we have collected) of Intel&reg; GPA.
- `--` specifies the command line parameters that will be used when the graphics application is launched. Currently both `--no-sandbox` and `--disable_direct_composition=1` are required for the latest version of Intel&reg; GPA to work with Chromium. - `--` specifies the command line parameters that will be used when the graphics application is launched. Currently both `--no-sandbox` and `--disable-direct-composition` are required for the latest version of Intel&reg; GPA to work with Chromium.
2. Close Chrome to stop recording the stream after we have collected enough frames. 2. Close Chrome to stop recording the stream after we have collected enough frames.
@ -58,7 +58,7 @@ gpa-injector.exe --injection-mode 1 --hook-d3d11on12 -t "C:\Program Files\Google
Note that Note that
- `--hook-d3d11on12` is required to profile WebGPU applications. - `--hook-d3d11on12` is required to profile WebGPU applications.
- `--no-sandbox` and `--disable_direct_composition=1` are both required for the latest version of Intel&reg; GPA to work with Chromium. - `--no-sandbox` and `--disable-direct-composition` are both required for the latest version of Intel&reg; GPA to work with Chromium.
2. Close Chrome to stop recording the stream after we have collected enough frames. 2. Close Chrome to stop recording the stream after we have collected enough frames.

@ -1712,7 +1712,7 @@
}, },
{ {
"id": 300, "id": 300,
"cr_bugs": [775898, 785648], "cr_bugs": [775898],
"description": "Direct composition causes rendering issues on Intel SandyBridge and IvyBridge GPUs on early versions of RS3", "description": "Direct composition causes rendering issues on Intel SandyBridge and IvyBridge GPUs on early versions of RS3",
"os": { "os": {
"type" : "win", "type" : "win",
@ -1727,7 +1727,7 @@
"ivybridge" "ivybridge"
], ],
"features": [ "features": [
"disable_direct_composition" "disable_direct_composition_video_overlays"
] ]
}, },
{ {

@ -162,7 +162,7 @@ bool GetActiveAdapterLuid(LUID* luid) {
// This has to be called after a context is created, active GPU is identified, // 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 // and GPU driver bug workarounds are computed again. Otherwise the workaround
// |disable_direct_composition| may not be correctly applied. // `disable_direct_composition_video_overlays` may not be correctly applied.
// Also, this has to be called after falling back to SwiftShader decision is // 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. // finalized because this function depends on GL is ANGLE's GLES or not.
void CollectHardwareOverlayInfo(OverlayInfo* overlay_info) { void CollectHardwareOverlayInfo(OverlayInfo* overlay_info) {

@ -316,7 +316,6 @@ void SetProcessGlWorkaroundsFromGpuFeatures(
.disable_metal = is_enabled(DISABLE_METAL), .disable_metal = is_enabled(DISABLE_METAL),
.disable_es3gl_context = is_enabled(DISABLE_ES3_GL_CONTEXT), .disable_es3gl_context = is_enabled(DISABLE_ES3_GL_CONTEXT),
#if BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_WIN)
.disable_direct_composition = is_enabled(DISABLE_DIRECT_COMPOSITION),
.disable_direct_composition_video_overlays = .disable_direct_composition_video_overlays =
is_enabled(DISABLE_DIRECT_COMPOSITION_VIDEO_OVERLAYS), is_enabled(DISABLE_DIRECT_COMPOSITION_VIDEO_OVERLAYS),
.disable_vp_auto_hdr = is_enabled(DISABLE_VP_AUTO_HDR), .disable_vp_auto_hdr = is_enabled(DISABLE_VP_AUTO_HDR),

@ -24,7 +24,6 @@ disable_d3d11_video_decoder
disable_d3d11_vp9_ksvc_decoding disable_d3d11_vp9_ksvc_decoding
disable_decode_swap_chain disable_decode_swap_chain
disable_depth_texture disable_depth_texture
disable_direct_composition
disable_direct_composition_sw_video_overlays disable_direct_composition_sw_video_overlays
disable_direct_composition_video_overlays disable_direct_composition_video_overlays
disable_discard_framebuffer disable_discard_framebuffer

@ -122,7 +122,7 @@ void InitializePlatformOverlaySettings(GPUInfo* gpu_info,
#if BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_WIN)
// This has to be called after a context is created, active GPU is identified, // 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 // and GPU driver bug workarounds are computed again. Otherwise the workaround
// |disable_direct_composition| may not be correctly applied. // `disable_direct_composition_video_overlays` may not be correctly applied.
// Also, this has to be called after falling back to SwiftShader decision is // 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. // finalized because this function depends on GL is ANGLE's GLES or not.
gl::DirectCompositionOverlayWorkarounds workarounds = { gl::DirectCompositionOverlayWorkarounds workarounds = {

@ -253,7 +253,8 @@ int main(int argc, char** argv) {
// Disabling Direct Composition works around the limitation that // Disabling Direct Composition works around the limitation that
// InProcessContextFactory doesn't work with Direct Composition, causing the // InProcessContextFactory doesn't work with Direct Composition, causing the
// window to not render. See http://crbug.com/936249. // window to not render. See http://crbug.com/936249.
gl::SetGlWorkarounds(gl::GlWorkarounds{.disable_direct_composition = true}); base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kDisableDirectComposition);
// The exit manager is in charge of calling the dtors of singleton objects. // The exit manager is in charge of calling the dtors of singleton objects.
base::AtExitManager exit_manager; base::AtExitManager exit_manager;

@ -669,7 +669,8 @@ void InitializeDirectComposition(
return; return;
} }
if (GetGlWorkarounds().disable_direct_composition) { if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableDirectComposition)) {
return; return;
} }

@ -56,12 +56,12 @@ GL_EXPORT ID3D11Device* GetDirectCompositionD3D11Device();
// Returns true if direct composition is supported. We prefer to use direct // Returns true if direct composition is supported. We prefer to use direct
// composition even without hardware overlays, because it allows us to bypass // composition even without hardware overlays, because it allows us to bypass
// blitting by DWM to the window redirection surface by using a flip mode swap // blitting by DWM to the window redirection surface by using a flip mode swap
// chain. Overridden with --disable_direct_composition=1. // chain. Overridden with --disable-direct-composition.
GL_EXPORT bool DirectCompositionSupported(); GL_EXPORT bool DirectCompositionSupported();
// Returns true if video overlays are supported and should be used. Overridden // Returns true if video overlays are supported and should be used. Overridden
// with --enable-direct-composition-video-overlays and // with --enable-direct-composition-video-overlays and
// --disable_direct_composition_video_overlays=1. This function is thread safe. // --disable-direct-composition-video-overlays. This function is thread safe.
GL_EXPORT bool DirectCompositionOverlaysSupported(); GL_EXPORT bool DirectCompositionOverlaysSupported();
// Returns true if hardware overlays are supported. This function is thread // Returns true if hardware overlays are supported. This function is thread

@ -135,8 +135,10 @@ const char kDisableGLExtensions[] = "disable-gl-extensions";
// Enables SwapBuffersWithBounds if it is supported. // Enables SwapBuffersWithBounds if it is supported.
const char kEnableSwapBuffersWithBounds[] = "enable-swap-buffers-with-bounds"; const char kEnableSwapBuffersWithBounds[] = "enable-swap-buffers-with-bounds";
// Enables using DirectComposition video overlays, even if hardware overlays // Disable DirectComposition.
// aren't supported. const char kDisableDirectComposition[] = "disable-direct-composition";
// Enable DirectComposition video overlays even if hardware doesn't support it.
const char kEnableDirectCompositionVideoOverlays[] = const char kEnableDirectCompositionVideoOverlays[] =
"enable-direct-composition-video-overlays"; "enable-direct-composition-video-overlays";
@ -166,6 +168,7 @@ const char* const kGLSwitchesCopiedFromGpuProcessHost[] = {
kOverrideUseSoftwareGLForTests, kOverrideUseSoftwareGLForTests,
kUseANGLE, kUseANGLE,
kEnableSwapBuffersWithBounds, kEnableSwapBuffersWithBounds,
kDisableDirectComposition,
kEnableDirectCompositionVideoOverlays, kEnableDirectCompositionVideoOverlays,
kDirectCompositionVideoSwapChainFormat, kDirectCompositionVideoSwapChainFormat,
kEnableUnsafeSwiftShader, kEnableUnsafeSwiftShader,

@ -71,6 +71,7 @@ GL_EXPORT extern const char kUseGpuInTests[];
GL_EXPORT extern const char kEnableSgiVideoSync[]; GL_EXPORT extern const char kEnableSgiVideoSync[];
GL_EXPORT extern const char kDisableGLExtensions[]; GL_EXPORT extern const char kDisableGLExtensions[];
GL_EXPORT extern const char kEnableSwapBuffersWithBounds[]; GL_EXPORT extern const char kEnableSwapBuffersWithBounds[];
GL_EXPORT extern const char kDisableDirectComposition[];
GL_EXPORT extern const char kEnableDirectCompositionVideoOverlays[]; GL_EXPORT extern const char kEnableDirectCompositionVideoOverlays[];
GL_EXPORT extern const char kUseAdapterLuid[]; GL_EXPORT extern const char kUseAdapterLuid[];
GL_EXPORT extern const char kEnableUnsafeSwiftShader[]; GL_EXPORT extern const char kEnableUnsafeSwiftShader[];

@ -46,7 +46,6 @@ struct GlWorkarounds {
bool disable_metal = false; bool disable_metal = false;
bool disable_es3gl_context = false; bool disable_es3gl_context = false;
bool disable_es3gl_context_for_testing = false; bool disable_es3gl_context_for_testing = false;
bool disable_direct_composition = false;
bool disable_direct_composition_video_overlays = false; bool disable_direct_composition_video_overlays = false;
bool disable_vp_auto_hdr = false; bool disable_vp_auto_hdr = false;
}; };

@ -102,7 +102,7 @@ ExamplesExitCode ExamplesMainProc(bool under_test, ExampleVector examples) {
// Disabling Direct Composition works around the limitation that // Disabling Direct Composition works around the limitation that
// InProcessContextFactory doesn't work with Direct Composition, causing the // InProcessContextFactory doesn't work with Direct Composition, causing the
// window to not render. See http://crbug.com/936249. // window to not render. See http://crbug.com/936249.
gl::SetGlWorkarounds(gl::GlWorkarounds{.disable_direct_composition = true}); command_line->AppendSwitch(switches::kDisableDirectComposition);
base::FeatureList::InitInstance( base::FeatureList::InitInstance(
command_line->GetSwitchValueASCII(switches::kEnableFeatures), command_line->GetSwitchValueASCII(switches::kEnableFeatures),