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

Side by Side Diff: content/common/gpu/gpu_channel.h

Issue 1809183002: gpu_messages.h => gpu/ipc/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make win_clang_x64_dbg happy by making command_buffer_traits an alias to gpu component on compnet b… Created 4 years, 9 months 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
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.cc ('k') | content/common/gpu/gpu_channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/containers/scoped_ptr_hash_map.h" 14 #include "base/containers/scoped_ptr_hash_map.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/process/process.h" 19 #include "base/process/process.h"
20 #include "base/threading/thread_checker.h" 20 #include "base/threading/thread_checker.h"
21 #include "base/trace_event/memory_dump_provider.h" 21 #include "base/trace_event/memory_dump_provider.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "content/common/content_export.h" 23 #include "content/common/content_export.h"
24 #include "content/common/gpu/gpu_command_buffer_stub.h" 24 #include "content/common/gpu/gpu_command_buffer_stub.h"
25 #include "content/common/gpu/gpu_memory_manager.h" 25 #include "content/common/gpu/gpu_memory_manager.h"
26 #include "content/common/gpu/gpu_stream_constants.h"
27 #include "gpu/command_buffer/service/valuebuffer_manager.h" 26 #include "gpu/command_buffer/service/valuebuffer_manager.h"
27 #include "gpu/ipc/common/gpu_stream_constants.h"
28 #include "ipc/ipc_sync_channel.h" 28 #include "ipc/ipc_sync_channel.h"
29 #include "ipc/message_router.h" 29 #include "ipc/message_router.h"
30 #include "ui/gfx/geometry/size.h" 30 #include "ui/gfx/geometry/size.h"
31 #include "ui/gfx/native_widget_types.h" 31 #include "ui/gfx/native_widget_types.h"
32 #include "ui/gl/gl_share_group.h" 32 #include "ui/gl/gl_share_group.h"
33 #include "ui/gl/gpu_preference.h" 33 #include "ui/gl/gpu_preference.h"
34 34
35 struct GPUCreateCommandBufferConfig; 35 struct GPUCreateCommandBufferConfig;
36 36
37 namespace base { 37 namespace base {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 // Some messages such as WaitForGetOffsetInRange and WaitForTokenInRange are 192 // Some messages such as WaitForGetOffsetInRange and WaitForTokenInRange are
193 // processed as soon as possible because the client is blocked until they 193 // processed as soon as possible because the client is blocked until they
194 // are completed. 194 // are completed.
195 void HandleOutOfOrderMessage(const IPC::Message& msg); 195 void HandleOutOfOrderMessage(const IPC::Message& msg);
196 196
197 void HandleMessageHelper(const IPC::Message& msg); 197 void HandleMessageHelper(const IPC::Message& msg);
198 198
199 scoped_refptr<GpuChannelMessageQueue> CreateStream( 199 scoped_refptr<GpuChannelMessageQueue> CreateStream(
200 int32_t stream_id, 200 int32_t stream_id,
201 GpuStreamPriority stream_priority); 201 gpu::GpuStreamPriority stream_priority);
202 202
203 scoped_refptr<GpuChannelMessageQueue> LookupStream(int32_t stream_id); 203 scoped_refptr<GpuChannelMessageQueue> LookupStream(int32_t stream_id);
204 204
205 void DestroyStreamIfNecessary( 205 void DestroyStreamIfNecessary(
206 const scoped_refptr<GpuChannelMessageQueue>& queue); 206 const scoped_refptr<GpuChannelMessageQueue>& queue);
207 207
208 void AddRouteToStream(int32_t route_id, int32_t stream_id); 208 void AddRouteToStream(int32_t route_id, int32_t stream_id);
209 void RemoveRouteFromStream(int32_t route_id); 209 void RemoveRouteFromStream(int32_t route_id);
210 210
211 // Message handlers for control messages. 211 // Message handlers for control messages.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 private: 354 private:
355 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessage); 355 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessage);
356 }; 356 };
357 357
358 class GpuChannelMessageQueue 358 class GpuChannelMessageQueue
359 : public base::RefCountedThreadSafe<GpuChannelMessageQueue> { 359 : public base::RefCountedThreadSafe<GpuChannelMessageQueue> {
360 public: 360 public:
361 static scoped_refptr<GpuChannelMessageQueue> Create( 361 static scoped_refptr<GpuChannelMessageQueue> Create(
362 int32_t stream_id, 362 int32_t stream_id,
363 GpuStreamPriority stream_priority, 363 gpu::GpuStreamPriority stream_priority,
364 GpuChannel* channel, 364 GpuChannel* channel,
365 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, 365 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
366 const scoped_refptr<gpu::PreemptionFlag>& preempting_flag, 366 const scoped_refptr<gpu::PreemptionFlag>& preempting_flag,
367 const scoped_refptr<gpu::PreemptionFlag>& preempted_flag, 367 const scoped_refptr<gpu::PreemptionFlag>& preempted_flag,
368 gpu::SyncPointManager* sync_point_manager); 368 gpu::SyncPointManager* sync_point_manager);
369 369
370 void Disable(); 370 void Disable();
371 void DisableIO(); 371 void DisableIO();
372 372
373 int32_t stream_id() const { return stream_id_; } 373 int32_t stream_id() const { return stream_id_; }
374 GpuStreamPriority stream_priority() const { return stream_priority_; } 374 gpu::GpuStreamPriority stream_priority() const { return stream_priority_; }
375 375
376 bool IsScheduled() const; 376 bool IsScheduled() const;
377 void OnRescheduled(bool scheduled); 377 void OnRescheduled(bool scheduled);
378 378
379 bool HasQueuedMessages() const; 379 bool HasQueuedMessages() const;
380 380
381 base::TimeTicks GetNextMessageTimeTick() const; 381 base::TimeTicks GetNextMessageTimeTick() const;
382 382
383 scoped_refptr<gpu::SyncPointOrderData> GetSyncPointOrderData(); 383 scoped_refptr<gpu::SyncPointOrderData> GetSyncPointOrderData();
384 384
(...skipping 28 matching lines...) Expand all
413 // We are currently preempting (i.e. no stub is descheduled). 413 // We are currently preempting (i.e. no stub is descheduled).
414 PREEMPTING, 414 PREEMPTING,
415 // We would like to preempt, but some stub is descheduled. 415 // We would like to preempt, but some stub is descheduled.
416 WOULD_PREEMPT_DESCHEDULED, 416 WOULD_PREEMPT_DESCHEDULED,
417 }; 417 };
418 418
419 friend class base::RefCountedThreadSafe<GpuChannelMessageQueue>; 419 friend class base::RefCountedThreadSafe<GpuChannelMessageQueue>;
420 420
421 GpuChannelMessageQueue( 421 GpuChannelMessageQueue(
422 int32_t stream_id, 422 int32_t stream_id,
423 GpuStreamPriority stream_priority, 423 gpu::GpuStreamPriority stream_priority,
424 GpuChannel* channel, 424 GpuChannel* channel,
425 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, 425 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
426 const scoped_refptr<gpu::PreemptionFlag>& preempting_flag, 426 const scoped_refptr<gpu::PreemptionFlag>& preempting_flag,
427 const scoped_refptr<gpu::PreemptionFlag>& preempted_flag, 427 const scoped_refptr<gpu::PreemptionFlag>& preempted_flag,
428 gpu::SyncPointManager* sync_point_manager); 428 gpu::SyncPointManager* sync_point_manager);
429 ~GpuChannelMessageQueue(); 429 ~GpuChannelMessageQueue();
430 430
431 void UpdatePreemptionState(); 431 void UpdatePreemptionState();
432 void UpdatePreemptionStateHelper(); 432 void UpdatePreemptionStateHelper();
433 433
434 void UpdateStateIdle(); 434 void UpdateStateIdle();
435 void UpdateStateWaiting(); 435 void UpdateStateWaiting();
436 void UpdateStateChecking(); 436 void UpdateStateChecking();
437 void UpdateStatePreempting(); 437 void UpdateStatePreempting();
438 void UpdateStateWouldPreemptDescheduled(); 438 void UpdateStateWouldPreemptDescheduled();
439 439
440 void TransitionToIdle(); 440 void TransitionToIdle();
441 void TransitionToWaiting(); 441 void TransitionToWaiting();
442 void TransitionToChecking(); 442 void TransitionToChecking();
443 void TransitionToPreempting(); 443 void TransitionToPreempting();
444 void TransitionToWouldPreemptDescheduled(); 444 void TransitionToWouldPreemptDescheduled();
445 445
446 bool ShouldTransitionToIdle() const; 446 bool ShouldTransitionToIdle() const;
447 447
448 const int32_t stream_id_; 448 const int32_t stream_id_;
449 const GpuStreamPriority stream_priority_; 449 const gpu::GpuStreamPriority stream_priority_;
450 450
451 // These can be accessed from both IO and main threads and are protected by 451 // These can be accessed from both IO and main threads and are protected by
452 // |channel_lock_|. 452 // |channel_lock_|.
453 bool enabled_; 453 bool enabled_;
454 bool scheduled_; 454 bool scheduled_;
455 GpuChannel* const channel_; 455 GpuChannel* const channel_;
456 std::deque<scoped_ptr<GpuChannelMessage>> channel_messages_; 456 std::deque<scoped_ptr<GpuChannelMessage>> channel_messages_;
457 mutable base::Lock channel_lock_; 457 mutable base::Lock channel_lock_;
458 458
459 // The following are accessed on the IO thread only. 459 // The following are accessed on the IO thread only.
(...skipping 14 matching lines...) Expand all
474 scoped_refptr<gpu::PreemptionFlag> preempting_flag_; 474 scoped_refptr<gpu::PreemptionFlag> preempting_flag_;
475 scoped_refptr<gpu::PreemptionFlag> preempted_flag_; 475 scoped_refptr<gpu::PreemptionFlag> preempted_flag_;
476 gpu::SyncPointManager* const sync_point_manager_; 476 gpu::SyncPointManager* const sync_point_manager_;
477 477
478 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); 478 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue);
479 }; 479 };
480 480
481 } // namespace content 481 } // namespace content
482 482
483 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 483 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.cc ('k') | content/common/gpu/gpu_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698