[{"id":36768,"web_url":"https://patchwork.libcamera.org/comment/36768/","msgid":"<fa2852f6-8bef-41f7-b567-5240fcc42b5e@ideasonboard.com>","date":"2025-11-11T11:58:41","subject":"Re: [PATCH v2] libcamera: pipeline_handler: Fix requestComplete on\n\twaiting requests on stop","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2025. 11. 05. 14:58 keltezéssel, Stefan Klug írta:\n> The requestComplete signal is not emitted when the camera is stopped and\n> the request is still in the waitingRequests_ queue. Fix that by calling\n> doQueueRequest() on the waiting requests after marking them as\n> cancelled. This ensures that the requests gets a proper sequence number\n> and are added to the queuedRequests_ list. This list is then iterated in\n> completeRequest() and leads to the requestComplete signal.\n> \n> Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/281\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> ---\n> \n> Hey all,\n> \n> In the discussion on v1 https://patchwork.libcamera.org/patch/24719/ it\n> was rightly noted that the solution does feel a bit hacky. However there\n> was no clear better solution and it was also acknowledged that the\n> change is quite small and solves the problem. So I'd propose to merge it\n> in as long as there is no better proposal.\n> \n> Changes in v2:\n> - Collected rby tag\n> - Added closes tag to automatically close the issue\n> - Slightly modified the comment and commit message to mention that this\n>    logic also ensures that the requests get a sequence number.\n> \n> Best regards,\n> Stefan\n> \n> ---\n\nLooks OK.\n\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\n\n>   src/libcamera/pipeline_handler.cpp | 11 ++++++++++-\n>   1 file changed, 10 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> index e5f9e55c9783..f398f62e0085 100644\n> --- a/src/libcamera/pipeline_handler.cpp\n> +++ b/src/libcamera/pipeline_handler.cpp\n> @@ -380,7 +380,16 @@ void PipelineHandler::stop(Camera *camera)\n>   \twhile (!waitingRequests.empty()) {\n>   \t\tRequest *request = waitingRequests.front();\n>   \t\twaitingRequests.pop();\n> -\t\tcancelRequest(request);\n> +\n> +\t\t/*\n> +\t\t * Cancel all requests by marking them as cancelled and calling\n> +\t\t * doQueueRequest() instead of cancelRequest(). This ensures\n> +\t\t * that the requests get a sequence number and are temporarily\n> +\t\t * added to queuedRequests_ so they can be properly completed in\n> +\t\t * completeRequest().\n> +\t\t */\n> +\t\trequest->_d()->cancel();\n> +\t\tdoQueueRequest(request);\n>   \t}\n>   \n>   \t/* Make sure no requests are pending. */","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2407AC3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Nov 2025 11:58:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 44417606D5;\n\tTue, 11 Nov 2025 12:58:47 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0D591606A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Nov 2025 12:58:45 +0100 (CET)","from [192.168.33.25] (185.221.140.239.nat.pool.zt.hu\n\t[185.221.140.239])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1A41A50A;\n\tTue, 11 Nov 2025 12:56:46 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"sX2I36RV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762862206;\n\tbh=SXg+PspgSs9ommJARWMrmmSm+IAFs6r6nt8IFJCsl+M=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=sX2I36RVaej6VCPIcSnPQEDW1XqEh3vBOYrI6azdPEQACysC8a+lJaQF097Hk9ucs\n\tHxjlDEWsiKvtbRRmLk7DJK46FFSkbhWYPhWoqF13AVMHj+z5YZdPaMiPYxL8jHRzvY\n\t43dRsmAVmTlNLVoHY8lVw1ERSv43TMeSk/fWlcpk=","Message-ID":"<fa2852f6-8bef-41f7-b567-5240fcc42b5e@ideasonboard.com>","Date":"Tue, 11 Nov 2025 12:58:41 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v2] libcamera: pipeline_handler: Fix requestComplete on\n\twaiting requests on stop","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"Paul Elder <paul.elder@ideasonboard.com>","References":"<20251105135859.282979-1-stefan.klug@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20251105135859.282979-1-stefan.klug@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]