Skip to contentSkip to conversation

gst-plugins-good: v4l2src: Make Leapoard Imaging VGA Camera work out of the box

PATCH Superseded Joel A Fernandes 1 participant 3 messages Jul 29, 2011 – Aug 1, 2011 2 messages not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gst-plugins-good: v4l2src: Make Leapoard Imaging VGA Camera work out of the box

Format enumeration in Gstreamer expects drivers to implement VIDIOC_ENUM_FMT and if not, it calls VIDIOC_TRY_FMT on a set of "emulated formats" which could be unsupported resulting in failure of the format negotiation stage [1]

We add UYVY to the set of formats making the mt9v113 sensor in this camera board and other sensors that don't support the emulated formats work out-of-the box without needing a caps filter element

[1] http://lists.freedesktop.org/archives/gstreamer-devel/2011-July/032425.html

---
 ...-UYVY-color-format-to-the-list-of-enumera.patch |   43 ++++++++++++++++++++
 recipes/gstreamer/gst-plugins-good_0.10.28.bb      |    4 +-
 2 files changed, 46 insertions(+), 1 deletions(-)
 create mode 100644 recipes/gstreamer/gst-plugins-good/0001-v4l2src-Add-UYVY-color-format-to-the-list-of-enumera.patch
recipes/gstreamer/gst-plugins-good/0001-v4l2src-Add-UYVY-color-format-to-the-list-of-enumera.patch new file +43 -0
new file mode 100644
index 0000000..88a0125
@@ -0,0 +1,43 @@
+From d5a1f365bfd4420912735709bcb8004d3ad7226c Mon Sep 17 00:00:00 2001
+From: Joel A Fernandes <[email protected]>
+Date: Fri, 29 Jul 2011 17:23:43 -0500
+Subject: [PATCH] v4l2src: Add UYVY color format to the list of enumerations
+
+OMAP3 ISP returns -EINVAL for VIDIOC_ENUM_FMT ioctl on video node. Due to this, format negotiation fails. This adds UYVY format to the list of enumerations.
+
+Signed-off-by: Joel A Fernandes <[email protected]>
+---
+ sys/v4l2/gstv4l2object.c |   17 +++++++++++++++++
+ 1 files changed, 17 insertions(+), 0 deletions(-)
+
+diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
+index 7e15489..e04c0fd 100644
+--- a/sys/v4l2/gstv4l2object.c
++++ b/sys/v4l2/gstv4l2object.c
+@@ -1025,6 +1025,23 @@ gst_v4l2_object_fill_format_list (GstV4l2Object * v4l2object)
+         (GCompareFunc) format_cmp_func);
+   }
+ 
++/* Add UYVY format to the list of enumerations */
++  format = g_new0 (struct v4l2_fmtdesc, 1);
++  format->type = (enum v4l2_buf_type)-1;
++  format->index = n;
++  format->flags = 0;
++  format->pixelformat = V4L2_PIX_FMT_UYVY;
++  v4l2object->formats = g_slist_insert_sorted (v4l2object->formats, format,
++      (GCompareFunc) format_cmp_func);
++
++  GST_INFO_OBJECT (v4l2object->element, "index:       %u", format->index);
++  GST_INFO_OBJECT (v4l2object->element, "type:        %d", format->type);
++  GST_INFO_OBJECT (v4l2object->element, "flags:       %08x", format->flags);
++  GST_INFO_OBJECT (v4l2object->element, "description: '%s'",
++      format->description);
++  GST_INFO_OBJECT (v4l2object->element, "pixelformat: %" GST_FOURCC_FORMAT,
++        GST_FOURCC_ARGS (format->pixelformat));
++
+ #ifndef GST_DISABLE_GST_DEBUG
+   {
+     GSList *l;
+-- 
+1.7.0.4
+
recipes/gstreamer/gst-plugins-good_0.10.28.bb +3 -1
index a398f4c..b93236b 100644
@@ -1,6 +1,8 @@
 require gst-plugins.inc
 
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
+
+SRC_URI += "file://0001-v4l2src-Add-UYVY-color-format-to-the-list-of-enumera.patch"
 
 SRC_URI[archive.md5sum] = "6ef1588921f59d85c44ee2e49a3c97a0"
 SRC_URI[archive.sha256sum] = "adfbce68b9fbadb7a7aeda2227af6afe1928ef025af4158726617b9d6834b028"
Signature · 1 line
1.7.0.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 19 lines · Koen Kooi

Op 30 jul. 2011, om 00:58 heeft Joel A Fernandes het volgende geschreven:

Quoted 16 lines

Format enumeration in Gstreamer expects drivers to implement VIDIOC_ENUM_FMT and if not, it calls VIDIOC_TRY_FMT on a set of "emulated formats" which could be unsupported resulting in failure of the format negotiation stage [1]

We add UYVY to the set of formats making the mt9v113 sensor in this camera board and other sensors that don't support the emulated formats work out-of-the box without needing a caps filter element

[1] http://lists.freedesktop.org/archives/gstreamer-devel/2011-July/032425.html

---
...-UYVY-color-format-to-the-list-of-enumera.patch |   43 ++++++++++++++++++++ recipes/gstreamer/gst-plugins-good_0.10.28.bb      |    4 +-

2 files changed, 46 insertions(+), 1 deletions(-)

create mode 100644 recipes/gstreamer/gst-plugins-good/0001-v4l2src-Add-UYVY-color-format-to-the-list-of-enumera.patch

Quoted 14 lines

recipes/gstreamer/gst-plugins-good/0001-v4l2src-Add-UYVY-color-format-to-the-list-of-enumera.patch line 6

Quoted 12 lines
recipes/gstreamer/gst-plugins-good/0001-v4l2src-Add-UYVY-color-format-to-the-list-of-enumera.patch new file +6 -0
new file mode 100644
index 0000000..88a0125
@@ -0,0 +1,43 @@
+From d5a1f365bfd4420912735709bcb8004d3ad7226c Mon Sep 17 00:00:00 2001
+From: Joel A Fernandes <[email protected]>
+Date: Fri, 29 Jul 2011 17:23:43 -0500
+Subject: [PATCH] v4l2src: Add UYVY color format to the list of enumerations
+
+OMAP3 ISP returns -EINVAL for VIDIOC_ENUM_FMT ioctl on video node. Due to this, format negotiation fails. This adds UYVY format to the list of enumerations.

I must be missing something, but what has negotation failure to do with adding a new format? I would expect adding new formats not to have any effect if negotiation fails.

The way it works is:

Enumerate formats -> Negotiate formats between source and sink pads and set the format

Enumerate formats doesn't return UYVY (The driver is supposed to return this but ENUM_FMT ioctl is not implemented in ISP like I was saying). Due to this, the negotiate function is either unable to find a matching format on the sink pad (if you used a UYVY caps filter element) or fails to set the format if you used a more general element.

Quoted 2 lines

Anyway, could you add a 'upstream-status' tag to the patch as described in http://wiki.openembedded.org/index.php/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations ?

This patch is more like a harmless hack which works around a limitation of the driver. It is unlikely that it will be accepted by upstream or if it should even be submitted as an RFC. Considering this, would it be ok if I prepended "HACK!" to the title? I noticed this in your 1GHz patches

Thanks,
Joel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi Vladimir,

Quoted 28 lines · Vladimir Pantelic
Quoted 19 lines · Joel A Fernandes
Quoted 10 lines
Quoted 9 lines

 +From d5a1f365bfd4420912735709bcb8004d3ad7226c Mon Sep 17 00:00:00 2001 +From: Joel A Fernandes<[email protected]>
 +Date: Fri, 29 Jul 2011 17:23:43 -0500
 +Subject: [PATCH] v4l2src: Add UYVY color format to the list of enumerations
 +
 +OMAP3 ISP returns -EINVAL for VIDIOC_ENUM_FMT ioctl on video node. Due to this, format negotiation fails. This adds UYVY format to the list of enumerations.

Quoted 3 lines

 I must be missing something, but what has negotation failure to do with adding a new format? I would expect adding new formats not to have any effect if negotiation fails.

The way it works is:

Enumerate formats ->  Negotiate formats between source and sink pads and set the format

Quoted 6 lines

Enumerate formats doesn't return UYVY (The driver is supposed to return this but ENUM_FMT ioctl is not implemented in ISP like I was saying). Due to this, the negotiate function is either unable to find a matching format on the sink pad (if you used a UYVY caps filter element) or fails to set the format if you used a more general element.

Quoted 4 lines

and why not make ENUM_FMT ioctl return what is needed??? Instead of "hacking" the gst driver?

That'll be a hack as well:
http://www.mail-archive.com/[email protected]/msg29718.html

Regards,
Joel