From patchwork Tue Jun 23 02:09:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 4127 Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8DF21603BD for ; Tue, 23 Jun 2020 04:09:43 +0200 (CEST) X-Halon-ID: 96de0ddc-b4f6-11ea-933e-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 96de0ddc-b4f6-11ea-933e-005056917a89; Tue, 23 Jun 2020 04:09:42 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 23 Jun 2020 04:09:20 +0200 Message-Id: <20200623020930.1781469-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 00/10] libcamera: ipu3: Allow zero-copy RAW stream X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2020 02:09:44 -0000 Hi, This series removes the need to copy the buffer when capturing RAW buffers from the IPU3 pipeline. This is made possible by allocating an internal queue of buffers in the pipeline handler which is used when the application does not provide an buffer for the RAW stream. There is on issue with this series. If the camera is configured to supply the application with more then one stream and one of them is a RAW stream. Then the sequence number of the RAW buffers in all requests are set to 0 before the request completes. This is due to that if two or more streams are used the RAW buffer is always queued to the ImgU input to serve as input to the vf and/or output buffers. When the RAW buffers is dequeued from the ImgU input device the kernel sets the sequence number to zero. This should either be solved in the kernel or by reworking how sequence numbers handled going out of libcamera, does it make sens to have seq numbers on the buffer level ? As the RPi pipeline handler already started using the copy approach we can not yet rename to role nor remove the copyFrom() helper. I aim to work on that once the approach taken in this series is agreed upon. Niklas Söderlund (10): libcamera: camera_sensor: Make mbusCodes() return a set libcamera: ipu3: Fold mediaBusToFormat() into only caller libcamera: ipu3: Breakout stream assignment to new function libcamera: ipu3: Calculate number of buffers for ImgU libcamera: ipu3: cio2: Move the CIO2Device class to separate files libcamera: ipu3: cio2: Consolidate information about formats libcamera: ipu3: cio2: Add function to generate configuration libcamera: ipu3: cio2: Make the V4L2 devices private libcamera: ipu3: cio2: Hide buffer allocation and freeing from users libcamera: ipu3: Allow zero-copy RAW stream capture include/libcamera/internal/camera_sensor.h | 4 +- include/libcamera/internal/formats.h | 2 +- src/libcamera/camera_sensor.cpp | 1 - src/libcamera/formats.cpp | 7 +- src/libcamera/pipeline/ipu3/cio2.cpp | 298 ++++++++++++ src/libcamera/pipeline/ipu3/cio2.h | 66 +++ src/libcamera/pipeline/ipu3/ipu3.cpp | 497 +++++---------------- src/libcamera/pipeline/ipu3/meson.build | 1 + test/camera-sensor.cpp | 2 +- 9 files changed, 475 insertions(+), 403 deletions(-) create mode 100644 src/libcamera/pipeline/ipu3/cio2.cpp create mode 100644 src/libcamera/pipeline/ipu3/cio2.h