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

Side by Side Diff: components/mus/gles2/gpu_state.h

Issue 1871613002: Compute GpuDriverBugWorkarounds only one time in the GPU process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 | « components/mus/gles2/command_buffer_driver.cc ('k') | components/mus/gles2/gpu_state.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_MUS_GLES2_GPU_STATE_H_ 5 #ifndef COMPONENTS_MUS_GLES2_GPU_STATE_H_
6 #define COMPONENTS_MUS_GLES2_GPU_STATE_H_ 6 #define COMPONENTS_MUS_GLES2_GPU_STATE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "components/mus/gles2/command_buffer_driver_manager.h" 12 #include "components/mus/gles2/command_buffer_driver_manager.h"
13 #include "components/mus/gles2/command_buffer_task_runner.h" 13 #include "components/mus/gles2/command_buffer_task_runner.h"
14 #include "gpu/command_buffer/service/gpu_preferences.h" 14 #include "gpu/command_buffer/service/gpu_preferences.h"
15 #include "gpu/command_buffer/service/mailbox_manager_impl.h" 15 #include "gpu/command_buffer/service/mailbox_manager_impl.h"
16 #include "gpu/command_buffer/service/sync_point_manager.h" 16 #include "gpu/command_buffer/service/sync_point_manager.h"
17 #include "gpu/config/gpu_driver_bug_workarounds.h"
17 #include "gpu/config/gpu_info.h" 18 #include "gpu/config/gpu_info.h"
18 #include "ui/gl/gl_share_group.h" 19 #include "ui/gl/gl_share_group.h"
19 20
20 namespace { 21 namespace {
21 class WaitableEvent; 22 class WaitableEvent;
22 } 23 }
23 24
24 namespace mus { 25 namespace mus {
25 26
26 // We need to share these across all CommandBuffer instances so that contexts 27 // We need to share these across all CommandBuffer instances so that contexts
27 // they create can share resources with each other via mailboxes. 28 // they create can share resources with each other via mailboxes.
28 class GpuState : public base::RefCountedThreadSafe<GpuState> { 29 class GpuState : public base::RefCountedThreadSafe<GpuState> {
29 public: 30 public:
30 GpuState(); 31 GpuState();
31 32
32 // We run the CommandBufferImpl on the control_task_runner, which forwards 33 // We run the CommandBufferImpl on the control_task_runner, which forwards
33 // most method class to the CommandBufferDriver, which runs on the "driver", 34 // most method class to the CommandBufferDriver, which runs on the "driver",
34 // thread (i.e., the thread on which GpuImpl instances are created). 35 // thread (i.e., the thread on which GpuImpl instances are created).
35 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner() { 36 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner() {
36 return control_thread_task_runner_; 37 return control_thread_task_runner_;
37 } 38 }
38 39
39 void StopThreads(); 40 void StopThreads();
40 41
41 const gpu::GpuPreferences& gpu_preferences() const { 42 const gpu::GpuPreferences& gpu_preferences() const {
42 return gpu_preferences_; 43 return gpu_preferences_;
43 } 44 }
44 45
46 const gpu::GpuDriverBugWorkarounds& gpu_driver_bug_workarounds() const {
47 return gpu_driver_bug_workarounds_;
48 }
49
45 CommandBufferTaskRunner* command_buffer_task_runner() const { 50 CommandBufferTaskRunner* command_buffer_task_runner() const {
46 return command_buffer_task_runner_.get(); 51 return command_buffer_task_runner_.get();
47 } 52 }
48 53
49 CommandBufferDriverManager* driver_manager() const { 54 CommandBufferDriverManager* driver_manager() const {
50 return driver_manager_.get(); 55 return driver_manager_.get();
51 } 56 }
52 57
53 // These objects are intended to be used on the "driver" thread (i.e., the 58 // These objects are intended to be used on the "driver" thread (i.e., the
54 // thread on which GpuImpl instances are created). 59 // thread on which GpuImpl instances are created).
(...skipping 24 matching lines...) Expand all
79 // |gpu_thread_| is for executing OS GL calls. 84 // |gpu_thread_| is for executing OS GL calls.
80 base::Thread gpu_thread_; 85 base::Thread gpu_thread_;
81 // |control_thread_| is for mojo incoming calls of CommandBufferImpl. 86 // |control_thread_| is for mojo incoming calls of CommandBufferImpl.
82 base::Thread control_thread_; 87 base::Thread control_thread_;
83 88
84 // Same as control_thread_->task_runner(). The TaskRunner is cached as it may 89 // Same as control_thread_->task_runner(). The TaskRunner is cached as it may
85 // be needed during shutdown. 90 // be needed during shutdown.
86 scoped_refptr<base::SingleThreadTaskRunner> control_thread_task_runner_; 91 scoped_refptr<base::SingleThreadTaskRunner> control_thread_task_runner_;
87 92
88 gpu::GpuPreferences gpu_preferences_; 93 gpu::GpuPreferences gpu_preferences_;
94 const gpu::GpuDriverBugWorkarounds gpu_driver_bug_workarounds_;
89 scoped_refptr<CommandBufferTaskRunner> command_buffer_task_runner_; 95 scoped_refptr<CommandBufferTaskRunner> command_buffer_task_runner_;
90 scoped_ptr<CommandBufferDriverManager> driver_manager_; 96 scoped_ptr<CommandBufferDriverManager> driver_manager_;
91 scoped_ptr<gpu::SyncPointManager> sync_point_manager_; 97 scoped_ptr<gpu::SyncPointManager> sync_point_manager_;
92 scoped_refptr<gfx::GLShareGroup> share_group_; 98 scoped_refptr<gfx::GLShareGroup> share_group_;
93 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 99 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
94 gpu::GPUInfo gpu_info_; 100 gpu::GPUInfo gpu_info_;
95 bool hardware_rendering_available_; 101 bool hardware_rendering_available_;
96 }; 102 };
97 103
98 } // namespace mus 104 } // namespace mus
99 105
100 #endif // COMPONENTS_MUS_GLES2_GPU_STATE_H_ 106 #endif // COMPONENTS_MUS_GLES2_GPU_STATE_H_
OLDNEW
« no previous file with comments | « components/mus/gles2/command_buffer_driver.cc ('k') | components/mus/gles2/gpu_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698