{"id":15080,"url":"https://patchwork.libcamera.org/api/1.1/patches/15080/?format=json","web_url":"https://patchwork.libcamera.org/patch/15080/","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":"<20211208123637.1332668-2-naush@raspberrypi.com>","date":"2021-12-08T12:36:37","name":"[libcamera-devel,v2,2/2] pipeline: raspberrypi: Restrict the advertised maximum ISP output resolution","commit_ref":"f16acb275c85518c13e81ffa6503347abcc01dc5","pull_url":null,"state":"accepted","archived":false,"hash":"1bef47682228f1560bb91cf586710994a71e0fa1","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15080/mbox/","series":[{"id":2827,"url":"https://patchwork.libcamera.org/api/1.1/series/2827/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2827","date":"2021-12-08T12:36:36","name":"[libcamera-devel,v2,1/2] pipeline: raspberrypi: Reduce logging verbosity","version":2,"mbox":"https://patchwork.libcamera.org/series/2827/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15080/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15080/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 60FA1C324B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Dec 2021 12:36:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EEC806086A;\n\tWed,  8 Dec 2021 13:36:42 +0100 (CET)","from mail-wm1-x330.google.com (mail-wm1-x330.google.com\n\t[IPv6:2a00:1450:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4007660225\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Dec 2021 13:36:41 +0100 (CET)","by mail-wm1-x330.google.com with SMTP id\n\t77-20020a1c0450000000b0033123de3425so4102151wme.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 08 Dec 2021 04:36:41 -0800 (PST)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:27d5:9305:f572:6623])\n\tby smtp.gmail.com with ESMTPSA id\n\tn15sm5830360wmq.38.2021.12.08.04.36.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 08 Dec 2021 04:36:40 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"AG7aj4g3\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=CgCVonvnxXDsJlMyIqj1/iVqjcm0DbL2S+Y1AFRZDPQ=;\n\tb=AG7aj4g3mCMoVn0SLgANAgBe6oQxzVdud+LIokrWyufHh9azhZKd0sIpG/tHV5tRvh\n\tQTIr/hNRqeCXHDZ6/wJMYltRJn5Vx4pNJlJPyvLQAvKJXNypAQXlXSO3IoJfi/0X+bbT\n\tB9uzATSFf/JxRabsmZ9Vp0grv8+oXpDIZWyqxoy5r4OMcOTZpevDkSn5VjO/7D67J34b\n\tc+lVgXCbd+RMb+gALUWI7kb0cvdmNjK6m5XtBVf6noW+LQ60fZShaI8Ck2XquIeWDSSh\n\t9ZdkTzrRYREO1RRb2xCM8Q3rFrcpQubDOmVMy//W3QsKMx3a7o+yQfyE2uc5iyZFrade\n\tYVuw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=CgCVonvnxXDsJlMyIqj1/iVqjcm0DbL2S+Y1AFRZDPQ=;\n\tb=nPT8ztnd9g3oHHmR4taYCjhOAdA046Lv1pqrdEzw+1TmGBKIyfaYy2Bhf4V7uo/Cpq\n\tmWENHL1VV0lVyiajZH6GLNBnuHG4XAQNo4NwLmGX2Ws0M0L79uTde2K9Xl24KiOI7kQH\n\txEKFu4WvGibM47IDxwqGSCg2EekQDfMJbhTJcAg9Kiz0VAujz1ZTJdyzZz7ZsHBIrZoR\n\tBFBTTUPhpEPqv/aqAKk0cLSXNSWzyan0E1NTM4XGvPFTUBU7ObSjy+vaFfswSQgPzhcB\n\t2VPgGe7WfLGjkhvQU9MEG2SOuxQgCNiE10UxTiTw48vbcPccGlSlADrpOJ5CwRPoQaiG\n\tF5vA==","X-Gm-Message-State":"AOAM533pgGiab2mbzy+hX+McLIeZ4OyovZLlnzvYsL8qoIgP6/2igcP6\n\tc1S/VoRzX1Shfyf4N3osW/zjBeCji4/bE9Kc","X-Google-Smtp-Source":"ABdhPJyKM7mGZrHrjC+Cc1mO/UkvGwtH3jinE2GXvrNrbE2+NGRNMZ2IPelstBom5KX0imBJqzMhXw==","X-Received":"by 2002:a05:600c:5125:: with SMTP id\n\to37mr15597969wms.81.1638967000738; \n\tWed, 08 Dec 2021 04:36:40 -0800 (PST)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  8 Dec 2021 12:36:37 +0000","Message-Id":"<20211208123637.1332668-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20211208123637.1332668-1-naush@raspberrypi.com>","References":"<20211208123637.1332668-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 2/2] pipeline: raspberrypi: Restrict\n\tthe advertised maximum ISP output resolution","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":"Limit the advertised ISP output sizes available to the sensor resolution in\nPipelineHandlerRPi::generateConfiguration(). The user is free to configure a\nlarger resolution than this, and this will work. However, this stops strange\nbehavior in applications that use the V4L2 compatability layer to run, and\nrequest the largest possible advertised resolution, which is much larger than\nthe sensor resolution.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 13 +++++++++----\n 1 file changed, 9 insertions(+), 4 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 101aaea30743..86851ac467ad 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -530,10 +530,11 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n \n \tunsigned int rawCount = 0;\n \tunsigned int outCount = 0;\n+\tSize sensorSize = data->sensor_->resolution();\n \tfor (const StreamRole role : roles) {\n \t\tswitch (role) {\n \t\tcase StreamRole::Raw:\n-\t\t\tsize = data->sensor_->resolution();\n+\t\t\tsize = sensorSize;\n \t\t\tsensorFormat = findBestFormat(data->sensorFormats_, size, defaultRawBitDepth);\n \t\t\tpixelFormat = mbusCodeToPixelFormat(sensorFormat.mbus_code,\n \t\t\t\t\t\t\t    BayerFormat::Packing::CSI2);\n@@ -546,7 +547,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n \t\t\tfmts = data->isp_[Isp::Output0].dev()->formats();\n \t\t\tpixelFormat = formats::NV12;\n \t\t\t/* Return the largest sensor resolution. */\n-\t\t\tsize = data->sensor_->resolution();\n+\t\t\tsize = sensorSize;\n \t\t\tbufferCount = 1;\n \t\t\toutCount++;\n \t\t\tbreak;\n@@ -599,11 +600,15 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n \t\t\t\t\t\tstd::forward_as_tuple(format.second.begin(), format.second.end()));\n \t\t\t}\n \t\t} else {\n-\t\t\t/* Translate the V4L2PixelFormat to PixelFormat. */\n+\t\t\t/*\n+\t\t\t * Translate the V4L2PixelFormat to PixelFormat. Note that we\n+\t\t\t * limit the recommended largest ISP output size to match the\n+\t\t\t * sensor resolution.\n+\t\t\t */\n \t\t\tfor (const auto &format : fmts) {\n \t\t\t\tPixelFormat pf = format.first.toPixelFormat();\n \t\t\t\tif (pf.isValid())\n-\t\t\t\t\tdeviceFormats[pf] = format.second;\n+\t\t\t\t\tdeviceFormats[pf].emplace_back(sensorSize);\n \t\t\t}\n \t\t}\n \n","prefixes":["libcamera-devel","v2","2/2"]}