summaryrefslogtreecommitdiff
path: root/chromium/gpu/ipc/service/gpu_init.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-07-31 15:50:41 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 12:35:23 +0000
commit7b2ffa587235a47d4094787d72f38102089f402a (patch)
tree30e82af9cbab08a7fa028bb18f4f2987a3f74dfa /chromium/gpu/ipc/service/gpu_init.cc
parentd94af01c90575348c4e81a418257f254b6f8d225 (diff)
downloadqtwebengine-chromium-7b2ffa587235a47d4094787d72f38102089f402a.tar.gz
BASELINE: Update Chromium to 76.0.3809.94
Change-Id: I321c3f5f929c105aec0f98c5091ef6108822e647 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/gpu/ipc/service/gpu_init.cc')
-rw-r--r--chromium/gpu/ipc/service/gpu_init.cc66
1 files changed, 49 insertions, 17 deletions
diff --git a/chromium/gpu/ipc/service/gpu_init.cc b/chromium/gpu/ipc/service/gpu_init.cc
index 603782ef2a4..0302db044c2 100644
--- a/chromium/gpu/ipc/service/gpu_init.cc
+++ b/chromium/gpu/ipc/service/gpu_init.cc
@@ -33,15 +33,17 @@
#if defined(USE_OZONE)
#include "ui/ozone/public/ozone_platform.h"
+#include "ui/ozone/public/surface_factory_ozone.h"
#endif
#if defined(OS_WIN)
-#include "gpu/ipc/service/direct_composition_surface_win.h"
+#include "ui/gl/direct_composition_surface_win.h"
#include "ui/gl/gl_surface_egl.h"
#endif
#if defined(OS_ANDROID)
#include "base/android/android_image_reader_compat.h"
+#include "ui/gl/android/android_surface_control_compat.h"
#endif
#if BUILDFLAG(ENABLE_VULKAN)
@@ -57,7 +59,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info,
DCHECK(gpu_info);
TRACE_EVENT0("gpu,startup", "Collect Graphics Info");
base::TimeTicks before_collect_context_graphics_info = base::TimeTicks::Now();
- bool success = CollectContextGraphicsInfo(gpu_info, gpu_preferences);
+ bool success = CollectContextGraphicsInfo(gpu_info);
if (!success)
LOG(ERROR) << "gpu::CollectGraphicsInfo failed.";
@@ -70,23 +72,40 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info,
}
#if defined(OS_WIN)
+OverlaySupport FlagsToOverlaySupport(UINT flags) {
+ if (flags & DXGI_OVERLAY_SUPPORT_FLAG_SCALING)
+ return OverlaySupport::kScaling;
+ if (flags & DXGI_OVERLAY_SUPPORT_FLAG_DIRECT)
+ return OverlaySupport::kDirect;
+ return OverlaySupport::kNone;
+}
+#endif // OS_WIN
+
+void InitializePlatformOverlaySettings(GPUInfo* gpu_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.
-void InitializeDirectCompositionOverlaySupport(GPUInfo* gpu_info) {
if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) {
DCHECK(gpu_info);
gpu_info->direct_composition =
- DirectCompositionSurfaceWin::IsDirectCompositionSupported();
+ gl::DirectCompositionSurfaceWin::IsDirectCompositionSupported();
gpu_info->supports_overlays =
- DirectCompositionSurfaceWin::AreOverlaysSupported();
- gpu_info->overlay_capabilities =
- DirectCompositionSurfaceWin::GetOverlayCapabilities();
+ gl::DirectCompositionSurfaceWin::AreOverlaysSupported();
+ gpu_info->nv12_overlay_support = FlagsToOverlaySupport(
+ gl::DirectCompositionSurfaceWin::GetOverlaySupportFlags(
+ DXGI_FORMAT_NV12));
+ gpu_info->yuy2_overlay_support = FlagsToOverlaySupport(
+ gl::DirectCompositionSurfaceWin::GetOverlaySupportFlags(
+ DXGI_FORMAT_YUY2));
}
+#elif defined(OS_ANDROID)
+ if (gpu_info->gpu.vendor_string == "Qualcomm")
+ gl::SurfaceControl::EnableQualcommUBWC();
+#endif
}
-#endif // defined(OS_WIN)
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(IS_CHROMECAST)
bool CanAccessNvidiaDeviceFile() {
@@ -225,6 +244,10 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
.requires_mojo;
params.viz_display_compositor = features::IsVizDisplayCompositorEnabled();
ui::OzonePlatform::InitializeForGPU(params);
+ const std::vector<gfx::BufferFormat> supported_buffer_formats_for_texturing =
+ ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
+ ->GetSupportedFormatsForTexturing();
#endif
#if BUILDFLAG(ENABLE_VULKAN)
@@ -303,9 +326,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
}
}
-#if defined(OS_WIN)
- InitializeDirectCompositionOverlaySupport(&gpu_info_);
-#endif
+ InitializePlatformOverlaySettings(&gpu_info_);
#if defined(OS_LINUX)
// Driver may create a compatibility profile context when collect graphics
@@ -387,6 +408,10 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
base::android::AndroidImageReader::DisableSupport();
}
#endif
+#if defined(USE_OZONE)
+ gpu_feature_info_.supported_buffer_formats_for_allocation_and_texturing =
+ std::move(supported_buffer_formats_for_texturing);
+#endif
return true;
}
@@ -426,6 +451,10 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
.requires_mojo;
params.viz_display_compositor = features::IsVizDisplayCompositorEnabled();
ui::OzonePlatform::InitializeForGPU(params);
+ const std::vector<gfx::BufferFormat> supported_buffer_formats_for_texturing =
+ ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
+ ->GetSupportedFormatsForTexturing();
ui::OzonePlatform::GetInstance()->AfterSandboxEntry();
#endif
bool needs_more_info = true;
@@ -454,7 +483,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
bool gl_disabled = gl::GetGLImplementation() == gl::kGLImplementationDisabled;
if (!gl_disabled && !use_swiftshader) {
- CollectContextGraphicsInfo(&gpu_info_, gpu_preferences_);
+ CollectContextGraphicsInfo(&gpu_info_);
gpu_feature_info_ = ComputeGpuFeatureInfo(gpu_info_, gpu_preferences_,
command_line, nullptr);
use_swiftshader = EnableSwiftShaderIfNeeded(
@@ -485,16 +514,14 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
}
}
-#if defined(OS_WIN)
- InitializeDirectCompositionOverlaySupport(&gpu_info_);
-#endif
+ InitializePlatformOverlaySettings(&gpu_info_);
#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_);
+ CollectContextGraphicsInfo(&gpu_info_);
gpu_feature_info_ = ComputeGpuFeatureInfo(gpu_info_, gpu_preferences_,
command_line, nullptr);
use_swiftshader = EnableSwiftShaderIfNeeded(
@@ -515,6 +542,11 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
AdjustInfoToSwiftShader();
}
+#if defined(USE_OZONE)
+ gpu_feature_info_.supported_buffer_formats_for_allocation_and_texturing =
+ std::move(supported_buffer_formats_for_texturing);
+#endif
+
UMA_HISTOGRAM_ENUMERATION("GPU.GLImplementation", gl::GetGLImplementation());
}
#endif // OS_ANDROID
@@ -524,7 +556,7 @@ void GpuInit::AdjustInfoToSwiftShader() {
gpu_info_.passthrough_cmd_decoder = false;
gpu_feature_info_for_hardware_gpu_ = gpu_feature_info_;
gpu_feature_info_ = ComputeGpuFeatureInfoForSwiftShader();
- CollectContextGraphicsInfo(&gpu_info_, gpu_preferences_);
+ CollectContextGraphicsInfo(&gpu_info_);
}
scoped_refptr<gl::GLSurface> GpuInit::TakeDefaultOffscreenSurface() {