From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Dan Scally <dan.scally@ideasonboard.com>
Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
Linux Media Mailing List <linux-media@vger.kernel.org>,
Sakari Ailus <sakari.ailus@iki.fi>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Stefan Klug <stefan.klug@ideasonboard.com>,
Paul Elder <paul.elder@ideasonboard.com>,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
Umang Jain <umang.jain@ideasonboard.com>,
Dafna Hirschfeld <dafna@fastmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Heiko Stuebner <heiko@sntech.de>
Subject: Re: [PATCH 6/8] media: rkisp1: Propagate pre/post-config errors
Date: Wed, 12 Jun 2024 18:46:40 +0300 [thread overview]
Message-ID: <20240612154640.GE15991@pendragon.ideasonboard.com> (raw)
In-Reply-To: <109cc53d-fb84-4133-a8e1-5418eb29d352@ideasonboard.com>
On Wed, Jun 12, 2024 at 02:35:39PM +0100, Daniel Scally wrote:
> Hi Jacopo - thanks for the patch. I think this probably should come
> before 5/8 in the series, and just hardcode return 0 in
> rkisp1_params_pre/post_configure() temporarily.
There should be no need to return errors from those two functions.
They're called at runtime to apply parameters. Validation of the
parameters should happen earlier, at qbuf time.
> On 05/06/2024 17:54, Jacopo Mondi wrote:
> > The support for the extensible parameters format introduces the
> > possibility of failures in handling the parameters buffer.
> >
> > Errors in parsing the configuration parameters are not propagated
> > to the rkisp1_config_isp() and the rkisp1_isp_start() functions.
> >
> > Propagate any possible errors to the callers to report it to userspace.
> >
> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> > ---
> > .../media/platform/rockchip/rkisp1/rkisp1-common.h | 10 +++++-----
> > .../media/platform/rockchip/rkisp1/rkisp1-isp.c | 14 +++++++++-----
> > .../media/platform/rockchip/rkisp1/rkisp1-params.c | 14 +++++++++-----
> > 3 files changed, 23 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> > index 0bddae8dbdb1..f9df5ed96c98 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> > @@ -591,10 +591,10 @@ const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_code(u32 mbus_code);
> > * It applies the initial ISP parameters from the first params buffer, but
> > * skips LSC as it needs to be configured after the ISP is started.
> > */
> > -void rkisp1_params_pre_configure(struct rkisp1_params *params,
> > - enum rkisp1_fmt_raw_pat_type bayer_pat,
> > - enum v4l2_quantization quantization,
> > - enum v4l2_ycbcr_encoding ycbcr_encoding);
> > +int rkisp1_params_pre_configure(struct rkisp1_params *params,
> > + enum rkisp1_fmt_raw_pat_type bayer_pat,
> > + enum v4l2_quantization quantization,
> > + enum v4l2_ycbcr_encoding ycbcr_encoding);
> >
> > /*
> > * rkisp1_params_post_configure - Configure the params after stream start
> > @@ -604,7 +604,7 @@ void rkisp1_params_pre_configure(struct rkisp1_params *params,
> > * This function is called by the ISP entity just after the ISP gets started.
> > * It applies the initial ISP LSC parameters from the first params buffer.
> > */
> > -void rkisp1_params_post_configure(struct rkisp1_params *params);
> > +int rkisp1_params_post_configure(struct rkisp1_params *params);
> >
> > /* rkisp1_params_disable - disable all parameters.
> > * This function is called by the isp entity upon stream start
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> > index 91301d17d356..05227c6a16fe 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> > @@ -310,12 +310,16 @@ static int rkisp1_config_isp(struct rkisp1_isp *isp,
> > rkisp1_params_disable(&rkisp1->params);
> > } else {
> > const struct v4l2_mbus_framefmt *src_frm;
> > + int ret;
> >
> > src_frm = v4l2_subdev_state_get_format(sd_state,
> > RKISP1_ISP_PAD_SOURCE_VIDEO);
> > - rkisp1_params_pre_configure(&rkisp1->params, sink_fmt->bayer_pat,
> > - src_frm->quantization,
> > - src_frm->ycbcr_enc);
> > + ret = rkisp1_params_pre_configure(&rkisp1->params,
> > + sink_fmt->bayer_pat,
> > + src_frm->quantization,
> > + src_frm->ycbcr_enc);
> > + if (ret)
> > + return ret;
> > }
> >
> > isp->sink_fmt = sink_fmt;
> > @@ -458,9 +462,9 @@ static int rkisp1_isp_start(struct rkisp1_isp *isp,
> > src_info = rkisp1_mbus_info_get_by_code(src_fmt->code);
> >
> > if (src_info->pixel_enc != V4L2_PIXEL_ENC_BAYER)
> > - rkisp1_params_post_configure(&rkisp1->params);
> > + ret = rkisp1_params_post_configure(&rkisp1->params);
> >
> > - return 0;
> > + return ret;
>
> I think ret could be returned uninitialised in some circumstances in this function now - if it's not
> the IMX8MP version and the pixel encoding is bayer...or am I missing something?
>
> > }
> >
> > /* ----------------------------------------------------------------------------
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
> > index 3d78e643d0b8..c081fd490b2b 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
> > @@ -2123,10 +2123,10 @@ static const struct rkisp1_cif_isp_afc_config rkisp1_afc_params_default_config =
> > 14
> > };
> >
> > -void rkisp1_params_pre_configure(struct rkisp1_params *params,
> > - enum rkisp1_fmt_raw_pat_type bayer_pat,
> > - enum v4l2_quantization quantization,
> > - enum v4l2_ycbcr_encoding ycbcr_encoding)
> > +int rkisp1_params_pre_configure(struct rkisp1_params *params,
> > + enum rkisp1_fmt_raw_pat_type bayer_pat,
> > + enum v4l2_quantization quantization,
> > + enum v4l2_ycbcr_encoding ycbcr_encoding)
> > {
> > struct rkisp1_cif_isp_hst_config hst = rkisp1_hst_params_default_config;
> > struct rkisp1_buffer *buf;
> > @@ -2187,9 +2187,11 @@ void rkisp1_params_pre_configure(struct rkisp1_params *params,
> >
> > unlock:
> > spin_unlock_irq(¶ms->config_lock);
> > +
> > + return ret;
> > }
> >
> > -void rkisp1_params_post_configure(struct rkisp1_params *params)
> > +int rkisp1_params_post_configure(struct rkisp1_params *params)
> > {
> > struct rkisp1_buffer *buf;
> > int ret = 0;
> > @@ -2227,6 +2229,8 @@ void rkisp1_params_post_configure(struct rkisp1_params *params)
> >
> > unlock:
> > spin_unlock_irq(¶ms->config_lock);
> > +
> > + return ret;
> > }
> >
> > /*
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2024-06-12 15:47 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 16:54 [PATCH 0/8] media: rkisp1: Implement support for extensible parameters Jacopo Mondi
2024-06-05 16:54 ` [PATCH 1/8] uapi: rkisp1-config: Add extensible parameters format Jacopo Mondi
2024-06-12 10:02 ` Dan Scally
2024-06-12 12:56 ` Laurent Pinchart
2024-06-12 13:49 ` Dan Scally
2024-06-12 14:56 ` Laurent Pinchart
2024-06-19 12:44 ` Jacopo Mondi
2024-06-19 15:49 ` Laurent Pinchart
2024-06-05 16:54 ` [PATCH 2/8] uapi: videodev2: Add V4L2_META_FMT_RK_ISP1_EXT_PARAMS Jacopo Mondi
2024-06-12 10:00 ` Dan Scally
2024-06-12 14:35 ` Laurent Pinchart
2024-06-12 15:09 ` Dan Scally
2024-06-20 9:31 ` Paul Elder
2024-06-05 16:54 ` [PATCH 3/8] media: rkisp1: Remove cached format info Jacopo Mondi
2024-06-12 10:06 ` Dan Scally
2024-06-12 14:47 ` Laurent Pinchart
2024-06-20 9:41 ` Paul Elder
2024-06-05 16:54 ` [PATCH 4/8] media: rkisp1: Add support for ext format Jacopo Mondi
2024-06-12 10:46 ` Dan Scally
2024-06-12 14:51 ` Laurent Pinchart
2024-06-05 16:54 ` [PATCH 5/8] media: rkisp1: Implement extensible params support Jacopo Mondi
2024-06-12 13:50 ` Dan Scally
2024-06-12 15:42 ` Laurent Pinchart
2024-06-19 15:46 ` Jacopo Mondi
2024-06-19 16:09 ` Laurent Pinchart
2024-06-05 16:54 ` [PATCH 6/8] media: rkisp1: Propagate pre/post-config errors Jacopo Mondi
2024-06-12 13:35 ` Dan Scally
2024-06-12 15:46 ` Laurent Pinchart [this message]
2024-06-05 16:54 ` [PATCH 7/8] media: rkisp1: Add struct rkisp1_params_buffer Jacopo Mondi
2024-06-12 13:52 ` Dan Scally
2024-06-05 16:54 ` [PATCH 8/8] media: rkisp1: Copy and validate parameters buffer Jacopo Mondi
2024-06-12 14:28 ` Dan Scally
2024-06-12 16:20 ` Laurent Pinchart
2024-06-19 14:22 ` Jacopo Mondi
2024-06-19 15:44 ` Laurent Pinchart
2024-06-19 15:55 ` Jacopo Mondi
2024-06-19 16:11 ` Laurent Pinchart
2024-06-19 16:20 ` Jacopo Mondi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240612154640.GE15991@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=dafna@fastmail.com \
--cc=dan.scally@ideasonboard.com \
--cc=heiko@sntech.de \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jacopo.mondi@ideasonboard.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=paul.elder@ideasonboard.com \
--cc=sakari.ailus@iki.fi \
--cc=stefan.klug@ideasonboard.com \
--cc=umang.jain@ideasonboard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.