From patchwork Tue Apr 9 19:25:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 955 Return-Path: Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AD56A60004 for ; Tue, 9 Apr 2019 21:25:05 +0200 (CEST) Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 2DCC120000B; Tue, 9 Apr 2019 19:25:05 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 9 Apr 2019 21:25:36 +0200 Message-Id: <20190409192548.20325-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 00/12] libcamera: ipu3: Multiple streams support X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2019 19:25:05 -0000 Hello, 4th version of multiple stream support for IPU3 platform. Quite a few changes from v3: - Rebase on latest master, including StreamUsages - Improved streamConfiguration to support more (but not all :P) use cases - Introduced a sub-class of Stream for IPU3, and make the stream selection logic use that sub-class during configuration, memory allocation and request queueing - Changed most of the patches touching the library to include Niklas' and Laurent's comments - replace 'request from buffer' with "buffer: Store Request reference in Buffer" - refuse empty requests not to mess up pipeline handler - expose the Stream's 'stream to buffer' map instead of exposing 'Stream *' and save a few iterations on the request's map - Changed request completion handling on IPU3 to complete requests in order - I'm not sure if I missed this in v3, but it was there in v2: the output device node should be queued with buffers otherwise the IPU3 stalls. Use the internal pool or the stream's pool to grab a free buffer and queue buffers to 'output' even if it is not part of the capture request Open points: - allocation failures handling: see email thread - buffer queuing to ImgU's output: I'm not too proud of that part and I'm sure it could be improved. As a bonus 12/12 is a sketched patch that captures from still image output every 10 viewfinder frames. Its purpose it mostly to demonstrate how applications could associate streams to their assigned roles. Tested with several combinations with the 'cam' testing app (sorry for the place holder variables, this comes from my testing scripts) src/cam/cam -c "$SDEV" -C -s role=still,width=$W,height=$H -s role=viewfinder,width=640,height=480 --file=/tmp/frame-# src/cam/cam -c "$SDEV" -C -s role=still,width=$W,height=$H -s role=video,width=640,height=480 --file=/tmp/frame-# src/cam/cam -c "$SDEV" -C -s role=still,width=$W,height=$H --file=/tmp/frame-# src/cam/cam -c "$SDEV" -C -s role=viewfinder,width=640,height=480 --file=/tmp/frame-# I had hoped for a much slimmer change-log, and I'm afraid another few iterations will be required. Any further testing is appreciated. Thanks j Jacopo Mondi (12): libcamera: ipu3: Sub-class Stream with IPU3Stream libcamera: ipu3: Create camera with 2 streams libcamera: camera: allocateBuffers: Pass the stream set libcamera: ipu3: Add multiple stream memory management libcamera: request: Expose the Stream to Buffers map libcamera: ipu3: Queue requests for multiple streams libcamera: request: Add empty() method libcamera: camera: Refuse empty requests libcamera: buffer: Store Request reference in Buffer libcamera: ipu3: Connect viewfinder's BufferReady signal libcamera: ipu3: Use roles in stream configuration [HACK] still capture every 10 frames include/libcamera/buffer.h | 5 + include/libcamera/request.h | 4 + include/libcamera/stream.h | 4 +- src/cam/main.cpp | 46 ++- src/libcamera/buffer.cpp | 39 ++- src/libcamera/camera.cpp | 21 +- src/libcamera/include/pipeline_handler.h | 6 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 426 +++++++++++++++++------ src/libcamera/pipeline/uvcvideo.cpp | 13 +- src/libcamera/pipeline/vimc.cpp | 13 +- src/libcamera/pipeline_handler.cpp | 11 +- src/libcamera/request.cpp | 25 +- 12 files changed, 483 insertions(+), 130 deletions(-) --- 2.21.0