Skip to content

VIDIOC_S_FMT should return EBUSY after buffers are allocated #52

@grawis

Description

@grawis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions