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

Unified Diff: components/mus/gles2/ozone_gpu_memory_buffer.h

Issue 1857243005: Scan-out capable buffers (aka ui::NativePixmap) for Mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix for windows Created 4 years, 8 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 | « components/mus/gles2/mojo_gpu_memory_buffer.cc ('k') | components/mus/gles2/ozone_gpu_memory_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/gles2/ozone_gpu_memory_buffer.h
diff --git a/components/mus/gles2/ozone_gpu_memory_buffer.h b/components/mus/gles2/ozone_gpu_memory_buffer.h
new file mode 100644
index 0000000000000000000000000000000000000000..92f6cab9ec8973131db56b50f30d4da2eafa58ef
--- /dev/null
+++ b/components/mus/gles2/ozone_gpu_memory_buffer.h
@@ -0,0 +1,70 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
+#define COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
+
+#include "base/memory/scoped_ptr.h"
+#include "components/mus/gles2/gpu_memory_buffer_impl.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/gpu_memory_buffer.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace ui {
+class ClientNativePixmap;
+class NativePixmap;
+} // namespace ui
+
+namespace mus {
+
+// A not-mojo GpuMemoryBuffer implementation solely for use internally to mus
+// for scanout buffers. Note that OzoneGpuMemoryBuffer is for use on the client
+// (aka CC thread).
+class OzoneGpuMemoryBuffer : public mus::GpuMemoryBufferImpl {
+ public:
+ ~OzoneGpuMemoryBuffer() override;
+
+ // gfx::GpuMemoryBuffer implementation
+ bool Map() override;
+ void Unmap() override;
+ void* memory(size_t plane) override;
+ int stride(size_t plane) const override;
+ gfx::GpuMemoryBufferHandle GetHandle() const override;
+
+ // Returns the type of this GpuMemoryBufferImpl.
+ gfx::GpuMemoryBufferType GetBufferType() const override;
+ scoped_refptr<ui::NativePixmap> GetNativePixmap() override;
+
+ // Create a NativeBuffer. The implementation (mus-specific) will call directly
+ // into ozone to allocate the buffer. See the version in the .cc file.
+ static scoped_ptr<gfx::GpuMemoryBuffer> CreateOzoneGpuMemoryBuffer(
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ gfx::BufferUsage usage,
+ gfx::AcceleratedWidget widget);
+
+ // Cribbed from content/common/gpu/client/gpu_memory_buffer_impl.h
+ static OzoneGpuMemoryBuffer* FromClientBuffer(ClientBuffer buffer);
+
+ private:
+ // TODO(rjkroege): It is conceivable that we do not need an |id| here. It
+ // would seem to be a legacy of content leaking into gfx. In a mojo context,
+ // perhaps it should be a mojo handle instead.
+ OzoneGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ scoped_ptr<ui::ClientNativePixmap> client_pixmap,
+ scoped_refptr<ui::NativePixmap> native_pixmap);
+
+ // The real backing buffer.
+ // From content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h
+ scoped_ptr<ui::ClientNativePixmap> client_pixmap_;
+ scoped_refptr<ui::NativePixmap> native_pixmap_;
+
+ DISALLOW_COPY_AND_ASSIGN(OzoneGpuMemoryBuffer);
+};
+
+} // namespace mus
+
+#endif // COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
« no previous file with comments | « components/mus/gles2/mojo_gpu_memory_buffer.cc ('k') | components/mus/gles2/ozone_gpu_memory_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698