| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains the command buffer helper class. | 5 // This file contains the command buffer helper class. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| 8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| 9 | 9 |
| 10 #include <stddef.h> |
| 11 #include <stdint.h> |
| 10 #include <string.h> | 12 #include <string.h> |
| 11 | 13 |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 17 #include "base/trace_event/memory_dump_provider.h" | 18 #include "base/trace_event/memory_dump_provider.h" |
| 18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 19 #include "gpu/command_buffer/common/cmd_buffer_common.h" | 20 #include "gpu/command_buffer/common/cmd_buffer_common.h" |
| 20 #include "gpu/command_buffer/common/command_buffer.h" | 21 #include "gpu/command_buffer/common/command_buffer.h" |
| 21 #include "gpu/gpu_export.h" | 22 #include "gpu/gpu_export.h" |
| 22 | 23 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 35 const int kAutoFlushBig = 2; // 1/2 of the buffer | 36 const int kAutoFlushBig = 2; // 1/2 of the buffer |
| 36 | 37 |
| 37 // Command buffer helper class. This class simplifies ring buffer management: | 38 // Command buffer helper class. This class simplifies ring buffer management: |
| 38 // it will allocate the buffer, give it to the buffer interface, and let the | 39 // it will allocate the buffer, give it to the buffer interface, and let the |
| 39 // user add commands to it, while taking care of the synchronization (put and | 40 // user add commands to it, while taking care of the synchronization (put and |
| 40 // get). It also provides a way to ensure commands have been executed, through | 41 // get). It also provides a way to ensure commands have been executed, through |
| 41 // the token mechanism: | 42 // the token mechanism: |
| 42 // | 43 // |
| 43 // helper.AddCommand(...); | 44 // helper.AddCommand(...); |
| 44 // helper.AddCommand(...); | 45 // helper.AddCommand(...); |
| 45 // int32 token = helper.InsertToken(); | 46 // int32_t token = helper.InsertToken(); |
| 46 // helper.AddCommand(...); | 47 // helper.AddCommand(...); |
| 47 // helper.AddCommand(...); | 48 // helper.AddCommand(...); |
| 48 // [...] | 49 // [...] |
| 49 // | 50 // |
| 50 // helper.WaitForToken(token); // this doesn't return until the first two | 51 // helper.WaitForToken(token); // this doesn't return until the first two |
| 51 // // commands have been executed. | 52 // // commands have been executed. |
| 52 class GPU_EXPORT CommandBufferHelper | 53 class GPU_EXPORT CommandBufferHelper |
| 53 : public base::trace_event::MemoryDumpProvider { | 54 : public base::trace_event::MemoryDumpProvider { |
| 54 public: | 55 public: |
| 55 explicit CommandBufferHelper(CommandBuffer* command_buffer); | 56 explicit CommandBufferHelper(CommandBuffer* command_buffer); |
| 56 ~CommandBufferHelper() override; | 57 ~CommandBufferHelper() override; |
| 57 | 58 |
| 58 // Initializes the CommandBufferHelper. | 59 // Initializes the CommandBufferHelper. |
| 59 // Parameters: | 60 // Parameters: |
| 60 // ring_buffer_size: The size of the ring buffer portion of the command | 61 // ring_buffer_size: The size of the ring buffer portion of the command |
| 61 // buffer. | 62 // buffer. |
| 62 bool Initialize(int32 ring_buffer_size); | 63 bool Initialize(int32_t ring_buffer_size); |
| 63 | 64 |
| 64 // Sets whether the command buffer should automatically flush periodically | 65 // Sets whether the command buffer should automatically flush periodically |
| 65 // to try to increase performance. Defaults to true. | 66 // to try to increase performance. Defaults to true. |
| 66 void SetAutomaticFlushes(bool enabled); | 67 void SetAutomaticFlushes(bool enabled); |
| 67 | 68 |
| 68 // True if the context is lost. | 69 // True if the context is lost. |
| 69 bool IsContextLost(); | 70 bool IsContextLost(); |
| 70 | 71 |
| 71 // Asynchronously flushes the commands, setting the put pointer to let the | 72 // Asynchronously flushes the commands, setting the put pointer to let the |
| 72 // buffer interface know that new commands have been added. After a flush | 73 // buffer interface know that new commands have been added. After a flush |
| 73 // returns, the command buffer service is aware of all pending commands. | 74 // returns, the command buffer service is aware of all pending commands. |
| 74 void Flush(); | 75 void Flush(); |
| 75 | 76 |
| 76 // Ensures that commands up to the put pointer will be processed in the | 77 // Ensures that commands up to the put pointer will be processed in the |
| 77 // command buffer service before any future commands on other command buffers | 78 // command buffer service before any future commands on other command buffers |
| 78 // sharing a channel. | 79 // sharing a channel. |
| 79 void OrderingBarrier(); | 80 void OrderingBarrier(); |
| 80 | 81 |
| 81 // Waits until all the commands have been executed. Returns whether it | 82 // Waits until all the commands have been executed. Returns whether it |
| 82 // was successful. The function will fail if the command buffer service has | 83 // was successful. The function will fail if the command buffer service has |
| 83 // disconnected. | 84 // disconnected. |
| 84 bool Finish(); | 85 bool Finish(); |
| 85 | 86 |
| 86 // Waits until a given number of available entries are available. | 87 // Waits until a given number of available entries are available. |
| 87 // Parameters: | 88 // Parameters: |
| 88 // count: number of entries needed. This value must be at most | 89 // count: number of entries needed. This value must be at most |
| 89 // the size of the buffer minus one. | 90 // the size of the buffer minus one. |
| 90 void WaitForAvailableEntries(int32 count); | 91 void WaitForAvailableEntries(int32_t count); |
| 91 | 92 |
| 92 // Inserts a new token into the command buffer. This token either has a value | 93 // Inserts a new token into the command buffer. This token either has a value |
| 93 // different from previously inserted tokens, or ensures that previously | 94 // different from previously inserted tokens, or ensures that previously |
| 94 // inserted tokens with that value have already passed through the command | 95 // inserted tokens with that value have already passed through the command |
| 95 // stream. | 96 // stream. |
| 96 // Returns: | 97 // Returns: |
| 97 // the value of the new token or -1 if the command buffer reader has | 98 // the value of the new token or -1 if the command buffer reader has |
| 98 // shutdown. | 99 // shutdown. |
| 99 int32 InsertToken(); | 100 int32_t InsertToken(); |
| 100 | 101 |
| 101 // Returns true if the token has passed. | 102 // Returns true if the token has passed. |
| 102 // Parameters: | 103 // Parameters: |
| 103 // the value of the token to check whether it has passed | 104 // the value of the token to check whether it has passed |
| 104 bool HasTokenPassed(int32 token) const { | 105 bool HasTokenPassed(int32_t token) const { |
| 105 if (token > token_) | 106 if (token > token_) |
| 106 return true; // we wrapped | 107 return true; // we wrapped |
| 107 return last_token_read() >= token; | 108 return last_token_read() >= token; |
| 108 } | 109 } |
| 109 | 110 |
| 110 // Waits until the token of a particular value has passed through the command | 111 // Waits until the token of a particular value has passed through the command |
| 111 // stream (i.e. commands inserted before that token have been executed). | 112 // stream (i.e. commands inserted before that token have been executed). |
| 112 // NOTE: This will call Flush if it needs to block. | 113 // NOTE: This will call Flush if it needs to block. |
| 113 // Parameters: | 114 // Parameters: |
| 114 // the value of the token to wait for. | 115 // the value of the token to wait for. |
| 115 void WaitForToken(int32 token); | 116 void WaitForToken(int32_t token); |
| 116 | 117 |
| 117 // Called prior to each command being issued. Waits for a certain amount of | 118 // Called prior to each command being issued. Waits for a certain amount of |
| 118 // space to be available. Returns address of space. | 119 // space to be available. Returns address of space. |
| 119 void* GetSpace(int32 entries) { | 120 void* GetSpace(int32_t entries) { |
| 120 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) | 121 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
| 121 // Allow this command buffer to be pre-empted by another if a "reasonable" | 122 // Allow this command buffer to be pre-empted by another if a "reasonable" |
| 122 // amount of work has been done. On highend machines, this reduces the | 123 // amount of work has been done. On highend machines, this reduces the |
| 123 // latency of GPU commands. However, on Android, this can cause the | 124 // latency of GPU commands. However, on Android, this can cause the |
| 124 // kernel to thrash between generating GPU commands and executing them. | 125 // kernel to thrash between generating GPU commands and executing them. |
| 125 ++commands_issued_; | 126 ++commands_issued_; |
| 126 if (flush_automatically_ && | 127 if (flush_automatically_ && |
| 127 (commands_issued_ % kCommandsPerFlushCheck == 0)) { | 128 (commands_issued_ % kCommandsPerFlushCheck == 0)) { |
| 128 PeriodicFlushCheck(); | 129 PeriodicFlushCheck(); |
| 129 } | 130 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 159 static_cast<volatile T*>(data)->header; | 160 static_cast<volatile T*>(data)->header; |
| 160 #endif | 161 #endif |
| 161 } | 162 } |
| 162 | 163 |
| 163 // Typed version of GetSpace. Gets enough room for the given type and returns | 164 // Typed version of GetSpace. Gets enough room for the given type and returns |
| 164 // a reference to it. | 165 // a reference to it. |
| 165 template <typename T> | 166 template <typename T> |
| 166 T* GetCmdSpace() { | 167 T* GetCmdSpace() { |
| 167 static_assert(T::kArgFlags == cmd::kFixed, | 168 static_assert(T::kArgFlags == cmd::kFixed, |
| 168 "T::kArgFlags should equal cmd::kFixed"); | 169 "T::kArgFlags should equal cmd::kFixed"); |
| 169 int32 space_needed = ComputeNumEntries(sizeof(T)); | 170 int32_t space_needed = ComputeNumEntries(sizeof(T)); |
| 170 T* data = static_cast<T*>(GetSpace(space_needed)); | 171 T* data = static_cast<T*>(GetSpace(space_needed)); |
| 171 ForceNullCheck(data); | 172 ForceNullCheck(data); |
| 172 return data; | 173 return data; |
| 173 } | 174 } |
| 174 | 175 |
| 175 // Typed version of GetSpace for immediate commands. | 176 // Typed version of GetSpace for immediate commands. |
| 176 template <typename T> | 177 template <typename T> |
| 177 T* GetImmediateCmdSpace(size_t data_space) { | 178 T* GetImmediateCmdSpace(size_t data_space) { |
| 178 static_assert(T::kArgFlags == cmd::kAtLeastN, | 179 static_assert(T::kArgFlags == cmd::kAtLeastN, |
| 179 "T::kArgFlags should equal cmd::kAtLeastN"); | 180 "T::kArgFlags should equal cmd::kAtLeastN"); |
| 180 int32 space_needed = ComputeNumEntries(sizeof(T) + data_space); | 181 int32_t space_needed = ComputeNumEntries(sizeof(T) + data_space); |
| 181 T* data = static_cast<T*>(GetSpace(space_needed)); | 182 T* data = static_cast<T*>(GetSpace(space_needed)); |
| 182 ForceNullCheck(data); | 183 ForceNullCheck(data); |
| 183 return data; | 184 return data; |
| 184 } | 185 } |
| 185 | 186 |
| 186 // Typed version of GetSpace for immediate commands. | 187 // Typed version of GetSpace for immediate commands. |
| 187 template <typename T> | 188 template <typename T> |
| 188 T* GetImmediateCmdSpaceTotalSize(size_t total_space) { | 189 T* GetImmediateCmdSpaceTotalSize(size_t total_space) { |
| 189 static_assert(T::kArgFlags == cmd::kAtLeastN, | 190 static_assert(T::kArgFlags == cmd::kAtLeastN, |
| 190 "T::kArgFlags should equal cmd::kAtLeastN"); | 191 "T::kArgFlags should equal cmd::kAtLeastN"); |
| 191 int32 space_needed = ComputeNumEntries(total_space); | 192 int32_t space_needed = ComputeNumEntries(total_space); |
| 192 T* data = static_cast<T*>(GetSpace(space_needed)); | 193 T* data = static_cast<T*>(GetSpace(space_needed)); |
| 193 ForceNullCheck(data); | 194 ForceNullCheck(data); |
| 194 return data; | 195 return data; |
| 195 } | 196 } |
| 196 | 197 |
| 197 int32 last_token_read() const { | 198 int32_t last_token_read() const { return command_buffer_->GetLastToken(); } |
| 198 return command_buffer_->GetLastToken(); | |
| 199 } | |
| 200 | 199 |
| 201 int32 get_offset() const { | 200 int32_t get_offset() const { |
| 202 return command_buffer_->GetLastState().get_offset; | 201 return command_buffer_->GetLastState().get_offset; |
| 203 } | 202 } |
| 204 | 203 |
| 205 // Common Commands | 204 // Common Commands |
| 206 void Noop(uint32 skip_count) { | 205 void Noop(uint32_t skip_count) { |
| 207 cmd::Noop* cmd = GetImmediateCmdSpace<cmd::Noop>( | 206 cmd::Noop* cmd = GetImmediateCmdSpace<cmd::Noop>( |
| 208 (skip_count - 1) * sizeof(CommandBufferEntry)); | 207 (skip_count - 1) * sizeof(CommandBufferEntry)); |
| 209 if (cmd) { | 208 if (cmd) { |
| 210 cmd->Init(skip_count); | 209 cmd->Init(skip_count); |
| 211 } | 210 } |
| 212 } | 211 } |
| 213 | 212 |
| 214 void SetToken(uint32 token) { | 213 void SetToken(uint32_t token) { |
| 215 cmd::SetToken* cmd = GetCmdSpace<cmd::SetToken>(); | 214 cmd::SetToken* cmd = GetCmdSpace<cmd::SetToken>(); |
| 216 if (cmd) { | 215 if (cmd) { |
| 217 cmd->Init(token); | 216 cmd->Init(token); |
| 218 } | 217 } |
| 219 } | 218 } |
| 220 | 219 |
| 221 void SetBucketSize(uint32 bucket_id, uint32 size) { | 220 void SetBucketSize(uint32_t bucket_id, uint32_t size) { |
| 222 cmd::SetBucketSize* cmd = GetCmdSpace<cmd::SetBucketSize>(); | 221 cmd::SetBucketSize* cmd = GetCmdSpace<cmd::SetBucketSize>(); |
| 223 if (cmd) { | 222 if (cmd) { |
| 224 cmd->Init(bucket_id, size); | 223 cmd->Init(bucket_id, size); |
| 225 } | 224 } |
| 226 } | 225 } |
| 227 | 226 |
| 228 void SetBucketData(uint32 bucket_id, | 227 void SetBucketData(uint32_t bucket_id, |
| 229 uint32 offset, | 228 uint32_t offset, |
| 230 uint32 size, | 229 uint32_t size, |
| 231 uint32 shared_memory_id, | 230 uint32_t shared_memory_id, |
| 232 uint32 shared_memory_offset) { | 231 uint32_t shared_memory_offset) { |
| 233 cmd::SetBucketData* cmd = GetCmdSpace<cmd::SetBucketData>(); | 232 cmd::SetBucketData* cmd = GetCmdSpace<cmd::SetBucketData>(); |
| 234 if (cmd) { | 233 if (cmd) { |
| 235 cmd->Init(bucket_id, | 234 cmd->Init(bucket_id, |
| 236 offset, | 235 offset, |
| 237 size, | 236 size, |
| 238 shared_memory_id, | 237 shared_memory_id, |
| 239 shared_memory_offset); | 238 shared_memory_offset); |
| 240 } | 239 } |
| 241 } | 240 } |
| 242 | 241 |
| 243 void SetBucketDataImmediate( | 242 void SetBucketDataImmediate(uint32_t bucket_id, |
| 244 uint32 bucket_id, uint32 offset, const void* data, uint32 size) { | 243 uint32_t offset, |
| 244 const void* data, |
| 245 uint32_t size) { |
| 245 cmd::SetBucketDataImmediate* cmd = | 246 cmd::SetBucketDataImmediate* cmd = |
| 246 GetImmediateCmdSpace<cmd::SetBucketDataImmediate>(size); | 247 GetImmediateCmdSpace<cmd::SetBucketDataImmediate>(size); |
| 247 if (cmd) { | 248 if (cmd) { |
| 248 cmd->Init(bucket_id, offset, size); | 249 cmd->Init(bucket_id, offset, size); |
| 249 memcpy(ImmediateDataAddress(cmd), data, size); | 250 memcpy(ImmediateDataAddress(cmd), data, size); |
| 250 } | 251 } |
| 251 } | 252 } |
| 252 | 253 |
| 253 void GetBucketStart(uint32 bucket_id, | 254 void GetBucketStart(uint32_t bucket_id, |
| 254 uint32 result_memory_id, | 255 uint32_t result_memory_id, |
| 255 uint32 result_memory_offset, | 256 uint32_t result_memory_offset, |
| 256 uint32 data_memory_size, | 257 uint32_t data_memory_size, |
| 257 uint32 data_memory_id, | 258 uint32_t data_memory_id, |
| 258 uint32 data_memory_offset) { | 259 uint32_t data_memory_offset) { |
| 259 cmd::GetBucketStart* cmd = GetCmdSpace<cmd::GetBucketStart>(); | 260 cmd::GetBucketStart* cmd = GetCmdSpace<cmd::GetBucketStart>(); |
| 260 if (cmd) { | 261 if (cmd) { |
| 261 cmd->Init(bucket_id, | 262 cmd->Init(bucket_id, |
| 262 result_memory_id, | 263 result_memory_id, |
| 263 result_memory_offset, | 264 result_memory_offset, |
| 264 data_memory_size, | 265 data_memory_size, |
| 265 data_memory_id, | 266 data_memory_id, |
| 266 data_memory_offset); | 267 data_memory_offset); |
| 267 } | 268 } |
| 268 } | 269 } |
| 269 | 270 |
| 270 void GetBucketData(uint32 bucket_id, | 271 void GetBucketData(uint32_t bucket_id, |
| 271 uint32 offset, | 272 uint32_t offset, |
| 272 uint32 size, | 273 uint32_t size, |
| 273 uint32 shared_memory_id, | 274 uint32_t shared_memory_id, |
| 274 uint32 shared_memory_offset) { | 275 uint32_t shared_memory_offset) { |
| 275 cmd::GetBucketData* cmd = GetCmdSpace<cmd::GetBucketData>(); | 276 cmd::GetBucketData* cmd = GetCmdSpace<cmd::GetBucketData>(); |
| 276 if (cmd) { | 277 if (cmd) { |
| 277 cmd->Init(bucket_id, | 278 cmd->Init(bucket_id, |
| 278 offset, | 279 offset, |
| 279 size, | 280 size, |
| 280 shared_memory_id, | 281 shared_memory_id, |
| 281 shared_memory_offset); | 282 shared_memory_offset); |
| 282 } | 283 } |
| 283 } | 284 } |
| 284 | 285 |
| 285 CommandBuffer* command_buffer() const { | 286 CommandBuffer* command_buffer() const { |
| 286 return command_buffer_; | 287 return command_buffer_; |
| 287 } | 288 } |
| 288 | 289 |
| 289 scoped_refptr<Buffer> get_ring_buffer() const { return ring_buffer_; } | 290 scoped_refptr<Buffer> get_ring_buffer() const { return ring_buffer_; } |
| 290 | 291 |
| 291 uint32 flush_generation() const { return flush_generation_; } | 292 uint32_t flush_generation() const { return flush_generation_; } |
| 292 | 293 |
| 293 void FreeRingBuffer(); | 294 void FreeRingBuffer(); |
| 294 | 295 |
| 295 bool HaveRingBuffer() const { | 296 bool HaveRingBuffer() const { |
| 296 return ring_buffer_id_ != -1; | 297 return ring_buffer_id_ != -1; |
| 297 } | 298 } |
| 298 | 299 |
| 299 bool usable () const { | 300 bool usable () const { |
| 300 return usable_; | 301 return usable_; |
| 301 } | 302 } |
| 302 | 303 |
| 303 void ClearUsable() { | 304 void ClearUsable() { |
| 304 usable_ = false; | 305 usable_ = false; |
| 305 context_lost_ = true; | 306 context_lost_ = true; |
| 306 CalcImmediateEntries(0); | 307 CalcImmediateEntries(0); |
| 307 } | 308 } |
| 308 | 309 |
| 309 // Overridden from base::trace_event::MemoryDumpProvider: | 310 // Overridden from base::trace_event::MemoryDumpProvider: |
| 310 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 311 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 311 base::trace_event::ProcessMemoryDump* pmd) override; | 312 base::trace_event::ProcessMemoryDump* pmd) override; |
| 312 | 313 |
| 313 private: | 314 private: |
| 314 // Returns the number of available entries (they may not be contiguous). | 315 // Returns the number of available entries (they may not be contiguous). |
| 315 int32 AvailableEntries() { | 316 int32_t AvailableEntries() { |
| 316 return (get_offset() - put_ - 1 + total_entry_count_) % total_entry_count_; | 317 return (get_offset() - put_ - 1 + total_entry_count_) % total_entry_count_; |
| 317 } | 318 } |
| 318 | 319 |
| 319 void CalcImmediateEntries(int waiting_count); | 320 void CalcImmediateEntries(int waiting_count); |
| 320 bool AllocateRingBuffer(); | 321 bool AllocateRingBuffer(); |
| 321 void FreeResources(); | 322 void FreeResources(); |
| 322 | 323 |
| 323 // Waits for the get offset to be in a specific range, inclusive. Returns | 324 // Waits for the get offset to be in a specific range, inclusive. Returns |
| 324 // false if there was an error. | 325 // false if there was an error. |
| 325 bool WaitForGetOffsetInRange(int32 start, int32 end); | 326 bool WaitForGetOffsetInRange(int32_t start, int32_t end); |
| 326 | 327 |
| 327 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) | 328 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
| 328 // Calls Flush if automatic flush conditions are met. | 329 // Calls Flush if automatic flush conditions are met. |
| 329 void PeriodicFlushCheck(); | 330 void PeriodicFlushCheck(); |
| 330 #endif | 331 #endif |
| 331 | 332 |
| 332 int32 GetTotalFreeEntriesNoWaiting() const; | 333 int32_t GetTotalFreeEntriesNoWaiting() const; |
| 333 | 334 |
| 334 CommandBuffer* command_buffer_; | 335 CommandBuffer* command_buffer_; |
| 335 int32 ring_buffer_id_; | 336 int32_t ring_buffer_id_; |
| 336 int32 ring_buffer_size_; | 337 int32_t ring_buffer_size_; |
| 337 scoped_refptr<gpu::Buffer> ring_buffer_; | 338 scoped_refptr<gpu::Buffer> ring_buffer_; |
| 338 CommandBufferEntry* entries_; | 339 CommandBufferEntry* entries_; |
| 339 int32 total_entry_count_; // the total number of entries | 340 int32_t total_entry_count_; // the total number of entries |
| 340 int32 immediate_entry_count_; | 341 int32_t immediate_entry_count_; |
| 341 int32 token_; | 342 int32_t token_; |
| 342 int32 put_; | 343 int32_t put_; |
| 343 int32 last_put_sent_; | 344 int32_t last_put_sent_; |
| 344 int32 last_barrier_put_sent_; | 345 int32_t last_barrier_put_sent_; |
| 345 | 346 |
| 346 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) | 347 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
| 347 int commands_issued_; | 348 int commands_issued_; |
| 348 #endif | 349 #endif |
| 349 | 350 |
| 350 bool usable_; | 351 bool usable_; |
| 351 bool context_lost_; | 352 bool context_lost_; |
| 352 bool flush_automatically_; | 353 bool flush_automatically_; |
| 353 | 354 |
| 354 base::TimeTicks last_flush_time_; | 355 base::TimeTicks last_flush_time_; |
| 355 | 356 |
| 356 // Incremented every time the helper flushes the command buffer. | 357 // Incremented every time the helper flushes the command buffer. |
| 357 // Can be used to track when prior commands have been flushed. | 358 // Can be used to track when prior commands have been flushed. |
| 358 uint32 flush_generation_; | 359 uint32_t flush_generation_; |
| 359 | 360 |
| 360 friend class CommandBufferHelperTest; | 361 friend class CommandBufferHelperTest; |
| 361 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 362 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
| 362 }; | 363 }; |
| 363 | 364 |
| 364 } // namespace gpu | 365 } // namespace gpu |
| 365 | 366 |
| 366 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 367 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| OLD | NEW |