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

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

Issue 908993003: [Ozone-Dri] Rename DriWrapper to DrmDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@udl3-pass-drm-fd
Patch Set: rebased Created 5 years, 9 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/native_display_delegate_dri.h" 5 #include "ui/ozone/platform/dri/native_display_delegate_dri.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_descriptor_posix.h" 9 #include "base/file_descriptor_posix.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "ui/display/types/native_display_observer.h" 12 #include "ui/display/types/native_display_observer.h"
13 #include "ui/events/ozone/device/device_event.h" 13 #include "ui/events/ozone/device/device_event.h"
14 #include "ui/ozone/common/display_util.h" 14 #include "ui/ozone/common/display_util.h"
15 #include "ui/ozone/platform/dri/display_mode_dri.h" 15 #include "ui/ozone/platform/dri/display_mode_dri.h"
16 #include "ui/ozone/platform/dri/display_snapshot_dri.h" 16 #include "ui/ozone/platform/dri/display_snapshot_dri.h"
17 #include "ui/ozone/platform/dri/dri_util.h" 17 #include "ui/ozone/platform/dri/dri_util.h"
18 #include "ui/ozone/platform/dri/dri_wrapper.h" 18 #include "ui/ozone/platform/dri/drm_device.h"
19 #include "ui/ozone/platform/dri/drm_device_generator.h" 19 #include "ui/ozone/platform/dri/drm_device_generator.h"
20 #include "ui/ozone/platform/dri/screen_manager.h" 20 #include "ui/ozone/platform/dri/screen_manager.h"
21 #include "ui/ozone/public/ozone_switches.h" 21 #include "ui/ozone/public/ozone_switches.h"
22 22
23 namespace ui { 23 namespace ui {
24 24
25 namespace { 25 namespace {
26 26
27 const char kContentProtection[] = "Content Protection"; 27 const char kContentProtection[] = "Content Protection";
28 28
(...skipping 25 matching lines...) Expand all
54 return 0; 54 return 0;
55 } 55 }
56 56
57 class DisplaySnapshotComparator { 57 class DisplaySnapshotComparator {
58 public: 58 public:
59 explicit DisplaySnapshotComparator(const DisplaySnapshotDri* snapshot) 59 explicit DisplaySnapshotComparator(const DisplaySnapshotDri* snapshot)
60 : drm_(snapshot->drm()), 60 : drm_(snapshot->drm()),
61 crtc_(snapshot->crtc()), 61 crtc_(snapshot->crtc()),
62 connector_(snapshot->connector()) {} 62 connector_(snapshot->connector()) {}
63 63
64 DisplaySnapshotComparator(const scoped_refptr<DriWrapper>& drm, 64 DisplaySnapshotComparator(const scoped_refptr<DrmDevice>& drm,
65 uint32_t crtc, 65 uint32_t crtc,
66 uint32_t connector) 66 uint32_t connector)
67 : drm_(drm), crtc_(crtc), connector_(connector) {} 67 : drm_(drm), crtc_(crtc), connector_(connector) {}
68 68
69 bool operator()(const DisplaySnapshotDri* other) const { 69 bool operator()(const DisplaySnapshotDri* other) const {
70 return drm_ == other->drm() && connector_ == other->connector() && 70 return drm_ == other->drm() && connector_ == other->connector() &&
71 crtc_ == other->crtc(); 71 crtc_ == other->crtc();
72 } 72 }
73 73
74 private: 74 private:
75 scoped_refptr<DriWrapper> drm_; 75 scoped_refptr<DrmDevice> drm_;
76 uint32_t crtc_; 76 uint32_t crtc_;
77 uint32_t connector_; 77 uint32_t connector_;
78 }; 78 };
79 79
80 class FindByDevicePath { 80 class FindByDevicePath {
81 public: 81 public:
82 explicit FindByDevicePath(const base::FilePath& path) : path_(path) {} 82 explicit FindByDevicePath(const base::FilePath& path) : path_(path) {}
83 83
84 bool operator()(const scoped_refptr<DriWrapper>& device) { 84 bool operator()(const scoped_refptr<DrmDevice>& device) {
85 return device->device_path() == path_; 85 return device->device_path() == path_;
86 } 86 }
87 87
88 private: 88 private:
89 base::FilePath path_; 89 base::FilePath path_;
90 }; 90 };
91 91
92 } // namespace 92 } // namespace
93 93
94 NativeDisplayDelegateDri::NativeDisplayDelegateDri( 94 NativeDisplayDelegateDri::NativeDisplayDelegateDri(
95 ScreenManager* screen_manager, 95 ScreenManager* screen_manager,
96 const scoped_refptr<DriWrapper>& primary_device, 96 const scoped_refptr<DrmDevice>& primary_device,
97 scoped_ptr<DrmDeviceGenerator> drm_device_generator) 97 scoped_ptr<DrmDeviceGenerator> drm_device_generator)
98 : screen_manager_(screen_manager), 98 : screen_manager_(screen_manager),
99 drm_device_generator_(drm_device_generator.Pass()) { 99 drm_device_generator_(drm_device_generator.Pass()) {
100 devices_.push_back(primary_device); 100 devices_.push_back(primary_device);
101 } 101 }
102 102
103 NativeDisplayDelegateDri::~NativeDisplayDelegateDri() { 103 NativeDisplayDelegateDri::~NativeDisplayDelegateDri() {
104 } 104 }
105 105
106 void NativeDisplayDelegateDri::InitializeIOTaskRunner( 106 void NativeDisplayDelegateDri::InitializeIOTaskRunner(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 const base::FilePath& path, 206 const base::FilePath& path,
207 const base::FileDescriptor& fd) { 207 const base::FileDescriptor& fd) {
208 base::File file(fd.fd); 208 base::File file(fd.fd);
209 auto it = 209 auto it =
210 std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path)); 210 std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path));
211 if (it != devices_.end()) { 211 if (it != devices_.end()) {
212 VLOG(2) << "Got request to add existing device '" << path.value() << "'"; 212 VLOG(2) << "Got request to add existing device '" << path.value() << "'";
213 return; 213 return;
214 } 214 }
215 215
216 scoped_refptr<DriWrapper> device = 216 scoped_refptr<DrmDevice> device =
217 drm_device_generator_->CreateDevice(path, file.Pass()); 217 drm_device_generator_->CreateDevice(path, file.Pass());
218 if (!device) { 218 if (!device) {
219 VLOG(2) << "Could not initialize DRM device for '" << path.value() << "'"; 219 VLOG(2) << "Could not initialize DRM device for '" << path.value() << "'";
220 return; 220 return;
221 } 221 }
222 222
223 devices_.push_back(device); 223 devices_.push_back(device);
224 if (io_task_runner_) 224 if (io_task_runner_)
225 device->InitializeTaskRunner(io_task_runner_); 225 device->InitializeTaskRunner(io_task_runner_);
226 } 226 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 408
409 if (it == old_displays.end()) { 409 if (it == old_displays.end()) {
410 screen_manager_->AddDisplayController(new_displays[i]->drm(), 410 screen_manager_->AddDisplayController(new_displays[i]->drm(),
411 new_displays[i]->crtc(), 411 new_displays[i]->crtc(),
412 new_displays[i]->connector()); 412 new_displays[i]->connector());
413 } 413 }
414 } 414 }
415 } 415 }
416 416
417 } // namespace ui 417 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/native_display_delegate_dri.h ('k') | ui/ozone/platform/dri/ozone_platform_dri.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698