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

Side by Side Diff: ui/ozone/platform/drm/gpu/hardware_display_plane.cc

Issue 1294113005: Atomic: Don’t keep track of Cursor planes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style fix Created 5 years, 4 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/drm/gpu/hardware_display_plane.h" 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane.h"
6 6
7 #include <drm_fourcc.h>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "ui/ozone/platform/drm/gpu/drm_device.h" 10 #include "ui/ozone/platform/drm/gpu/drm_device.h"
9 11
12 #ifndef DRM_PLANE_TYPE_OVERLAY
13 #define DRM_PLANE_TYPE_OVERLAY 0
14 #endif
15
16 #ifndef DRM_PLANE_TYPE_PRIMARY
17 #define DRM_PLANE_TYPE_PRIMARY 1
18 #endif
19
20 #ifndef DRM_PLANE_TYPE_CURSOR
21 #define DRM_PLANE_TYPE_CURSOR 2
22 #endif
23
10 namespace ui { 24 namespace ui {
11 25
26 namespace {
27
28 const char* kTypePropName = "type";
29 HardwareDisplayPlane::Type GetPlaneType(int value) {
30 switch (value) {
31 case DRM_PLANE_TYPE_CURSOR:
32 return HardwareDisplayPlane::kCursor;
33 case DRM_PLANE_TYPE_PRIMARY:
34 return HardwareDisplayPlane::kPrimary;
35 case DRM_PLANE_TYPE_OVERLAY:
36 return HardwareDisplayPlane::kOverlay;
37 default:
38 NOTREACHED();
39 return HardwareDisplayPlane::kDummy;
40 }
41 }
42
43 } // namespace
44
12 HardwareDisplayPlane::HardwareDisplayPlane(uint32_t plane_id, 45 HardwareDisplayPlane::HardwareDisplayPlane(uint32_t plane_id,
13 uint32_t possible_crtcs) 46 uint32_t possible_crtcs)
14 : plane_id_(plane_id), possible_crtcs_(possible_crtcs) { 47 : plane_id_(plane_id), possible_crtcs_(possible_crtcs) {
15 } 48 }
16 49
17 HardwareDisplayPlane::~HardwareDisplayPlane() { 50 HardwareDisplayPlane::~HardwareDisplayPlane() {
18 } 51 }
19 52
20 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) { 53 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) {
21 return possible_crtcs_ & (1 << crtc_index); 54 return possible_crtcs_ & (1 << crtc_index);
22 } 55 }
23 56
24 bool HardwareDisplayPlane::Initialize(DrmDevice* drm, 57 bool HardwareDisplayPlane::Initialize(DrmDevice* drm,
25 const std::vector<uint32_t>& formats) { 58 const std::vector<uint32_t>& formats,
26 return true; 59 bool is_dummy) {
60 if (is_dummy) {
61 type_ = kDummy;
62 supported_formats_.push_back(DRM_FORMAT_XRGB8888);
63 return true;
64 }
65
66 supported_formats_ = formats;
67
68 ScopedDrmObjectPropertyPtr plane_props(drmModeObjectGetProperties(
69 drm->get_fd(), plane_id_, DRM_MODE_OBJECT_PLANE));
70 if (!plane_props) {
71 PLOG(ERROR) << "Unable to get plane properties.";
72 return false;
73 }
74
75 uint32_t count_props = plane_props->count_props;
76 for (uint32_t i = 0; i < count_props; i++) {
77 ScopedDrmPropertyPtr property(
78 drmModeGetProperty(drm->get_fd(), plane_props->props[i]));
79 if (property && !strcmp(property->name, kTypePropName)) {
80 type_ = GetPlaneType(plane_props->prop_values[i]);
81 }
82 }
83
84 return InitializeProperties(drm, plane_props);
27 } 85 }
28 86
29 bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const { 87 bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const {
30 return true; 88 return true;
31 } 89 }
32 90
91 bool HardwareDisplayPlane::InitializeProperties(
92 DrmDevice* drm,
93 const ScopedDrmObjectPropertyPtr& plane_props) {
94 return true;
95 }
96
33 } // namespace ui 97 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/hardware_display_plane.h ('k') | ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698