{"id":18204,"url":"https://patchwork.libcamera.org/api/1.1/patches/18204/?format=json","web_url":"https://patchwork.libcamera.org/patch/18204/","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":"<20230127154322.29019-5-naush@raspberrypi.com>","date":"2023-01-27T15:43:11","name":"[libcamera-devel,v6,04/15] 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/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18204/mbox/","series":[{"id":3728,"url":"https://patchwork.libcamera.org/api/1.1/series/3728/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3728","date":"2023-01-27T15:43:07","name":"[libcamera-devel,v6,01/15] libcamera: stream: Add stream hints to StreamConfiguration","version":6,"mbox":"https://patchwork.libcamera.org/series/3728/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18204/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18204/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 7084CBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Jan 2023 15:43:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7C41661EF9;\n\tFri, 27 Jan 2023 16:43:43 +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 937C9625E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jan 2023 16:43:38 +0100 (CET)","by mail-wm1-x330.google.com with SMTP id\n\tf12-20020a7bc8cc000000b003daf6b2f9b9so5679063wml.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jan 2023 07:43:38 -0800 (PST)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\th18-20020a05600c30d200b003c21ba7d7d6sm4549566wmn.44.2023.01.27.07.43.37\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 27 Jan 2023 07:43:37 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674834223;\n\tbh=z1bIE/e9vXtfIY1SAoNZ7ufuWwQk4rK8DoHrCYJLUls=;\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=x5i2yCr50G0FMNXzDo6UgnQ0bPDNeF81hZfUA19gJvkENJYfZKn+edcmX/DttH4qk\n\tqO+n8iGC5SZl7R00BBvWnDtwOrj96qW5Pp48FK4oMIWQY3cMyepYDc3wFjaPH/nezZ\n\tie1gaH6KzM52KiRog2c3Ht4QxAaAhV3XyxnOQ8eTyVnhUhDkC9ld7Vqgf3YzPB5i03\n\t1djwG5xAiYDjG8ytBD/pr9BBctMARf5ahWuactKm5W85uvhwDb0K514qsCRv7uu+Rv\n\tA+8nkT9zQ7ekbMUPT+MElriTGIauvXGRAaRkI4uxczfqGTP7liWSFspkyIDkO04iVF\n\t1cBN5FOpmHYzQ==","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=ebjZaGnHe6ttVotKHBzk7oVcPheV/bXS8hsRGk0E6Ww=;\n\tb=myAdBZsxMr1VwosKcCONkePJupMB+esasWDsaeNf69disqRmhXzXz0jeBl3CzqUXLb\n\tQxKqcJphZUBKpmzq+0b3eQR+YODU/cjt92OPNOtzOyOItQzSBR1UZCVvNDcsyG4JTskP\n\tT6kUsHnqZk4Za4/yMurjVvFUugFVdENiJmm/XP+um6MMZgN0lkrTzVox6HvX4AFKeehj\n\tA8LGlxj4o0VIj0aH9zzEqd3TzMl9Zlmcln4f5XwCpzN32/9D6henURq2ruaC3ho5LGpw\n\tEvazNmyo6Cfg1oIFI58AnPVi/X+Qylq3UoThBrsfR4Zzvh2zvX61+JbzbFrlzu5Jv5WS\n\tDOsA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"myAdBZsx\"; 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=ebjZaGnHe6ttVotKHBzk7oVcPheV/bXS8hsRGk0E6Ww=;\n\tb=eRCirA38zujlb8oVkZomxbUSCsNxnQNDpvCsfUmw61pW0HKZXvQSgZFsIfqnIqpp6D\n\ttMsQGHod9m44Ww8qMAXY72iYjP+KrcucXMVAw8Hh/1TAb8kwglBwQ7eBUTuZ2wCbad6m\n\tFfLE05mjljm13M8goa8P1k1UWRbIw0NlcQtaJoVj0CuFhQJs+Cgm5J/0cfoNeFYf5B2z\n\tECfv4aTb1sW8DTDigZlmcqYQiQAe0USHnM9NPckv7axzJH3yKckRbARf+gYER84Y/Yqt\n\tdB8PD5TMyn98H54QBdC9LsuN28jVkg/N/4/KEgQaSUnhwfPn5GQxTin/nzq/jWBOOQR3\n\tqrCA==","X-Gm-Message-State":"AFqh2kpAq/HzRHBxddD1OLNHfCjLS4hKsgWf2PRl0C/T8cYlNzm7nHkk\n\t2Yyo9gXJzooN9H4m/jz9Swqzi4xRVZXqhZbh7r4=","X-Google-Smtp-Source":"AMrXdXtyozZAJsU8ucpfaOkaHmxtO5BqLuSh4fksNAnsq5Cnh0J9akFlh92iZj1wkuXjZLUDrxtcdg==","X-Received":"by 2002:a05:600c:a4d:b0:3db:1d6:16f7 with SMTP id\n\tc13-20020a05600c0a4d00b003db01d616f7mr37645196wmq.23.1674834217876; \n\tFri, 27 Jan 2023 07:43:37 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 27 Jan 2023 15:43:11 +0000","Message-Id":"<20230127154322.29019-5-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20230127154322.29019-1-naush@raspberrypi.com>","References":"<20230127154322.29019-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v6 04/15] 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 9e959782d310..8aa83aa76ae0 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1041,21 +1041,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@@ -1072,6 +1057,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","v6","04/15"]}