From faccfa71cae10341e23c9e276c44745de01cf319 Mon Sep 17 00:00:00 2001 From: "mason.huo" Date: Mon, 4 Jul 2022 11:27:37 +0800 Subject: [PATCH] media: starfive: Add video format debug information Add some debug log for set/get video format, so that we can check if the v4l2 driver accepts or not the format set by user. Signed-off-by: mason.huo --- drivers/media/platform/starfive/v4l2_driver/stf_isp.c | 5 ++++- .../media/platform/starfive/v4l2_driver/stf_video.c | 18 +++++++++++++----- drivers/media/platform/starfive/v4l2_driver/stf_vin.c | 3 +++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/starfive/v4l2_driver/stf_isp.c b/drivers/media/platform/starfive/v4l2_driver/stf_isp.c index 03e8ed6..6fb75d4 100644 --- a/drivers/media/platform/starfive/v4l2_driver/stf_isp.c +++ b/drivers/media/platform/starfive/v4l2_driver/stf_isp.c @@ -620,7 +620,8 @@ static void isp_try_format(struct stf_isp_dev *isp_dev, } i = isp_match_format_get_index(formats, fmt->code, pad); - st_debug(ST_ISP, "isp_match_format_get_index = %d\n", i); + st_debug(ST_ISP, "%s pad=%d, code=%x isp_match_format_get_index = %d\n", + __func__, pad, code, i); if (i >= formats->nfmts && (pad == STF_ISP_PAD_SRC_RAW || pad == STF_ISP_PAD_SRC_SCD_Y)) { @@ -759,6 +760,8 @@ static int isp_set_format(struct v4l2_subdev *sd, struct v4l2_rect *rect = NULL; int ret; + st_debug(ST_ISP, "%s pad=%d, code=%x, which=%d\n", + __func__, fmt->reserved[0], fmt->format.code, fmt->which); format = __isp_get_format(isp_dev, state, fmt->pad, fmt->which); if (format == NULL) return -EINVAL; diff --git a/drivers/media/platform/starfive/v4l2_driver/stf_video.c b/drivers/media/platform/starfive/v4l2_driver/stf_video.c index 58493fd..6e5578a 100644 --- a/drivers/media/platform/starfive/v4l2_driver/stf_video.c +++ b/drivers/media/platform/starfive/v4l2_driver/stf_video.c @@ -872,8 +872,9 @@ static int video_g_fmt(struct file *file, void *fh, struct v4l2_format *f) struct stfcamss_video *video = video_drvdata(file); st_debug(ST_VIDEO, "%s, fmt.type = 0x%x\n", __func__, f->type); - st_debug(ST_VIDEO, "%s, active_fmt.type = 0x%x\n", - __func__, video->active_fmt.type); + st_debug(ST_VIDEO, "%s, active_fmt.type = 0x%x,0x%x\n", + __func__, video->active_fmt.type, + video->active_fmt.fmt.pix.pixelformat); *f = video->active_fmt; return 0; } @@ -915,9 +916,9 @@ static int video_entity_s_fmt(struct stfcamss_video *video, mf->code = dst_code; ret = v4l2_subdev_call(subdev, pad, set_fmt, state, fmt); st_warn(ST_VIDEO, - "\"%s\":%d pad fmt set to 0x%x %ux%u, dst_code = 0x%x\n", + "\"%s\":%d pad fmt set to 0x%x %ux%u, dst_code = 0x%x, ret=%d\n", subdev->name, fmt->pad, mf->code, - mf->width, mf->height, dst_code); + mf->width, mf->height, dst_code, ret); if (mf->code != code || mf->width != width || mf->height != height) { st_warn(ST_VIDEO, @@ -1011,6 +1012,9 @@ static int video_pipeline_s_fmt(struct stfcamss_video *video, index = video_find_format(mf->code, video->formats[index].pixelformat, video->formats, video->nformats); + st_debug(ST_VIDEO, "%s, code=%x, index=%d\n", + __func__, mf->code, index); + if (index < 0) return index; @@ -1033,7 +1037,8 @@ static int video_s_fmt(struct file *file, void *fh, struct v4l2_format *f) struct stfcamss_video *video = video_drvdata(file); int ret; - st_debug(ST_VIDEO, "%s, fmt.type = 0x%x\n", __func__, f->type); + st_debug(ST_VIDEO, "%s, fmt.type = 0x%x, v4l2fmt=%x\n", + __func__, f->type, f->fmt.pix.pixelformat); if (vb2_is_busy(&video->vb2_q)) return -EBUSY; @@ -1043,6 +1048,9 @@ static int video_s_fmt(struct file *file, void *fh, struct v4l2_format *f) return ret; ret = video_pipeline_s_fmt(video, NULL, f); + + st_debug(ST_VIDEO, "%s, pixelformat=0x%x, ret=%d\n", + __func__, f->fmt.pix.pixelformat, ret); if (ret < 0) return ret; diff --git a/drivers/media/platform/starfive/v4l2_driver/stf_vin.c b/drivers/media/platform/starfive/v4l2_driver/stf_vin.c index 109cf44..f84f54f 100644 --- a/drivers/media/platform/starfive/v4l2_driver/stf_vin.c +++ b/drivers/media/platform/starfive/v4l2_driver/stf_vin.c @@ -780,6 +780,9 @@ static int vin_set_format(struct v4l2_subdev *sd, struct vin_line *line = v4l2_get_subdevdata(sd); struct v4l2_mbus_framefmt *format; + st_debug(ST_VIDEO, "%s, pad %d, fmt code %x\n", + __func__, fmt->pad, fmt->format.code); + format = __vin_get_format(line, state, fmt->pad, fmt->which); if (format == NULL) return -EINVAL; -- 2.7.4