[libcamera-devel,RFC,0/3] libcamera: Use extended fmt and buffer ioctls API
mbox series

Message ID 20210205131044.512128-1-helen.koike@collabora.com
Headers show
Series
  • libcamera: Use extended fmt and buffer ioctls API
Related show

Message

Helen Koike Feb. 5, 2021, 1:10 p.m. UTC
Hi,

This RFC migrate libcamera to use the kernel V4L2 Ext API.
Please see kernel patchset cover letter on [1] for more details on the
API and the features it would bring for userspace.

The purpose of this RFC is:
* To use as a proof-of-concept of the proposed Ext API on [1].
* To promote discussions/reviews on the proposed uapi, to make sure we get it right.
* To discuss how this would be integrated with libcamera.

This RFC replaces the traditional ioctls:
* VIDIOC_{S,G,TRY}_FMT
* VIDIOC_(D)QBUF
By:
* VIDIOC_{S,G,TRY}_EXT_PIX_FMT
* VIDIOC_EXT_(D)QBUF

Which is far from the final solution, since libcamera would need a
fallback mechanism for older kernels.

So I would like to get some ideas and pointers regarding how this would
be implemented, and also if you see issues on the uapi.

Another point is regarding memory planes and color planes.
QUERYBUF and EXPBUF deals with memory planes, but QBUF requires
information per color planes, which requires some special handling in
the code.

I'd like to hear your thoughts.

This RFC was tested with qcam on vimc. It works with my wip-v7
branch [2] (which is v6 with some fixes that I'm going to post to
linux-media soon), and it is also available at my tree [3].

[1] https://patchwork.linuxtv.org/project/linux-media/cover/20210114180738.1758707-1-helen.koike@collabora.com/
[2] https://gitlab.collabora.com/koike/linux/-/tree/v4l2/ext-api/wip-v7
[3] https://gitlab.collabora.com/koike/libcamera/-/tree/ext_api

Thanks!

Helen Koike (3):
  include: uapi: Add header definitions for V4L2 Ext API
  libcamera: Use VIDIOC_{S,G,TRY}_EXT_PIX_FMT API
  libcamera: Use VIDIOC_EXT_(D)QBUF for buffer handling

 include/libcamera/internal/v4l2_videodevice.h |   8 +-
 include/linux/videodev2.h                     |  96 +++++++
 src/libcamera/pipeline/ipu3/cio2.cpp          |   1 -
 src/libcamera/pipeline/ipu3/imgu.cpp          |   1 -
 .../pipeline/raspberrypi/raspberrypi.cpp      |   4 +
 src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |   4 +-
 src/libcamera/pipeline/simple/converter.cpp   |   6 +-
 src/libcamera/pipeline/simple/simple.cpp      |   8 +-
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |   2 +
 src/libcamera/pipeline/vimc/vimc.cpp          |   2 +
 src/libcamera/v4l2_videodevice.cpp            | 258 ++++++------------
 src/v4l2/v4l2_camera_proxy.cpp                |  20 +-
 12 files changed, 212 insertions(+), 198 deletions(-)