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

Side by Side Diff: gpu/command_buffer/client/gpu_memory_buffer.h

Issue 13870010: Move GpuMemoryBuffer interface from ui/gl to gpu/command_buffer/client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a syntax error Created 7 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 | Annotate | Revision Log
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_GL_GPU_MEMORY_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_
6 #define UI_GL_GPU_MEMORY_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 11
12 namespace gfx { 12 namespace gpu {
13 class Size;
14 13
15 // Interface for creating and accessing a zero-copy GPU memory buffer. 14 // Interface for creating and accessing a zero-copy GPU memory buffer.
16 // This design evolved from the generalization of GraphicBuffer API 15 // This design evolved from the generalization of GraphicBuffer API
17 // of Android framework. 16 // of Android framework.
18 // 17 //
19 // THREADING CONSIDERATIONS: 18 // THREADING CONSIDERATIONS:
20 // 19 //
21 // This interface is thread-safe. However, multiple threads mapping 20 // This interface is thread-safe. However, multiple threads mapping
22 // a buffer for Write or ReadOrWrite simultaneously may result in undefined 21 // a buffer for Write or ReadOrWrite simultaneously may result in undefined
23 // behavior and is not allowed. 22 // behavior and is not allowed.
24 class GpuMemoryBuffer { 23 class GpuMemoryBuffer {
25 public: 24 public:
26 typedef base::Callback<scoped_ptr<gfx::GpuMemoryBuffer>(gfx::Size)> Creator; 25 typedef base::Callback<scoped_ptr<GpuMemoryBuffer>(uint32, uint32)> Creator;
joth 2013/04/18 21:18:34 Size is 'int' and gpu/ tends to use GLsizei (also
27 enum AccessMode { 26 enum AccessMode {
28 READ_ONLY, 27 READ_ONLY,
29 WRITE_ONLY, 28 WRITE_ONLY,
30 READ_OR_WRITE, 29 READ_OR_WRITE,
31 }; 30 };
32 31
33 // Frees a previously allocated buffer. Freeing a buffer that is still 32 // Frees a previously allocated buffer. Freeing a buffer that is still
34 // mapped in any process is undefined behavior. 33 // mapped in any process is undefined behavior.
35 virtual ~GpuMemoryBuffer() {} 34 virtual ~GpuMemoryBuffer() {}
36 35
37 // Maps the buffer so the client can write the bitmap data in |*vaddr| 36 // Maps the buffer so the client can write the bitmap data in |*vaddr|
38 // subsequently. This call may block, for instance if the hardware needs 37 // subsequently. This call may block, for instance if the hardware needs
39 // to finish rendering or if CPU caches need to be synchronized. 38 // to finish rendering or if CPU caches need to be synchronized.
40 virtual void Map(AccessMode mode, void** vaddr) = 0; 39 virtual void Map(AccessMode mode, void** vaddr) = 0;
41 40
42 // Unmaps the buffer. Called after all changes to the buffer are 41 // Unmaps the buffer. Called after all changes to the buffer are
43 // completed. 42 // completed.
44 virtual void Unmap() = 0; 43 virtual void Unmap() = 0;
45 44
46 // Returns the native pointer for the buffer. 45 // Returns the native pointer for the buffer.
47 virtual void* GetNativeBuffer() = 0; 46 virtual void* GetNativeBuffer() = 0;
48 47
49 // Returns the stride in pixels for the buffer. 48 // Returns the stride in pixels for the buffer.
50 virtual uint32 GetStride() = 0; 49 virtual uint32 GetStride() = 0;
51 }; 50 };
52 51
53 } // namespace gfx 52 } // namespace gpu
54 53
55 #endif // UI_GL_GPU_MEMORY_BUFFER_H_ 54 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_
OLDNEW
« no previous file with comments | « android_webview/renderer/aw_content_renderer_client.h ('k') | gpu/command_buffer/client/gpu_memory_buffer_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698