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() { |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame^] | 40 | uint64_t enum_value = UINT64_MAX; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 41 | DrmProperty p; |
| 42 | |
| 43 | int ret = drm_->GetPlaneProperty(*this, "type", &p); |
| 44 | if (ret) { |
| 45 | ALOGE("Could not get plane type property"); |
| 46 | return ret; |
| 47 | } |
| 48 | |
Roman Stratiienko | b3b5c1e | 2021-02-15 13:44:19 +0200 | [diff] [blame] | 49 | uint64_t type = 0; |
Sean Paul | fc0b1da | 2019-03-06 09:48:42 -0500 | [diff] [blame] | 50 | std::tie(ret, type) = p.value(); |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 51 | if (ret) { |
| 52 | ALOGE("Failed to get plane type property value"); |
| 53 | return ret; |
| 54 | } |
| 55 | switch (type) { |
| 56 | case DRM_PLANE_TYPE_OVERLAY: |
| 57 | case DRM_PLANE_TYPE_PRIMARY: |
| 58 | case DRM_PLANE_TYPE_CURSOR: |
| 59 | type_ = (uint32_t)type; |
| 60 | break; |
| 61 | default: |
Sean Paul | f741c67 | 2016-05-11 13:49:38 -0400 | [diff] [blame] | 62 | ALOGE("Invalid plane type %" PRIu64, type); |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 63 | return -EINVAL; |
| 64 | } |
| 65 | |
| 66 | ret = drm_->GetPlaneProperty(*this, "CRTC_ID", &crtc_property_); |
| 67 | if (ret) { |
| 68 | ALOGE("Could not get CRTC_ID property"); |
| 69 | return ret; |
| 70 | } |
| 71 | |
| 72 | ret = drm_->GetPlaneProperty(*this, "FB_ID", &fb_property_); |
| 73 | if (ret) { |
| 74 | ALOGE("Could not get FB_ID property"); |
| 75 | return ret; |
| 76 | } |
| 77 | |
| 78 | ret = drm_->GetPlaneProperty(*this, "CRTC_X", &crtc_x_property_); |
| 79 | if (ret) { |
| 80 | ALOGE("Could not get CRTC_X property"); |
| 81 | return ret; |
| 82 | } |
| 83 | |
| 84 | ret = drm_->GetPlaneProperty(*this, "CRTC_Y", &crtc_y_property_); |
| 85 | if (ret) { |
| 86 | ALOGE("Could not get CRTC_Y property"); |
| 87 | return ret; |
| 88 | } |
| 89 | |
| 90 | ret = drm_->GetPlaneProperty(*this, "CRTC_W", &crtc_w_property_); |
| 91 | if (ret) { |
| 92 | ALOGE("Could not get CRTC_W property"); |
| 93 | return ret; |
| 94 | } |
| 95 | |
| 96 | ret = drm_->GetPlaneProperty(*this, "CRTC_H", &crtc_h_property_); |
| 97 | if (ret) { |
| 98 | ALOGE("Could not get CRTC_H property"); |
| 99 | return ret; |
| 100 | } |
| 101 | |
| 102 | ret = drm_->GetPlaneProperty(*this, "SRC_X", &src_x_property_); |
| 103 | if (ret) { |
| 104 | ALOGE("Could not get SRC_X property"); |
| 105 | return ret; |
| 106 | } |
| 107 | |
| 108 | ret = drm_->GetPlaneProperty(*this, "SRC_Y", &src_y_property_); |
| 109 | if (ret) { |
| 110 | ALOGE("Could not get SRC_Y property"); |
| 111 | return ret; |
| 112 | } |
| 113 | |
| 114 | ret = drm_->GetPlaneProperty(*this, "SRC_W", &src_w_property_); |
| 115 | if (ret) { |
| 116 | ALOGE("Could not get SRC_W property"); |
| 117 | return ret; |
| 118 | } |
| 119 | |
| 120 | ret = drm_->GetPlaneProperty(*this, "SRC_H", &src_h_property_); |
| 121 | if (ret) { |
| 122 | ALOGE("Could not get SRC_H property"); |
| 123 | return ret; |
| 124 | } |
| 125 | |
Alexandru Gheorghe | ea1c5e5 | 2018-09-17 10:48:54 +0100 | [diff] [blame] | 126 | ret = drm_->GetPlaneProperty(*this, "zpos", &zpos_property_); |
| 127 | if (ret) |
| 128 | ALOGE("Could not get zpos property for plane %u", id()); |
| 129 | |
Sean Paul | 1c4c326 | 2015-07-14 15:51:52 -0400 | [diff] [blame] | 130 | ret = drm_->GetPlaneProperty(*this, "rotation", &rotation_property_); |
| 131 | if (ret) |
| 132 | ALOGE("Could not get rotation property"); |
| 133 | |
Sean Paul | d8aefb6 | 2015-10-15 15:17:31 -0400 | [diff] [blame] | 134 | ret = drm_->GetPlaneProperty(*this, "alpha", &alpha_property_); |
| 135 | if (ret) |
| 136 | ALOGI("Could not get alpha property"); |
| 137 | |
Lowry Li | 9b6cafd | 2018-08-28 17:58:21 +0800 | [diff] [blame] | 138 | ret = drm_->GetPlaneProperty(*this, "pixel blend mode", &blend_property_); |
| 139 | if (ret) |
| 140 | ALOGI("Could not get pixel blend mode property"); |
| 141 | |
Robert Foss | a09220c | 2016-09-30 10:27:23 -0400 | [diff] [blame] | 142 | ret = drm_->GetPlaneProperty(*this, "IN_FENCE_FD", &in_fence_fd_property_); |
| 143 | if (ret) |
| 144 | ALOGI("Could not get IN_FENCE_FD property"); |
| 145 | |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 146 | if (HasNonRgbFormat()) { |
| 147 | ret = drm_->GetPlaneProperty(*this, "COLOR_ENCODING", |
| 148 | &color_encoding_propery_); |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame^] | 149 | if (ret == 0) { |
| 150 | std::tie(enum_value, ret) = color_encoding_propery_.GetEnumValueWithName( |
| 151 | "ITU-R BT.709 YCbCr"); |
| 152 | if (ret == 0) { |
| 153 | color_encoding_enum_map_[DrmHwcColorSpace::kItuRec709] = enum_value; |
| 154 | } |
| 155 | std::tie(enum_value, ret) = color_encoding_propery_.GetEnumValueWithName( |
| 156 | "ITU-R BT.601 YCbCr"); |
| 157 | if (ret == 0) { |
| 158 | color_encoding_enum_map_[DrmHwcColorSpace::kItuRec601] = enum_value; |
| 159 | } |
| 160 | std::tie(enum_value, ret) = color_encoding_propery_.GetEnumValueWithName( |
| 161 | "ITU-R BT.2020 YCbCr"); |
| 162 | if (ret == 0) { |
| 163 | color_encoding_enum_map_[DrmHwcColorSpace::kItuRec2020] = enum_value; |
| 164 | } |
| 165 | } else { |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 166 | ALOGI("Could not get COLOR_ENCODING property"); |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame^] | 167 | } |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 168 | |
| 169 | ret = drm_->GetPlaneProperty(*this, "COLOR_RANGE", &color_range_property_); |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame^] | 170 | if (ret == 0) { |
| 171 | std::tie(enum_value, ret) = color_range_property_.GetEnumValueWithName( |
| 172 | "YCbCr full range"); |
| 173 | if (ret == 0) { |
| 174 | color_range_enum_map_[DrmHwcSampleRange::kFullRange] = enum_value; |
| 175 | } |
| 176 | std::tie(enum_value, ret) = color_range_property_.GetEnumValueWithName( |
| 177 | "YCbCr limited range"); |
| 178 | if (ret == 0) { |
| 179 | color_range_enum_map_[DrmHwcSampleRange::kLimitedRange] = enum_value; |
| 180 | } |
| 181 | } else { |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 182 | ALOGI("Could not get COLOR_RANGE property"); |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame^] | 183 | } |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 184 | } |
| 185 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 186 | return 0; |
| 187 | } |
| 188 | |
| 189 | uint32_t DrmPlane::id() const { |
| 190 | return id_; |
| 191 | } |
| 192 | |
| 193 | bool DrmPlane::GetCrtcSupported(const DrmCrtc &crtc) const { |
Roman Stratiienko | e2f2c92 | 2021-02-13 10:57:47 +0200 | [diff] [blame] | 194 | return ((1 << crtc.pipe()) & possible_crtc_mask_) != 0; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 195 | } |
| 196 | |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 197 | bool DrmPlane::IsValidForLayer(DrmHwcLayer *layer) { |
Benjamin Li | b00b28d | 2021-05-09 08:52:18 -0700 | [diff] [blame] | 198 | if (rotation_property_.id() == 0) { |
| 199 | if (layer->transform != DrmHwcTransform::kIdentity) { |
| 200 | ALOGV("Rotation is not supported on plane %d", id_); |
| 201 | return false; |
| 202 | } |
| 203 | } else { |
| 204 | // For rotation checks, we assume the hardware reports its capabilities |
| 205 | // consistently (e.g. a 270 degree rotation is a 90 degree rotation + H |
| 206 | // flip + V flip; it wouldn't make sense to support all of the latter but |
| 207 | // not the former). |
| 208 | int ret = 0; |
| 209 | const std::pair<enum DrmHwcTransform, std::string> transforms[] = |
| 210 | {{kFlipH, "reflect-x"}, |
| 211 | {kFlipV, "reflect-y"}, |
| 212 | {kRotate90, "rotate-90"}, |
| 213 | {kRotate180, "rotate-180"}, |
| 214 | {kRotate270, "rotate-270"}}; |
| 215 | |
| 216 | for (const auto &[transform, name] : transforms) { |
| 217 | if (layer->transform & transform) { |
| 218 | std::tie(std::ignore, |
| 219 | ret) = rotation_property_.GetEnumValueWithName(name); |
| 220 | if (ret) { |
| 221 | ALOGV("Rotation '%s' is not supported on plane %d", name.c_str(), |
| 222 | id_); |
| 223 | return false; |
| 224 | } |
| 225 | } |
| 226 | } |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | if (alpha_property_.id() == 0 && layer->alpha != 0xffff) { |
| 230 | ALOGV("Alpha is not supported on plane %d", id_); |
| 231 | return false; |
| 232 | } |
| 233 | |
| 234 | if (blend_property_.id() == 0) { |
| 235 | if ((layer->blending != DrmHwcBlending::kNone) && |
| 236 | (layer->blending != DrmHwcBlending::kPreMult)) { |
| 237 | ALOGV("Blending is not supported on plane %d", id_); |
| 238 | return false; |
| 239 | } |
| 240 | } else { |
| 241 | int ret = 0; |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 242 | |
| 243 | switch (layer->blending) { |
| 244 | case DrmHwcBlending::kPreMult: |
Benjamin Li | f75099a | 2021-05-09 08:52:35 -0700 | [diff] [blame] | 245 | std::tie(std::ignore, |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 246 | ret) = blend_property_.GetEnumValueWithName("Pre-multiplied"); |
| 247 | break; |
| 248 | case DrmHwcBlending::kCoverage: |
Benjamin Li | f75099a | 2021-05-09 08:52:35 -0700 | [diff] [blame] | 249 | std::tie(std::ignore, |
| 250 | ret) = blend_property_.GetEnumValueWithName("Coverage"); |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 251 | break; |
| 252 | case DrmHwcBlending::kNone: |
| 253 | default: |
Benjamin Li | f75099a | 2021-05-09 08:52:35 -0700 | [diff] [blame] | 254 | std::tie(std::ignore, |
| 255 | ret) = blend_property_.GetEnumValueWithName("None"); |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 256 | break; |
| 257 | } |
| 258 | if (ret) { |
| 259 | ALOGV("Expected a valid blend mode on plane %d", id_); |
| 260 | return false; |
| 261 | } |
| 262 | } |
| 263 | |
Roman Stratiienko | 5128715 | 2021-02-10 14:59:52 +0200 | [diff] [blame] | 264 | uint32_t format = layer->buffer_info.format; |
Matvii Zorin | 67a89d3 | 2021-01-31 14:45:05 +0200 | [diff] [blame] | 265 | if (!IsFormatSupported(format)) { |
| 266 | ALOGV("Plane %d does not supports %c%c%c%c format", id_, format, |
| 267 | format >> 8, format >> 16, format >> 24); |
| 268 | return false; |
| 269 | } |
| 270 | |
| 271 | return true; |
| 272 | } |
| 273 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 274 | uint32_t DrmPlane::type() const { |
| 275 | return type_; |
| 276 | } |
| 277 | |
Roman Kovalivskyi | 859b607 | 2020-03-26 05:03:39 +0200 | [diff] [blame] | 278 | bool DrmPlane::IsFormatSupported(uint32_t format) const { |
| 279 | return std::find(std::begin(formats_), std::end(formats_), format) != |
| 280 | std::end(formats_); |
| 281 | } |
| 282 | |
Matvii Zorin | 8338c34 | 2020-09-08 16:12:51 +0300 | [diff] [blame] | 283 | bool DrmPlane::HasNonRgbFormat() const { |
| 284 | return std::find_if_not(std::begin(formats_), std::end(formats_), |
| 285 | [](uint32_t format) { |
| 286 | return BufferInfoGetter::IsDrmFormatRgb(format); |
| 287 | }) != std::end(formats_); |
| 288 | } |
| 289 | |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 290 | auto DrmPlane::AtomicSetState(drmModeAtomicReq &pset, DrmHwcLayer &layer, |
| 291 | uint32_t zpos, uint32_t crtc_id) -> int { |
| 292 | int ret = 0; |
| 293 | uint32_t fb_id = UINT32_MAX; |
| 294 | int fence_fd = -1; |
| 295 | hwc_rect_t display_frame; |
| 296 | hwc_frect_t source_crop; |
| 297 | uint64_t rotation = 0; |
| 298 | uint64_t alpha = 0xFFFF; |
| 299 | uint64_t blend = UINT64_MAX; |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 300 | |
| 301 | if (!layer.FbIdHandle) { |
| 302 | ALOGE("Expected a valid framebuffer for pset"); |
| 303 | return -EINVAL; |
| 304 | } |
| 305 | |
| 306 | fb_id = layer.FbIdHandle->GetFbId(); |
| 307 | fence_fd = layer.acquire_fence.Get(); |
| 308 | display_frame = layer.display_frame; |
| 309 | source_crop = layer.source_crop; |
| 310 | alpha = layer.alpha; |
| 311 | |
| 312 | // Disable the plane if there's no framebuffer |
| 313 | if (fb_id == UINT32_MAX) { |
| 314 | if (!AtomicDisablePlane(pset)) { |
| 315 | return -EINVAL; |
| 316 | } |
| 317 | return 0; |
| 318 | } |
| 319 | |
| 320 | if (blend_property_) { |
| 321 | switch (layer.blending) { |
| 322 | case DrmHwcBlending::kPreMult: |
| 323 | std::tie(blend, |
| 324 | ret) = blend_property_.GetEnumValueWithName("Pre-multiplied"); |
| 325 | break; |
| 326 | case DrmHwcBlending::kCoverage: |
| 327 | std::tie(blend, ret) = blend_property_.GetEnumValueWithName("Coverage"); |
| 328 | break; |
| 329 | case DrmHwcBlending::kNone: |
| 330 | default: |
| 331 | std::tie(blend, ret) = blend_property_.GetEnumValueWithName("None"); |
| 332 | break; |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | if (zpos_property_ && !zpos_property_.is_immutable()) { |
| 337 | uint64_t min_zpos = 0; |
| 338 | |
| 339 | // Ignore ret and use min_zpos as 0 by default |
| 340 | std::tie(std::ignore, min_zpos) = zpos_property_.range_min(); |
| 341 | |
| 342 | if (!zpos_property_.AtomicSet(pset, zpos + min_zpos)) { |
| 343 | return -EINVAL; |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | rotation = 0; |
| 348 | if (layer.transform & DrmHwcTransform::kFlipH) |
| 349 | rotation |= DRM_MODE_REFLECT_X; |
| 350 | if (layer.transform & DrmHwcTransform::kFlipV) |
| 351 | rotation |= DRM_MODE_REFLECT_Y; |
| 352 | if (layer.transform & DrmHwcTransform::kRotate90) |
| 353 | rotation |= DRM_MODE_ROTATE_90; |
| 354 | else if (layer.transform & DrmHwcTransform::kRotate180) |
| 355 | rotation |= DRM_MODE_ROTATE_180; |
| 356 | else if (layer.transform & DrmHwcTransform::kRotate270) |
| 357 | rotation |= DRM_MODE_ROTATE_270; |
| 358 | else |
| 359 | rotation |= DRM_MODE_ROTATE_0; |
| 360 | |
| 361 | if (fence_fd >= 0) { |
| 362 | if (!in_fence_fd_property_.AtomicSet(pset, fence_fd)) { |
| 363 | return -EINVAL; |
| 364 | } |
| 365 | } |
| 366 | |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 367 | if (!crtc_property_.AtomicSet(pset, crtc_id) || |
| 368 | !fb_property_.AtomicSet(pset, fb_id) || |
| 369 | !crtc_x_property_.AtomicSet(pset, display_frame.left) || |
| 370 | !crtc_y_property_.AtomicSet(pset, display_frame.top) || |
| 371 | !crtc_w_property_.AtomicSet(pset, |
| 372 | display_frame.right - display_frame.left) || |
| 373 | !crtc_h_property_.AtomicSet(pset, |
| 374 | display_frame.bottom - display_frame.top) || |
| 375 | !src_x_property_.AtomicSet(pset, (int)(source_crop.left) << 16) || |
| 376 | !src_y_property_.AtomicSet(pset, (int)(source_crop.top) << 16) || |
| 377 | !src_w_property_.AtomicSet(pset, |
| 378 | (int)(source_crop.right - source_crop.left) |
| 379 | << 16) || |
| 380 | !src_h_property_.AtomicSet(pset, |
| 381 | (int)(source_crop.bottom - source_crop.top) |
| 382 | << 16)) { |
| 383 | return -EINVAL; |
| 384 | } |
| 385 | |
| 386 | if (rotation_property_) { |
| 387 | if (!rotation_property_.AtomicSet(pset, rotation)) { |
| 388 | return -EINVAL; |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | if (alpha_property_) { |
| 393 | if (!alpha_property_.AtomicSet(pset, alpha)) { |
| 394 | return -EINVAL; |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | if (blend_property_ && blend != UINT64_MAX) { |
| 399 | if (!blend_property_.AtomicSet(pset, blend)) { |
| 400 | return -EINVAL; |
| 401 | } |
| 402 | } |
| 403 | |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame^] | 404 | if (color_encoding_enum_map_.count(layer.color_space) != 0 && |
| 405 | !color_encoding_propery_ |
| 406 | .AtomicSet(pset, color_encoding_enum_map_[layer.color_space])) { |
| 407 | return -EINVAL; |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 408 | } |
| 409 | |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame^] | 410 | if (color_range_enum_map_.count(layer.sample_range) != 0 && |
| 411 | !color_range_property_ |
| 412 | .AtomicSet(pset, color_range_enum_map_[layer.sample_range])) { |
| 413 | return -EINVAL; |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 414 | } |
Roman Stratiienko | 4f1effa | 2021-09-29 12:47:26 +0300 | [diff] [blame^] | 415 | |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 416 | return 0; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 417 | } |
| 418 | |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 419 | auto DrmPlane::AtomicDisablePlane(drmModeAtomicReq &pset) -> int { |
| 420 | if (!crtc_property_.AtomicSet(pset, 0) || !fb_property_.AtomicSet(pset, 0)) { |
| 421 | return -EINVAL; |
| 422 | } |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 423 | |
Roman Stratiienko | 0dbe639 | 2021-09-29 12:47:16 +0300 | [diff] [blame] | 424 | return 0; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 425 | } |
Sean Paul | 1c4c326 | 2015-07-14 15:51:52 -0400 | [diff] [blame] | 426 | |
Alexandru Gheorghe | ea1c5e5 | 2018-09-17 10:48:54 +0100 | [diff] [blame] | 427 | const DrmProperty &DrmPlane::zpos_property() const { |
| 428 | return zpos_property_; |
| 429 | } |
| 430 | |
Sean Paul | f72cccd | 2018-08-27 13:59:08 -0400 | [diff] [blame] | 431 | } // namespace android |