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

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

Issue 377753002: [Ozone-GBM] Add basic support for display configuration over IPC (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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
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 "ui/events/ozone/device/device_manager.h" 12 #include "ui/events/ozone/device/device_manager.h"
13 #include "ui/events/ozone/evdev/event_factory_evdev.h" 13 #include "ui/events/ozone/evdev/event_factory_evdev.h"
14 #include "ui/ozone/ozone_platform.h" 14 #include "ui/ozone/ozone_platform.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_wrapper.h" 16 #include "ui/ozone/platform/dri/dri_wrapper.h"
17 #include "ui/ozone/platform/dri/gbm_surface.h" 17 #include "ui/ozone/platform/dri/gbm_surface.h"
18 #include "ui/ozone/platform/dri/gbm_surface_factory.h" 18 #include "ui/ozone/platform/dri/gbm_surface_factory.h"
19 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" 19 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h"
20 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" 20 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h"
21 #include "ui/ozone/platform/dri/scanout_surface.h" 21 #include "ui/ozone/platform/dri/scanout_surface.h"
22 #include "ui/ozone/platform/dri/screen_manager.h" 22 #include "ui/ozone/platform/dri/screen_manager.h"
23 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" 23 #include "ui/ozone/platform/dri/virtual_terminal_manager.h"
24 #include "ui/ozone/public/cursor_factory_ozone.h" 24 #include "ui/ozone/public/cursor_factory_ozone.h"
25 #include "ui/ozone/public/gpu_platform_support.h" 25 #include "ui/ozone/public/gpu_platform_support.h"
26 #include "ui/ozone/public/gpu_platform_support_host.h" 26 #include "ui/ozone/public/gpu_platform_support_host.h"
27 27
28 #if defined(OS_CHROMEOS) 28 #if defined(OS_CHROMEOS)
29 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h"
30 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" 29 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h"
30 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h"
31 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_proxy.h"
31 #endif 32 #endif
32 33
33 namespace ui { 34 namespace ui {
34 35
35 namespace { 36 namespace {
36 37
37 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0"; 38 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0";
38 39
39 class GbmSurfaceGenerator : public ScanoutSurfaceGenerator { 40 class GbmSurfaceGenerator : public ScanoutSurfaceGenerator {
40 public: 41 public:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 86 }
86 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { 87 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE {
87 return gpu_platform_support_.get(); 88 return gpu_platform_support_.get();
88 } 89 }
89 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { 90 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE {
90 return gpu_platform_support_host_.get(); 91 return gpu_platform_support_host_.get();
91 } 92 }
92 #if defined(OS_CHROMEOS) 93 #if defined(OS_CHROMEOS)
93 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() 94 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
94 OVERRIDE { 95 OVERRIDE {
95 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); 96 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy(
97 gpu_platform_support_host_.get(), device_manager_.get()));
96 } 98 }
97 virtual scoped_ptr<TouchscreenDeviceManager> 99 virtual scoped_ptr<TouchscreenDeviceManager>
98 CreateTouchscreenDeviceManager() OVERRIDE { 100 CreateTouchscreenDeviceManager() OVERRIDE {
99 return scoped_ptr<TouchscreenDeviceManager>( 101 return scoped_ptr<TouchscreenDeviceManager>(
100 new TouchscreenDeviceManagerOzone()); 102 new TouchscreenDeviceManagerOzone());
101 } 103 }
102 #endif 104 #endif
103 virtual void InitializeUI() OVERRIDE { 105 virtual void InitializeUI() OVERRIDE {
104 vt_manager_.reset(new VirtualTerminalManager()); 106 vt_manager_.reset(new VirtualTerminalManager());
105 // Needed since the browser process creates the accelerated widgets and that 107 // Needed since the browser process creates the accelerated widgets and that
(...skipping 15 matching lines...) Expand all
121 surface_generator_.get())); 123 surface_generator_.get()));
122 if (!surface_factory_ozone_) 124 if (!surface_factory_ozone_)
123 surface_factory_ozone_.reset(new GbmSurfaceFactory()); 125 surface_factory_ozone_.reset(new GbmSurfaceFactory());
124 126
125 surface_factory_ozone_->InitializeGpu(dri_.get(), 127 surface_factory_ozone_->InitializeGpu(dri_.get(),
126 surface_generator_->device(), 128 surface_generator_->device(),
127 screen_manager_.get()); 129 screen_manager_.get());
128 130
129 gpu_platform_support_.reset( 131 gpu_platform_support_.reset(
130 new GpuPlatformSupportGbm(surface_factory_ozone_.get())); 132 new GpuPlatformSupportGbm(surface_factory_ozone_.get()));
133 #if defined(OS_CHROMEOS)
134 gpu_platform_support_->SetNativeDisplayDelegate(
135 scoped_ptr<NativeDisplayDelegateDri>(
136 new NativeDisplayDelegateDri(dri_.get(),
137 screen_manager_.get(),
138 NULL)));
139 #endif
131 } 140 }
132 141
133 private: 142 private:
134 scoped_ptr<VirtualTerminalManager> vt_manager_; 143 scoped_ptr<VirtualTerminalManager> vt_manager_;
135 scoped_ptr<DriWrapper> dri_; 144 scoped_ptr<DriWrapper> dri_;
136 scoped_ptr<GbmSurfaceGenerator> surface_generator_; 145 scoped_ptr<GbmSurfaceGenerator> surface_generator_;
137 scoped_ptr<ScreenManager> screen_manager_; 146 scoped_ptr<ScreenManager> screen_manager_;
138 scoped_ptr<DeviceManager> device_manager_; 147 scoped_ptr<DeviceManager> device_manager_;
139 148
140 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; 149 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_;
141 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; 150 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_;
142 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; 151 scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
143 152
144 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; 153 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_;
145 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; 154 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_;
146 155
147 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); 156 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm);
148 }; 157 };
149 158
150 } // namespace 159 } // namespace
151 160
152 OzonePlatform* CreateOzonePlatformGbm() { return new OzonePlatformGbm; } 161 OzonePlatform* CreateOzonePlatformGbm() { return new OzonePlatformGbm; }
153 162
154 } // namespace ui 163 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698