Index: content/common/gpu/client/gpu_channel_host.h |
diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h |
index 5efa98dab4535f915504cab96d4a5a2be6149f39..87240efab0f77c8438830dc81b0536c716aa2e07 100644 |
--- a/content/common/gpu/client/gpu_channel_host.h |
+++ b/content/common/gpu/client/gpu_channel_host.h |
@@ -24,6 +24,7 @@ |
#include "ipc/ipc_sync_channel.h" |
#include "media/video/video_decode_accelerator.h" |
#include "media/video/video_encode_accelerator.h" |
+#include "ui/gfx/gpu_memory_buffer.h" |
#include "ui/gfx/native_widget_types.h" |
#include "ui/gfx/size.h" |
#include "ui/gl/gpu_preference.h" |
@@ -77,6 +78,10 @@ class CONTENT_EXPORT GpuChannelHostFactory { |
int32 image_id, |
const CreateImageCallback& callback) = 0; |
virtual void DeleteImage(int32 image_id, int32 sync_point) = 0; |
+ virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
+ size_t width, |
+ size_t height, |
+ unsigned internalformat) = 0; |
}; |
// Encapsulates an IPC channel between the client and one GPU process. |
@@ -94,6 +99,10 @@ class GpuChannelHost : public IPC::Sender, |
const gpu::GPUInfo& gpu_info, |
const IPC::ChannelHandle& channel_handle); |
+ // Returns true if |handle| is a valid GpuMemoryBuffer handle that |
+ // can be shared to the GPU process. |
+ static bool IsValidGpuMemoryBuffer(gfx::GpuMemoryBufferHandle handle); |
+ |
bool IsLost() const { |
DCHECK(channel_filter_.get()); |
return channel_filter_->IsLost(); |
@@ -162,6 +171,15 @@ class GpuChannelHost : public IPC::Sender, |
// Reserve one unused transfer buffer ID. |
int32 ReserveTransferBufferId(); |
+ // Returns a GPU memory buffer handle to the buffer that can be sent via |
+ // IPC to the GPU process. The caller is responsible for ensuring it is |
+ // closed. Returns an invalid handle on failure. |
+ gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess( |
+ gfx::GpuMemoryBufferHandle source_handle); |
+ |
+ // Reserve one unused gpu memory buffer ID. |
+ int32 ReserveGpuMemoryBufferId(); |
+ |
private: |
friend class base::RefCountedThreadSafe<GpuChannelHost>; |
GpuChannelHost(GpuChannelHostFactory* factory, |
@@ -228,6 +246,7 @@ class GpuChannelHost : public IPC::Sender, |
// Threading notes: all fields are constant during the lifetime of |this| |
// except: |
// - |next_transfer_buffer_id_|, atomic type |
+ // - |next_gpu_memory_buffer_id_|, atomic type |
// - |proxies_|, protected by |context_lock_| |
GpuChannelHostFactory* const factory_; |
const int client_id_; |
@@ -244,6 +263,9 @@ class GpuChannelHost : public IPC::Sender, |
// Transfer buffer IDs are allocated in sequence. |
base::AtomicSequenceNumber next_transfer_buffer_id_; |
+ // Gpu memory buffer IDs are allocated in sequence. |
+ base::AtomicSequenceNumber next_gpu_memory_buffer_id_; |
+ |
// Protects proxies_. |
mutable base::Lock context_lock_; |
// Used to look up a proxy from its routing id. |