From patchwork Fri Mar 12 05:47:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11555 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 B8494BD1F1 for ; Fri, 12 Mar 2021 05:47:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 72FDE68C6A; Fri, 12 Mar 2021 06:47:37 +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="Yff1ksrb"; 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 0D30A68C6E 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 8A10BA2A; Fri, 12 Mar 2021 06:47:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615528052; bh=8lnDfH/NO4/Q9HX64lxchoVP23qzoB/7ihqg0whiYUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yff1ksrbbGMJut2dSrSEdNyE55E0pIv8Dp/yWhCscurwH7JaByW0qs+fdus7voSAe J6AiX3r4ymfT7ZMBe0WyMFGTRcciiYxODhuNysxCormqq6Q81Bx182+qfn8i84MdD4 A0h3XJdQptJl3jqsom7rZh7aOoYNwfF4Akb2qzDc= From: Kieran Bingham To: libcamera devel Date: Fri, 12 Mar 2021 05:47:23 +0000 Message-Id: <20210312054727.852622-5-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 4/8] libcamera: camera: Validate requests are completed in Running state 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" All requests must have completed before the Camera has fully stopped. Requests completing when the camera is not running represent an internal pipeline handler bug. Trap this event with a fatal error. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- src/libcamera/camera.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 84edbb8f494d..19fb9eb415b0 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -1062,11 +1062,11 @@ int Camera::stop() LOG(Camera, Debug) << "Stopping capture"; - d->setState(Private::CameraConfigured); - d->pipe_->invokeMethod(&PipelineHandler::stop, ConnectionTypeBlocking, this); + d->setState(Private::CameraConfigured); + return 0; } @@ -1079,6 +1079,12 @@ int Camera::stop() */ void Camera::requestComplete(Request *request) { + Private *const d = LIBCAMERA_D_PTR(); + + int ret = d->isAccessAllowed(Private::CameraRunning); + if (ret < 0) + LOG(Camera, Fatal) << "Trying to complete a request when Stopped"; + requestCompleted.emit(request); }