linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v4l-utils PATCH 0/2] META_OUTPUT buffer type support for v4l2-compliance
@ 2018-12-10 21:20 Sakari Ailus
  2018-12-10 21:20 ` [v4l-utils PATCH 1/2] Update uAPI headers from the kernel Sakari Ailus
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sakari Ailus @ 2018-12-10 21:20 UTC (permalink / raw)
  To: linux-media; +Cc: yong.zhi

Hi all,

Here are the patches needed to support the META_OUTPUT queue type for
v4l2-compliance. The patch that adds the support is preceded by the kernel
header update --- the headers have been recently updated and there were
no other changes.

Sakari Ailus (1):
  Update uAPI headers from the kernel

Yong Zhi (1):
  v4l2-compliance: Add support for metadata output

 include/linux/videodev2.h                   |  2 ++
 utils/common/v4l-helpers.h                  | 14 +++++++++++++-
 utils/common/v4l2-info.cpp                  |  4 ++++
 utils/v4l2-compliance/v4l2-compliance.cpp   |  7 ++++---
 utils/v4l2-compliance/v4l2-compliance.h     |  2 +-
 utils/v4l2-compliance/v4l2-test-formats.cpp |  7 +++++++
 6 files changed, 31 insertions(+), 5 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [v4l-utils PATCH 1/2] Update uAPI headers from the kernel
  2018-12-10 21:20 [v4l-utils PATCH 0/2] META_OUTPUT buffer type support for v4l2-compliance Sakari Ailus
@ 2018-12-10 21:20 ` Sakari Ailus
  2018-12-10 21:20 ` [v4l-utils PATCH 2/2] v4l2-compliance: Add support for metadata output Sakari Ailus
  2018-12-11  8:22 ` [v4l-utils PATCH 0/2] META_OUTPUT buffer type support for v4l2-compliance Hans Verkuil
  2 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2018-12-10 21:20 UTC (permalink / raw)
  To: linux-media; +Cc: yong.zhi

This brings the META_OUTPUT buffer type as well as the related capability.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 include/linux/videodev2.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 9350bdc1..6aae99ea 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -143,6 +143,7 @@ enum v4l2_buf_type {
 	V4L2_BUF_TYPE_SDR_CAPTURE          = 11,
 	V4L2_BUF_TYPE_SDR_OUTPUT           = 12,
 	V4L2_BUF_TYPE_META_CAPTURE         = 13,
+	V4L2_BUF_TYPE_META_OUTPUT	   = 14,
 	/* Deprecated, do not use */
 	V4L2_BUF_TYPE_PRIVATE              = 0x80,
 };
@@ -463,6 +464,7 @@ struct v4l2_capability {
 #define V4L2_CAP_READWRITE              0x01000000  /* read/write systemcalls */
 #define V4L2_CAP_ASYNCIO                0x02000000  /* async I/O */
 #define V4L2_CAP_STREAMING              0x04000000  /* streaming I/O ioctls */
+#define V4L2_CAP_META_OUTPUT		0x08000000  /* Is a metadata output device */
 
 #define V4L2_CAP_TOUCH                  0x10000000  /* Is a touch device */
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [v4l-utils PATCH 2/2] v4l2-compliance: Add support for metadata output
  2018-12-10 21:20 [v4l-utils PATCH 0/2] META_OUTPUT buffer type support for v4l2-compliance Sakari Ailus
  2018-12-10 21:20 ` [v4l-utils PATCH 1/2] Update uAPI headers from the kernel Sakari Ailus
@ 2018-12-10 21:20 ` Sakari Ailus
  2018-12-11  8:22 ` [v4l-utils PATCH 0/2] META_OUTPUT buffer type support for v4l2-compliance Hans Verkuil
  2 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2018-12-10 21:20 UTC (permalink / raw)
  To: linux-media; +Cc: yong.zhi

From: Yong Zhi <yong.zhi@intel.com>

Add support for metadata output video nodes, in other words,
V4L2_CAP_META_OUTPUT and V4L2_BUF_TYPE_META_OUTPUT.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 utils/common/v4l-helpers.h                  | 14 +++++++++++++-
 utils/common/v4l2-info.cpp                  |  4 ++++
 utils/v4l2-compliance/v4l2-compliance.cpp   |  7 ++++---
 utils/v4l2-compliance/v4l2-compliance.h     |  2 +-
 utils/v4l2-compliance/v4l2-test-formats.cpp |  7 +++++++
 5 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/utils/common/v4l-helpers.h b/utils/common/v4l-helpers.h
index fc4f91ed..a4739cb4 100644
--- a/utils/common/v4l-helpers.h
+++ b/utils/common/v4l-helpers.h
@@ -392,6 +392,11 @@ static inline bool v4l_has_meta_cap(const struct v4l_fd *f)
 	return v4l_g_caps(f) & V4L2_CAP_META_CAPTURE;
 }
 
+static inline bool v4l_has_meta_out(const struct v4l_fd *f)
+{
+	return v4l_g_caps(f) & V4L2_CAP_META_OUTPUT;
+}
+
 static inline bool v4l_has_touch(const struct v4l_fd *f)
 {
 	return v4l_g_caps(f) & V4L2_CAP_TOUCH;
@@ -440,6 +445,9 @@ static inline __u32 v4l_determine_type(const struct v4l_fd *f)
 		return V4L2_BUF_TYPE_SDR_OUTPUT;
 	if (v4l_has_meta_cap(f))
 		return V4L2_BUF_TYPE_META_CAPTURE;
+	if (v4l_has_meta_out(f))
+		return V4L2_BUF_TYPE_META_OUTPUT;
+
 	return 0;
 }
 
@@ -672,6 +680,7 @@ static inline void v4l_format_s_pixelformat(struct v4l2_format *fmt, __u32 pixel
 		fmt->fmt.vbi.sample_format = pixelformat;
 		break;
 	case V4L2_BUF_TYPE_META_CAPTURE:
+	case V4L2_BUF_TYPE_META_OUTPUT:
 		fmt->fmt.meta.dataformat = pixelformat;
 		break;
 	}
@@ -693,6 +702,7 @@ static inline __u32 v4l_format_g_pixelformat(const struct v4l2_format *fmt)
 	case V4L2_BUF_TYPE_VBI_OUTPUT:
 		return fmt->fmt.vbi.sample_format;
 	case V4L2_BUF_TYPE_META_CAPTURE:
+	case V4L2_BUF_TYPE_META_OUTPUT:
 		return fmt->fmt.meta.dataformat;
 	default:
 		return 0;
@@ -1031,6 +1041,7 @@ v4l_format_g_sizeimage(const struct v4l2_format *fmt, unsigned plane)
 	case V4L2_BUF_TYPE_SDR_OUTPUT:
 		return plane ? 0 : fmt->fmt.sdr.buffersize;
 	case V4L2_BUF_TYPE_META_CAPTURE:
+	case V4L2_BUF_TYPE_META_OUTPUT:
 		return plane ? 0 : fmt->fmt.meta.buffersize;
 	default:
 		return 0;
@@ -1152,7 +1163,8 @@ static inline bool v4l_type_is_sdr(unsigned type)
 
 static inline bool v4l_type_is_meta(unsigned type)
 {
-       return type == V4L2_BUF_TYPE_META_CAPTURE;
+	return type == V4L2_BUF_TYPE_META_CAPTURE ||
+	       type == V4L2_BUF_TYPE_META_OUTPUT;
 }
 
 static inline unsigned v4l_type_invert(unsigned type)
diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp
index c0a4ba40..c49e23cc 100644
--- a/utils/common/v4l2-info.cpp
+++ b/utils/common/v4l2-info.cpp
@@ -95,6 +95,8 @@ static std::string cap2s(unsigned cap)
 		s += "\t\tSDR Output\n";
 	if (cap & V4L2_CAP_META_CAPTURE)
 		s += "\t\tMetadata Capture\n";
+	if (cap & V4L2_CAP_META_OUTPUT)
+		s += "\t\tMetadata Output\n";
 	if (cap & V4L2_CAP_TUNER)
 		s += "\t\tTuner\n";
 	if (cap & V4L2_CAP_TOUCH)
@@ -188,6 +190,8 @@ std::string buftype2s(int type)
 		return "SDR Output";
 	case V4L2_BUF_TYPE_META_CAPTURE:
 		return "Metadata Capture";
+	case V4L2_BUF_TYPE_META_OUTPUT:
+		return "Metadata Output";
 	case V4L2_BUF_TYPE_PRIVATE:
 		return "Private";
 	default:
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index a53fcc50..80f02042 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -476,7 +476,7 @@ static int testCap(struct node *node)
 	const __u32 output_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_MPLANE |
 			V4L2_CAP_VIDEO_OUTPUT_OVERLAY | V4L2_CAP_VBI_OUTPUT |
 			V4L2_CAP_SDR_OUTPUT | V4L2_CAP_SLICED_VBI_OUTPUT |
-			V4L2_CAP_MODULATOR;
+			V4L2_CAP_MODULATOR | V4L2_CAP_META_OUTPUT;
 	const __u32 overlay_caps = V4L2_CAP_VIDEO_OVERLAY | V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
 	const __u32 m2m_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_VIDEO_M2M_MPLANE;
 	const __u32 io_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
@@ -702,12 +702,13 @@ void testNode(struct node &node, struct node &expbuf_node, media_type type,
 	if (node.g_caps() & (V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VBI_OUTPUT |
 			 V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE |
 			 V4L2_CAP_VIDEO_M2M | V4L2_CAP_SLICED_VBI_OUTPUT |
-			 V4L2_CAP_RDS_OUTPUT | V4L2_CAP_SDR_OUTPUT))
+			 V4L2_CAP_RDS_OUTPUT | V4L2_CAP_SDR_OUTPUT |
+			 V4L2_CAP_META_OUTPUT))
 		node.can_output = true;
 	if (node.g_caps() & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE |
 			 V4L2_CAP_VIDEO_M2M_MPLANE))
 		node.is_planar = true;
-	if (node.g_caps() & V4L2_CAP_META_CAPTURE) {
+	if (node.g_caps() & (V4L2_CAP_META_CAPTURE | V4L2_CAP_META_OUTPUT)) {
 		node.is_video = false;
 		node.is_meta = true;
 	}
diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
index a12faeee..9b48e3d1 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -69,7 +69,7 @@ typedef std::map<__u32, unsigned> frmsizes_count_map;
 
 struct base_node;
 
-#define V4L2_BUF_TYPE_LAST V4L2_BUF_TYPE_META_CAPTURE
+#define V4L2_BUF_TYPE_LAST V4L2_BUF_TYPE_META_OUTPUT
 
 struct base_node {
 	bool is_video;
diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp
index 006cc322..b68ba969 100644
--- a/utils/v4l2-compliance/v4l2-test-formats.cpp
+++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
@@ -47,6 +47,7 @@ static const __u32 buftype2cap[] = {
 	V4L2_CAP_SDR_CAPTURE,
 	V4L2_CAP_SDR_OUTPUT,
 	V4L2_CAP_META_CAPTURE,
+	V4L2_CAP_META_OUTPUT,
 };
 
 static int testEnumFrameIntervals(struct node *node, __u32 pixfmt,
@@ -298,6 +299,7 @@ int testEnumFormats(struct node *node)
 		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());
@@ -545,6 +547,7 @@ static int testFormatsType(struct node *node, int ret,  unsigned type, struct v4
 		fail_on_test(check_0(sdr.reserved, sizeof(sdr.reserved)));
 		break;
 	case V4L2_BUF_TYPE_META_CAPTURE:
+	case V4L2_BUF_TYPE_META_OUTPUT:
 		if (map.find(meta.dataformat) == map.end())
 			return fail("dataformat %08x (%s) for buftype %d not reported by ENUM_FMT\n",
 					meta.dataformat, fcc2s(meta.dataformat).c_str(), type);
@@ -584,6 +587,7 @@ int testGetFormats(struct node *node)
 		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());
@@ -640,6 +644,7 @@ static bool matchFormats(const struct v4l2_format &f1, const struct v4l2_format
 	case V4L2_BUF_TYPE_SDR_OUTPUT:
 		return !memcmp(&f1.fmt.sdr, &f2.fmt.sdr, sizeof(f1.fmt.sdr));
 	case V4L2_BUF_TYPE_META_CAPTURE:
+	case V4L2_BUF_TYPE_META_OUTPUT:
 		return !memcmp(&f1.fmt.meta, &f2.fmt.meta, sizeof(f1.fmt.meta));
 
 	}
@@ -717,6 +722,7 @@ int testTryFormats(struct node *node)
 				pixelformat = fmt.fmt.sdr.pixelformat;
 				break;
 			case V4L2_BUF_TYPE_META_CAPTURE:
+			case V4L2_BUF_TYPE_META_OUTPUT:
 				pixelformat = fmt.fmt.meta.dataformat;
 				break;
 			case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
@@ -968,6 +974,7 @@ int testSetFormats(struct node *node)
 
 			switch (type) {
 			case V4L2_BUF_TYPE_META_CAPTURE:
+			case V4L2_BUF_TYPE_META_OUTPUT:
 				pixelformat = fmt_set.fmt.meta.dataformat;
 				break;
 			case V4L2_BUF_TYPE_SDR_CAPTURE:
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [v4l-utils PATCH 0/2] META_OUTPUT buffer type support for v4l2-compliance
  2018-12-10 21:20 [v4l-utils PATCH 0/2] META_OUTPUT buffer type support for v4l2-compliance Sakari Ailus
  2018-12-10 21:20 ` [v4l-utils PATCH 1/2] Update uAPI headers from the kernel Sakari Ailus
  2018-12-10 21:20 ` [v4l-utils PATCH 2/2] v4l2-compliance: Add support for metadata output Sakari Ailus
@ 2018-12-11  8:22 ` Hans Verkuil
  2 siblings, 0 replies; 4+ messages in thread
From: Hans Verkuil @ 2018-12-11  8:22 UTC (permalink / raw)
  To: Sakari Ailus, linux-media; +Cc: yong.zhi

On 12/10/18 10:20 PM, Sakari Ailus wrote:
> Hi all,
> 
> Here are the patches needed to support the META_OUTPUT queue type for
> v4l2-compliance. The patch that adds the support is preceded by the kernel
> header update --- the headers have been recently updated and there were
> no other changes.

Looks good for v4l2-compliance, but v4l2-ctl should also be updated.

I have alreaedy prepared v4l2-ctl-meta.cpp (should work automatically with
this patch series applied), but there are two other places where you need
to add META_OUTPUT support. Just add a third patch for v4l2-ctl.

Regards,

	Hans

> 
> Sakari Ailus (1):
>   Update uAPI headers from the kernel
> 
> Yong Zhi (1):
>   v4l2-compliance: Add support for metadata output
> 
>  include/linux/videodev2.h                   |  2 ++
>  utils/common/v4l-helpers.h                  | 14 +++++++++++++-
>  utils/common/v4l2-info.cpp                  |  4 ++++
>  utils/v4l2-compliance/v4l2-compliance.cpp   |  7 ++++---
>  utils/v4l2-compliance/v4l2-compliance.h     |  2 +-
>  utils/v4l2-compliance/v4l2-test-formats.cpp |  7 +++++++
>  6 files changed, 31 insertions(+), 5 deletions(-)
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-11  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-10 21:20 [v4l-utils PATCH 0/2] META_OUTPUT buffer type support for v4l2-compliance Sakari Ailus
2018-12-10 21:20 ` [v4l-utils PATCH 1/2] Update uAPI headers from the kernel Sakari Ailus
2018-12-10 21:20 ` [v4l-utils PATCH 2/2] v4l2-compliance: Add support for metadata output Sakari Ailus
2018-12-11  8:22 ` [v4l-utils PATCH 0/2] META_OUTPUT buffer type support for v4l2-compliance Hans Verkuil

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).