Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "hwc-drm-plane" |
| 18 | |
Roman Stratiienko | 13cc366 | 2020-08-29 21:35:39 +0300 | [diff] [blame] | 19 | #include "DrmPlane.h" |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 20 | |
Roman Stratiienko | 2640cd8 | 2021-02-26 17:49:40 +0200 | [diff] [blame] | 21 | #include <algorithm> |
Roman Stratiienko | e2f2c92 | 2021-02-13 10:57:47 +0200 | [diff] [blame] | 22 | #include <cerrno> |
Sean Paul | f72cccd | 2018-08-27 13:59:08 -0400 | [diff] [blame] | 23 | #include <cinttypes> |
Roman Stratiienko | e2f2c92 | 2021-02-13 10:57:47 +0200 | [diff] [blame] | 24 | #include <cstdint> |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 25 | |
Roman Stratiienko | 13cc366 | 2020-08-29 21:35:39 +0300 | [diff] [blame] | 26 | #include "DrmDevice.h" |
Roman Stratiienko | d518a05 | 2021-02-25 19:15:14 +0200 | [diff] [blame] | 27 | #include "bufferinfo/BufferInfoGetter.h" |
| 28 | #include "utils/log.h" |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 29 | |
| 30 | namespace android { |
| 31 | |
Alexandru Gheorghe | 0f5abd7 | 2018-05-01 14:37:10 +0100 | [diff] [blame] | 32 | DrmPlane::DrmPlane(DrmDevice *drm, drmModePlanePtr p) |
Roman Kovalivskyi | 859b607 | 2020-03-26 05:03:39 +0200 | [diff] [blame] | 33 | : drm_(drm), |
| 34 | id_(p->plane_id), |
| 35 | possible_crtc_mask_(p->possible_crtcs), |
| 36 | formats_(p->formats, p->formats + p->count_formats) { |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 37 | } |
| 38 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 39 | int DrmPlane::Init() { |
| 40 | DrmProperty p; |
| 41 | |
| 42 | int ret = drm_->GetPlaneProperty(*this, "type", &p); |
| 43 | if (ret) { |
| 44 | ALOGE("Could not get plane type property"); |
| 45 | return ret; |
| 46 | } |
| 47 | |
Roman Stratiienko | b3b5c1e | 2021-02-15 13:44:19 +0200 | [diff] [blame] | 48 | uint64_t type = 0; |
Sean Paul | fc0b1da | 2019-03-06 09:48:42 -0500 | [diff] [blame] | 49 | std::tie(ret, type) = p.value(); |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 50 | if (ret) { |
| 51 | ALOGE("Failed to get plane type property value"); |
| 52 | return ret; |
| 53 | } |
| 54 | switch (type) { |
| 55 | case DRM_PLANE_TYPE_OVERLAY: |
| 56 | case DRM_PLANE_TYPE_PRIMARY: |
| 57 | case DRM_PLANE_TYPE_CURSOR: |
| 58 | type_ = (uint32_t)type; |
| 59 | break; |
| 60 | default: |
Sean Paul | f741c67 | 2016-05-11 13:49:38 -0400 | [diff] [blame] | 61 | ALOGE("Invalid plane type %" PRIu64, type); |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 62 | return -EINVAL; |
| 63 | } |
| 64 | |
| 65 | ret = drm_->GetPlaneProperty(*this, "CRTC_ID", &crtc_property_); |
| 66 | if (ret) { |
| 67 | ALOGE("Could not get CRTC_ID property"); |
| 68 | return ret; |
| 69 | } |
| 70 | |
| 71 | ret = drm_->GetPlaneProperty(*this, "FB_ID", &fb_property_); |
| 72 | if (ret) { |
| 73 | ALOGE("Could not get FB_ID property"); |
| 74 | return ret; |
| 75 | } |
| 76 | |
| 77 | ret = drm_->GetPlaneProperty(*this, "CRTC_X", &crtc_x_property_); |
| 78 | if (ret) { |
| 79 | ALOGE("Could not get CRTC_X property"); |
| 80 | return ret; |
| 81 | } |
| 82 | |
| 83 | ret = drm_->GetPlaneProperty(*this, "CRTC_Y", &crtc_y_property_); |
| 84 | if (ret) { |
| 85 | ALOGE("Could not get CRTC_Y property"); |
| 86 | return ret; |
| 87 | } |
| 88 | |
| 89 | ret = drm_->GetPlaneProperty(*this, "CRTC_W", &crtc_w_property_); |
| 90 | if (ret) { |
| 91 | ALOGE("Could not get CRTC_W property"); |
| 92 | return ret; |
| 93 | } |
| 94 | |
| 95 | ret = drm_->GetPlaneProperty(*this, "CRTC_H", &crtc_h_property_); |
| 96 | if (ret) { |
| 97 | ALOGE("Could not get CRTC_H property"); |
| 98 | return ret; |
| 99 | } |
| 100 | |
| 101 | ret = drm_->GetPlaneProperty(*this, "SRC_X", &src_x_property_); |
| 102 | if (ret) { |
| 103 | ALOGE("Could not get SRC_X property"); |
| 104 | return ret; |
| 105 | } |
| 106 | |
| 107 | ret = drm_->GetPlaneProperty(*this, "SRC_Y", &src_y_property_); |
| 108 | if (ret) { |
| 109 | ALOGE("Could not get SRC_Y property"); |
| 110 | return ret; |
| 111 | } |
| 112 | |
| 113 | ret = drm_->GetPlaneProperty(*this, "SRC_W", &src_w_property_); |
| 114 | if (ret) { |
| 115 | ALOGE("Could not get SRC_W property"); |
| 116 | return ret; |
| 117 | } |
| 118 | |
| 119 | ret = drm_->GetPlaneProperty(*this, "SRC_H", &src_h_property_); |
| 120 | if (ret) { |
| 121 | ALOGE("Could not get SRC_H property"); |
| 122 | return ret; |
| 123 | } |
| 124 | |
Alexandru Gheorghe | ea1c5e5 | 2018-09-17 10:48:54 +0100 | [diff] [blame] | 125 | ret = drm_->GetPlaneProperty(*this, "zpos", &zpos_property_); |
| 126 | if (ret) |
| 127 | ALOGE("Could not get zpos property for plane %u", id()); |
| 128 | |
Sean Paul | 1c4c326 | 2015-07-14 15:51:52 -0400 | [diff] [blame] | 129 | ret = drm_->GetPlaneProperty(*this, "rotation", &rotation_property_); |
Roman Stratiienko | 24a4c18 | 2021-09-29 12:59:54 +0300 | [diff] [blame] | 130 | if (ret == 0) { |
| 131 | rotation_property_.AddEnumToMap("rotate-0", DrmHwcTransform::kIdentity, |
| 132 | transform_enum_map_); |
| 133 | rotation_property_.AddEnumToMap("rotate-90", DrmHwcTransform::kRotate90, |
| 134 | transform_enum_map_); |
| 135 | rotation_property_.AddEnumToMap("rotate-180", DrmHwcTransform::kRotate180, |
| 136 | transform_enum_map_); |
| 137 | rotation_property_.AddEnumToMap("rotate-270", DrmHwcTransform::kRotate270, |
| 138 | transform_enum_map_); |
| 139 | rotation_property_.AddEnumToMap("reflect-x", DrmHwcTransform::kFlipH, |
| 140 | transform_enum_map_); |
| 141 | rotation_property_.AddEnumToMap("reflect-y", DrmHwcTransform::kFlipV, |
| 142 | transform_enum_map_); |
| 143 | } else { |
Sean Paul | 1c4c326 | 2015-07-14 15:51:52 -0400 | [diff] [blame] | 144 | ALOGE("Could not get rotation property"); |
Roman Stratiienko | 24a4c18 | 2021-09-29 12:59:54 +0300 | [diff] [blame] | 145 | } |
Sean Paul | 1c4c326 | 2015-07-14 15:51:52 -0400 | [diff] [blame] | 146 | |
Sean Paul | d8aefb6 | 2015-10-15 15:17:31 -0400 | [diff] [blame] | 147 | ret = drm_->GetPlaneProperty(*this, "alpha", &alpha_property_); |
| 148 | if (ret) |
| 149 | ALOGI("Could not get alpha property"); |
| 150 | |
Lowry Li | 9b6cafd | 2018-08-28 17:58:21 +0800 | [diff] [blame] | 151 | ret = drm_->GetPlaneProperty(*this, "pixel blend mode", &blend_property_); |
Roman Stratiienko | 5063d53 | 2021-09-29 12:47:31 +0300 | [diff] [blame] | 152 | if (ret == 0) { |
Roman Stratiienko | 0f679aa | 2021-09-29 12:59:48 +0300 | [diff] [blame] | 153 | blend_property_.AddEnumToMap("Pre-multiplied", DrmHwcBlending::kPreMult, |
| 154 | blending_enum_map_); |
| 155 | blend_property_.AddEnumToMap("Coverage", DrmHwcBlending::kCoverage, |
| 156 | blending_enum_map_); |
| 157 | blend_property_.AddEnumToMap("None", DrmHwcBlending::kNone, |
| 158 | blending_enum_map_); |
Roman Stratiienko | 5063d53 | 2021-09-29 12:47:31 +0300 | [diff] [blame] | 159 | } else { |
Lowry Li | 9b6cafd | 2018-08-28 17:58:21 +0800 | [diff] [blame] | 160 | ALOGI("Could not get pixel blend mode property"); |
Roman Stratiienko | 5063d53 | 2021-09-29 12:47:31 +0300 | [diff] [blame] | 161 | } |
Lowry Li | 9b6cafd | 2018-08-28 17:58:21 +0800 | [diff] [blame] | 162 | |
Robert Foss | a09220c | 2016-09-30 10:27:23 -0400 | [diff] [blame] | 163 | ret = drm_->GetPlaneProperty(*this, "IN_FENCE_FD", &in_fence_fd_property_); |
| 164 | if (ret) |
| 165 | ALOGI("Could not get IN_FENCE_FD property"); |
| 166 | |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 167 | if (HasNonRgbFormat()) { |
| 168 | ret = drm_->GetPlaneProperty(*this, "COLOR_ENCODING", |
| 169 | &color_encoding_propery_); |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame] | 170 | if (ret == 0) { |
Roman Stratiienko | 0f679aa | 2021-09-29 12:59:48 +0300 | [diff] [blame] | 171 | color_encoding_propery_.AddEnumToMap("ITU-R BT.709 YCbCr", |
| 172 | DrmHwcColorSpace::kItuRec709, |
| 173 | color_encoding_enum_map_); |
| 174 | color_encoding_propery_.AddEnumToMap("ITU-R BT.601 YCbCr", |
| 175 | DrmHwcColorSpace::kItuRec601, |
| 176 | color_encoding_enum_map_); |
| 177 | color_encoding_propery_.AddEnumToMap("ITU-R BT.2020 YCbCr", |
| 178 | DrmHwcColorSpace::kItuRec2020, |
| 179 | color_encoding_enum_map_); |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame] | 180 | } else { |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 181 | ALOGI("Could not get COLOR_ENCODING property"); |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame] | 182 | } |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 183 | |
| 184 | ret = drm_->GetPlaneProperty(*this, "COLOR_RANGE", &color_range_property_); |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame] | 185 | if (ret == 0) { |
Roman Stratiienko | 0f679aa | 2021-09-29 12:59:48 +0300 | [diff] [blame] | 186 | color_range_property_.AddEnumToMap("YCbCr full range", |
| 187 | DrmHwcSampleRange::kFullRange, |
| 188 | color_range_enum_map_); |
| 189 | color_range_property_.AddEnumToMap("YCbCr limited range", |
| 190 | DrmHwcSampleRange::kLimitedRange, |
| 191 | color_range_enum_map_); |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame] | 192 | } else { |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 193 | ALOGI("Could not get COLOR_RANGE property"); |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame] | 194 | } |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 195 | } |
| 196 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 197 | return 0; |
| 198 | } |
| 199 | |
| 200 | uint32_t DrmPlane::id() const { |
| 201 | return id_; |
| 202 | } |
| 203 | |
| 204 | bool DrmPlane::GetCrtcSupported(const DrmCrtc &crtc) const { |
Roman Stratiienko | e2f2c92 | 2021-02-13 10:57:47 +0200 | [diff] [blame] | 205 | return ((1 << crtc.pipe()) & possible_crtc_mask_) != 0; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 206 | } |
| 207 | |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 208 | bool DrmPlane::IsValidForLayer(DrmHwcLayer *layer) { |
Roman Stratiienko | 24a4c18 | 2021-09-29 12:59:54 +0300 | [diff] [blame] | 209 | if (!rotation_property_) { |
Benjamin Li | b00b28d | 2021-05-09 08:52:18 -0700 | [diff] [blame] | 210 | if (layer->transform != DrmHwcTransform::kIdentity) { |
Roman Stratiienko | 24a4c18 | 2021-09-29 12:59:54 +0300 | [diff] [blame] | 211 | ALOGV("No rotation property on plane %d", id_); |
Benjamin Li | b00b28d | 2021-05-09 08:52:18 -0700 | [diff] [blame] | 212 | return false; |
| 213 | } |
| 214 | } else { |
Roman Stratiienko | 24a4c18 | 2021-09-29 12:59:54 +0300 | [diff] [blame] | 215 | if (transform_enum_map_.count(layer->transform) == 0) { |
| 216 | ALOGV("Transform is not supported on plane %d", id_); |
| 217 | return false; |
Benjamin Li | b00b28d | 2021-05-09 08:52:18 -0700 | [diff] [blame] | 218 | } |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | if (alpha_property_.id() == 0 && layer->alpha != 0xffff) { |
| 222 | ALOGV("Alpha is not supported on plane %d", id_); |
| 223 | return false; |
| 224 | } |
| 225 | |
Roman Stratiienko | 5063d53 | 2021-09-29 12:47:31 +0300 | [diff] [blame] | 226 | if (blending_enum_map_.count(layer->blending) == 0 && |
Roman Stratiienko | 013d068 | 2021-09-30 19:36:00 +0300 | [diff] [blame^] | 227 | layer->blending != DrmHwcBlending::kNone && |
| 228 | layer->blending != DrmHwcBlending::kPreMult) { |
Roman Stratiienko | 5063d53 | 2021-09-29 12:47:31 +0300 | [diff] [blame] | 229 | ALOGV("Blending is not supported on plane %d", id_); |
| 230 | return false; |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 231 | } |
| 232 | |
Roman Stratiienko | 5128715 | 2021-02-10 14:59:52 +0200 | [diff] [blame] | 233 | uint32_t format = layer->buffer_info.format; |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 234 | if (!IsFormatSupported(format)) { |
| 235 | ALOGV("Plane %d does not supports %c%c%c%c format", id_, format, |
| 236 | format >> 8, format >> 16, format >> 24); |
| 237 | return false; |
| 238 | } |
| 239 | |
| 240 | return true; |
| 241 | } |
| 242 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 243 | uint32_t DrmPlane::type() const { |
| 244 | return type_; |
| 245 | } |
| 246 | |
Roman Kovalivskyi | 859b607 | 2020-03-26 05:03:39 +0200 | [diff] [blame] | 247 | bool DrmPlane::IsFormatSupported(uint32_t format) const { |
| 248 | return std::find(std::begin(formats_), std::end(formats_), format) != |
| 249 | std::end(formats_); |
| 250 | } |
| 251 | |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 252 | bool DrmPlane::HasNonRgbFormat() const { |
| 253 | return std::find_if_not(std::begin(formats_), std::end(formats_), |
| 254 | [](uint32_t format) { |
| 255 | return BufferInfoGetter::IsDrmFormatRgb(format); |
| 256 | }) != std::end(formats_); |
| 257 | } |
| 258 | |
Roman Stratiienko | 6662f71 | 2021-09-29 12:52:22 +0300 | [diff] [blame] | 259 | static uint64_t ToDrmRotation(DrmHwcTransform transform) { |
| 260 | uint64_t rotation = 0; |
| 261 | if (transform & DrmHwcTransform::kFlipH) |
| 262 | rotation |= DRM_MODE_REFLECT_X; |
| 263 | if (transform & DrmHwcTransform::kFlipV) |
| 264 | rotation |= DRM_MODE_REFLECT_Y; |
| 265 | if (transform & DrmHwcTransform::kRotate90) |
| 266 | rotation |= DRM_MODE_ROTATE_90; |
| 267 | else if (transform & DrmHwcTransform::kRotate180) |
| 268 | rotation |= DRM_MODE_ROTATE_180; |
| 269 | else if (transform & DrmHwcTransform::kRotate270) |
| 270 | rotation |= DRM_MODE_ROTATE_270; |
| 271 | else |
| 272 | rotation |= DRM_MODE_ROTATE_0; |
| 273 | |
| 274 | return rotation; |
| 275 | } |
| 276 | |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 277 | auto DrmPlane::AtomicSetState(drmModeAtomicReq &pset, DrmHwcLayer &layer, |
| 278 | uint32_t zpos, uint32_t crtc_id) -> int { |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 279 | if (!layer.FbIdHandle) { |
| 280 | ALOGE("Expected a valid framebuffer for pset"); |
| 281 | return -EINVAL; |
| 282 | } |
| 283 | |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 284 | if (zpos_property_ && !zpos_property_.is_immutable()) { |
| 285 | uint64_t min_zpos = 0; |
| 286 | |
| 287 | // Ignore ret and use min_zpos as 0 by default |
| 288 | std::tie(std::ignore, min_zpos) = zpos_property_.range_min(); |
| 289 | |
| 290 | if (!zpos_property_.AtomicSet(pset, zpos + min_zpos)) { |
| 291 | return -EINVAL; |
| 292 | } |
| 293 | } |
| 294 | |
Roman Stratiienko | 6662f71 | 2021-09-29 12:52:22 +0300 | [diff] [blame] | 295 | if (layer.acquire_fence && |
| 296 | !in_fence_fd_property_.AtomicSet(pset, layer.acquire_fence.Get())) { |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 297 | return -EINVAL; |
| 298 | } |
| 299 | |
Roman Stratiienko | 6662f71 | 2021-09-29 12:52:22 +0300 | [diff] [blame] | 300 | if (!crtc_property_.AtomicSet(pset, crtc_id) || |
| 301 | !fb_property_.AtomicSet(pset, layer.FbIdHandle->GetFbId()) || |
| 302 | !crtc_x_property_.AtomicSet(pset, layer.display_frame.left) || |
| 303 | !crtc_y_property_.AtomicSet(pset, layer.display_frame.top) || |
| 304 | !crtc_w_property_.AtomicSet(pset, layer.display_frame.right - |
| 305 | layer.display_frame.left) || |
| 306 | !crtc_h_property_.AtomicSet(pset, layer.display_frame.bottom - |
| 307 | layer.display_frame.top) || |
| 308 | !src_x_property_.AtomicSet(pset, (int)(layer.source_crop.left) << 16) || |
| 309 | !src_y_property_.AtomicSet(pset, (int)(layer.source_crop.top) << 16) || |
| 310 | !src_w_property_.AtomicSet(pset, (int)(layer.source_crop.right - |
| 311 | layer.source_crop.left) |
| 312 | << 16) || |
| 313 | !src_h_property_.AtomicSet(pset, (int)(layer.source_crop.bottom - |
| 314 | layer.source_crop.top) |
| 315 | << 16)) { |
| 316 | return -EINVAL; |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 317 | } |
| 318 | |
Roman Stratiienko | 6662f71 | 2021-09-29 12:52:22 +0300 | [diff] [blame] | 319 | if (rotation_property_ && |
| 320 | !rotation_property_.AtomicSet(pset, ToDrmRotation(layer.transform))) { |
| 321 | return -EINVAL; |
| 322 | } |
| 323 | |
| 324 | if (alpha_property_ && !alpha_property_.AtomicSet(pset, layer.alpha)) { |
| 325 | return -EINVAL; |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 326 | } |
| 327 | |
Roman Stratiienko | 5063d53 | 2021-09-29 12:47:31 +0300 | [diff] [blame] | 328 | if (blending_enum_map_.count(layer.blending) != 0 && |
| 329 | !blend_property_.AtomicSet(pset, blending_enum_map_[layer.blending])) { |
| 330 | return -EINVAL; |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 331 | } |
| 332 | |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame] | 333 | if (color_encoding_enum_map_.count(layer.color_space) != 0 && |
| 334 | !color_encoding_propery_ |
| 335 | .AtomicSet(pset, color_encoding_enum_map_[layer.color_space])) { |
| 336 | return -EINVAL; |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 337 | } |
| 338 | |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame] | 339 | if (color_range_enum_map_.count(layer.sample_range) != 0 && |
| 340 | !color_range_property_ |
| 341 | .AtomicSet(pset, color_range_enum_map_[layer.sample_range])) { |
| 342 | return -EINVAL; |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 343 | } |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame] | 344 | |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 345 | return 0; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 346 | } |
| 347 | |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 348 | auto DrmPlane::AtomicDisablePlane(drmModeAtomicReq &pset) -> int { |
| 349 | if (!crtc_property_.AtomicSet(pset, 0) || !fb_property_.AtomicSet(pset, 0)) { |
| 350 | return -EINVAL; |
| 351 | } |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 352 | |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 353 | return 0; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 354 | } |
Sean Paul | 1c4c326 | 2015-07-14 15:51:52 -0400 | [diff] [blame] | 355 | |
Alexandru Gheorghe | ea1c5e5 | 2018-09-17 10:48:54 +0100 | [diff] [blame] | 356 | const DrmProperty &DrmPlane::zpos_property() const { |
| 357 | return zpos_property_; |
| 358 | } |
| 359 | |
Sean Paul | f72cccd | 2018-08-27 13:59:08 -0400 | [diff] [blame] | 360 | } // namespace android |