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 #include "ui/ozone/platform/dri/ozone_platform_gbm.h" | 5 #include "ui/ozone/platform/dri/ozone_platform_gbm.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <gbm.h> | 8 #include <gbm.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 | 10 |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "ui/events/ozone/device/device_manager.h" | 13 #include "ui/events/ozone/device/device_manager.h" |
14 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 14 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
15 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" | 15 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" |
16 #include "ui/ozone/platform/dri/dri_window.h" | 16 #include "ui/ozone/platform/dri/dri_window.h" |
17 #include "ui/ozone/platform/dri/dri_window_delegate_proxy.h" | |
17 #include "ui/ozone/platform/dri/dri_window_manager.h" | 18 #include "ui/ozone/platform/dri/dri_window_manager.h" |
18 #include "ui/ozone/platform/dri/dri_wrapper.h" | 19 #include "ui/ozone/platform/dri/dri_wrapper.h" |
19 #include "ui/ozone/platform/dri/gbm_buffer.h" | 20 #include "ui/ozone/platform/dri/gbm_buffer.h" |
20 #include "ui/ozone/platform/dri/gbm_surface.h" | 21 #include "ui/ozone/platform/dri/gbm_surface.h" |
21 #include "ui/ozone/platform/dri/gbm_surface_factory.h" | 22 #include "ui/ozone/platform/dri/gbm_surface_factory.h" |
22 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" | 23 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" |
23 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" | 24 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" |
24 #include "ui/ozone/platform/dri/scanout_buffer.h" | 25 #include "ui/ozone/platform/dri/scanout_buffer.h" |
25 #include "ui/ozone/platform/dri/screen_manager.h" | 26 #include "ui/ozone/platform/dri/screen_manager.h" |
26 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" | 27 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 } | 94 } |
94 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { | 95 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { |
95 return gpu_platform_support_host_.get(); | 96 return gpu_platform_support_host_.get(); |
96 } | 97 } |
97 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( | 98 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( |
98 PlatformWindowDelegate* delegate, | 99 PlatformWindowDelegate* delegate, |
99 const gfx::Rect& bounds) OVERRIDE { | 100 const gfx::Rect& bounds) OVERRIDE { |
100 return scoped_ptr<PlatformWindow>( | 101 return scoped_ptr<PlatformWindow>( |
101 new DriWindow(delegate, | 102 new DriWindow(delegate, |
102 bounds, | 103 bounds, |
103 surface_factory_ozone_.get(), | 104 scoped_ptr<DriWindowDelegate>(new DriWindowDelegateProxy( |
alexst (slow to review)
2014/08/20 21:51:09
make_scoped_ptr
| |
105 ui_window_manager_.NextAcceleratedWidget(), | |
106 gpu_platform_support_host_.get())), | |
104 event_factory_ozone_.get())); | 107 event_factory_ozone_.get())); |
105 } | 108 } |
106 #if defined(OS_CHROMEOS) | 109 #if defined(OS_CHROMEOS) |
107 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 110 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
108 OVERRIDE { | 111 OVERRIDE { |
109 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( | 112 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( |
110 gpu_platform_support_host_.get(), device_manager_.get())); | 113 gpu_platform_support_host_.get(), device_manager_.get())); |
111 } | 114 } |
112 virtual scoped_ptr<TouchscreenDeviceManager> | 115 virtual scoped_ptr<TouchscreenDeviceManager> |
113 CreateTouchscreenDeviceManager() OVERRIDE { | 116 CreateTouchscreenDeviceManager() OVERRIDE { |
114 return scoped_ptr<TouchscreenDeviceManager>( | 117 return scoped_ptr<TouchscreenDeviceManager>( |
115 new TouchscreenDeviceManagerOzone()); | 118 new TouchscreenDeviceManagerOzone()); |
116 } | 119 } |
117 #endif | 120 #endif |
118 virtual void InitializeUI() OVERRIDE { | 121 virtual void InitializeUI() OVERRIDE { |
119 vt_manager_.reset(new VirtualTerminalManager()); | 122 vt_manager_.reset(new VirtualTerminalManager()); |
120 // Needed since the browser process creates the accelerated widgets and that | 123 // Needed since the browser process creates the accelerated widgets and that |
121 // happens through SFO. | 124 // happens through SFO. |
122 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 125 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
123 | |
124 device_manager_ = CreateDeviceManager(); | 126 device_manager_ = CreateDeviceManager(); |
125 gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm()); | 127 gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm()); |
126 cursor_factory_ozone_.reset( | 128 cursor_factory_ozone_.reset( |
127 new CursorFactoryEvdevDri(gpu_platform_support_host_.get())); | 129 new CursorFactoryEvdevDri(gpu_platform_support_host_.get())); |
128 event_factory_ozone_.reset(new EventFactoryEvdev( | 130 event_factory_ozone_.reset(new EventFactoryEvdev( |
129 cursor_factory_ozone_.get(), device_manager_.get())); | 131 cursor_factory_ozone_.get(), device_manager_.get())); |
130 } | 132 } |
131 | 133 |
132 virtual void InitializeGPU() OVERRIDE { | 134 virtual void InitializeGPU() OVERRIDE { |
133 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); | 135 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); |
134 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); | 136 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); |
135 screen_manager_.reset(new ScreenManager(dri_.get(), | 137 screen_manager_.reset(new ScreenManager(dri_.get(), |
136 buffer_generator_.get())); | 138 buffer_generator_.get())); |
137 if (!surface_factory_ozone_) | 139 if (!surface_factory_ozone_) |
138 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 140 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
139 | 141 |
140 surface_factory_ozone_->InitializeGpu(dri_.get(), | 142 surface_factory_ozone_->InitializeGpu(dri_.get(), |
141 buffer_generator_->device(), | 143 buffer_generator_->device(), |
142 screen_manager_.get()); | 144 screen_manager_.get(), |
145 &gpu_window_manager_); | |
143 gpu_platform_support_.reset( | 146 gpu_platform_support_.reset( |
144 new GpuPlatformSupportGbm(surface_factory_ozone_.get(), | 147 new GpuPlatformSupportGbm(surface_factory_ozone_.get(), |
145 &gpu_window_manager_, | 148 &gpu_window_manager_, |
146 screen_manager_.get())); | 149 screen_manager_.get())); |
147 #if defined(OS_CHROMEOS) | 150 #if defined(OS_CHROMEOS) |
148 gpu_platform_support_->AddHandler(scoped_ptr<GpuPlatformSupport>( | 151 gpu_platform_support_->AddHandler(scoped_ptr<GpuPlatformSupport>( |
149 new DisplayMessageHandler( | 152 new DisplayMessageHandler( |
150 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( | 153 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( |
151 dri_.get(), | 154 dri_.get(), |
152 screen_manager_.get(), | 155 screen_manager_.get(), |
(...skipping 13 matching lines...) Expand all Loading... | |
166 scoped_ptr<DeviceManager> device_manager_; | 169 scoped_ptr<DeviceManager> device_manager_; |
167 | 170 |
168 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; | 171 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; |
169 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; | 172 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; |
170 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 173 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
171 | 174 |
172 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; | 175 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; |
173 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; | 176 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; |
174 | 177 |
175 DriWindowManager gpu_window_manager_; | 178 DriWindowManager gpu_window_manager_; |
179 DriWindowManager ui_window_manager_; | |
176 | 180 |
177 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 181 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
178 }; | 182 }; |
179 | 183 |
180 } // namespace | 184 } // namespace |
181 | 185 |
182 OzonePlatform* CreateOzonePlatformGbm() { | 186 OzonePlatform* CreateOzonePlatformGbm() { |
183 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 187 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
184 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 188 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
185 } | 189 } |
186 | 190 |
187 } // namespace ui | 191 } // namespace ui |
OLD | NEW |