Patch Detail
Show a patch.
GET /api/1.1/patches/19602/?format=api
{ "id": 19602, "url": "https://patchwork.libcamera.org/api/1.1/patches/19602/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19602/", "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": "<20240301212121.9072-12-laurent.pinchart@ideasonboard.com>", "date": "2024-03-01T21:21:00", "name": "[PATCH/RFC,11/32] libcamera: v4l2_subdevice: Update to the new kernel routing API", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": false, "hash": "5418a8fd1dddab8aa9602c61672939a26927ea7a", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19602/mbox/", "series": [ { "id": 4197, "url": "https://patchwork.libcamera.org/api/1.1/series/4197/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4197", "date": "2024-03-01T21:20:49", "name": "libcamera: Support the upstream Unicam driver", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4197/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19602/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19602/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 0E6C8C3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 1 Mar 2024 21:21:38 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A84B562B3D;\n\tFri, 1 Mar 2024 22:21:37 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1C21262876\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 1 Mar 2024 22:21:36 +0100 (CET)", "from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi\n\t[89.27.53.110])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A60B2A9A;\n\tFri, 1 Mar 2024 22:21:21 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"XkoeKNse\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1709328081;\n\tbh=A/vx4y0whQuSO5nLGsivMVu/Kx0cQsMGQuhbBsWnia0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=XkoeKNseZEN9MMX0Y/V8QbrdKU340a6GRbfejF5UaI2jk56ID/ucR8m/A+Kf1IJz9\n\thlclj0e+b5ijjSqxwqQobZNCcUnxNual8FIUhvSGlP9n/yDXcahp8Xqj+aCpfL0/En\n\t2fDqApccTghfbthZOn0vlOhaYuBtQuCX8Yy1rAKY=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH/RFC 11/32] libcamera: v4l2_subdevice: Update to the new\n\tkernel routing API", "Date": "Fri, 1 Mar 2024 23:21:00 +0200", "Message-ID": "<20240301212121.9072-12-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20240301212121.9072-1-laurent.pinchart@ideasonboard.com>", "References": "<20240301212121.9072-1-laurent.pinchart@ideasonboard.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>", "Cc": "Sakari Ailus <sakari.ailus@iki.fi>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The subdev embedded data support series includes a change to the\nVIDIOC_SUBDEV_G_ROUTING and VIDIOC_SUBDEV_S_ROUTING ioctls that impacts\nthe userspace API.\n\nUpdate to the new API. Backward compatibility can't be easily preserved\nas the ioctl structure size has changed. This is not a major issue, as\nthe routing API isn't enabled in any upstream kernel.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/v4l2_subdevice.cpp | 43 ++++++++++++++++++++++++++------\n 1 file changed, 35 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 3653f57a7d10..d5d400cdfd58 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -1332,19 +1332,23 @@ int V4L2Subdevice::getRouting(Routing *routing, Whence whence)\n \trt.which = whence;\n \n \tint ret = ioctl(VIDIOC_SUBDEV_G_ROUTING, &rt);\n-\tif (ret == 0 || ret == -ENOTTY)\n-\t\treturn ret;\n-\n-\tif (ret != -ENOSPC) {\n-\t\tLOG(V4L2, Error)\n-\t\t\t<< \"Failed to retrieve number of routes: \"\n-\t\t\t<< strerror(-ret);\n+\tif (ret) {\n+\t\tif (ret != -ENOTTY)\n+\t\t\tLOG(V4L2, Error)\n+\t\t\t\t<< \"Failed to retrieve number of routes: \"\n+\t\t\t\t<< strerror(-ret);\n \t\treturn ret;\n \t}\n \n+\tif (!rt.num_routes)\n+\t\treturn 0;\n+\n \tstd::vector<struct v4l2_subdev_route> routes{ rt.num_routes };\n \trt.routes = reinterpret_cast<uintptr_t>(routes.data());\n \n+\trt.len_routes = rt.num_routes;\n+\trt.num_routes = 0;\n+\n \tret = ioctl(VIDIOC_SUBDEV_G_ROUTING, &rt);\n \tif (ret) {\n \t\tLOG(V4L2, Error)\n@@ -1391,6 +1395,7 @@ int V4L2Subdevice::setRouting(Routing *routing, Whence whence)\n \n \tstruct v4l2_subdev_routing rt = {};\n \trt.which = whence;\n+\trt.len_routes = routes.size();\n \trt.num_routes = routes.size();\n \trt.routes = reinterpret_cast<uintptr_t>(routes.data());\n \n@@ -1400,7 +1405,29 @@ int V4L2Subdevice::setRouting(Routing *routing, Whence whence)\n \t\treturn ret;\n \t}\n \n-\troutes.resize(rt.num_routes);\n+\t/*\n+\t * The kernel wants to return more routes than we have space for. We\n+\t * need to issue a VIDIOC_SUBDEV_G_ROUTING call.\n+\t */\n+\tif (rt.num_routes > routes.size()) {\n+\t\troutes.resize(rt.num_routes);\n+\n+\t\trt.len_routes = rt.num_routes;\n+\t\trt.num_routes = 0;\n+\n+\t\tret = ioctl(VIDIOC_SUBDEV_G_ROUTING, &rt);\n+\t\tif (ret) {\n+\t\t\tLOG(V4L2, Error)\n+\t\t\t\t<< \"Failed to retrieve routes: \" << strerror(-ret);\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\tif (rt.num_routes != routes.size()) {\n+\t\tLOG(V4L2, Error) << \"Invalid number of routes\";\n+\t\treturn -EINVAL;\n+\t}\n+\n \trouting->resize(rt.num_routes);\n \n \tfor (const auto &[i, route] : utils::enumerate(routes))\n", "prefixes": [ "PATCH/RFC", "11/32" ] }