drm/plane: Add COLOR PIPELINE property

We're adding a new enum COLOR PIPELINE property. This
property will have entries for each COLOR PIPELINE by
referencing the DRM object ID of the first drm_colorop
of the pipeline. 0 disables the entire COLOR PIPELINE.

Userspace can use this to discover the available color
pipelines, as well as set the desired one. The color
pipelines are programmed via properties on the actual
drm_colorop objects.

Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
Link: https://patch.msgid.link/20251115000237.3561250-11-alex.hung@amd.com
This commit is contained in:
Harry Wentland
2025-11-14 17:01:35 -07:00
committed by Simon Ser
parent 2190c14498
commit 2afc3184f3
7 changed files with 166 additions and 0 deletions

View File

@@ -1536,6 +1536,52 @@ drm_atomic_add_affected_planes(struct drm_atomic_state *state,
}
EXPORT_SYMBOL(drm_atomic_add_affected_planes);
/**
* drm_atomic_add_affected_colorops - add colorops for plane
* @state: atomic state
* @plane: DRM plane
*
* This function walks the current configuration and adds all colorops
* currently used by @plane to the atomic configuration @state. This is useful
* when an atomic commit also needs to check all currently enabled colorop on
* @plane, e.g. when changing the mode. It's also useful when re-enabling a plane
* to avoid special code to force-enable all colorops.
*
* Since acquiring a colorop state will always also acquire the w/w mutex of the
* current plane for that colorop (if there is any) adding all the colorop states for
* a plane will not reduce parallelism of atomic updates.
*
* Returns:
* 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
* then the w/w mutex code has detected a deadlock and the entire atomic
* sequence must be restarted. All other errors are fatal.
*/
int
drm_atomic_add_affected_colorops(struct drm_atomic_state *state,
struct drm_plane *plane)
{
struct drm_colorop *colorop;
struct drm_colorop_state *colorop_state;
WARN_ON(!drm_atomic_get_new_plane_state(state, plane));
drm_dbg_atomic(plane->dev,
"Adding all current colorops for [PLANE:%d:%s] to %p\n",
plane->base.id, plane->name, state);
drm_for_each_colorop(colorop, plane->dev) {
if (colorop->plane != plane)
continue;
colorop_state = drm_atomic_get_colorop_state(state, colorop);
if (IS_ERR(colorop_state))
return PTR_ERR(colorop_state);
}
return 0;
}
EXPORT_SYMBOL(drm_atomic_add_affected_colorops);
/**
* drm_atomic_check_only - check whether a given config would work
* @state: atomic configuration to check