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

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: rebase 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
« no previous file with comments | « ui/ozone/platform/dri/hardware_display_plane_manager.h ('k') | ui/ozone/platform/dri/scoped_drm_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0e9bc999b76a529ee4456c37889eb2c59b6d2dc4
--- /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.";
+ return false;
+ }
+
+ property_set_ = drmModePropertySetAlloc();
+ if (!property_set_) {
+ LOG(ERROR) << "Failed to allocate property set.";
+ return false;
+ }
+
+ uint32_t num_planes = plane_resources->count_planes;
+ for (uint32_t i = 0; i < num_planes; ++i) {
+ 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
« no previous file with comments | « ui/ozone/platform/dri/hardware_display_plane_manager.h ('k') | ui/ozone/platform/dri/scoped_drm_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698