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

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

Issue 393233005: [Ozone-DRI] Convert HardwareDisplayController to use scanout buffers (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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_dri.h" 5 #include "ui/ozone/platform/dri/ozone_platform_dri.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "ui/events/ozone/device/device_manager.h" 8 #include "ui/events/ozone/device/device_manager.h"
9 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" 9 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
10 #include "ui/events/ozone/evdev/event_factory_evdev.h" 10 #include "ui/events/ozone/evdev/event_factory_evdev.h"
11 #include "ui/ozone/common/window/platform_window_compat.h" 11 #include "ui/ozone/common/window/platform_window_compat.h"
12 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" 12 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h"
13 #include "ui/ozone/platform/dri/dri_surface.h" 13 #include "ui/ozone/platform/dri/dri_buffer.h"
14 #include "ui/ozone/platform/dri/dri_surface_factory.h" 14 #include "ui/ozone/platform/dri/dri_surface_factory.h"
15 #include "ui/ozone/platform/dri/dri_wrapper.h" 15 #include "ui/ozone/platform/dri/dri_wrapper.h"
16 #include "ui/ozone/platform/dri/scanout_surface.h"
17 #include "ui/ozone/platform/dri/screen_manager.h" 16 #include "ui/ozone/platform/dri/screen_manager.h"
18 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" 17 #include "ui/ozone/platform/dri/virtual_terminal_manager.h"
19 #include "ui/ozone/public/ozone_platform.h" 18 #include "ui/ozone/public/ozone_platform.h"
20 19
21 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
22 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" 21 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h"
23 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" 22 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h"
24 #endif 23 #endif
25 24
26 namespace ui { 25 namespace ui {
27 26
28 namespace { 27 namespace {
29 28
30 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0"; 29 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0";
31 30
32 class DriSurfaceGenerator : public ScanoutSurfaceGenerator {
33 public:
34 DriSurfaceGenerator(DriWrapper* dri) : dri_(dri) {}
35 virtual ~DriSurfaceGenerator() {}
36
37 virtual ScanoutSurface* Create(const gfx::Size& size) OVERRIDE {
38 return new DriSurface(dri_, size);
39 }
40
41 private:
42 DriWrapper* dri_; // Not owned.
43
44 DISALLOW_COPY_AND_ASSIGN(DriSurfaceGenerator);
45 };
46
47 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) 31 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure)
48 // 32 //
49 // This platform is Linux without any display server (no X, wayland, or 33 // This platform is Linux without any display server (no X, wayland, or
50 // anything). This means chrome alone owns the display and input devices. 34 // anything). This means chrome alone owns the display and input devices.
51 class OzonePlatformDri : public OzonePlatform { 35 class OzonePlatformDri : public OzonePlatform {
52 public: 36 public:
53 OzonePlatformDri() 37 OzonePlatformDri()
54 : vt_manager_(new VirtualTerminalManager()), 38 : vt_manager_(new VirtualTerminalManager()),
55 dri_(new DriWrapper(kDefaultGraphicsCardPath)), 39 dri_(new DriWrapper(kDefaultGraphicsCardPath)),
56 surface_generator_(new DriSurfaceGenerator(dri_.get())), 40 buffer_generator_(new DriBufferGenerator(dri_.get())),
57 screen_manager_(new ScreenManager(dri_.get(), 41 screen_manager_(new ScreenManager(dri_.get(),
58 surface_generator_.get())), 42 buffer_generator_.get())),
59 device_manager_(CreateDeviceManager()) { 43 device_manager_(CreateDeviceManager()) {
60 base::AtExitManager::RegisterTask( 44 base::AtExitManager::RegisterTask(
61 base::Bind(&base::DeletePointer<OzonePlatformDri>, this)); 45 base::Bind(&base::DeletePointer<OzonePlatformDri>, this));
62 } 46 }
63 virtual ~OzonePlatformDri() {} 47 virtual ~OzonePlatformDri() {}
64 48
65 // OzonePlatform: 49 // OzonePlatform:
66 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { 50 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE {
67 return surface_factory_ozone_.get(); 51 return surface_factory_ozone_.get();
68 } 52 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 new CursorFactoryEvdevDri(surface_factory_ozone_.get())); 87 new CursorFactoryEvdevDri(surface_factory_ozone_.get()));
104 event_factory_ozone_.reset(new EventFactoryEvdev( 88 event_factory_ozone_.reset(new EventFactoryEvdev(
105 cursor_factory_ozone_.get(), device_manager_.get())); 89 cursor_factory_ozone_.get(), device_manager_.get()));
106 } 90 }
107 91
108 virtual void InitializeGPU() OVERRIDE {} 92 virtual void InitializeGPU() OVERRIDE {}
109 93
110 private: 94 private:
111 scoped_ptr<VirtualTerminalManager> vt_manager_; 95 scoped_ptr<VirtualTerminalManager> vt_manager_;
112 scoped_ptr<DriWrapper> dri_; 96 scoped_ptr<DriWrapper> dri_;
113 scoped_ptr<DriSurfaceGenerator> surface_generator_; 97 scoped_ptr<DriBufferGenerator> buffer_generator_;
114 scoped_ptr<ScreenManager> screen_manager_; 98 scoped_ptr<ScreenManager> screen_manager_;
115 scoped_ptr<DeviceManager> device_manager_; 99 scoped_ptr<DeviceManager> device_manager_;
116 100
117 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; 101 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_;
118 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; 102 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_;
119 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; 103 scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
120 104
121 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); 105 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri);
122 }; 106 };
123 107
124 } // namespace 108 } // namespace
125 109
126 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } 110 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; }
127 111
128 } // namespace ui 112 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698