Description
VIDIOC_S_FMT currently succeeds after capture buffers have already been
allocated with VIDIOC_REQBUFS.
Changing the format at this point updates dev->output_format, but the
existing buffers retain the size calculated for the previous format. This
leaves the current format and allocated buffer sizes inconsistent, causing a
later VIDIOC_QBUF call to fail.
Test
Load vcam with pixel conversion enabled, set YUYV, allocate buffers, and then
switch to RGB24:
Initial format: 640x480 YUYV, bytesperline=1280, sizeimage=614400
Allocated buffers: 3
Buffer 0 length: 614400
S_FMT after REQBUFS: succeeded
Current format: 640x480 RGB3, bytesperline=1920, sizeimage=921600
QBUF after S_FMT: failed: Invalid argument
The allocated buffer remains 614400 bytes, while the new RGB24 format
requires 921600 bytes.
Expected behavior
VIDIOC_S_FMT should return EBUSY while videobuf2 buffers are allocated,
leaving the current format unchanged. Applications can release the buffers
with VIDIOC_REQBUFS count=0 before changing the format.
Description
VIDIOC_S_FMTcurrently succeeds after capture buffers have already beenallocated with
VIDIOC_REQBUFS.Changing the format at this point updates
dev->output_format, but theexisting buffers retain the size calculated for the previous format. This
leaves the current format and allocated buffer sizes inconsistent, causing a
later
VIDIOC_QBUFcall to fail.Test
Load vcam with pixel conversion enabled, set YUYV, allocate buffers, and then
switch to RGB24:
The allocated buffer remains 614400 bytes, while the new RGB24 format
requires 921600 bytes.
Expected behavior
VIDIOC_S_FMTshould returnEBUSYwhile videobuf2 buffers are allocated,leaving the current format unchanged. Applications can release the buffers
with
VIDIOC_REQBUFS count=0before changing the format.