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

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

Issue 177953004: Enable SurfaceTexture based zero-copy texture uploading on Android platform Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
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 EGL_CLIENT_BUFFER, 21 EGL_CLIENT_BUFFER,
22 IO_SURFACE_BUFFER, 22 IO_SURFACE_BUFFER,
23 GPU_MEMORY_BUFFER_TYPE_LAST = IO_SURFACE_BUFFER 23 SURFACE_TEXTURE_BUFFER,
24 GPU_MEMORY_BUFFER_TYPE_LAST = SURFACE_TEXTURE_BUFFER
24 }; 25 };
25 26
26 struct GpuMemoryBufferHandle { 27 struct GpuMemoryBufferHandle {
27 GpuMemoryBufferHandle() 28 GpuMemoryBufferHandle()
28 : type(EMPTY_BUFFER), 29 : type(EMPTY_BUFFER),
29 handle(base::SharedMemory::NULLHandle()) 30 handle(base::SharedMemory::NULLHandle())
30 #if defined(OS_ANDROID) 31 #if defined(OS_ANDROID)
31 , native_buffer(NULL) 32 ,
33 native_buffer(NULL),
34 texture_id(0),
35 surface_texture_handle(NULL)
32 #endif 36 #endif
33 #if defined(OS_MACOSX) 37 #if defined(OS_MACOSX)
34 , io_surface_id(0) 38 ,
39 io_surface_id(0)
35 #endif 40 #endif
36 { 41 {
37 } 42 }
38 bool is_null() const { return type == EMPTY_BUFFER; } 43 bool is_null() const { return type == EMPTY_BUFFER; }
39 GpuMemoryBufferType type; 44 GpuMemoryBufferType type;
40 base::SharedMemoryHandle handle; 45 base::SharedMemoryHandle handle;
41 #if defined(OS_ANDROID) 46 #if defined(OS_ANDROID)
42 EGLClientBuffer native_buffer; 47 EGLClientBuffer native_buffer;
48 unsigned int texture_id;
reveman 2014/02/26 08:02:34 I think it should be possible to create the surfac
49 void* surface_texture_handle;
reveman 2014/02/26 08:02:34 hm, this should instead be something that can be s
43 #endif 50 #endif
44 #if defined(OS_MACOSX) 51 #if defined(OS_MACOSX)
45 uint32 io_surface_id; 52 uint32 io_surface_id;
46 #endif 53 #endif
47 54
48 }; 55 };
49 56
50 // Interface for creating and accessing a zero-copy GPU memory buffer. 57 // Interface for creating and accessing a zero-copy GPU memory buffer.
51 // This design evolved from the generalization of GraphicBuffer API 58 // This design evolved from the generalization of GraphicBuffer API
52 // of Android framework. 59 // of Android framework.
(...skipping 29 matching lines...) Expand all
82 // Returns the stride in bytes for the buffer. 89 // Returns the stride in bytes for the buffer.
83 virtual uint32 GetStride() const = 0; 90 virtual uint32 GetStride() const = 0;
84 91
85 // Returns a platform specific handle for this buffer. 92 // Returns a platform specific handle for this buffer.
86 virtual GpuMemoryBufferHandle GetHandle() const = 0; 93 virtual GpuMemoryBufferHandle GetHandle() const = 0;
87 }; 94 };
88 95
89 } // namespace gfx 96 } // namespace gfx
90 97
91 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ 98 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698