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

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

Issue 20017005: gpu: Refactor GpuMemoryBuffer framework for multi-process support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "gles2_impl_export.h"
11
12 namespace gpu {
13
14 // Interface for creating and accessing a zero-copy GPU memory buffer.
15 // This design evolved from the generalization of GraphicBuffer API
16 // of Android framework.
17 //
18 // THREADING CONSIDERATIONS:
19 //
20 // This interface is thread-safe. However, multiple threads mapping
21 // a buffer for Write or ReadOrWrite simultaneously may result in undefined
22 // behavior and is not allowed.
23 class GLES2_IMPL_EXPORT GpuMemoryBuffer {
24 public:
25 enum AccessMode {
26 READ_ONLY,
27 WRITE_ONLY,
28 READ_WRITE,
29 };
30
31 // Frees a previously allocated buffer. Freeing a buffer that is still
32 // mapped in any process is undefined behavior.
33 virtual ~GpuMemoryBuffer() {}
34
35 // Maps the buffer so the client can write the bitmap data in |*vaddr|
36 // subsequently. This call may block, for instance if the hardware needs
37 // to finish rendering or if CPU caches need to be synchronized.
38 virtual void Map(AccessMode mode, void** vaddr) = 0;
39
40 // Unmaps the buffer. Called after all changes to the buffer are
41 // completed.
42 virtual void Unmap() = 0;
43
44 // Returns true iff the buffer is mapped.
45 virtual bool IsMapped() = 0;
46
47 // Returns the native pointer for the buffer.
48 virtual void* GetNativeBuffer() = 0;
49
50 // Returns the stride in bytes for the buffer.
51 virtual uint32 GetStride() = 0;
52 };
53
54 } // namespace gpu
55
56 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698