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

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

Issue 310673002: ozone: gbm: Fix libglapi linkage errors under gbm (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | 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 <stdlib.h> 8 #include <stdlib.h>
8 #include <gbm.h> 9 #include <gbm.h>
9 10
10 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" 11 #include "ui/base/cursor/ozone/cursor_factory_ozone.h"
11 #include "ui/events/ozone/device/device_manager.h" 12 #include "ui/events/ozone/device/device_manager.h"
12 #include "ui/events/ozone/evdev/event_factory_evdev.h" 13 #include "ui/events/ozone/evdev/event_factory_evdev.h"
13 #include "ui/ozone/ozone_platform.h" 14 #include "ui/ozone/ozone_platform.h"
14 #include "ui/ozone/platform/dri/dri_wrapper.h" 15 #include "ui/ozone/platform/dri/dri_wrapper.h"
15 #include "ui/ozone/platform/dri/gbm_surface.h" 16 #include "ui/ozone/platform/dri/gbm_surface.h"
16 #include "ui/ozone/platform/dri/gbm_surface_factory.h" 17 #include "ui/ozone/platform/dri/gbm_surface_factory.h"
17 #include "ui/ozone/platform/dri/scanout_surface.h" 18 #include "ui/ozone/platform/dri/scanout_surface.h"
18 #include "ui/ozone/platform/dri/screen_manager.h" 19 #include "ui/ozone/platform/dri/screen_manager.h"
19 20
20 #if defined(OS_CHROMEOS) 21 #if defined(OS_CHROMEOS)
21 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" 22 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h"
22 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" 23 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h"
23 #endif 24 #endif
24 25
25 namespace ui { 26 namespace ui {
26 27
27 namespace { 28 namespace {
28 29
29 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0"; 30 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0";
30 31
31 class GbmSurfaceGenerator : public ScanoutSurfaceGenerator { 32 class GbmSurfaceGenerator : public ScanoutSurfaceGenerator {
32 public: 33 public:
33 GbmSurfaceGenerator(DriWrapper* dri) 34 GbmSurfaceGenerator(DriWrapper* dri)
34 : dri_(dri), 35 : dri_(dri),
36 glapi_lib_(dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL)),
35 device_(gbm_create_device(dri_->get_fd())) {} 37 device_(gbm_create_device(dri_->get_fd())) {}
36 virtual ~GbmSurfaceGenerator() { 38 virtual ~GbmSurfaceGenerator() {
37 gbm_device_destroy(device_); 39 gbm_device_destroy(device_);
40 if (glapi_lib_)
41 dlclose(glapi_lib_);
38 } 42 }
39 43
40 gbm_device* device() const { return device_; } 44 gbm_device* device() const { return device_; }
41 45
42 virtual ScanoutSurface* Create(const gfx::Size& size) OVERRIDE { 46 virtual ScanoutSurface* Create(const gfx::Size& size) OVERRIDE {
43 return new GbmSurface(device_, dri_, size); 47 return new GbmSurface(device_, dri_, size);
44 } 48 }
45 49
46 private: 50 private:
47 DriWrapper* dri_; // Not owned. 51 DriWrapper* dri_; // Not owned.
48 52
53 // HACK: gbm drivers have broken linkage
54 void *glapi_lib_;
55
49 gbm_device* device_; 56 gbm_device* device_;
50 57
51 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceGenerator); 58 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceGenerator);
52 }; 59 };
53 60
54 class OzonePlatformGbm : public OzonePlatform { 61 class OzonePlatformGbm : public OzonePlatform {
55 public: 62 public:
56 OzonePlatformGbm() {} 63 OzonePlatformGbm() {}
57 virtual ~OzonePlatformGbm() {} 64 virtual ~OzonePlatformGbm() {}
58 65
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; 118 scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
112 119
113 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); 120 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm);
114 }; 121 };
115 122
116 } // namespace 123 } // namespace
117 124
118 OzonePlatform* CreateOzonePlatformGbm() { return new OzonePlatformGbm; } 125 OzonePlatform* CreateOzonePlatformGbm() { return new OzonePlatformGbm; }
119 126
120 } // namespace ui 127 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698