{"id":18130,"url":"https://patchwork.libcamera.org/api/patches/18130/?format=json","web_url":"https://patchwork.libcamera.org/patch/18130/","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":"<20230118085953.7027-5-naush@raspberrypi.com>","date":"2023-01-18T08:59:45","name":"[libcamera-devel,v5,04/12] pipeline: raspberrypi: Reorder startup drop frame initialisation","commit_ref":null,"pull_url":null,"state":"accepted","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/18130/mbox/","series":[{"id":3713,"url":"https://patchwork.libcamera.org/api/series/3713/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3713","date":"2023-01-18T08:59:41","name":"Raspberry Pi: Platform configuration and buffer allocation improvements","version":5,"mbox":"https://patchwork.libcamera.org/series/3713/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18130/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18130/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 9C03CC3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 18 Jan 2023 09:01:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0C7F5625EA;\n\tWed, 18 Jan 2023 10:01:22 +0100 (CET)","from mail-wr1-x432.google.com (mail-wr1-x432.google.com\n\t[IPv6:2a00:1450:4864:20::432])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C3FAA625EB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Jan 2023 10:01:18 +0100 (CET)","by mail-wr1-x432.google.com with SMTP id b5so12018907wrn.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Jan 2023 01:01:18 -0800 (PST)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ti6-20020adfe486000000b002423dc3b1a9sm30312464wrm.52.2023.01.18.01.01.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 18 Jan 2023 01:01:17 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674032482;\n\tbh=L265xLyiuEuaKv9P5lGhDdWVXIA6ltrNVdeVTVaM2LM=;\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=zkyOaypu3lTYwRZxt1nCwuTZSnCUz8MEifPYPR+FfcboHYubgISNPSo4wgEy8toHA\n\t3TJPcQLuPPt/mtmeddjrUSMGntuuYemiCA3Nmb2e+cJKdeBKWyNgqefADndgPdafxl\n\tN2UgEnL0FnycW7+GYzRRFrPlBMpcadTjkdUJiPsXn91k6RP2tQLlDZjDPhhbqpKdW/\n\tqhL8pWF7rqahrAE++2FEdmQB9JE2AJWOBswVuWhuhnTDA5gn/Pj0i/kJi/WkRjvKiG\n\tjhFqcNzPryFPIcsmYPMXRP3ksNBZGOYWRxJz8OEEea0yHJRaz+fYNb3PeEKGdlpQ85\n\tPN2G44Thi0Kzw==","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=8TFxH7E7BdYI52Y2sjOrvKP7oQS4L1/5NWJaxGyGFtw=;\n\tb=pENFsmiPp6RixW9LHbNQlpk4YEZy3qKniHm9WiVLYBFuy+mN+OchW9U+w7PB8VuAJk\n\tRrTUIpDI/13ioJyd3rOxTg0SYpADEyBIRZfcFiwOL79adu1+a91QH/+UQ+YmaiTwIPQ/\n\tsDSiT/HIGXlfErOvtCuwZGuu12OeFDLwTPUmrKWDKUJpgOsWH40ToxBsa7u8QpyR9aIe\n\t82Z6PnP32eg9bWxKFMPGLcwhNBtHI6tKtrSQHDymZRYitWO7lZPSsZyWbk5JVpt3dywm\n\tji2O2fLabGsZtoMnhYe4w1BzufJ7sshs0TlLS0c6ktQpnK3QdNNAFvCzrUBqr4VYIkpv\n\t2IRw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"pENFsmiP\"; 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=8TFxH7E7BdYI52Y2sjOrvKP7oQS4L1/5NWJaxGyGFtw=;\n\tb=QmGAYMv544tu69HgWyH/elDHTP0vk1JiKa4zxWMM2QznRk820pO8i4NZu0Md4JOKCS\n\tGlIKMQybfl4m6Si404XDkXiVvkqj4MgatYO8eqY7rm20ruIz5tnNUC0J434NMYTrv51i\n\to2DkUWuvHxlTN41on6KjZYyfxSbsKu+kDK5G4C17jn5xDEja5bQnSKYE2BKxJz9dCIcQ\n\t2hcKAqeBqQw5M6/il7D4O7W+0Jy18GEM2SbZF1oaEXq/oZ/D8GRtVOK4sEDCdkQffrmP\n\tdM8y0h8EbmHXbybD+dSaczXrWnaRF1FaDBhQ/i4a6Y24QIxhnQRgWJNBN5T08BEanjDd\n\tPLfg==","X-Gm-Message-State":"AFqh2koi3Y+fHyLtiMT060dolDGO06Mfhu83N+5Q8kEgVTRpSiHJoqCP\n\tovWeYsswoZ51XqR3mIgNp3vgysCZX5RR2vtOpCI=","X-Google-Smtp-Source":"AMrXdXsvU8JK+RPyfiUMjzZGgwbi5t9RZ5v2yZyhcZj8U4V/MGydEI5kTR4PRROTf8Czas62nhQ0+Q==","X-Received":"by 2002:adf:edc2:0:b0:242:4cf5:f385 with SMTP id\n\tv2-20020adfedc2000000b002424cf5f385mr5455645wro.34.1674032478160; \n\tWed, 18 Jan 2023 01:01:18 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 18 Jan 2023 08:59:45 +0000","Message-Id":"<20230118085953.7027-5-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20230118085953.7027-1-naush@raspberrypi.com>","References":"<20230118085953.7027-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 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>\nReviewed-by: Kieran Bingham <kieran.bingham@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 6bf9a669c679..8d325c7a18c5 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1037,21 +1037,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@@ -1068,6 +1053,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","v5","04/12"]}