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

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

Issue 409793007: Add plane manager to the atomic swap path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
Index: ui/ozone/platform/dri/hardware_display_plane_manager.cc
diff --git a/ui/ozone/platform/dri/hardware_display_plane_manager.cc b/ui/ozone/platform/dri/hardware_display_plane_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..18a08326611e5d472bf6ac343342091f1641a035
--- /dev/null
+++ b/ui/ozone/platform/dri/hardware_display_plane_manager.cc
@@ -0,0 +1,57 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/ozone/platform/dri/hardware_display_plane_manager.h"
+
+#include <drm.h>
+#include <errno.h>
+#include <xf86drm.h>
+
+#include "base/logging.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/ozone/platform/dri/dri_wrapper.h"
+
+namespace ui {
+
+HardwareDisplayPlaneManager::HardwareDisplayPlaneManager(DriWrapper* drm)
+ : drm_(drm), property_set_(NULL) {
+}
+
+HardwareDisplayPlaneManager::~HardwareDisplayPlaneManager() {
+ if (property_set_)
+ drmModePropertySetFree(property_set_);
+}
+
+bool HardwareDisplayPlaneManager::Initialize() {
+ ScopedDrmPlaneResPtr plane_resources(
+ drmModeGetPlaneResources(drm_->get_fd()));
+ if (!plane_resources) {
+ LOG(ERROR) << "Failed to get plane resources";
dnicoara 2014/07/22 20:48:32 nit: Period at the end :)
+ return false;
+ }
+
+ property_set_ = drmModePropertySetAlloc();
+ if (!property_set_) {
+ LOG(ERROR) << "Failed to get property set";
dnicoara 2014/07/22 20:48:32 s/get/allocate/ ?
+ return false;
+ }
+
+ uint32_t num_planes = plane_resources->count_planes;
+ for (uint32_t i = 0; i < num_planes; i++) {
dnicoara 2014/07/22 20:48:32 nit: pre-increment. I'm conflicted about this one,
+ ScopedDrmPlanePtr drm_plane(
+ drmModeGetPlane(drm_->get_fd(), plane_resources->planes[i]));
+ if (!drm_plane) {
+ LOG(ERROR) << "Failed to get plane " << i;
+ return false;
+ }
+ scoped_ptr<HardwareDisplayPlane> plane(
+ new HardwareDisplayPlane(drm_, property_set_, drm_plane.Pass()));
+ if (plane->Initialize())
+ planes_.push_back(plane.release());
+ }
+
+ return true;
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698