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

Unified Diff: ui/ozone/platform/dri/dri_wrapper.cc

Issue 956563004: [Ozone-Dri] Gracefully handle DRM devices with no resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2311
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/dri/dri_wrapper.h ('k') | ui/ozone/platform/dri/drm_device_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/dri_wrapper.cc
diff --git a/ui/ozone/platform/dri/dri_wrapper.cc b/ui/ozone/platform/dri/dri_wrapper.cc
index 9cdc994353a2ec65886d71d342abad08ffaf8fa9..a2b333f16e762f6d5ce2d67e762e7f9fb730ff80 100644
--- a/ui/ozone/platform/dri/dri_wrapper.cc
+++ b/ui/ozone/platform/dri/dri_wrapper.cc
@@ -88,6 +88,14 @@ void HandlePageFlipEventOnUI(int fd,
payload->callback.Run(frame, seconds, useconds);
}
+bool CanQueryForResources(int fd) {
+ drm_mode_card_res resources;
+ memset(&resources, 0, sizeof(resources));
+ // If there is no error getting DRM resources then assume this is a
+ // modesetting device.
+ return !drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &resources);
+}
+
} // namespace
class DriWrapper::IOWatcher
@@ -163,10 +171,23 @@ DriWrapper::~DriWrapper() {
watcher_->Shutdown();
}
-void DriWrapper::Initialize() {
+bool DriWrapper::Initialize() {
+ // Ignore devices that cannot perform modesetting.
+ if (!CanQueryForResources(file_.GetPlatformFile())) {
+ VLOG(2) << "Cannot query for resources for '" << device_path_.value()
+ << "'";
+ return false;
+ }
+
plane_manager_.reset(new HardwareDisplayPlaneManagerLegacy());
- if (!plane_manager_->Initialize(this))
- LOG(ERROR) << "Failed to initialize the plane manager";
+ if (!plane_manager_->Initialize(this)) {
+ LOG(ERROR) << "Failed to initialize the plane manager for "
+ << device_path_.value();
+ plane_manager_.reset();
+ return false;
+ }
+
+ return true;
}
void DriWrapper::InitializeTaskRunner(
« no previous file with comments | « ui/ozone/platform/dri/dri_wrapper.h ('k') | ui/ozone/platform/dri/drm_device_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698