Patch Detail
Show a patch.
GET /api/1.1/patches/21676/?format=api
{ "id": 21676, "url": "https://patchwork.libcamera.org/api/1.1/patches/21676/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21676/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20241018092716.295624-4-mzamazal@redhat.com>", "date": "2024-10-18T09:27:16", "name": "[v4,3/3] libcamera: software_isp: Clean up pending requests on stop", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "7cb6c3e159c8f60ea03bcf4dca1f0e1a05c853b9", "submitter": { "id": 177, "url": "https://patchwork.libcamera.org/api/1.1/people/177/?format=api", "name": "Milan Zamazal", "email": "mzamazal@redhat.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21676/mbox/", "series": [ { "id": 4717, "url": "https://patchwork.libcamera.org/api/1.1/series/4717/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4717", "date": "2024-10-18T09:27:13", "name": "Clean up pending requests on stop in software ISP", "version": 4, "mbox": "https://patchwork.libcamera.org/series/4717/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21676/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21676/checks/", "tags": {}, "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 D3839C32FE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Oct 2024 09:27:43 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8E0426538B;\n\tFri, 18 Oct 2024 11:27:43 +0200 (CEST)", "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9BD296538B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 11:27:40 +0200 (CEST)", "from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-118-hSdXXV-JPq6L9rHHu_gRVA-1;\n\tFri, 18 Oct 2024 05:27:36 -0400", "from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 3BBB6195608B; Fri, 18 Oct 2024 09:27:35 +0000 (UTC)", "from nuthatch.redhat.com (unknown [10.45.225.61])\n\tby mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 6EB09300019D; Fri, 18 Oct 2024 09:27:33 +0000 (UTC)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"U0AffD0i\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1729243659;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=4Du9buRgH03PHqgtWUzkJnCHpVysVjf2UiYjEBfv76w=;\n\tb=U0AffD0isAwpyii4s31LCFGhE4gPrUG2CnkQySdszl8RCfSX6xdnl36P43Eajnwrva/usQ\n\t3bMo8ZPJQQk+hBlb8Kp4NlGegTBNPGIQXx6Dh9MFNgsg74pa1oGomJRzjBHpqR/JCHoc0w\n\t9D0hrkUQxC2pkxAND2Yq4j306NMeePg=", "X-MC-Unique": "hSdXXV-JPq6L9rHHu_gRVA-1", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>, robert.mader@posteo.de,\n\tkieran.bingham@ideasonboard.com, laurent.pinchart@ideasonboard.com", "Subject": "[PATCH v4 3/3] libcamera: software_isp: Clean up pending requests on\n\tstop", "Date": "Fri, 18 Oct 2024 11:27:16 +0200", "Message-ID": "<20241018092716.295624-4-mzamazal@redhat.com>", "In-Reply-To": "<20241018092716.295624-1-mzamazal@redhat.com>", "References": "<20241018092716.295624-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.4", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true", "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>" }, "content": "PipelineHandler::stop() calls stopDevice() method to perform pipeline\nspecific cleanup and then completes waiting requests. If any queued\nrequests remain, an assertion error is raised.\n\nSoftware ISP stores request buffers in\nSimpleCameraData::conversionQueue_ and queues them as V4L2 signals\nbufferReady. stopDevice() cleanup forgets to clean up the buffers and\ntheir requests from conversionQueue_, possibly resulting in the\nassertion error. This patch fixes the omission.\n\nThe problem wasn't very visible when\nSimplePipelineHandler::kNumInternalBuffers (the number of buffers\nallocated in V4L2) was equal to the number of buffers exported from\nsoftware ISP. But when the number of the exported buffers was increased\nby one in commit abe2ec64f9e4e97bbdfe3a50372611bd7b5315c2, the assertion\nerror started pop up in some environments. Increasing the number of the\nbuffers much more, e.g. to 9, makes the problem very reproducible.\n\nEach pipeline uses its own mechanism to track the requests to clean up\nand it can't be excluded that similar omissions are present in other\nplaces. But there is no obvious way to make a common cleanup for all\nthe pipelines (except for doing it instead of raising the assertion\nerror, which is probably undesirable, in order not to hide incomplete\npipeline specific cleanups).\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=234\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 10 ++++++++++\n 1 file changed, 10 insertions(+)", "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex a1339d87c..995223364 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -284,6 +284,7 @@ public:\n \tstd::vector<std::unique_ptr<FrameBuffer>> conversionBuffers_;\n \tstd::queue<std::pair<Request *, std::map<const Stream *, FrameBuffer *>>> conversionQueue_;\n \tbool useConversion_;\n+\tvoid clearIncompleteRequests();\n \n \tstd::unique_ptr<Converter> converter_;\n \tstd::unique_ptr<SoftwareIsp> swIsp_;\n@@ -893,6 +894,14 @@ void SimpleCameraData::conversionOutputDone(FrameBuffer *buffer)\n \t\tpipe->completeRequest(request);\n }\n \n+void SimpleCameraData::clearIncompleteRequests()\n+{\n+\twhile (!conversionQueue_.empty()) {\n+\t\tpipe()->cancelRequest(conversionQueue_.front().first);\n+\t\tconversionQueue_.pop();\n+\t}\n+}\n+\n void SimpleCameraData::ispStatsReady(uint32_t frame, uint32_t bufferId)\n {\n \tswIsp_->processStats(frame, bufferId,\n@@ -1402,6 +1411,7 @@ void SimplePipelineHandler::stopDevice(Camera *camera)\n \n \tvideo->bufferReady.disconnect(data, &SimpleCameraData::bufferReady);\n \n+\tdata->clearIncompleteRequests();\n \tdata->conversionBuffers_.clear();\n \n \treleasePipeline(data);\n", "prefixes": [ "v4", "3/3" ] }