From patchwork Fri Jan 7 12:55:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 15258 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 09EE3BE080 for ; Fri, 7 Jan 2022 12:55:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4D9B460928; Fri, 7 Jan 2022 13:55:12 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rN8N/Sv6"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B235060868 for ; Fri, 7 Jan 2022 13:55:10 +0100 (CET) Received: from Monstersaurus.ksquared.org.uk.beta.tailscale.net (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4267D8D7; Fri, 7 Jan 2022 13:55:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1641560110; bh=f/fCvJQQx9vy7lq1nmGOR+dE/9AGHpK2IHB1mV9HgiA=; h=From:To:Cc:Subject:Date:From; b=rN8N/Sv6VgD4IhKpdsEFLfvrsozhc25naiJpodR41OVQrZNJm+g3DL8bsIIK5DD9R z25zH/JWdzAQXMhYiHI6sY1VkFUyfduN9QFofeqtJS5+BG4yXxEC3XZeS6Z/QxqsUN 5dPTjm6qG6M9N5mWIezSLst9ERtiyCnitDlIrr0s= From: Kieran Bingham To: libcamera devel Date: Fri, 7 Jan 2022 12:55:04 +0000 Message-Id: <20220107125506.1477795-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/2] libcamera: pipeline_handler: Prepare requests 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" Provide a new call on pipeline handlers allowing the Camera to prepare a request and associate the request with the pipeline handler after it is constructed. This allows us to perform one-time operations such as connecting relevant signals on the request to the pipeline handler. Use this new call to move the prepared signal connection away from queueRequest where it was repeatedly connecting the signal, leading to bugs which exhibited excessively long shutdown times when any substantial number of frames had been processed. This is reported to have taken more than 10 minutes to close down the pipeline after a 2 hour capture run. Finally add an assertion to the signal connection to ensure that we catch and prevent this from happening again. We only have a limited expectation of the size of slot lists, so if this is exceeded it likely exposes a bug. If we come across a use case that requires substantial conections here, it can be revisted then. This underlying bug was identified from : https://github.com/raspberrypi/libcamera-apps/issues/217 And should resolve the issue there. Note that the assertion preventing excessive slot usage already breaks the CTS tests on CrOS and may indicate either we really need more slots, or that other slot leaks are occuring. Kieran Bingham (2): libcamera: pipeline_handler: Prepare requests libcamera: base: signal: Prevent excessive slot usage include/libcamera/internal/pipeline_handler.h | 1 + src/libcamera/base/signal.cpp | 8 ++++++++ src/libcamera/camera.cpp | 14 ++++++++++--- src/libcamera/pipeline_handler.cpp | 20 ++++++++++++++++--- 4 files changed, 37 insertions(+), 6 deletions(-)