From patchwork Thu Sep 2 04:22:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13596 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id DD00ABDC71 for ; Thu, 2 Sep 2021 04:23:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 24F6969170; Thu, 2 Sep 2021 06:23:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="N0BiOWUa"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D4D960503 for ; Thu, 2 Sep 2021 06:23:23 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9E6DA45E; Thu, 2 Sep 2021 06:23:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1630556602; bh=lYELlp6iuNX7sxL7l7C117ol1MoJZLImC+l1KHfBhWA=; h=From:To:Cc:Subject:Date:From; b=N0BiOWUa8/FJBeVh6KHk+TvSmevaqEXDr/oikCif12Xe/sL37XCRVT9uXRhSFx1Aj dOaUbNMRD3XU4/0j5UNZazJgmNXeThfPiSH68HeXjo6mS2GMwaGhIpZqd8rQRc7Ohb 2Fl02/sqhyiF4rjwi7pGWrKfPVuEHf5HnvEPMg1w= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Thu, 2 Sep 2021 07:22:51 +0300 Message-Id: <20210902042303.2254-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v1 00/12] libcamera: Handle fallout of FrameBuffer offset support 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hello everybody, This patch series started as an investigation of a qcam failure with IPU3 after the merge of the FrameBuffer offset support. While a hack in qcam would be possible, I decided to instead address the core issue and fix it in V4L2VideoDevice. The series only covers the changes needed in the libcamera core. qcam is still broken, and this actually introduces a breakage with cam as well. I wouldn't be surprised if the adaptation layers (Android, GStreamer and V4L2) were also broken somehow by this series when the camera produces multi-planar formats. I will address that as a next step, but I'd like feedback on the changes in the core first as they will have an impact on the applications and adaptation layers. The most important change is in patches 10/12 and 11/12, which translate between V4L2 buffers and libcamera FrameBuffer to handle the case where a multi-planar frame buffer is used with the V4L2 single-planar API. It's working more or less by chance at the moment (except in qcam where it's broken, and possibly in other places I haven't tested). Patches 01/12 to 09/12 are cleanups and additions to prepare for the work in V4L2VideoDevice, and patch 12/12 is a small cleanup on top. This series doesn't break any unit test, as vimc doesn't support NV12. Addition of NV12 support to the vimc kernel driver would be very nice, in order to test multi-planar support in our unit tests. Volunteers are welcome ;-) Laurent Pinchart (12): libcamera: base: utils: Use size_t for index in utils::enumerate() libcamera: file_descriptor: Add a function to retrieve the inode libcamera: formats: Add planeSize() helpers to PixelFormatInfo libcamera: formats: Support V4L2 non-contiguous formats libcamera: framebuffer: Move planes check to constructor libcamera: framebuffer: Add a function to check if planes are contiguous libcamera: framebuffer: Allocate metadata planes at construction time libcamera: framebuffer: Prevent modifying the number of metadata planes libcamera: v4l2_videodevice: Cache PixelFormatInfo libcamera: v4l2_videodevice: Coalesce planes when queuing buffer libcamera: v4l2_videodevice: Split planes when dequeuing buffer libcamera: v4l2_videodevice: Use utils::enumerate() include/libcamera/base/utils.h | 4 +- include/libcamera/file_descriptor.h | 3 + include/libcamera/framebuffer.h | 19 +- include/libcamera/internal/formats.h | 6 +- include/libcamera/internal/framebuffer.h | 2 + include/libcamera/internal/v4l2_videodevice.h | 1 + src/android/mm/generic_camera_buffer.cpp | 11 +- src/android/yuv/post_processor_yuv.cpp | 10 +- src/cam/camera_session.cpp | 4 +- src/cam/file_sink.cpp | 2 +- src/libcamera/file_descriptor.cpp | 22 ++ src/libcamera/formats.cpp | 223 ++++++++++++------ src/libcamera/framebuffer.cpp | 60 ++++- src/libcamera/pipeline/ipu3/cio2.cpp | 2 +- src/libcamera/v4l2_pixelformat.cpp | 11 +- src/libcamera/v4l2_videodevice.cpp | 148 +++++++++--- src/qcam/main_window.cpp | 2 +- src/qcam/viewfinder_gl.cpp | 2 +- src/qcam/viewfinder_qt.cpp | 2 +- src/v4l2/v4l2_camera_proxy.cpp | 8 +- test/utils.cpp | 10 +- 21 files changed, 402 insertions(+), 150 deletions(-) Reviewed-by: Kieran Bingham Reviewed-by: Kieran Bingham Reviewed-by: Kieran Bingham Reviewed-by: Kieran Bingham Reviewed-by: Kieran Bingham Reviewed-by: Hirokazu Honda Reviewed-by: Hirokazu Honda Reviewed-by: Hirokazu Honda Reviewed-by: Hirokazu Honda Reviewed-by: Hirokazu Honda