[PATCH v2 8/9] media: renesas: vsp1: Expose color space through the DRM API
Tomi Valkeinen
tomi.valkeinen at ideasonboard.com
Wed Apr 30 10:17:30 UTC 2025
Hi,
On 30/04/2025 02:29, Laurent Pinchart wrote:
> Now that the VSP1 driver supports color spaces, expose them through the
> API used by the DU driver. This allows configuring the YCbCr encoding
> and quantization used by each plane, ensuring correct color rendering.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
> ---
> drivers/media/platform/renesas/vsp1/vsp1_drm.c | 4 ++++
> drivers/media/platform/renesas/vsp1/vsp1_drm.h | 6 ++++--
> include/media/vsp1.h | 4 ++++
> 3 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.c b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> index e5339fda5941..fe55e8747b05 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> @@ -136,6 +136,8 @@ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1,
> format.format.height = input->crop.height + input->crop.top;
> format.format.code = rpf->fmtinfo->mbus;
> format.format.field = V4L2_FIELD_NONE;
> + format.format.ycbcr_enc = input->ycbcr_enc;
> + format.format.quantization = input->quantization;
>
> ret = v4l2_subdev_call(&rpf->entity.subdev, pad, set_fmt, NULL,
> &format);
> @@ -876,6 +878,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
> input->crop = cfg->src;
> input->compose = cfg->dst;
> input->zpos = cfg->zpos;
> + input->ycbcr_enc = cfg->color_encoding;
> + input->quantization = cfg->color_range;
>
> drm_pipe->pipe.inputs[rpf_index] = rpf;
>
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.h b/drivers/media/platform/renesas/vsp1/vsp1_drm.h
> index 7234737cc464..07a5d0adbd08 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_drm.h
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.h
> @@ -52,8 +52,8 @@ struct vsp1_drm_pipeline {
> * struct vsp1_drm - State for the API exposed to the DRM driver
> * @pipe: the VSP1 DRM pipeline used for display
> * @lock: protects the BRU and BRS allocation
> - * @inputs: source crop rectangle, destination compose rectangle and z-order
> - * position for every input (indexed by RPF index)
> + * @inputs: source crop rectangle, destination compose rectangle, z-order
> + * position and colorspace for every input (indexed by RPF index)
> */
> struct vsp1_drm {
> struct vsp1_drm_pipeline pipe[VSP1_MAX_LIF];
> @@ -63,6 +63,8 @@ struct vsp1_drm {
> struct v4l2_rect crop;
> struct v4l2_rect compose;
> unsigned int zpos;
> + enum v4l2_ycbcr_encoding ycbcr_enc;
> + enum v4l2_quantization quantization;
> } inputs[VSP1_MAX_RPF];
> };
>
> diff --git a/include/media/vsp1.h b/include/media/vsp1.h
> index 48f4a5023d81..4ea6352fd63f 100644
> --- a/include/media/vsp1.h
> +++ b/include/media/vsp1.h
> @@ -52,6 +52,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index,
> * @alpha: alpha value (0: fully transparent, 255: fully opaque)
> * @zpos: Z position of the plane (from 0 to number of planes minus 1)
> * @premult: true for premultiplied alpha
> + * @color_encoding: color encoding (valid for YUV formats only)
> + * @color_range: color range (valid for YUV formats only)
> */
> struct vsp1_du_atomic_config {
> u32 pixelformat;
> @@ -62,6 +64,8 @@ struct vsp1_du_atomic_config {
> unsigned int alpha;
> unsigned int zpos;
> bool premult;
> + enum v4l2_ycbcr_encoding color_encoding;
> + enum v4l2_quantization color_range;
> };
>
> /**
Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas at ideasonboard.com>
Tomi
More information about the dri-devel
mailing list