Patch Detail
Show a patch.
GET /api/1.1/patches/548/?format=api
{ "id": 548, "url": "https://patchwork.libcamera.org/api/1.1/patches/548/?format=api", "web_url": "https://patchwork.libcamera.org/patch/548/", "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": "<20190207212119.30299-6-kieran.bingham@ideasonboard.com>", "date": "2019-02-07T21:21:19", "name": "[libcamera-devel,5/5] libcamera: v4l2_device: Provide V4L2 Log helper", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "88d16d385b2f7c3b2262ec4bd9dc8498331f1b38", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/548/mbox/", "series": [ { "id": 171, "url": "https://patchwork.libcamera.org/api/1.1/series/171/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=171", "date": "2019-02-07T21:21:14", "name": "libcamera: Buffer Sharing", "version": 1, "mbox": "https://patchwork.libcamera.org/series/171/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/548/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/548/checks/", "tags": {}, "headers": { "Return-Path": "<kieran.bingham@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 008CB610B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 7 Feb 2019 22:21:37 +0100 (CET)", "from localhost.localdomain (unknown [149.254.234.206])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E757F9;\n\tThu, 7 Feb 2019 22:21:34 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549574496;\n\tbh=ndQnb27rLBCb/+/ucf16XyMpMw3lAxY30gT4Ygqhu3I=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=mnKpXyz17CfLcB5rh94M8f7i18dP2ADZDkFUS2APMHZu6/c6389yMIkNeZhmJ0j3W\n\toC5a4wZwprA90fzUG65QpffW2dm66X/v6tm1agxMBwUcS7MqoFbQlLJkB2Wyjmr4DO\n\tv8fR24ux9Fv/MXP/k/SEQTlnUkjA/BB88GjJ8mDQ=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>", "Date": "Thu, 7 Feb 2019 21:21:19 +0000", "Message-Id": "<20190207212119.30299-6-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.19.1", "In-Reply-To": "<20190207212119.30299-1-kieran.bingham@ideasonboard.com>", "References": "<20190207212119.30299-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 5/5] libcamera: v4l2_device: Provide V4L2\n\tLog helper", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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": "Thu, 07 Feb 2019 21:21:37 -0000" }, "content": "Add a V4L2DEVICE_LOG Macro helper to prepend the V4L2 Video Device node to\nevery log output. This is particularly useful when more than one V4L2Device is\nutilised in the system.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/v4l2_device.cpp | 48 +++++++++++++++++++----------------\n 1 file changed, 26 insertions(+), 22 deletions(-)", "diff": "diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex c2e4d0ea8db2..ce977613ff20 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -28,6 +28,8 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(V4L2)\n \n+#define V4L2DEVICE_LOG(severity) LOG(V4L2, severity) << deviceNode_ << \": \"\n+\n /**\n * \\struct V4L2Capability\n * \\brief struct v4l2_capability object wrapper and helpers\n@@ -254,14 +256,14 @@ int V4L2Device::open()\n \tint ret;\n \n \tif (isOpen()) {\n-\t\tLOG(V4L2, Error) << \"Device already open\";\n+\t\tV4L2DEVICE_LOG(Error) << \"Device already open\";\n \t\treturn -EBUSY;\n \t}\n \n \tret = ::open(deviceNode_.c_str(), O_RDWR | O_NONBLOCK);\n \tif (ret < 0) {\n \t\tret = -errno;\n-\t\tLOG(V4L2, Error)\n+\t\tV4L2DEVICE_LOG(Error)\n \t\t\t<< \"Failed to open V4L2 device '\" << deviceNode_\n \t\t\t<< \"': \" << strerror(-ret);\n \t\treturn ret;\n@@ -271,24 +273,25 @@ int V4L2Device::open()\n \tret = ioctl(fd_, VIDIOC_QUERYCAP, &caps_);\n \tif (ret < 0) {\n \t\tret = -errno;\n-\t\tLOG(V4L2, Error)\n+\t\tV4L2DEVICE_LOG(Error)\n \t\t\t<< \"Failed to query device capabilities: \"\n \t\t\t<< strerror(-ret);\n \t\treturn ret;\n \t}\n \n-\tLOG(V4L2, Debug)\n+\tV4L2DEVICE_LOG(Debug)\n \t\t<< \"Opened '\" << deviceNode_ << \"' \"\n \t\t<< caps_.bus_info() << \": \" << caps_.driver()\n \t\t<< \": \" << caps_.card();\n \n \tif (!caps_.isCapture() && !caps_.isOutput()) {\n-\t\tLOG(V4L2, Debug) << \"Device is not a supported type\";\n+\t\tV4L2DEVICE_LOG(Debug) << \"Device is not a supported type\";\n \t\treturn -EINVAL;\n \t}\n \n \tif (!caps_.hasStreaming()) {\n-\t\tLOG(V4L2, Error) << \"Device does not support streaming I/O\";\n+\t\tV4L2DEVICE_LOG(Error)\n+\t\t\t<< \"Device does not support streaming I/O\";\n \t\treturn -EINVAL;\n \t}\n \n@@ -513,13 +516,13 @@ int V4L2Device::requestBuffers(unsigned int count)\n \tret = ioctl(fd_, VIDIOC_REQBUFS, &rb);\n \tif (ret < 0) {\n \t\tret = -errno;\n-\t\tLOG(V4L2, Error)\n+\t\tV4L2DEVICE_LOG(Error)\n \t\t\t<< \"Unable to request \" << count << \" buffers: \"\n \t\t\t<< strerror(-ret);\n \t\treturn ret;\n \t}\n \n-\tLOG(V4L2, Debug)\n+\tV4L2DEVICE_LOG(Debug)\n \t\t<< deviceNode_ << \":\" << rb.count << \" buffers requested.\";\n \n \treturn rb.count;\n@@ -545,7 +548,8 @@ int V4L2Device::exportBuffers(BufferPool *pool)\n \n \tallocatedBuffers = ret;\n \tif (allocatedBuffers < pool->count()) {\n-\t\tLOG(V4L2, Error) << \"Not enough buffers provided by V4L2Device\";\n+\t\tV4L2DEVICE_LOG(Error)\n+\t\t\t<< \"Not enough buffers provided by V4L2Device\";\n \t\trequestBuffers(0);\n \t\treturn -ENOMEM;\n \t}\n@@ -565,7 +569,7 @@ int V4L2Device::exportBuffers(BufferPool *pool)\n \t\tret = ioctl(fd_, VIDIOC_QUERYBUF, &buf);\n \t\tif (ret < 0) {\n \t\t\tret = -errno;\n-\t\t\tLOG(V4L2, Error)\n+\t\t\tV4L2DEVICE_LOG(Error)\n \t\t\t\t<< \"Unable to query buffer \" << i << \": \"\n \t\t\t\t<< strerror(-ret);\n \t\t\tbreak;\n@@ -583,7 +587,7 @@ int V4L2Device::exportBuffers(BufferPool *pool)\n \t\t}\n \n \t\tif (ret) {\n-\t\t\tLOG(V4L2, Error) << \"Failed to create plane\";\n+\t\t\tV4L2DEVICE_LOG(Error) << \"Failed to create plane\";\n \t\t\tbreak;\n \t\t}\n \t}\n@@ -605,7 +609,7 @@ int V4L2Device::createPlane(Buffer *buffer, unsigned int planeIndex,\n \tstruct v4l2_exportbuffer expbuf = {};\n \tint ret;\n \n-\tLOG(V4L2, Debug)\n+\tV4L2DEVICE_LOG(Debug)\n \t\t<< \"Buffer \" << buffer->index()\n \t\t<< \" plane \" << planeIndex\n \t\t<< \": length=\" << length;\n@@ -618,7 +622,7 @@ int V4L2Device::createPlane(Buffer *buffer, unsigned int planeIndex,\n \tret = ioctl(fd_, VIDIOC_EXPBUF, &expbuf);\n \tif (ret < 0) {\n \t\tret = -errno;\n-\t\tLOG(V4L2, Error)\n+\t\tV4L2DEVICE_LOG(Error)\n \t\t\t<< \"Failed to export buffer: \" << strerror(-ret);\n \t\treturn ret;\n \t}\n@@ -648,13 +652,13 @@ int V4L2Device::importBuffers(BufferPool *pool)\n \n \tallocatedBuffers = ret;\n \tif (allocatedBuffers < pool->count()) {\n-\t\tLOG(V4L2, Error)\n+\t\tV4L2DEVICE_LOG(Error)\n \t\t\t<< \"Not enough buffers provided by V4L2Device\";\n \t\trequestBuffers(0);\n \t\treturn -ENOMEM;\n \t}\n \n-\tLOG(V4L2, Debug) << \"Device using an externally provided pool\";\n+\tV4L2DEVICE_LOG(Debug) << \"Device using an externally provided pool\";\n \tbufferPool_ = pool;\n \n \treturn 0;\n@@ -665,7 +669,7 @@ int V4L2Device::importBuffers(BufferPool *pool)\n */\n int V4L2Device::releaseBuffers()\n {\n-\tLOG(V4L2, Debug) << \"Releasing bufferPool\";\n+\tV4L2DEVICE_LOG(Debug) << \"Releasing bufferPool\";\n \n \trequestBuffers(0);\n \tbufferPool_ = nullptr;\n@@ -715,12 +719,12 @@ int V4L2Device::queueBuffer(Buffer *buffer)\n \t\tbuf.m.planes = planes;\n \t}\n \n-\tLOG(V4L2, Debug) << \"Queueing buffer \" << buf.index;\n+\tV4L2DEVICE_LOG(Debug) << \"Queueing buffer \" << buf.index;\n \n \tret = ioctl(fd_, VIDIOC_QBUF, &buf);\n \tif (ret < 0) {\n \t\tret = -errno;\n-\t\tLOG(V4L2, Error)\n+\t\tV4L2DEVICE_LOG(Error)\n \t\t\t<< \"Failed to queue buffer \" << buf.index << \": \"\n \t\t\t<< strerror(-ret);\n \t\treturn ret;\n@@ -757,7 +761,7 @@ Buffer *V4L2Device::dequeueBuffer()\n \tret = ioctl(fd_, VIDIOC_DQBUF, &buf);\n \tif (ret < 0) {\n \t\tret = -errno;\n-\t\tLOG(V4L2, Error)\n+\t\tV4L2DEVICE_LOG(Error)\n \t\t\t<< \"Failed to dequeue buffer: \" << strerror(-ret);\n \t\treturn nullptr;\n \t}\n@@ -793,7 +797,7 @@ void V4L2Device::bufferAvailable(EventNotifier *notifier)\n \tif (!buffer)\n \t\treturn;\n \n-\tLOG(V4L2, Debug) << \"Buffer \" << buffer->index() << \" is available\";\n+\tV4L2DEVICE_LOG(Debug) << \"Buffer \" << buffer->index() << \" is available\";\n \n \t/* Notify anyone listening to the device. */\n \tbufferReady.emit(buffer);\n@@ -819,7 +823,7 @@ int V4L2Device::streamOn()\n \tret = ioctl(fd_, VIDIOC_STREAMON, &bufferType_);\n \tif (ret < 0) {\n \t\tret = -errno;\n-\t\tLOG(V4L2, Error)\n+\t\tV4L2DEVICE_LOG(Error)\n \t\t\t<< \"Failed to start streaming: \" << strerror(-ret);\n \t\treturn ret;\n \t}\n@@ -841,7 +845,7 @@ int V4L2Device::streamOff()\n \tret = ioctl(fd_, VIDIOC_STREAMOFF, &bufferType_);\n \tif (ret < 0) {\n \t\tret = -errno;\n-\t\tLOG(V4L2, Error)\n+\t\tV4L2DEVICE_LOG(Error)\n \t\t\t<< \"Failed to stop streaming: \" << strerror(-ret);\n \t\treturn ret;\n \t}\n", "prefixes": [ "libcamera-devel", "5/5" ] }