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

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

Issue 2550583002: gpu: Thread-safe command buffer state lookup. (Closed)
Patch Set: jbauman's review 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
« no previous file with comments | « gpu/gles2_conform_support/egl/context.cc ('k') | gpu/ipc/client/command_buffer_proxy_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..00f844a8d2c74a7cabcdc6c7058c328390a32415 100644
--- a/gpu/ipc/client/command_buffer_proxy_impl.h
+++ b/gpu/ipc/client/command_buffer_proxy_impl.h
@@ -96,11 +96,10 @@ class GPU_EXPORT CommandBufferProxyImpl
// CommandBuffer implementation:
State GetLastState() override;
- 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 +127,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;
@@ -157,12 +157,6 @@ class GPU_EXPORT CommandBufferProxyImpl
void SetUpdateVSyncParametersCallback(
const UpdateVSyncParametersCallback& callback);
- // TODO(apatrick): this is a temporary optimization while skia is calling
- // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6
- // ints redundantly when only the error is needed for the
- // CommandBufferProxyImpl implementation.
- gpu::error::Error GetLastError() override;
-
int32_t route_id() const { return route_id_; }
const scoped_refptr<GpuChannelHost>& channel() const { return channel_; }
@@ -211,6 +205,9 @@ 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();
+ // Like above but calls the error handler and disconnects channel by posting
+ // a task.
+ void TryUpdateStateThreadSafe();
// Like the above but does not call the error event handler if the new state
// has an error.
void TryUpdateStateDontReportError();
@@ -240,6 +237,16 @@ class GPU_EXPORT CommandBufferProxyImpl
// The shared memory area used to update state.
gpu::CommandBufferSharedState* shared_state() const;
+ // The shared memory area used to update state.
+ std::unique_ptr<base::SharedMemory> shared_state_shm_;
+
+ // The last cached state received from the service.
+ State last_state_;
+
+ // 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 last_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.
@@ -252,12 +259,6 @@ class GPU_EXPORT CommandBufferProxyImpl
// Unowned list of DeletionObservers.
base::ObserverList<DeletionObserver> deletion_observers_;
- // The last cached state received from the service.
- State last_state_;
-
- // The shared memory area used to update state.
- std::unique_ptr<base::SharedMemory> shared_state_shm_;
-
scoped_refptr<GpuChannelHost> channel_;
const gpu::CommandBufferId command_buffer_id_;
const int32_t route_id_;
« no previous file with comments | « gpu/gles2_conform_support/egl/context.cc ('k') | gpu/ipc/client/command_buffer_proxy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698