From patchwork Thu Mar 26 22:58:37 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: 3344 Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0C45D60412 for ; Thu, 26 Mar 2020 23:58:57 +0100 (CET) X-Halon-ID: 57e1b053-6fb5-11ea-aeed-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de [79.202.35.146]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id 57e1b053-6fb5-11ea-aeed-005056917f90; Thu, 26 Mar 2020 23:58:54 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Thu, 26 Mar 2020 23:58:37 +0100 Message-Id: <20200326225844.4117712-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 0/7] libcamera: Add support for a RAW still capture 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: Thu, 26 Mar 2020 22:58:58 -0000 Hi, This series adds RAW capture support. It implements a RAW stream in the IPU3 pipeline handler as an example. It targets RAW still image captures and uses a memcpy to copy out the buffer with the RAW data as soon as it's dequeued from the CIO2. The copy is needed as the buffer might need to be used in further processing by the IMGU. Patch 1/7 Defines a new StillCaptureRaw role which can be used to applications to generate configurations for raw capture. Patch 2/7 makes use of this new role in the cam utility. Patch 3/7 adds the preliminary DRM formats for IPU3 RAW pixel formats. Patch 4/7 adds a helper to do the actual memcpy of FrameBuffers. Patch 5/7 adds a way for pipelines to set a FrameBuffer Request *. Patch 6/7 and 7/7 deals with implementing the RAW stream into the IPU3 pipeline handler. I have tested this on IPU3 and I can capture both a single RAW stream or a mix of RAW and video, example with both and writing to disk. $ ./cam -c1 -s role=video -s role=stillraw -C -F ... fps: 0.00 stream0 seq: 002055 bytesused: 1382400 stream1 seq: 000001 bytesused: 3269376 fps: 30.30 stream0 seq: 002056 bytesused: 1382400 stream1 seq: 000002 bytesused: 3269376 fps: 30.30 stream0 seq: 002057 bytesused: 1382400 stream1 seq: 000003 bytesused: 3269376 fps: 30.30 stream0 seq: 002058 bytesused: 1382400 stream1 seq: 000004 bytesused: 3269376 ... I have also verified the content of the captured RAW frames have the expected content. Niklas Söderlund (7): libcamera: stream: Add StillCaptureRaw role cam: Add option to capture StillCaptureRaw stream include: drm_fourcc: Add Bayer FourCC and modifiers libcamera: FrameBuffer: Add a method to copy buffer content libcamera: FrameBuffer: Add a setRequest() interface libcamera: ipu3: Do not unconditionally queue buffers to CIO2 libcamera: ipu3: Add support for a RAW still capture stream include/libcamera/buffer.h | 4 +- include/libcamera/stream.h | 1 + include/linux/drm_fourcc.h | 94 +++++++++++++++ src/cam/main.cpp | 4 +- src/libcamera/buffer.cpp | 79 +++++++++++++ src/libcamera/pipeline/ipu3/ipu3.cpp | 164 +++++++++++++++++++++++---- src/libcamera/stream.cpp | 3 + 7 files changed, 326 insertions(+), 23 deletions(-)