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/drm/ozone_platform_gbm.h" | 5 #include "ui/ozone/platform/drm/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 28 matching lines...) Expand all Loading... | |
39 #include "ui/ozone/public/ozone_platform.h" | 39 #include "ui/ozone/public/ozone_platform.h" |
40 #include "ui/ozone/public/ozone_switches.h" | 40 #include "ui/ozone/public/ozone_switches.h" |
41 | 41 |
42 #if defined(USE_XKBCOMMON) | 42 #if defined(USE_XKBCOMMON) |
43 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h" | 43 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h" |
44 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" | 44 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" |
45 #else | 45 #else |
46 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" | 46 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" |
47 #endif | 47 #endif |
48 | 48 |
49 #if defined(USE_VGEM_MAP) | |
50 #include <fcntl.h> | |
51 #endif | |
52 | |
49 namespace ui { | 53 namespace ui { |
50 | 54 |
51 namespace { | 55 namespace { |
52 | 56 |
53 class GlApiLoader { | 57 class GlApiLoader { |
54 public: | 58 public: |
55 GlApiLoader() | 59 GlApiLoader() |
56 : glapi_lib_(dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL)) {} | 60 : glapi_lib_(dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL)) {} |
57 | 61 |
58 ~GlApiLoader() { | 62 ~GlApiLoader() { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 new DrmWindowHost(delegate, bounds, gpu_platform_support_host_.get(), | 146 new DrmWindowHost(delegate, bounds, gpu_platform_support_host_.get(), |
143 event_factory_ozone_.get(), cursor_.get(), | 147 event_factory_ozone_.get(), cursor_.get(), |
144 window_manager_.get(), display_manager_.get())); | 148 window_manager_.get(), display_manager_.get())); |
145 platform_window->Initialize(); | 149 platform_window->Initialize(); |
146 return platform_window.Pass(); | 150 return platform_window.Pass(); |
147 } | 151 } |
148 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 152 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
149 return make_scoped_ptr( | 153 return make_scoped_ptr( |
150 new DrmNativeDisplayDelegate(display_manager_.get())); | 154 new DrmNativeDisplayDelegate(display_manager_.get())); |
151 } | 155 } |
156 base::ScopedFD OpenClientNativePixmapDevice() const override { | |
157 #if defined(USE_VGEM_MAP) | |
158 static const char kVgemPath[] = "/dev/dri/renderD129"; | |
159 int vgem_fd = open(kVgemPath, O_RDWR | O_CLOEXEC); | |
dcheng
2015/08/21 14:44:06
base::ScopedFD vgem_fd(open(...));
dshwang
2015/08/21 18:38:37
Done.
| |
160 DCHECK_GE(vgem_fd, 0) << "Failed to open: " << kVgemPath; | |
dcheng
2015/08/21 14:44:06
DCHECK(vgem_fd.is_valid())
dshwang
2015/08/21 18:38:37
Done.
| |
161 return base::ScopedFD(vgem_fd); | |
dcheng
2015/08/21 14:44:06
return vgem_fd
dshwang
2015/08/21 18:38:37
Done.
| |
162 #endif | |
163 return base::ScopedFD(); | |
164 } | |
152 void InitializeUI() override { | 165 void InitializeUI() override { |
153 device_manager_ = CreateDeviceManager(); | 166 device_manager_ = CreateDeviceManager(); |
154 window_manager_.reset(new DrmWindowHostManager()); | 167 window_manager_.reset(new DrmWindowHostManager()); |
155 cursor_.reset(new DrmCursor(window_manager_.get())); | 168 cursor_.reset(new DrmCursor(window_manager_.get())); |
156 #if defined(USE_XKBCOMMON) | 169 #if defined(USE_XKBCOMMON) |
157 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr( | 170 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr( |
158 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_))); | 171 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_))); |
159 #else | 172 #else |
160 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 173 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
161 make_scoped_ptr(new StubKeyboardLayoutEngine())); | 174 make_scoped_ptr(new StubKeyboardLayoutEngine())); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 OzonePlatform* CreateOzonePlatformGbm() { | 237 OzonePlatform* CreateOzonePlatformGbm() { |
225 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 238 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
226 #if defined(USE_MESA_PLATFORM_NULL) | 239 #if defined(USE_MESA_PLATFORM_NULL) |
227 // Only works with surfaceless. | 240 // Only works with surfaceless. |
228 cmd->AppendSwitch(switches::kOzoneUseSurfaceless); | 241 cmd->AppendSwitch(switches::kOzoneUseSurfaceless); |
229 #endif | 242 #endif |
230 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 243 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
231 } | 244 } |
232 | 245 |
233 } // namespace ui | 246 } // namespace ui |
OLD | NEW |