Commit 46ff58ff authored by kylechar's avatar kylechar Committed by Commit Bot

Enable OOP-R for browser UI without viz.

Ensure that browser process raster context has the same logic for when
to use OOP-R if viz is enabled or disabled. This copies the logic from
VizProcessTransportFactory into SharedWorkerContextProviderFactory.

This change will only impact Chrome OS as it's the only platform that
still uses the viz disabled path.

Bug: 995885
Change-Id: I2d78052e4d515967496a054545b83e24c23592d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1800308
Commit-Queue: kylechar <kylechar@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696162}
parent c1c6f44b
...@@ -49,7 +49,7 @@ namespace { ...@@ -49,7 +49,7 @@ namespace {
// child process client id. // child process client id.
constexpr uint32_t kBrowserClientId = 0u; constexpr uint32_t kBrowserClientId = 0u;
scoped_refptr<viz::ContextProviderCommandBuffer> CreateContextProviderImpl( scoped_refptr<viz::ContextProviderCommandBuffer> CreateContextProvider(
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
bool support_locking, bool support_locking,
...@@ -410,23 +410,20 @@ VizProcessTransportFactory::TryCreateContextsForGpuCompositing( ...@@ -410,23 +410,20 @@ VizProcessTransportFactory::TryCreateContextsForGpuCompositing(
worker_context_provider_.reset(); worker_context_provider_.reset();
bool enable_oop_rasterization = bool enable_oop_rasterization =
features::IsUiGpuRasterizationEnabled() &&
gpu_feature_info.status_values[gpu::GPU_FEATURE_TYPE_OOP_RASTERIZATION] == gpu_feature_info.status_values[gpu::GPU_FEATURE_TYPE_OOP_RASTERIZATION] ==
gpu::kGpuFeatureStatusEnabled; gpu::kGpuFeatureStatusEnabled;
bool enable_gpu_rasterization =
features::IsUiGpuRasterizationEnabled() && !enable_oop_rasterization;
if (!worker_context_provider_) { if (!worker_context_provider_) {
constexpr bool kSharedWorkerContextSupportsLocking = true; worker_context_provider_ = CreateContextProvider(
constexpr bool kSharedWorkerContextSupportsRaster = true;
const bool kSharedWorkerContextSupportsGLES2 =
features::IsUiGpuRasterizationEnabled() && !enable_oop_rasterization;
const bool kSharedWorkerContextSupportsGrContext =
features::IsUiGpuRasterizationEnabled() && !enable_oop_rasterization;
const bool kSharedWorkerContextSupportsOOPR = enable_oop_rasterization;
worker_context_provider_ = CreateContextProviderImpl(
gpu_channel_host, GetGpuMemoryBufferManager(), gpu_channel_host, GetGpuMemoryBufferManager(),
kSharedWorkerContextSupportsLocking, kSharedWorkerContextSupportsGLES2, /*supports_locking=*/true,
kSharedWorkerContextSupportsRaster, /*supports_gles2=*/enable_gpu_rasterization,
kSharedWorkerContextSupportsGrContext, kSharedWorkerContextSupportsOOPR, /*supports_raster=*/true,
/*supports_grcontext=*/enable_gpu_rasterization,
/*supports_oopr=*/enable_oop_rasterization,
viz::command_buffer_metrics::ContextType::BROWSER_WORKER); viz::command_buffer_metrics::ContextType::BROWSER_WORKER);
// Don't observer context loss on |worker_context_provider_| here, that is // Don't observer context loss on |worker_context_provider_| here, that is
...@@ -452,7 +449,7 @@ VizProcessTransportFactory::TryCreateContextsForGpuCompositing( ...@@ -452,7 +449,7 @@ VizProcessTransportFactory::TryCreateContextsForGpuCompositing(
constexpr bool kCompositorContextSupportsGrContext = true; constexpr bool kCompositorContextSupportsGrContext = true;
constexpr bool kCompositorContextSupportsOOPR = false; constexpr bool kCompositorContextSupportsOOPR = false;
main_context_provider_ = CreateContextProviderImpl( main_context_provider_ = CreateContextProvider(
std::move(gpu_channel_host), GetGpuMemoryBufferManager(), std::move(gpu_channel_host), GetGpuMemoryBufferManager(),
kCompositorContextSupportsLocking, kCompositorContextSupportsGLES2, kCompositorContextSupportsLocking, kCompositorContextSupportsGLES2,
kCompositorContextSupportsRaster, kCompositorContextSupportsGrContext, kCompositorContextSupportsRaster, kCompositorContextSupportsGrContext,
......
...@@ -50,18 +50,28 @@ gpu::ContextResult SharedWorkerContextProviderFactory::Validate( ...@@ -50,18 +50,28 @@ gpu::ContextResult SharedWorkerContextProviderFactory::Validate(
if (provider_) if (provider_)
return gpu::ContextResult::kSuccess; return gpu::ContextResult::kSuccess;
const auto& gpu_feature_info = gpu_channel_host->gpu_feature_info();
bool enable_oop_rasterization =
features::IsUiGpuRasterizationEnabled() &&
gpu_feature_info.status_values[gpu::GPU_FEATURE_TYPE_OOP_RASTERIZATION] ==
gpu::kGpuFeatureStatusEnabled;
bool enable_gpu_rasterization =
features::IsUiGpuRasterizationEnabled() && !enable_oop_rasterization;
// TODO(crbug.com/909568): refactor // TODO(crbug.com/909568): refactor
// RenderThreadImpl::SharedCompositorWorkerContextProvider to use this. // RenderThreadImpl::SharedCompositorWorkerContextProvider to use this.
const bool need_alpha_channel = false; const bool need_alpha_channel = false;
const bool support_locking = true; const bool support_locking = true;
const bool support_gles2_interface = features::IsUiGpuRasterizationEnabled(); const bool support_gles2_interface = enable_gpu_rasterization;
const bool support_raster_interface = true; const bool support_raster_interface = true;
const bool support_grcontext = features::IsUiGpuRasterizationEnabled(); const bool support_grcontext = enable_gpu_rasterization;
const bool support_oopr = enable_oop_rasterization;
provider_ = CreateContextProvider( provider_ = CreateContextProvider(
std::move(gpu_channel_host), gpu_memory_buffer_manager, std::move(gpu_channel_host), gpu_memory_buffer_manager,
gpu::kNullSurfaceHandle, need_alpha_channel, false /* support_stencil */, gpu::kNullSurfaceHandle, need_alpha_channel, /*support_stencil=*/false,
support_locking, support_gles2_interface, support_raster_interface, support_locking, support_gles2_interface, support_raster_interface,
support_grcontext, context_type_); support_grcontext, support_oopr, context_type_);
auto result = provider_->BindToCurrentThread(); auto result = provider_->BindToCurrentThread();
if (result != gpu::ContextResult::kSuccess) if (result != gpu::ContextResult::kSuccess)
provider_ = nullptr; provider_ = nullptr;
...@@ -79,6 +89,7 @@ SharedWorkerContextProviderFactory::CreateContextProvider( ...@@ -79,6 +89,7 @@ SharedWorkerContextProviderFactory::CreateContextProvider(
bool support_gles2_interface, bool support_gles2_interface,
bool support_raster_interface, bool support_raster_interface,
bool support_grcontext, bool support_grcontext,
bool support_oopr,
command_buffer_metrics::ContextType type) { command_buffer_metrics::ContextType type) {
DCHECK(gpu_channel_host); DCHECK(gpu_channel_host);
...@@ -93,7 +104,7 @@ SharedWorkerContextProviderFactory::CreateContextProvider( ...@@ -93,7 +104,7 @@ SharedWorkerContextProviderFactory::CreateContextProvider(
attributes.buffer_preserved = false; attributes.buffer_preserved = false;
attributes.enable_gles2_interface = support_gles2_interface; attributes.enable_gles2_interface = support_gles2_interface;
attributes.enable_raster_interface = support_raster_interface; attributes.enable_raster_interface = support_raster_interface;
attributes.enable_oop_rasterization = support_oopr;
gpu::SharedMemoryLimits memory_limits = gpu::SharedMemoryLimits memory_limits =
gpu::SharedMemoryLimits::ForDisplayCompositor(); gpu::SharedMemoryLimits::ForDisplayCompositor();
......
...@@ -63,6 +63,7 @@ class SharedWorkerContextProviderFactory { ...@@ -63,6 +63,7 @@ class SharedWorkerContextProviderFactory {
bool support_gles2_interface, bool support_gles2_interface,
bool support_raster_interface, bool support_raster_interface,
bool support_grcontext, bool support_grcontext,
bool support_oopr,
command_buffer_metrics::ContextType type); command_buffer_metrics::ContextType type);
const int32_t stream_id_; const int32_t stream_id_;
......
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