[libcamera-devel,00/30] libcamera: Rework buffer API
mbox series

Message ID 20191126233620.1695316-1-niklas.soderlund@ragnatech.se
Headers show
Series
  • libcamera: Rework buffer API
Related show

Message

Niklas Söderlund Nov. 26, 2019, 11:35 p.m. UTC
Hi,

This series reworks the buffer API across the whole library. The two 
main reasons for the rework is

- The current buffer API is cumbersome to work with as the variations 
  between internally allocated buffers (from a V4L2 video device) and 
  externally (from other source in the system or other V4l2 video 
  device) is slightly different.

- V4L2 concepts such as buffer index have "leaked" into the application 
  facing interface which makes the API less intuitive to work with as 
  one needs to know more about V4L2 and its limitations to use.

As changing the buffer API touches most parts of the library this series 
is unfortunately quiet large and some patches are also quiet large. I 
have really tried to break things apart as best I could.

The series starts by adding the new FrameBuffer interface building 
blocks and then slowly proceeds to replace the existing API with the new 
one. The series is tested on all upstream pipelines and IPAs without any 
regressions.

Niklas Söderlund (30):
  libcamera: pipelines: Align bookkeeping in queueRequest()
  libcamera: Remove buffer index from logging
  libcamera: buffer: Add BufferInfo container for buffer metadata
    information
  libcamera: buffer: Add FileDecriptor to help deal with file
    descriptors
  libcamera: buffer: Add Dmabuf to describe a dma buffer
  libcamera: buffer: Add FrameBuffer interface
  ipa: Switch to FrameBuffer interface
  libcamera: buffer: Switch from Plane to Dmabuf
  libcamera: buffers: Remove Plane class
  libcamera: buffer: Drop private function setRequest()
  libcamera: v4l2_videodevice: Align which type variable is used in
    queueBuffer()
  libcamera: v4l2_videodevice: Remove assertion involving BufferPool
  libcamera: v4l2_videodevice: Extract exportDmaBuffer() to export DMA
    buffer
  libcamera: request: In addBuffer() do not fetch stream from Buffer
  libcamera: buffer: Move capture information to BufferInfo
  libcamera: buffer: Buffer remove metadata information
  libcamera: v4l2_videodevice: Add support for multi plane output
    buffers
  libcamera: v4l2_videodevice: Add V4L2BufferCache to deal with index
    mapping
  libcamera: v4l2_videodevice: Add new buffer interface
  libcamera: stream: Add prototypes for new interface
  libcamera: pipelines: Explicitly allocate streams
  libcamera: v4l2_videodevice: Add V4L2Stream to facilitate buffers
  libcamera: pipelines: Switch to V4L2Stream
  libcamera: stream: Make FrameBuffer support mandatory
  libcamera: allocator: Add BufferAllocator to help applications
    allocate buffers
  libcamera: camera: Start streams before pipeline
  libcamera: Switch to FrameBuffer interface
  libcamera: Remove dead code after switch to FrameBuffer
  libcamera: pipeline: Remove explicit buffer handling
  libcamera: camera: Remove the prepared state

 include/ipa/ipa_interface.h                   |   2 +-
 include/libcamera/allocator.h                 |  39 ++
 include/libcamera/buffer.h                    | 118 ++---
 include/libcamera/camera.h                    |   8 +-
 include/libcamera/meson.build                 |   1 +
 include/libcamera/request.h                   |  14 +-
 include/libcamera/stream.h                    |  29 +-
 src/android/camera_device.cpp                 |  34 +-
 src/cam/buffer_writer.cpp                     |  11 +-
 src/cam/buffer_writer.h                       |   3 +-
 src/cam/capture.cpp                           |  55 +-
 src/cam/capture.h                             |   4 +-
 src/ipa/libipa/ipa_interface_wrapper.cpp      |   7 +-
 src/ipa/rkisp1/rkisp1.cpp                     |  14 +-
 src/libcamera/allocator.cpp                   | 141 ++++++
 src/libcamera/buffer.cpp                      | 478 +++++++++---------
 src/libcamera/camera.cpp                      | 157 ++----
 src/libcamera/include/pipeline_handler.h      |  14 +-
 src/libcamera/include/v4l2_videodevice.h      |  65 ++-
 src/libcamera/ipa_context_wrapper.cpp         |   8 +-
 src/libcamera/ipa_interface.cpp               |   7 +-
 src/libcamera/meson.build                     |   1 +
 src/libcamera/pipeline/ipu3/ipu3.cpp          | 315 +++++-------
 src/libcamera/pipeline/rkisp1/rkisp1.cpp      | 165 +++---
 src/libcamera/pipeline/uvcvideo.cpp           |  50 +-
 src/libcamera/pipeline/vimc.cpp               |  51 +-
 src/libcamera/pipeline_handler.cpp            |  66 +--
 src/libcamera/request.cpp                     |  24 +-
 src/libcamera/stream.cpp                      | 265 ++--------
 src/libcamera/v4l2_videodevice.cpp            | 445 +++++++++++-----
 src/qcam/main_window.cpp                      |  64 +--
 src/qcam/main_window.h                        |   6 +-
 test/camera/buffer_import.cpp                 | 411 +++++----------
 test/camera/capture.cpp                       |  41 +-
 test/camera/statemachine.cpp                  |  89 +---
 test/ipa/ipa_wrappers_test.cpp                |  38 +-
 test/v4l2_videodevice/buffer_sharing.cpp      |  39 +-
 test/v4l2_videodevice/capture_async.cpp       |  16 +-
 test/v4l2_videodevice/request_buffers.cpp     |  11 +-
 test/v4l2_videodevice/stream_on_off.cpp       |   6 +-
 test/v4l2_videodevice/v4l2_m2mdevice.cpp      |  44 +-
 test/v4l2_videodevice/v4l2_videodevice_test.h |   2 +-
 42 files changed, 1503 insertions(+), 1855 deletions(-)
 create mode 100644 include/libcamera/allocator.h
 create mode 100644 src/libcamera/allocator.cpp