{"id":11540,"url":"https://patchwork.libcamera.org/api/1.1/patches/11540/?format=json","web_url":"https://patchwork.libcamera.org/patch/11540/","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":"<20210309144457.32412-1-m.cichy@pengutronix.de>","date":"2021-03-09T14:44:57","name":"[libcamera-devel] libcamera: v4l2_subdevice: Fix formats() returning only sizes for last mbus code","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"56fdfa0dc8f939c958b757618f823cb3d2f192ca","submitter":{"id":80,"url":"https://patchwork.libcamera.org/api/1.1/people/80/?format=json","name":"Marian Cichy","email":"m.cichy@pengutronix.de"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11540/mbox/","series":[{"id":1779,"url":"https://patchwork.libcamera.org/api/1.1/series/1779/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1779","date":"2021-03-09T14:44:57","name":"[libcamera-devel] libcamera: v4l2_subdevice: Fix formats() returning only sizes for last mbus code","version":1,"mbox":"https://patchwork.libcamera.org/series/1779/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11540/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11540/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 406CFBD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Mar 2021 14:45:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C01DE68A9C;\n\tTue,  9 Mar 2021 15:45:01 +0100 (CET)","from metis.ext.pengutronix.de (metis.ext.pengutronix.de\n\t[IPv6:2001:67c:670:201:290:27ff:fe1d:cc33])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 591F468A99\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Mar 2021 15:45:00 +0100 (CET)","from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28])\n\tby metis.ext.pengutronix.de with esmtps\n\t(TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92)\n\t(envelope-from <mci@pengutronix.de>)\n\tid 1lJdbX-00022z-Oa; Tue, 09 Mar 2021 15:44:59 +0100","from mci by dude02.hi.pengutronix.de with local (Exim 4.92)\n\t(envelope-from <mci@pengutronix.de>)\n\tid 1lJdbX-00009P-Dn; Tue, 09 Mar 2021 15:44:59 +0100"],"From":"Marian Cichy <m.cichy@pengutronix.de>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  9 Mar 2021 15:44:57 +0100","Message-Id":"<20210309144457.32412-1-m.cichy@pengutronix.de>","X-Mailer":"git-send-email 2.29.2","MIME-Version":"1.0","X-SA-Exim-Connect-IP":"2001:67c:670:100:1d::28","X-SA-Exim-Mail-From":"mci@pengutronix.de","X-SA-Exim-Scanned":"No (on metis.ext.pengutronix.de);\n\tSAEximRunCond expanded to false","X-PTX-Original-Recipient":"libcamera-devel@lists.libcamera.org","Subject":"[libcamera-devel] [PATCH] libcamera: v4l2_subdevice: Fix formats()\n\treturning only sizes for last mbus code","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":"graphics@pengutronix.de, Marian Cichy <m.cichy@pengutronix.de>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"V4L2Subdevice::formats() wants to enumerate all media bus codes and\nframe sizes on a pad, however, the current implementation always\noverwrites the SizeRange of the last mbus code, effectively returning\nonly this SizeRange.\n\nThis can be even fatal, as camera_sensor is using this function to\nenumerate all codes and sizes. If the last mbus code has no SizeRange\nfor whatever reason, the camera_sensor will error out, claiming that it\ndidn't found any image formats at all.\n\nSigned-off-by: Marian Cichy <m.cichy@pengutronix.de>\n---\n src/libcamera/v4l2_subdevice.cpp | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)","diff":"diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 9af1c0ab..37bafb9b 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -354,10 +354,10 @@ V4L2Subdevice::Formats V4L2Subdevice::formats(unsigned int pad)\n \t\treturn {};\n \t}\n \n+\tstd::vector<SizeRange> sizes = {};\n \tfor (unsigned int code : enumPadCodes(pad)) {\n-\t\tstd::vector<SizeRange> sizes = enumPadSizes(pad, code);\n-\t\tif (sizes.empty())\n-\t\t\treturn {};\n+\t\tstd::vector<SizeRange> codeSizeRange = enumPadSizes(pad, code);\n+\t\tsizes.insert(sizes.end(), codeSizeRange.begin(), codeSizeRange.end());\n \n \t\tconst auto inserted = formats.insert({ code, sizes });\n \t\tif (!inserted.second) {\n","prefixes":["libcamera-devel"]}