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 COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ |
6 #define COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ | 6 #define COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "components/view_manager/public/interfaces/command_buffer.mojom.h" | 11 #include "components/view_manager/public/interfaces/command_buffer.mojom.h" |
12 #include "components/view_manager/public/interfaces/viewport_parameter_listener. mojom.h" | |
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
14 | 13 |
15 namespace gles2 { | 14 namespace gles2 { |
16 class CommandBufferDriver; | 15 class CommandBufferDriver; |
17 class CommandBufferImplObserver; | 16 class CommandBufferImplObserver; |
18 class GpuState; | 17 class GpuState; |
19 | 18 |
20 // This class listens to the CommandBuffer message pipe on a low-latency thread | 19 // This class listens to the CommandBuffer message pipe on a low-latency thread |
21 // so that we can insert sync points without blocking on the GL driver. It | 20 // so that we can insert sync points without blocking on the GL driver. It |
rjkroege
2015/08/06 00:16:21
so we have a thread hop to process incoming Comman
Fady Samuel
2015/08/06 16:48:23
Yes. It's a mess, right now.
rjkroege
2015/08/06 22:09:02
actually, it's reasonable for the moment. But... d
| |
22 // forwards most method calls to the CommandBufferDriver, which runs on the | 21 // forwards most method calls to the CommandBufferDriver, which runs on the |
23 // same thread as the native viewport. | 22 // same thread as the native viewport. |
24 class CommandBufferImpl : public mojo::CommandBuffer { | 23 class CommandBufferImpl : public mojo::CommandBuffer { |
25 public: | 24 public: |
26 CommandBufferImpl(mojo::InterfaceRequest<CommandBuffer> request, | 25 CommandBufferImpl(mojo::InterfaceRequest<CommandBuffer> request, |
27 mojo::ViewportParameterListenerPtr listener, | |
28 scoped_refptr<GpuState> gpu_state, | 26 scoped_refptr<GpuState> gpu_state, |
rjkroege
2015/08/06 00:16:21
you are still using virtualized gpu contexts?
Fady Samuel
2015/08/06 16:48:23
Wasn't that for texture ID translation? GpuState i
rjkroege
2015/08/06 22:09:02
yes. you are using virtual contexts. also: thread
| |
29 scoped_ptr<CommandBufferDriver> driver); | 27 scoped_ptr<CommandBufferDriver> driver); |
30 | 28 |
31 // mojo::CommandBuffer: | 29 // mojo::CommandBuffer: |
32 void Initialize(mojo::CommandBufferSyncClientPtr sync_client, | 30 void Initialize(mojo::CommandBufferSyncClientPtr sync_client, |
33 mojo::CommandBufferSyncPointClientPtr sync_point_client, | 31 mojo::CommandBufferSyncPointClientPtr sync_point_client, |
34 mojo::CommandBufferLostContextObserverPtr loss_observer, | 32 mojo::CommandBufferLostContextObserverPtr loss_observer, |
35 mojo::ScopedSharedBufferHandle shared_state) override; | 33 mojo::ScopedSharedBufferHandle shared_state) override; |
36 void SetGetBuffer(int32_t buffer) override; | 34 void SetGetBuffer(int32_t buffer) override; |
37 void Flush(int32_t put_offset) override; | 35 void Flush(int32_t put_offset) override; |
38 void MakeProgress(int32_t last_get_offset) override; | 36 void MakeProgress(int32_t last_get_offset) override; |
(...skipping 20 matching lines...) Expand all Loading... | |
59 | 57 |
60 private: | 58 private: |
61 class CommandBufferDriverClientImpl; | 59 class CommandBufferDriverClientImpl; |
62 | 60 |
63 friend class base::DeleteHelper<CommandBufferImpl>; | 61 friend class base::DeleteHelper<CommandBufferImpl>; |
64 | 62 |
65 ~CommandBufferImpl() override; | 63 ~CommandBufferImpl() override; |
66 | 64 |
67 void BindToRequest(mojo::InterfaceRequest<CommandBuffer> request); | 65 void BindToRequest(mojo::InterfaceRequest<CommandBuffer> request); |
68 | 66 |
69 void UpdateVSyncParameters(base::TimeTicks timebase, | |
70 base::TimeDelta interval); | |
71 | |
72 void OnConnectionError(); | 67 void OnConnectionError(); |
73 | 68 |
74 scoped_refptr<GpuState> gpu_state_; | 69 scoped_refptr<GpuState> gpu_state_; |
75 scoped_refptr<base::SingleThreadTaskRunner> driver_task_runner_; | 70 scoped_refptr<base::SingleThreadTaskRunner> driver_task_runner_; |
76 scoped_ptr<CommandBufferDriver> driver_; | 71 scoped_ptr<CommandBufferDriver> driver_; |
77 mojo::CommandBufferSyncPointClientPtr sync_point_client_; | 72 mojo::CommandBufferSyncPointClientPtr sync_point_client_; |
78 mojo::ViewportParameterListenerPtr viewport_parameter_listener_; | |
79 mojo::Binding<CommandBuffer> binding_; | 73 mojo::Binding<CommandBuffer> binding_; |
80 CommandBufferImplObserver* observer_; | 74 CommandBufferImplObserver* observer_; |
81 base::WeakPtrFactory<CommandBufferImpl> weak_ptr_factory_; | 75 base::WeakPtrFactory<CommandBufferImpl> weak_ptr_factory_; |
82 | 76 |
83 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); | 77 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); |
84 }; | 78 }; |
85 | 79 |
86 } // namespace gles2 | 80 } // namespace gles2 |
87 | 81 |
88 #endif // COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ | 82 #endif // COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |