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

Side by Side Diff: ui/ozone/platform/dri/dri_wrapper.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: 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/dri_wrapper.h" 5 #include "ui/ozone/platform/dri/dri_wrapper.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/mman.h> 8 #include <sys/mman.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 #include <xf86drm.h> 10 #include <xf86drm.h>
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 DriWrapper::DriWrapper(const base::FilePath& device_path, base::File file) 157 DriWrapper::DriWrapper(const base::FilePath& device_path, base::File file)
158 : device_path_(device_path), file_(file.Pass()) { 158 : device_path_(device_path), file_(file.Pass()) {
159 } 159 }
160 160
161 DriWrapper::~DriWrapper() { 161 DriWrapper::~DriWrapper() {
162 if (watcher_) 162 if (watcher_)
163 watcher_->Shutdown(); 163 watcher_->Shutdown();
164 } 164 }
165 165
166 void DriWrapper::Initialize() { 166 bool DriWrapper::Initialize() {
167 plane_manager_.reset(new HardwareDisplayPlaneManagerLegacy()); 167 plane_manager_.reset(new HardwareDisplayPlaneManagerLegacy());
168 if (!plane_manager_->Initialize(this)) 168 if (!plane_manager_->Initialize(this)) {
169 LOG(ERROR) << "Failed to initialize the plane manager"; 169 LOG(ERROR) << "Failed to initialize the plane manager for "
170 << device_path_.value();
171 return false;
alexst (slow to review) 2015/02/23 21:46:32 Should reset the plane manager here since it's in
dnicoara 2015/02/23 21:49:10 Done.
172 }
173
174 return true;
170 } 175 }
171 176
172 void DriWrapper::InitializeTaskRunner( 177 void DriWrapper::InitializeTaskRunner(
173 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { 178 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
174 DCHECK(!task_runner_); 179 DCHECK(!task_runner_);
175 task_runner_ = task_runner; 180 task_runner_ = task_runner;
176 watcher_ = new IOWatcher(file_.GetPlatformFile(), task_runner_); 181 watcher_ = new IOWatcher(file_.GetPlatformFile(), task_runner_);
177 } 182 }
178 183
179 ScopedDrmCrtcPtr DriWrapper::GetCrtc(uint32_t crtc_id) { 184 ScopedDrmCrtcPtr DriWrapper::GetCrtc(uint32_t crtc_id) {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 DCHECK(file_.IsValid()); 411 DCHECK(file_.IsValid());
407 return (drmSetMaster(file_.GetPlatformFile()) == 0); 412 return (drmSetMaster(file_.GetPlatformFile()) == 0);
408 } 413 }
409 414
410 bool DriWrapper::DropMaster() { 415 bool DriWrapper::DropMaster() {
411 DCHECK(file_.IsValid()); 416 DCHECK(file_.IsValid());
412 return (drmDropMaster(file_.GetPlatformFile()) == 0); 417 return (drmDropMaster(file_.GetPlatformFile()) == 0);
413 } 418 }
414 419
415 } // namespace ui 420 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698