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

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

Issue 947293002: [Ozone-Dri] Gracefully handle DRM devices with no resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make errors/warning to vlogs 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/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"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 return true; 212 return true;
213 } 213 }
214 214
215 void NativeDisplayDelegateDri::AddGraphicsDevice( 215 void NativeDisplayDelegateDri::AddGraphicsDevice(
216 const base::FilePath& path, 216 const base::FilePath& path,
217 const base::FileDescriptor& fd) { 217 const base::FileDescriptor& fd) {
218 base::File file(fd.fd); 218 base::File file(fd.fd);
219 auto it = 219 auto it =
220 std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path)); 220 std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path));
221 if (it != devices_.end()) { 221 if (it != devices_.end()) {
222 LOG(WARNING) << "Got request to add existing device '" << path.value() 222 VLOG(2) << "Got request to add existing device '" << path.value() << "'";
223 << "'";
224 return; 223 return;
225 } 224 }
226 225
227 scoped_refptr<DriWrapper> device = 226 scoped_refptr<DriWrapper> device =
228 drm_device_generator_->CreateDevice(path, file.Pass()); 227 drm_device_generator_->CreateDevice(path, file.Pass());
228 if (!device) {
229 VLOG(2) << "Could not initialize DRM device for '" << path.value() << "'";
230 return;
231 }
232
229 devices_.push_back(device); 233 devices_.push_back(device);
230 if (io_task_runner_) 234 if (io_task_runner_)
231 device->InitializeTaskRunner(io_task_runner_); 235 device->InitializeTaskRunner(io_task_runner_);
232 } 236 }
233 237
234 void NativeDisplayDelegateDri::RemoveGraphicsDevice( 238 void NativeDisplayDelegateDri::RemoveGraphicsDevice(
235 const base::FilePath& path) { 239 const base::FilePath& path) {
236 auto it = 240 auto it =
237 std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path)); 241 std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path));
238 if (it == devices_.end()) { 242 if (it == devices_.end()) {
239 LOG(ERROR) << "Got request to remove non-existent device '" << path.value() 243 VLOG(2) << "Got request to remove non-existent device '" << path.value()
240 << "'"; 244 << "'";
241 return; 245 return;
242 } 246 }
243 247
244 devices_.erase(it); 248 devices_.erase(it);
245 } 249 }
246 250
247 DisplaySnapshotDri* NativeDisplayDelegateDri::FindDisplaySnapshot(int64_t id) { 251 DisplaySnapshotDri* NativeDisplayDelegateDri::FindDisplaySnapshot(int64_t id) {
248 for (size_t i = 0; i < cached_displays_.size(); ++i) 252 for (size_t i = 0; i < cached_displays_.size(); ++i)
249 if (cached_displays_[i]->display_id() == id) 253 if (cached_displays_[i]->display_id() == id)
250 return cached_displays_[i]; 254 return cached_displays_[i];
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 412
409 if (it == old_displays.end()) { 413 if (it == old_displays.end()) {
410 screen_manager_->AddDisplayController(new_displays[i]->drm(), 414 screen_manager_->AddDisplayController(new_displays[i]->drm(),
411 new_displays[i]->crtc(), 415 new_displays[i]->crtc(),
412 new_displays[i]->connector()); 416 new_displays[i]->connector());
413 } 417 }
414 } 418 }
415 } 419 }
416 420
417 } // namespace ui 421 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/hardware_display_plane_manager.cc ('k') | ui/ozone/platform/dri/ozone_platform_dri.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698