All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
	Philipp Zabel <p.zabel@pengutronix.de>,
	kernel@pengutronix.de, linux-imx@nxp.com
Subject: Re: [PATCH v1 4/6] media: imx-pxp: Implement frame size enumeration
Date: Thu, 12 Jan 2023 15:11:33 +0100	[thread overview]
Message-ID: <20230112141133.GP24101@pengutronix.de> (raw)
In-Reply-To: <20230106133227.13685-5-laurent.pinchart@ideasonboard.com>

On Fri, 06 Jan 2023 15:32:25 +0200, Laurent Pinchart wrote:
> Implement support for the VIDIOC_ENUM_FRAMESIZES ioctl.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/media/platform/nxp/imx-pxp.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c
> index fd4c055c01eb..68f838e3069d 100644
> --- a/drivers/media/platform/nxp/imx-pxp.c
> +++ b/drivers/media/platform/nxp/imx-pxp.c
> @@ -1391,6 +1391,26 @@ static int pxp_s_fmt_vid_out(struct file *file, void *priv,
>  	return 0;
>  }
>  
> +static int pxp_enum_framesizes(struct file *file, void *fh,
> +			       struct v4l2_frmsizeenum *fsize)
> +{
> +	if (fsize->index > 0)
> +		return -EINVAL;
> +
> +	if (!find_format(fsize->pixel_format))
> +		return -EINVAL;
> +
> +	fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> +	fsize->stepwise.min_width = MIN_W;
> +	fsize->stepwise.max_width = MAX_W;
> +	fsize->stepwise.step_width = ALIGN_W;

fsize->stepwise.step_width = 1 << ALIGN_W;

ALIGN_W isn't the steps in pixels, but the exponent for a 2^align alignment.

> +	fsize->stepwise.min_height = MIN_H;
> +	fsize->stepwise.max_height = MAX_H;
> +	fsize->stepwise.step_height = ALIGN_H;

fsize->stepwise.step_height = 1 << ALIGN_H;

Michael

> +
> +	return 0;
> +}
> +
>  static u8 pxp_degrees_to_rot_mode(u32 degrees)
>  {
>  	switch (degrees) {
> @@ -1459,6 +1479,8 @@ static const struct v4l2_ioctl_ops pxp_ioctl_ops = {
>  	.vidioc_try_fmt_vid_out	= pxp_try_fmt_vid_out,
>  	.vidioc_s_fmt_vid_out	= pxp_s_fmt_vid_out,
>  
> +	.vidioc_enum_framesizes	= pxp_enum_framesizes,
> +
>  	.vidioc_reqbufs		= v4l2_m2m_ioctl_reqbufs,
>  	.vidioc_querybuf	= v4l2_m2m_ioctl_querybuf,
>  	.vidioc_qbuf		= v4l2_m2m_ioctl_qbuf,
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> 

  reply	other threads:[~2023-01-12 14:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 13:32 [PATCH v1 0/6] media: imx-pxp: Miscellaneous enhancements Laurent Pinchart
2023-01-06 13:32 ` [PATCH v1 1/6] media: imx-pxp: Sort headers alphabetically Laurent Pinchart
2023-01-12 13:54   ` Michael Tretter
2023-01-06 13:32 ` [PATCH v1 2/6] media: imx-pxp: Add media controller support Laurent Pinchart
2023-01-12 13:58   ` Michael Tretter
2023-01-12 16:59     ` Laurent Pinchart
2023-01-06 13:32 ` [PATCH v1 3/6] media: imx-pxp: Pass pixel format value to find_format() Laurent Pinchart
2023-01-12 13:59   ` Michael Tretter
2023-01-06 13:32 ` [PATCH v1 4/6] media: imx-pxp: Implement frame size enumeration Laurent Pinchart
2023-01-12 14:11   ` Michael Tretter [this message]
2023-01-06 13:32 ` [PATCH v1 5/6] media: imx-pxp: Introduce pxp_read() and pxp_write() wrappers Laurent Pinchart
2023-01-06 14:50   ` Alexander Stein
2023-01-06 18:44     ` Laurent Pinchart
2023-01-12 14:14       ` Michael Tretter
2023-01-12 14:16   ` Michael Tretter
2023-01-06 13:32 ` [PATCH v1 6/6] media: imx-pxp: Use non-threaded IRQ Laurent Pinchart
2023-01-12 14:27   ` Michael Tretter

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=20230112141133.GP24101@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-media@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    /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.