[PATCH] v4l2(GSOC 2017): added printings for all buf types

Edgar Kaziahmedov edos at linux.com
Sun Mar 26 01:45:35 UTC 2017


Meaningful and informative printings have been added for all
v4l2 buf types in the 'print_v4l2_format_fmt' routine.
As a new kernel version, it has been added additional
defines to xlat/v4l2*.in files.

Signed-off-by: Edgar Kaziahmedov <edos at linux.com>
---
 v4l2.c                                 | 70 ++++++++++++++++++++++++++++------
 xlat/v4l2_buf_flags.in                 | 12 +++++-
 xlat/v4l2_buf_types.in                 |  2 +
 xlat/v4l2_colorspaces.in               |  4 ++
 xlat/v4l2_device_capabilities_flags.in |  3 ++
 xlat/v4l2_memories.in                  |  2 +
 xlat/v4l2_sliced_flags.in              |  6 +++
 xlat/v4l2_vbi_flags.in                 |  6 +++
 8 files changed, 92 insertions(+), 13 deletions(-)
 create mode 100644 xlat/v4l2_sliced_flags.in
 create mode 100644 xlat/v4l2_vbi_flags.in

diff --git a/v4l2.c b/v4l2.c
index 637e8788..443a0d94 100644
--- a/v4l2.c
+++ b/v4l2.c
@@ -200,6 +200,8 @@ print_v4l2_fmtdesc(struct tcb *const tcp, const kernel_ulong_t arg)
 
 #include "xlat/v4l2_fields.h"
 #include "xlat/v4l2_colorspaces.h"
+#include "xlat/v4l2_vbi_flags.h"
+#include "xlat/v4l2_sliced_flags.h"
 
 static void
 print_v4l2_format_fmt(const char *prefix, const struct_v4l2_format *f)
@@ -248,37 +250,81 @@ print_v4l2_format_fmt(const char *prefix, const struct_v4l2_format *f)
 		break;
 	}
 #endif
-
-	/* TODO: Complete this switch statement */
-#if 0
 	case V4L2_BUF_TYPE_VIDEO_OVERLAY:
 #if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
-	case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
+	case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: {
 #endif
+                unsigned int i;
+
 		tprints(prefix);
-		tprints("fmt.win={???}");
+		tprintf("fmt.win={left=%d, top=%d, width=%u, height=%u,field=",
+                        ARGS_RECT(f->fmt.win.w));
+                printxval(v4l2_fields, f->fmt.win.field, "V4L2_FIELD_???");
+                tprintf(", chromakey=0x%08x, clips=[", f->fmt.win.chromakey);
+                for (i = 0; i < f->fmt.win.clipcount; i++) {
+                        if (i > 0)
+                                tprints(", ");
+                        tprintf(FMT_RECT, ARGS_RECT(f->fmt.win.clips->c));
+                }
+                tprintf("], clipcount=%u, bitmap=%p, global_alpha=0x%02x}", 
+                        f->fmt.win.clipcount, f->fmt.win.bitmap,
+                        f->fmt.win.global_alpha);
 		break;
-
+        }
 	case V4L2_BUF_TYPE_VBI_CAPTURE:
 	case V4L2_BUF_TYPE_VBI_OUTPUT:
 		tprints(prefix);
-		tprints("fmt.vbi={???}");
+		tprintf("fmt.vbi={sampling_rate=%u, offset=%u, "
+                        "samples_per_line=%u, sample_format=",
+                        f->fmt.vbi.sampling_rate, f->fmt.vbi.offset,
+                        f->fmt.vbi.samples_per_line);
+                print_pixelformat(f->fmt.vbi.sample_format);
+                tprintf(", start=%u,%u, count=%u,%u, ",
+                        f->fmt.vbi.start[0], f->fmt.vbi.start[1],
+                        f->fmt.vbi.count[0], f->fmt.vbi.count[1]);
+                tprints("flags=");
+                printxval(v4l2_vbi_flags, f->fmt.vbi.flags, "V4L2_VBI_???");
+                tprintf(", reserved=0x%08x,0x%08x}", f->fmt.vbi.reserved[0],
+                        f->fmt.vbi.reserved[1]);
 		break;
 
 	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
-	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
+	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: {
+                unsigned int i;
 		tprints(prefix);
-		tprints("fmt.sliced={???}");
-		break;
+		tprints("fmt.sliced={service_set=");
+                printxval(v4l2_sliced_flags, f->fmt.sliced.service_set, 
+                          "V4L2_SLICED_???");
+                tprintf(", io_size=%d, service_lines=[", 
+                        f->fmt.sliced.io_size);
+                /* I'm sorry for this magic constant, but standard headers 
+                 * doesn't contain the corresponding define for 
+                 * v4l2_sliced_vbi_format
+                 */
+                for (i = 0; i < 24; i++) {
+                        if (i > 0)
+                                tprints(", ");
+                        tprintf("{line[%u]=0x%04x, 0x%04x} ", i, 
+                                f->fmt.sliced.service_lines[0][i],
+                                f->fmt.sliced.service_lines[1][i]);
+                } 
+                tprintf("], reserved=0x%08x,0x%08x}", 
+                        f->fmt.sliced.reserved[0],
+                        f->fmt.sliced.reserved[1]);
 
+		break;
+        }
 #if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
 	case V4L2_BUF_TYPE_SDR_CAPTURE:
 	case V4L2_BUF_TYPE_SDR_OUTPUT:
 		tprints(prefix);
-		tprints("fmt.sdr={???}");
+		tprints("fmt.sdr={pixelformat=");
+                print_pixelformat(f->fmt.sdr.pixelformat);
+                tprintf(", buffersize=%u, reserved=0x%08x,0x%08x}",
+                        f->fmt.sdr.buffersize, 
+                        f->fmt.sdr.reserved[0]);
 		break;
 #endif
-#endif
 	}
 }
 
diff --git a/xlat/v4l2_buf_flags.in b/xlat/v4l2_buf_flags.in
index ba7e86e9..0c577149 100644
--- a/xlat/v4l2_buf_flags.in
+++ b/xlat/v4l2_buf_flags.in
@@ -5,4 +5,14 @@ V4L2_BUF_FLAG_KEYFRAME
 V4L2_BUF_FLAG_PFRAME
 V4L2_BUF_FLAG_BFRAME
 V4L2_BUF_FLAG_TIMECODE
-V4L2_BUF_FLAG_INPUT
+V4L2_BUF_FLAG_PREPARED
+V4L2_BUF_FLAG_NO_CACHE_INVALIDATE
+V4L2_BUF_FLAG_NO_CACHE_CLEAN
+V4L2_BUF_FLAG_TIMESTAMP_MASK
+V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN
+V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC
+V4L2_BUF_FLAG_TIMESTAMP_COPY
+V4L2_BUF_FLAG_TSTAMP_SRC_MASK
+V4L2_BUF_FLAG_TSTAMP_SRC_EOF
+V4L2_BUF_FLAG_TSTAMP_SRC_SOE
+V4L2_BUF_FLAG_LAST
diff --git a/xlat/v4l2_buf_types.in b/xlat/v4l2_buf_types.in
index 431cb598..2b52561f 100644
--- a/xlat/v4l2_buf_types.in
+++ b/xlat/v4l2_buf_types.in
@@ -8,3 +8,5 @@ V4L2_BUF_TYPE_VBI_OUTPUT
 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT
 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
+V4L2_BUF_TYPE_SDR_CAPTURE
+V4L2_BUF_TYPE_SDR_OUTPUT
diff --git a/xlat/v4l2_colorspaces.in b/xlat/v4l2_colorspaces.in
index 961e71c8..1d227e49 100644
--- a/xlat/v4l2_colorspaces.in
+++ b/xlat/v4l2_colorspaces.in
@@ -6,3 +6,7 @@ V4L2_COLORSPACE_470_SYSTEM_M
 V4L2_COLORSPACE_470_SYSTEM_BG
 V4L2_COLORSPACE_JPEG
 V4L2_COLORSPACE_SRGB
+V4L2_COLORSPACE_ADOBERGB
+V4L2_COLORSPACE_BT2020
+V4L2_COLORSPACE_RAW
+V4L2_COLORSPACE_DCI_P3
diff --git a/xlat/v4l2_device_capabilities_flags.in b/xlat/v4l2_device_capabilities_flags.in
index 9380eb44..d4e3292b 100644
--- a/xlat/v4l2_device_capabilities_flags.in
+++ b/xlat/v4l2_device_capabilities_flags.in
@@ -22,3 +22,6 @@ V4L2_CAP_ASYNCIO
 V4L2_CAP_STREAMING
 V4L2_CAP_TOUCH
 V4L2_CAP_DEVICE_CAPS
+V4L2_CAP_SDR_CAPTURE
+V4L2_CAP_EXT_PIX_FORMAT
+V4L2_CAP_SDR_OUTPUT
diff --git a/xlat/v4l2_memories.in b/xlat/v4l2_memories.in
index e592d57f..2acd47b8 100644
--- a/xlat/v4l2_memories.in
+++ b/xlat/v4l2_memories.in
@@ -1,2 +1,4 @@
 V4L2_MEMORY_MMAP
 V4L2_MEMORY_USERPTR
+V4L2_MEMORY_OVERLAY
+V4L2_MEMORY_DMABUF
diff --git a/xlat/v4l2_sliced_flags.in b/xlat/v4l2_sliced_flags.in
new file mode 100644
index 00000000..baff2e26
--- /dev/null
+++ b/xlat/v4l2_sliced_flags.in
@@ -0,0 +1,6 @@
+V4L2_SLICED_TELETEXT_B
+V4L2_SLICED_VPS
+V4L2_SLICED_CAPTION_525
+V4L2_SLICED_WSS_625
+V4L2_SLICED_VBI_525
+V4L2_SLICED_VBI_625
diff --git a/xlat/v4l2_vbi_flags.in b/xlat/v4l2_vbi_flags.in
new file mode 100644
index 00000000..b367e606
--- /dev/null
+++ b/xlat/v4l2_vbi_flags.in
@@ -0,0 +1,6 @@
+V4L2_VBI_UNSYNC
+V4L2_VBI_INTERLACED
+V4L2_VBI_ITU_525_F1_START
+V4L2_VBI_ITU_525_F2_START
+V4L2_VBI_ITU_625_F1_START
+V4L2_VBI_ITU_625_F2_START
-- 
2.11.0





More information about the Strace-devel mailing list