Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: renesas: vsp1: Expose color space through the DRM API

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@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20250429232904.26413-9-laurent.pinchart+renesas@ideasonboard.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>

authored by

Laurent Pinchart and committed by
Hans Verkuil
b64b1349 67cbb2be

+12 -2
+4
drivers/media/platform/renesas/vsp1/vsp1_drm.c
··· 136 136 format.format.height = input->crop.height + input->crop.top; 137 137 format.format.code = rpf->fmtinfo->mbus; 138 138 format.format.field = V4L2_FIELD_NONE; 139 + format.format.ycbcr_enc = input->ycbcr_enc; 140 + format.format.quantization = input->quantization; 139 141 140 142 ret = v4l2_subdev_call(&rpf->entity.subdev, pad, set_fmt, NULL, 141 143 &format); ··· 878 876 input->crop = cfg->src; 879 877 input->compose = cfg->dst; 880 878 input->zpos = cfg->zpos; 879 + input->ycbcr_enc = cfg->color_encoding; 880 + input->quantization = cfg->color_range; 881 881 882 882 drm_pipe->pipe.inputs[rpf_index] = rpf; 883 883
+4 -2
drivers/media/platform/renesas/vsp1/vsp1_drm.h
··· 52 52 * struct vsp1_drm - State for the API exposed to the DRM driver 53 53 * @pipe: the VSP1 DRM pipeline used for display 54 54 * @lock: protects the BRU and BRS allocation 55 - * @inputs: source crop rectangle, destination compose rectangle and z-order 56 - * position for every input (indexed by RPF index) 55 + * @inputs: source crop rectangle, destination compose rectangle, z-order 56 + * position and colorspace for every input (indexed by RPF index) 57 57 */ 58 58 struct vsp1_drm { 59 59 struct vsp1_drm_pipeline pipe[VSP1_MAX_LIF]; ··· 63 63 struct v4l2_rect crop; 64 64 struct v4l2_rect compose; 65 65 unsigned int zpos; 66 + enum v4l2_ycbcr_encoding ycbcr_enc; 67 + enum v4l2_quantization quantization; 66 68 } inputs[VSP1_MAX_RPF]; 67 69 }; 68 70
+4
include/media/vsp1.h
··· 52 52 * @alpha: alpha value (0: fully transparent, 255: fully opaque) 53 53 * @zpos: Z position of the plane (from 0 to number of planes minus 1) 54 54 * @premult: true for premultiplied alpha 55 + * @color_encoding: color encoding (valid for YUV formats only) 56 + * @color_range: color range (valid for YUV formats only) 55 57 */ 56 58 struct vsp1_du_atomic_config { 57 59 u32 pixelformat; ··· 64 62 unsigned int alpha; 65 63 unsigned int zpos; 66 64 bool premult; 65 + enum v4l2_ycbcr_encoding color_encoding; 66 + enum v4l2_quantization color_range; 67 67 }; 68 68 69 69 /**