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

Side by Side Diff: gpu/ipc/client/gpu_channel_host.h

Issue 2383753002: gpu: Add GpuFence framework.
Patch Set: rebase Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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_GPU_CHANNEL_HOST_H_ 5 #ifndef GPU_IPC_CLIENT_GPU_CHANNEL_HOST_H_
6 #define GPU_IPC_CLIENT_GPU_CHANNEL_HOST_H_ 6 #define GPU_IPC_CLIENT_GPU_CHANNEL_HOST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/atomic_sequence_num.h" 15 #include "base/atomic_sequence_num.h"
16 #include "base/containers/scoped_ptr_hash_map.h" 16 #include "base/containers/scoped_ptr_hash_map.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/process/process.h" 20 #include "base/process/process.h"
21 #include "base/synchronization/lock.h" 21 #include "base/synchronization/lock.h"
22 #include "gpu/config/gpu_info.h" 22 #include "gpu/config/gpu_info.h"
23 #include "gpu/gpu_export.h" 23 #include "gpu/gpu_export.h"
24 #include "gpu/ipc/common/gpu_stream_constants.h" 24 #include "gpu/ipc/common/gpu_stream_constants.h"
25 #include "ipc/ipc_channel_handle.h" 25 #include "ipc/ipc_channel_handle.h"
26 #include "ipc/ipc_sync_channel.h" 26 #include "ipc/ipc_sync_channel.h"
27 #include "ipc/message_filter.h" 27 #include "ipc/message_filter.h"
28 #include "ipc/message_router.h" 28 #include "ipc/message_router.h"
29 #include "ui/events/latency_info.h" 29 #include "ui/events/latency_info.h"
30 #include "ui/gfx/gpu_fence.h"
30 #include "ui/gfx/gpu_memory_buffer.h" 31 #include "ui/gfx/gpu_memory_buffer.h"
31 32
32 namespace base { 33 namespace base {
33 class WaitableEvent; 34 class WaitableEvent;
34 } 35 }
35 36
36 namespace IPC { 37 namespace IPC {
37 class SyncMessageFilter; 38 class SyncMessageFilter;
38 } 39 }
39 40
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Returns a GPU memory buffer handle to the buffer that can be sent via 148 // Returns a GPU memory buffer handle to the buffer that can be sent via
148 // IPC to the GPU process. The caller is responsible for ensuring it is 149 // IPC to the GPU process. The caller is responsible for ensuring it is
149 // closed. Returns an invalid handle on failure. 150 // closed. Returns an invalid handle on failure.
150 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess( 151 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess(
151 const gfx::GpuMemoryBufferHandle& source_handle, 152 const gfx::GpuMemoryBufferHandle& source_handle,
152 bool* requires_sync_point); 153 bool* requires_sync_point);
153 154
154 // Reserve one unused image ID. 155 // Reserve one unused image ID.
155 int32_t ReserveImageId(); 156 int32_t ReserveImageId();
156 157
158 // Returns a GPU fence handle to the fence that can be sent via
159 // IPC to the GPU process. The caller is responsible for ensuring it is
160 // closed. Returns an invalid handle on failure.
161 gfx::GpuFenceHandle ShareGpuFenceToGpuProcess(
162 const gfx::GpuFenceHandle& source_handle);
163
164 // Reserve one unused fence ID.
165 int32_t ReserveFenceId();
166
157 // Generate a route ID guaranteed to be unique for this channel. 167 // Generate a route ID guaranteed to be unique for this channel.
158 int32_t GenerateRouteID(); 168 int32_t GenerateRouteID();
159 169
160 // Generate a stream ID guaranteed to be unique for this channel. 170 // Generate a stream ID guaranteed to be unique for this channel.
161 int32_t GenerateStreamID(); 171 int32_t GenerateStreamID();
162 172
163 // Sends a synchronous nop to the server which validate that all previous IPC 173 // Sends a synchronous nop to the server which validate that all previous IPC
164 // messages have been received. Once the synchronous nop has been sent to the 174 // messages have been received. Once the synchronous nop has been sent to the
165 // server all previous flushes will all be marked as validated, including 175 // server all previous flushes will all be marked as validated, including
166 // flushes for other streams on the same channel. Once a validation has been 176 // flushes for other streams on the same channel. Once a validation has been
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 scoped_refptr<MessageFilter> channel_filter_; 276 scoped_refptr<MessageFilter> channel_filter_;
267 277
268 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 278 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
269 279
270 // A filter for sending messages from thread other than the main thread. 280 // A filter for sending messages from thread other than the main thread.
271 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; 281 scoped_refptr<IPC::SyncMessageFilter> sync_filter_;
272 282
273 // Image IDs are allocated in sequence. 283 // Image IDs are allocated in sequence.
274 base::AtomicSequenceNumber next_image_id_; 284 base::AtomicSequenceNumber next_image_id_;
275 285
286 // Fence IDs are allocated in sequence.
287 base::AtomicSequenceNumber next_fence_id_;
288
276 // Route IDs are allocated in sequence. 289 // Route IDs are allocated in sequence.
277 base::AtomicSequenceNumber next_route_id_; 290 base::AtomicSequenceNumber next_route_id_;
278 291
279 // Stream IDs are allocated in sequence. 292 // Stream IDs are allocated in sequence.
280 base::AtomicSequenceNumber next_stream_id_; 293 base::AtomicSequenceNumber next_stream_id_;
281 294
282 // Protects channel_ and stream_flush_info_. 295 // Protects channel_ and stream_flush_info_.
283 mutable base::Lock context_lock_; 296 mutable base::Lock context_lock_;
284 std::unique_ptr<IPC::SyncChannel> channel_; 297 std::unique_ptr<IPC::SyncChannel> channel_;
285 base::hash_map<int32_t, StreamFlushInfo> stream_flush_info_; 298 base::hash_map<int32_t, StreamFlushInfo> stream_flush_info_;
286 299
287 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); 300 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost);
288 }; 301 };
289 302
290 } // namespace gpu 303 } // namespace gpu
291 304
292 #endif // GPU_IPC_CLIENT_GPU_CHANNEL_HOST_H_ 305 #endif // GPU_IPC_CLIENT_GPU_CHANNEL_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698