OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
7 | 7 |
8 #include "../common/buffer.h" | 8 #include "../common/buffer.h" |
9 #include "../common/constants.h" | 9 #include "../common/constants.h" |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 // Initialize the command buffer using the given preallocated buffer. | 72 // Initialize the command buffer using the given preallocated buffer. |
73 virtual bool Initialize(base::SharedMemory* buffer, int32 size) = 0; | 73 virtual bool Initialize(base::SharedMemory* buffer, int32 size) = 0; |
74 | 74 |
75 // Gets the ring buffer for the command buffer. | 75 // Gets the ring buffer for the command buffer. |
76 virtual Buffer GetRingBuffer() = 0; | 76 virtual Buffer GetRingBuffer() = 0; |
77 | 77 |
78 // Returns the current status. | 78 // Returns the current status. |
79 virtual State GetState() = 0; | 79 virtual State GetState() = 0; |
80 | 80 |
| 81 // Returns the last state without synchronizing with the service. |
| 82 virtual State GetLastState() = 0; |
| 83 |
81 // The writer calls this to update its put offset. This ensures the reader | 84 // The writer calls this to update its put offset. This ensures the reader |
82 // sees the latest added commands, and will eventually process them. | 85 // sees the latest added commands, and will eventually process them. On the |
| 86 // service side, commands are processed up to the given put_offset before |
| 87 // subsequent Flushes on the same GpuChannel. |
83 virtual void Flush(int32 put_offset) = 0; | 88 virtual void Flush(int32 put_offset) = 0; |
84 | 89 |
85 // The writer calls this to update its put offset. This function returns the | 90 // The writer calls this to update its put offset. This function returns the |
86 // reader's most recent get offset. Does not return until after the put offset | 91 // reader's most recent get offset. Does not return until all pending commands |
87 // change callback has been invoked. Returns -1 if the put offset is invalid. | 92 // have been executed. |
88 // If last_known_get is different from the reader's current get pointer, this | |
89 // function will return immediately, otherwise it guarantees that the reader | |
90 // has processed some commands before returning (assuming the command buffer | |
91 // isn't empty and there is no error). | |
92 virtual State FlushSync(int32 put_offset, int32 last_known_get) = 0; | 93 virtual State FlushSync(int32 put_offset, int32 last_known_get) = 0; |
93 | 94 |
94 // Sets the current get offset. This can be called from any thread. | 95 // Sets the current get offset. This can be called from any thread. |
95 virtual void SetGetOffset(int32 get_offset) = 0; | 96 virtual void SetGetOffset(int32 get_offset) = 0; |
96 | 97 |
97 // Create a transfer buffer and return a handle that uniquely | 98 // Create a transfer buffer and return a handle that uniquely |
98 // identifies it or -1 on error. id_request lets the caller request a | 99 // identifies it or -1 on error. id_request lets the caller request a |
99 // specific id for the transfer buffer, or -1 if the caller does not care. | 100 // specific id for the transfer buffer, or -1 if the caller does not care. |
100 // If the requested id can not be fulfilled, a different id will be returned. | 101 // If the requested id can not be fulfilled, a different id will be returned. |
101 // id_request must be either -1 or between 0 and 100. | 102 // id_request must be either -1 or between 0 and 100. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 156 |
156 // These want to be private (and const) but can't in order to support | 157 // These want to be private (and const) but can't in order to support |
157 // pickling. | 158 // pickling. |
158 int32 last_token_read; | 159 int32 last_token_read; |
159 int32 last_token_written; | 160 int32 last_token_written; |
160 }; | 161 }; |
161 | 162 |
162 } // namespace gpu | 163 } // namespace gpu |
163 | 164 |
164 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 165 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
OLD | NEW |