summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-27 01:18:35 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-27 01:18:35 +0000
commit744e079897d430c91b18352c8e200bbeeadffe8b (patch)
tree2d75297b938cd2e21586455340240c5b9e88bf32 /gpu
parent7ba34a0114537b08164b4f44943ec5c25aac9417 (diff)
downloadchromium_src-744e079897d430c91b18352c8e200bbeeadffe8b.zip
chromium_src-744e079897d430c91b18352c8e200bbeeadffe8b.tar.gz
chromium_src-744e079897d430c91b18352c8e200bbeeadffe8b.tar.bz2
Make *CommandBufferProxy* implement GpuControl
GpuControl is where we will pipe out-of-band stuff, that is currently done in each of the WGC3D implementations, but we want to move down into GLES2Implementation. This is essentially just a refactoring, since the current GpuControl only deals with GpuMemoryBuffer that's not available out-of-process, but we can then add things like GenerateMailboxes, Ensure/DiscardBackbuffer or callback stuff on top. BUG=181120 R=dmichael@chromium.org, sievers@chromium.org Review URL: https://codereview.chromium.org/24711002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/client_test_helper.h1
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc4
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest.cc4
-rw-r--r--gpu/command_buffer/common/gpu_control.h3
-rw-r--r--gpu/command_buffer/service/gpu_control_service.cc4
-rw-r--r--gpu/command_buffer/service/gpu_control_service.h2
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.cc6
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.h2
-rw-r--r--gpu/gles2_conform_support/egl/display.cc4
-rw-r--r--gpu/gles2_conform_support/egl/display.h2
10 files changed, 30 insertions, 2 deletions
diff --git a/gpu/command_buffer/client/client_test_helper.h b/gpu/command_buffer/client/client_test_helper.h
index e9d6c36..e3c35f3 100644
--- a/gpu/command_buffer/client/client_test_helper.h
+++ b/gpu/command_buffer/client/client_test_helper.h
@@ -87,6 +87,7 @@ class MockClientGpuControl : public GpuControl {
MockClientGpuControl();
virtual ~MockClientGpuControl();
+ MOCK_METHOD0(SupportsGpuMemoryBuffer, bool());
MOCK_METHOD4(CreateGpuMemoryBuffer,
gfx::GpuMemoryBuffer*(size_t width,
size_t height,
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 0bee1ed..54e47a5 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -22,6 +22,7 @@
#include "gpu/command_buffer/client/transfer_buffer.h"
#include "gpu/command_buffer/client/vertex_array_object_manager.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
+#include "gpu/command_buffer/common/gpu_control.h"
#include "gpu/command_buffer/common/trace_event.h"
#include "ui/gfx/gpu_memory_buffer.h"
@@ -113,6 +114,7 @@ GLES2Implementation::GLES2Implementation(
gpu_control_(gpu_control) {
GPU_DCHECK(helper);
GPU_DCHECK(transfer_buffer);
+ GPU_DCHECK(gpu_control);
char temp[128];
sprintf(temp, "%p", static_cast<void*>(this));
@@ -2090,7 +2092,7 @@ const GLubyte* GLES2Implementation::GetStringHelper(GLenum name) {
"GL_CHROMIUM_map_sub "
"GL_CHROMIUM_shallow_flush "
"GL_EXT_unpack_subimage";
- if (gpu_control_ != NULL) {
+ if (gpu_control_->SupportsGpuMemoryBuffer()) {
// The first space character is intentional.
str += " GL_CHROMIUM_map_image";
}
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index 84fa749..e92f5e22 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -2504,6 +2504,8 @@ TEST_F(GLES2ImplementationTest, GetString) {
char buf[sizeof(kString) + 1];
memset(buf, kBad, sizeof(buf));
+ EXPECT_CALL(*gpu_control_.get(), SupportsGpuMemoryBuffer())
+ .WillOnce(Return(true));
EXPECT_CALL(*command_buffer(), OnFlush())
.WillOnce(DoAll(SetMemory(result1.ptr, uint32(sizeof(kString))),
SetMemory(mem1.ptr, kString)))
@@ -2540,6 +2542,8 @@ TEST_F(GLES2ImplementationTest, PixelStoreiGLPackReverseRowOrderANGLE) {
expected.set_bucket_size2.Init(kBucketId, 0);
expected.pixel_store.Init(GL_PACK_REVERSE_ROW_ORDER_ANGLE, 1);
+ EXPECT_CALL(*gpu_control_.get(), SupportsGpuMemoryBuffer())
+ .WillOnce(Return(false));
EXPECT_CALL(*command_buffer(), OnFlush())
.WillOnce(DoAll(SetMemory(result1.ptr, uint32(sizeof(kString))),
SetMemory(mem1.ptr, kString)))
diff --git a/gpu/command_buffer/common/gpu_control.h b/gpu/command_buffer/common/gpu_control.h
index 5534ca7..503c745 100644
--- a/gpu/command_buffer/common/gpu_control.h
+++ b/gpu/command_buffer/common/gpu_control.h
@@ -5,6 +5,7 @@
#ifndef GPU_COMMAND_BUFFER_COMMON_GPU_CONTROL_H_
#define GPU_COMMAND_BUFFER_COMMON_GPU_CONTROL_H_
+#include "gpu/command_buffer/common/types.h"
#include "gpu/gpu_export.h"
namespace gfx {
@@ -19,6 +20,8 @@ class GPU_EXPORT GpuControl {
GpuControl() {}
virtual ~GpuControl() {}
+ virtual bool SupportsGpuMemoryBuffer() = 0;
+
// Create a gpu memory buffer of the given dimensions and format. Returns
// its ID or -1 on error.
virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(
diff --git a/gpu/command_buffer/service/gpu_control_service.cc b/gpu/command_buffer/service/gpu_control_service.cc
index d368ff9..64ea261 100644
--- a/gpu/command_buffer/service/gpu_control_service.cc
+++ b/gpu/command_buffer/service/gpu_control_service.cc
@@ -19,6 +19,10 @@ GpuControlService::GpuControlService(
GpuControlService::~GpuControlService() {
}
+bool GpuControlService::SupportsGpuMemoryBuffer() {
+ return gpu_memory_buffer_manager_ && gpu_memory_buffer_factory_;
+}
+
gfx::GpuMemoryBuffer* GpuControlService::CreateGpuMemoryBuffer(
size_t width,
size_t height,
diff --git a/gpu/command_buffer/service/gpu_control_service.h b/gpu/command_buffer/service/gpu_control_service.h
index a12fee46..6b781f8 100644
--- a/gpu/command_buffer/service/gpu_control_service.h
+++ b/gpu/command_buffer/service/gpu_control_service.h
@@ -22,6 +22,8 @@ class GPU_EXPORT GpuControlService : public GpuControl {
virtual ~GpuControlService();
// Overridden from GpuControl:
+ virtual bool SupportsGpuMemoryBuffer() OVERRIDE;
+
virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(
size_t width,
size_t height,
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 972533c..778ca7d 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -242,6 +242,7 @@ InProcessCommandBuffer::InProcessCommandBuffer()
: context_lost_(false),
share_group_id_(0),
last_put_offset_(-1),
+ supports_gpu_memory_buffer_(false),
flush_event_(false, false),
queue_(CreateSchedulerClient()) {}
@@ -406,6 +407,7 @@ bool InProcessCommandBuffer::InitializeOnGpuThread(
gpu_control_.reset(
new GpuControlService(decoder_->GetContextGroup()->image_manager(),
g_gpu_memory_buffer_factory));
+ supports_gpu_memory_buffer_ = gpu_control_->SupportsGpuMemoryBuffer();
decoder_->set_engine(gpu_scheduler_.get());
@@ -647,6 +649,10 @@ void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point,
QueueTask(WrapCallback(callback));
}
+bool InProcessCommandBuffer::SupportsGpuMemoryBuffer() {
+ return supports_gpu_memory_buffer_;
+}
+
gfx::GpuMemoryBuffer* InProcessCommandBuffer::CreateGpuMemoryBuffer(
size_t width,
size_t height,
diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h
index e63e11a..96f2642 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.h
+++ b/gpu/command_buffer/service/in_process_command_buffer.h
@@ -110,6 +110,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
virtual gpu::error::Error GetLastError() OVERRIDE;
// GpuControl implementation:
+ virtual bool SupportsGpuMemoryBuffer() OVERRIDE;
virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(
size_t width,
size_t height,
@@ -165,6 +166,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
// Members accessed on the client thread:
State last_state_;
int32 last_put_offset_;
+ bool supports_gpu_memory_buffer_;
// Accessed on both threads:
scoped_ptr<CommandBuffer> command_buffer_;
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc
index 87bd809..cdc4fdb 100644
--- a/gpu/gles2_conform_support/egl/display.cc
+++ b/gpu/gles2_conform_support/egl/display.cc
@@ -11,6 +11,7 @@
#include "gpu/command_buffer/client/gles2_lib.h"
#include "gpu/command_buffer/client/transfer_buffer.h"
#include "gpu/command_buffer/service/context_group.h"
+#include "gpu/command_buffer/service/gpu_control_service.h"
#include "gpu/command_buffer/service/transfer_buffer_manager.h"
#include "gpu/gles2_conform_support/egl/config.h"
#include "gpu/gles2_conform_support/egl/surface.h"
@@ -122,6 +123,7 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config,
gpu_scheduler_.reset(new gpu::GpuScheduler(command_buffer.get(),
decoder_.get(),
NULL));
+ gpu_control_.reset(new gpu::GpuControlService(NULL, NULL));
decoder_->set_engine(gpu_scheduler_.get());
gfx::Size size(create_offscreen_width_, create_offscreen_height_);
@@ -228,7 +230,7 @@ EGLContext Display::CreateContext(EGLConfig config,
NULL,
transfer_buffer_.get(),
true,
- NULL));
+ gpu_control_.get()));
if (!context_->Initialize(
kTransferBufferSize,
diff --git a/gpu/gles2_conform_support/egl/display.h b/gpu/gles2_conform_support/egl/display.h
index 251904c..f7c0ff3 100644
--- a/gpu/gles2_conform_support/egl/display.h
+++ b/gpu/gles2_conform_support/egl/display.h
@@ -18,6 +18,7 @@
namespace gpu {
class CommandBufferService;
+class GpuControl;
class GpuScheduler;
class TransferBuffer;
class TransferBufferManagerInterface;
@@ -83,6 +84,7 @@ class Display {
scoped_ptr<gpu::CommandBufferService> command_buffer_;
scoped_ptr<gpu::GpuScheduler> gpu_scheduler_;
scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
+ scoped_ptr<gpu::GpuControl> gpu_control_;
scoped_refptr<gfx::GLContext> gl_context_;
scoped_refptr<gfx::GLSurface> gl_surface_;
scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_;