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

Side by Side Diff: ui/ozone/platform/dri/ozone_platform_gbm.cc

Issue 469343003: [Ozone-GBM] Pumb DriWindowDelegate throughout the platform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittest && rebase Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ui/ozone/platform/dri/ozone_platform_dri.cc ('k') | ui/ozone/platform/dri/screen_manager.h » ('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 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 91 }
91 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { 92 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE {
92 return gpu_platform_support_.get(); 93 return gpu_platform_support_.get();
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 scoped_ptr<DriWindow> platform_window(
101 new DriWindow(delegate, 102 new DriWindow(delegate,
102 bounds, 103 bounds,
103 surface_factory_ozone_.get(), 104 scoped_ptr<DriWindowDelegate>(new DriWindowDelegateProxy(
104 event_factory_ozone_.get())); 105 ui_window_manager_.NextAcceleratedWidget(),
106 gpu_platform_support_host_.get())),
107 event_factory_ozone_.get(),
108 &ui_window_manager_));
109 platform_window->Initialize();
110 return platform_window.PassAs<PlatformWindow>();
105 } 111 }
106 #if defined(OS_CHROMEOS) 112 #if defined(OS_CHROMEOS)
107 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() 113 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
108 OVERRIDE { 114 OVERRIDE {
109 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( 115 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy(
110 gpu_platform_support_host_.get(), device_manager_.get())); 116 gpu_platform_support_host_.get(), device_manager_.get()));
111 } 117 }
112 virtual scoped_ptr<TouchscreenDeviceManager> 118 virtual scoped_ptr<TouchscreenDeviceManager>
113 CreateTouchscreenDeviceManager() OVERRIDE { 119 CreateTouchscreenDeviceManager() OVERRIDE {
114 return scoped_ptr<TouchscreenDeviceManager>( 120 return scoped_ptr<TouchscreenDeviceManager>(
115 new TouchscreenDeviceManagerOzone()); 121 new TouchscreenDeviceManagerOzone());
116 } 122 }
117 #endif 123 #endif
118 virtual void InitializeUI() OVERRIDE { 124 virtual void InitializeUI() OVERRIDE {
119 vt_manager_.reset(new VirtualTerminalManager()); 125 vt_manager_.reset(new VirtualTerminalManager());
120 // Needed since the browser process creates the accelerated widgets and that 126 // Needed since the browser process creates the accelerated widgets and that
121 // happens through SFO. 127 // happens through SFO.
122 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); 128 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
123
124 device_manager_ = CreateDeviceManager(); 129 device_manager_ = CreateDeviceManager();
125 gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm()); 130 gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm());
126 cursor_factory_ozone_.reset( 131 cursor_factory_ozone_.reset(
127 new CursorFactoryEvdevDri(gpu_platform_support_host_.get())); 132 new CursorFactoryEvdevDri(gpu_platform_support_host_.get()));
128 event_factory_ozone_.reset(new EventFactoryEvdev( 133 event_factory_ozone_.reset(new EventFactoryEvdev(
129 cursor_factory_ozone_.get(), device_manager_.get())); 134 cursor_factory_ozone_.get(), device_manager_.get()));
130 } 135 }
131 136
132 virtual void InitializeGPU() OVERRIDE { 137 virtual void InitializeGPU() OVERRIDE {
133 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); 138 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath));
134 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); 139 buffer_generator_.reset(new GbmBufferGenerator(dri_.get()));
135 screen_manager_.reset(new ScreenManager(dri_.get(), 140 screen_manager_.reset(new ScreenManager(dri_.get(),
136 buffer_generator_.get())); 141 buffer_generator_.get()));
137 if (!surface_factory_ozone_) 142 if (!surface_factory_ozone_)
138 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); 143 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
139 144
140 surface_factory_ozone_->InitializeGpu(dri_.get(), 145 surface_factory_ozone_->InitializeGpu(dri_.get(),
141 buffer_generator_->device(), 146 buffer_generator_->device(),
142 screen_manager_.get()); 147 screen_manager_.get(),
148 &gpu_window_manager_);
143 gpu_platform_support_.reset( 149 gpu_platform_support_.reset(
144 new GpuPlatformSupportGbm(surface_factory_ozone_.get(), 150 new GpuPlatformSupportGbm(surface_factory_ozone_.get(),
145 &gpu_window_manager_, 151 &gpu_window_manager_,
146 screen_manager_.get())); 152 screen_manager_.get()));
147 #if defined(OS_CHROMEOS) 153 #if defined(OS_CHROMEOS)
148 gpu_platform_support_->AddHandler(scoped_ptr<GpuPlatformSupport>( 154 gpu_platform_support_->AddHandler(scoped_ptr<GpuPlatformSupport>(
149 new DisplayMessageHandler( 155 new DisplayMessageHandler(
150 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( 156 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri(
151 dri_.get(), 157 dri_.get(),
152 screen_manager_.get(), 158 screen_manager_.get(),
(...skipping 13 matching lines...) Expand all
166 scoped_ptr<DeviceManager> device_manager_; 172 scoped_ptr<DeviceManager> device_manager_;
167 173
168 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; 174 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_;
169 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; 175 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_;
170 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; 176 scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
171 177
172 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; 178 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_;
173 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; 179 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_;
174 180
175 DriWindowManager gpu_window_manager_; 181 DriWindowManager gpu_window_manager_;
182 DriWindowManager ui_window_manager_;
176 183
177 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); 184 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm);
178 }; 185 };
179 186
180 } // namespace 187 } // namespace
181 188
182 OzonePlatform* CreateOzonePlatformGbm() { 189 OzonePlatform* CreateOzonePlatformGbm() {
183 CommandLine* cmd = CommandLine::ForCurrentProcess(); 190 CommandLine* cmd = CommandLine::ForCurrentProcess();
184 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); 191 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless));
185 } 192 }
186 193
187 } // namespace ui 194 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/ozone_platform_dri.cc ('k') | ui/ozone/platform/dri/screen_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698