Chromium Code Reviews| 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 #ifndef GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 5 #ifndef GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
| 6 #define GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 6 #define GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 size_t width, | 94 size_t width, |
| 95 size_t height, | 95 size_t height, |
| 96 unsigned internal_format) override; | 96 unsigned internal_format) override; |
| 97 void DestroyImage(int32_t id) override; | 97 void DestroyImage(int32_t id) override; |
| 98 int32_t CreateGpuMemoryBufferImage(size_t width, | 98 int32_t CreateGpuMemoryBufferImage(size_t width, |
| 99 size_t height, | 99 size_t height, |
| 100 unsigned internal_format, | 100 unsigned internal_format, |
| 101 unsigned usage) override; | 101 unsigned usage) override; |
| 102 void SignalQuery(uint32_t query, const base::Closure& callback) override; | 102 void SignalQuery(uint32_t query, const base::Closure& callback) override; |
| 103 void SetLock(base::Lock* lock) override; | 103 void SetLock(base::Lock* lock) override; |
| 104 bool IsGpuChannelLost() override; | |
| 105 void EnsureWorkVisible() override; | 104 void EnsureWorkVisible() override; |
| 106 gpu::CommandBufferNamespace GetNamespaceID() const override; | 105 gpu::CommandBufferNamespace GetNamespaceID() const override; |
| 107 gpu::CommandBufferId GetCommandBufferID() const override; | 106 gpu::CommandBufferId GetCommandBufferID() const override; |
| 108 int32_t GetExtraCommandBufferData() const override; | 107 int32_t GetExtraCommandBufferData() const override; |
| 109 uint64_t GenerateFenceSyncRelease() override; | 108 uint64_t GenerateFenceSyncRelease() override; |
| 110 bool IsFenceSyncRelease(uint64_t release) override; | 109 bool IsFenceSyncRelease(uint64_t release) override; |
| 111 bool IsFenceSyncFlushed(uint64_t release) override; | 110 bool IsFenceSyncFlushed(uint64_t release) override; |
| 112 bool IsFenceSyncFlushReceived(uint64_t release) override; | 111 bool IsFenceSyncFlushReceived(uint64_t release) override; |
| 113 void SignalSyncToken(const gpu::SyncToken& sync_token, | 112 void SignalSyncToken(const gpu::SyncToken& sync_token, |
| 114 const base::Closure& callback) override; | 113 const base::Closure& callback) override; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 if (lock_) | 159 if (lock_) |
| 161 lock_->AssertAcquired(); | 160 lock_->AssertAcquired(); |
| 162 } | 161 } |
| 163 | 162 |
| 164 // Send an IPC message over the GPU channel. This is private to fully | 163 // Send an IPC message over the GPU channel. This is private to fully |
| 165 // encapsulate the channel; all callers of this function must explicitly | 164 // encapsulate the channel; all callers of this function must explicitly |
| 166 // verify that the context has not been lost. | 165 // verify that the context has not been lost. |
| 167 bool Send(IPC::Message* msg); | 166 bool Send(IPC::Message* msg); |
| 168 | 167 |
| 169 // Message handlers: | 168 // Message handlers: |
| 170 void OnUpdateState(const gpu::CommandBuffer::State& state); | |
| 171 void OnDestroyed(gpu::error::ContextLostReason reason, | 169 void OnDestroyed(gpu::error::ContextLostReason reason, |
| 172 gpu::error::Error error); | 170 gpu::error::Error error); |
| 173 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 171 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
| 174 void OnSignalAck(uint32_t id); | 172 void OnSignalAck(uint32_t id); |
| 175 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, | 173 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, |
| 176 gfx::SwapResult result); | 174 gfx::SwapResult result); |
| 177 void OnUpdateVSyncParameters(base::TimeTicks timebase, | 175 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 178 base::TimeDelta interval); | 176 base::TimeDelta interval); |
| 179 | 177 |
| 180 // Try to read an updated copy of the state from shared memory. | |
| 181 void TryUpdateState(); | |
| 182 | |
| 183 // Updates the highest verified release fence sync. | 178 // Updates the highest verified release fence sync. |
| 184 void UpdateVerifiedReleases(uint32_t verified_flush); | 179 void UpdateVerifiedReleases(uint32_t verified_flush); |
| 185 | 180 |
| 186 // Loses the context after we received an invalid message from the GPU | 181 // Try to read an updated copy of the state from shared memory, and calls |
| 187 // process. Will call the lost context callback reentrantly if any. | 182 // OnGpuStateError() if the new state has an error. |
| 188 void InvalidGpuMessage(); | 183 void TryUpdateState(); |
| 184 // Like the above but does not call the error event handler if the new state | |
| 185 // has an error. | |
| 186 void TryUpdateStateDontReportError(); | |
| 187 // Sets the state, and calls OnGpuStateError() if the new state has an error. | |
| 188 void SetStateFromSyncReply(const gpu::CommandBuffer::State& state); | |
| 189 | 189 |
| 190 // Loses the context after we received an invalid reply from the GPU | 190 // Loses the context after we received an invalid reply from the GPU |
| 191 // process. Will post a task to call the lost context callback if any. | 191 // process. |
| 192 void InvalidGpuReply(); | 192 void OnGpuSyncReplyError(); |
| 193 | 193 |
| 194 void InvalidGpuReplyOnClientThread(); | 194 // Loses the context when receiving a message from the GPU process. |
| 195 void OnGpuAsyncMessageError(gpu::error::ContextLostReason reason, | |
| 196 gpu::error::Error error); | |
| 197 | |
| 198 // Loses the context after we receive an error state from the GPU process. | |
| 199 void OnGpuStateError(); | |
| 200 | |
| 201 // Sets an error on the last_state_ and loses the context due to client-side | |
| 202 // errors. | |
| 203 void OnClientError(gpu::error::Error error); | |
| 204 | |
| 205 // Helper methods, don't call these directly. | |
| 206 void DestroyChannelInFreshCallStack(); | |
| 207 void LockAndDestroyChannel(); | |
| 208 void DestroyChannel(); | |
|
piman
2016/04/29 01:35:28
nit: we don't really destroy the channel (it's alm
danakj
2016/04/29 02:34:41
Ah ya, done in Patch set 7.
| |
| 195 | 209 |
| 196 // The shared memory area used to update state. | 210 // The shared memory area used to update state. |
| 197 gpu::CommandBufferSharedState* shared_state() const; | 211 gpu::CommandBufferSharedState* shared_state() const; |
| 198 | 212 |
| 199 base::Lock* lock_; | 213 base::Lock* lock_; |
| 200 | 214 |
| 201 // Client that wants to listen for important events on the GpuControl. | 215 // Client that wants to listen for important events on the GpuControl. |
| 202 gpu::GpuControlClient* gpu_control_client_; | 216 gpu::GpuControlClient* gpu_control_client_; |
| 203 | 217 |
| 204 // Unowned list of DeletionObservers. | 218 // Unowned list of DeletionObservers. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 | 261 |
| 248 base::WeakPtr<CommandBufferProxyImpl> weak_this_; | 262 base::WeakPtr<CommandBufferProxyImpl> weak_this_; |
| 249 scoped_refptr<base::SequencedTaskRunner> callback_thread_; | 263 scoped_refptr<base::SequencedTaskRunner> callback_thread_; |
| 250 | 264 |
| 251 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 265 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
| 252 }; | 266 }; |
| 253 | 267 |
| 254 } // namespace gpu | 268 } // namespace gpu |
| 255 | 269 |
| 256 #endif // GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 270 #endif // GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
| OLD | NEW |