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

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

Issue 302603004: Plumb GpuMemoryBuffer allocation to GPU process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | ui/gl/gl_image_surface_texture.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/gfx/native_widget_types.h"
11 12
12 #if defined(OS_ANDROID) 13 #if defined(OS_ANDROID)
13 #include <third_party/khronos/EGL/egl.h> 14 #include <third_party/khronos/EGL/egl.h>
14 #endif 15 #endif
15 16
16 namespace gfx { 17 namespace gfx {
17 18
18 enum GpuMemoryBufferType { 19 enum GpuMemoryBufferType {
19 EMPTY_BUFFER, 20 EMPTY_BUFFER,
20 SHARED_MEMORY_BUFFER, 21 SHARED_MEMORY_BUFFER,
21 IO_SURFACE_BUFFER, 22 IO_SURFACE_BUFFER,
22 ANDROID_NATIVE_BUFFER, 23 ANDROID_NATIVE_BUFFER,
23 SURFACE_TEXTURE_BUFFER, 24 SURFACE_TEXTURE_BUFFER,
24 GPU_MEMORY_BUFFER_TYPE_LAST = SURFACE_TEXTURE_BUFFER 25 GPU_MEMORY_BUFFER_TYPE_LAST = SURFACE_TEXTURE_BUFFER
25 }; 26 };
26 27
27 #if defined(OS_ANDROID) 28 struct GpuMemoryBufferId {
28 struct SurfaceTextureId { 29 GpuMemoryBufferId() : primary_id(0), secondary_id(base::kNullProcessId) {}
29 SurfaceTextureId() : primary_id(0), secondary_id(0) {} 30 GpuMemoryBufferId(int32 primary_id, base::ProcessId secondary_id)
30 SurfaceTextureId(int32 primary_id, int32 secondary_id)
31 : primary_id(primary_id), secondary_id(secondary_id) {} 31 : primary_id(primary_id), secondary_id(secondary_id) {}
32 int32 primary_id; 32 int32 primary_id;
33 int32 secondary_id; 33 base::ProcessId secondary_id;
34 }; 34 };
35 #endif
36 35
37 struct GpuMemoryBufferHandle { 36 struct GpuMemoryBufferHandle {
38 GpuMemoryBufferHandle() 37 GpuMemoryBufferHandle()
39 : type(EMPTY_BUFFER), 38 : type(EMPTY_BUFFER),
40 handle(base::SharedMemory::NULLHandle()) 39 handle(base::SharedMemory::NULLHandle()),
40 window(kNullPluginWindow)
41 #if defined(OS_MACOSX) 41 #if defined(OS_MACOSX)
42 , 42 ,
43 io_surface_id(0u) 43 io_surface_id(0u)
44 #endif 44 #endif
45 #if defined(OS_ANDROID) 45 #if defined(OS_ANDROID)
46 , 46 ,
47 native_buffer(NULL) 47 native_buffer(NULL)
48 #endif 48 #endif
49 { 49 {
50 } 50 }
51 bool is_null() const { return type == EMPTY_BUFFER; } 51 bool is_null() const { return type == EMPTY_BUFFER; }
52 GpuMemoryBufferType type; 52 GpuMemoryBufferType type;
53 base::SharedMemoryHandle handle; 53 base::SharedMemoryHandle handle;
54 gfx::PluginWindowHandle window;
reveman 2014/05/31 00:34:02 You don't seem to be using this yet. How about we
54 #if defined(OS_MACOSX) 55 #if defined(OS_MACOSX)
55 uint32 io_surface_id; 56 uint32 io_surface_id;
56 #endif 57 #endif
57 #if defined(OS_ANDROID) 58 #if defined(OS_ANDROID)
58 EGLClientBuffer native_buffer; 59 EGLClientBuffer native_buffer;
59 SurfaceTextureId surface_texture_id;
60 #endif 60 #endif
61 GpuMemoryBufferId gpu_memory_id;
reveman 2014/05/31 00:34:02 gpu_memory_id looks like a lazy typed version of g
reveman 2014/05/31 00:34:02 also, can you move this above the idefs?
alexst (slow to review) 2014/06/02 19:19:45 Sure, I like global_id.
61 }; 62 };
62 63
63 // This interface typically correspond to a type of shared memory that is also 64 // This interface typically correspond to a type of shared memory that is also
64 // shared with the GPU. A GPU memory buffer can be written to directly by 65 // shared with the GPU. A GPU memory buffer can be written to directly by
65 // regular CPU code, but can also be read by the GPU. 66 // regular CPU code, but can also be read by the GPU.
66 class GFX_EXPORT GpuMemoryBuffer { 67 class GFX_EXPORT GpuMemoryBuffer {
67 public: 68 public:
68 GpuMemoryBuffer(); 69 GpuMemoryBuffer();
69 virtual ~GpuMemoryBuffer(); 70 virtual ~GpuMemoryBuffer();
70 71
(...skipping 13 matching lines...) Expand all
84 // Returns the stride in bytes for the buffer. 85 // Returns the stride in bytes for the buffer.
85 virtual uint32 GetStride() const = 0; 86 virtual uint32 GetStride() const = 0;
86 87
87 // Returns a platform specific handle for this buffer. 88 // Returns a platform specific handle for this buffer.
88 virtual GpuMemoryBufferHandle GetHandle() const = 0; 89 virtual GpuMemoryBufferHandle GetHandle() const = 0;
89 }; 90 };
90 91
91 } // namespace gfx 92 } // namespace gfx
92 93
93 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ 94 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | ui/gl/gl_image_surface_texture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698