OLD | NEW |
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 "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 9 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
10 #include "ui/events/ozone/device/device_manager.h" | 10 #include "ui/events/ozone/device/device_manager.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) | 45 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) |
46 // | 46 // |
47 // This platform is Linux without any display server (no X, wayland, or | 47 // This platform is Linux without any display server (no X, wayland, or |
48 // anything). This means chrome alone owns the display and input devices. | 48 // anything). This means chrome alone owns the display and input devices. |
49 class OzonePlatformDri : public OzonePlatform { | 49 class OzonePlatformDri : public OzonePlatform { |
50 public: | 50 public: |
51 OzonePlatformDri() | 51 OzonePlatformDri() |
52 : dri_(new DriWrapper(GetFirstDisplayCardPath())), | 52 : dri_(new DriWrapper(GetPrimaryDisplayCardPath())), |
53 buffer_generator_(new DriBufferGenerator()), | 53 buffer_generator_(new DriBufferGenerator()), |
54 screen_manager_(new ScreenManager(buffer_generator_.get())), | 54 screen_manager_(new ScreenManager(buffer_generator_.get())), |
55 device_manager_(CreateDeviceManager()), | 55 device_manager_(CreateDeviceManager()), |
56 window_delegate_manager_() {} | 56 window_delegate_manager_() {} |
57 ~OzonePlatformDri() override {} | 57 ~OzonePlatformDri() override {} |
58 | 58 |
59 // OzonePlatform: | 59 // OzonePlatform: |
60 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { | 60 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { |
61 return surface_factory_ozone_.get(); | 61 return surface_factory_ozone_.get(); |
62 } | 62 } |
(...skipping 18 matching lines...) Expand all Loading... |
81 scoped_ptr<DriWindow> platform_window( | 81 scoped_ptr<DriWindow> platform_window( |
82 new DriWindow(delegate, bounds, gpu_platform_support_host_.get(), | 82 new DriWindow(delegate, bounds, gpu_platform_support_host_.get(), |
83 event_factory_ozone_.get(), cursor_.get(), | 83 event_factory_ozone_.get(), cursor_.get(), |
84 window_manager_.get(), display_manager_.get())); | 84 window_manager_.get(), display_manager_.get())); |
85 platform_window->Initialize(); | 85 platform_window->Initialize(); |
86 return platform_window.Pass(); | 86 return platform_window.Pass(); |
87 } | 87 } |
88 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 88 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
89 return make_scoped_ptr(new NativeDisplayDelegateProxy( | 89 return make_scoped_ptr(new NativeDisplayDelegateProxy( |
90 gpu_platform_support_host_.get(), device_manager_.get(), | 90 gpu_platform_support_host_.get(), device_manager_.get(), |
91 display_manager_.get())); | 91 display_manager_.get(), dri_->device_path())); |
92 } | 92 } |
93 void InitializeUI() override { | 93 void InitializeUI() override { |
94 if (!dri_->Initialize()) | 94 if (!dri_->Initialize()) |
95 LOG(FATAL) << "Failed to initialize primary DRM device"; | 95 LOG(FATAL) << "Failed to initialize primary DRM device"; |
96 | 96 |
97 // This makes sure that simple targets that do not handle display | 97 // This makes sure that simple targets that do not handle display |
98 // configuration can still use the primary display. | 98 // configuration can still use the primary display. |
99 ForceInitializationOfPrimaryDisplay(dri_, screen_manager_.get()); | 99 ForceInitializationOfPrimaryDisplay(dri_, screen_manager_.get()); |
100 drm_device_manager_.reset(new DrmDeviceManager(dri_)); | 100 drm_device_manager_.reset(new DrmDeviceManager(dri_)); |
101 display_manager_.reset(new DisplayManager()); | 101 display_manager_.reset(new DisplayManager()); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); | 160 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); |
161 }; | 161 }; |
162 | 162 |
163 } // namespace | 163 } // namespace |
164 | 164 |
165 OzonePlatform* CreateOzonePlatformDri() { | 165 OzonePlatform* CreateOzonePlatformDri() { |
166 return new OzonePlatformDri; | 166 return new OzonePlatformDri; |
167 } | 167 } |
168 | 168 |
169 } // namespace ui | 169 } // namespace ui |
OLD | NEW |