From patchwork Fri Mar 12 05:47:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11558 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 4CCF0BD1F1 for ; Fri, 12 Mar 2021 05:47:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 050A568C71; Fri, 12 Mar 2021 06:47:39 +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="vlqRx/UM"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E8F5868C72 for ; Fri, 12 Mar 2021 06:47:33 +0100 (CET) Received: from localhost.localdomain (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 844FEB60; Fri, 12 Mar 2021 06:47:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615528053; bh=kgO76cnZq5+HAIHE0rd6caDxMO6D5eBzGOa4V+mF1I0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vlqRx/UMZuICbXi8UYEgObYXyiV2YjzYBUIfLwKFAiFy142C4L9NmmpwTNNRtDiEp Pa40Khc/XeV9lrWEa/EkHCFzqhqWl1iQY/9htXURvTFST1og1F2q/CSvTm6wHERYhO K+TJza6+rjn39UyREiscnvfXzDxhkiJAmlw/2Jmg= From: Kieran Bingham To: libcamera devel Date: Fri, 12 Mar 2021 05:47:26 +0000 Message-Id: <20210312054727.852622-8-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210312054727.852622-1-kieran.bingham@ideasonboard.com> References: <20210312054727.852622-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 7/8] libcamera: pipeline: ipu3: Ensure no requests are pending at stop() 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 Pipeline handlers are responsible for making sure that all work is completed during the stop call, and all requests and resources should be released back to the application. Add an assertion to guarantee that there are no pending requests before returning from ::stop() Signed-off-by: Kieran Bingham --- RFC? Ideally this should be handled by the base pipeline handler so that the same guarantee applies to all pipeline handlers. But we don't currently call into the base class during stop. src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 7ab3a5bfdccb..c5facaea16dd 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -771,6 +771,14 @@ void PipelineHandlerIPU3::stop(Camera *camera) if (ret) LOG(IPU3, Warning) << "Failed to stop camera " << camera->id(); + /* + * All requests must have completed before releaseing buffers. + * \todo: Ensure all pipeline handlers guarantee queuedRequests is emtpy + * at the end of stop(). + */ + if (!data->queuedRequests_.empty()) + LOG(IPU3, Fatal) << "There are still requests to complete."; + freeBuffers(camera); }