From e684a3455bcc29a6e3e66a004e352dea4e1141e7 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 13 Feb 2019 15:05:36 +0100 Subject: BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922 Reviewed-by: Michael BrĂ¼ning --- chromium/gpu/ipc/service/gpu_init.cc | 121 ++++++++++++++++++++++++++++------- 1 file changed, 98 insertions(+), 23 deletions(-) (limited to 'chromium/gpu/ipc/service/gpu_init.cc') diff --git a/chromium/gpu/ipc/service/gpu_init.cc b/chromium/gpu/ipc/service/gpu_init.cc index bee52c67f1a..90c497304c9 100644 --- a/chromium/gpu/ipc/service/gpu_init.cc +++ b/chromium/gpu/ipc/service/gpu_init.cc @@ -60,17 +60,6 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info, if (!success) LOG(ERROR) << "gpu::CollectGraphicsInfo failed."; -#if defined(OS_WIN) - if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && - gl::GLSurfaceEGL::IsDirectCompositionSupported()) { - gpu_info->direct_composition = true; - gpu_info->supports_overlays = - DirectCompositionSurfaceWin::AreOverlaysSupported(); - 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; @@ -79,6 +68,25 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info, 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 = + DirectCompositionSurfaceWin::AreOverlaysSupported(); + gpu_info->overlay_capabilities = + DirectCompositionSurfaceWin::GetOverlayCapabilities(); + } +} +#endif // defined(OS_WIN) + #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(IS_CHROMECAST) bool CanAccessNvidiaDeviceFile() { bool res = true; @@ -111,6 +119,11 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, if (!PopGPUInfoCache(&gpu_info_)) { CollectBasicGraphicsInfo(command_line, &gpu_info_); } +#if defined(OS_WIN) + GpuSeriesType gpu_series_type = GetGpuSeriesType( + gpu_info_.active_gpu().vendor_id, gpu_info_.active_gpu().device_id); + UMA_HISTOGRAM_ENUMERATION("GPU.GpuGeneration", gpu_series_type); +#endif // OS_WIN // Set keys for crash logging based on preliminary gpu info, in case we // crash during feature collection. @@ -262,15 +275,6 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, } } } - if (use_swiftshader) { - AdjustInfoToSwiftShader(); - } - - if (kGpuFeatureStatusEnabled != - gpu_feature_info_ - .status_values[GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE]) { - gpu_preferences_.disable_accelerated_video_decode = true; - } if (!gl_disabled) { if (!gpu_feature_info_.disabled_extensions.empty()) { @@ -289,6 +293,44 @@ 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 + // based on core profile context after disabling platform extensions. + if (!gl_disabled && !use_swiftshader) { + if (!CollectGraphicsInfo(&gpu_info_, gpu_preferences_)) + return false; + gpu::SetKeysForCrashLogging(gpu_info_); + gpu_feature_info_ = gpu::ComputeGpuFeatureInfo(gpu_info_, gpu_preferences_, + command_line, nullptr); + use_swiftshader = EnableSwiftShaderIfNeeded( + command_line, gpu_feature_info_, + gpu_preferences_.disable_software_rasterizer, false); + if (use_swiftshader) { + gl::init::ShutdownGL(true); + if (!gl::init::InitializeGLNoExtensionsOneOff()) { + VLOG(1) << "gl::init::InitializeGLNoExtensionsOneOff with SwiftShader " + << "failed"; + return false; + } + } + } +#endif // defined(OS_LINUX) + + if (use_swiftshader) { + AdjustInfoToSwiftShader(); + } + + if (kGpuFeatureStatusEnabled != + gpu_feature_info_ + .status_values[GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE]) { + gpu_preferences_.disable_accelerated_video_decode = true; + } + base::TimeDelta initialize_one_off_time = base::TimeTicks::Now() - before_initialize_one_off; UMA_HISTOGRAM_MEDIUM_TIMES("GPU.InitializeOneOffMediumTime", @@ -315,6 +357,8 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, gpu_preferences_.watchdog_starts_backgrounded); } + UMA_HISTOGRAM_ENUMERATION("GPU.GLImplementation", gl::GetGLImplementation()); + if (!gpu_info_.sandboxed && !attempted_startsandbox) { gpu_info_.sandboxed = sandbox_helper_->EnsureSandboxInitialized( watchdog_thread_.get(), &gpu_info_, gpu_preferences_); @@ -359,6 +403,8 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, if (gpu_feature_info_.IsWorkaroundEnabled(DISABLE_AIMAGEREADER)) { base::android::AndroidImageReader::DisableSupport(); } + + UMA_HISTOGRAM_ENUMERATION("GPU.GLImplementation", gl::GetGLImplementation()); } #else void GpuInit::InitializeInProcess(base::CommandLine* command_line, @@ -416,9 +462,6 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, } } } - if (use_swiftshader) { - AdjustInfoToSwiftShader(); - } if (!gl_disabled) { if (!gpu_feature_info_.disabled_extensions.empty()) { @@ -434,6 +477,38 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, VLOG(1) << "gl::init::CreateOffscreenGLSurface failed"; } } + +#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 + // based on core profile context after disabling platform extensions. + if (!gl_disabled && !use_swiftshader) { + CollectContextGraphicsInfo(&gpu_info_, gpu_preferences_); + gpu_feature_info_ = ComputeGpuFeatureInfo(gpu_info_, gpu_preferences_, + command_line, nullptr); + use_swiftshader = EnableSwiftShaderIfNeeded( + command_line, gpu_feature_info_, + gpu_preferences_.disable_software_rasterizer, false); + if (use_swiftshader) { + gl::init::ShutdownGL(true); + if (!gl::init::InitializeGLNoExtensionsOneOff()) { + VLOG(1) << "gl::init::InitializeGLNoExtensionsOneOff failed " + << "with SwiftShader"; + return; + } + } + } +#endif // defined(OS_LINUX) + + if (use_swiftshader) { + AdjustInfoToSwiftShader(); + } + + UMA_HISTOGRAM_ENUMERATION("GPU.GLImplementation", gl::GetGLImplementation()); } #endif // OS_ANDROID -- cgit v1.2.1