From patchwork Thu Oct 2 08:09:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24547 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 DB255C324C for ; Thu, 2 Oct 2025 08:10:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id ED91A613AB; Thu, 2 Oct 2025 10:10:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="wR5WPxYA"; 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 04156613AB for ; Thu, 2 Oct 2025 10:09:57 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:1a1d:8219:5cfd:b9c0]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 2BA31BCA; Thu, 2 Oct 2025 10:08:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1759392508; bh=bw4o4BNrYMyICMAt0lzueuwOTmr6VWrmvWCg4+Ftv8A=; h=From:To:Cc:Subject:Date:From; b=wR5WPxYAhNxPB1DCo0P1mFa8VIlhNjbOV7Eezt8Wh0s8C36CRYTy6JC4+3PY/DUL8 ubymLQ2w43nKvRm1lubMDnuHu2v4FXvPOvH0TxGkYke1uoJo1AgjoW9cDLslB5hwsQ U5u6ZC3CV+sMNG2xeTGs27q57GiDpm5j86vG2hWg= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1] libcamera: sensor: Use V4L2_SEL_TGT_NATIVE_SIZE for PixelArraySize Date: Thu, 2 Oct 2025 10:09:22 +0200 Message-ID: <20251002080952.3077149-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 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" The PixelArraySize property is incorrectly deduced from V4L2_SEL_TGT_CROP_BOUNDS instead of V4L2_SEL_TGT_NATIVE_SIZE. This is sometimes the same value, but for newer sensor drivers V4L2_SEL_TGT_NATIVE_SIZE is often larger than crop bounds. Most sensor drivers already support V4L2_SEL_TGT_NATIVE_SIZE and for the ones that don't, the fallback to the largest supported size is acceptable. Signed-off-by: Stefan Klug --- Hi all, On the imx335 we had an issue that we got the following reports: PixelArrayActiveAreas: [ (36, 50)/2624x1944 ] PixelArraySize: (2624,1944) As you can see, the PixelArraySize doesn't hold the active area which must be the case according to https://www.libcamera.org/api-html/namespacelibcamera_1_1properties.html#acec5675f79b6c456aca72c7532a263a4 The native_size reported by the driver is [ (0, 0)/2696x2044 ] So I think this is the right thing to do :-) Best regards, Stefan --- src/libcamera/sensor/camera_sensor_legacy.cpp | 2 +- src/libcamera/sensor/camera_sensor_raw.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp index a84f084ceeeb..c0adc393950f 100644 --- a/src/libcamera/sensor/camera_sensor_legacy.cpp +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp @@ -399,7 +399,7 @@ int CameraSensorLegacy::validateSensorDriver() * test platforms have been updated. */ Rectangle rect; - int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &rect); + int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_NATIVE_SIZE, &rect); if (ret) { /* * Default the pixel array size to the largest size supported diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp index 759cccafe4a9..a975028a5e70 100644 --- a/src/libcamera/sensor/camera_sensor_raw.cpp +++ b/src/libcamera/sensor/camera_sensor_raw.cpp @@ -420,10 +420,10 @@ std::optional CameraSensorRaw::init() */ Rectangle rect; - ret = subdev_->getSelection(streams_.image.sink, V4L2_SEL_TGT_CROP_BOUNDS, + ret = subdev_->getSelection(streams_.image.sink, V4L2_SEL_TGT_NATIVE_SIZE, &rect); if (ret) { - LOG(CameraSensor, Error) << "No pixel array crop bounds"; + LOG(CameraSensor, Error) << "No pixel array native size"; return { ret }; }