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 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 virtual scoped_ptr<TouchscreenDeviceManager> | 97 virtual scoped_ptr<TouchscreenDeviceManager> |
98 CreateTouchscreenDeviceManager() OVERRIDE { | 98 CreateTouchscreenDeviceManager() OVERRIDE { |
99 return scoped_ptr<TouchscreenDeviceManager>( | 99 return scoped_ptr<TouchscreenDeviceManager>( |
100 new TouchscreenDeviceManagerOzone()); | 100 new TouchscreenDeviceManagerOzone()); |
101 } | 101 } |
102 #endif | 102 #endif |
103 virtual void InitializeUI() OVERRIDE { | 103 virtual void InitializeUI() OVERRIDE { |
104 vt_manager_.reset(new VirtualTerminalManager()); | 104 vt_manager_.reset(new VirtualTerminalManager()); |
105 // Needed since the browser process creates the accelerated widgets and that | 105 // Needed since the browser process creates the accelerated widgets and that |
106 // happens through SFO. | 106 // happens through SFO. |
107 surface_factory_ozone_.reset(new GbmSurfaceFactory(NULL, NULL, NULL)); | 107 surface_factory_ozone_.reset(new GbmSurfaceFactory()); |
108 | 108 |
109 device_manager_ = CreateDeviceManager(); | 109 device_manager_ = CreateDeviceManager(); |
110 gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm()); | 110 gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm()); |
111 cursor_factory_ozone_.reset( | 111 cursor_factory_ozone_.reset( |
112 new CursorFactoryEvdevDri(gpu_platform_support_host_.get())); | 112 new CursorFactoryEvdevDri(gpu_platform_support_host_.get())); |
113 event_factory_ozone_.reset(new EventFactoryEvdev( | 113 event_factory_ozone_.reset(new EventFactoryEvdev( |
114 cursor_factory_ozone_.get(), device_manager_.get())); | 114 cursor_factory_ozone_.get(), device_manager_.get())); |
115 } | 115 } |
116 | 116 |
117 virtual void InitializeGPU() OVERRIDE { | 117 virtual void InitializeGPU() OVERRIDE { |
118 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); | 118 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); |
119 surface_generator_.reset(new GbmSurfaceGenerator(dri_.get())); | 119 surface_generator_.reset(new GbmSurfaceGenerator(dri_.get())); |
120 screen_manager_.reset(new ScreenManager(dri_.get(), | 120 screen_manager_.reset(new ScreenManager(dri_.get(), |
121 surface_generator_.get())); | 121 surface_generator_.get())); |
122 surface_factory_ozone_.reset( | 122 if (!surface_factory_ozone_) |
123 new GbmSurfaceFactory(dri_.get(), | 123 surface_factory_ozone_.reset(new GbmSurfaceFactory()); |
124 surface_generator_->device(), | 124 |
125 screen_manager_.get())); | 125 surface_factory_ozone_->InitializeGpu(dri_.get(), |
| 126 surface_generator_->device(), |
| 127 screen_manager_.get()); |
126 | 128 |
127 gpu_platform_support_.reset( | 129 gpu_platform_support_.reset( |
128 new GpuPlatformSupportGbm(surface_factory_ozone_.get())); | 130 new GpuPlatformSupportGbm(surface_factory_ozone_.get())); |
129 } | 131 } |
130 | 132 |
131 private: | 133 private: |
132 scoped_ptr<VirtualTerminalManager> vt_manager_; | 134 scoped_ptr<VirtualTerminalManager> vt_manager_; |
133 scoped_ptr<DriWrapper> dri_; | 135 scoped_ptr<DriWrapper> dri_; |
134 scoped_ptr<GbmSurfaceGenerator> surface_generator_; | 136 scoped_ptr<GbmSurfaceGenerator> surface_generator_; |
135 scoped_ptr<ScreenManager> screen_manager_; | 137 scoped_ptr<ScreenManager> screen_manager_; |
136 scoped_ptr<DeviceManager> device_manager_; | 138 scoped_ptr<DeviceManager> device_manager_; |
137 | 139 |
138 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; | 140 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; |
139 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; | 141 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; |
140 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 142 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
141 | 143 |
142 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; | 144 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; |
143 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; | 145 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; |
144 | 146 |
145 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 147 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
146 }; | 148 }; |
147 | 149 |
148 } // namespace | 150 } // namespace |
149 | 151 |
150 OzonePlatform* CreateOzonePlatformGbm() { return new OzonePlatformGbm; } | 152 OzonePlatform* CreateOzonePlatformGbm() { return new OzonePlatformGbm; } |
151 | 153 |
152 } // namespace ui | 154 } // namespace ui |
OLD | NEW |