Message ID | 20230106133227.13685-5-laurent.pinchart@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series | media: imx-pxp: Miscellaneous enhancements | expand |
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 > >
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.min_height = MIN_H; + fsize->stepwise.max_height = MAX_H; + fsize->stepwise.step_height = ALIGN_H; + + 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,
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(+)