From patchwork Wed Nov 5 13:58:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24978 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 B7352BDE4C for ; Wed, 5 Nov 2025 13:59:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B614C60A80; Wed, 5 Nov 2025 14:59:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="G/ao7yeD"; 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 18F2160805 for ; Wed, 5 Nov 2025 14:59:05 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:3793:9dc2:3dec:ebc3]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 93BB2E45; Wed, 5 Nov 2025 14:57:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1762351030; bh=NuIPLkjjha9Qb199TObYAQVZ56RAR7i4srDwGIsbKw4=; h=From:To:Cc:Subject:Date:From; b=G/ao7yeD76DCreFpO60hE4aM79+UX3b9teLw1l40597FlB6dMooE6ZLZc2tLCaipq J06rp6KbJbUTTGXKQD9lBCgm/ojLPNdxV90e1SC4is/1LkJtM6fQPNrfcrmPnILT4O 7dtvc8sjcywaqRybvinMxPWk33eiHKcWEpwqeP3E= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder Subject: [PATCH v2] libcamera: pipeline_handler: Fix requestComplete on waiting requests on stop Date: Wed, 5 Nov 2025 14:58:19 +0100 Message-ID: <20251105135859.282979-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 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 requestComplete signal is not emitted when the camera is stopped and the request is still in the waitingRequests_ queue. Fix that by calling doQueueRequest() on the waiting requests after marking them as cancelled. This ensures that the requests gets a proper sequence number and are added to the queuedRequests_ list. This list is then iterated in completeRequest() and leads to the requestComplete signal. Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/281 Signed-off-by: Stefan Klug Reviewed-by: Paul Elder --- Hey all, In the discussion on v1 https://patchwork.libcamera.org/patch/24719/ it was rightly noted that the solution does feel a bit hacky. However there was no clear better solution and it was also acknowledged that the change is quite small and solves the problem. So I'd propose to merge it in as long as there is no better proposal. Changes in v2: - Collected rby tag - Added closes tag to automatically close the issue - Slightly modified the comment and commit message to mention that this logic also ensures that the requests get a sequence number. Best regards, Stefan --- src/libcamera/pipeline_handler.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index e5f9e55c9783..f398f62e0085 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -380,7 +380,16 @@ void PipelineHandler::stop(Camera *camera) while (!waitingRequests.empty()) { Request *request = waitingRequests.front(); waitingRequests.pop(); - cancelRequest(request); + + /* + * Cancel all requests by marking them as cancelled and calling + * doQueueRequest() instead of cancelRequest(). This ensures + * that the requests get a sequence number and are temporarily + * added to queuedRequests_ so they can be properly completed in + * completeRequest(). + */ + request->_d()->cancel(); + doQueueRequest(request); } /* Make sure no requests are pending. */