{"id":17968,"url":"https://patchwork.libcamera.org/api/patches/17968/?format=json","web_url":"https://patchwork.libcamera.org/patch/17968/","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":"<20221209090050.19441-5-naush@raspberrypi.com>","date":"2022-12-09T09:00:42","name":"[libcamera-devel,v4,04/12] pipeline: raspberrypi: Reorder startup drop frame initialisation","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ff791e119ad0da0aa7691ec299702cf9d4d0e1e9","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17968/mbox/","series":[{"id":3663,"url":"https://patchwork.libcamera.org/api/series/3663/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3663","date":"2022-12-09T09:00:38","name":"Raspberry Pi: Platform configuration and buffer allocation improvements","version":4,"mbox":"https://patchwork.libcamera.org/series/3663/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17968/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17968/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 30574BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  9 Dec 2022 09:01:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DE4F463361;\n\tFri,  9 Dec 2022 10:01:35 +0100 (CET)","from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EFFA561F1E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  9 Dec 2022 10:01:31 +0100 (CET)","by mail-wm1-x32c.google.com with SMTP id o15so2728476wmr.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 09 Dec 2022 01:01:31 -0800 (PST)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tbd10-20020a05600c1f0a00b003cf774c31a0sm7773674wmb.16.2022.12.09.01.01.30\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 09 Dec 2022 01:01:30 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1670576495;\n\tbh=8HTIPDT/NLnYs2wOJmUDMwsBHq8KUzzKjYDz7CKniHo=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=bv2/98MrTdBVCh4xAvWBXqVUapPgBkqAb3FFJ0rOFsFykC3kC14W7n8Y6LGdSe4XA\n\tzf+hS/jXFn6SP+Ntd/UtVdQKDpaMxxCSlq9E5EflnLIAYasQYlTESyCYwkz6AwoSe8\n\tKjU4XRTYPwSzp4nYJTA26rVdNt/ggo51CSwsW6tgJLnsTKJbLz1dr8XFx+b65pb+gB\n\t2v5f6+R87iU+3HQ9LumJTd2BvQZ+RSzhsQa0oTRdZMVbICfGY4cZoRN3a8+N+7lRCn\n\tpVyNe/K4wYRtWF1bG5/7uT7tH4W49tXSWu+FoAUUTNT3xq0WFHDdwDNm7lyaJWmgs4\n\t2U72H8Zs1whaA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=5Z11VugKNVYk4NrBATUQ29zE9EItJoR8a0aD1H32Zho=;\n\tb=gDXNQZK65MuyLFyDHzPTRa01p6gQbkpp+zAlHRxSTqoUYn7VQhOkZjTtJiFhW4VEy6\n\tzumbqzirh68dV0Np5HjrEcPdysI7/OC2PxYoWCDYq2wfE4jPf9UfDmFlEtZc0Lo3nuPU\n\tCZXfbdwQrJrvFS2j6QyIdSnjHV4WIPTO8ngTlK6Glh3EnMInXw1K7dF/LeGZQVVPntGH\n\tqYVnKNb065IIr/f2K3WAHMdGUn5pezDNgK5HFWBOO+MeedGT/NgkMLkIH8yjDYqAGs6+\n\t+VlAtGBNF8WABAXokSLTI7RtCt+VIVjluzs/uFyTZohplSMJF81OoyUCwQ8VxrTtuaDy\n\tA6rw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"gDXNQZK6\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=5Z11VugKNVYk4NrBATUQ29zE9EItJoR8a0aD1H32Zho=;\n\tb=zgxKX2wtc3l/Lj4OjaZD0x1M7NjaUSU/aKWezvxdgzQMXwI4aDTvhplNz23gA8GrEt\n\tWWeKnJA16f1kynOEJWhMmlEqn6e/cEc6sLrPww/uERnbEWhDCOO17uc/0dHdaELbHmv7\n\tUKWMR5xfbLVJtllxdHZUFfwi1PzKXfHt9KClM1fEyXIraNEt/O1Mc5hDeHCktZpMHyB3\n\tiA17tWrmd35HEFcW4FwKd/lNFTEWBUFU03Mu19zkfHcoIKv1N30cPuF3X7jmEa5oKA0E\n\tBxfqKsyoKk5jXUioIoSOc8+JtkSYyBpK7Aa8if1WVFsJyNwJ6XWbeNCUfwqbk9AhB9B3\n\t6NRA==","X-Gm-Message-State":"ANoB5pn7PkuZIKtk/bI1EvgOWYuyXXe2QpDhDN+MWw22CxRD7EhipD/u\n\tbjF9jE2In82pFtb1M073VzIBJQL/nQo0P0GT","X-Google-Smtp-Source":"AA0mqf4QQh03oLLkQihaofdDovzXEUycOMPRDae3mIavTJr3oAHe8HZFolwEkyGrQeoEPFfzlZkCSg==","X-Received":"by 2002:a05:600c:1da3:b0:3d1:ebdf:d58b with SMTP id\n\tp35-20020a05600c1da300b003d1ebdfd58bmr4280386wms.5.1670576491408; \n\tFri, 09 Dec 2022 01:01:31 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  9 Dec 2022 09:00:42 +0000","Message-Id":"<20221209090050.19441-5-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20221209090050.19441-1-naush@raspberrypi.com>","References":"<20221209090050.19441-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 04/12] pipeline: raspberrypi: Reorder\n\tstartup 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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Reorder the code such that the IPA requested startup drop frames count is\navailable before the pipeline handler allocates any stream buffers.\n\nThis will be used in a subsequent change to stop Unicam buffer allocations if\nthere are no startup drop frames required and the application has configured a\nraw stream and always provides buffers for it.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 30 +++++++++----------\n 1 file changed, 15 insertions(+), 15 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 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 \tRPiCameraData *data = cameraData(camera);\n \tint ret;\n \n-\tfor (auto const stream : data->streams_)\n-\t\tstream->resetBuffers();\n-\n-\tif (!data->buffersAllocated_) {\n-\t\t/* Allocate buffers for internal pipeline usage. */\n-\t\tret = prepareBuffers(camera);\n-\t\tif (ret) {\n-\t\t\tLOG(RPI, Error) << \"Failed to allocate buffers\";\n-\t\t\tdata->freeBuffers();\n-\t\t\tstop(camera);\n-\t\t\treturn ret;\n-\t\t}\n-\t\tdata->buffersAllocated_ = true;\n-\t}\n-\n \t/* Check if a ScalerCrop control was specified. */\n \tif (controls)\n \t\tdata->applyScalerCrop(*controls);\n@@ -1067,6 +1052,21 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n \t/* Configure the number of dropped frames required on startup. */\n \tdata->dropFrameCount_ = startConfig.dropFrameCount;\n \n+\tfor (auto const stream : data->streams_)\n+\t\tstream->resetBuffers();\n+\n+\tif (!data->buffersAllocated_) {\n+\t\t/* Allocate buffers for internal pipeline usage. */\n+\t\tret = prepareBuffers(camera);\n+\t\tif (ret) {\n+\t\t\tLOG(RPI, Error) << \"Failed to allocate buffers\";\n+\t\t\tdata->freeBuffers();\n+\t\t\tstop(camera);\n+\t\t\treturn ret;\n+\t\t}\n+\t\tdata->buffersAllocated_ = true;\n+\t}\n+\n \t/* We need to set the dropFrameCount_ before queueing buffers. */\n \tret = queueAllBuffers(camera);\n \tif (ret) {\n","prefixes":["libcamera-devel","v4","04/12"]}