| 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
|
| +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
|
|
|