Patch Detail
Show a patch.
GET /api/1.1/patches/3908/?format=api
{ "id": 3908, "url": "https://patchwork.libcamera.org/api/1.1/patches/3908/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3908/", "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": "<20200603141609.18584-5-paul.elder@ideasonboard.com>", "date": "2020-06-03T14:16:08", "name": "[libcamera-devel,4/5] v4l2: v4l2_camera_proxy: Don't return -EINVAL for zero sizeimage in REQBUFS", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "f5206f895db47b5dcea65ca39f54995f30f36cfd", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3908/mbox/", "series": [ { "id": 946, "url": "https://patchwork.libcamera.org/api/1.1/series/946/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=946", "date": "2020-06-03T14:16:04", "name": "Support qv4l2 with v4l2-compat", "version": 1, "mbox": "https://patchwork.libcamera.org/series/946/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3908/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3908/checks/", "tags": {}, "headers": { "Return-Path": "<paul.elder@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AB4576115D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 3 Jun 2020 16:16:28 +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 0F9A827C;\n\tWed, 3 Jun 2020 16:16:26 +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=\"CXHw+/VC\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591193788;\n\tbh=fzX5dsUHNWEcVPbQjILd17OrXxrDz+27H6d9cGGr7dE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=CXHw+/VC1HXIq6EptMay9rW55nuHsVAvYvq9s9S8lnPRcTvSAFfPQOIw+JASmwbZL\n\tD81OGEJJtbTJqcxzrM8Lbfxq+EF4bOJdQqX9eycA5W4uRI5APH05QYp4b0wC/wGy+4\n\tcMYWQxKqeS3OjQ5yXu92t4Zfo3zdmFmhKEl3TiVg=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 3 Jun 2020 23:16:08 +0900", "Message-Id": "<20200603141609.18584-5-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20200603141609.18584-1-paul.elder@ideasonboard.com>", "References": "<20200603141609.18584-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 4/5] v4l2: v4l2_camera_proxy: Don't return\n\t-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": "Wed, 03 Jun 2020 14:16:29 -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.\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 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 d2419b96..f84982a2 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. MJPG),\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", "4/5" ] }