All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC 0/2] V4L: Add V4L2_CAP_VIDEO_M2M capability
@ 2012-06-30 19:23 Sylwester Nawrocki
  2012-06-30 19:23 ` [PATCH/RFC 1/2] V4L: Add capability flags for memory-to-memory devices Sylwester Nawrocki
  2012-06-30 19:23 ` [PATCH/RFC 2/2] Feature removal: using capture and output capabilities for m2m devices Sylwester Nawrocki
  0 siblings, 2 replies; 4+ messages in thread
From: Sylwester Nawrocki @ 2012-06-30 19:23 UTC (permalink / raw)
  To: linux-media
  Cc: posciak, andrzej.p, hans.verkuil, hdegoede, javier.martin,
	jtp.park, kyungmin.park, k.debski, mchehab, m.szyprowski,
	Sylwester Nawrocki

Currently mem-to-mem devices are identified through V4L2_CAP_VIDEO_CAPTURE
and V4L2_CAP_VIDEO_OUTPUT capabilities. This is not reliable and may
lead to false identification of mem-to-mem devices as video capture
or output devices, if an application doesn't check both flags.

As a follow up to an RFC from Kamil
http://www.mail-archive.com/linux-media@vger.kernel.org/msg22363.html
this changeset adds new capability flags for mem-to-mem devices:
V4L2_CAP_VIDEO_M2M and V4L2_CAP_VIDEO_M2M_MPLANE.

For backward compatibility with existing applications Capture and Output
capability flags are not removed at the drivers. These are intended
to be removed later after some transition period.

However, in practice I wouldn't expect problems, as all current
mem-to-mem drivers are now for embedded devices. So two kernel
releases transition period might be an overkill here.

Comments ?

Regards,
Sylwester

Sylwester Nawrocki (2):
  V4L: Add capability flags for memory-to-memory devices
  Feature removal: Using capture and output capabilities for m2m devices

 Documentation/DocBook/media/v4l/compat.xml         |    9 +++++++++
 .../DocBook/media/v4l/vidioc-querycap.xml          |   13 +++++++++++++
 Documentation/feature-removal-schedule.txt         |   14 ++++++++++++++
 drivers/media/video/mem2mem_testdev.c              |    4 +---
 drivers/media/video/mx2_emmaprp.c                  |   10 +++++++---
 drivers/media/video/s5p-fimc/fimc-m2m.c            |    7 ++++++-
 drivers/media/video/s5p-g2d/g2d.c                  |    9 +++++++--
 drivers/media/video/s5p-jpeg/jpeg-core.c           |   10 +++++++---
 drivers/media/video/s5p-mfc/s5p_mfc_dec.c          |   10 ++++++++--
 drivers/media/video/s5p-mfc/s5p_mfc_enc.c          |   11 ++++++++---
 include/linux/videodev2.h                          |    4 ++++
 11 files changed, 84 insertions(+), 17 deletions(-)

--
1.7.4.1


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

* [PATCH/RFC 1/2] V4L: Add capability flags for memory-to-memory devices
  2012-06-30 19:23 [PATCH/RFC 0/2] V4L: Add V4L2_CAP_VIDEO_M2M capability Sylwester Nawrocki
@ 2012-06-30 19:23 ` Sylwester Nawrocki
  2012-07-24 14:37   ` Kamil Debski
  2012-06-30 19:23 ` [PATCH/RFC 2/2] Feature removal: using capture and output capabilities for m2m devices Sylwester Nawrocki
  1 sibling, 1 reply; 4+ messages in thread
From: Sylwester Nawrocki @ 2012-06-30 19:23 UTC (permalink / raw)
  To: linux-media
  Cc: posciak, andrzej.p, hans.verkuil, hdegoede, javier.martin,
	jtp.park, kyungmin.park, k.debski, mchehab, m.szyprowski,
	Sylwester Nawrocki

This patch adds new V4L2_CAP_VIDEO_M2M and V4L2_CAP_VIDEO_M2M_MPLANE capability
flags that are intended to be used for memory-to-memory (M2M) devices, instead
of ORed V4L2_CAP_VIDEO_CAPTURE and V4L2_CAP_VIDEO_OUTPUT.

V4L2_CAP_VIDEO_M2M flag is added at the drivers, CAPTURE and OUTPUT capability
flags are left untouched and will be removed in future, after a transition
period required for existing applications to be adapted to check only for
V4L2_CAP_VIDEO_M2M.

Signed-off-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
---
 Documentation/DocBook/media/v4l/compat.xml         |    9 +++++++++
 .../DocBook/media/v4l/vidioc-querycap.xml          |   13 +++++++++++++
 drivers/media/video/mem2mem_testdev.c              |    4 +---
 drivers/media/video/mx2_emmaprp.c                  |   10 +++++++---
 drivers/media/video/s5p-fimc/fimc-m2m.c            |    7 ++++++-
 drivers/media/video/s5p-g2d/g2d.c                  |    9 +++++++--
 drivers/media/video/s5p-jpeg/jpeg-core.c           |   10 +++++++---
 drivers/media/video/s5p-mfc/s5p_mfc_dec.c          |   10 ++++++++--
 drivers/media/video/s5p-mfc/s5p_mfc_enc.c          |   11 ++++++++---
 include/linux/videodev2.h                          |    4 ++++
 10 files changed, 70 insertions(+), 17 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml
index ea42ef8..3ab6e0fc9 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2458,6 +2458,15 @@ details.</para>
       </orderedlist>
     </section>
 
+    <section>
+      <title>V4L2 in Linux 3.6</title>
+      <orderedlist>
+        <listitem>
+	  <para>Added V4L2_CAP_VIDEO_M2M and V4L2_CAP_VIDEO_M2M_MPLANE capabilities.</para>
+        </listitem>
+      </orderedlist>
+    </section>
+
     <section id="other">
       <title>Relation of V4L2 to other Linux multimedia APIs</title>
 
diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
index 4643505..f33dd74 100644
--- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
@@ -192,6 +192,19 @@ linkend="output">Video Output</link> interface.</entry>
 	    <link linkend="output">Video Output</link> interface.</entry>
 	  </row>
 	  <row>
+	    <entry><constant>V4L2_CAP_VIDEO_M2M</constant></entry>
+	    <entry>0x00004000</entry>
+	    <entry>The device supports the single-planar API through the
+	    Video Memory-To-Memory interface.</entry>
+	  </row>
+	  <row>
+	    <entry><constant>V4L2_CAP_VIDEO_M2M_MPLANE</constant></entry>
+	    <entry>0x00008000</entry>
+	    <entry>The device supports the
+	    <link linkend="planar-apis">multi-planar API</link> through the
+	    Video Memory-To-Memory  interface.</entry>
+	  </row>
+	  <row>
 	    <entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry>
 	    <entry>0x00000004</entry>
 	    <entry>The device supports the <link
diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c
index 3945556..a8fa79a 100644
--- a/drivers/media/video/mem2mem_testdev.c
+++ b/drivers/media/video/mem2mem_testdev.c
@@ -381,9 +381,7 @@ static int vidioc_querycap(struct file *file, void *priv,
 	strncpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver) - 1);
 	strncpy(cap->card, MEM2MEM_NAME, sizeof(cap->card) - 1);
 	cap->bus_info[0] = 0;
-	cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT
-			  | V4L2_CAP_STREAMING;
-
+	cap->capabilities = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING;
 	return 0;
 }
 
diff --git a/drivers/media/video/mx2_emmaprp.c b/drivers/media/video/mx2_emmaprp.c
index 0bd5815..5f8a6f5 100644
--- a/drivers/media/video/mx2_emmaprp.c
+++ b/drivers/media/video/mx2_emmaprp.c
@@ -396,9 +396,13 @@ static int vidioc_querycap(struct file *file, void *priv,
 {
 	strncpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver) - 1);
 	strncpy(cap->card, MEM2MEM_NAME, sizeof(cap->card) - 1);
-	cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT
-			  | V4L2_CAP_STREAMING;
-
+	/*
+	 * This is only a mem-to-mem video device. The capture and output
+	 * device capability flags are left only for backward compatibility
+	 * and are scheduled for removal.
+	 */
+	cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT |
+			    V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING;
 	return 0;
 }
 
diff --git a/drivers/media/video/s5p-fimc/fimc-m2m.c b/drivers/media/video/s5p-fimc/fimc-m2m.c
index 4c58e05..98b080e 100644
--- a/drivers/media/video/s5p-fimc/fimc-m2m.c
+++ b/drivers/media/video/s5p-fimc/fimc-m2m.c
@@ -259,7 +259,12 @@ static int fimc_m2m_querycap(struct file *file, void *fh,
 	strncpy(cap->driver, fimc->pdev->name, sizeof(cap->driver) - 1);
 	strncpy(cap->card, fimc->pdev->name, sizeof(cap->card) - 1);
 	cap->bus_info[0] = 0;
-	cap->capabilities = V4L2_CAP_STREAMING |
+	/*
+	 * This is only a mem-to-mem video device. The capture and output
+	 * device capability flags are left only for backward compatibility
+	 * and are scheduled for removal.
+	 */
+	cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE |
 		V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE;
 
 	return 0;
diff --git a/drivers/media/video/s5p-g2d/g2d.c b/drivers/media/video/s5p-g2d/g2d.c
index 7c98ee7..7c22004 100644
--- a/drivers/media/video/s5p-g2d/g2d.c
+++ b/drivers/media/video/s5p-g2d/g2d.c
@@ -290,8 +290,13 @@ static int vidioc_querycap(struct file *file, void *priv,
 	strncpy(cap->card, G2D_NAME, sizeof(cap->card) - 1);
 	cap->bus_info[0] = 0;
 	cap->version = KERNEL_VERSION(1, 0, 0);
-	cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT
-							| V4L2_CAP_STREAMING;
+	/*
+	 * This is only a mem-to-mem video device. The capture and output
+	 * device capability flags are left only for backward compatibility
+	 * and are scheduled for removal.
+	 */
+	cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT |
+			    V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING;
 	return 0;
 }
 
diff --git a/drivers/media/video/s5p-jpeg/jpeg-core.c b/drivers/media/video/s5p-jpeg/jpeg-core.c
index 28b5225d..2bde13f 100644
--- a/drivers/media/video/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/video/s5p-jpeg/jpeg-core.c
@@ -489,9 +489,13 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,
 			sizeof(cap->card));
 	}
 	cap->bus_info[0] = 0;
-	cap->capabilities = V4L2_CAP_STREAMING |
-			    V4L2_CAP_VIDEO_CAPTURE |
-			    V4L2_CAP_VIDEO_OUTPUT;
+	/*
+	 * This is only a mem-to-mem video device. The capture and output
+	 * device capability flags are left only for backward compatibility
+	 * and are scheduled for removal.
+	 */
+	cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M |
+			    V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT;
 	return 0;
 }
 
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
index 4dd32fc..00fc4ac 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
@@ -220,8 +220,14 @@ static int vidioc_querycap(struct file *file, void *priv,
 	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
 	cap->bus_info[0] = 0;
 	cap->version = KERNEL_VERSION(1, 0, 0);
-	cap->capabilities = V4L2_CAP_VIDEO_CAPTURE_MPLANE |
-			V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_STREAMING;
+	/*
+	 * This is only a mem-to-mem video device. The capture and output
+	 * device capability flags are left only for backward compatibility
+	 * and are scheduled for removal.
+	 */
+	cap->capabilities = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING |
+			    V4L2_CAP_VIDEO_CAPTURE_MPLANE |
+			    V4L2_CAP_VIDEO_OUTPUT_MPLANE;
 	return 0;
 }
 
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
index 03d8334..b5ade31 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
@@ -779,9 +779,14 @@ static int vidioc_querycap(struct file *file, void *priv,
 	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
 	cap->bus_info[0] = 0;
 	cap->version = KERNEL_VERSION(1, 0, 0);
-	cap->capabilities = V4L2_CAP_VIDEO_CAPTURE_MPLANE
-			  | V4L2_CAP_VIDEO_OUTPUT_MPLANE
-			  | V4L2_CAP_STREAMING;
+	/*
+	 * This is only a mem-to-mem video device. The capture and output
+	 * device capability flags are left only for backward compatibility
+	 * and are scheduled for removal.
+	 */
+	cap->capabilities = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING |
+			    V4L2_CAP_VIDEO_CAPTURE_MPLANE |
+			    V4L2_CAP_VIDEO_OUTPUT_MPLANE;
 	return 0;
 }
 
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index f79d0cc..b960c48 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -273,6 +273,10 @@ struct v4l2_capability {
 #define V4L2_CAP_VIDEO_CAPTURE_MPLANE	0x00001000
 /* Is a video output device that supports multiplanar formats */
 #define V4L2_CAP_VIDEO_OUTPUT_MPLANE	0x00002000
+/* Is a video mem-to-mem device that supports multiplanar formats */
+#define V4L2_CAP_VIDEO_M2M_MPLANE	0x00004000
+/* Is a video mem-to-mem device */
+#define V4L2_CAP_VIDEO_M2M		0x00008000
 
 #define V4L2_CAP_TUNER			0x00010000  /* has a tuner */
 #define V4L2_CAP_AUDIO			0x00020000  /* has audio support */
-- 
1.7.4.1


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

* [PATCH/RFC 2/2] Feature removal: using capture and output capabilities for m2m devices
  2012-06-30 19:23 [PATCH/RFC 0/2] V4L: Add V4L2_CAP_VIDEO_M2M capability Sylwester Nawrocki
  2012-06-30 19:23 ` [PATCH/RFC 1/2] V4L: Add capability flags for memory-to-memory devices Sylwester Nawrocki
@ 2012-06-30 19:23 ` Sylwester Nawrocki
  1 sibling, 0 replies; 4+ messages in thread
From: Sylwester Nawrocki @ 2012-06-30 19:23 UTC (permalink / raw)
  To: linux-media
  Cc: posciak, andrzej.p, hans.verkuil, hdegoede, javier.martin,
	jtp.park, kyungmin.park, k.debski, mchehab, m.szyprowski,
	Sylwester Nawrocki

Identifying a memory-to-memory video device through an ORed output and capture
capability flags is not reliable. Schedule this for removal.

Signed-off-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
---
 Documentation/feature-removal-schedule.txt |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 09701af..950d84a 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -558,3 +558,17 @@ Why:	The V4L2_CID_VCENTER, V4L2_CID_HCENTER controls have been deprecated
 	There are newer controls (V4L2_CID_PAN*, V4L2_CID_TILT*) that provide
 	similar	functionality.
 Who:	Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
+
+----------------------------
+
+What:	Using V4L2_CAP_VIDEO_CAPTURE and V4L2_CAP_VIDEO_OUTPUT flags
+	to indicate a V4L2 memory-to-memory device capability
+When:	3.8
+Why:	New drivers should use new V4L2_CAP_VIDEO_M2M capability flag
+	to indicate a V4L2 video memory-to-memory (M2M) device and
+	applications can now identify a M2M video device by checking
+	for V4L2_CAP_VIDEO_M2M, with VIDIOC_QUERYCAP ioctl. Using ORed
+	V4L2_CAP_VIDEO_CAPTURE and V4L2_CAP_VIDEO_OUTPUT flags for M2M
+	devices is ambiguous and may lead, for example, to identifying
+	a M2M device as a video	capture or output device.
+Who:	Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
--
1.7.4.1


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

* RE: [PATCH/RFC 1/2] V4L: Add capability flags for memory-to-memory devices
  2012-06-30 19:23 ` [PATCH/RFC 1/2] V4L: Add capability flags for memory-to-memory devices Sylwester Nawrocki
@ 2012-07-24 14:37   ` Kamil Debski
  0 siblings, 0 replies; 4+ messages in thread
From: Kamil Debski @ 2012-07-24 14:37 UTC (permalink / raw)
  To: 'Sylwester Nawrocki', linux-media
  Cc: posciak, Andrzej Pietrasiewicz, hans.verkuil, hdegoede,
	javier.martin, jtp.park, kyungmin.park, mchehab,
	Marek Szyprowski

> From: Sylwester Nawrocki [mailto:sylvester.nawrocki@gmail.com]
> Sent: 30 June 2012 21:24
> 
> This patch adds new V4L2_CAP_VIDEO_M2M and V4L2_CAP_VIDEO_M2M_MPLANE
> capability
> flags that are intended to be used for memory-to-memory (M2M) devices,
> instead
> of ORed V4L2_CAP_VIDEO_CAPTURE and V4L2_CAP_VIDEO_OUTPUT.
> 
> V4L2_CAP_VIDEO_M2M flag is added at the drivers, CAPTURE and OUTPUT
> capability
> flags are left untouched and will be removed in future, after a
> transition
> period required for existing applications to be adapted to check only for
> V4L2_CAP_VIDEO_M2M.
> 
> Signed-off-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>

For s5p-mfc and g2d:
Acked-by: Kamil Debski <k.debski@samsung.com>


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

end of thread, other threads:[~2012-07-24 14:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-30 19:23 [PATCH/RFC 0/2] V4L: Add V4L2_CAP_VIDEO_M2M capability Sylwester Nawrocki
2012-06-30 19:23 ` [PATCH/RFC 1/2] V4L: Add capability flags for memory-to-memory devices Sylwester Nawrocki
2012-07-24 14:37   ` Kamil Debski
2012-06-30 19:23 ` [PATCH/RFC 2/2] Feature removal: using capture and output capabilities for m2m devices Sylwester Nawrocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.