* [PATCH] v4l2-compliance: Verify metadata formats
@ 2019-09-24 9:25 Vandana BN
2019-09-24 12:01 ` Hans Verkuil
0 siblings, 1 reply; 3+ messages in thread
From: Vandana BN @ 2019-09-24 9:25 UTC (permalink / raw)
To: linux-media, linux-kernel-mentees; +Cc: hverkuil, Vandana BN
changes to testEnumFormats() and testGetFormats() to verify METADATA type.
G_FMT sets node->valid_buftypes, so TRY/S_FMT does not get called for
other input types, hence did not modify them.
Signed-off-by: Vandana BN <bnvandana@gmail.com>
---
utils/v4l2-compliance/v4l2-test-formats.cpp | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp
index 525dfafa..604ea921 100644
--- a/utils/v4l2-compliance/v4l2-test-formats.cpp
+++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
@@ -305,8 +305,6 @@ int testEnumFormats(struct node *node)
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
case V4L2_BUF_TYPE_SDR_CAPTURE:
case V4L2_BUF_TYPE_SDR_OUTPUT:
- case V4L2_BUF_TYPE_META_CAPTURE:
- case V4L2_BUF_TYPE_META_OUTPUT:
if (ret && (node->g_caps() & buftype2cap[type]))
return fail("%s cap set, but no %s formats defined\n",
buftype2s(type).c_str(), buftype2s(type).c_str());
@@ -314,6 +312,10 @@ int testEnumFormats(struct node *node)
return fail("%s cap not set, but %s formats defined\n",
buftype2s(type).c_str(), buftype2s(type).c_str());
break;
+ case V4L2_BUF_TYPE_META_CAPTURE:
+ case V4L2_BUF_TYPE_META_OUTPUT:
+ /* Metadata formats need not be present for all input types */
+ break;
default:
if (!ret)
return fail("Buffer type %s not allowed!\n", buftype2s(type).c_str());
@@ -599,8 +601,6 @@ int testGetFormats(struct node *node)
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
case V4L2_BUF_TYPE_SDR_CAPTURE:
case V4L2_BUF_TYPE_SDR_OUTPUT:
- case V4L2_BUF_TYPE_META_CAPTURE:
- case V4L2_BUF_TYPE_META_OUTPUT:
if (ret && (node->g_caps() & buftype2cap[type]))
return fail("%s cap set, but no %s formats defined\n",
buftype2s(type).c_str(), buftype2s(type).c_str());
@@ -608,6 +608,15 @@ int testGetFormats(struct node *node)
return fail("%s cap not set, but %s formats defined\n",
buftype2s(type).c_str(), buftype2s(type).c_str());
break;
+ case V4L2_BUF_TYPE_META_CAPTURE:
+ case V4L2_BUF_TYPE_META_OUTPUT:
+ if(ret && !node->buftype_pixfmts[type].empty())
+ return fail("%s Get_format failed, but %s formats defined\n",
+ buftype2s(type).c_str(), buftype2s(type).c_str());
+ if(!ret && node->buftype_pixfmts[type].empty())
+ return fail("%s Get_format success, but no %s formats defined\n",
+ buftype2s(type).c_str(), buftype2s(type).c_str());
+ break;
default:
/* ENUMFMT doesn't support other buftypes */
break;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] v4l2-compliance: Verify metadata formats
2019-09-24 9:25 [PATCH] v4l2-compliance: Verify metadata formats Vandana BN
@ 2019-09-24 12:01 ` Hans Verkuil
2019-09-25 9:14 ` [PATCH v2] " Vandana BN
0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2019-09-24 12:01 UTC (permalink / raw)
To: Vandana BN, linux-media, linux-kernel-mentees
On 9/24/19 11:25 AM, Vandana BN wrote:
> changes to testEnumFormats() and testGetFormats() to verify METADATA type.
> G_FMT sets node->valid_buftypes, so TRY/S_FMT does not get called for
> other input types, hence did not modify them.
This is a very confusing commit log.
The core problem is that for a given input or output there may not be any
metadata formats defined. And that is what is fixed here.
>
> Signed-off-by: Vandana BN <bnvandana@gmail.com>
> ---
> utils/v4l2-compliance/v4l2-test-formats.cpp | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp
> index 525dfafa..604ea921 100644
> --- a/utils/v4l2-compliance/v4l2-test-formats.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
> @@ -305,8 +305,6 @@ int testEnumFormats(struct node *node)
> case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
> case V4L2_BUF_TYPE_SDR_CAPTURE:
> case V4L2_BUF_TYPE_SDR_OUTPUT:
> - case V4L2_BUF_TYPE_META_CAPTURE:
> - case V4L2_BUF_TYPE_META_OUTPUT:
> if (ret && (node->g_caps() & buftype2cap[type]))
> return fail("%s cap set, but no %s formats defined\n",
> buftype2s(type).c_str(), buftype2s(type).c_str());
> @@ -314,6 +312,10 @@ int testEnumFormats(struct node *node)
> return fail("%s cap not set, but %s formats defined\n",
> buftype2s(type).c_str(), buftype2s(type).c_str());
> break;
> + case V4L2_BUF_TYPE_META_CAPTURE:
> + case V4L2_BUF_TYPE_META_OUTPUT:
> + /* Metadata formats need not be present for all input types */
for all input types -> for the current input/output
> + break;
> default:
> if (!ret)
> return fail("Buffer type %s not allowed!\n", buftype2s(type).c_str());
> @@ -599,8 +601,6 @@ int testGetFormats(struct node *node)
> case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
> case V4L2_BUF_TYPE_SDR_CAPTURE:
> case V4L2_BUF_TYPE_SDR_OUTPUT:
> - case V4L2_BUF_TYPE_META_CAPTURE:
> - case V4L2_BUF_TYPE_META_OUTPUT:
> if (ret && (node->g_caps() & buftype2cap[type]))
> return fail("%s cap set, but no %s formats defined\n",
> buftype2s(type).c_str(), buftype2s(type).c_str());
> @@ -608,6 +608,15 @@ int testGetFormats(struct node *node)
> return fail("%s cap not set, but %s formats defined\n",
> buftype2s(type).c_str(), buftype2s(type).c_str());
> break;
> + case V4L2_BUF_TYPE_META_CAPTURE:
> + case V4L2_BUF_TYPE_META_OUTPUT:
> + if(ret && !node->buftype_pixfmts[type].empty())
Space after 'if'.
> + return fail("%s Get_format failed, but %s formats defined\n",
Get_format -> G_FMT
> + buftype2s(type).c_str(), buftype2s(type).c_str());
> + if(!ret && node->buftype_pixfmts[type].empty())
Space after 'if'.
> + return fail("%s Get_format success, but no %s formats defined\n",
G_FMT, 'no %s' -> 'no %s' (space too many.
> + buftype2s(type).c_str(), buftype2s(type).c_str());
> + break;
> default:
> /* ENUMFMT doesn't support other buftypes */
> break;
>
Regards,
Hans
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] v4l2-compliance: Verify metadata formats
2019-09-24 12:01 ` Hans Verkuil
@ 2019-09-25 9:14 ` Vandana BN
0 siblings, 0 replies; 3+ messages in thread
From: Vandana BN @ 2019-09-25 9:14 UTC (permalink / raw)
To: linux-media, linux-kernel-mentees; +Cc: hverkuil, Vandana BN
Metadata formats may not be defined for a given input or output type.
This patch checks, if given input/output type enumerates metadata formats
and validates G_FMT accordingly.
Signed-off-by: Vandana BN <bnvandana@gmail.com>
---
utils/v4l2-compliance/v4l2-test-formats.cpp | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp
index 525dfafa..b60d9275 100644
--- a/utils/v4l2-compliance/v4l2-test-formats.cpp
+++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
@@ -305,8 +305,6 @@ int testEnumFormats(struct node *node)
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
case V4L2_BUF_TYPE_SDR_CAPTURE:
case V4L2_BUF_TYPE_SDR_OUTPUT:
- case V4L2_BUF_TYPE_META_CAPTURE:
- case V4L2_BUF_TYPE_META_OUTPUT:
if (ret && (node->g_caps() & buftype2cap[type]))
return fail("%s cap set, but no %s formats defined\n",
buftype2s(type).c_str(), buftype2s(type).c_str());
@@ -314,6 +312,10 @@ int testEnumFormats(struct node *node)
return fail("%s cap not set, but %s formats defined\n",
buftype2s(type).c_str(), buftype2s(type).c_str());
break;
+ case V4L2_BUF_TYPE_META_CAPTURE:
+ case V4L2_BUF_TYPE_META_OUTPUT:
+ /* Metadata formats need not be present for the current input/output */
+ break;
default:
if (!ret)
return fail("Buffer type %s not allowed!\n", buftype2s(type).c_str());
@@ -599,8 +601,6 @@ int testGetFormats(struct node *node)
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
case V4L2_BUF_TYPE_SDR_CAPTURE:
case V4L2_BUF_TYPE_SDR_OUTPUT:
- case V4L2_BUF_TYPE_META_CAPTURE:
- case V4L2_BUF_TYPE_META_OUTPUT:
if (ret && (node->g_caps() & buftype2cap[type]))
return fail("%s cap set, but no %s formats defined\n",
buftype2s(type).c_str(), buftype2s(type).c_str());
@@ -608,6 +608,15 @@ int testGetFormats(struct node *node)
return fail("%s cap not set, but %s formats defined\n",
buftype2s(type).c_str(), buftype2s(type).c_str());
break;
+ case V4L2_BUF_TYPE_META_CAPTURE:
+ case V4L2_BUF_TYPE_META_OUTPUT:
+ if (ret && !node->buftype_pixfmts[type].empty())
+ return fail("%s G_FMT failed, but %s formats defined\n",
+ buftype2s(type).c_str(), buftype2s(type).c_str());
+ if (!ret && node->buftype_pixfmts[type].empty())
+ return fail("%s G_FMT success, but no %s formats defined\n",
+ buftype2s(type).c_str(), buftype2s(type).c_str());
+ break;
default:
/* ENUMFMT doesn't support other buftypes */
break;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-25 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24 9:25 [PATCH] v4l2-compliance: Verify metadata formats Vandana BN
2019-09-24 12:01 ` Hans Verkuil
2019-09-25 9:14 ` [PATCH v2] " Vandana BN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).