From patchwork Fri Oct 23 10:58:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 28594 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 44784C324C for ; Fri, 23 Oct 2026 11:00:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EB0F168FF0; Fri, 23 Oct 2026 13:00:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Il3N43cN"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 00F2668FD3 for ; Fri, 23 Oct 2026 13:00:52 +0200 (CEST) Received: from mail.ideasonboard.com (unknown [IPv6:2401:4900:1c30:59f6:be2b:2877:6bc4:392]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CBBE24E46; Fri, 23 Oct 2026 12:58:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1792753123; bh=3pp1jCtegNZZJe9WezSIxD6zTYQj2CLaA7fGES0u5K0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Il3N43cN5lm59UET9C7YzDImOfDXYuctdHwxyChSlujHwOV1/TeBo7So1sOHxJLjE ussF+vrOk6IxwsVnDl0VK1QlN2Uyahr4XXi4T/UF2Iwuh/+uFZk8vWoRzuCZklleyi zPwefdKbIy6S3B24mCTdl1I0g4G5ziGUO9zOTl1A= From: Jai Luthra Date: Fri, 23 Oct 2026 16:28:32 +0530 Subject: [PATCH WIP RFC 24/26] pipeline: rpi: vc4: Migrate to generic RAW formats MIME-Version: 1.0 Message-Id: <20261023-b4-raw-model-v1-24-eadb9948901b@ideasonboard.com> References: <20261023-b4-raw-model-v1-0-eadb9948901b@ideasonboard.com> In-Reply-To: <20261023-b4-raw-model-v1-0-eadb9948901b@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Laurent Pinchart , Kieran Bingham , Sakari Ailus , Naushir Patuck , Jai Luthra X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2415; i=jai.luthra@ideasonboard.com; h=from:subject:message-id; bh=3pp1jCtegNZZJe9WezSIxD6zTYQj2CLaA7fGES0u5K0=; b=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBq2z3a0nzGWCS3RN0X3UntTIsjs31GCNnXa8ayH ZqgpDsjBz6JAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCats92gAKCRBD3pH5JJpx RX+8D/0YOnzJG5Rh1LmziZ6NS2ameAkHx8G+10K/CRZt9VKvgRKv1cBYMr1UsTF0L0jXQUxHbqX hK4uMI4M3Sccis0EYpDtEeOcA2/iCHNZUOvC9ad/vJiNVPPRj4k15uHrTrZX9DayjFwQHYWUq8W HDP0WF+6kB7QIa6+xEzqbrBVaJk2GgAW+yHPn/fi9rhdvJF3U4XhgKdUzHh6PcLkS2EjJk1JgQW CRgyLjapgg/j2XjFPB+xEYkMqaqhbiMSUOcnJpRwsHNP8ha5a1Mfq5MrdepaCt1LwIVLdcnLdrQ sXAmYjsWpVPPpjgTc9NAE36NIZTId56Ap8QU+AEm1L0pzND1xHbUvq0O0Rd2X2qRGIbeH1bgzLl VDFcG5l5aMAEVbNPaD8FBn+7qtLa9CqMfS5BgaPJej3zJInkane1SlQDweKCFj0KVOokgs6MztH DveNc8GYCjpWHU3Mp23EXo82k8LBR/f7TmbqyZdO6aoXEGbCz3sA6fQT0KtrORuf0SVQKbJcChB KCbnO5HNbcSdYD3Si5I0HCQERizkL3owIO6VBXX5YACIY/xubOY9W03zH6MQ86ZlkhVyGoLOOuS H3cfMXHyGDVrpyiwF9TgwL40ec0KIjb1eutVgJAUbzcbQw7u3pp4+yAP42GNSp0Q33ylQh0zd15 WbE5NQv+x2zbCqg== X-Developer-Key: i=jai.luthra@ideasonboard.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 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" Unicam supports both the new media bus codes and fourcc values. VC4 ISP unfortunately uses fourcc values to talk to the firmware, so we instead convert the new generic fourcc to the legacy (bayer-order specific) values before configuring it. Signed-off-by: Jai Luthra --- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index 3236cc70c6a4..efd393a5c4a6 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -15,6 +15,7 @@ #include "libcamera/internal/device_enumerator.h" #include "libcamera/internal/dma_buf_allocator.h" +#include "libcamera/internal/v4l2_pixelformat.h" #include "libcamera/internal/v4l2_subdevice.h" #include "../common/pipeline_base.h" @@ -622,6 +623,14 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi V4L2VideoDevice *unicam = unicam_[Unicam::Image].dev(); V4L2DeviceFormat unicamFormat; + /* + * The sensor bayer order is the order of the data arriving at the + * Unicam image input, as affected by any transform applied to the + * sensor. + */ + ColorFilterArray sensorBayerOrder = + sensor_->bayerOrder(rpiConfig->combinedTransform_); + /* * See which streams are requested, and route the user * StreamConfiguration appropriately. @@ -641,9 +650,13 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi if (ret) return ret; + V4L2DeviceFormat ispFormat = unicamFormat; + ispFormat.fourcc.toNonGeneric(sensorBayerOrder); + LOG(RPI, Info) << "Sensor: " << sensor_->id() << " - Selected sensor format: " << rpiConfig->sensorFormat_ - << " - Selected unicam format: " << unicamFormat; + << " - Selected unicam format: " << unicamFormat + << " - Selected ISP input format: " << ispFormat; /* * Configure the Unicam embedded data output format only if the sensor @@ -684,7 +697,7 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi * 3. Configure the ISP. */ - ret = isp_[Isp::Input].dev()->setFormat(&unicamFormat); + ret = isp_[Isp::Input].dev()->setFormat(&ispFormat); if (ret) return ret;