From patchwork Wed Oct 18 12:52:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Vinnicombe X-Patchwork-Id: 19146 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id BAFE3C3272 for ; Wed, 18 Oct 2023 12:53:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 161E36296F; Wed, 18 Oct 2023 14:53:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1697633582; bh=RNioL3kSdCwy+upaTPyzFY2nbpE25rKOGabeX1HpnvA=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jfC0nr7fnvx1tunpc91JcV9SDGISXCQzqpAsaDfQ2yMObYfaEPXRhflEKo6KL/+G+ LG7xMaedqjA1lWRMWlaBx+EBJ9LuGmibOuSVj+esONpd0XYZagU1N68gpoYu+wP/ZO SBf3OcSfljImxj6PdMTWY+TraIX4DVslIAXQyXjcJ9aa+cABkLS2F/BMCMYpmmGs6Y 4NO3shMdkCnedAcK9F6d4KNR2gOEp62+A2NnDICk54eESGJFx6pCZTcbxyz/0XVuFi o3/jkhldNaD15GicN5ytuTenSbBuZAS0Qelk0w6oqy7nVLtTwwk1P/Ny6U2flodpAx ouJCmCvCx6mGw== Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 21C7C61DD1 for ; Wed, 18 Oct 2023 14:53:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="EAFapyf5"; dkim-atps=neutral Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b9338e4695so91745391fa.2 for ; Wed, 18 Oct 2023 05:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1697633579; x=1698238379; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/akBn66ehZSNqNRetwyTg1ivF5hhi/1gBDHlt7HY3SA=; b=EAFapyf5SmiHYMUX1+U3f3jhLZM5+PmhRH56RMpHnAkPNXfZvmNvuPvZiopHSzdm3o mboUyAchKHpIb1EcsXHfOFJ5uA4Rjq+jBjJGiUg2KMOGC1BqO8XGDIK7DV5yKqO/pCV3 a6LnYbvSMxHeSzXLBoLB7lpJe4fhCWmV7lvsSBj4Z2T5dnhFoFEpXPP1BPG6rlCIsp90 IgzrGYY6pxNpvbNpyRf5KnlRnEkTG0kpaRuDQV2Hv7S4YWkUyzVDbRXEfnwcehGZe5bk PFvGRbIqV6LFoBq5hARxxtKuuFKdY8PqM6nGdAJmQpvqKCdzl0wPlHGxJIMyS9yP+6ob MDDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697633579; x=1698238379; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/akBn66ehZSNqNRetwyTg1ivF5hhi/1gBDHlt7HY3SA=; b=HKwuQE/9atY/Ps4UE9aa6pi9EYwCfkGJo0iotHO13u93VlMeoFhBQn3BIftswzvGJy xzY4uVXBxfdyvf34aSeUA6YU7YV8SybPi4PVDMcv48guBbNpW0cpCnOvpKkZGxw+I9Le RD2lWIVLWzen/V6lAMjneTbwr6C6d7IiSdSxpcvrAbxp1K4jofmIXA/GQ0h86Rn7wHPV 95Pw0EPQ7joJu//qK3rxFHSrVow/PsZEGAN9KUjmDcDni691vqAJxoepYc7OLFzXDdze Zlf613hGurXVj1pVFSHnJWcIEAdrGewhI6oPPmlx8MRi8+tzNkP1DjB91arE1oVUJ/Pn KxBw== X-Gm-Message-State: AOJu0YzPlwkemIRi+G5Ukt/9I1B8aN3EyDT4s7PQMSGzqoWTFCKBaSSk rEhJvemH6CbDrW0bqxfNmEAIo7JvrOdeNlqCENQ= X-Google-Smtp-Source: AGHT+IEhErBcFdah6CHZVYjECCyu84bzgLLsqRqfFcUbC4HJOZhXY+eE972tozi8XVObOJgp6sCK2g== X-Received: by 2002:a05:651c:388:b0:2bf:f6f6:9fd9 with SMTP id e8-20020a05651c038800b002bff6f69fd9mr3357101ljp.0.1697633578696; Wed, 18 Oct 2023 05:52:58 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id q14-20020a05600c46ce00b0040836519dd9sm1622983wmo.25.2023.10.18.05.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 05:52:58 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 18 Oct 2023 13:52:41 +0100 Message-Id: <20231018125241.17838-1-william.vinnicombe@raspberrypi.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] pipeline: rpi: vc4: Allocate more embedded data buffers X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: William Vinnicombe via libcamera-devel From: William Vinnicombe Reply-To: William Vinnicombe Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" If the pipeline runs out of embedded data buffers, then it will pass the frame to the IPA without the metadata. The IPA then has to use the delayed controls as inputs to the algorithms. This can cause problems with the subsequent algorithms if the sensor did not action the controls, especially with the autofocus as that doesn't have controls which can be passed in lieu of the metadata. Reduce the likelihood of this by increasing the number of embedded data buffers, as they are small so a generous number can be allocated. Signed-off-by: William Vinnicombe Reviewed-by: Naushir Patuck Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index 425ab9ae..d7279d02 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -258,10 +258,21 @@ int PipelineHandlerVc4::prepareBuffers(Camera *camera) } else if (stream == &data->unicam_[Unicam::Embedded]) { /* - * Embedded data buffers are (currently) for internal use, - * so allocate the minimum required to avoid frame drops. + * Embedded data buffers are (currently) for internal use, and + * are small enough (typically 1-2KB) that we can + * allocate them generously to avoid causing problems in the + * IPA when we cannot supply the metadata. + * + * 12 are allocated as a typical application will have 8-10 + * input buffers, so allocating more embedded buffers than that + * is a sensible choice. + * + * The lifetimes of these buffers are smaller than those of the + * raw buffers, so allocating a fixed number will still suffice + * if the application requests a greater number of raw + * buffers, as these will be recycled quicker. */ - numBuffers = minBuffers; + numBuffers = 12; } else { /* * Since the ISP runs synchronous with the IPA and requests,