Commit 33f395ae authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Initialize Direct Composition HW overlay support at the right time.

Currently we initialize it too soon, so on multi-GPU system, the
workaround |disable_direct_composition| may not be correctly applied.

BUG=907684
TEST=manual
R=piman@chromium.org,sunnyps@chromium.org

Change-Id: Id30e09f2229b4229b82ee9330523426b470b7c5d
Reviewed-on: https://chromium-review.googlesource.com/c/1346998
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610329}
parent dae45f5f
......@@ -60,8 +60,23 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info,
if (!success)
LOG(ERROR) << "gpu::CollectGraphicsInfo failed.";
if (success) {
base::TimeDelta collect_context_time =
base::TimeTicks::Now() - before_collect_context_graphics_info;
UMA_HISTOGRAM_TIMES("GPU.CollectContextGraphicsInfo", collect_context_time);
}
return success;
}
#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.
void InitializeDirectCompositionOverlaySupport(GPUInfo* gpu_info) {
if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) {
DCHECK(gpu_info);
gpu_info->direct_composition =
DirectCompositionSurfaceWin::IsDirectCompositionSupported();
gpu_info->supports_overlays =
......@@ -69,15 +84,8 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info,
gpu_info->overlay_capabilities =
DirectCompositionSurfaceWin::GetOverlayCapabilities();
}
#endif // defined(OS_WIN)
if (success) {
base::TimeDelta collect_context_time =
base::TimeTicks::Now() - before_collect_context_graphics_info;
UMA_HISTOGRAM_TIMES("GPU.CollectContextGraphicsInfo", collect_context_time);
}
return success;
}
#endif // defined(OS_WIN)
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(IS_CHROMECAST)
bool CanAccessNvidiaDeviceFile() {
......@@ -285,6 +293,10 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
}
}
#if defined(OS_WIN)
InitializeDirectCompositionOverlaySupport(&gpu_info_);
#endif
#if defined(OS_LINUX)
// Driver may create a compatibility profile context when collect graphics
// information on Linux platform. Try to collect graphics information
......@@ -466,6 +478,10 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
}
}
#if defined(OS_WIN)
InitializeDirectCompositionOverlaySupport(&gpu_info_);
#endif
#if defined(OS_LINUX)
// Driver may create a compatibility profile context when collect graphics
// information on Linux platform. Try to collect graphics information
......
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