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

Side by Side Diff: services/ui/gpu/gpu_main.h

Issue 2539893002: Mus: Implement GpuMain mojo interface (Closed)
Patch Set: Addressed Sadrul's comments Created 4 years 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 | « gpu/command_buffer/client/gpu_memory_buffer_manager.h ('k') | services/ui/gpu/gpu_main.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 SERVICES_UI_GPU_GPU_MAIN_H_ 5 #ifndef SERVICES_UI_GPU_GPU_MAIN_H_
6 #define SERVICES_UI_GPU_GPU_MAIN_H_ 6 #define SERVICES_UI_GPU_GPU_MAIN_H_
7 7
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "gpu/ipc/in_process_command_buffer.h"
9 #include "gpu/ipc/service/gpu_init.h" 10 #include "gpu/ipc/service/gpu_init.h"
11 #include "services/ui/gpu/interfaces/gpu_main.mojom.h"
10 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h" 12 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h"
13 #include "services/ui/surfaces/display_compositor.h"
11 14
12 namespace gpu { 15 namespace gpu {
13 class GpuMemoryBufferFactory; 16 class GpuMemoryBufferFactory;
17 class ImageFactory;
14 } 18 }
15 19
16 namespace ui { 20 namespace ui {
17 21
18 class GpuServiceInternal; 22 class GpuServiceInternal;
19 23
20 class GpuMain : public gpu::GpuSandboxHelper { 24 class GpuMain : public gpu::GpuSandboxHelper, public mojom::GpuMain {
21 public: 25 public:
22 GpuMain(); 26 explicit GpuMain(mojom::GpuMainRequest request);
23 ~GpuMain() override; 27 ~GpuMain() override;
24 28
29 // mojom::GpuMain implementation:
30 void CreateGpuService(mojom::GpuServiceInternalRequest request,
31 const CreateGpuServiceCallback& callback) override;
32 void CreateDisplayCompositor(
33 cc::mojom::DisplayCompositorRequest request,
34 cc::mojom::DisplayCompositorClientPtr client) override;
35
25 void OnStart(); 36 void OnStart();
26 void Create(mojom::GpuServiceInternalRequest request);
27 37
28 GpuServiceInternal* gpu_service() { return gpu_service_internal_.get(); } 38 GpuServiceInternal* gpu_service() { return gpu_service_internal_.get(); }
29 39
30 private: 40 private:
31 void InitOnGpuThread( 41 void InitOnGpuThread(
32 scoped_refptr<base::SingleThreadTaskRunner> io_runner, 42 scoped_refptr<base::SingleThreadTaskRunner> io_runner,
33 scoped_refptr<base::SingleThreadTaskRunner> compositor_runner); 43 scoped_refptr<base::SingleThreadTaskRunner> compositor_runner);
34 44
45 void CreateDisplayCompositorInternal(
46 cc::mojom::DisplayCompositorRequest request,
47 cc::mojom::DisplayCompositorClientPtrInfo client_info);
48 void CreateDisplayCompositorOnCompositorThread(
49 gpu::ImageFactory* image_factory,
50 mojom::GpuServiceInternalPtrInfo gpu_service_info,
51 cc::mojom::DisplayCompositorRequest request,
52 cc::mojom::DisplayCompositorClientPtrInfo client_info);
53 void CreateGpuServiceOnGpuThread(
54 mojom::GpuServiceInternalRequest request,
55 scoped_refptr<base::SingleThreadTaskRunner> origin_runner,
56 const CreateGpuServiceCallback& callback);
57
35 void TearDownOnCompositorThread(); 58 void TearDownOnCompositorThread();
36 void TearDownOnGpuThread(); 59 void TearDownOnGpuThread();
37 void CreateOnGpuThread(mojom::GpuServiceInternalRequest request);
38 60
39 // gpu::GpuSandboxHelper: 61 // gpu::GpuSandboxHelper:
40 void PreSandboxStartup() override; 62 void PreSandboxStartup() override;
41 bool EnsureSandboxInitialized( 63 bool EnsureSandboxInitialized(
42 gpu::GpuWatchdogThread* watchdog_thread) override; 64 gpu::GpuWatchdogThread* watchdog_thread) override;
43 65
44 std::unique_ptr<gpu::GpuInit> gpu_init_; 66 std::unique_ptr<gpu::GpuInit> gpu_init_;
45 std::unique_ptr<GpuServiceInternal> gpu_service_internal_; 67 std::unique_ptr<GpuServiceInternal> gpu_service_internal_;
68
69 // The message-pipe used by the DisplayCompositor to request gpu memory
70 // buffers.
71 mojom::GpuServiceInternalPtr gpu_internal_;
72
73 // The InCommandCommandBuffer::Service used by the display compositor.
74 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_command_service_;
75
76 // If the gpu service is not yet ready then we stash pending MessagePipes in
77 // these member variables.
78 cc::mojom::DisplayCompositorRequest pending_display_compositor_request_;
79 cc::mojom::DisplayCompositorClientPtrInfo
80 pending_display_compositor_client_info_;
81
82 std::unique_ptr<DisplayCompositor> display_compositor_;
83
46 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; 84 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
47 85
48 // The main thread for GpuService. 86 // The main thread for GpuService.
49 base::Thread gpu_thread_; 87 base::Thread gpu_thread_;
50 88
51 // The thread that handles IO events for GpuService. 89 // The thread that handles IO events for GpuService.
52 base::Thread io_thread_; 90 base::Thread io_thread_;
53 91
54 // The thread used for the display compositor. 92 // The display compositor gets its own thread in mus-gpu. The gpu service,
93 // where GL commands are processed resides on its own thread. Various
94 // components of the display compositor such as Display, ResourceProvider,
95 // and GLRenderer block on sync tokens from other command buffers. Thus,
96 // the gpu service must live on a separate thread.
55 base::Thread compositor_thread_; 97 base::Thread compositor_thread_;
56 98
57 base::WeakPtrFactory<GpuMain> weak_factory_; 99 mojo::Binding<mojom::GpuMain> binding_;
58 100
59 DISALLOW_COPY_AND_ASSIGN(GpuMain); 101 DISALLOW_COPY_AND_ASSIGN(GpuMain);
60 }; 102 };
61 103
62 } // namespace ui 104 } // namespace ui
63 105
64 #endif // SERVICES_UI_GPU_GPU_MAIN_H_ 106 #endif // SERVICES_UI_GPU_GPU_MAIN_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gpu_memory_buffer_manager.h ('k') | services/ui/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698