[Rendering] Allow compositor context to share resources with worker context 19/190119/1
authorChandan Padhi <c.padhi@samsung.com>
Thu, 27 Sep 2018 05:50:21 +0000 (11:20 +0530)
committerChandan Padhi <c.padhi@samsung.com>
Thu, 27 Sep 2018 05:54:38 +0000 (11:24 +0530)
This is necessary to avoid synchronization issues with produce
and consume texture which might result in black/corrupted tiles.

Change-Id: I56029521c5fa19adab9f100d85262d8e0aadfbbd
Signed-off-by: Chandan Padhi <c.padhi@samsung.com>
content/renderer/render_thread_impl.cc
content/renderer/render_thread_impl.h

index 089bc9a..ccbb4df 100644 (file)
@@ -2157,7 +2157,7 @@ void RenderThreadImpl::RequestNewLayerTreeFrameSink(
     return;
   }
 
-  scoped_refptr<viz::RasterContextProvider> worker_context_provider =
+  scoped_refptr<ui::ContextProviderCommandBuffer> worker_context_provider =
       SharedCompositorWorkerContextProvider();
   if (!worker_context_provider) {
     // Cause the compositor to wait and try again.
@@ -2193,7 +2193,7 @@ void RenderThreadImpl::RequestNewLayerTreeFrameSink(
           gpu_channel_host, GetGpuMemoryBufferManager(), kGpuStreamIdDefault,
           kGpuStreamPriorityDefault, gpu::kNullSurfaceHandle, url,
           automatic_flushes, support_locking, support_grcontext, limits,
-          attributes, nullptr /* share_context */,
+          attributes, worker_context_provider.get() /* share_context */,
           ui::command_buffer_metrics::RENDER_COMPOSITOR_CONTEXT));
 
   if (layout_test_deps_) {
@@ -2488,7 +2488,7 @@ base::TaskRunner* RenderThreadImpl::GetWorkerTaskRunner() {
   return categorized_worker_pool_.get();
 }
 
-scoped_refptr<viz::RasterContextProvider>
+scoped_refptr<ui::ContextProviderCommandBuffer>
 RenderThreadImpl::SharedCompositorWorkerContextProvider() {
   DCHECK(IsMainThread());
   // Try to reuse existing shared worker context provider.
@@ -2518,8 +2518,8 @@ RenderThreadImpl::SharedCompositorWorkerContextProvider() {
       std::move(gpu_channel_host), GetGpuMemoryBufferManager(),
       gpu::SharedMemoryLimits(), support_locking, support_gles2_interface,
       support_raster_interface, support_oop_rasterization, support_grcontext,
-      ui::command_buffer_metrics::RENDER_WORKER_CONTEXT, kGpuStreamIdWorker,
-      kGpuStreamPriorityWorker);
+      ui::command_buffer_metrics::RENDER_WORKER_CONTEXT, kGpuStreamIdDefault,
+      kGpuStreamPriorityDefault);
   auto result = shared_worker_context_provider_->BindToCurrentThread();
   if (result != gpu::ContextResult::kSuccess)
     shared_worker_context_provider_ = nullptr;
index b88425f..fb29658 100644 (file)
@@ -416,7 +416,7 @@ class CONTENT_EXPORT RenderThreadImpl
 
   // Returns a worker context provider that will be bound on the compositor
   // thread.
-  scoped_refptr<viz::RasterContextProvider>
+  scoped_refptr<ui::ContextProviderCommandBuffer>
   SharedCompositorWorkerContextProvider();
 
   // Causes the idle handler to skip sending idle notifications
@@ -750,7 +750,8 @@ class CONTENT_EXPORT RenderThreadImpl
 
   base::ObserverList<RenderThreadObserver> observers_;
 
-  scoped_refptr<viz::RasterContextProvider> shared_worker_context_provider_;
+  scoped_refptr<ui::ContextProviderCommandBuffer>
+      shared_worker_context_provider_;
 
   std::unique_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_;