Commit 22b5641e authored by kylechar's avatar kylechar Committed by Commit Bot

Improve InProcessCommandBuffer logic.

This CL implements logic from GLES2CommandBufferStub::Initialize() in
InProcessCommandBuffer::InitializeOnGpuThread(). Some differences are
not addressed and I've left TODOs instead.

Bug: 832243, 811979
Change-Id: I1139a33f594280ea4c17b3a7223391e33bc15ad6
Reviewed-on: https://chromium-review.googlesource.com/1006038Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550630}
parent bba70ff1
......@@ -172,7 +172,9 @@ void DeferredGpuCommandService::PerformAllIdleWork() {
}
}
bool DeferredGpuCommandService::UseVirtualizedGLContexts() { return true; }
bool DeferredGpuCommandService::ForceVirtualizedGLContexts() {
return true;
}
gpu::SyncPointManager* DeferredGpuCommandService::sync_point_manager() {
return sync_point_manager_.get();
......
......@@ -49,7 +49,7 @@ class DeferredGpuCommandService
void ScheduleTask(base::OnceClosure task) override;
void ScheduleDelayedWork(base::OnceClosure task) override;
bool UseVirtualizedGLContexts() override;
bool ForceVirtualizedGLContexts() override;
gpu::SyncPointManager* sync_point_manager() override;
void RunTasks();
......
......@@ -259,9 +259,9 @@ void VizMainImpl::CreateFrameSinkManagerInternal(
DCHECK(gpu_service_);
DCHECK(gpu_thread_task_runner_->BelongsToCurrentThread());
constexpr bool use_virtualized_gl_context = false;
constexpr bool force_virtualized_gl_context = false;
gpu_command_service_ = base::MakeRefCounted<gpu::GpuInProcessThreadService>(
use_virtualized_gl_context, gpu_thread_task_runner_,
force_virtualized_gl_context, gpu_thread_task_runner_,
gpu_service_->sync_point_manager(), gpu_service_->mailbox_manager(),
gpu_service_->share_group(), gpu_service_->gpu_feature_info(),
gpu_service_->gpu_channel_manager()->gpu_preferences());
......
......@@ -10,7 +10,7 @@
namespace gpu {
GpuInProcessThreadService::GpuInProcessThreadService(
bool use_virtualized_gl_context,
bool force_virtualized_gl_context,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
gpu::SyncPointManager* sync_point_manager,
gpu::MailboxManager* mailbox_manager,
......@@ -21,7 +21,7 @@ GpuInProcessThreadService::GpuInProcessThreadService(
mailbox_manager,
share_group,
gpu_feature_info),
use_virtualized_gl_context_(use_virtualized_gl_context),
force_virtualized_gl_context_(force_virtualized_gl_context),
task_runner_(task_runner),
sync_point_manager_(sync_point_manager) {}
......@@ -33,8 +33,8 @@ void GpuInProcessThreadService::ScheduleDelayedWork(base::OnceClosure task) {
task_runner_->PostDelayedTask(FROM_HERE, std::move(task),
base::TimeDelta::FromMilliseconds(2));
}
bool GpuInProcessThreadService::UseVirtualizedGLContexts() {
return use_virtualized_gl_context_;
bool GpuInProcessThreadService::ForceVirtualizedGLContexts() {
return force_virtualized_gl_context_;
}
gpu::SyncPointManager* GpuInProcessThreadService::sync_point_manager() {
......
......@@ -21,7 +21,7 @@ class GL_IN_PROCESS_CONTEXT_EXPORT GpuInProcessThreadService
public base::RefCountedThreadSafe<GpuInProcessThreadService> {
public:
GpuInProcessThreadService(
bool use_virtualized_gl_context,
bool force_virtualized_gl_context,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
gpu::SyncPointManager* sync_point_manager,
gpu::MailboxManager* mailbox_manager,
......@@ -32,7 +32,7 @@ class GL_IN_PROCESS_CONTEXT_EXPORT GpuInProcessThreadService
// gpu::InProcessCommandBuffer::Service implementation.
void ScheduleTask(base::OnceClosure task) override;
void ScheduleDelayedWork(base::OnceClosure task) override;
bool UseVirtualizedGLContexts() override;
bool ForceVirtualizedGLContexts() override;
gpu::SyncPointManager* sync_point_manager() override;
void AddRef() const override;
void Release() const override;
......@@ -43,7 +43,7 @@ class GL_IN_PROCESS_CONTEXT_EXPORT GpuInProcessThreadService
~GpuInProcessThreadService() override;
const bool use_virtualized_gl_context_;
const bool force_virtualized_gl_context_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
......
This diff is collapsed.
......@@ -237,7 +237,7 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer
// work.
virtual void ScheduleDelayedWork(base::OnceClosure task) = 0;
virtual bool UseVirtualizedGLContexts() = 0;
virtual bool ForceVirtualizedGLContexts() = 0;
virtual SyncPointManager* sync_point_manager() = 0;
virtual bool BlockThreadOnWaitSyncToken() const = 0;
......@@ -280,20 +280,20 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer
SurfaceHandle window;
const ContextCreationAttribs& attribs;
Capabilities* capabilities; // Ouptut.
InProcessCommandBuffer* context_group;
InProcessCommandBuffer* share_command_buffer;
ImageFactory* image_factory;
InitializeOnGpuThreadParams(bool is_offscreen,
SurfaceHandle window,
const ContextCreationAttribs& attribs,
Capabilities* capabilities,
InProcessCommandBuffer* share_group,
InProcessCommandBuffer* share_command_buffer,
ImageFactory* image_factory)
: is_offscreen(is_offscreen),
window(window),
attribs(attribs),
capabilities(capabilities),
context_group(share_group),
share_command_buffer(share_command_buffer),
image_factory(image_factory) {}
};
......
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