{"id":2582,"url":"https://patchwork.libcamera.org/api/1.1/covers/2582/?format=json","web_url":"https://patchwork.libcamera.org/cover/2582/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200112010212.2609025-1-niklas.soderlund@ragnatech.se>","date":"2020-01-12T01:01:40","name":"[libcamera-devel,v4,00/32] libcamera: Rework buffer API","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/1.1/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"mbox":"https://patchwork.libcamera.org/cover/2582/mbox/","series":[{"id":617,"url":"https://patchwork.libcamera.org/api/1.1/series/617/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=617","date":"2020-01-12T01:01:40","name":"libcamera: Rework buffer API","version":4,"mbox":"https://patchwork.libcamera.org/series/617/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/2582/comments/","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7CE6A6067C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 12 Jan 2020 02:02:58 +0100 (CET)","from bismarck.berto.se (p54ac5d7b.dip0.t-ipconnect.de\n\t[84.172.93.123]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid 3df10cc1-34d7-11ea-b6d8-005056917f90;\n\tSun, 12 Jan 2020 02:02:54 +0100 (CET)"],"X-Halon-ID":"3df10cc1-34d7-11ea-b6d8-005056917f90","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Sun, 12 Jan 2020 02:01:40 +0100","Message-Id":"<20200112010212.2609025-1-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.24.1","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 00/32] libcamera: Rework buffer API","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Sun, 12 Jan 2020 01:02:58 -0000"},"content":"Hi,\n\nThis series reworks the buffer API across the whole library. The two\nmain reasons for the rework is\n\n- The current buffer API is cumbersome to work with as the variations\n  between internally allocated buffers (from a V4L2 video device) and\n  externally (from other source in the system or other V4l2 video\n  device) is slightly different.\n\n- V4L2 concepts such as buffer index have \"leaked\" into the application\n  facing interface which makes the API less intuitive to work with as\n  one needs to know more about V4L2 and its limitations to use.\n\nAs changing the buffer API touches most parts of the library this series\nis unfortunately quite large and some patches are also quite large. I\nhave really tried to break things apart as best I could.\n\nThe series starts by adding the new FrameBuffer interface building\nblocks and then slowly proceeds to replace the existing API with the new\none. The series is tested on all upstream pipelines and IPAs without any\nregressions.\n\nOne note on 18/32, there is a temporary hack which is introduced in this\npatch that allows both the Buffer and FrameBuffer API to function side\nby side. That is i the V4L2VideoDevice is setup using the Buffer API\nslots related to Buffer will be emitted while if it is setup with the\nFrameBuffer API slots related to FrameBuffers are emitted. This hack is\nremoved later in 27/32 where the Buffer API is completely removed.\n\nI have incorporated all prototype patches published by Laurent on top of\nthis series. Either in their original form or squashed if the code is\nintroduced in this patch-set (FileDescriptor). Big thanks to Laurent for\nthis work.\n\nLaurent Pinchart (1):\n  v4l2: camera_proxy: Call V4L2Camera::getBufferFd() directly\n\nNiklas Söderlund (31):\n  libcamera: request: remove prepare()\n  libcamera: Add FileDescriptor to help pass numerical fds around\n  test: file_descriptor: Add test\n  v4l2: Rename FrameMetadata to V4L2FrameMetadata\n  v4l2: camera: Handle memory mapping of buffers directly\n  libcamera: buffer: Add FrameMetadata container for metadata\n    information\n  libcamera: buffer: Add FrameBuffer interface\n  ipa: Switch to FrameBuffer interface\n  libcamera: buffer: Switch from Plane to FrameBuffer::Plane\n  libcamera: buffers: Remove Plane class\n  libcamera: buffer: Drop private function setRequest()\n  libcamera: v4l2_videodevice: Align which type variable is used in\n    queueBuffer()\n  libcamera: v4l2_videodevice: Extract exportDmabufFd()\n  libcamera: request: In addBuffer() do not fetch stream from Buffer\n  libcamera: buffer: Move captured metadata to FrameMetadata\n  libcamera: v4l2_videodevice: Add V4L2BufferCache to deal with index\n    mapping\n  libcamera: v4l2_videodevice: Add FrameBuffer interface\n  test: v4l2_videodevice: Switch to FrameBuffer interface\n  test: camera: buffer_import: Update to FrameBuffer restrictions\n  libcamera: pipeline: rkisp1: Destroy frame information before\n    completing request\n  libcamera: pipeline: rkisp1: Switch to FrameBuffer interface for stat\n    and param\n  libcamera: pipeline: ipu3: Switch to FrameBuffer interface for cio2\n    and stat\n  libcamera: pipeline: Add FrameBuffer handlers\n  libcamera: allocator: Add FrameBufferAllocator to help applications\n    allocate buffers\n  libcamera: Switch to FrameBuffer interface\n  libcamera: v4l2_videodevice: Remove Buffer interface\n  libcamera: Remove dead code after switch to FrameBuffer\n  cam: Cache buffer memory mapping\n  qcam: Cache buffer memory mapping\n  libcamera: pipeline: Remove explicit buffer handling\n  libcamera: camera: Remove the prepared state\n\n include/ipa/ipa_interface.h                   |   2 +-\n include/libcamera/buffer.h                    | 113 ++---\n include/libcamera/camera.h                    |  13 +-\n include/libcamera/file_descriptor.h           |  47 ++\n include/libcamera/framebuffer_allocator.h     |  45 ++\n include/libcamera/meson.build                 |   2 +\n include/libcamera/request.h                   |  16 +-\n include/libcamera/stream.h                    |  23 -\n src/android/camera_device.cpp                 |  43 +-\n src/cam/buffer_writer.cpp                     |  33 +-\n src/cam/buffer_writer.h                       |   8 +-\n src/cam/capture.cpp                           |  64 +--\n src/cam/capture.h                             |   5 +-\n src/ipa/libipa/ipa_interface_wrapper.cpp      |   9 +-\n src/ipa/rkisp1/rkisp1.cpp                     |  40 +-\n src/libcamera/buffer.cpp                      | 411 +++++------------\n src/libcamera/camera.cpp                      | 184 +++-----\n src/libcamera/file_descriptor.cpp             | 203 +++++++++\n src/libcamera/framebuffer_allocator.cpp       | 215 +++++++++\n src/libcamera/include/pipeline_handler.h      |  13 +-\n src/libcamera/include/v4l2_videodevice.h      |  66 ++-\n src/libcamera/ipa_context_wrapper.cpp         |   8 +-\n src/libcamera/ipa_interface.cpp               |   7 +-\n src/libcamera/meson.build                     |   2 +\n src/libcamera/pipeline/ipu3/ipu3.cpp          | 277 +++++-------\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      | 192 ++++----\n src/libcamera/pipeline/uvcvideo.cpp           |  40 +-\n src/libcamera/pipeline/vimc.cpp               |  40 +-\n src/libcamera/pipeline_handler.cpp            |  75 ++-\n src/libcamera/request.cpp                     |  60 +--\n src/libcamera/stream.cpp                      | 248 +---------\n src/libcamera/v4l2_videodevice.cpp            | 426 ++++++++++++------\n src/qcam/main_window.cpp                      |  86 ++--\n src/qcam/main_window.h                        |   7 +-\n src/v4l2/v4l2_camera.cpp                      |  63 +--\n src/v4l2/v4l2_camera.h                        |  44 +-\n src/v4l2/v4l2_camera_proxy.cpp                |  46 +-\n src/v4l2/v4l2_camera_proxy.h                  |   2 +-\n src/v4l2/v4l2_compat_manager.cpp              |   2 +-\n test/camera/buffer_import.cpp                 | 382 ++++------------\n test/camera/capture.cpp                       |  48 +-\n test/camera/statemachine.cpp                  |  89 +---\n test/file-descriptor.cpp                      | 208 +++++++++\n test/ipa/ipa_wrappers_test.cpp                |  41 +-\n test/meson.build                              |   1 +\n test/v4l2_videodevice/buffer_sharing.cpp      |  34 +-\n test/v4l2_videodevice/capture_async.cpp       |  18 +-\n test/v4l2_videodevice/request_buffers.cpp     |  11 +-\n test/v4l2_videodevice/stream_on_off.cpp       |   6 +-\n test/v4l2_videodevice/v4l2_m2mdevice.cpp      |  40 +-\n test/v4l2_videodevice/v4l2_videodevice_test.h |   2 +-\n 51 files changed, 2101 insertions(+), 1959 deletions(-)\n create mode 100644 include/libcamera/file_descriptor.h\n create mode 100644 include/libcamera/framebuffer_allocator.h\n create mode 100644 src/libcamera/file_descriptor.cpp\n create mode 100644 src/libcamera/framebuffer_allocator.cpp\n create mode 100644 test/file-descriptor.cpp"}