Merge branch 'kms-plane-color-pipeline' into 'master'

Draft: backend/drm: add support for plane color pipelines

See merge request wlroots/wlroots!5220
This commit is contained in:
Simon Ser 2026-06-13 15:12:52 +00:00
commit e3a6813e38
11 changed files with 549 additions and 36 deletions

View file

@ -20,6 +20,18 @@ struct wlr_drm_viewport {
struct wlr_box dst_box;
};
struct wlr_drm_colorop {
uint32_t id;
uint32_t type; // enum drm_colorop_type
uint32_t size; // for 1D_LUT, 3D_LUT
uint64_t curve_1d_types; // for 1D_CURVE, bitmask of 1 << WLR_DRM_COLOROP_1D_CURVE_*
struct wlr_drm_colorop_props props;
struct wl_list link; // wlr_drm_plane.color_pipelines
uint32_t data; // for 1D_LUT, CTM_3X4, 3D_LUT
};
struct wlr_drm_plane {
uint32_t type;
uint32_t id;
@ -43,11 +55,17 @@ struct wlr_drm_plane {
struct wlr_output_cursor_size *cursor_sizes;
size_t cursor_sizes_len;
struct wl_list *color_pipelines; // wlr_drm_colorop.link
size_t color_pipelines_len;
struct wlr_drm_plane_props props;
uint32_t initial_crtc_id;
struct liftoff_plane *liftoff;
struct liftoff_layer *liftoff_layer;
// Atomic modesetting only
uint32_t color_pipeline;
};
struct wlr_drm_layer {
@ -164,6 +182,15 @@ struct wlr_drm_connector_state {
bool vrr_enabled;
uint32_t colorspace;
uint32_t hdr_output_metadata;
uint32_t primary_color_pipeline;
struct wl_array colorops; // struct wlr_drm_colorop_state
};
struct wlr_drm_colorop_state {
struct wlr_drm_colorop *colorop;
bool bypass;
uint32_t curve_1d_type; // for 1D_CURVE
uint32_t data; // for 1D_LUT, CTM_3X4, 3D_LUT
};
/**

View file

@ -68,6 +68,7 @@ struct wlr_drm_plane_props {
uint32_t color_encoding; // Not guaranteed to exist
uint32_t color_range; // Not guaranteed to exist
uint32_t color_pipeline; // Not guaranteed to exist
};
// Equivalent to wlr_drm_color_encoding defined in the kernel (but not exported)
@ -83,10 +84,33 @@ enum wlr_drm_color_range {
WLR_DRM_COLOR_YCBCR_LIMITED_RANGE,
};
// Equivalent to drm_colorop_curve_1d_type defined in the kernel (but not exported)
enum wlr_drm_colorop_curve_1d_type {
WLR_DRM_COLOROP_1D_CURVE_SRGB_EOTF,
WLR_DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF,
WLR_DRM_COLOROP_1D_CURVE_PQ_125_EOTF,
WLR_DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF,
WLR_DRM_COLOROP_1D_CURVE_BT2020_INV_OETF,
WLR_DRM_COLOROP_1D_CURVE_BT2020_OETF,
WLR_DRM_COLOROP_1D_CURVE_GAMMA22,
WLR_DRM_COLOROP_1D_CURVE_GAMMA22_INV,
};
struct wlr_drm_colorop_props {
uint32_t type;
uint32_t next;
uint32_t bypass;
uint32_t data; // for 1D_LUT, CTM_3X4, 3D_LUT
uint32_t size; // for 1D_LUT, 3D_LUT
uint32_t curve_1d_type; // for 1D_CURVE
uint32_t multiplier; // for MULTIPLIER
};
bool get_drm_connector_props(int fd, uint32_t id,
struct wlr_drm_connector_props *out);
bool get_drm_crtc_props(int fd, uint32_t id, struct wlr_drm_crtc_props *out);
bool get_drm_plane_props(int fd, uint32_t id, struct wlr_drm_plane_props *out);
bool get_drm_colorop_props(int fd, uint32_t id, struct wlr_drm_colorop_props *out);
bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret);
void *get_drm_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len);
@ -94,5 +118,6 @@ char *get_drm_prop_enum(int fd, uint32_t obj, uint32_t prop);
bool introspect_drm_prop_range(int fd, uint32_t prop_id,
uint64_t *min, uint64_t *max);
bool introspect_drm_prop_enum(int fd, uint32_t prop_id, uint64_t *bitmask);
#endif

View file

@ -75,9 +75,10 @@ enum wlr_output_state_field {
WLR_OUTPUT_STATE_LAYERS = 1 << 9,
WLR_OUTPUT_STATE_WAIT_TIMELINE = 1 << 10,
WLR_OUTPUT_STATE_SIGNAL_TIMELINE = 1 << 11,
WLR_OUTPUT_STATE_COLOR_TRANSFORM = 1 << 12,
WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM = 1 << 12,
WLR_OUTPUT_STATE_IMAGE_DESCRIPTION = 1 << 13,
WLR_OUTPUT_STATE_COLOR_REPRESENTATION = 1 << 14,
WLR_OUTPUT_STATE_PRE_COLOR_TRANSFORM = 1 << 15,
};
enum wlr_output_state_mode_type {
@ -162,7 +163,10 @@ struct wlr_output_state {
struct wlr_drm_syncobj_timeline *signal_timeline;
uint64_t signal_point;
struct wlr_color_transform *color_transform;
// Pre-blending color transform
struct wlr_color_transform *pre_color_transform;
// Post-blending color transform
struct wlr_color_transform *post_color_transform;
struct wlr_output_image_description *image_description;
};
@ -276,7 +280,8 @@ struct wlr_output {
struct {
struct wl_listener display_destroy;
struct wlr_output_image_description image_description_value;
struct wlr_color_transform *color_transform;
struct wlr_color_transform *pre_color_transform;
struct wlr_color_transform *post_color_transform;
struct wlr_color_primaries default_primaries_value;
} WLR_PRIVATE;
};
@ -619,11 +624,18 @@ void wlr_output_state_set_wait_timeline(struct wlr_output_state *state,
void wlr_output_state_set_signal_timeline(struct wlr_output_state *state,
struct wlr_drm_syncobj_timeline *timeline, uint64_t dst_point);
/**
* Set the color transform for an output.
* Set the pre-blending color transform for an output.
*
* The color transform is applied before blending output layers.
*/
void wlr_output_state_set_pre_color_transform(struct wlr_output_state *state,
struct wlr_color_transform *tr);
/**
* Set the post-blending color transform for an output.
*
* The color transform is applied after blending output layers.
*/
void wlr_output_state_set_color_transform(struct wlr_output_state *state,
void wlr_output_state_set_post_color_transform(struct wlr_output_state *state,
struct wlr_color_transform *tr);
/**