{"id":19621,"url":"https://patchwork.libcamera.org/api/1.1/patches/19621/?format=json","web_url":"https://patchwork.libcamera.org/patch/19621/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240301212121.9072-31-laurent.pinchart@ideasonboard.com>","date":"2024-03-01T21:21:19","name":"[PATCH/RFC,30/32] pipeline: raspberrypi: vc4: Fix configuration of the embedded data node","commit_ref":null,"pull_url":null,"state":"rfc","archived":false,"hash":"8e439b06cfcec32440911f8d261a109b6c2f40b6","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19621/mbox/","series":[{"id":4197,"url":"https://patchwork.libcamera.org/api/1.1/series/4197/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4197","date":"2024-03-01T21:20:49","name":"libcamera: Support the upstream Unicam driver","version":1,"mbox":"https://patchwork.libcamera.org/series/4197/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19621/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19621/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id CD625BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  1 Mar 2024 21:22:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8AC9062C94;\n\tFri,  1 Mar 2024 22:22:05 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9AE1262C95\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 Mar 2024 22:22:03 +0100 (CET)","from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi\n\t[89.27.53.110])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 22A713AC3;\n\tFri,  1 Mar 2024 22:21:49 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"f/tl4/OZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1709328109;\n\tbh=YSMuEhlQbv/mbS4xuvgyxPFDndM/NDOaJQLd/+dyulI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=f/tl4/OZWyxEdr0KcmhlIClcqeMYfdN+8uSizZo8p3aMRskgbJKeVBxQN+eIrK68r\n\tR2XVgCt9s0KQEd39Od+8n0kK/UK38P4t0ooejI4NtMzSVVJxsuNLrkk9pZEdxcimUl\n\tC9b0KS+6Tm9ePmhHD0i0oalM184PVZW0pOQBgJaQ=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH/RFC 30/32] pipeline: raspberrypi: vc4: Fix configuration of\n\tthe embedded data node","Date":"Fri,  1 Mar 2024 23:21:19 +0200","Message-ID":"<20240301212121.9072-31-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20240301212121.9072-1-laurent.pinchart@ideasonboard.com>","References":"<20240301212121.9072-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"Sakari Ailus <sakari.ailus@iki.fi>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The Unicam embedded data video device suffers from two issues with the\nupstream driver:\n\n- The driver uses the generic metadata V4L2_META_FMT_GENERIC_* formats,\n  instead of the downstream V4L2_META_FMT_SENSOR_DATA.\n\n- The driver requires the width and height of the embedded data stream\n  to be configured.\n\nFix them both.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/rpi/vc4/vc4.cpp | 19 +++++++++++++++++--\n 1 file changed, 17 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\nindex 81e0bc1b8f7a..2ff9b708d021 100644\n--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n@@ -624,10 +624,25 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi\n \t * supports it.\n \t */\n \tif (sensorMetadata_) {\n+\t\tstatic const std::map<uint32_t, V4L2PixelFormat> metaFormats{\n+\t\t\t{ MEDIA_BUS_FMT_META_8, V4L2PixelFormat(V4L2_META_FMT_GENERIC_8) },\n+\t\t\t{ MEDIA_BUS_FMT_META_10, V4L2PixelFormat(V4L2_META_FMT_GENERIC_CSI2_10) },\n+\t\t\t{ MEDIA_BUS_FMT_META_12, V4L2PixelFormat(V4L2_META_FMT_GENERIC_CSI2_12) },\n+\t\t\t{ MEDIA_BUS_FMT_META_14, V4L2PixelFormat(V4L2_META_FMT_GENERIC_CSI2_14) },\n+\t\t};\n+\n \t\tV4L2SubdeviceFormat embeddedFormat = sensor_->embeddedDataFormat();\n+\t\tconst auto metaFormat = metaFormats.find(embeddedFormat.code);\n+\t\tif (metaFormat == metaFormats.end()) {\n+\t\t\tLOG(RPI, Error)\n+\t\t\t\t<< \"Unsupported metadata format \"\n+\t\t\t\t<< utils::hex(embeddedFormat.code, 4);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n \t\tV4L2DeviceFormat format{};\n-\t\tformat.fourcc = V4L2PixelFormat(V4L2_META_FMT_SENSOR_DATA);\n-\t\tformat.planes[0].size = embeddedFormat.size.width * embeddedFormat.size.height;\n+\t\tformat.fourcc = metaFormat->second;\n+\t\tformat.size = embeddedFormat.size;\n \n \t\tLOG(RPI, Debug) << \"Setting embedded data format \" << format;\n \t\tret = unicam_[Unicam::Embedded].dev()->setFormat(&format);\n","prefixes":["PATCH/RFC","30/32"]}