{"id":24547,"url":"https://patchwork.libcamera.org/api/patches/24547/?format=json","web_url":"https://patchwork.libcamera.org/patch/24547/","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":"<20251002080952.3077149-1-stefan.klug@ideasonboard.com>","date":"2025-10-02T08:09:22","name":"[v1] libcamera: sensor: Use V4L2_SEL_TGT_NATIVE_SIZE for PixelArraySize","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"93fd255e45e0f2f5d5a5e17695582553496642e0","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24547/mbox/","series":[{"id":5473,"url":"https://patchwork.libcamera.org/api/series/5473/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5473","date":"2025-10-02T08:09:22","name":"[v1] libcamera: sensor: Use V4L2_SEL_TGT_NATIVE_SIZE for PixelArraySize","version":1,"mbox":"https://patchwork.libcamera.org/series/5473/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24547/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24547/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 DB255C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Oct 2025 08:10:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED91A613AB;\n\tThu,  2 Oct 2025 10:10:00 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 04156613AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Oct 2025 10:09:57 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:1a1d:8219:5cfd:b9c0])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 2BA31BCA;\n\tThu,  2 Oct 2025 10:08:28 +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=\"wR5WPxYA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759392508;\n\tbh=bw4o4BNrYMyICMAt0lzueuwOTmr6VWrmvWCg4+Ftv8A=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=wR5WPxYAhNxPB1DCo0P1mFa8VIlhNjbOV7Eezt8Wh0s8C36CRYTy6JC4+3PY/DUL8\n\tubymLQ2w43nKvRm1lubMDnuHu2v4FXvPOvH0TxGkYke1uoJo1AgjoW9cDLslB5hwsQ\n\tU5u6ZC3CV+sMNG2xeTGs27q57GiDpm5j86vG2hWg=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v1] libcamera: sensor: Use V4L2_SEL_TGT_NATIVE_SIZE for\n\tPixelArraySize","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","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":"The PixelArraySize property is incorrectly deduced from\nV4L2_SEL_TGT_CROP_BOUNDS instead of V4L2_SEL_TGT_NATIVE_SIZE. This is\nsometimes the same value, but for newer sensor drivers\nV4L2_SEL_TGT_NATIVE_SIZE is often larger than crop bounds. Most sensor\ndrivers already support V4L2_SEL_TGT_NATIVE_SIZE and for the ones that\ndon't, the fallback to the largest supported size is acceptable.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n\nHi all,\n\nOn the imx335 we had an issue that we got the following reports:\nPixelArrayActiveAreas: [ (36, 50)/2624x1944 ]\nPixelArraySize: (2624,1944)\n\nAs you can see, the PixelArraySize doesn't hold the active area which\nmust be the case according to https://www.libcamera.org/api-html/namespacelibcamera_1_1properties.html#acec5675f79b6c456aca72c7532a263a4\n\nThe native_size reported by the driver is [ (0, 0)/2696x2044 ]\n\nSo I think this is the right thing to do :-)\n\nBest regards,\nStefan\n\n\n---\n src/libcamera/sensor/camera_sensor_legacy.cpp | 2 +-\n src/libcamera/sensor/camera_sensor_raw.cpp    | 4 ++--\n 2 files changed, 3 insertions(+), 3 deletions(-)","diff":"diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp\nindex a84f084ceeeb..c0adc393950f 100644\n--- a/src/libcamera/sensor/camera_sensor_legacy.cpp\n+++ b/src/libcamera/sensor/camera_sensor_legacy.cpp\n@@ -399,7 +399,7 @@ int CameraSensorLegacy::validateSensorDriver()\n \t * test platforms have been updated.\n \t */\n \tRectangle rect;\n-\tint ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &rect);\n+\tint ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_NATIVE_SIZE, &rect);\n \tif (ret) {\n \t\t/*\n \t\t * Default the pixel array size to the largest size supported\ndiff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp\nindex 759cccafe4a9..a975028a5e70 100644\n--- a/src/libcamera/sensor/camera_sensor_raw.cpp\n+++ b/src/libcamera/sensor/camera_sensor_raw.cpp\n@@ -420,10 +420,10 @@ std::optional<int> CameraSensorRaw::init()\n \t */\n \n \tRectangle rect;\n-\tret = subdev_->getSelection(streams_.image.sink, V4L2_SEL_TGT_CROP_BOUNDS,\n+\tret = subdev_->getSelection(streams_.image.sink, V4L2_SEL_TGT_NATIVE_SIZE,\n \t\t\t\t    &rect);\n \tif (ret) {\n-\t\tLOG(CameraSensor, Error) << \"No pixel array crop bounds\";\n+\t\tLOG(CameraSensor, Error) << \"No pixel array native size\";\n \t\treturn { ret };\n \t}\n \n","prefixes":["v1"]}