Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(923)

Unified Diff: content/renderer/render_thread_impl.cc

Issue 1949023005: gpu: Add flag for enabling asynchronous worker context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase fix Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index c81e108be2fee15ac2e233e91f3a4035618ed098..e9d569bc8110441467768a403485bfa96a0a174b 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -403,7 +403,9 @@ void StringToUintVector(const std::string& str, std::vector<unsigned>* vector) {
scoped_refptr<ContextProviderCommandBuffer> CreateOffscreenContext(
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
- command_buffer_metrics::ContextType type) {
+ command_buffer_metrics::ContextType type,
+ int32_t stream_id,
+ gpu::GpuStreamPriority stream_priority) {
DCHECK(gpu_channel_host);
// This is used to create a few different offscreen contexts:
// - The shared main thread context (offscreen) used by blink for canvas.
@@ -418,9 +420,10 @@ scoped_refptr<ContextProviderCommandBuffer> CreateOffscreenContext(
attributes.sample_buffers = 0;
attributes.bind_generates_resource = false;
attributes.lose_context_when_out_of_memory = true;
- constexpr bool automatic_flushes = false;
+ const bool automatic_flushes = false;
return make_scoped_refptr(new ContextProviderCommandBuffer(
- std::move(gpu_channel_host), gpu::kNullSurfaceHandle,
+ std::move(gpu_channel_host), stream_id, stream_priority,
+ gpu::kNullSurfaceHandle,
GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext"),
gfx::PreferIntegratedGpu, automatic_flushes, gpu::SharedMemoryLimits(),
attributes, nullptr, type));
@@ -743,6 +746,8 @@ void RenderThreadImpl::Init(
command_line.HasSwitch(switches::kEnableGpuRasterization);
is_gpu_rasterization_forced_ =
command_line.HasSwitch(switches::kForceGpuRasterization);
+ is_async_worker_context_enabled_ =
+ command_line.HasSwitch(switches::kEnableGpuAsyncWorkerContext);
if (command_line.HasSwitch(switches::kGpuRasterizationMSAASampleCount)) {
std::string string_value = command_line.GetSwitchValueASCII(
@@ -1447,7 +1452,8 @@ RenderThreadImpl::SharedMainThreadContextProvider() {
shared_main_thread_contexts_ = CreateOffscreenContext(
std::move(gpu_channel_host),
- command_buffer_metrics::RENDERER_MAINTHREAD_CONTEXT);
+ command_buffer_metrics::RENDERER_MAINTHREAD_CONTEXT,
+ gpu::GPU_STREAM_DEFAULT, gpu::GpuStreamPriority::NORMAL);
if (!shared_main_thread_contexts_->BindToCurrentThread())
shared_main_thread_contexts_ = nullptr;
return shared_main_thread_contexts_;
@@ -1527,6 +1533,10 @@ bool RenderThreadImpl::IsGpuRasterizationEnabled() {
return is_gpu_rasterization_enabled_;
}
+bool RenderThreadImpl::IsAsyncWorkerContextEnabled() {
+ return is_async_worker_context_enabled_;
+}
+
int RenderThreadImpl::GetGpuRasterizationMSAASampleCount() {
return gpu_rasterization_msaa_sample_count_;
}
@@ -1952,9 +1962,17 @@ RenderThreadImpl::SharedWorkerContextProvider() {
return shared_worker_context_provider_;
}
+ int32_t stream_id = gpu::GPU_STREAM_DEFAULT;
+ gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL;
+ if (is_async_worker_context_enabled_) {
+ stream_id = gpu_channel_host->GenerateStreamID();
+ stream_priority = gpu::GpuStreamPriority::LOW;
+ }
+
shared_worker_context_provider_ =
CreateOffscreenContext(std::move(gpu_channel_host),
- command_buffer_metrics::RENDER_WORKER_CONTEXT);
+ command_buffer_metrics::RENDER_WORKER_CONTEXT,
+ stream_id, stream_priority);
if (!shared_worker_context_provider_->BindToCurrentThread())
shared_worker_context_provider_ = nullptr;
if (shared_worker_context_provider_)
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698