{"id":2450,"url":"https://patchwork.libcamera.org/api/1.1/covers/2450/?format=json","web_url":"https://patchwork.libcamera.org/cover/2450/","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":"<20191230120510.938333-1-niklas.soderlund@ragnatech.se>","date":"2019-12-30T12:04:45","name":"[libcamera-devel,v2,00/25] 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/2450/mbox/","series":[{"id":593,"url":"https://patchwork.libcamera.org/api/1.1/series/593/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=593","date":"2019-12-30T12:04:45","name":"libcamera: Rework buffer API","version":2,"mbox":"https://patchwork.libcamera.org/series/593/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/2450/comments/","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EED886046A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Dec 2019 13:05:49 +0100 (CET)","from bismarck.berto.se (p4fca2fd0.dip0.t-ipconnect.de\n\t[79.202.47.208]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid aeace4d3-2afc-11ea-a00b-005056917a89;\n\tMon, 30 Dec 2019 13:05:48 +0100 (CET)"],"X-Halon-ID":"aeace4d3-2afc-11ea-a00b-005056917a89","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":"Mon, 30 Dec 2019 13:04:45 +0100","Message-Id":"<20191230120510.938333-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 v2 00/25] 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":"Mon, 30 Dec 2019 12:05:50 -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 quiet large and some patches are also quiet 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 12/25, 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 21/25 where the Buffer API is completely removed.\n\nThe series is quiet heavily rewritten since v1 and as I processed the \nreview comments things got moved around. I hope I have not missed \nanything when processing the review comments and tracking changes in \neach patch individual changelong. I'm sure I did anyhow and if so I \nwould like to apologize in advance as I know v1 was painful to review.\n\nThe series depends on '[PATCH v2 0/3] libcamera: Add FileDescriptor to \nhelp pass numerical fds around'.\n\nNiklas Söderlund (25):\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: pipelines: 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  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                    | 109 ++---\n include/libcamera/camera.h                    |  13 +-\n include/libcamera/framebuffer_allocator.h     |  47 ++\n include/libcamera/meson.build                 |   1 +\n include/libcamera/request.h                   |  14 +-\n include/libcamera/stream.h                    |  23 -\n src/android/camera_device.cpp                 |  41 +-\n src/cam/buffer_writer.cpp                     |  15 +-\n src/cam/buffer_writer.h                       |   3 +-\n src/cam/capture.cpp                           |  61 +--\n src/cam/capture.h                             |   5 +-\n src/ipa/libipa/ipa_interface_wrapper.cpp      |   9 +-\n src/ipa/rkisp1/rkisp1.cpp                     |  30 +-\n src/libcamera/buffer.cpp                      | 403 +++++-------------\n src/libcamera/camera.cpp                      | 170 +++-----\n src/libcamera/framebuffer_allocator.cpp       | 213 +++++++++\n src/libcamera/include/pipeline_handler.h      |  15 +-\n src/libcamera/include/v4l2_videodevice.h      |  78 +++-\n src/libcamera/ipa_context_wrapper.cpp         |   8 +-\n src/libcamera/ipa_interface.cpp               |   7 +-\n src/libcamera/meson.build                     |   1 +\n src/libcamera/pipeline/ipu3/ipu3.cpp          | 275 ++++++------\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      | 178 ++++----\n src/libcamera/pipeline/uvcvideo.cpp           |  42 +-\n src/libcamera/pipeline/vimc.cpp               |  42 +-\n src/libcamera/pipeline_handler.cpp            |  65 ++-\n src/libcamera/request.cpp                     |  37 +-\n src/libcamera/stream.cpp                      | 248 +----------\n src/libcamera/v4l2_videodevice.cpp            | 381 ++++++++++-------\n src/qcam/main_window.cpp                      |  86 ++--\n src/qcam/main_window.h                        |   7 +-\n test/camera/buffer_import.cpp                 | 383 +++++------------\n test/camera/capture.cpp                       |  48 +--\n test/camera/statemachine.cpp                  |  89 +---\n test/ipa/ipa_wrappers_test.cpp                |  41 +-\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 42 files changed, 1465 insertions(+), 1836 deletions(-)\n create mode 100644 include/libcamera/framebuffer_allocator.h\n create mode 100644 src/libcamera/framebuffer_allocator.cpp"}