Patch Detail
Show a patch.
GET /api/patches/8399/?format=api
{ "id": 8399, "url": "https://patchwork.libcamera.org/api/patches/8399/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8399/", "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": "<20200624145256.48266-2-paul.elder@ideasonboard.com>", "date": "2020-06-24T14:52:35", "name": "[libcamera-devel,v4,01/22] v4l2: v4l2_camera_file: Add V4L2CameraFile to model the opened camera file", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "db9ffca63fb3dd0b8dc107e48f4da34427ec18ee", "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/8399/mbox/", "series": [ { "id": 1041, "url": "https://patchwork.libcamera.org/api/series/1041/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1041", "date": "2020-06-24T14:52:34", "name": "Support v4l2-compliance", "version": 4, "mbox": "https://patchwork.libcamera.org/series/1041/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/8399/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8399/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 4930760103\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Jun 2020 16:53:18 +0200 (CEST)", "from jade.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:8147:f2a2:a8c6:9087])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DA9142A8;\n\tWed, 24 Jun 2020 16:53:15 +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=\"jRjffJ5o\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593010397;\n\tbh=6mIM5PBpg8o0x92o8pBhs6mUlFj0aBmX5X01zeq6HVA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=jRjffJ5oB/NACXdK3hFZnxSDgmUd9VpklFBBwo88nWwJvSZsLZaL9DyS8/s7lknfn\n\tXpUH1XnU+lz6Wfr92Q9pPe0VO/a3dNCmqmcRo/hF9+4VjfaB1ZWAvYhaZeisDGibYy\n\t/3Ql1gPVTe2Aa+ibLthprLquL1dukeoYqMQhjrTk=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 24 Jun 2020 23:52:35 +0900", "Message-Id": "<20200624145256.48266-2-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200624145256.48266-1-paul.elder@ideasonboard.com>", "References": "<20200624145256.48266-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 01/22] v4l2: v4l2_camera_file: Add\n\tV4L2CameraFile to model the opened camera file", "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, 24 Jun 2020 14:53:18 -0000" }, "content": "With relation to opening files, the kernel has three objects related to\nfiles:\n- inodes, that represent files on disk\n- file objects, that are allocated at open() time and store all data\n related to the open file\n- file descriptors, that are integers that map to a file\n\nIn the V4L2 compatibility layer, V4L2CameraProxy, which wraps a single\nlibcamera camera via V4L2Camera, is more or less equivalent to the\ninode. We also already have file descriptors (that are really eventfds)\nthat mirror the file descriptors. Here we create a V4L2CameraFile to\nmodel the file objects, to contain information related to the open file,\nnamely if the file has been opened as non-blocking, and the V4L2\npriority (to support VIDIOC_G/S_PRIORITY later on). This new class\nallows us to more cleanly support multiple open later on, since we can\nmove out of V4L2CameraProxy the handling of mapping the fd to the open\nfile information.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nNo change in v4\n\nChanges in v3:\n- cosmetic changes\n- change public V4L2CameraFile::priority_ to private with public getter\n and setter\n\nNew in v2\n---\n src/v4l2/meson.build | 1 +\n src/v4l2/v4l2_camera_file.cpp | 26 ++++++++++++++++++++++++\n src/v4l2/v4l2_camera_file.h | 37 +++++++++++++++++++++++++++++++++++\n 3 files changed, 64 insertions(+)\n create mode 100644 src/v4l2/v4l2_camera_file.cpp\n create mode 100644 src/v4l2/v4l2_camera_file.h", "diff": "diff --git a/src/v4l2/meson.build b/src/v4l2/meson.build\nindex f2e4aaf..e3838f0 100644\n--- a/src/v4l2/meson.build\n+++ b/src/v4l2/meson.build\n@@ -2,6 +2,7 @@\n \n v4l2_compat_sources = files([\n 'v4l2_camera.cpp',\n+ 'v4l2_camera_file.cpp',\n 'v4l2_camera_proxy.cpp',\n 'v4l2_compat.cpp',\n 'v4l2_compat_manager.cpp',\ndiff --git a/src/v4l2/v4l2_camera_file.cpp b/src/v4l2/v4l2_camera_file.cpp\nnew file mode 100644\nindex 0000000..d3232ab\n--- /dev/null\n+++ b/src/v4l2/v4l2_camera_file.cpp\n@@ -0,0 +1,26 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2020, Google Inc.\n+ *\n+ * v4l2_camera_file.h - V4L2 compatibility camera file information\n+ */\n+\n+#include \"v4l2_camera_file.h\"\n+\n+#include <linux/videodev2.h>\n+\n+#include \"v4l2_camera_proxy.h\"\n+\n+using namespace libcamera;\n+\n+V4L2CameraFile::V4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy)\n+\t: proxy_(proxy), nonBlocking_(nonBlocking), efd_(efd),\n+\t priority_(V4L2_PRIORITY_DEFAULT)\n+{\n+\tproxy_->open(nonBlocking);\n+}\n+\n+V4L2CameraFile::~V4L2CameraFile()\n+{\n+\tproxy_->close();\n+}\ndiff --git a/src/v4l2/v4l2_camera_file.h b/src/v4l2/v4l2_camera_file.h\nnew file mode 100644\nindex 0000000..8f4670a\n--- /dev/null\n+++ b/src/v4l2/v4l2_camera_file.h\n@@ -0,0 +1,37 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2020, Google Inc.\n+ *\n+ * v4l2_camera_file.h - V4L2 compatibility camera file information\n+ */\n+\n+#ifndef __V4L2_CAMERA_FILE_H__\n+#define __V4L2_CAMERA_FILE_H__\n+\n+#include <linux/videodev2.h>\n+\n+class V4L2CameraProxy;\n+\n+class V4L2CameraFile\n+{\n+public:\n+\tV4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy);\n+\t~V4L2CameraFile();\n+\n+\tV4L2CameraProxy *proxy() const { return proxy_; }\n+\n+\tbool nonBlocking() const { return nonBlocking_; }\n+\tint efd() const { return efd_; }\n+\n+\tenum v4l2_priority priority() const { return priority_; }\n+\tvoid setPriority(enum v4l2_priority priority) { priority_ = priority; }\n+\n+private:\n+\tV4L2CameraProxy *proxy_;\n+\n+\tbool nonBlocking_;\n+\tint efd_;\n+\tenum v4l2_priority priority_;\n+};\n+\n+#endif /* __V4L2_CAMERA_FILE_H__ */\n", "prefixes": [ "libcamera-devel", "v4", "01/22" ] }