From patchwork Sat Jul 13 17:23:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1681 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CD42160C23 for ; Sat, 13 Jul 2019 19:24:24 +0200 (CEST) Received: from pendragon.ideasonboard.com (softbank126209254147.bbtec.net [126.209.254.147]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 624982B2 for ; Sat, 13 Jul 2019 19:24:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1563038664; bh=xLpeTP6D8eEw5SUutoTcdaumrmewP84AveS6Zfs7vks=; h=From:To:Subject:Date:From; b=tF7Lbpw3BaAsQ4oKSMAorOsFxXDNcmY43UFhnWFmgmGU/6glhRwJRwDQQbJcOpG9F BFkuCeSCWvEgagGfesi0AVd631CBlcxpTqZ6GyqBfA2HN5WZROt535LXuDzmKGN6rB FvrQxu6LxFlj8Rq0T/P1VjU5z5dv2t4guQZa8mNc= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 13 Jul 2019 20:23:35 +0300 Message-Id: <20190713172351.25452-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 00/16] Add support for external buffers 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: Sat, 13 Jul 2019 17:24:25 -0000 a.k.a. Cover letter at 2:00am after a long code camp Hello everybody, This patch series adds buffer import to libcamera. This is the result of lots of back-and-forth face-to-face work between Jacopo and me, and should get close to upstreamable state. After having worked and reworked the code for way too long, I believe we'll need another rework of the API on top of this series to more clearly separate the different concepts into different objects. For the time being, this should allow us to import buffers from the Android camera HAL, and goes (in my opinion at least in the right direction). Summarizing the series here is difficult as it interleaves fixes and reworks that may appear semi-random with patches that implement the core of buffer importing. The first large change is patch 06/16 that reworks the Buffer class extensively and splits it in two. Patch 11/16 and 12/16 prepare for buffer import by extending the application-facing API of the related classes, and patches 14/16 and 15/16 implementing the remaining part of buffer importing. Finally patch 16/16 adds a buffer import test. Jacopo Mondi (6): libcamera: stream: Shorten access to the bufferPool libcamera: stream: Add Stream memory type libcamera: buffer: Add dmabuf file descriptors libcamera: stream: Map external buffers to indexes libcamera: pipeline: Support importing buffers test: camera: Add buffer import and mapping test Laurent Pinchart (10): libcamera: camera: Don't move buffers away from request at completion libcamera: camera: Don't check buffer count before freeing buffers libcamera: pipeline_handler: Simplify request completion libcamera: request: Add cookie to make request tracking easier libcamera: v4l2_videodevice: Add helper to queue all buffers libcamera: buffer: Split memory information to BufferMemory libcamera: v4l2_videodevice: Signal buffer completion at streamoff time libcamera: pipeline: ipu3: Use stream configuration to get buffers count libcamera: Stop using Stream::bufferPool to get the number of buffers libcamera: buffer: Add an accessor to the BufferMemory include/libcamera/buffer.h | 63 ++-- include/libcamera/camera.h | 3 +- include/libcamera/request.h | 12 +- include/libcamera/stream.h | 23 ++ src/cam/buffer_writer.cpp | 6 +- src/cam/capture.cpp | 38 +- src/libcamera/buffer.cpp | 177 +++++++--- src/libcamera/camera.cpp | 42 ++- src/libcamera/include/pipeline_handler.h | 2 +- src/libcamera/include/v4l2_videodevice.h | 9 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 78 +++-- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +- src/libcamera/pipeline/uvcvideo.cpp | 8 +- src/libcamera/pipeline/vimc.cpp | 8 +- src/libcamera/pipeline_handler.cpp | 49 +-- src/libcamera/request.cpp | 70 +++- src/libcamera/stream.cpp | 234 ++++++++++++- src/libcamera/v4l2_videodevice.cpp | 109 ++++-- src/qcam/main_window.cpp | 36 +- test/camera/buffer_import.cpp | 425 +++++++++++++++++++++++ test/camera/capture.cpp | 20 +- test/camera/meson.build | 1 + test/camera/statemachine.cpp | 6 +- test/v4l2_videodevice/buffer_sharing.cpp | 14 +- test/v4l2_videodevice/capture_async.cpp | 8 +- 25 files changed, 1201 insertions(+), 252 deletions(-) create mode 100644 test/camera/buffer_import.cpp