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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.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/gpu_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index 13b7b22f319c0fc84e8652b84584b7ea0cb8c013..a3f27ad0a0ef68595da97d756718144e35cbc393 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -41,6 +41,7 @@
#if defined(OS_ANDROID)
#include "content/common/gpu/stream_texture_android.h"
+#include "content/common/gpu/surface_texture_bridge_android.h"
#endif
namespace content {
@@ -225,6 +226,8 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
OnDestroyGpuMemoryBuffer);
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateStreamTexture,
OnCreateStreamTexture)
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateSurfaceTexture,
+ OnCreateSurfaceTexture)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -581,6 +584,23 @@ void GpuCommandBufferStub::OnCreateStreamTexture(uint32 texture_id,
#endif
}
+void GpuCommandBufferStub::OnCreateSurfaceTexture(
+ uint32 gpu_memory_buffer,
+ uint32* surface_texture_handle,
+ uint32* gpu_texture_id) {
+#if defined(OS_ANDROID)
+ gfx::SurfaceTexture* surface_texture =
+ SurfaceTextureBridge::CreateSurfaceTexture(this, gpu_texture_id);
+ surface_texture->AddRef();
+ SurfaceTextureBridge::SetupSurfaceTexturePeer(
+ this, reinterpret_cast<void*>(gpu_memory_buffer), surface_texture);
+ *surface_texture_handle = reinterpret_cast<uint32>(surface_texture);
+#else
+ *surface_texture_handle = 0;
+ *gpu_texture_id = 0;
+#endif
+}
+
void GpuCommandBufferStub::SetLatencyInfoCallback(
const LatencyInfoCallback& callback) {
latency_info_callback_ = callback;

Powered by Google App Engine
This is Rietveld 408576698