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

Unified Diff: content/common/gpu/client/command_buffer_proxy_impl.cc

Issue 177953004: Enable SurfaceTexture based zero-copy texture uploading on Android platform Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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
Index: content/common/gpu/client/command_buffer_proxy_impl.cc
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc
index 631eea96641ac85446e394e408e527a1982ef29c..191984bc6157c88d4212aad01ee39499d9f81ef5 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -5,6 +5,7 @@
#include "content/common/gpu/client/command_buffer_proxy_impl.h"
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/shared_memory.h"
@@ -14,6 +15,7 @@
#include "content/common/gpu/client/gpu_video_decode_accelerator_host.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/common/view_messages.h"
+#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/common/cmd_buffer_common.h"
#include "gpu/command_buffer/common/command_buffer_shared.h"
#include "gpu/command_buffer/common/gpu_memory_allocation.h"
@@ -381,10 +383,8 @@ gfx::GpuMemoryBuffer* CommandBufferProxyImpl::CreateGpuMemoryBuffer(
if (last_state_.error != gpu::error::kNoError)
return NULL;
-
int32 new_id = channel_->ReserveGpuMemoryBufferId();
DCHECK(gpu_memory_buffers_.find(new_id) == gpu_memory_buffers_.end());
-
scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer(
channel_->factory()->AllocateGpuMemoryBuffer(width,
height,
@@ -398,10 +398,28 @@ gfx::GpuMemoryBuffer* CommandBufferProxyImpl::CreateGpuMemoryBuffer(
// This handle is owned by the GPU process and must be passed to it or it
// will leak. In otherwords, do not early out on error between here and the
// sending of the RegisterGpuMemoryBuffer IPC below.
+
gfx::GpuMemoryBufferHandle handle =
channel_->ShareGpuMemoryBufferToGpuProcess(
gpu_memory_buffer->GetHandle());
+#if defined(OS_ANDROID)
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::KEnableSurfaceTextureBuffer)) {
+ uint32 surface_texture_handle = 0;
+ uint32 texture_id = 0;
+ Send(new GpuCommandBufferMsg_CreateSurfaceTexture(
+ route_id_,
+ reinterpret_cast<uint32>(gpu_memory_buffer.get()),
+ &surface_texture_handle,
+ &texture_id));
+
+ handle.surface_texture_handle =
+ reinterpret_cast<void*>(surface_texture_handle);
+ handle.texture_id = texture_id;
+ }
+#endif
reveman 2014/02/26 08:02:34 I haven't looked at what this code does in detail
+
if (!Send(new GpuCommandBufferMsg_RegisterGpuMemoryBuffer(
route_id_,
new_id,

Powered by Google App Engine
This is Rietveld 408576698