[{"id":26241,"web_url":"https://patchwork.libcamera.org/comment/26241/","msgid":"<167389043119.42371.4210607969195276380@Monstersaurus>","date":"2023-01-16T17:33:51","subject":"Re: [libcamera-devel] [PATCH v4 04/12] pipeline: raspberrypi:\n\tReorder startup drop frame initialisation","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck via libcamera-devel (2022-12-09 09:00:42)\n> Reorder the code such that the IPA requested startup drop frames count is\n> available before the pipeline handler allocates any stream buffers.\n> \n> This will be used in a subsequent change to stop Unicam buffer allocations if\n> there are no startup drop frames required and the application has configured a\n> raw stream and always provides buffers for it.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  .../pipeline/raspberrypi/raspberrypi.cpp      | 30 +++++++++----------\n>  1 file changed, 15 insertions(+), 15 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index f6388d63416b..c5a489fc7581 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -1036,21 +1036,6 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n>         RPiCameraData *data = cameraData(camera);\n>         int ret;\n>  \n> -       for (auto const stream : data->streams_)\n> -               stream->resetBuffers();\n> -\n> -       if (!data->buffersAllocated_) {\n> -               /* Allocate buffers for internal pipeline usage. */\n> -               ret = prepareBuffers(camera);\n> -               if (ret) {\n> -                       LOG(RPI, Error) << \"Failed to allocate buffers\";\n> -                       data->freeBuffers();\n> -                       stop(camera);\n> -                       return ret;\n> -               }\n> -               data->buffersAllocated_ = true;\n> -       }\n> -\n>         /* Check if a ScalerCrop control was specified. */\n>         if (controls)\n>                 data->applyScalerCrop(*controls);\n> @@ -1067,6 +1052,21 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n>         /* Configure the number of dropped frames required on startup. */\n>         data->dropFrameCount_ = startConfig.dropFrameCount;\n>  \n> +       for (auto const stream : data->streams_)\n> +               stream->resetBuffers();\n> +\n> +       if (!data->buffersAllocated_) {\n> +               /* Allocate buffers for internal pipeline usage. */\n> +               ret = prepareBuffers(camera);\n> +               if (ret) {\n> +                       LOG(RPI, Error) << \"Failed to allocate buffers\";\n> +                       data->freeBuffers();\n> +                       stop(camera);\n> +                       return ret;\n> +               }\n> +               data->buffersAllocated_ = true;\n> +       }\n> +\n>         /* We need to set the dropFrameCount_ before queueing buffers. */\n>         ret = queueAllBuffers(camera);\n>         if (ret) {\n> -- \n> 2.25.1\n>","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 AF40DBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Jan 2023 17:33:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2B02C61F01;\n\tMon, 16 Jan 2023 18:33:56 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 19C1B61F01\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Jan 2023 18:33:54 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9801E802;\n\tMon, 16 Jan 2023 18:33:53 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1673890436;\n\tbh=2fr3Wc3skls0YvFfaoXBtn9mS3tPrU4eGXRKjyd0d+U=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=zDnpqtENS9F/XCuuqHVZ25YW5uF0onUuLo5JIauaBvjMxJQ+NgcaYrDvDDguL2RLp\n\tXFPDUsgwzzEs9qP6esHy7JnhnaPCr0Wh1xX7AfYmB4fV+WhLnjBHpYKjlAEjLQ4aYz\n\t83XeApSbaJQuOSg8jwdseo/IiqrFIKeQhpv7vYwao+9fk5m7MtU7LDpwt+5S0urkJ4\n\tKqLHSJP/e85evE4zIVUZood8GbSzr7rhx8hVeVrJY4ZpmfOIBWqv+oeO3o3agKNLi8\n\tGSswn9T43I6+IUzSk6b/6OqJ3ChYzXYya6ELjfT6ezryIIFH7DwNcc6+oxwVNQDdXW\n\tJWpC1vbgwlFqA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1673890433;\n\tbh=2fr3Wc3skls0YvFfaoXBtn9mS3tPrU4eGXRKjyd0d+U=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=UoSkBfIalxcLBmSwVbhVeT5WE9//k/SzUjFUuzolHD7fJgzUfyaD8kaSTtB66UGf+\n\teTQqUE5qoxjpxZ2u2+MA657s/XEEDRy4kFwVEM7u3lYz3p6NpwSocmvFlkW5FlXZkQ\n\tnFS45xnQ+1QCuYrD5gQxG0nR/csGaaMYaFV44Lsk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"UoSkBfIa\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20221209090050.19441-5-naush@raspberrypi.com>","References":"<20221209090050.19441-1-naush@raspberrypi.com>\n\t<20221209090050.19441-5-naush@raspberrypi.com>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 16 Jan 2023 17:33:51 +0000","Message-ID":"<167389043119.42371.4210607969195276380@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 04/12] pipeline: raspberrypi:\n\tReorder startup drop frame initialisation","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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]