Skip to content

fix expected buffer length calculation

Sarah Gershuni linux-media 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 0 repliesNew
  2. v12 patches 2 repliesSuperseded

v1 from the cover letter

The current implementation assumes that stride equals image width, which leads to incorrect buffer size calculations when padding is present.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2add plane_bytesperline to trace_contextutils/v4l2-tracer/trace-helper.cpp utils/v4l2-tracer/trace.h+14 -20 replies
2/2use bytesperline for expected buffer length calculationutils/v4l2-tracer/trace-helper.cpp+1 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v4l-utils v2 0/2] fix expected buffer length calculation

v2:

In this updated version:

- Restore single-buffer calculation using bytesperline Replace the multi-planar v4l2_fwht_find_pixfmt-based logic with the original single-buffer model, using bytesperline instead of assuming stride == width.

- Keep plane_bytesperline as added in v1
The plane_bytesperline array and its initialization in g_fmt_setup_trace are unchanged from v1.

- Link to v1: https://lore.kernel.org/all/[email protected]/

v1:
The current implementation assumes that stride equals image width, which leads to incorrect buffer size calculations when padding is present.

This series fixes the issue by introducing stride-aware handling.

The previous version computed buffer sizes using per-plane bytesperline values and v4l2_fwht_find_pixfmt, iterating over all planes.

Patch 1 introduces plane_bytesperline to store per-plane stride. Patch 2 uses it to compute the expected buffer length.

Thanks,
Sarah

---
Sarah Gershuni (2):
add plane_bytesperline to trace_context
use bytesperline for expected buffer length calculation

 utils/v4l2-tracer/trace-helper.cpp | 22 ++++++++++++++--------
 utils/v4l2-tracer/trace.h          |  1 +
 2 files changed, 15 insertions(+), 8 deletions(-)
Signature · 1 line
2.43.0