Show a patch.

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

{
    "id": 21246,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21246/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21246/",
    "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": "<20240912051409.3495486-2-chenghaoyang@google.com>",
    "date": "2024-09-12T05:09:39",
    "name": "[1/1] libcamera: Put buffer back to V4L2BufferCache when VIDIOC_QBUF fails",
    "commit_ref": "835c1bf35ecf402b5fb13a8cd2ac56e9f22dc585",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e40e9056ab46be9387930f14907eef729ae3e435",
    "submitter": {
        "id": 117,
        "url": "https://patchwork.libcamera.org/api/1.1/people/117/?format=api",
        "name": "Cheng-Hao Yang",
        "email": "chenghaoyang@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21246/mbox/",
    "series": [
        {
            "id": 4584,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4584/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4584",
            "date": "2024-09-12T05:09:38",
            "name": "Recycle V4L2BufferCache when VIDIOC_QBUF fails",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4584/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21246/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21246/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 235D7BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 12 Sep 2024 05:14:22 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D9496634FF;\n\tThu, 12 Sep 2024 07:14:20 +0200 (CEST)",
            "from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com\n\t[IPv6:2607:f8b0:4864:20::1029])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D6E04618F0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Sep 2024 07:14:17 +0200 (CEST)",
            "by mail-pj1-x1029.google.com with SMTP id\n\t98e67ed59e1d1-2d8881850d9so435776a91.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 11 Sep 2024 22:14:17 -0700 (PDT)",
            "from chenghaoyang-low.c.googlers.com.com\n\t(208.158.221.35.bc.googleusercontent.com. [35.221.158.208])\n\tby smtp.gmail.com with ESMTPSA id\n\t98e67ed59e1d1-2db0419aab4sm9599977a91.15.2024.09.11.22.14.14\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 11 Sep 2024 22:14:14 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"WRWAYCKP\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1726118055; x=1726722855;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=7+fqqkDQ80DgARYQpLwDpjYvmrJNNkk0b7z3EHMkHGU=;\n\tb=WRWAYCKPP30n9GsMQpJip3GFj0e93Pb63IKuRWV/fVJ58PeXbuZOhDWmNI3BJYVsqo\n\t2nRulB5CrQmhhG7fOYuowikyw4ZftCpSH3MZ4xD07O5MY1Djyf62SMQDdMxEIX3puIYp\n\t/XfHdT0i6W14uiNeeZitOeGNJT+x4KB9RkkBs=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1726118055; x=1726722855;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=7+fqqkDQ80DgARYQpLwDpjYvmrJNNkk0b7z3EHMkHGU=;\n\tb=ByFx7y/YaWT5FSu6bLYb9+cfRfsSkRF/0SIVVyuGrmiQliYDqcWmRzRcGU59SR4AbZ\n\tczpqw4iEJQMKUCQ4jn9qeYU/EU3JyfrVlT9QSuqO32eu1Cl4a43r2TwQDOZkivAE2UFv\n\t3Otc8npxkXIny2qaOCHP5ABlFmJdDt5mWaDt0rXXyZ6ZdM8JZVZoPbfDTaWFecMkC866\n\tIqYhF9RGtgNXACABaxLNoHO2FQLZmlRvjT9T01gzeRlDw0Gb6/JNw4aAkPvzCmaDQPQG\n\tpmVJJPkLDTBOo4irEVa/dapqlHMhtxkJEwWZVrisCcjr6jyMm4cBksPiVPpQhBMNiwaW\n\tODng==",
        "X-Gm-Message-State": "AOJu0Yw5NVGjOunaZqmxoDoLBzoOzufMV+li5FCLzchle//VKZGBcyZ4\n\t5Z5LlBqXLeOvnstjgPvcMSt+fR0jTznInDsLXYt20o6vJGidjhnjYPZjHNDYCQKEuD76Q+q6dP4\n\t=",
        "X-Google-Smtp-Source": "AGHT+IGrCBBYrIlEiLLEgpBNxzrFzhgiG/iKiu57iOoIWIaNhnz6eUEUW5OmT8f/jwJGNKz/xI4elA==",
        "X-Received": "by 2002:a17:90a:4906:b0:2d8:9c97:3c33 with SMTP id\n\t98e67ed59e1d1-2dba0061173mr1662525a91.28.1726118055496; \n\tWed, 11 Sep 2024 22:14:15 -0700 (PDT)",
        "From": "Harvey Yang <chenghaoyang@chromium.org>",
        "X-Google-Original-From": "Harvey Yang <chenghaoyang@google.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Han-Lin Chen <hanlinchen@chromium.org>,\n\tHarvey Yang <chenghaoyang@chromium.org>",
        "Subject": "[PATCH 1/1] libcamera: Put buffer back to V4L2BufferCache when\n\tVIDIOC_QBUF fails",
        "Date": "Thu, 12 Sep 2024 05:09:39 +0000",
        "Message-ID": "<20240912051409.3495486-2-chenghaoyang@google.com>",
        "X-Mailer": "git-send-email 2.46.0.598.g6f2099f65c-goog",
        "In-Reply-To": "<20240912051409.3495486-1-chenghaoyang@google.com>",
        "References": "<20240912051409.3495486-1-chenghaoyang@google.com>",
        "MIME-Version": "1.0",
        "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>"
    },
    "content": "From: Han-Lin Chen <hanlinchen@chromium.org>\n\nThe patch puts buffer back to V4L2BufferCache when VIDIOC_QBUF fails\nin V4L2VideoDevice. This is to avoid cache leaks and causing assert.\n\nSigned-off-by: Han-Lin Chen <hanlinchen@chromium.org>\nCo-developed-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n src/libcamera/v4l2_videodevice.cpp | 8 ++++++++\n 1 file changed, 8 insertions(+)",
    "diff": "diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 76742e18..75a2cdb1 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1626,11 +1626,15 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n \t */\n \tif (planes.size() < numV4l2Planes) {\n \t\tLOG(V4L2, Error) << \"Frame buffer has too few planes\";\n+\t\tcache_->put(buf.index);\n+\n \t\treturn -EINVAL;\n \t}\n \n \tif (planes.size() != numV4l2Planes && !buffer->_d()->isContiguous()) {\n \t\tLOG(V4L2, Error) << \"Device format requires contiguous buffer\";\n+\t\tcache_->put(buf.index);\n+\n \t\treturn -EINVAL;\n \t}\n \n@@ -1673,6 +1677,8 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n \t\t\t\tif (i != planes.size() - 1 && bytesused != length) {\n \t\t\t\t\tLOG(V4L2, Error)\n \t\t\t\t\t\t<< \"Holes in multi-planar buffer not supported\";\n+\t\t\t\t\tcache_->put(buf.index);\n+\n \t\t\t\t\treturn -EINVAL;\n \t\t\t\t}\n \t\t\t}\n@@ -1722,6 +1728,8 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Failed to queue buffer \" << buf.index << \": \"\n \t\t\t<< strerror(-ret);\n+\t\tcache_->put(buf.index);\n+\n \t\treturn ret;\n \t}\n \n",
    "prefixes": [
        "1/1"
    ]
}