Patch Detail
Show a patch.
GET /api/1.1/patches/15231/?format=api
{ "id": 15231, "url": "https://patchwork.libcamera.org/api/1.1/patches/15231/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15231/", "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": "<20211228215951.32396-6-laurent.pinchart@ideasonboard.com>", "date": "2021-12-28T21:59:51", "name": "[libcamera-devel,v1,5/5] v4l2: v4l2_camera_proxy: Use file description in debug messages", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "a6e095350d507a43f6286ae5d2180785a182e098", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": { "id": 14, "url": "https://patchwork.libcamera.org/api/1.1/users/14/?format=api", "username": "pinchartl", "first_name": "Laurent", "last_name": "Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/15231/mbox/", "series": [ { "id": 2870, "url": "https://patchwork.libcamera.org/api/1.1/series/2870/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2870", "date": "2021-12-28T21:59:46", "name": "libcamera: Improve debug messages in V4L2 compat layer", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2870/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15231/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15231/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 30A4FBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Dec 2021 22:00:07 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BD8446090D;\n\tTue, 28 Dec 2021 23:00:06 +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 A93786091A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Dec 2021 22:59:59 +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 4727A895\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Dec 2021 22:59:59 +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=\"hQjJkXpt\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1640728799;\n\tbh=eJoX2ye7HNkZYahMKX0B6FF8m61c0oNmmEEPOXFp4y0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=hQjJkXpt0FIH0LHAot91yXdx7mDCHlOezfyUgHnSUJ55lmgB9AMkp6aSA0bpGlYr/\n\tSxqYpYdlZC24xBFe6/9zfIFEdivuJjtg6sOW7zU/LhzmxjEM7BcLt6Lz6DZykbcwTr\n\te+f87psVpj2UF6/p1orazXYGHxobiNPPPmbVQ4w0=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 28 Dec 2021 23:59:51 +0200", "Message-Id": "<20211228215951.32396-6-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.33.1", "In-Reply-To": "<20211228215951.32396-1-laurent.pinchart@ideasonboard.com>", "References": "<20211228215951.32396-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v1 5/5] v4l2: v4l2_camera_proxy: Use file\n\tdescription in debug messages", "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": "Debug messages in V4L2CameraProxy print the numerical file descriptor,\nwhich isn't very human-friendly. Replace it with the V4L2CameraFile\ndescription that includes the full path. While at it, refactor the\nmessages to use __func__ instead of manually copying function names.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/v4l2/v4l2_camera_proxy.cpp | 74 ++++++++++++++++++++------------\n src/v4l2/v4l2_camera_proxy.h | 7 +--\n src/v4l2/v4l2_compat_manager.cpp | 5 ++-\n 3 files changed, 54 insertions(+), 32 deletions(-)", "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 80e6624bc9b7..5ccf40b9692c 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -46,7 +46,8 @@ V4L2CameraProxy::V4L2CameraProxy(unsigned int index,\n \n int V4L2CameraProxy::open(V4L2CameraFile *file)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing open fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tMutexLocker locker(proxyMutex_);\n \n@@ -80,7 +81,8 @@ int V4L2CameraProxy::open(V4L2CameraFile *file)\n \n void V4L2CameraProxy::close(V4L2CameraFile *file)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing close fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tMutexLocker locker(proxyMutex_);\n \n@@ -94,10 +96,11 @@ void V4L2CameraProxy::close(V4L2CameraFile *file)\n \tvcam_->close();\n }\n \n-void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags,\n-\t\t\t off64_t offset)\n+void *V4L2CameraProxy::mmap(V4L2CameraFile *file, void *addr, size_t length,\n+\t\t\t int prot, int flags, off64_t offset)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing mmap\";\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tMutexLocker locker(proxyMutex_);\n \n@@ -131,9 +134,10 @@ void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags,\n \treturn map;\n }\n \n-int V4L2CameraProxy::munmap(void *addr, size_t length)\n+int V4L2CameraProxy::munmap(V4L2CameraFile *file, void *addr, size_t length)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing munmap\";\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tMutexLocker locker(proxyMutex_);\n \n@@ -233,9 +237,10 @@ void V4L2CameraProxy::updateBuffers()\n \t}\n }\n \n-int V4L2CameraProxy::vidioc_querycap(struct v4l2_capability *arg)\n+int V4L2CameraProxy::vidioc_querycap(V4L2CameraFile *file, struct v4l2_capability *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_querycap\";\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \t*arg = capabilities_;\n \n@@ -244,7 +249,8 @@ int V4L2CameraProxy::vidioc_querycap(struct v4l2_capability *arg)\n \n int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_frmsizeenum *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_framesizes fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->pixel_format);\n \tPixelFormat format = v4l2Format.toPixelFormat();\n@@ -267,7 +273,8 @@ int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_fr\n \n int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_fmt fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (!validateBufferType(arg->type) ||\n \t arg->index >= streamConfig_.formats().pixelformats().size())\n@@ -288,7 +295,8 @@ int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *\n \n int V4L2CameraProxy::vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_g_fmt fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (!validateBufferType(arg->type))\n \t\treturn -EINVAL;\n@@ -331,7 +339,8 @@ int V4L2CameraProxy::tryFormat(struct v4l2_format *arg)\n \n int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_s_fmt fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (!validateBufferType(arg->type))\n \t\treturn -EINVAL;\n@@ -361,7 +370,8 @@ int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n \n int V4L2CameraProxy::vidioc_try_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_try_fmt fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (!validateBufferType(arg->type))\n \t\treturn -EINVAL;\n@@ -384,7 +394,8 @@ enum v4l2_priority V4L2CameraProxy::maxPriority()\n \n int V4L2CameraProxy::vidioc_g_priority(V4L2CameraFile *file, enum v4l2_priority *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_g_priority fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \t*arg = maxPriority();\n \n@@ -394,7 +405,7 @@ int V4L2CameraProxy::vidioc_g_priority(V4L2CameraFile *file, enum v4l2_priority\n int V4L2CameraProxy::vidioc_s_priority(V4L2CameraFile *file, enum v4l2_priority *arg)\n {\n \tLOG(V4L2Compat, Debug)\n-\t\t<< \"Servicing vidioc_s_priority fd = \" << file->efd();\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (*arg > V4L2_PRIORITY_RECORD)\n \t\treturn -EINVAL;\n@@ -409,7 +420,8 @@ int V4L2CameraProxy::vidioc_s_priority(V4L2CameraFile *file, enum v4l2_priority\n \n int V4L2CameraProxy::vidioc_enuminput(V4L2CameraFile *file, struct v4l2_input *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enuminput fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (arg->index != 0)\n \t\treturn -EINVAL;\n@@ -426,7 +438,8 @@ int V4L2CameraProxy::vidioc_enuminput(V4L2CameraFile *file, struct v4l2_input *a\n \n int V4L2CameraProxy::vidioc_g_input(V4L2CameraFile *file, int *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_g_input fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \t*arg = 0;\n \n@@ -435,7 +448,8 @@ int V4L2CameraProxy::vidioc_g_input(V4L2CameraFile *file, int *arg)\n \n int V4L2CameraProxy::vidioc_s_input(V4L2CameraFile *file, int *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_s_input fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (*arg != 0)\n \t\treturn -EINVAL;\n@@ -452,7 +466,8 @@ void V4L2CameraProxy::freeBuffers()\n \n int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuffers *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_reqbufs fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (!validateBufferType(arg->type) ||\n \t !validateMemoryType(arg->memory))\n@@ -526,7 +541,8 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n \n int V4L2CameraProxy::vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_querybuf fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (arg->index >= bufferCount_)\n \t\treturn -EINVAL;\n@@ -544,8 +560,9 @@ int V4L2CameraProxy::vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *a\n \n int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_qbuf, index = \"\n-\t\t\t << arg->index << \" fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__\n+\t\t<< \"(index=\" << arg->index << \")\";\n \n \tif (arg->index >= bufferCount_)\n \t\treturn -EINVAL;\n@@ -575,7 +592,8 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n \t\t\t\t Mutex *lock)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_dqbuf fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (arg->index >= bufferCount_)\n \t\treturn -EINVAL;\n@@ -624,7 +642,8 @@ int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n \n int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *file, int *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_streamon fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (bufferCount_ == 0)\n \t\treturn -EINVAL;\n@@ -648,7 +667,8 @@ int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *file, int *arg)\n \n int V4L2CameraProxy::vidioc_streamoff(V4L2CameraFile *file, int *arg)\n {\n-\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_streamoff fd = \" << file->efd();\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n \tif (!validateBufferType(*arg))\n \t\treturn -EINVAL;\n@@ -709,7 +729,7 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long request, void *ar\n \tint ret;\n \tswitch (request) {\n \tcase VIDIOC_QUERYCAP:\n-\t\tret = vidioc_querycap(static_cast<struct v4l2_capability *>(arg));\n+\t\tret = vidioc_querycap(file, static_cast<struct v4l2_capability *>(arg));\n \t\tbreak;\n \tcase VIDIOC_ENUM_FRAMESIZES:\n \t\tret = vidioc_enum_framesizes(file, static_cast<struct v4l2_frmsizeenum *>(arg));\ndiff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\nindex fa0a49e0439b..08f0295a92dd 100644\n--- a/src/v4l2/v4l2_camera_proxy.h\n+++ b/src/v4l2/v4l2_camera_proxy.h\n@@ -29,8 +29,9 @@ public:\n \n \tint open(V4L2CameraFile *file);\n \tvoid close(V4L2CameraFile *file);\n-\tvoid *mmap(void *addr, size_t length, int prot, int flags, off64_t offset);\n-\tint munmap(void *addr, size_t length);\n+\tvoid *mmap(V4L2CameraFile *file, void *addr, size_t length, int prot,\n+\t\t int flags, off64_t offset);\n+\tint munmap(V4L2CameraFile *file, void *addr, size_t length);\n \n \tint ioctl(V4L2CameraFile *file, unsigned long request, void *arg);\n \n@@ -44,7 +45,7 @@ private:\n \tvoid updateBuffers();\n \tvoid freeBuffers();\n \n-\tint vidioc_querycap(struct v4l2_capability *arg);\n+\tint vidioc_querycap(V4L2CameraFile *file, struct v4l2_capability *arg);\n \tint vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_frmsizeenum *arg);\n \tint vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg);\n \tint vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg);\ndiff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp\nindex ded568beb60e..0f7575c54b22 100644\n--- a/src/v4l2/v4l2_compat_manager.cpp\n+++ b/src/v4l2/v4l2_compat_manager.cpp\n@@ -194,7 +194,8 @@ void *V4L2CompatManager::mmap(void *addr, size_t length, int prot, int flags,\n \tif (!file)\n \t\treturn fops_.mmap(addr, length, prot, flags, fd, offset);\n \n-\tvoid *map = file->proxy()->mmap(addr, length, prot, flags, offset);\n+\tvoid *map = file->proxy()->mmap(file.get(), addr, length, prot, flags,\n+\t\t\t\t\toffset);\n \tif (map == MAP_FAILED)\n \t\treturn map;\n \n@@ -210,7 +211,7 @@ int V4L2CompatManager::munmap(void *addr, size_t length)\n \n \tV4L2CameraFile *file = device->second.get();\n \n-\tint ret = file->proxy()->munmap(addr, length);\n+\tint ret = file->proxy()->munmap(file, addr, length);\n \tif (ret < 0)\n \t\treturn ret;\n \n", "prefixes": [ "libcamera-devel", "v1", "5/5" ] }