Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CLIENT_GPU_CONTROL_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ |
| 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 // The namespace and command buffer ID forms a unique pair for all existing | 75 // The namespace and command buffer ID forms a unique pair for all existing |
| 76 // GpuControl (on client) and matches for the corresponding command buffer | 76 // GpuControl (on client) and matches for the corresponding command buffer |
| 77 // (on server) in a single server process. The extra command buffer data can | 77 // (on server) in a single server process. The extra command buffer data can |
| 78 // be used for extra identification purposes. One usage is to store some | 78 // be used for extra identification purposes. One usage is to store some |
| 79 // extra field to identify unverified sync tokens for the implementation of | 79 // extra field to identify unverified sync tokens for the implementation of |
| 80 // the CanWaitUnverifiedSyncToken() function. | 80 // the CanWaitUnverifiedSyncToken() function. |
| 81 virtual CommandBufferNamespace GetNamespaceID() const = 0; | 81 virtual CommandBufferNamespace GetNamespaceID() const = 0; |
| 82 virtual CommandBufferId GetCommandBufferID() const = 0; | 82 virtual CommandBufferId GetCommandBufferID() const = 0; |
| 83 virtual int32_t GetExtraCommandBufferData() const = 0; | 83 virtual int32_t GetExtraCommandBufferData() const = 0; |
| 84 | 84 |
| 85 // Fence Syncs use release counters at a context level, these fence syncs | 85 // Generates a fence sync which should be inserted into the GL command stream. |
| 86 // need to be flushed before they can be shared with other contexts across | 86 // When the service executes the fence sync it is released. Fence syncs are |
| 87 // channels. Subclasses should implement these functions and take care of | 87 // shared with other contexts as sync tokens which encapsulate the fence sync |
| 88 // figuring out when a fence sync has been flushed. The difference between | 88 // and the command buffer on which it was generated. Fence syncs need to be |
| 89 // IsFenceSyncFlushed and IsFenceSyncFlushReceived, one is testing is the | 89 // flushed before they can be used by other contexts. Furthermore, the flush |
| 90 // client has issued the flush, and the other is testing if the service | 90 // must be verified before sending a sync token across channel boundaries. |
| 91 // has received the flush. | |
| 92 virtual uint64_t GenerateFenceSyncRelease() = 0; | 91 virtual uint64_t GenerateFenceSyncRelease() = 0; |
| 92 | |
| 93 // Returns true if the fence sync is valid. | |
| 93 virtual bool IsFenceSyncRelease(uint64_t release) = 0; | 94 virtual bool IsFenceSyncRelease(uint64_t release) = 0; |
| 95 | |
| 96 // Returns true if the client has flushed the fence sync. | |
| 94 virtual bool IsFenceSyncFlushed(uint64_t release) = 0; | 97 virtual bool IsFenceSyncFlushed(uint64_t release) = 0; |
| 98 | |
| 99 // Returns true if the service has received the fence sync. Used for verifying | |
| 100 // sync tokens. | |
| 95 virtual bool IsFenceSyncFlushReceived(uint64_t release) = 0; | 101 virtual bool IsFenceSyncFlushReceived(uint64_t release) = 0; |
| 96 | 102 |
| 103 // Returns true if the service has released (executed) the fence sync. Some | |
| 104 // implementations may support calling this from any thread without holding | |
| 105 // the lock provided by the client. | |
|
piman
2016/12/07 20:30:12
Are there implementations that are not thread safe
sunnyps
2016/12/08 01:14:15
I made the InProcessCommandBuffer implementation t
| |
| 106 virtual bool IsFenceSyncReleased(uint64_t release) = 0; | |
| 107 | |
| 97 // Runs |callback| when sync token is signalled. | 108 // Runs |callback| when sync token is signalled. |
| 98 virtual void SignalSyncToken(const SyncToken& sync_token, | 109 virtual void SignalSyncToken(const SyncToken& sync_token, |
| 99 const base::Closure& callback) = 0; | 110 const base::Closure& callback) = 0; |
| 100 | 111 |
| 101 // Under some circumstances a sync token may be used which has not been | 112 // Under some circumstances a sync token may be used which has not been |
| 102 // verified to have been flushed. For example, fence syncs queued on the | 113 // verified to have been flushed. For example, fence syncs queued on the |
| 103 // same channel as the wait command guarantee that the fence sync will | 114 // same channel as the wait command guarantee that the fence sync will |
| 104 // be enqueued first so does not need to be flushed. | 115 // be enqueued first so does not need to be flushed. |
| 105 virtual bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) = 0; | 116 virtual bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) = 0; |
| 106 | 117 |
| 107 private: | 118 private: |
| 108 DISALLOW_COPY_AND_ASSIGN(GpuControl); | 119 DISALLOW_COPY_AND_ASSIGN(GpuControl); |
| 109 }; | 120 }; |
| 110 | 121 |
| 111 } // namespace gpu | 122 } // namespace gpu |
| 112 | 123 |
| 113 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ | 124 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ |
| OLD | NEW |