{"id":21561,"url":"https://patchwork.libcamera.org/api/patches/21561/?format=json","web_url":"https://patchwork.libcamera.org/patch/21561/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20241009093919.391662-1-umang.jain@ideasonboard.com>","date":"2024-10-09T09:39:19","name":"[v2] libcamera: rkisp1: Clamp stream configuration to ISP limit on raw path","commit_ref":"3d0ca251e119936f7c21fc654659ba90ffc73d33","pull_url":null,"state":"accepted","archived":false,"hash":"813e59925dcc36d7267425547f730b561a617875","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21561/mbox/","series":[{"id":4673,"url":"https://patchwork.libcamera.org/api/series/4673/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4673","date":"2024-10-09T09:39:19","name":"[v2] libcamera: rkisp1: Clamp stream configuration to ISP limit on raw path","version":2,"mbox":"https://patchwork.libcamera.org/series/4673/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21561/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21561/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 428E6C32E0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Oct 2024 09:39:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4D5DC6536D;\n\tWed,  9 Oct 2024 11:39:29 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B03A96536A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Oct 2024 11:39:27 +0200 (CEST)","from umang.jain (unknown\n\t[IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 305D5594;\n\tWed,  9 Oct 2024 11:37:49 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"WmI4PdJA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1728466670;\n\tbh=sBPVDTQ30qKEKaqSjIY3/obaYT7+tiiFBmgdRl/S1EE=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=WmI4PdJARAmaV0qAbTGmxQfYKUfziHEg7Z8mpEqbjKoVBxUtH2R0nMhFYvxvoKM9V\n\t6xptIrroNlRrPi8HfR95LIBOxlq3nv7MgKnwh1sjFF6/oIS6qNK98LaX8zpbKIevjn\n\t7/lbTGZQ0lACa3OP2S56TdIaqaKmrLV19K0ZTCWE=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tStefan Klug <stefan.klug@ideasonboard.com>,\n\tUmang Jain <umang.jain@ideasonboard.com>","Subject":"[PATCH v2] libcamera: rkisp1: Clamp stream configuration to ISP\n\tlimit on raw path","Date":"Wed,  9 Oct 2024 15:09:19 +0530","Message-ID":"<20241009093919.391662-1-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.45.2","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Commit 761545407c76 (\"pipeline: rkisp1: Filter out sensor sizes not\nsupported by the pipeline\") introduced a mechanism to determine maximum\nsupported sensor resolution and filter out resolutions that cannot be\nsupported by the ISP.\n\nHowever, it missed to update the raw stream configuration path, where\nit should have clamped the raw stream configuration size to the maximum\nsensor supported resolution.\n\nThis patch fixes the above issue and can be confirmed with IMX283\non i.MX8MP:\n\nFrom:\n($) cam -c1 -srole=raw,width=5472,height=3072\nINFO Camera camera.cpp:1197 configuring streams: (0) 5472x3648-SRGGB12\nERROR RkISP1 rkisp1_path.cpp:425 Unable to configure capture in 5472x3648-SRGGB12\nFailed to configure camera\nFailed to start camera session\n\nTo:\n($) cam -c1 -srole=raw,width=5472,height=3072\nINFO Camera camera.cpp:1197 configuring streams: (0) 4096x3072-SRGGB12\ncam0: Capture until user interrupts by SIGINT\n536.082380 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 25165824\n536.182378 (10.00 fps) cam0-stream0 seq: 000001 bytesused: 25165824\n536.282375 (10.00 fps) cam0-stream0 seq: 000002 bytesused: 25165824\n...\n\nFixes: 761545407c76 (\"pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline\")\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\nChanges in v2:\n- Extend the comment on what 'resolution' var is and denote that\n  sensor->getFormat() will never return something greter than\n 'resolution'\n---\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 8 +++++++-\n 1 file changed, 7 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex 3b5bea96..1999094e 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -326,9 +326,15 @@ RkISP1Path::validate(const CameraSensor *sensor,\n \tif (isRaw) {\n \t\t/*\n \t\t * Use the sensor output size closest to the requested stream\n-\t\t * size.\n+\t\t * size while ensuring the output size doesn't exceed ISP limits.\n+\t\t *\n+\t\t * As 'resolution' is the largest sensor resolution\n+\t\t * supported by the ISP, CameraSensor::getFormat() will never\n+\t\t * return a V4L2SubdeviceFormat with a larger size.\n \t\t */\n \t\tuint32_t mbusCode = formatToMediaBus.at(cfg->pixelFormat);\n+\t\tcfg->size.boundTo(resolution);\n+\n \t\tSize rawSize = sensorConfig ? sensorConfig->outputSize\n \t\t\t\t\t    : cfg->size;\n \n","prefixes":["v2"]}