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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
6 #define COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "components/mus/gles2/gpu_memory_buffer_impl.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/gfx/gpu_memory_buffer.h"
12 #include "ui/gfx/native_widget_types.h"
13
14 namespace ui {
15 class ClientNativePixmap;
16 class NativePixmap;
17 } // namespace ui
18
19 namespace mus {
20
21 // A not-mojo GpuMemoryBuffer implementation solely for use internally to mus
22 // for scanout buffers. Note that OzoneGpuMemoryBuffer is for use on the client
23 // (aka CC thread).
24 class OzoneGpuMemoryBuffer : public mus::GpuMemoryBufferImpl {
25 public:
26 ~OzoneGpuMemoryBuffer() override;
27
28 // gfx::GpuMemoryBuffer implementation
29 bool Map() override;
30 void Unmap() override;
31 void* memory(size_t plane) override;
32 int stride(size_t plane) const override;
33 gfx::GpuMemoryBufferHandle GetHandle() const override;
34
35 // Returns the type of this GpuMemoryBufferImpl.
36 gfx::GpuMemoryBufferType GetBufferType() const override;
37 scoped_refptr<ui::NativePixmap> GetNativePixmap() override;
38
39 // Create a NativeBuffer. The implementation (mus-specific) will call directly
40 // into ozone to allocate the buffer. See the version in the .cc file.
41 static scoped_ptr<gfx::GpuMemoryBuffer> CreateOzoneGpuMemoryBuffer(
42 const gfx::Size& size,
43 gfx::BufferFormat format,
44 gfx::BufferUsage usage,
45 gfx::AcceleratedWidget widget);
46
47 // Cribbed from content/common/gpu/client/gpu_memory_buffer_impl.h
48 static OzoneGpuMemoryBuffer* FromClientBuffer(ClientBuffer buffer);
49
50 private:
51 // TODO(rjkroege): It is conceivable that we do not need an |id| here. It
52 // would seem to be a legacy of content leaking into gfx. In a mojo context,
53 // perhaps it should be a mojo handle instead.
54 OzoneGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
55 const gfx::Size& size,
56 gfx::BufferFormat format,
57 scoped_ptr<ui::ClientNativePixmap> client_pixmap,
58 scoped_refptr<ui::NativePixmap> native_pixmap);
59
60 // The real backing buffer.
61 // From content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h
62 scoped_ptr<ui::ClientNativePixmap> client_pixmap_;
63 scoped_refptr<ui::NativePixmap> native_pixmap_;
64
65 DISALLOW_COPY_AND_ASSIGN(OzoneGpuMemoryBuffer);
66 };
67
68 } // namespace mus
69
70 #endif // COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
OLDNEW
« 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