diff mbox series

media: nxp: imx8-isi: fix m2m device v4l2-compliance test errors

Message ID 20240923120048.3200166-1-laurentiu.palcu@oss.nxp.com (mailing list archive)
State New, archived
Headers show
Series media: nxp: imx8-isi: fix m2m device v4l2-compliance test errors | expand

Commit Message

Laurentiu Palcu Sept. 23, 2024, noon UTC
Running the v4l2-compliance (1.27.0-5208, SHA: af114250d48d) on the m2m
device fails on the MMAP streaming tests, with the following messages:

fail: v4l2-test-buffers.cpp(240): g_field() == V4L2_FIELD_ANY
fail: v4l2-test-buffers.cpp(1508): buf.qbuf(node)

Apparently, the driver does not properly set the field member of
vb2_v4l2_buffer struct, returning the default V4L2_FIELD_ANY value which
is against the guidelines.

Fixes: cf21f328fcafac ("media: nxp: Add i.MX8 ISI driver")
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
---
 drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Laurent Pinchart Sept. 23, 2024, 10 p.m. UTC | #1
Hi Laurentiu,

Thank you for the patch.

On Mon, Sep 23, 2024 at 03:00:48PM +0300, Laurentiu Palcu wrote:
> Running the v4l2-compliance (1.27.0-5208, SHA: af114250d48d) on the m2m
> device fails on the MMAP streaming tests, with the following messages:
> 
> fail: v4l2-test-buffers.cpp(240): g_field() == V4L2_FIELD_ANY
> fail: v4l2-test-buffers.cpp(1508): buf.qbuf(node)
> 
> Apparently, the driver does not properly set the field member of
> vb2_v4l2_buffer struct, returning the default V4L2_FIELD_ANY value which
> is against the guidelines.

Strange, I would have sworn v4l2-compliance passed successfully when I
submitted the driver. Maybe it has been updated in the meantime.

> Fixes: cf21f328fcafac ("media: nxp: Add i.MX8 ISI driver")
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
> ---
>  drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> index b71195a3ba256..3f0c9e2ac802d 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> @@ -222,6 +222,11 @@ static int mxc_isi_m2m_vb2_buffer_prepare(struct vb2_buffer *vb2)
>  	struct mxc_isi_m2m_ctx *ctx = vb2_get_drv_priv(vq);
>  	const struct mxc_isi_m2m_ctx_queue_data *qdata =
>  		mxc_isi_m2m_ctx_qdata(ctx, vq->type);
> +	struct vb2_v4l2_buffer *v4l2_buf = to_vb2_v4l2_buffer(vb2);
> +
> +	v4l2_buf->field = vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ?
> +			  ctx->queues.out.format.field :
> +			  ctx->queues.cap.format.field;

Wouldn't it be better to handle this in mxc_isi_video_buffer_prepare() ?
I think the same issue exists for live capture, not just for M2M
operation.

>  
>  	return mxc_isi_video_buffer_prepare(ctx->m2m->isi, vb2, qdata->info,
>  					    &qdata->format);
Laurentiu Palcu Sept. 24, 2024, 7:23 a.m. UTC | #2
Hi Laurent,

On Tue, Sep 24, 2024 at 01:00:47AM +0300, Laurent Pinchart wrote:
> Hi Laurentiu,
> 
> Thank you for the patch.
> 
> On Mon, Sep 23, 2024 at 03:00:48PM +0300, Laurentiu Palcu wrote:
> > Running the v4l2-compliance (1.27.0-5208, SHA: af114250d48d) on the m2m
> > device fails on the MMAP streaming tests, with the following messages:
> > 
> > fail: v4l2-test-buffers.cpp(240): g_field() == V4L2_FIELD_ANY
> > fail: v4l2-test-buffers.cpp(1508): buf.qbuf(node)
> > 
> > Apparently, the driver does not properly set the field member of
> > vb2_v4l2_buffer struct, returning the default V4L2_FIELD_ANY value which
> > is against the guidelines.
> 
> Strange, I would have sworn v4l2-compliance passed successfully when I
> submitted the driver. Maybe it has been updated in the meantime.
> 
> > Fixes: cf21f328fcafac ("media: nxp: Add i.MX8 ISI driver")
> > Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
> > ---
> >  drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> > index b71195a3ba256..3f0c9e2ac802d 100644
> > --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> > +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> > @@ -222,6 +222,11 @@ static int mxc_isi_m2m_vb2_buffer_prepare(struct vb2_buffer *vb2)
> >  	struct mxc_isi_m2m_ctx *ctx = vb2_get_drv_priv(vq);
> >  	const struct mxc_isi_m2m_ctx_queue_data *qdata =
> >  		mxc_isi_m2m_ctx_qdata(ctx, vq->type);
> > +	struct vb2_v4l2_buffer *v4l2_buf = to_vb2_v4l2_buffer(vb2);
> > +
> > +	v4l2_buf->field = vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ?
> > +			  ctx->queues.out.format.field :
> > +			  ctx->queues.cap.format.field;
> 
> Wouldn't it be better to handle this in mxc_isi_video_buffer_prepare() ?
> I think the same issue exists for live capture, not just for M2M
> operation.

Yes, you're right. I guess I missed the fact that the queue's pixel
format is passed to the mxc_isi_video_buffer_prepare() which makes it
easier to set the field there. I'll send a v2 shortly.

Thanks,
Laurentiu

> 
> >  
> >  	return mxc_isi_video_buffer_prepare(ctx->m2m->isi, vb2, qdata->info,
> >  					    &qdata->format);
> 
> -- 
> Regards,
> 
> Laurent Pinchart
diff mbox series

Patch

diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
index b71195a3ba256..3f0c9e2ac802d 100644
--- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
+++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
@@ -222,6 +222,11 @@  static int mxc_isi_m2m_vb2_buffer_prepare(struct vb2_buffer *vb2)
 	struct mxc_isi_m2m_ctx *ctx = vb2_get_drv_priv(vq);
 	const struct mxc_isi_m2m_ctx_queue_data *qdata =
 		mxc_isi_m2m_ctx_qdata(ctx, vq->type);
+	struct vb2_v4l2_buffer *v4l2_buf = to_vb2_v4l2_buffer(vb2);
+
+	v4l2_buf->field = vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ?
+			  ctx->queues.out.format.field :
+			  ctx->queues.cap.format.field;
 
 	return mxc_isi_video_buffer_prepare(ctx->m2m->isi, vb2, qdata->info,
 					    &qdata->format);