media: rkisp1: Initialize color space on ISP sink and source pads
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 12 Aug 2022 22:44:14 +0000 (00:44 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 24 Sep 2022 06:33:19 +0000 (08:33 +0200)
Initialize the four color space fields on the sink and source video pads
of the ISP in the .init_cfg() operation. As the main use case for the
ISP is to convert Bayer data to YUV, select a raw color space on the
sink pad and a limited range quantization of SYCC on the source pad by
default.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c

index 383a3ec83ca9ffcd585fe53075403afe23553553..9fcf272734ee611f42f347b8f003eea7cd2397d4 100644 (file)
@@ -431,12 +431,17 @@ static int rkisp1_isp_init_config(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *sink_fmt, *src_fmt;
        struct v4l2_rect *sink_crop, *src_crop;
 
+       /* Video. */
        sink_fmt = v4l2_subdev_get_try_format(sd, sd_state,
                                              RKISP1_ISP_PAD_SINK_VIDEO);
        sink_fmt->width = RKISP1_DEFAULT_WIDTH;
        sink_fmt->height = RKISP1_DEFAULT_HEIGHT;
        sink_fmt->field = V4L2_FIELD_NONE;
        sink_fmt->code = RKISP1_DEF_SINK_PAD_FMT;
+       sink_fmt->colorspace = V4L2_COLORSPACE_RAW;
+       sink_fmt->xfer_func = V4L2_XFER_FUNC_NONE;
+       sink_fmt->ycbcr_enc = V4L2_YCBCR_ENC_601;
+       sink_fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE;
 
        sink_crop = v4l2_subdev_get_try_crop(sd, sd_state,
                                             RKISP1_ISP_PAD_SINK_VIDEO);
@@ -449,11 +454,16 @@ static int rkisp1_isp_init_config(struct v4l2_subdev *sd,
                                             RKISP1_ISP_PAD_SOURCE_VIDEO);
        *src_fmt = *sink_fmt;
        src_fmt->code = RKISP1_DEF_SRC_PAD_FMT;
+       src_fmt->colorspace = V4L2_COLORSPACE_SRGB;
+       src_fmt->xfer_func = V4L2_XFER_FUNC_SRGB;
+       src_fmt->ycbcr_enc = V4L2_YCBCR_ENC_601;
+       src_fmt->quantization = V4L2_QUANTIZATION_LIM_RANGE;
 
        src_crop = v4l2_subdev_get_try_crop(sd, sd_state,
                                            RKISP1_ISP_PAD_SOURCE_VIDEO);
        *src_crop = *sink_crop;
 
+       /* Parameters and statistics. */
        sink_fmt = v4l2_subdev_get_try_format(sd, sd_state,
                                              RKISP1_ISP_PAD_SINK_PARAMS);
        src_fmt = v4l2_subdev_get_try_format(sd, sd_state,