Commit 339565ed authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Expose OOPR to chrome://gpu

Also a minor cleanup making GpuPreferences const.

TBR=boliu@chromium.org,tsepez@chromium.org

Bug: 785008
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I865682dc09a817a2d05a1ee9a410be5510f6bef9
Reviewed-on: https://chromium-review.googlesource.com/1091072
Commit-Queue: Jonathan Backer <backer@chromium.org>
Reviewed-by: default avatarenne <enne@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565406}
parent 1c2f0d01
......@@ -62,7 +62,7 @@ DeferredGpuCommandService::CreateDeferredGpuCommandService() {
gpu::GpuPreferences gpu_preferences =
content::GetGpuPreferencesFromCommandLine();
bool success = gpu::InitializeGLThreadSafe(
base::CommandLine::ForCurrentProcess(), &gpu_preferences, &gpu_info,
base::CommandLine::ForCurrentProcess(), gpu_preferences, &gpu_info,
&gpu_feature_info);
if (!success) {
LOG(FATAL) << "gpu::InitializeGLThreadSafe() failed.";
......
......@@ -535,9 +535,7 @@ void GpuServiceImpl::UpdateGpuInfoPlatform(
if (in_host_process())
return;
// TODO(https://crbug.com/847543): Unfold the OSX specific codepath so that we
// can call this earlier and leave gpu_preferences_ const.
bool success = gpu::CollectContextGraphicsInfo(&gpu_info_, &gpu_preferences_);
bool success = gpu::CollectContextGraphicsInfo(&gpu_info_, gpu_preferences_);
if (!success) {
LOG(ERROR) << "gpu::CollectGraphicsInfo failed.";
// TODO(piman): can we signal overall failure?
......
......@@ -233,7 +233,7 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
gpu::GpuPreferences gpu_preferences_;
const gpu::GpuPreferences gpu_preferences_;
// Information about the GPU, such as device and vendor ID.
gpu::GPUInfo gpu_info_;
......
......@@ -161,6 +161,13 @@ const GpuFeatureData GetGpuFeatureData(
"Accelerated rasterization has been disabled, either via blacklist, "
"about:flags or the command line.",
true, true},
{"oop_rasterization",
SafeGetFeatureStatus(gpu_feature_info,
gpu::GPU_FEATURE_TYPE_OOP_RASTERIZATION),
command_line.HasSwitch(switches::kDisableOopRasterization),
"Out-of-process accelerated rasterization has been disabled, either "
"via blacklist, about:flags or the command line.",
false, true},
{"multiple_raster_threads", gpu::kGpuFeatureStatusEnabled,
NumberOfRendererRasterThreads() == 1, "Raster is using a single thread.",
false, true},
......
......@@ -117,18 +117,21 @@ void UpdateFeatureStats(const gpu::GpuFeatureInfo& gpu_feature_info) {
gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS,
gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING,
gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION,
gpu::GPU_FEATURE_TYPE_OOP_RASTERIZATION,
gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL,
gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL2};
const std::string kGpuBlacklistFeatureHistogramNames[] = {
"GPU.BlacklistFeatureTestResults.Accelerated2dCanvas",
"GPU.BlacklistFeatureTestResults.GpuCompositing",
"GPU.BlacklistFeatureTestResults.GpuRasterization",
"GPU.BlacklistFeatureTestResults.OopRasterization",
"GPU.BlacklistFeatureTestResults.Webgl",
"GPU.BlacklistFeatureTestResults.Webgl2"};
const bool kGpuFeatureUserFlags[] = {
command_line.HasSwitch(switches::kDisableAccelerated2dCanvas),
command_line.HasSwitch(switches::kDisableGpu),
command_line.HasSwitch(switches::kDisableGpuRasterization),
command_line.HasSwitch(switches::kDisableOopRasterization),
command_line.HasSwitch(switches::kDisableWebGL),
(command_line.HasSwitch(switches::kDisableWebGL) ||
command_line.HasSwitch(switches::kDisableWebGL2))};
......@@ -137,6 +140,7 @@ void UpdateFeatureStats(const gpu::GpuFeatureInfo& gpu_feature_info) {
"GPU.BlacklistFeatureTestResultsWindows2.Accelerated2dCanvas",
"GPU.BlacklistFeatureTestResultsWindows2.GpuCompositing",
"GPU.BlacklistFeatureTestResultsWindows2.GpuRasterization",
"GPU.BlacklistFeatureTestResultsWindows2.OopRasterization",
"GPU.BlacklistFeatureTestResultsWindows2.Webgl",
"GPU.BlacklistFeatureTestResultsWindows2.Webgl2"};
#endif
......
......@@ -230,6 +230,7 @@ cr.define('gpu', function() {
'texture_sharing': 'Texture Sharing',
'video_decode': 'Video Decode',
'rasterization': 'Rasterization',
'oop_rasterization': 'Out-of-process Rasterization',
'multiple_raster_threads': 'Multiple Raster Threads',
'native_gpu_memory_buffers': 'Native GpuMemoryBuffers',
'protected_video_decode': 'Hardware Protected Video Decode',
......
......@@ -373,8 +373,7 @@ bool GpuCommandBufferTestEGL::InitializeEGLGLES2(int width, int height) {
}
gpu::GPUInfo gpu_info;
gpu::GpuPreferences gpu_preferences;
gpu::CollectContextGraphicsInfo(&gpu_info, &gpu_preferences);
gpu::CollectContextGraphicsInfo(&gpu_info, gpu::GpuPreferences());
// See crbug.com/822716, the ATI proprietary driver has eglGetProcAddress
// but eglInitialize crashes with x11.
if (gpu_info.gl_vendor.find("ATI Technologies Inc.") != std::string::npos) {
......
......@@ -104,6 +104,8 @@ GPU_BLACKLIST_FEATURE_TEST(AcceleratedVideoDecode,
GPU_BLACKLIST_FEATURE_TEST(GpuRasterization,
GPU_FEATURE_TYPE_GPU_RASTERIZATION)
GPU_BLACKLIST_FEATURE_TEST(OOPRasterization, GPU_FEATURE_TYPE_OOP_RASTERIZATION)
GPU_BLACKLIST_FEATURE_TEST(WebGL2,
GPU_FEATURE_TYPE_ACCELERATED_WEBGL2)
......
......@@ -23,7 +23,6 @@
#include "gpu/config/gpu_switches.h"
#include "third_party/angle/src/gpu_info_util/SystemInfo.h" // nogncheck
#include "third_party/skia/include/core/SkGraphics.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/gpu/GrContext.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
......@@ -167,7 +166,8 @@ bool CollectBasicGraphicsInfo(const base::CommandLine* command_line,
return CollectBasicGraphicsInfo(gpu_info);
}
bool CollectGraphicsInfoGL(GPUInfo* gpu_info, GpuPreferences* gpu_preferences) {
bool CollectGraphicsInfoGL(GPUInfo* gpu_info,
const GpuPreferences& gpu_preferences) {
TRACE_EVENT0("startup", "gpu_info_collector::CollectGraphicsInfoGL");
DCHECK_NE(gl::GetGLImplementation(), gl::kGLImplementationNone);
......@@ -246,11 +246,9 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info, GpuPreferences* gpu_preferences) {
}
#endif
if (gpu_preferences->enable_oop_rasterization) {
gpu_preferences->enable_oop_rasterization = SupportsOOPRaster(gl_info);
if (gpu_preferences.enable_oop_rasterization) {
gpu_info->oop_rasterization_supported = SupportsOOPRaster(gl_info);
}
gpu_info->oop_rasterization_supported =
gpu_preferences->enable_oop_rasterization;
// TODO(kbr): remove once the destruction of a current context automatically
// clears the current context.
......@@ -380,8 +378,7 @@ void FillGPUInfoFromSystemInfo(GPUInfo* gpu_info,
void CollectGraphicsInfoForTesting(GPUInfo* gpu_info) {
DCHECK(gpu_info);
#if defined(OS_ANDROID)
GpuPreferences gpu_preferences;
CollectContextGraphicsInfo(gpu_info, &gpu_preferences);
CollectContextGraphicsInfo(gpu_info, GpuPreferences());
#else
CollectBasicGraphicsInfo(gpu_info);
#endif // OS_ANDROID
......
......@@ -35,8 +35,9 @@ GPU_EXPORT bool CollectBasicGraphicsInfo(const base::CommandLine* command_line,
// Create a GL/DirectX context and collect related info.
// This is called at GPU process startup time.
GPU_EXPORT bool CollectContextGraphicsInfo(GPUInfo* gpu_info,
GpuPreferences* gpu_preferences);
GPU_EXPORT bool CollectContextGraphicsInfo(
GPUInfo* gpu_info,
const GpuPreferences& gpu_preferences);
#if defined(OS_WIN)
// Collect the DirectX Disagnostics information about the attached displays.
......@@ -46,7 +47,7 @@ GPU_EXPORT void RecordGpuSupportedRuntimeVersionHistograms(GPUInfo* gpu_info);
// Create a GL context and collect GL strings and versions.
GPU_EXPORT bool CollectGraphicsInfoGL(GPUInfo* gpu_info,
GpuPreferences* gpu_preferences);
const GpuPreferences& gpu_preferences);
// If more than one GPUs are identified, and GL strings are available,
// identify the active GPU based on GL strings.
......
......@@ -13,7 +13,7 @@
namespace gpu {
bool CollectContextGraphicsInfo(GPUInfo* gpu_info,
GpuPreferences* gpu_preferences) {
const GpuPreferences& gpu_preferences) {
// When command buffer is compiled as a standalone library, the process might
// not have a Java environment.
if (base::android::IsVMInitialized()) {
......
......@@ -9,7 +9,7 @@
namespace gpu {
bool CollectContextGraphicsInfo(GPUInfo* gpu_info,
GpuPreferences* gpu_preferences) {
const GpuPreferences& gpu_preferences) {
DCHECK(gpu_info);
TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo");
......
......@@ -10,7 +10,7 @@
namespace gpu {
bool CollectContextGraphicsInfo(GPUInfo* gpu_info,
GpuPreferences* gpu_preferences) {
const GpuPreferences& gpu_preferences) {
DCHECK(gpu_info);
TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo");
......
......@@ -10,7 +10,7 @@
namespace gpu {
bool CollectContextGraphicsInfo(GPUInfo* gpu_info,
GpuPreferences* gpu_preferences) {
const GpuPreferences& gpu_preferences) {
DCHECK(gpu_info);
TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo");
......
......@@ -208,8 +208,7 @@ INSTANTIATE_TEST_CASE_P(GPUConfig,
// be fixed.
TEST_P(GPUInfoCollectorTest, CollectGraphicsInfoGL) {
GPUInfo gpu_info;
GpuPreferences gpu_preferences;
CollectGraphicsInfoGL(&gpu_info, &gpu_preferences);
CollectGraphicsInfoGL(&gpu_info, GpuPreferences());
#if defined(OS_WIN)
if (GetParam() == kMockedWindows) {
EXPECT_EQ(test_values_.gpu.driver_vendor, gpu_info.gpu.driver_vendor);
......
......@@ -480,7 +480,7 @@ void RecordGpuSupportedRuntimeVersionHistograms(GPUInfo* gpu_info) {
}
bool CollectContextGraphicsInfo(GPUInfo* gpu_info,
GpuPreferences* gpu_preferences) {
const GpuPreferences& gpu_preferences) {
TRACE_EVENT0("gpu", "CollectGraphicsInfo");
DCHECK(gpu_info);
......
......@@ -505,7 +505,7 @@ bool PopGpuFeatureInfoCache(GpuFeatureInfo* gpu_feature_info) {
#if defined(OS_ANDROID)
bool InitializeGLThreadSafe(base::CommandLine* command_line,
GpuPreferences* gpu_preferences,
const GpuPreferences& gpu_preferences,
GPUInfo* out_gpu_info,
GpuFeatureInfo* out_gpu_feature_info) {
static base::NoDestructor<base::Lock> gl_bindings_initialization_lock;
......@@ -528,7 +528,7 @@ bool InitializeGLThreadSafe(base::CommandLine* command_line,
}
}
CollectContextGraphicsInfo(out_gpu_info, gpu_preferences);
*out_gpu_feature_info = ComputeGpuFeatureInfo(*out_gpu_info, *gpu_preferences,
*out_gpu_feature_info = ComputeGpuFeatureInfo(*out_gpu_info, gpu_preferences,
command_line, nullptr);
if (!out_gpu_feature_info->disabled_extensions.empty()) {
gl::init::SetDisabledExtensionsPlatform(
......
......@@ -60,7 +60,7 @@ GPU_EXPORT bool PopGpuFeatureInfoCache(GpuFeatureInfo* gpu_feature_info);
// GPU driver bug workaround decisions. This is intended to be called
// by Android WebView render thread and in-process GPU thread.
GPU_EXPORT bool InitializeGLThreadSafe(base::CommandLine* command_line,
GpuPreferences* gpu_preferences,
const GpuPreferences& gpu_preferences,
GPUInfo* out_gpu_info,
GpuFeatureInfo* out_gpu_feature_info);
#endif // OS_ANDROID
......
......@@ -441,6 +441,8 @@ TEST_F(StructTraitsTest, GpuFeatureInfo) {
gpu::kGpuFeatureStatusUndefined;
input.status_values[GPU_FEATURE_TYPE_GPU_RASTERIZATION] =
gpu::kGpuFeatureStatusDisabled;
input.status_values[GPU_FEATURE_TYPE_OOP_RASTERIZATION] =
gpu::kGpuFeatureStatusDisabled;
GpuFeatureInfo output;
ASSERT_TRUE(mojom::GpuFeatureInfo::Deserialize(
......
......@@ -41,7 +41,8 @@
namespace gpu {
namespace {
bool CollectGraphicsInfo(GPUInfo* gpu_info, GpuPreferences* gpu_preferences) {
bool CollectGraphicsInfo(GPUInfo* gpu_info,
const GpuPreferences& gpu_preferences) {
DCHECK(gpu_info);
TRACE_EVENT0("gpu,startup", "Collect Graphics Info");
base::TimeTicks before_collect_context_graphics_info = base::TimeTicks::Now();
......@@ -217,7 +218,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
// We need to collect GL strings (VENDOR, RENDERER) for blacklisting purposes.
if (!gl_disabled && !use_swiftshader) {
if (!CollectGraphicsInfo(&gpu_info_, &gpu_preferences_))
if (!CollectGraphicsInfo(&gpu_info_, gpu_preferences))
return false;
gpu::SetKeysForCrashLogging(gpu_info_);
gpu_feature_info_ = gpu::ComputeGpuFeatureInfo(gpu_info_, gpu_preferences,
......@@ -310,7 +311,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
gpu_preferences.disable_software_rasterizer,
false));
InitializeGLThreadSafe(command_line, &gpu_preferences_, &gpu_info_,
InitializeGLThreadSafe(command_line, gpu_preferences, &gpu_info_,
&gpu_feature_info_);
}
#else
......@@ -355,7 +356,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_preferences);
gpu_feature_info_ = ComputeGpuFeatureInfo(gpu_info_, gpu_preferences,
command_line, nullptr);
use_swiftshader = ShouldEnableSwiftShader(
......
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