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

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: Fix platform cast build 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.h> 7 #include <drm.h>
8 #include <xf86drm.h> 8 #include <xf86drm.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "ui/gfx/geometry/rect.h" 11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/ozone/platform/drm/gpu/drm_device.h" 12 #include "ui/ozone/platform/drm/gpu/drm_device.h"
13 13
14 namespace ui { 14 namespace ui {
15 15
16 namespace {
17 #define FOURCC(a, b, c, d) \
dnicoara 2015/08/25 16:27:13 #defines shouldn't be in a namespace
dnicoara 2015/08/25 16:27:13 What was the issue with including drm_fourcc.h?
kalyank 2015/08/25 16:38:09 Acknowledged.
kalyank 2015/08/25 16:39:47 chromeos_daisy_chromium_compile_only_ng, cast_shel
kalyank 2015/08/25 16:54:36 Done.
dnicoara 2015/08/25 17:35:32 Silly me, I was looking at the wrong version. I f
kalyank 2015/08/25 17:56:18 Thanks, should have checked that. Waiting for tryb
18 ((static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \
19 (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24))
20
21 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4')
22
23 #ifndef DRM_PLANE_TYPE_OVERLAY
24 #define DRM_PLANE_TYPE_OVERLAY 0
25 #endif
26
27 #ifndef DRM_PLANE_TYPE_PRIMARY
28 #define DRM_PLANE_TYPE_PRIMARY 1
29 #endif
30
31 #ifndef DRM_PLANE_TYPE_CURSOR
32 #define DRM_PLANE_TYPE_CURSOR 2
33 #endif
34
35 const char* kTypePropName = "type";
36 HardwareDisplayPlane::Type GetPlaneType(int value) {
37 switch (value) {
38 case DRM_PLANE_TYPE_CURSOR:
39 return HardwareDisplayPlane::kCursor;
40 case DRM_PLANE_TYPE_PRIMARY:
41 return HardwareDisplayPlane::kPrimary;
42 case DRM_PLANE_TYPE_OVERLAY:
43 return HardwareDisplayPlane::kOverlay;
44 default:
45 NOTREACHED();
46 return HardwareDisplayPlane::kDummy;
47 }
48 }
49
50 } // namespace
51
16 HardwareDisplayPlane::HardwareDisplayPlane(uint32_t plane_id, 52 HardwareDisplayPlane::HardwareDisplayPlane(uint32_t plane_id,
17 uint32_t possible_crtcs) 53 uint32_t possible_crtcs)
18 : plane_id_(plane_id), possible_crtcs_(possible_crtcs) { 54 : plane_id_(plane_id), possible_crtcs_(possible_crtcs) {
19 } 55 }
20 56
21 HardwareDisplayPlane::~HardwareDisplayPlane() { 57 HardwareDisplayPlane::~HardwareDisplayPlane() {
22 } 58 }
23 59
24 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) { 60 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) {
25 return possible_crtcs_ & (1 << crtc_index); 61 return possible_crtcs_ & (1 << crtc_index);
26 } 62 }
27 63
28 bool HardwareDisplayPlane::Initialize(DrmDevice* drm, 64 bool HardwareDisplayPlane::Initialize(DrmDevice* drm,
29 const std::vector<uint32_t>& formats) { 65 const std::vector<uint32_t>& formats,
30 return true; 66 bool is_dummy) {
67 if (is_dummy) {
68 type_ = kDummy;
69 supported_formats_.push_back(DRM_FORMAT_XRGB8888);
70 return true;
71 }
72
73 supported_formats_ = formats;
74
75 ScopedDrmObjectPropertyPtr plane_props(drmModeObjectGetProperties(
76 drm->get_fd(), plane_id_, DRM_MODE_OBJECT_PLANE));
77 if (!plane_props) {
78 PLOG(ERROR) << "Unable to get plane properties.";
79 return false;
80 }
81
82 uint32_t count_props = plane_props->count_props;
83 for (uint32_t i = 0; i < count_props; i++) {
84 ScopedDrmPropertyPtr property(
85 drmModeGetProperty(drm->get_fd(), plane_props->props[i]));
86 if (property && !strcmp(property->name, kTypePropName)) {
87 type_ = GetPlaneType(plane_props->prop_values[i]);
88 }
89 }
90
91 return InitializeProperties(drm, plane_props);
31 } 92 }
32 93
33 bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const { 94 bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const {
34 return true; 95 return true;
35 } 96 }
36 97
98 bool HardwareDisplayPlane::InitializeProperties(
99 DrmDevice* drm,
100 const ScopedDrmObjectPropertyPtr& plane_props) {
101 return true;
102 }
103
37 } // namespace ui 104 } // 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