From patchwork Tue Feb 1 09:27:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15315 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 62A3ABDCBF for ; Tue, 1 Feb 2022 09:27:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9B551609AF; Tue, 1 Feb 2022 10:27:44 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="JrRdhB90"; dkim-atps=neutral Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D57D609AC for ; Tue, 1 Feb 2022 10:27:43 +0100 (CET) Received: by mail-wm1-x336.google.com with SMTP id v123so12202315wme.2 for ; Tue, 01 Feb 2022 01:27:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/vA+TTNOcAn6G7a36dLDQE237v6Ufxc5lg5UfKqlX2k=; b=JrRdhB90b8BNmsZdffSkBkabB2Qvw/GmQl/vE+JDRXkPWXbhuTz82P6hAftbspxkra 4c7uIHYnkaKyJgGn7LwBamMfrKd/FA3FfIfqdw6JRhBRQmE7531wHB3X0kWHEuuldAhP HzuzI2tZkjhN0vQxdeVdHQ1OKWdtS0RMei2oaEBL2p7u4wgZBp6L5B4wVoaCl8WrgL/P zlxIXEKNTqhs9JGaHuTE1l1rhBYygSD/RXL55tM7eWwnrpGw/FhC73o5Grl1MvvJYxjp 3qn4bJMxKPl9hObEakr8mWXCmp58n2cM83fu+eMm9bMJLQ2KOU54BvIGrFWlg7Rf4xEZ Q7VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/vA+TTNOcAn6G7a36dLDQE237v6Ufxc5lg5UfKqlX2k=; b=ABE3kJkErhnZZVaztTRRW+7Pw/dfCMmt3LV5x4/jAYB43GLdpuWZV88wLtldUev9+z Mk/ooi+9feclwmYP9wJR+nFeE/s6PbHA2K8H4QhuyD8stDNa+gSyxxxnECb/tJQvJOoM khxl2HA+WhCYhTafGR5HxTz1BuUdFRM+Un8YYJNKh+U0pFHFwNnLK/iGL1q4txOPQISg dzdj33OC7M1mMf4BtsVOEjwHrcNuIvQNoCaucOZyzSU2KIfma7uDQsO9Y1qilWbTDeju mjL76qkCLsPwVlZzv7TdmFmSf2PtAAYQwWZKRwzHiguf069Gxrzi7uebHYH8SxeiR5SZ D5Xw== X-Gm-Message-State: AOAM532eKv2ZsyGe7bqyF/IU+sgHfU8Uz7qzkVdq0ETpr1QYc7b7zwCC HZSmoZmcbxMf8DwSpa0aZonAW3+3Xbu8ew== X-Google-Smtp-Source: ABdhPJwNV/9R4i3mI7Y9wkyRzF6YwdijkUGEP3x5JV1dClMw3BRHKwxbaC9WNXoxVoZjdHVTEQD+yQ== X-Received: by 2002:a05:600c:3d8c:: with SMTP id bi12mr943116wmb.109.1643707662615; Tue, 01 Feb 2022 01:27:42 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:4d5c:b154:41bf:e0bf]) by smtp.gmail.com with ESMTPSA id i6sm13841964wrw.8.2022.02.01.01.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 01:27:42 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 1 Feb 2022 09:27:37 +0000 Message-Id: <20220201092738.804028-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 1/2] pipeline: raspberrypi: Fix log message 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Fix a typo in a logging message. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 8c03eecefe42..6a46e6bc89fa 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -2070,7 +2070,7 @@ void RPiCameraData::tryRunPipeline() ispPrepare.embeddedBufferPresent = true; LOG(RPI, Debug) << "Signalling signalIspPrepare:" - << " Bayer buffer id: " << embeddedId; + << " Embedded buffer id: " << embeddedId; } ipa_->signalIspPrepare(ispPrepare); From patchwork Tue Feb 1 09:27:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15316 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 3EF58BDCBF for ; Tue, 1 Feb 2022 09:27:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1F00E609C9; Tue, 1 Feb 2022 10:27:45 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="XARsyupg"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EA1C1609AF for ; Tue, 1 Feb 2022 10:27:43 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id bg21-20020a05600c3c9500b0035283e7a012so1170924wmb.0 for ; Tue, 01 Feb 2022 01:27:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6kvCDzXi5pnFVeXHFb5Scom2T7rg5KBUgg4cl0s/rtA=; b=XARsyupgE758gp3mz69PRfBpy8F9g2nsP/g+5ncLaPMcXUGpvtElIC2UOFSWzQEQyi E33qh2/nxZ9OYpiwuhFTnPxkNna0EzOvayh1fuA20ExJuc7YQCNPZbyojT9jC2K0tGA+ sZdTw1cBf2DBp0sVEMuJ6gItTTr1QZI5dQyIzPp+67VCjeL7hf8+zaIDi+vgTj2pueU3 SymoUIZer17bQj0BbHgNN3jTLTEPFpn0yglgQqhpNfI/ZwQOVLUcvVjbh+gG3WZjAiH0 jINKY2CEYIpK2CDwti5v4JtWnRyKfnPC75H30h0poPIrVrXyzq/JRp8Snc7xrQOMfm4h DKcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6kvCDzXi5pnFVeXHFb5Scom2T7rg5KBUgg4cl0s/rtA=; b=Ry6A0xSwLrbeWVq/R2h8kSDFUTO2pGxk5cHe45P/gg5P0SLMGGW1XI9KEyjPBlgJ/B OMFaqP6Fg/kms/HVUrNTE4VQcV5GxOzFDfxl/e/lfqnCBycPgNTxdw3HEQcK+Tf7y+Wl l8XHWNYOWTssbPVON+T+UNxNcq1y9MuoNJ/0lcbnq43RxVqy9DK185aMbwB24qwdy6YX 7uLIZgOInEhDV7rBsCVoBBmoEEJlG/TLj4wyxWVW9m8rcRPsSc7ut1x4ADgtW5h2+E2u mL/Vuz6qtxWSRYF9jDlIwjYY4cuXPuPp3yv/UcBZ5OBBmiHcySjzo5EqBDvr3aFW3Vz8 WK6Q== X-Gm-Message-State: AOAM531oX65DaqsG4YXFUekk2XCaqzxOJsDclqrGLUz59NBjMUBYqBfS IB0xLMrUvfGNQ6Gq/HEdFyRFuW0sZsgL4w== X-Google-Smtp-Source: ABdhPJw5GxNer8IQZNL7427b6nTVylfJpdw5MyYTpEovXTl+3Fqd35pFY2olNhtxEsgjhrG4/7Jr8w== X-Received: by 2002:a05:600c:1e8b:: with SMTP id be11mr962279wmb.96.1643707663415; Tue, 01 Feb 2022 01:27:43 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:4d5c:b154:41bf:e0bf]) by smtp.gmail.com with ESMTPSA id i6sm13841964wrw.8.2022.02.01.01.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 01:27:42 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 1 Feb 2022 09:27:38 +0000 Message-Id: <20220201092738.804028-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220201092738.804028-1-naush@raspberrypi.com> References: <20220201092738.804028-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 2/2] pipeline: raspberrypi: Fix the buffer count calculation for the ISP input stream 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The ISP input stream currently only allocates a single slot in the V4L2VideoDevice cache as it follows the number of buffers allocated for use. However, this is wrong as the ISP input stream imports buffers from Unicam image stream. As a consequence of this, only one cache slot was used during runtime for the ISP input stream, and if multiple buffers were to be queued simultaneously, the queue operation would return a failure. Fix this by passing the same number of RAW buffers available from the Unicam image stream. Additionally, double this count in the cases where buffers could be allocated externally from the application. Bug: https://github.com/raspberrypi/libcamera-apps/issues/236 https://github.com/raspberrypi/libcamera-apps/issues/238 https://github.com/raspberrypi/libcamera-apps/issues/240 Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 8 ++++++++ src/libcamera/pipeline/raspberrypi/rpi_stream.cpp | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 6a46e6bc89fa..49af56edc1f9 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1382,6 +1382,14 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) * minimise frame drops. */ numBuffers = std::max(2, minBuffers - numRawBuffers); + } else if (stream == &data->isp_[Isp::Input]) { + /* + * ISP input buffers are imported from Unicam, so follow + * similar logic as above to count all the RAW buffers + * available. + */ + numBuffers = numRawBuffers + std::max(2, minBuffers - numRawBuffers); + } else if (stream == &data->unicam_[Unicam::Embedded]) { /* * Embedded data buffers are (currently) for internal use, diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp index a4159e20b068..a421ad09ba50 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp @@ -111,11 +111,12 @@ int Stream::prepareBuffers(unsigned int count) * If this is an external stream, we must allocate slots for buffers that * might be externally allocated. We have no indication of how many buffers * may be used, so this might overallocate slots in the buffer cache. + * Similarly, if this stream is only importing buffers, we do the same. * * \todo Find a better heuristic, or, even better, an exact solution to * this issue. */ - if (isExternal()) + if (isExternal() || importOnly_) count = count * 2; return dev_->importBuffers(count);