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

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: win build 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/content_common.gypi ('k') | ui/gfx/gpu_memory_buffer.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 11
12 #if defined(OS_ANDROID) 12 #if defined(OS_ANDROID)
13 #include <third_party/khronos/EGL/egl.h> 13 #include <third_party/khronos/EGL/egl.h>
14 #endif 14 #endif
15 15
16 namespace gfx { 16 namespace gfx {
17 17
18 enum GpuMemoryBufferType { 18 enum GpuMemoryBufferType {
19 EMPTY_BUFFER, 19 EMPTY_BUFFER,
20 SHARED_MEMORY_BUFFER, 20 SHARED_MEMORY_BUFFER,
21 IO_SURFACE_BUFFER, 21 IO_SURFACE_BUFFER,
22 ANDROID_NATIVE_BUFFER, 22 ANDROID_NATIVE_BUFFER,
23 SURFACE_TEXTURE_BUFFER, 23 SURFACE_TEXTURE_BUFFER,
24 GPU_MEMORY_BUFFER_TYPE_LAST = SURFACE_TEXTURE_BUFFER 24 GPU_MEMORY_BUFFER_TYPE_LAST = SURFACE_TEXTURE_BUFFER
25 }; 25 };
26 26
27 // TODO(alexst): Merge this with GpuMemoryBufferId as part of switchover to
28 // the new API for GpuMemoryBuffer allocation when it's done.
27 #if defined(OS_ANDROID) 29 #if defined(OS_ANDROID)
28 struct SurfaceTextureId { 30 struct SurfaceTextureId {
29 SurfaceTextureId() : primary_id(0), secondary_id(0) {} 31 SurfaceTextureId() : primary_id(0), secondary_id(0) {}
30 SurfaceTextureId(int32 primary_id, int32 secondary_id) 32 SurfaceTextureId(int32 primary_id, int32 secondary_id)
31 : primary_id(primary_id), secondary_id(secondary_id) {} 33 : primary_id(primary_id), secondary_id(secondary_id) {}
32 int32 primary_id; 34 int32 primary_id;
33 int32 secondary_id; 35 int32 secondary_id;
34 }; 36 };
35 #endif 37 #endif
36 38
37 struct GpuMemoryBufferHandle { 39 struct GpuMemoryBufferId {
38 GpuMemoryBufferHandle() 40 GpuMemoryBufferId() : primary_id(0), secondary_id(0) {}
39 : type(EMPTY_BUFFER), 41 GpuMemoryBufferId(int32 primary_id, int32 secondary_id)
40 handle(base::SharedMemory::NULLHandle()) 42 : primary_id(primary_id), secondary_id(secondary_id) {}
41 #if defined(OS_MACOSX) 43 int32 primary_id;
42 , 44 int32 secondary_id;
43 io_surface_id(0u) 45 };
44 #endif 46
45 #if defined(OS_ANDROID) 47 struct GFX_EXPORT GpuMemoryBufferHandle {
46 , 48 GpuMemoryBufferHandle();
47 native_buffer(NULL)
48 #endif
49 {
50 }
51 bool is_null() const { return type == EMPTY_BUFFER; } 49 bool is_null() const { return type == EMPTY_BUFFER; }
52 GpuMemoryBufferType type; 50 GpuMemoryBufferType type;
53 base::SharedMemoryHandle handle; 51 base::SharedMemoryHandle handle;
52 GpuMemoryBufferId global_id;
54 #if defined(OS_MACOSX) 53 #if defined(OS_MACOSX)
55 uint32 io_surface_id; 54 uint32 io_surface_id;
56 #endif 55 #endif
57 #if defined(OS_ANDROID) 56 #if defined(OS_ANDROID)
58 EGLClientBuffer native_buffer; 57 EGLClientBuffer native_buffer;
59 SurfaceTextureId surface_texture_id; 58 SurfaceTextureId surface_texture_id;
60 #endif 59 #endif
61 }; 60 };
62 61
63 // This interface typically correspond to a type of shared memory that is also 62 // This interface typically correspond to a type of shared memory that is also
(...skipping 20 matching lines...) Expand all
84 // Returns the stride in bytes for the buffer. 83 // Returns the stride in bytes for the buffer.
85 virtual uint32 GetStride() const = 0; 84 virtual uint32 GetStride() const = 0;
86 85
87 // Returns a platform specific handle for this buffer. 86 // Returns a platform specific handle for this buffer.
88 virtual GpuMemoryBufferHandle GetHandle() const = 0; 87 virtual GpuMemoryBufferHandle GetHandle() const = 0;
89 }; 88 };
90 89
91 } // namespace gfx 90 } // namespace gfx
92 91
93 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ 92 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_
OLDNEW
« no previous file with comments | « content/content_common.gypi ('k') | ui/gfx/gpu_memory_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698