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

Unified Diff: ui/gfx/gpu_memory_buffer.h

Issue 634083002: gpu: Compositor management of GpuMemoryBuffer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cc-pre-chromium-image-refactor
Patch Set: mac build fix Created 6 years, 2 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: ui/gfx/gpu_memory_buffer.h
diff --git a/ui/gfx/gpu_memory_buffer.h b/ui/gfx/gpu_memory_buffer.h
index 932c8d6be98ff330907d8b68f4125e529be16761..8aab9da2d194e066fc54bf766a6fa4a86fe263ce 100644
--- a/ui/gfx/gpu_memory_buffer.h
+++ b/ui/gfx/gpu_memory_buffer.h
@@ -13,6 +13,16 @@
#include "ui/gfx/x/x11_types.h"
#endif
+#ifdef __cplusplus
piman 2014/10/09 21:33:02 I don't think you need to bother with the #ifdef _
reveman 2014/10/10 02:20:16 Good point. Done here and everywhere else this app
+extern "C" {
+#endif
+
+typedef struct _ClientBuffer* ClientBuffer;
+
+#ifdef __cplusplus
+}
+#endif
+
namespace gfx {
enum GpuMemoryBufferType {
@@ -69,8 +79,15 @@ struct GFX_EXPORT GpuMemoryBufferHandle {
// regular CPU code, but can also be read by the GPU.
class GFX_EXPORT GpuMemoryBuffer {
public:
- GpuMemoryBuffer();
- virtual ~GpuMemoryBuffer();
+ // The format needs to be taken into account when mapping a buffer into the
+ // client's address space.
+ enum Format { RGBA_8888, RGBX_8888, BGRA_8888, FORMAT_LAST = BGRA_8888 };
+
+ // The usage mode affects how a buffer can be used. Only buffers created with
+ // MAP can be mapped into the client's address space and accessed by the CPU.
+ enum Usage { MAP, SCANOUT, USAGE_LAST = SCANOUT };
+
+ virtual ~GpuMemoryBuffer() {}
// Maps the buffer into the client's address space so it can be written to by
// the CPU. This call may block, for instance if the GPU needs to finish
@@ -85,11 +102,17 @@ class GFX_EXPORT GpuMemoryBuffer {
// Returns true iff the buffer is mapped.
virtual bool IsMapped() const = 0;
+ // Returns the format for the buffer.
+ virtual Format GetFormat() const = 0;
+
// Returns the stride in bytes for the buffer.
virtual uint32 GetStride() const = 0;
// Returns a platform specific handle for this buffer.
virtual GpuMemoryBufferHandle GetHandle() const = 0;
+
+ // Type-checking downcast routine.
+ virtual ClientBuffer AsClientBuffer() = 0;
};
} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698