Re: [PATCH] v4l2-compliance: Relax g/s_parm type check

2018-02-21 Thread Hans Verkuil
Hi Jacopo,

I've made a different implementation which is simpler. It's just been
committed.

Thanks for the report and suggested patch though!

Regards,

Hans

On 02/19/18 17:46, Jacopo Mondi wrote:
> Since commit
> 
> commit 2e564ee56978874ddd4a8d061d37be088f130fd9
> Author: Hans Verkuil 
>   vidioc-g-parm.rst: also allow _MPLANE buffer types
> 
> V4L2 allows _MPLANE buffer types for capture/output on s/g_parm
> operations.
> 
> Relax v4l2-compliance check to comply with this.
> 
> Signed-off-by: Jacopo Mondi 
> ---
>  utils/v4l2-compliance/v4l2-test-formats.cpp | 17 ++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp 
> b/utils/v4l2-compliance/v4l2-test-formats.cpp
> index b7a32fe..25c4da5 100644
> --- a/utils/v4l2-compliance/v4l2-test-formats.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
> @@ -1235,9 +1235,20 @@ int testParm(struct node *node)
>   type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&
>   type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
>   return fail("G/S_PARM is only allowed for video 
> capture/output\n");
> - if (!(node->g_caps() & buftype2cap[type]))
> - return fail("%s cap not set, but G/S_PARM 
> worked\n",
> - buftype2s(type).c_str());
> +
> + if (!((node->g_caps() & V4L2_BUF_TYPE_VIDEO_CAPTURE ||
> + node->g_caps() & 
> V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) &&
> + ((buftype2cap[type] == 
> V4L2_BUF_TYPE_VIDEO_CAPTURE ||
> + buftype2cap[type] == 
> V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)))
> + return fail("%s cap not set, 
> but G/S_PARM worked\n",
> + 
> buftype2s(type).c_str());
> +
> + if (!((node->g_caps() & V4L2_BUF_TYPE_VIDEO_OUTPUT ||
> + node->g_caps() & 
> V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)) &&
> + ((buftype2cap[type] == 
> V4L2_BUF_TYPE_VIDEO_OUTPUT ||
> + buftype2cap[type] == 
> V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)))
> + return fail("%s cap not set, 
> but G/S_PARM worked\n",
> + 
> buftype2s(type).c_str());
>   }
>   }
> 
> --
> 2.7.4
> 



[PATCH] v4l2-compliance: Relax g/s_parm type check

2018-02-19 Thread Jacopo Mondi
Since commit

commit 2e564ee56978874ddd4a8d061d37be088f130fd9
Author: Hans Verkuil 
vidioc-g-parm.rst: also allow _MPLANE buffer types

V4L2 allows _MPLANE buffer types for capture/output on s/g_parm
operations.

Relax v4l2-compliance check to comply with this.

Signed-off-by: Jacopo Mondi 
---
 utils/v4l2-compliance/v4l2-test-formats.cpp | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp 
b/utils/v4l2-compliance/v4l2-test-formats.cpp
index b7a32fe..25c4da5 100644
--- a/utils/v4l2-compliance/v4l2-test-formats.cpp
+++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
@@ -1235,9 +1235,20 @@ int testParm(struct node *node)
type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&
type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
return fail("G/S_PARM is only allowed for video 
capture/output\n");
-   if (!(node->g_caps() & buftype2cap[type]))
-   return fail("%s cap not set, but G/S_PARM 
worked\n",
-   buftype2s(type).c_str());
+
+   if (!((node->g_caps() & V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+   node->g_caps() & 
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) &&
+   ((buftype2cap[type] == 
V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+   buftype2cap[type] == 
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)))
+   return fail("%s cap not set, 
but G/S_PARM worked\n",
+   
buftype2s(type).c_str());
+
+   if (!((node->g_caps() & V4L2_BUF_TYPE_VIDEO_OUTPUT ||
+   node->g_caps() & 
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)) &&
+   ((buftype2cap[type] == 
V4L2_BUF_TYPE_VIDEO_OUTPUT ||
+   buftype2cap[type] == 
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)))
+   return fail("%s cap not set, 
but G/S_PARM worked\n",
+   
buftype2s(type).c_str());
}
}

--
2.7.4