Patch Detail
Show a patch.
GET /api/patches/14831/?format=api
{ "id": 14831, "url": "https://patchwork.libcamera.org/api/patches/14831/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14831/", "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": "<20211128235752.10836-17-laurent.pinchart@ideasonboard.com>", "date": "2021-11-28T23:57:51", "name": "[libcamera-devel,v3,16/17] v4l2: v4l2_camera: Return int in getBufferFd()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "fbbf9d57c2e92c2a17e8ad248ae865413e2b6d2b", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14831/mbox/", "series": [ { "id": 2768, "url": "https://patchwork.libcamera.org/api/series/2768/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2768", "date": "2021-11-28T23:57:35", "name": "libcamera: Introduce UniqueFD", "version": 3, "mbox": "https://patchwork.libcamera.org/series/2768/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14831/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14831/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 3FF32BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 28 Nov 2021 23:58:41 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DF0C66057D;\n\tMon, 29 Nov 2021 00:58:40 +0100 (CET)", "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 5835C605BA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 00:58:28 +0100 (CET)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DFD76A15;\n\tMon, 29 Nov 2021 00:58:27 +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=\"FAmLk1QI\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638143908;\n\tbh=sxelJUYeWdlBpBv7l7ZwyQ7eMmEYLFVw22ze63Qx6bg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=FAmLk1QIibJPJooFh8BbS8x4chBKjqW7HGCNAByXWLwNSpxeDUPpTi/fneP1iMT4s\n\tNgXnid5Z2xFAbgifwSC0NJnQk4ROq5iJtRs7NkaGOjIieiuiYvA5bjBOnNznjBGynz\n\tjTnF87l/04mTxEh6PLyuyhqjYwfWNRUY+q6erSLk=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 29 Nov 2021 01:57:51 +0200", "Message-Id": "<20211128235752.10836-17-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20211128235752.10836-1-laurent.pinchart@ideasonboard.com>", "References": "<20211128235752.10836-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 16/17] v4l2: v4l2_camera: Return int in\n\tgetBufferFd()", "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: Hirokazu Honda <hiroh@chromium.org>\n\nV4L2Camera::getBufferFd() returns FileDescriptor. However, the\nfile descriptor is still owned by V4L2Camera. It should rather\nreturn an integer to represent V4L2Camera doesn't have the\nownership of the file descriptor.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/v4l2/v4l2_camera.cpp | 6 +++---\n src/v4l2/v4l2_camera.h | 2 +-\n src/v4l2/v4l2_camera_proxy.cpp | 6 +++---\n 3 files changed, 7 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp\nindex 157ab94e0544..464507505c79 100644\n--- a/src/v4l2/v4l2_camera.cpp\n+++ b/src/v4l2/v4l2_camera.cpp\n@@ -186,16 +186,16 @@ void V4L2Camera::freeBuffers()\n \tbufferAllocator_->free(stream);\n }\n \n-FileDescriptor V4L2Camera::getBufferFd(unsigned int index)\n+int V4L2Camera::getBufferFd(unsigned int index)\n {\n \tStream *stream = config_->at(0).stream();\n \tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers =\n \t\tbufferAllocator_->buffers(stream);\n \n \tif (buffers.size() <= index)\n-\t\treturn FileDescriptor();\n+\t\treturn -1;\n \n-\treturn buffers[index]->planes()[0].fd;\n+\treturn buffers[index]->planes()[0].fd.fd();\n }\n \n int V4L2Camera::streamOn()\ndiff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h\nindex 0cea111561dd..9817fd393d59 100644\n--- a/src/v4l2/v4l2_camera.h\n+++ b/src/v4l2/v4l2_camera.h\n@@ -51,7 +51,7 @@ public:\n \n \tint allocBuffers(unsigned int count);\n \tvoid freeBuffers();\n-\tlibcamera::FileDescriptor getBufferFd(unsigned int index);\n+\tint getBufferFd(unsigned int index);\n \n \tint streamOn();\n \tint streamOff();\ndiff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 3610e63cade3..627e38d90f5b 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -114,14 +114,14 @@ void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags,\n \t\treturn MAP_FAILED;\n \t}\n \n-\tFileDescriptor fd = vcam_->getBufferFd(index);\n-\tif (!fd.isValid()) {\n+\tint fd = vcam_->getBufferFd(index);\n+\tif (fd < 0) {\n \t\terrno = EINVAL;\n \t\treturn MAP_FAILED;\n \t}\n \n \tvoid *map = V4L2CompatManager::instance()->fops().mmap(addr, length, prot,\n-\t\t\t\t\t\t\t flags, fd.fd(), 0);\n+\t\t\t\t\t\t\t flags, fd, 0);\n \tif (map == MAP_FAILED)\n \t\treturn map;\n \n", "prefixes": [ "libcamera-devel", "v3", "16/17" ] }