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

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: rebase 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
« no previous file with comments | « ui/compositor/test/in_process_context_factory.cc ('k') | ui/gfx/gpu_memory_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/gpu_memory_buffer.h
diff --git a/ui/gfx/gpu_memory_buffer.h b/ui/gfx/gpu_memory_buffer.h
index 013a039d245910a80bc49dcbbd17701236d37038..e33a189278b86641c8d9f8b6296024a1f2af5714 100644
--- a/ui/gfx/gpu_memory_buffer.h
+++ b/ui/gfx/gpu_memory_buffer.h
@@ -13,6 +13,8 @@
#include "ui/gfx/x/x11_types.h"
#endif
+extern "C" typedef struct _ClientBuffer* ClientBuffer;
+
namespace gfx {
enum GpuMemoryBufferType {
@@ -53,8 +55,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
@@ -69,11 +78,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
« no previous file with comments | « ui/compositor/test/in_process_context_factory.cc ('k') | ui/gfx/gpu_memory_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698