From patchwork Wed Oct 9 09:39:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 21561 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 428E6C32E0 for ; Wed, 9 Oct 2024 09:39:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4D5DC6536D; Wed, 9 Oct 2024 11:39:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WmI4PdJA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B03A96536A for ; Wed, 9 Oct 2024 11:39:27 +0200 (CEST) Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 305D5594; Wed, 9 Oct 2024 11:37:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728466670; bh=sBPVDTQ30qKEKaqSjIY3/obaYT7+tiiFBmgdRl/S1EE=; h=From:To:Cc:Subject:Date:From; b=WmI4PdJARAmaV0qAbTGmxQfYKUfziHEg7Z8mpEqbjKoVBxUtH2R0nMhFYvxvoKM9V 6xptIrroNlRrPi8HfR95LIBOxlq3nv7MgKnwh1sjFF6/oIS6qNK98LaX8zpbKIevjn 7/lbTGZQ0lACa3OP2S56TdIaqaKmrLV19K0ZTCWE= From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi , Kieran Bingham , Stefan Klug , Umang Jain Subject: [PATCH v2] libcamera: rkisp1: Clamp stream configuration to ISP limit 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 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" Commit 761545407c76 ("pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline") introduced a mechanism to determine maximum supported sensor resolution and filter out resolutions that cannot be supported by the ISP. However, it missed to update the raw stream configuration path, where it should have clamped the raw stream configuration size to the maximum sensor supported resolution. This patch fixes the above issue and can be confirmed with IMX283 on i.MX8MP: From: ($) cam -c1 -srole=raw,width=5472,height=3072 INFO Camera camera.cpp:1197 configuring streams: (0) 5472x3648-SRGGB12 ERROR RkISP1 rkisp1_path.cpp:425 Unable to configure capture in 5472x3648-SRGGB12 Failed to configure camera Failed to start camera session To: ($) cam -c1 -srole=raw,width=5472,height=3072 INFO Camera camera.cpp:1197 configuring streams: (0) 4096x3072-SRGGB12 cam0: Capture until user interrupts by SIGINT 536.082380 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 25165824 536.182378 (10.00 fps) cam0-stream0 seq: 000001 bytesused: 25165824 536.282375 (10.00 fps) cam0-stream0 seq: 000002 bytesused: 25165824 ... Fixes: 761545407c76 ("pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline") Signed-off-by: Umang Jain Reviewed-by: Jacopo Mondi Reviewed-by: Stefan Klug Reviewed-by: Kieran Bingham --- Changes in v2: - Extend the comment on what 'resolution' var is and denote that sensor->getFormat() will never return something greter than 'resolution' --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 3b5bea96..1999094e 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -326,9 +326,15 @@ RkISP1Path::validate(const CameraSensor *sensor, if (isRaw) { /* * Use the sensor output size closest to the requested stream - * size. + * size while ensuring the output size doesn't exceed ISP limits. + * + * As 'resolution' is the largest sensor resolution + * supported by the ISP, CameraSensor::getFormat() will never + * return a V4L2SubdeviceFormat with a larger size. */ uint32_t mbusCode = formatToMediaBus.at(cfg->pixelFormat); + cfg->size.boundTo(resolution); + Size rawSize = sensorConfig ? sensorConfig->outputSize : cfg->size;