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

Unified Diff: gpu/ipc/client/command_buffer_proxy_impl.h

Issue 2550583002: gpu: Thread-safe command buffer state lookup. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: gpu/ipc/client/command_buffer_proxy_impl.h
diff --git a/gpu/ipc/client/command_buffer_proxy_impl.h b/gpu/ipc/client/command_buffer_proxy_impl.h
index 89300514ca5aec9da9fb5178c788aba04928ad1c..ec9f41c10956c7795442a6f1a4122d617d438d57 100644
--- a/gpu/ipc/client/command_buffer_proxy_impl.h
+++ b/gpu/ipc/client/command_buffer_proxy_impl.h
@@ -99,8 +99,8 @@ class GPU_EXPORT CommandBufferProxyImpl
int32_t GetLastToken() override;
void Flush(int32_t put_offset) override;
void OrderingBarrier(int32_t put_offset) override;
- void WaitForTokenInRange(int32_t start, int32_t end) override;
- void WaitForGetOffsetInRange(int32_t start, int32_t end) override;
+ State WaitForTokenInRange(int32_t start, int32_t end) override;
+ State WaitForGetOffsetInRange(int32_t start, int32_t end) override;
void SetGetBuffer(int32_t shm_id) override;
scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size,
int32_t* id) override;
@@ -128,6 +128,7 @@ class GPU_EXPORT CommandBufferProxyImpl
bool IsFenceSyncRelease(uint64_t release) override;
bool IsFenceSyncFlushed(uint64_t release) override;
bool IsFenceSyncFlushReceived(uint64_t release) override;
+ bool IsFenceSyncReleased(uint64_t release) override;
void SignalSyncToken(const gpu::SyncToken& sync_token,
const base::Closure& callback) override;
bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override;
@@ -210,10 +211,13 @@ class GPU_EXPORT CommandBufferProxyImpl
// Try to read an updated copy of the state from shared memory, and calls
// OnGpuStateError() if the new state has an error.
- void TryUpdateState();
+ State TryUpdateState();
+ // Like above but calls the error handler and disconnects channel by posting
+ // a task.
+ State TryUpdateStateThreadSafe();
// Like the above but does not call the error event handler if the new state
// has an error.
- void TryUpdateStateDontReportError();
+ State TryUpdateStateDontReportError();
// Sets the state, and calls OnGpuStateError() if the new state has an error.
void SetStateFromSyncReply(const gpu::CommandBuffer::State& state);
@@ -240,6 +244,10 @@ class GPU_EXPORT CommandBufferProxyImpl
// The shared memory area used to update state.
gpu::CommandBufferSharedState* shared_state() const;
+ // Lock to access shared state e.g. sync token release count across multiple
+ // threads. This allows tracking command buffer progress from another thread.
+ base::Lock state_lock_;
+
// There should be a lock_ if this is going to be used across multiple
// threads, or we guarantee it is used by a single thread by using a thread
// checker if no lock_ is set.

Powered by Google App Engine
This is Rietveld 408576698