All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Eugen Hristev <eugen.hristev@collabora.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH] media: microchip-isc: Remove dead code in pipeline validation
Date: Wed, 25 Oct 2023 14:08:44 +0300	[thread overview]
Message-ID: <20231025110844.GF481@pendragon.ideasonboard.com> (raw)
In-Reply-To: <eae2aff1-e950-4e49-869f-a17d05a32631@collabora.com>

Hi Eugen,

On Wed, Oct 25, 2023 at 11:31:20AM +0300, Eugen Hristev wrote:
> On 10/25/23 02:34, Laurent Pinchart wrote:
> > The isc_try_fse() function, called from isc_validate(), takes two
> > parameters, an isc_device pointer, and a v4l2_subdev_state pointer. The
> > isc_device is accessed but not modified by the function. The state is
> > modified, including the struct v4l2_subdev_pad_config array it points
> > to, but they are then never used by the caller. Furthermore, the V4L2
> > subdev operation called by isc_try_fse() doesn't modify the subdev it is
> > called on. The isc_try_fse() function has thus no effect, and can just
> > be dropped.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > This patch has been compile-tested only. Eugen, would you be able to
> > test it on hardware ?
> 
> Hello Laurent,
> 
> Thank you for the patch.
> When I initially wrote this code, I definitely had something in mind. I 
> think it was the fact that the ISC should adjust it's crop area 
> according to what the subdev is emitting, to avoid other problems (e.g. 
> reporting bad frame size and v4l2-compliance crying )
> Somehow , maybe, that intention is lost somewhere. I agree with you that 
> this code appears useless.

It seems to have been copied from the previous driver, which used the
try_crop field after fetching it, but that last part was dropping as
part of the conversion to MC.

> I will test it out and let you know . (I cannot promise exactly when I 
> have some time to do it, so bear with me please...)

Thank you.

> > ---
> >   .../platform/microchip/microchip-isc-base.c   | 39 -------------------
> >   1 file changed, 39 deletions(-)
> > 
> > diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
> > index 1f8528844497..540cb1378289 100644
> > --- a/drivers/media/platform/microchip/microchip-isc-base.c
> > +++ b/drivers/media/platform/microchip/microchip-isc-base.c
> > @@ -851,38 +851,6 @@ static int isc_try_configure_pipeline(struct isc_device *isc)
> >   	return 0;
> >   }
> >   
> > -static void isc_try_fse(struct isc_device *isc,
> > -			struct v4l2_subdev_state *sd_state)
> > -{
> > -	struct v4l2_subdev_frame_size_enum fse = {
> > -		.which = V4L2_SUBDEV_FORMAT_TRY,
> > -	};
> > -	int ret;
> > -
> > -	/*
> > -	 * If we do not know yet which format the subdev is using, we cannot
> > -	 * do anything.
> > -	 */
> > -	if (!isc->config.sd_format)
> > -		return;
> > -
> > -	fse.code = isc->try_config.sd_format->mbus_code;
> > -
> > -	ret = v4l2_subdev_call(isc->current_subdev->sd, pad, enum_frame_size,
> > -			       sd_state, &fse);
> > -	/*
> > -	 * Attempt to obtain format size from subdev. If not available,
> > -	 * just use the maximum ISC can receive.
> > -	 */
> > -	if (ret) {
> > -		sd_state->pads->try_crop.width = isc->max_width;
> > -		sd_state->pads->try_crop.height = isc->max_height;
> > -	} else {
> > -		sd_state->pads->try_crop.width = fse.max_width;
> > -		sd_state->pads->try_crop.height = fse.max_height;
> > -	}
> > -}
> > -
> >   static int isc_try_fmt(struct isc_device *isc, struct v4l2_format *f)
> >   {
> >   	struct v4l2_pix_format *pixfmt = &f->fmt.pix;
> > @@ -944,10 +912,6 @@ static int isc_validate(struct isc_device *isc)
> >   		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
> >   		.pad = isc->remote_pad,
> >   	};
> > -	struct v4l2_subdev_pad_config pad_cfg = {};
> > -	struct v4l2_subdev_state pad_state = {
> > -		.pads = &pad_cfg,
> > -	};
> >   
> >   	/* Get current format from subdev */
> >   	ret = v4l2_subdev_call(isc->current_subdev->sd, pad, get_fmt, NULL,
> > @@ -1008,9 +972,6 @@ static int isc_validate(struct isc_device *isc)
> >   	if (ret)
> >   		return ret;
> >   
> > -	/* Obtain frame sizes if possible to have crop requirements ready */
> > -	isc_try_fse(isc, &pad_state);
> > -
> >   	/* Configure ISC pipeline for the config */
> >   	ret = isc_try_configure_pipeline(isc);
> >   	if (ret)
> 

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2023-10-25 11:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 23:34 [PATCH] media: microchip-isc: Remove dead code in pipeline validation Laurent Pinchart
2023-10-25  8:31 ` Eugen Hristev
2023-10-25 11:08   ` Laurent Pinchart [this message]

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=20231025110844.GF481@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=eugen.hristev@collabora.com \
    --cc=linux-media@vger.kernel.org \
    /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.