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 PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ | 5 #ifndef PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ |
6 #define PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ | 6 #define PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "gpu/command_buffer/client/gpu_control.h" | 15 #include "gpu/command_buffer/client/gpu_control.h" |
16 #include "gpu/command_buffer/common/command_buffer.h" | 16 #include "gpu/command_buffer/common/command_buffer.h" |
| 17 #include "gpu/command_buffer/common/command_buffer_id.h" |
17 #include "gpu/command_buffer/common/command_buffer_shared.h" | 18 #include "gpu/command_buffer/common/command_buffer_shared.h" |
18 #include "ppapi/proxy/plugin_dispatcher.h" | 19 #include "ppapi/proxy/plugin_dispatcher.h" |
19 #include "ppapi/proxy/ppapi_proxy_export.h" | 20 #include "ppapi/proxy/ppapi_proxy_export.h" |
20 #include "ppapi/shared_impl/host_resource.h" | 21 #include "ppapi/shared_impl/host_resource.h" |
21 | 22 |
22 namespace IPC { | 23 namespace IPC { |
23 class Message; | 24 class Message; |
24 } | 25 } |
25 | 26 |
26 namespace ppapi { | 27 namespace ppapi { |
27 namespace proxy { | 28 namespace proxy { |
28 | 29 |
29 class SerializedHandle; | 30 class SerializedHandle; |
30 | 31 |
31 class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, | 32 class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, |
32 public gpu::GpuControl { | 33 public gpu::GpuControl { |
33 public: | 34 public: |
34 PpapiCommandBufferProxy(const HostResource& resource, | 35 PpapiCommandBufferProxy(const HostResource& resource, |
35 PluginDispatcher* dispatcher, | 36 PluginDispatcher* dispatcher, |
36 const gpu::Capabilities& capabilities, | 37 const gpu::Capabilities& capabilities, |
37 const SerializedHandle& shared_state, | 38 const SerializedHandle& shared_state, |
38 uint64_t command_buffer_id); | 39 gpu::CommandBufferId command_buffer_id); |
39 ~PpapiCommandBufferProxy() override; | 40 ~PpapiCommandBufferProxy() override; |
40 | 41 |
41 // gpu::CommandBuffer implementation: | 42 // gpu::CommandBuffer implementation: |
42 bool Initialize() override; | 43 bool Initialize() override; |
43 State GetLastState() override; | 44 State GetLastState() override; |
44 int32_t GetLastToken() override; | 45 int32_t GetLastToken() override; |
45 void Flush(int32_t put_offset) override; | 46 void Flush(int32_t put_offset) override; |
46 void OrderingBarrier(int32_t put_offset) override; | 47 void OrderingBarrier(int32_t put_offset) override; |
47 void WaitForTokenInRange(int32_t start, int32_t end) override; | 48 void WaitForTokenInRange(int32_t start, int32_t end) override; |
48 void WaitForGetOffsetInRange(int32_t start, int32_t end) override; | 49 void WaitForGetOffsetInRange(int32_t start, int32_t end) override; |
(...skipping 11 matching lines...) Expand all Loading... |
60 void DestroyImage(int32_t id) override; | 61 void DestroyImage(int32_t id) override; |
61 int32_t CreateGpuMemoryBufferImage(size_t width, | 62 int32_t CreateGpuMemoryBufferImage(size_t width, |
62 size_t height, | 63 size_t height, |
63 unsigned internalformat, | 64 unsigned internalformat, |
64 unsigned usage) override; | 65 unsigned usage) override; |
65 void SignalQuery(uint32_t query, const base::Closure& callback) override; | 66 void SignalQuery(uint32_t query, const base::Closure& callback) override; |
66 void SetLock(base::Lock*) override; | 67 void SetLock(base::Lock*) override; |
67 bool IsGpuChannelLost() override; | 68 bool IsGpuChannelLost() override; |
68 void EnsureWorkVisible() override; | 69 void EnsureWorkVisible() override; |
69 gpu::CommandBufferNamespace GetNamespaceID() const override; | 70 gpu::CommandBufferNamespace GetNamespaceID() const override; |
70 uint64_t GetCommandBufferID() const override; | 71 gpu::CommandBufferId GetCommandBufferID() const override; |
71 uint64_t GenerateFenceSyncRelease() override; | 72 uint64_t GenerateFenceSyncRelease() override; |
72 bool IsFenceSyncRelease(uint64_t release) override; | 73 bool IsFenceSyncRelease(uint64_t release) override; |
73 bool IsFenceSyncFlushed(uint64_t release) override; | 74 bool IsFenceSyncFlushed(uint64_t release) override; |
74 bool IsFenceSyncFlushReceived(uint64_t release) override; | 75 bool IsFenceSyncFlushReceived(uint64_t release) override; |
75 void SignalSyncToken(const gpu::SyncToken& sync_token, | 76 void SignalSyncToken(const gpu::SyncToken& sync_token, |
76 const base::Closure& callback) override; | 77 const base::Closure& callback) override; |
77 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; | 78 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; |
78 int32_t GetExtraCommandBufferData() const override; | 79 int32_t GetExtraCommandBufferData() const override; |
79 | 80 |
80 private: | 81 private: |
81 bool Send(IPC::Message* msg); | 82 bool Send(IPC::Message* msg); |
82 void UpdateState(const gpu::CommandBuffer::State& state, bool success); | 83 void UpdateState(const gpu::CommandBuffer::State& state, bool success); |
83 | 84 |
84 // Try to read an updated copy of the state from shared memory. | 85 // Try to read an updated copy of the state from shared memory. |
85 void TryUpdateState(); | 86 void TryUpdateState(); |
86 | 87 |
87 // The shared memory area used to update state. | 88 // The shared memory area used to update state. |
88 gpu::CommandBufferSharedState* shared_state() const; | 89 gpu::CommandBufferSharedState* shared_state() const; |
89 | 90 |
90 void FlushInternal(); | 91 void FlushInternal(); |
91 | 92 |
92 const uint64_t command_buffer_id_; | 93 const gpu::CommandBufferId command_buffer_id_; |
93 | 94 |
94 gpu::Capabilities capabilities_; | 95 gpu::Capabilities capabilities_; |
95 State last_state_; | 96 State last_state_; |
96 scoped_ptr<base::SharedMemory> shared_state_shm_; | 97 scoped_ptr<base::SharedMemory> shared_state_shm_; |
97 | 98 |
98 HostResource resource_; | 99 HostResource resource_; |
99 PluginDispatcher* dispatcher_; | 100 PluginDispatcher* dispatcher_; |
100 | 101 |
101 base::Closure channel_error_callback_; | 102 base::Closure channel_error_callback_; |
102 | 103 |
103 InstanceData::FlushInfo *flush_info_; | 104 InstanceData::FlushInfo *flush_info_; |
104 | 105 |
105 uint64_t next_fence_sync_release_; | 106 uint64_t next_fence_sync_release_; |
106 uint64_t pending_fence_sync_release_; | 107 uint64_t pending_fence_sync_release_; |
107 uint64_t flushed_fence_sync_release_; | 108 uint64_t flushed_fence_sync_release_; |
108 uint64_t validated_fence_sync_release_; | 109 uint64_t validated_fence_sync_release_; |
109 | 110 |
110 DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy); | 111 DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy); |
111 }; | 112 }; |
112 | 113 |
113 } // namespace proxy | 114 } // namespace proxy |
114 } // namespace ppapi | 115 } // namespace ppapi |
115 | 116 |
116 #endif // PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ | 117 #endif // PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ |
OLD | NEW |