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

Unified Diff: gpu/command_buffer/service/in_process_command_buffer.h

Issue 331723003: gpu: Remove Create/DeleteImage IPC by adding an X11_PIXMAP_BUFFER GpuMemoryBuffer type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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: gpu/command_buffer/service/in_process_command_buffer.h
diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h
index f1e07910e710088357dd2ab62969d8d01cbeff7e..7fece0eccbbed2b5581d7790b66fdc63a9f6abbb 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.h
+++ b/gpu/command_buffer/service/in_process_command_buffer.h
@@ -10,7 +10,7 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
-#include "base/memory/linked_ptr.h"
+#include "base/containers/scoped_ptr_hash_map.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -52,11 +52,29 @@ class ShaderTranslatorCache;
}
class CommandBufferServiceBase;
-class GpuControlService;
-class GpuMemoryBufferFactory;
class GpuScheduler;
class TransferBufferManagerInterface;
+// TODO(reveman): Remove this interface when InProcessCommandBuffer doesn't need
+// a custom factory interface and android_webview implementation of GPU memory
+// buffers can use the same mechanism for buffer allocation as what's used for
+// out of process GPU service.
+class GPU_EXPORT InProcessGpuMemoryBufferFactory {
+ public:
+ virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
+ size_t width,
+ size_t height,
+ unsigned internalformat,
+ unsigned usage) = 0;
+ virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
+ const gfx::GpuMemoryBufferHandle& handle,
+ const gfx::Size& size,
+ unsigned internalformat) = 0;
+
+ protected:
+ virtual ~InProcessGpuMemoryBufferFactory() {}
+};
+
// This class provides a thread-safe interface to the global GPU service (for
// example GPU thread) when being run in single process mode.
// However, the behavior for accessing one context (i.e. one instance of this
@@ -68,7 +86,8 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
explicit InProcessCommandBuffer(const scoped_refptr<Service>& service);
virtual ~InProcessCommandBuffer();
- static void SetGpuMemoryBufferFactory(GpuMemoryBufferFactory* factory);
+ static void SetGpuMemoryBufferFactory(
+ InProcessGpuMemoryBufferFactory* factory);
// If |surface| is not NULL, use it directly; in this case, the command
// buffer gpu thread must be the same as the client thread. Otherwise create
@@ -109,7 +128,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
virtual void RetireSyncPoint(uint32 sync_point) OVERRIDE;
virtual void SignalSyncPoint(uint32 sync_point,
const base::Closure& callback) OVERRIDE;
- virtual void SignalQuery(uint32 query,
+ virtual void SignalQuery(uint32 query_id,
const base::Closure& callback) OVERRIDE;
virtual void SetSurfaceVisible(bool visible) OVERRIDE;
virtual void Echo(const base::Closure& callback) OVERRIDE;
@@ -179,7 +198,15 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
void RetireSyncPointOnGpuThread(uint32 sync_point);
void SignalSyncPointOnGpuThread(uint32 sync_point,
const base::Closure& callback);
- void DestroyTransferBufferOnGputhread(int32 id);
+ void SignalQueryOnGpuThread(unsigned query_id, const base::Closure& callback);
+ void DestroyTransferBufferOnGpuThread(int32 id);
+ void RegisterGpuMemoryBufferOnGpuThread(
+ int32 id,
+ const gfx::GpuMemoryBufferHandle& handle,
+ size_t width,
+ size_t height,
+ unsigned internalformat);
+ void UnregisterGpuMemoryBufferOnGpuThread(int32 id);
// Callbacks:
void OnContextLost();
@@ -204,7 +231,8 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
State last_state_;
int32 last_put_offset_;
gpu::Capabilities capabilities_;
- typedef std::map<int32, linked_ptr<gfx::GpuMemoryBuffer> > GpuMemoryBufferMap;
+ typedef base::ScopedPtrHashMap<int32, gfx::GpuMemoryBuffer>
+ GpuMemoryBufferMap;
GpuMemoryBufferMap gpu_memory_buffers_;
// Accessed on both threads:
@@ -214,7 +242,6 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
scoped_refptr<Service> service_;
State state_after_last_flush_;
base::Lock state_after_last_flush_lock_;
- scoped_ptr<GpuControlService> gpu_control_;
scoped_refptr<gfx::GLShareGroup> gl_share_group_;
#if defined(OS_ANDROID)
« no previous file with comments | « gpu/command_buffer/service/image_manager.cc ('k') | gpu/command_buffer/service/in_process_command_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698