Commit f3fd3216 authored by Sunny Sachanandani's avatar Sunny Sachanandani Committed by Commit Bot

Enable automatic flush for canvas context

Automatically growing transfer buffer removed the flush when it would
run of space.  This decreased canvas throughput by reducing pipelining.

Automatic flushes are another way of improving throughput by submitting
work to the GPU process often.  This CL enables automatic flushes for
the shared main thread context used for canvas which might have been
disabled unintentionally.

Bug: 880901
Change-Id: Ib48d9c56c18c9e2d449d7c42f74b16609ad3ea55
Reviewed-on: https://chromium-review.googlesource.com/1213665Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589688}
parent fc143229
...@@ -336,6 +336,7 @@ scoped_refptr<ws::ContextProviderCommandBuffer> CreateOffscreenContext( ...@@ -336,6 +336,7 @@ scoped_refptr<ws::ContextProviderCommandBuffer> CreateOffscreenContext(
bool support_raster_interface, bool support_raster_interface,
bool support_oop_rasterization, bool support_oop_rasterization,
bool support_grcontext, bool support_grcontext,
bool automatic_flushes,
ws::command_buffer_metrics::ContextType type, ws::command_buffer_metrics::ContextType type,
int32_t stream_id, int32_t stream_id,
gpu::SchedulingPriority stream_priority) { gpu::SchedulingPriority stream_priority) {
...@@ -361,8 +362,6 @@ scoped_refptr<ws::ContextProviderCommandBuffer> CreateOffscreenContext( ...@@ -361,8 +362,6 @@ scoped_refptr<ws::ContextProviderCommandBuffer> CreateOffscreenContext(
attributes.enable_oop_rasterization = support_oop_rasterization && attributes.enable_oop_rasterization = support_oop_rasterization &&
support_raster_interface && support_raster_interface &&
!support_gles2_interface; !support_gles2_interface;
const bool automatic_flushes = false;
return base::MakeRefCounted<ws::ContextProviderCommandBuffer>( return base::MakeRefCounted<ws::ContextProviderCommandBuffer>(
std::move(gpu_channel_host), gpu_memory_buffer_manager, stream_id, std::move(gpu_channel_host), gpu_memory_buffer_manager, stream_id,
stream_priority, gpu::kNullSurfaceHandle, stream_priority, gpu::kNullSurfaceHandle,
...@@ -1334,13 +1333,14 @@ media::GpuVideoAcceleratorFactories* RenderThreadImpl::GetGpuFactories() { ...@@ -1334,13 +1333,14 @@ media::GpuVideoAcceleratorFactories* RenderThreadImpl::GetGpuFactories() {
bool support_raster_interface = false; bool support_raster_interface = false;
bool support_oop_rasterization = false; bool support_oop_rasterization = false;
bool support_grcontext = false; bool support_grcontext = false;
bool automatic_flushes = false;
scoped_refptr<ws::ContextProviderCommandBuffer> media_context_provider = scoped_refptr<ws::ContextProviderCommandBuffer> media_context_provider =
CreateOffscreenContext(gpu_channel_host, GetGpuMemoryBufferManager(), CreateOffscreenContext(
limits, support_locking, support_gles2_interface, gpu_channel_host, GetGpuMemoryBufferManager(), limits,
support_raster_interface, support_locking, support_gles2_interface, support_raster_interface,
support_oop_rasterization, support_grcontext, support_oop_rasterization, support_grcontext, automatic_flushes,
ws::command_buffer_metrics::ContextType::MEDIA, ws::command_buffer_metrics::ContextType::MEDIA, kGpuStreamIdMedia,
kGpuStreamIdMedia, kGpuStreamPriorityMedia); kGpuStreamPriorityMedia);
const bool enable_video_accelerator = const bool enable_video_accelerator =
!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode) && !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode) &&
...@@ -1402,10 +1402,11 @@ RenderThreadImpl::GetVideoFrameCompositorContextProvider( ...@@ -1402,10 +1402,11 @@ RenderThreadImpl::GetVideoFrameCompositorContextProvider(
bool support_raster_interface = false; bool support_raster_interface = false;
bool support_oop_rasterization = false; bool support_oop_rasterization = false;
bool support_grcontext = false; bool support_grcontext = false;
bool automatic_flushes = false;
video_frame_compositor_context_provider_ = CreateOffscreenContext( video_frame_compositor_context_provider_ = CreateOffscreenContext(
gpu_channel_host, GetGpuMemoryBufferManager(), limits, support_locking, gpu_channel_host, GetGpuMemoryBufferManager(), limits, support_locking,
support_gles2_interface, support_raster_interface, support_gles2_interface, support_raster_interface,
support_oop_rasterization, support_grcontext, support_oop_rasterization, support_grcontext, automatic_flushes,
ws::command_buffer_metrics::ContextType::RENDER_COMPOSITOR, ws::command_buffer_metrics::ContextType::RENDER_COMPOSITOR,
kGpuStreamIdMedia, kGpuStreamPriorityMedia); kGpuStreamIdMedia, kGpuStreamPriorityMedia);
return video_frame_compositor_context_provider_; return video_frame_compositor_context_provider_;
...@@ -1431,10 +1432,14 @@ RenderThreadImpl::SharedMainThreadContextProvider() { ...@@ -1431,10 +1432,14 @@ RenderThreadImpl::SharedMainThreadContextProvider() {
bool support_raster_interface = false; bool support_raster_interface = false;
bool support_oop_rasterization = false; bool support_oop_rasterization = false;
bool support_grcontext = true; bool support_grcontext = true;
// Enable automatic flushes to improve canvas throughput.
// See https://crbug.com/880901
bool automatic_flushes = true;
shared_main_thread_contexts_ = CreateOffscreenContext( shared_main_thread_contexts_ = CreateOffscreenContext(
std::move(gpu_channel_host), GetGpuMemoryBufferManager(), std::move(gpu_channel_host), GetGpuMemoryBufferManager(),
gpu::SharedMemoryLimits(), support_locking, support_gles2_interface, gpu::SharedMemoryLimits(), support_locking, support_gles2_interface,
support_raster_interface, support_oop_rasterization, support_grcontext, support_raster_interface, support_oop_rasterization, support_grcontext,
automatic_flushes,
ws::command_buffer_metrics::ContextType::RENDERER_MAIN_THREAD, ws::command_buffer_metrics::ContextType::RENDERER_MAIN_THREAD,
kGpuStreamIdDefault, kGpuStreamPriorityDefault); kGpuStreamIdDefault, kGpuStreamPriorityDefault);
auto result = shared_main_thread_contexts_->BindToCurrentThread(); auto result = shared_main_thread_contexts_->BindToCurrentThread();
...@@ -2315,6 +2320,7 @@ RenderThreadImpl::SharedCompositorWorkerContextProvider() { ...@@ -2315,6 +2320,7 @@ RenderThreadImpl::SharedCompositorWorkerContextProvider() {
bool support_gles2_interface = !support_oop_rasterization; bool support_gles2_interface = !support_oop_rasterization;
bool support_raster_interface = true; bool support_raster_interface = true;
bool support_grcontext = !support_oop_rasterization; bool support_grcontext = !support_oop_rasterization;
bool automatic_flushes = false;
auto shared_memory_limits = auto shared_memory_limits =
support_oop_rasterization ? gpu::SharedMemoryLimits::ForOOPRasterContext() support_oop_rasterization ? gpu::SharedMemoryLimits::ForOOPRasterContext()
: gpu::SharedMemoryLimits(); : gpu::SharedMemoryLimits();
...@@ -2322,7 +2328,7 @@ RenderThreadImpl::SharedCompositorWorkerContextProvider() { ...@@ -2322,7 +2328,7 @@ RenderThreadImpl::SharedCompositorWorkerContextProvider() {
std::move(gpu_channel_host), GetGpuMemoryBufferManager(), std::move(gpu_channel_host), GetGpuMemoryBufferManager(),
shared_memory_limits, support_locking, support_gles2_interface, shared_memory_limits, support_locking, support_gles2_interface,
support_raster_interface, support_oop_rasterization, support_grcontext, support_raster_interface, support_oop_rasterization, support_grcontext,
ws::command_buffer_metrics::ContextType::RENDER_WORKER, automatic_flushes, ws::command_buffer_metrics::ContextType::RENDER_WORKER,
kGpuStreamIdWorker, kGpuStreamPriorityWorker); kGpuStreamIdWorker, kGpuStreamPriorityWorker);
auto result = shared_worker_context_provider_->BindToCurrentThread(); auto result = shared_worker_context_provider_->BindToCurrentThread();
if (result != gpu::ContextResult::kSuccess) if (result != gpu::ContextResult::kSuccess)
......
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