Show a patch.

GET /api/1.1/patches/21719/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 21719,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21719/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21719/",
    "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": "<20241021133718.894374-4-mzamazal@redhat.com>",
    "date": "2024-10-21T13:37:18",
    "name": "[v5,3/3] libcamera: software_isp: Clean up pending requests on stop",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e941dc7b6ed69ba464def72063753c3eb5f4d8d6",
    "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/21719/mbox/",
    "series": [
        {
            "id": 4731,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4731/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4731",
            "date": "2024-10-21T13:37:15",
            "name": "Clean up pending requests on stop in software ISP",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/4731/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21719/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21719/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 060D3C32A3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 21 Oct 2024 13:37:53 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 77A156539A;\n\tMon, 21 Oct 2024 15:37:53 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A978765395\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Oct 2024 15:37:50 +0200 (CEST)",
            "from mx-prod-mc-05.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-17-uFU5hYCoPmynEhkpGN88FQ-1;\n\tMon, 21 Oct 2024 09:37:45 -0400",
            "from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.40])\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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 7B29E1955F56; Mon, 21 Oct 2024 13:37:44 +0000 (UTC)",
            "from nuthatch.redhat.com (unknown [10.45.225.218])\n\tby mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 056EA19560AA; Mon, 21 Oct 2024 13:37:41 +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=\"WRKCYu+T\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1729517868;\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=3WoTpRJAP8R/tmlv6Ebuy4dTtvfx1ooV6jThdJPrys4=;\n\tb=WRKCYu+TTJjEPLmGxJHzAPEOlukZBOjPvDfkI7jE8nSPX3E53Hjvw19MjRqAcHeRfKfV09\n\tXxpVv1neOSETGMRYB5SLxY97XgEVK0dX546ks7ozXQei5rx4rVmDW5jnVKy5DQHd4SpUFf\n\t4vcXZFi4ROWO0oOIWNmXeX0ZMsezK2Q=",
        "X-MC-Unique": "uFU5hYCoPmynEhkpGN88FQ-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 v5 3/3] libcamera: software_isp: Clean up pending requests on\n\tstop",
        "Date": "Mon, 21 Oct 2024 15:37:18 +0200",
        "Message-ID": "<20241021133718.894374-4-mzamazal@redhat.com>",
        "In-Reply-To": "<20241021133718.894374-1-mzamazal@redhat.com>",
        "References": "<20241021133718.894374-1-mzamazal@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.40",
        "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 f3a6b1635..6b1121c34 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -288,6 +288,7 @@ public:\n \t};\n \tstd::queue<RequestOutputs> conversionQueue_;\n \tbool useConversion_;\n+\tvoid clearIncompleteRequests();\n \n \tstd::unique_ptr<Converter> converter_;\n \tstd::unique_ptr<SoftwareIsp> swIsp_;\n@@ -897,6 +898,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().request);\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@@ -1406,6 +1415,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": [
        "v5",
        "3/3"
    ]
}