backend/drm: enumerate plane color pipelines

This commit is contained in:
Simon Ser 2025-12-07 00:12:46 +01:00
parent bd99e8c2bd
commit fd0a4dc40e
4 changed files with 121 additions and 0 deletions

View file

@ -51,6 +51,7 @@ static const struct prop_info crtc_info[] = {
static const struct prop_info plane_info[] = {
#define INDEX(name) (offsetof(struct wlr_drm_plane_props, name) / sizeof(uint32_t))
{ "COLOR_ENCODING", INDEX(color_encoding) },
{ "COLOR_PIPELINE", INDEX(color_pipeline) },
{ "COLOR_RANGE", INDEX(color_range) },
{ "CRTC_H", INDEX(crtc_h) },
{ "CRTC_ID", INDEX(crtc_id) },
@ -73,6 +74,18 @@ static const struct prop_info plane_info[] = {
#undef INDEX
};
static const struct prop_info colorop_info[] = {
#define INDEX(name) (offsetof(struct wlr_drm_colorop_props, name) / sizeof(uint32_t))
{ "BYPASS", INDEX(bypass) },
{ "CURVE_1D_TYPE", INDEX(curve_1d_type) },
{ "DATA", INDEX(data) },
{ "MULTIPLIER", INDEX(multiplier) },
{ "NEXT", INDEX(next) },
{ "SIZE", INDEX(size) },
{ "TYPE", INDEX(type) },
#undef INDEX
};
static int cmp_prop_info(const void *arg1, const void *arg2) {
const char *key = arg1;
const struct prop_info *elem = arg2;
@ -123,6 +136,11 @@ bool get_drm_plane_props(int fd, uint32_t id, struct wlr_drm_plane_props *out) {
plane_info, sizeof(plane_info) / sizeof(plane_info[0]));
}
bool get_drm_colorop_props(int fd, uint32_t id, struct wlr_drm_colorop_props *out) {
return scan_properties(fd, id, DRM_MODE_OBJECT_COLOROP, (uint32_t *)out,
colorop_info, sizeof(colorop_info) / sizeof(colorop_info[0]));
}
bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) {
drmModeObjectProperties *props =
drmModeObjectGetProperties(fd, obj, DRM_MODE_OBJECT_ANY);