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

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

Issue 913273006: ozone: choose a card useful for display rather than by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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
(...skipping 29 matching lines...) Expand all
40 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h" 40 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h"
41 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" 41 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h"
42 #else 42 #else
43 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" 43 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
44 #endif 44 #endif
45 45
46 namespace ui { 46 namespace ui {
47 47
48 namespace { 48 namespace {
49 49
50 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0";
51
52 class GlApiLoader { 50 class GlApiLoader {
53 public: 51 public:
54 GlApiLoader() 52 GlApiLoader()
55 : glapi_lib_(dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL)) {} 53 : glapi_lib_(dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL)) {}
56 54
57 ~GlApiLoader() { 55 ~GlApiLoader() {
58 if (glapi_lib_) 56 if (glapi_lib_)
59 dlclose(glapi_lib_); 57 dlclose(glapi_lib_);
60 } 58 }
61 59
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 make_scoped_ptr(new StubKeyboardLayoutEngine())); 143 make_scoped_ptr(new StubKeyboardLayoutEngine()));
146 #endif 144 #endif
147 event_factory_ozone_.reset(new EventFactoryEvdev( 145 event_factory_ozone_.reset(new EventFactoryEvdev(
148 cursor_.get(), device_manager_.get(), 146 cursor_.get(), device_manager_.get(),
149 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); 147 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()));
150 } 148 }
151 149
152 void InitializeGPU() override { 150 void InitializeGPU() override {
153 gl_api_loader_.reset(new GlApiLoader()); 151 gl_api_loader_.reset(new GlApiLoader());
154 // Async page flips are supported only on surfaceless mode. 152 // Async page flips are supported only on surfaceless mode.
155 gbm_.reset(new GbmWrapper(kDefaultGraphicsCardPath)); 153 gbm_.reset(new GbmWrapper(NULL));
156 gbm_->Initialize(); 154 gbm_->Initialize();
157 buffer_generator_.reset(new GbmBufferGenerator()); 155 buffer_generator_.reset(new GbmBufferGenerator());
158 screen_manager_.reset( 156 screen_manager_.reset(
159 new ScreenManager(gbm_.get(), buffer_generator_.get())); 157 new ScreenManager(gbm_.get(), buffer_generator_.get()));
160 window_delegate_manager_.reset(new DriWindowDelegateManager()); 158 window_delegate_manager_.reset(new DriWindowDelegateManager());
161 if (!surface_factory_ozone_) 159 if (!surface_factory_ozone_)
162 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); 160 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
163 161
164 surface_factory_ozone_->InitializeGpu(gbm_.get(), 162 surface_factory_ozone_->InitializeGpu(gbm_.get(),
165 window_delegate_manager_.get()); 163 window_delegate_manager_.get());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 OzonePlatform* CreateOzonePlatformGbm() { 202 OzonePlatform* CreateOzonePlatformGbm() {
205 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 203 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
206 #if defined(USE_MESA_PLATFORM_NULL) 204 #if defined(USE_MESA_PLATFORM_NULL)
207 // Only works with surfaceless. 205 // Only works with surfaceless.
208 cmd->AppendSwitch(switches::kOzoneUseSurfaceless); 206 cmd->AppendSwitch(switches::kOzoneUseSurfaceless);
209 #endif 207 #endif
210 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); 208 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless));
211 } 209 }
212 210
213 } // namespace ui 211 } // namespace ui
OLDNEW
« ui/ozone/platform/dri/ozone_platform_dri.cc ('K') | « ui/ozone/platform/dri/ozone_platform_dri.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698