uint64_t rotation = 0;
uint64_t alpha = 0xFFFF;
uint64_t blend;
+ uint64_t color_encoding = UINT64_MAX;
+ uint64_t color_range = UINT64_MAX;
if (comp_plane.type() != DrmCompositionPlane::Type::kDisable) {
if (source_layers.size() > 1) {
break;
}
}
+
+ if (plane->color_encoding_propery().id()) {
+ switch (layer.dataspace & HAL_DATASPACE_STANDARD_MASK) {
+ case HAL_DATASPACE_STANDARD_BT709:
+ std::tie(color_encoding,
+ ret) = plane->color_encoding_propery()
+ .GetEnumValueWithName("ITU-R BT.709 YCbCr");
+ break;
+ case HAL_DATASPACE_STANDARD_BT601_625:
+ case HAL_DATASPACE_STANDARD_BT601_625_UNADJUSTED:
+ case HAL_DATASPACE_STANDARD_BT601_525:
+ case HAL_DATASPACE_STANDARD_BT601_525_UNADJUSTED:
+ std::tie(color_encoding,
+ ret) = plane->color_encoding_propery()
+ .GetEnumValueWithName("ITU-R BT.601 YCbCr");
+ break;
+ case HAL_DATASPACE_STANDARD_BT2020:
+ case HAL_DATASPACE_STANDARD_BT2020_CONSTANT_LUMINANCE:
+ std::tie(color_encoding,
+ ret) = plane->color_encoding_propery()
+ .GetEnumValueWithName("ITU-R BT.2020 YCbCr");
+ break;
+ }
+ }
+
+ if (plane->color_range_property().id()) {
+ switch (layer.dataspace & HAL_DATASPACE_RANGE_MASK) {
+ case HAL_DATASPACE_RANGE_FULL:
+ std::tie(color_range,
+ ret) = plane->color_range_property()
+ .GetEnumValueWithName("YCbCr full range");
+ break;
+ case HAL_DATASPACE_RANGE_LIMITED:
+ std::tie(color_range,
+ ret) = plane->color_range_property()
+ .GetEnumValueWithName("YCbCr limited range");
+ break;
+ }
+ }
}
// Disable the plane if there's no framebuffer
break;
}
}
+
+ if (plane->color_encoding_propery().id() && color_encoding != UINT64_MAX) {
+ ret = drmModeAtomicAddProperty(pset, plane->id(),
+ plane->color_encoding_propery().id(),
+ color_encoding) < 0;
+ if (ret) {
+ ALOGE("Failed to add COLOR_ENCODING property %d to plane %d",
+ plane->color_encoding_propery().id(), plane->id());
+ break;
+ }
+ }
+
+ if (plane->color_range_property().id() && color_range != UINT64_MAX) {
+ ret = drmModeAtomicAddProperty(pset, plane->id(),
+ plane->color_range_property().id(),
+ color_range) < 0;
+ if (ret) {
+ ALOGE("Failed to add COLOR_RANGE property %d to plane %d",
+ plane->color_range_property().id(), plane->id());
+ break;
+ }
+ }
}
if (!ret) {
#define LOG_TAG "hwc-drm-plane"
#include "DrmPlane.h"
+#include "bufferinfo/BufferInfoGetter.h"
#include <errno.h>
#include <log/log.h>
if (ret)
ALOGI("Could not get IN_FENCE_FD property");
+ if (HasNonRgbFormat()) {
+ ret = drm_->GetPlaneProperty(*this, "COLOR_ENCODING",
+ &color_encoding_propery_);
+ if (ret)
+ ALOGI("Could not get COLOR_ENCODING property");
+
+ ret = drm_->GetPlaneProperty(*this, "COLOR_RANGE", &color_range_property_);
+ if (ret)
+ ALOGI("Could not get COLOR_RANGE property");
+ }
+
return 0;
}
std::end(formats_);
}
+bool DrmPlane::HasNonRgbFormat() const {
+ return std::find_if_not(std::begin(formats_), std::end(formats_),
+ [](uint32_t format) {
+ return BufferInfoGetter::IsDrmFormatRgb(format);
+ }) != std::end(formats_);
+}
+
const DrmProperty &DrmPlane::crtc_property() const {
return crtc_property_;
}
const DrmProperty &DrmPlane::in_fence_fd_property() const {
return in_fence_fd_property_;
}
+
+const DrmProperty &DrmPlane::color_encoding_propery() const {
+ return color_encoding_propery_;
+}
+
+const DrmProperty &DrmPlane::color_range_property() const {
+ return color_range_property_;
+}
} // namespace android
uint32_t type() const;
bool IsFormatSupported(uint32_t format) const;
+ bool HasNonRgbFormat() const;
const DrmProperty &crtc_property() const;
const DrmProperty &fb_property() const;
const DrmProperty &alpha_property() const;
const DrmProperty &blend_property() const;
const DrmProperty &in_fence_fd_property() const;
+ const DrmProperty &color_encoding_propery() const;
+ const DrmProperty &color_range_property() const;
private:
DrmDevice *drm_;
DrmProperty alpha_property_;
DrmProperty blend_property_;
DrmProperty in_fence_fd_property_;
+ DrmProperty color_encoding_propery_;
+ DrmProperty color_range_property_;
};
} // namespace android