• Marek Szyprowski's avatar
    [media] v4l: videobuf2: add read() and write() emulator · b25748fe
    Marek Szyprowski authored
    Add a generic file io (read and write) emulator for videobuf2. It uses
    MMAP memory type buffers and generic vb2 calls: req_bufs, qbuf and
    dqbuf. Video date is being copied from mmap buffers to userspace with
    standard copy_to_user() function. To add support for file io the driver
    needs to provide an additional callback - read_setup or write_setup. It
    should provide the default number of buffers used by emulator and flags.
    
    With these flags one can detemine the style of read() or write()
    emulation. By default 'streaming' style is used. With
    VB2_FILEIO_READ_ONCE flag one can select 'one shot' mode for read()
    emulator. With VB2_FILEIO_WRITE_IMMEDIATE flag one can select immediate
    conversion of write calls to qbuf for write() emulator, so the vb2 will
    not wait until each buffer is filled completely before queueing it to
    the driver.
    Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
    CC: Pawel Osciak <pawel@osciak.com>
    Reviewed-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
    b25748fe
videobuf2-core.c 45.7 KB