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

Side by Side Diff: ui/gfx/gpu_memory_buffer.h

Issue 685983005: gpu: Associate all GpuMemoryBuffers with unique IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more ozone build fix Created 6 years, 1 month 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_GPU_MEMORY_BUFFER_H_ 5 #ifndef UI_GFX_GPU_MEMORY_BUFFER_H_
6 #define UI_GFX_GPU_MEMORY_BUFFER_H_ 6 #define UI_GFX_GPU_MEMORY_BUFFER_H_
7 7
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/gfx/gfx_export.h" 10 #include "ui/gfx/gfx_export.h"
11 11
12 #if defined(USE_X11)
13 #include "ui/gfx/x/x11_types.h"
14 #endif
15
16 extern "C" typedef struct _ClientBuffer* ClientBuffer; 12 extern "C" typedef struct _ClientBuffer* ClientBuffer;
17 13
18 namespace gfx { 14 namespace gfx {
19 15
20 enum GpuMemoryBufferType { 16 enum GpuMemoryBufferType {
21 EMPTY_BUFFER, 17 EMPTY_BUFFER,
22 SHARED_MEMORY_BUFFER, 18 SHARED_MEMORY_BUFFER,
23 IO_SURFACE_BUFFER, 19 IO_SURFACE_BUFFER,
24 SURFACE_TEXTURE_BUFFER, 20 SURFACE_TEXTURE_BUFFER,
25 X11_PIXMAP_BUFFER,
26 OZONE_NATIVE_BUFFER, 21 OZONE_NATIVE_BUFFER,
27 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_BUFFER 22 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_BUFFER
28 }; 23 };
29 24
30 struct GpuMemoryBufferId { 25 using GpuMemoryBufferId = int32;
31 GpuMemoryBufferId() : primary_id(0), secondary_id(0) {}
32 GpuMemoryBufferId(int32 primary_id, int32 secondary_id)
33 : primary_id(primary_id), secondary_id(secondary_id) {}
34 int32 primary_id;
35 int32 secondary_id;
36 };
37 26
38 struct GFX_EXPORT GpuMemoryBufferHandle { 27 struct GFX_EXPORT GpuMemoryBufferHandle {
39 GpuMemoryBufferHandle(); 28 GpuMemoryBufferHandle();
40 bool is_null() const { return type == EMPTY_BUFFER; } 29 bool is_null() const { return type == EMPTY_BUFFER; }
41 GpuMemoryBufferType type; 30 GpuMemoryBufferType type;
31 GpuMemoryBufferId id;
42 base::SharedMemoryHandle handle; 32 base::SharedMemoryHandle handle;
43 GpuMemoryBufferId global_id;
44 #if defined(OS_MACOSX) 33 #if defined(OS_MACOSX)
45 uint32 io_surface_id; 34 uint32 io_surface_id;
46 #endif 35 #endif
47 #if defined(USE_X11)
48 XID pixmap;
49 #endif
50 }; 36 };
51 37
52 // This interface typically correspond to a type of shared memory that is also 38 // This interface typically correspond to a type of shared memory that is also
53 // shared with the GPU. A GPU memory buffer can be written to directly by 39 // shared with the GPU. A GPU memory buffer can be written to directly by
54 // regular CPU code, but can also be read by the GPU. 40 // regular CPU code, but can also be read by the GPU.
55 class GFX_EXPORT GpuMemoryBuffer { 41 class GFX_EXPORT GpuMemoryBuffer {
56 public: 42 public:
57 // The format needs to be taken into account when mapping a buffer into the 43 // The format needs to be taken into account when mapping a buffer into the
58 // client's address space. 44 // client's address space.
59 enum Format { RGBA_8888, RGBX_8888, BGRA_8888, FORMAT_LAST = BGRA_8888 }; 45 enum Format { RGBA_8888, RGBX_8888, BGRA_8888, FORMAT_LAST = BGRA_8888 };
(...skipping 26 matching lines...) Expand all
86 // Returns a platform specific handle for this buffer. 72 // Returns a platform specific handle for this buffer.
87 virtual GpuMemoryBufferHandle GetHandle() const = 0; 73 virtual GpuMemoryBufferHandle GetHandle() const = 0;
88 74
89 // Type-checking downcast routine. 75 // Type-checking downcast routine.
90 virtual ClientBuffer AsClientBuffer() = 0; 76 virtual ClientBuffer AsClientBuffer() = 0;
91 }; 77 };
92 78
93 } // namespace gfx 79 } // namespace gfx
94 80
95 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ 81 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/common/IChildProcessCallback.aidl ('k') | ui/gfx/gpu_memory_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698