summaryrefslogtreecommitdiffstats
path: root/content/common/gpu/gpu_command_buffer_stub.cc
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-22 23:13:09 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-22 23:13:09 +0000
commitbc10f46abc6b4d6338fd1819b0360bc9115846f2 (patch)
tree34595adeaffa513af37b0caa4e9afd05cfcf65d0 /content/common/gpu/gpu_command_buffer_stub.cc
parent9f67dd0edac097ff862e9f92e988da2f5cb19348 (diff)
downloadchromium_src-bc10f46abc6b4d6338fd1819b0360bc9115846f2.zip
chromium_src-bc10f46abc6b4d6338fd1819b0360bc9115846f2.tar.gz
chromium_src-bc10f46abc6b4d6338fd1819b0360bc9115846f2.tar.bz2
Add multi-process GpuMemoryBuffer framework.
This adds a multi-process framework for reading/writing directly to memory that the 3D graphics hardware can use for rendering without any costly copying having to be done on the GPU process side. A GpuMemoryBuffer is a type of shared memory that can be accessed by the GPU. The high level procedure required to allocate this type of memory is almost exactly the same as that for standard shared memory. Only the browser process can allocated the memory and it needs to be shared and registered with the GPU process before it can be used. This also adds a GpuMemoryBuffer type that is backed by standard shared memory for testing purposes. TEST=gpu_unittests --gtest_filter=MockGpuMemoryBufferTest.Lifecycle BUG=261649 Review URL: https://codereview.chromium.org/19762004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230248 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/gpu/gpu_command_buffer_stub.cc')
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index 05792bf..9030ffe 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -26,6 +26,8 @@
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/service/gl_context_virtual.h"
#include "gpu/command_buffer/service/gl_state_restorer_impl.h"
+#include "gpu/command_buffer/service/gpu_control_service.h"
+#include "gpu/command_buffer/service/image_manager.h"
#include "gpu/command_buffer/service/logger.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/command_buffer/service/query_manager.h"
@@ -223,6 +225,10 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(
GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback,
OnSetClientHasMemoryAllocationChangedCallback)
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterGpuMemoryBuffer,
+ OnRegisterGpuMemoryBuffer);
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyGpuMemoryBuffer,
+ OnDestroyGpuMemoryBuffer);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -403,6 +409,12 @@ void GpuCommandBufferStub::OnInitialize(
return;
}
+ gpu_control_.reset(
+ new gpu::GpuControlService(context_group_->image_manager(),
+ NULL,
+ context_group_->mailbox_manager(),
+ NULL));
+
decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get()));
scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(),
@@ -848,6 +860,28 @@ void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback(
}
}
+void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer(
+ int32 id,
+ gfx::GpuMemoryBufferHandle gpu_memory_buffer,
+ uint32 width,
+ uint32 height,
+ uint32 internalformat) {
+ TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterGpuMemoryBuffer");
+ if (gpu_control_) {
+ gpu_control_->RegisterGpuMemoryBuffer(id,
+ gpu_memory_buffer,
+ width,
+ height,
+ internalformat);
+ }
+}
+
+void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) {
+ TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyGpuMemoryBuffer");
+ if (gpu_control_)
+ gpu_control_->DestroyGpuMemoryBuffer(id);
+}
+
void GpuCommandBufferStub::SendConsoleMessage(
int32 id,
const std::string& message) {