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

Side by Side Diff: ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.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, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_atomic.h" 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.h"
6 6
7 #include <drm.h> 7 #include <drm.h>
8 #include <drm/drm_fourcc.h> 8 #include <drm/drm_fourcc.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <gbm.h> 10 #include <gbm.h>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 src_rect.width()) || 82 src_rect.width()) ||
83 drmModePropertySetAdd(property_set, plane_id_, src_h_prop_.id, 83 drmModePropertySetAdd(property_set, plane_id_, src_h_prop_.id,
84 src_rect.height()); 84 src_rect.height());
85 if (plane_set_error) { 85 if (plane_set_error) {
86 PLOG(ERROR) << "Failed to set plane data"; 86 PLOG(ERROR) << "Failed to set plane data";
87 return false; 87 return false;
88 } 88 }
89 return true; 89 return true;
90 } 90 }
91 91
92 bool HardwareDisplayPlaneAtomic::Initialize( 92 bool HardwareDisplayPlaneAtomic::InitializeProperties(
93 DrmDevice* drm, 93 DrmDevice* drm,
94 const std::vector<uint32_t>& formats) { 94 const ScopedDrmObjectPropertyPtr& plane_props) {
95 ScopedDrmObjectPropertyPtr plane_props(drmModeObjectGetProperties(
96 drm->get_fd(), plane_id_, DRM_MODE_OBJECT_PLANE));
97
98 if (!plane_props) {
99 PLOG(ERROR) << "Unable to get plane properties.";
100 return false;
101 }
102
103 bool props_init = crtc_prop_.Initialize(drm, kCrtcPropName, plane_props) && 95 bool props_init = crtc_prop_.Initialize(drm, kCrtcPropName, plane_props) &&
104 fb_prop_.Initialize(drm, kFbPropName, plane_props) && 96 fb_prop_.Initialize(drm, kFbPropName, plane_props) &&
105 crtc_x_prop_.Initialize(drm, kCrtcXPropName, plane_props) && 97 crtc_x_prop_.Initialize(drm, kCrtcXPropName, plane_props) &&
106 crtc_y_prop_.Initialize(drm, kCrtcYPropName, plane_props) && 98 crtc_y_prop_.Initialize(drm, kCrtcYPropName, plane_props) &&
107 crtc_w_prop_.Initialize(drm, kCrtcWPropName, plane_props) && 99 crtc_w_prop_.Initialize(drm, kCrtcWPropName, plane_props) &&
108 crtc_h_prop_.Initialize(drm, kCrtcHPropName, plane_props) && 100 crtc_h_prop_.Initialize(drm, kCrtcHPropName, plane_props) &&
109 src_x_prop_.Initialize(drm, kSrcXPropName, plane_props) && 101 src_x_prop_.Initialize(drm, kSrcXPropName, plane_props) &&
110 src_y_prop_.Initialize(drm, kSrcYPropName, plane_props) && 102 src_y_prop_.Initialize(drm, kSrcYPropName, plane_props) &&
111 src_w_prop_.Initialize(drm, kSrcWPropName, plane_props) && 103 src_w_prop_.Initialize(drm, kSrcWPropName, plane_props) &&
112 src_h_prop_.Initialize(drm, kSrcHPropName, plane_props); 104 src_h_prop_.Initialize(drm, kSrcHPropName, plane_props);
113 105
114 if (!props_init) { 106 if (!props_init) {
115 LOG(ERROR) << "Unable to get plane properties."; 107 LOG(ERROR) << "Unable to get plane properties.";
116 return false; 108 return false;
117 } 109 }
118 110
119 supported_formats_ = formats;
120 if (is_dummy())
121 supported_formats_.push_back(DRM_FORMAT_XRGB8888);
122
123 return true; 111 return true;
124 } 112 }
125 113
126 bool HardwareDisplayPlaneAtomic::IsSupportedFormat(uint32_t format) const { 114 bool HardwareDisplayPlaneAtomic::IsSupportedFormat(uint32_t format) const {
127 uint32_t format_type = 0; 115 uint32_t format_type = 0;
128 switch (format) { 116 switch (format) {
129 case GBM_BO_FORMAT_ARGB8888: { 117 case GBM_BO_FORMAT_ARGB8888: {
130 // We create a FB of 24 bit color depth. 118 // We create a FB of 24 bit color depth.
131 format_type = DRM_FORMAT_XRGB8888; 119 format_type = DRM_FORMAT_XRGB8888;
132 break; 120 break;
133 } 121 }
134 case GBM_BO_FORMAT_XRGB8888: { 122 case GBM_BO_FORMAT_XRGB8888: {
135 format_type = DRM_FORMAT_XRGB8888; 123 format_type = DRM_FORMAT_XRGB8888;
136 break; 124 break;
137 } 125 }
138 default: 126 default:
139 NOTREACHED(); 127 NOTREACHED();
140 return false; 128 return false;
141 } 129 }
142 130
143 for (auto& element : supported_formats_) { 131 for (auto& element : supported_formats_) {
144 if (element == format_type) 132 if (element == format_type)
145 return true; 133 return true;
146 } 134 }
147 135
148 return false; 136 return false;
149 } 137 }
150 138
151 } // namespace ui 139 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698