Patch Detail
Show a patch.
GET /api/1.1/patches/17988/?format=api
{ "id": 17988, "url": "https://patchwork.libcamera.org/api/1.1/patches/17988/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17988/", "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": "<20221213091558.621950-6-paul.elder@ideasonboard.com>", "date": "2022-12-13T09:15:56", "name": "[libcamera-devel,v2,5/7] tracepoints: v4l2: Add tracepoints for tracking buffer lifetime", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "a79b40a18c3bd290161be29e47e04997a31440ac", "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/17988/mbox/", "series": [ { "id": 3668, "url": "https://patchwork.libcamera.org/api/1.1/series/3668/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3668", "date": "2022-12-13T09:15:51", "name": "tracepoints: request: Improve request tracepoints", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3668/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17988/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17988/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 23D54C328D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Dec 2022 09:16:22 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D00B96336E;\n\tTue, 13 Dec 2022 10:16:21 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 33B3363362\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Dec 2022 10:16:19 +0100 (CET)", "from pyrite.tail37cf.ts.net (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EC5164A7;\n\tTue, 13 Dec 2022 10:16:17 +0100 (CET)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1670922981;\n\tbh=RBr4bT1bI9efjqqwFc9pjDaNt8QG7v1WHc89a0WZTv0=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=ZABTxtygFOaOj/YlNuxYNE5VJY/mxbVNUa8B/NHy+l6sMtz9ahg9nJIKwIWnqCbwM\n\t95jTvH4TUs4TSn9qyQMLlJsrJa/LypjuWWDCxSiLAhVXMs8sXcsIx6LlGf2XjmdPif\n\tjnRygntfTIUKH/o97wWm/QbunRUT21o6TGxEmSGXC2RawG3JXUwrPhFLZ8nggQgitc\n\t0gSS29O0YHsF/czpfblS0wyf7O/EmSCuXdxBhubQTUpjASXrruiMzT0bMCN2qFbPBZ\n\tYwTqAsZ9lwzfJg9Y+sG1S128O+7RR9Ox4QQyyyhFj/Z5PhDJl+BJBoT7I2Nr7mO4y7\n\tHiK2/N17kpBlA==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1670922978;\n\tbh=RBr4bT1bI9efjqqwFc9pjDaNt8QG7v1WHc89a0WZTv0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=uUtdpQN0MkHU7Bp9tIdXNj0qjMg8FUbdN4AIp+fcY8ZQiUi7fqzS3Ksu5VI42LxxE\n\tCXcBVClCYcuVJKkO/ITFZ87Qttrnss4XKrkfM3udnMYDTser56wQIzJuI9SHZ+1Pb+\n\tTqHg+6JtpJPm1IeNdVwP0gfmQRt+H3mrQCWerkFE=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"uUtdpQN0\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 13 Dec 2022 18:15:56 +0900", "Message-Id": "<20221213091558.621950-6-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.35.1", "In-Reply-To": "<20221213091558.621950-1-paul.elder@ideasonboard.com>", "References": "<20221213091558.621950-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 5/7] tracepoints: v4l2: Add tracepoints\n\tfor tracking buffer lifetime", "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>", "From": "Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Paul Elder <paul.elder@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add tracepoints in V4L2VideoDevice for tracing the lifetime of\nlibcamera FrameBuffers.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nNew in v2\n---\n .../internal/tracepoints/meson.build | 2 +\n .../libcamera/internal/tracepoints/v4l2.tp | 77 +++++++++++++++++++\n .../internal/tracepoints/v4l2_enums.tp | 16 ++++\n src/libcamera/v4l2_videodevice.cpp | 9 +++\n 4 files changed, 104 insertions(+)\n create mode 100644 include/libcamera/internal/tracepoints/v4l2.tp\n create mode 100644 include/libcamera/internal/tracepoints/v4l2_enums.tp", "diff": "diff --git a/include/libcamera/internal/tracepoints/meson.build b/include/libcamera/internal/tracepoints/meson.build\nindex d9b2fca5..83f1144b 100644\n--- a/include/libcamera/internal/tracepoints/meson.build\n+++ b/include/libcamera/internal/tracepoints/meson.build\n@@ -4,9 +4,11 @@\n tracepoint_files = files([\n 'buffer_enums.tp',\n 'request_enums.tp',\n+ 'v4l2_enums.tp',\n ])\n \n tracepoint_files += files([\n 'pipeline.tp',\n 'request.tp',\n+ 'v4l2.tp',\n ])\ndiff --git a/include/libcamera/internal/tracepoints/v4l2.tp b/include/libcamera/internal/tracepoints/v4l2.tp\nnew file mode 100644\nindex 00000000..f80eeb30\n--- /dev/null\n+++ b/include/libcamera/internal/tracepoints/v4l2.tp\n@@ -0,0 +1,77 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>\n+ *\n+ * v4l2.tp - Tracepoints for V4L2 devices\n+ */\n+\n+#include <libcamera/framebuffer.h>\n+#include <libcamera/request.h>\n+\n+#include \"libcamera/internal/v4l2_device.h\"\n+#include \"libcamera/internal/v4l2_videodevice.h\"\n+\n+TRACEPOINT_EVENT_CLASS(\n+\tlibcamera,\n+\tv4l2_with_buffer,\n+\tTP_ARGS(\n+\t\tlibcamera::V4L2VideoDevice *, vdev,\n+\t\tlibcamera::FrameBuffer *, buf\n+\t),\n+\tTP_FIELDS(\n+\t\tctf_string(devnode, vdev->deviceNode().c_str())\n+\t\tctf_integer_hex(uintptr_t, buffer, reinterpret_cast<uintptr_t>(buf))\n+\t\tctf_enum(libcamera, buffer_status, uint32_t, buf_status, buf->metadata().status)\n+\t)\n+)\n+\n+TRACEPOINT_EVENT(\n+\tlibcamera,\n+\tv4l2_videodev_streamoff,\n+\tTP_ARGS(\n+\t\tlibcamera::V4L2VideoDevice *, vdev,\n+\t\tuint32_t, stream_state,\n+\t\tuint32_t, queued_buffers_size\n+\t),\n+\tTP_FIELDS(\n+\t\tctf_string(devnode, vdev->deviceNode().c_str())\n+\t\tctf_enum(libcamera, v4l2_streaming_state, uint32_t, state, stream_state)\n+\t\tctf_integer(uint32_t, queued_buffers, queued_buffers_size)\n+\t)\n+)\n+\n+TRACEPOINT_EVENT(\n+\tlibcamera,\n+\tv4l2_videodev_send_back_buffer,\n+\tTP_ARGS(\n+\t\tlibcamera::V4L2VideoDevice *, vdev,\n+\t\tlibcamera::FrameBuffer *, buf,\n+\t\tlibcamera::Request *, req\n+\t),\n+\tTP_FIELDS(\n+\t\tctf_string(devnode, vdev->deviceNode().c_str())\n+\t\tctf_integer_hex(uintptr_t, buffer, reinterpret_cast<uintptr_t>(buf))\n+\t\tctf_enum(libcamera, buffer_status, uint32_t, buf_status, buf->metadata().status)\n+\t\tctf_integer_hex(uintptr_t, request, reinterpret_cast<uintptr_t>(req))\n+\t)\n+)\n+\n+TRACEPOINT_EVENT_INSTANCE(\n+\tlibcamera,\n+\tv4l2_with_buffer,\n+\tv4l2_videodev_add_buffer_to_queue,\n+\tTP_ARGS(\n+\t\tlibcamera::V4L2VideoDevice *, vdev,\n+\t\tlibcamera::FrameBuffer *, buf\n+\t)\n+)\n+\n+TRACEPOINT_EVENT_INSTANCE(\n+\tlibcamera,\n+\tv4l2_with_buffer,\n+\tv4l2_videodev_remove_buffer_from_queue,\n+\tTP_ARGS(\n+\t\tlibcamera::V4L2VideoDevice *, vdev,\n+\t\tlibcamera::FrameBuffer *, buf\n+\t)\n+)\ndiff --git a/include/libcamera/internal/tracepoints/v4l2_enums.tp b/include/libcamera/internal/tracepoints/v4l2_enums.tp\nnew file mode 100644\nindex 00000000..38506e17\n--- /dev/null\n+++ b/include/libcamera/internal/tracepoints/v4l2_enums.tp\n@@ -0,0 +1,16 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>\n+ *\n+ * v4l2_enums.tp - Tracepoint definition for enums in V4L2\n+ */\n+\n+TRACEPOINT_ENUM(\n+\tlibcamera,\n+\tv4l2_streaming_state,\n+\tTP_ENUM_VALUES(\n+\t\tctf_enum_value(\"Streaming\", 0)\n+\t\tctf_enum_value(\"Stopping\", 1)\n+\t\tctf_enum_value(\"Stopped\", 2)\n+\t)\n+)\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 1051997e..b134b0d4 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -31,6 +31,7 @@\n #include \"libcamera/internal/framebuffer.h\"\n #include \"libcamera/internal/media_device.h\"\n #include \"libcamera/internal/media_object.h\"\n+#include \"libcamera/internal/tracepoints.h\"\n \n /**\n * \\file v4l2_videodevice.h\n@@ -1706,6 +1707,7 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n \t\t\twatchdog_.start(std::chrono::duration_cast<std::chrono::milliseconds>(watchdogDuration_));\n \t}\n \n+\tLIBCAMERA_TRACEPOINT(v4l2_videodev_add_buffer_to_queue, this, buffer);\n \tqueuedBuffers_[buf.index] = buffer;\n \n \treturn 0;\n@@ -1786,6 +1788,7 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()\n \tcache_->put(buf.index);\n \n \tFrameBuffer *buffer = it->second;\n+\tLIBCAMERA_TRACEPOINT(v4l2_videodev_remove_buffer_from_queue, this, buffer);\n \tqueuedBuffers_.erase(it);\n \n \tif (queuedBuffers_.empty()) {\n@@ -1930,6 +1933,9 @@ int V4L2VideoDevice::streamOn()\n */\n int V4L2VideoDevice::streamOff()\n {\n+\tLIBCAMERA_TRACEPOINT(v4l2_videodev_streamoff, this,\n+\t\t\t static_cast<uint32_t>(state_), queuedBuffers_.size());\n+\n \tint ret;\n \n \tif (state_ != State::Streaming && queuedBuffers_.empty())\n@@ -1954,6 +1960,9 @@ int V4L2VideoDevice::streamOff()\n \n \t\tcache_->put(it.first);\n \t\tmetadata.status = FrameMetadata::FrameCancelled;\n+\n+\t\tLIBCAMERA_TRACEPOINT(v4l2_videodev_send_back_buffer, this, buffer, buffer->request());\n+\n \t\tbufferReady.emit(buffer);\n \t}\n \n", "prefixes": [ "libcamera-devel", "v2", "5/7" ] }