Show a patch.

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

{
    "id": 3940,
    "url": "https://patchwork.libcamera.org/api/patches/3940/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3940/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20200605090106.15424-6-paul.elder@ideasonboard.com>",
    "date": "2020-06-05T09:01:04",
    "name": "[libcamera-devel,v2,5/7] v4l2: v4l2_camera_proxy: Don't return -EINVAL for zero sizeimage in REQBUFS",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f3895414e9b64b676a15cb4e6f04677348fa08ea",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3940/mbox/",
    "series": [
        {
            "id": 956,
            "url": "https://patchwork.libcamera.org/api/series/956/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=956",
            "date": "2020-06-05T09:00:59",
            "name": "Support qv4l2 with v4l2-compat",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/956/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3940/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3940/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<paul.elder@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 006EE6124F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Jun 2020 11:01:24 +0200 (CEST)",
            "from emerald.amanokami.net (fs76eef344.knge213.ap.nuro.jp\n\t[118.238.243.68])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CD86F27C;\n\tFri,  5 Jun 2020 11:01:22 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"lsl5tw/y\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591347683;\n\tbh=eqVGWxLcEElmdrGmRBqiyy8NYrlqldzJ/gMwEMcKe1c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=lsl5tw/yoUsF3yW/pfke3lz+9DNju3R5uvrgkR0bnt9/CpjWmPIm6WIi/Bh+7HdGw\n\t1cxW4w8/plWitFl9IwG/93G9DQ461Xs1WHaCCRW3KnXTgwSO51X4C4rCQOwFDICClY\n\tRH5GI5UPZxjTYRSpcVx06ZorxtoQelD5Tv+AHGi0=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  5 Jun 2020 18:01:04 +0900",
        "Message-Id": "<20200605090106.15424-6-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20200605090106.15424-1-paul.elder@ideasonboard.com>",
        "References": "<20200605090106.15424-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 5/7] v4l2: v4l2_camera_proxy: Don't\n\treturn -EINVAL for zero sizeimage in REQBUFS",
        "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>",
        "X-List-Received-Date": "Fri, 05 Jun 2020 09:01:24 -0000"
    },
    "content": "If VIDIOC_REQBUFS returns -EINVAL, it signals to the application that\nthe requested buffer or memory type is not supported. If we return\n-EINVAL due to a zero sizeimage, then the application will think that we\ndon't support a memory type that we actually do. We cannot error on a\nzero sizeimage, because reqbufs could be called merely to probe what IO\nmethods we support; qv4l2, for example, called reqbufs once with userptr\nand once more with mmap, both times with count=1.\n\nOn the other hand, sizeimage will be zero for formats whose size we\ndon't know how to calculate, such as MJPEG. If we try to stream such\nformats anyway, we will get a floating point exception and crash. Issue\na warning for now, and don't return -EINVAL, so that we can continue\noperation.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v2: expand changelog\n---\n src/v4l2/v4l2_camera_proxy.cpp | 12 +++++++++++-\n 1 file changed, 11 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex a0c6deea..cbe9e026 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -352,8 +352,18 @@ int V4L2CameraProxy::vidioc_reqbufs(struct v4l2_requestbuffers *arg)\n \t\treturn -EINVAL;\n \n \tsizeimage_ = calculateSizeImage(streamConfig_);\n+\t/*\n+\t * If we return -EINVAL here then the application will think that we\n+\t * don't support streaming mmap. Since we don't support readwrite and\n+\t * userptr either, the application will get confused and think that\n+\t * we don't support anything.\n+\t * On the other hand, if a format has a zero sizeimage (eg. MJPEG),\n+\t * we'll get a floating point exception when we try to stream it.\n+\t */\n \tif (sizeimage_ == 0)\n-\t\treturn -EINVAL;\n+\t\tLOG(V4L2Compat, Warning)\n+\t\t\t<< \"sizeimage of at least one format is zero. \"\n+\t\t\t<< \"Streaming this format will cause a floating point exception.\";\n \n \tsetFmtFromConfig(streamConfig_);\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "5/7"
    ]
}