Skip to contentSkip to conversation

v4l2-tracer: trace: serialize all mplane planes

PATCH In review yehudis9982 2 participants 4 messages Feb 25 – Mar 6 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 v4l2-tracer: trace: serialize all mplane planes

For V4L2_BUF_TYPE_*_MPLANE buffers, trace_v4l2_buffer() only serialized the first plane. Serialize all planes by iterating over buf->length and appending each entry to m.planes in the JSON trace output.

---
 utils/v4l2-tracer/trace.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/v4l2-tracer/trace.cpp +2 -2
index 996fb043..8e9039ef 100644
@@ -252,8 +252,8 @@ void trace_v4l2_buffer(void *arg, json_object *ioctl_args)
 	if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ||
 	    buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
 		json_object *planes_obj = json_object_new_array();
-		/* TODO add planes > 0 */
-		json_object_array_add(planes_obj, trace_v4l2_plane(buf->m.planes, buf->memory));
+		for (__u32 i = 0; i < buf->length; i++)
+			json_object_array_add(planes_obj, trace_v4l2_plane(&buf->m.planes[i], buf->memory));
 		json_object_object_add(m_obj, "planes", planes_obj);
 	}
 
Signature · 1 line
2.43.0
#1 lore raw

Le mercredi 25 février 2026 à 14:00 +0200, yehudis9982 a écrit :

Quoted 16 lines

For V4L2_BUF_TYPE_*_MPLANE buffers, trace_v4l2_buffer() only serialized the first plane. Serialize all planes by iterating over buf->length and appending each entry to m.planes in the JSON trace output.

---
 utils/v4l2-tracer/trace.cpp | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
utils/v4l2-tracer/trace.cpp +0 -0
index 996fb043..8e9039ef 100644
@@ -252,8 +252,8 @@ void trace_v4l2_buffer(void *arg, json_object *ioctl_args)

  if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE || buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { json_object *planes_obj = json_object_new_array();

utils/v4l2-tracer/trace.cpp void trace_v4l2_buffer(void *arg, json_object *ioctl_args) · line 256

Quoted 4 lines
utils/v4l2-tracer/trace.cpp +2 -2
-		/* TODO add planes > 0 */
-		json_object_array_add(planes_obj, trace_v4l2_plane(buf->m.planes, buf->memory));
+		for (__u32 i = 0; i < buf->length; i++)
+			json_object_array_add(planes_obj, trace_v4l2_plane(&buf->m.planes[i], buf->memory));

Have you verified that it works with the deserializer ? (retrace function).

Nicolas

Quoted 3 lines

  json_object_object_add(m_obj, "planes", planes_obj); }

#2 lore raw

‫בתאריך יום ה׳, 26 בפבר׳ 2026 ב-21:22 מאת ‪Nicolas Dufresne‬‏ <‪[email protected]‬‏>:‬

Quoted 25 lines · Le mercredi 25 février 2026 à 14:00 +0200, yehudis9982 a écrit :
Quoted 13 lines

For V4L2_BUF_TYPE_*_MPLANE buffers, trace_v4l2_buffer() only serialized the first plane. Serialize all planes by iterating over buf->length and appending each entry to m.planes in the JSON trace output.

---
 utils/v4l2-tracer/trace.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/v4l2-tracer/trace.cpp +0 -0
index 996fb043..8e9039ef 100644

utils/v4l2-tracer/trace.cpp void trace_v4l2_buffer(void *arg, json_object *ioctl_args) · line 256

Quoted 7 lines
utils/v4l2-tracer/trace.cpp +2 -2
@@ -252,8 +252,8 @@ void trace_v4l2_buffer(void *arg, json_object *ioctl_args)
      if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ||
          buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
              json_object *planes_obj = json_object_new_array();
-             /* TODO add planes > 0 */
-             json_object_array_add(planes_obj, trace_v4l2_plane(buf->m.planes, buf->memory));
+             for (__u32 i = 0; i < buf->length; i++)
+                     json_object_array_add(planes_obj, trace_v4l2_plane(&buf->m.planes[i], buf->memory));

Have you verified that it works with the deserializer ? (retrace function).

Quoted 1 line

Nicolas

The current retrace implementation follows a different execution path and currently handles a single plane only.

This change updates the tracing (serialization) side to correctly serialize all planes for multi-planar buffers. Retrace support for multiple planes will be addressed in a separate follow-up patch to extend the deserialization logic accordingly.

Quoted 4 lines
Quoted 4 lines
utils/v4l2-tracer/trace.cpp +0 -0
              json_object_object_add(m_obj, "planes", planes_obj);
      }
 
#3 lore raw

Le mardi 03 mars 2026 à 13:17 +0200, Yehudis Safern a écrit :

Quoted 8 lines

‫בתאריך יום ה׳, 26 בפבר׳ 2026 ב-21:22 מאת ‪Nicolas Dufresne‬‏ <‪[email protected]‬‏>:‬

Quoted 6 lines · Le mercredi 25 février 2026 à 14:00 +0200, yehudis9982 a écrit :
Quoted 4 lines

For V4L2_BUF_TYPE_*_MPLANE buffers, trace_v4l2_buffer() only serialized the first plane. Serialize all planes by iterating over buf->length and appending each entry to m.planes in the JSON trace output.

nit: I'd expect "Yehudis Safern <[email protected]>" here instead.

Quoted 21 lines
Quoted 19 lines
Quoted 9 lines

---
 utils/v4l2-tracer/trace.cpp | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
utils/v4l2-tracer/trace.cpp +0 -0
index 996fb043..8e9039ef 100644
@@ -252,8 +252,8 @@ void trace_v4l2_buffer(void *arg, json_object *ioctl_args)
Quoted 7 lines

      if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ||
          buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
              json_object *planes_obj = json_object_new_array();
-             /* TODO add planes > 0 */
-             json_object_array_add(planes_obj, trace_v4l2_plane(buf->m.planes, buf->memory)); +             for (__u32 i = 0; i < buf->length; i++)
+                     json_object_array_add(planes_obj, trace_v4l2_plane(&buf->m.planes[i], buf->memory));

Have you verified that it works with the deserializer ? (retrace function).

Quoted 1 line

Nicolas

Quoted 12 lines

The current retrace implementation follows a different execution path and currently handles a single plane only.

This change updates the tracing (serialization) side to correctly serialize all planes for multi-planar buffers. Retrace support for multiple planes will be addressed in a separate follow-up patch to extend the deserialization logic accordingly.

Quoted 4 lines
Quoted 4 lines

              json_object_object_add(m_obj, "planes", planes_obj); }

cheers,
Nicolas