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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/ozone/platform/dri/hardware_display_plane_manager.h"
6
7 #include <drm.h>
8 #include <errno.h>
9 #include <xf86drm.h>
10
11 #include "base/logging.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/ozone/platform/dri/dri_wrapper.h"
14
15 namespace ui {
16
17 HardwareDisplayPlaneManager::HardwareDisplayPlaneManager(DriWrapper* drm)
18 : drm_(drm), property_set_(NULL) {
19 }
20
21 HardwareDisplayPlaneManager::~HardwareDisplayPlaneManager() {
22 if (property_set_)
23 drmModePropertySetFree(property_set_);
24 }
25
26 bool HardwareDisplayPlaneManager::Initialize() {
27 ScopedDrmPlaneResPtr plane_resources(
28 drmModeGetPlaneResources(drm_->get_fd()));
29 if (!plane_resources) {
30 LOG(ERROR) << "Failed to get plane resources.";
31 return false;
32 }
33
34 property_set_ = drmModePropertySetAlloc();
35 if (!property_set_) {
36 LOG(ERROR) << "Failed to allocate property set.";
37 return false;
38 }
39
40 uint32_t num_planes = plane_resources->count_planes;
41 for (uint32_t i = 0; i < num_planes; ++i) {
42 ScopedDrmPlanePtr drm_plane(
43 drmModeGetPlane(drm_->get_fd(), plane_resources->planes[i]));
44 if (!drm_plane) {
45 LOG(ERROR) << "Failed to get plane " << i << ".";
46 return false;
47 }
48 scoped_ptr<HardwareDisplayPlane> plane(
49 new HardwareDisplayPlane(drm_, property_set_, drm_plane.Pass()));
50 if (plane->Initialize())
51 planes_.push_back(plane.release());
52 }
53
54 return true;
55 }
56
57 } // namespace ui
OLDNEW
« 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