[{"id":22251,"web_url":"https://patchwork.libcamera.org/comment/22251/","msgid":"<CAHW6GYJz+uQjb4uP_ZMN9s+PNTF9zhRjDA4jp=9g1TxNrPfQXA@mail.gmail.com>","date":"2022-03-10T10:34:37","subject":"Re: [libcamera-devel] [PATCH v1 1/6] pipeline: raspberrypi: Avoid\n\tover-allocation for ISP Output 1","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi Naush\n\nThanks for this patch!\n\nOn Mon, 7 Mar 2022 at 12:46, Naushir Patuck via libcamera-devel\n<libcamera-devel@lists.libcamera.org> wrote:\n>\n> The V4L2DeviceFormat structure for the ISP Output 1 node was a copy of what is\n> used ISP Output 1 node, but with the size changed. However, the plane size and\n> stride values were not updated. So there is a possibility that the buffer might\n> be over-sized for the requested resolution.\n>\n> Fix this by only copying the relevent fields from the ISP Output 0\n> V4L2DeviceFormat structure, and let the device driver size the planes as needed.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n>\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 29bff9d6eee4..d604c473c26c 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -844,11 +844,13 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>          * colour denoise will not run.\n>          */\n>         if (!output1Set) {\n> -               V4L2DeviceFormat output1Format = format;\n> +               V4L2DeviceFormat output1Format;\n>                 constexpr Size maxDimensions(1200, 1200);\n>                 const Size limit = maxDimensions.boundedToAspectRatio(format.size);\n>\n>                 output1Format.size = (format.size / 2).boundedTo(limit).alignedDownTo(2, 2);\n> +               output1Format.colorSpace = format.colorSpace;\n> +               output1Format.fourcc = V4L2PixelFormat::fromPixelFormat(formats::YUV420);\n>\n>                 LOG(RPI, Debug) << \"Setting ISP Output1 (internal) to \"\n>                                 << output1Format.toString();\n> --\n> 2.25.1\n>\n\nLooks good to me, and we have of course been testing it with picamera2.\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nTested-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks\nDavid","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 BACEEBE08A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Mar 2022 10:34:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 067BE6118C;\n\tThu, 10 Mar 2022 11:34:51 +0100 (CET)","from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 868E5601FF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Mar 2022 11:34:48 +0100 (CET)","by mail-wm1-x32b.google.com with SMTP id r65so2965387wma.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Mar 2022 02:34:48 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1646908491;\n\tbh=j+TfkTQmYd4ictQ9GPOYZDZH82Nsn7Zkzbt5AAbqdGU=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=ytfWTANEQbcl6eY79cGwx/iDVBDPAQolyCcm3/BCsEyoMnP+LDo1Xk4CFTmOfOW7n\n\t0C0iFKEKzy+wyTrT/mmD5KpxaBwbjvaJR5IytOKoCvOK5tsTppAwjiQkQQV9VU+ljN\n\t92S2ticOXjjUYzNTkKInq3VoZjYA9BRIXVjyZXydiN1vK2jDAtVcUj2E+7V55YRGS9\n\tkpOw1f5XRNrZ93QTabHq8KCdLifI8oAzy+KbOiaJIOpNGmjnhOuqC1/CHTdS83J2pk\n\tzNd51bEDh0AWa1IRWu7tntfBEhVtObyqsVwElPPuk01nXgYkGwH7gRiZowb0SkpFrS\n\t+uIcqPddb52yA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=W3m4Uv6i+molhmjWMNBE9wUQ2IWU0D2nTH/nWTc0lFM=;\n\tb=OH0EvGnZ5c/n4M4LPhwDFepyErDp4sHybGPQWVXNq3/BC9IZgVk3GxRV08dTzfpdUM\n\tbuS09IWLHsQGHvWm+rX1kOCbQvCkWKeTNnNMSpsKyf3jqkSKnrI/WCQ55oxngHw9ZCbE\n\tq74/a+bFOGcH1Q+/vwBWNknxEZkFqlhmn+ltScwJjVGAfM293A3D9/xgLUH6tKCOw467\n\tqdGiB6HMa56/sea+SP0ZD6CIbvqNaLJrfakdzseUs4SGZvLVEGMKjEIWhXJ2m3R43Q/2\n\twNDJVZt5oDMvYcIusZrlh6ADwNnP7J+6KPT0ApvJZoLKWnmKYwkzV04acBQHO9mhTafQ\n\tYRpg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"OH0EvGnZ\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=W3m4Uv6i+molhmjWMNBE9wUQ2IWU0D2nTH/nWTc0lFM=;\n\tb=Hgm3hYVF8+oJCZltnzNvtS0H0MvbtbmlwkRTyWkyFfAocBmgN8Imgrmp8TlfGl4MLn\n\tKvBGQ0nwkHCMWCFkbuuO17RCzbsHBKjlGhbyn/zQ6WCi66flgNtLlbttZauNAsl8lmzG\n\tz3MShRFR7cR33QWH1NqDiUOHPEXREjx0d1Yu/DFGa4yJ+pO3mdbWhZiCHfh3osnQEBxh\n\tI6TKbp+57rCB8IheZaH77S0SM+n5F2Fx89r80U5UXOcNnSo4aodVc2Orr1XpkgmR2u5D\n\thE2kgPKXSBi1/gn5iinBZtF/C5lAyhP8puUPKPwvjnZ4PlmtR5Kmi3ay/eqFXioZNjVP\n\tjIcw==","X-Gm-Message-State":"AOAM532UjtQ08i1JMMio3TnP3Y5TwUrn0v8BVwUFjJ8vmhBt8ePXGbiI\n\tRfUVQy315jr+NqaQuxzSJobZSTJndjpmEebEkerOsErUldw=","X-Google-Smtp-Source":"ABdhPJxdA/l0cEmPCVeWTf3FDZLMmpm4z9kYJ3A8PBR45ELwfJXv/RovU0YbYcX88TZHuAMvftuRCilEbyjFIlu1CPg=","X-Received":"by 2002:a05:600c:27cb:b0:381:400d:3bba with SMTP id\n\tl11-20020a05600c27cb00b00381400d3bbamr11210880wmb.60.1646908488053;\n\tThu, 10 Mar 2022 02:34:48 -0800 (PST)","MIME-Version":"1.0","References":"<20220307124633.115452-1-naush@raspberrypi.com>\n\t<20220307124633.115452-2-naush@raspberrypi.com>","In-Reply-To":"<20220307124633.115452-2-naush@raspberrypi.com>","Date":"Thu, 10 Mar 2022 10:34:37 +0000","Message-ID":"<CAHW6GYJz+uQjb4uP_ZMN9s+PNTF9zhRjDA4jp=9g1TxNrPfQXA@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v1 1/6] pipeline: raspberrypi: Avoid\n\tover-allocation for ISP Output 1","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>","From":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22263,"web_url":"https://patchwork.libcamera.org/comment/22263/","msgid":"<Yi4R4SPIr9s5OwCT@pendragon.ideasonboard.com>","date":"2022-03-13T15:46:41","subject":"Re: [libcamera-devel] [PATCH v1 1/6] pipeline: raspberrypi: Avoid\n\tover-allocation for ISP Output 1","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Mon, Mar 07, 2022 at 12:46:28PM +0000, Naushir Patuck via libcamera-devel wrote:\n> The V4L2DeviceFormat structure for the ISP Output 1 node was a copy of what is\n> used ISP Output 1 node, but with the size changed. However, the plane size and\n\nDid you mean \"of what is used by the ISP Output 0 node\" ?\n\n> stride values were not updated. So there is a possibility that the buffer might\n> be over-sized for the requested resolution.\n> \n> Fix this by only copying the relevent fields from the ISP Output 0\n\ns/relevent/relevant/\n\n> V4L2DeviceFormat structure, and let the device driver size the planes as needed.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 29bff9d6eee4..d604c473c26c 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -844,11 +844,13 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>  \t * colour denoise will not run.\n>  \t */\n>  \tif (!output1Set) {\n> -\t\tV4L2DeviceFormat output1Format = format;\n> +\t\tV4L2DeviceFormat output1Format;\n>  \t\tconstexpr Size maxDimensions(1200, 1200);\n>  \t\tconst Size limit = maxDimensions.boundedToAspectRatio(format.size);\n>  \n>  \t\toutput1Format.size = (format.size / 2).boundedTo(limit).alignedDownTo(2, 2);\n> +\t\toutput1Format.colorSpace = format.colorSpace;\n> +\t\toutput1Format.fourcc = V4L2PixelFormat::fromPixelFormat(formats::YUV420);\n>  \n>  \t\tLOG(RPI, Debug) << \"Setting ISP Output1 (internal) to \"\n>  \t\t\t\t<< output1Format.toString();","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 17333BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 13 Mar 2022 15:47:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4E9166118A;\n\tSun, 13 Mar 2022 16:47:00 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 41F31604E7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 13 Mar 2022 16:46:58 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A5C76492;\n\tSun, 13 Mar 2022 16:46:57 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647186420;\n\tbh=ITiKq1pfFNCkfFxB6iUQ33NsLGHtHLgsBBLrzfrp5QE=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=H9emsyMoPWaPkDkEDtyKKCx9JpP9JEwQJu95xdA+1s7tUwFj3orVmSdv1FaJDJMN3\n\tF/Iw2WV4OcGpFRqJwE2lLfUgs2OP5FJoUaxD4Vquf3UA9iSTHO235JC/oEoz5cMpph\n\tqGOzMVbQuMeukYDnuYC61kGVAX5qOliAcpZW7Ur2alpov0pDK/qGN2gzeJJDsFEu/G\n\tvaRb1vjcSlNAGEXBXUlXKuo0vTON/ih/Ff5qQ5B5iG4hSD9j19XQtpcNTk1yOBdr05\n\tJzhgQm443d7uCgAPTK9jubYtV8GQaWrGGhJc5l0l7YcUff+qrTNbApFG/Rf8W80jYd\n\tT7G24dwLLpsmg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1647186417;\n\tbh=ITiKq1pfFNCkfFxB6iUQ33NsLGHtHLgsBBLrzfrp5QE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hbBzTGCidWOpWmg9iHGCI1g9aujBTCAWduswtxP7CqpCjAw2qjl7PpujyfjQa0VGj\n\tkHei1RtJMXeMy6qmxEEIPtDoAl9w9/oqCZQzPn4jEKwcAkauqzncbh+80HCRoQU7Hw\n\tpnoK0Vo58ECV/OiN79vFBgxtx8NDgZJC0i5es/xc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"hbBzTGCi\"; dkim-atps=neutral","Date":"Sun, 13 Mar 2022 17:46:41 +0200","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<Yi4R4SPIr9s5OwCT@pendragon.ideasonboard.com>","References":"<20220307124633.115452-1-naush@raspberrypi.com>\n\t<20220307124633.115452-2-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220307124633.115452-2-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v1 1/6] pipeline: raspberrypi: Avoid\n\tover-allocation for ISP Output 1","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]