Show a patch.

GET /api/1.1/patches/3548/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 3548,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3548/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3548/",
    "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": "<20200426004309.2743-1-laurent.pinchart@ideasonboard.com>",
    "date": "2020-04-26T00:43:08",
    "name": "[libcamera-devel,1/2] libcamera: v4l2_videodevice: Rename fdEvent_ to fdBufferNotifier_",
    "commit_ref": "66a1928a0a7a14c19f10d8fd09980258912f515e",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "4d83118bf7498e4454cd393faaa57d4afdeffdfa",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3548/mbox/",
    "series": [
        {
            "id": 828,
            "url": "https://patchwork.libcamera.org/api/1.1/series/828/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=828",
            "date": "2020-04-26T00:43:08",
            "name": "[libcamera-devel,1/2] libcamera: v4l2_videodevice: Rename fdEvent_ to fdBufferNotifier_",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/828/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3548/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3548/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "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 DCC3F62E55\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 26 Apr 2020 02:43:27 +0200 (CEST)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6364D4F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 26 Apr 2020 02:43:27 +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=\"N14KFo+L\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1587861807;\n\tbh=T9p/zxTLJga5VcZfg96mQ2fjPHvxb56eV5Oq4+Jsaqc=;\n\th=From:To:Subject:Date:From;\n\tb=N14KFo+L+0H+OTBnDkQ3Ka73Kv8MQy8UUClgpSgLPI34juIVaeVJh4O/SyxIIqIdE\n\tbobsr8p7SBzwRB2tCEgaEBQJE19Z58BddiyaBoI2+n3OcR1I74nRR7Lw5bSu0QqG+/\n\tW2PI9ws/Hzb8is9sZtOpD5jAJcXpi8zDAyt/1k3U=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sun, 26 Apr 2020 03:43:08 +0300",
        "Message-Id": "<20200426004309.2743-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.3",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 1/2] libcamera: v4l2_videodevice: Rename\n\tfdEvent_ to fdBufferNotifier_",
        "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": "Sun, 26 Apr 2020 00:43:28 -0000"
    },
    "content": "To prepare for the addition of a second notifier for V4L2 events, rename\nthe current fdEvent_ member to fdBufferNotifier_ to better reflect its\nusage.\n\nWhile at it, simplify allocation of the fdEvent_ notifier.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/v4l2_videodevice.h |  2 +-\n src/libcamera/v4l2_videodevice.cpp       | 36 ++++++++++++++----------\n 2 files changed, 22 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\nindex f21b9264a40d..ee63d28da734 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -270,7 +270,7 @@ private:\n \tV4L2BufferCache *cache_;\n \tstd::map<unsigned int, FrameBuffer *> queuedBuffers_;\n \n-\tEventNotifier *fdEvent_;\n+\tEventNotifier *fdBufferNotifier_;\n };\n \n class V4L2M2MDevice\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex a959cfe65c43..18a71e4f8a7f 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -544,7 +544,7 @@ const std::string V4L2DeviceFormat::toString() const\n  * \\param[in] deviceNode The file-system path to the video device node\n  */\n V4L2VideoDevice::V4L2VideoDevice(const std::string &deviceNode)\n-\t: V4L2Device(deviceNode), cache_(nullptr), fdEvent_(nullptr)\n+\t: V4L2Device(deviceNode), cache_(nullptr), fdBufferNotifier_(nullptr)\n {\n \t/*\n \t * We default to an MMAP based CAPTURE video device, however this will\n@@ -610,29 +610,32 @@ int V4L2VideoDevice::open()\n \t * devices (POLLIN), and write notifications for OUTPUT video devices\n \t * (POLLOUT).\n \t */\n+\tEventNotifier::Type notifierType;\n+\n \tif (caps_.isVideoCapture()) {\n-\t\tfdEvent_ = new EventNotifier(fd(), EventNotifier::Read);\n+\t\tnotifierType = EventNotifier::Read;\n \t\tbufferType_ = caps_.isMultiplanar()\n \t\t\t    ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE\n \t\t\t    : V4L2_BUF_TYPE_VIDEO_CAPTURE;\n \t} else if (caps_.isVideoOutput()) {\n-\t\tfdEvent_ = new EventNotifier(fd(), EventNotifier::Write);\n+\t\tnotifierType = EventNotifier::Write;\n \t\tbufferType_ = caps_.isMultiplanar()\n \t\t\t    ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE\n \t\t\t    : V4L2_BUF_TYPE_VIDEO_OUTPUT;\n \t} else if (caps_.isMetaCapture()) {\n-\t\tfdEvent_ = new EventNotifier(fd(), EventNotifier::Read);\n+\t\tnotifierType = EventNotifier::Read;\n \t\tbufferType_ = V4L2_BUF_TYPE_META_CAPTURE;\n \t} else if (caps_.isMetaOutput()) {\n-\t\tfdEvent_ = new EventNotifier(fd(), EventNotifier::Write);\n+\t\tnotifierType = EventNotifier::Write;\n \t\tbufferType_ = V4L2_BUF_TYPE_META_OUTPUT;\n \t} else {\n \t\tLOG(V4L2, Error) << \"Device is not a supported type\";\n \t\treturn -EINVAL;\n \t}\n \n-\tfdEvent_->activated.connect(this, &V4L2VideoDevice::bufferAvailable);\n-\tfdEvent_->setEnabled(false);\n+\tfdBufferNotifier_ = new EventNotifier(fd(), notifierType);\n+\tfdBufferNotifier_->activated.connect(this, &V4L2VideoDevice::bufferAvailable);\n+\tfdBufferNotifier_->setEnabled(false);\n \n \tLOG(V4L2, Debug)\n \t\t<< \"Opened device \" << caps_.bus_info() << \": \"\n@@ -699,15 +702,17 @@ int V4L2VideoDevice::open(int handle, enum v4l2_buf_type type)\n \t * devices (POLLIN), and write notifications for OUTPUT video devices\n \t * (POLLOUT).\n \t */\n+\tEventNotifier::Type notifierType;\n+\n \tswitch (type) {\n \tcase V4L2_BUF_TYPE_VIDEO_OUTPUT:\n-\t\tfdEvent_ = new EventNotifier(fd(), EventNotifier::Write);\n+\t\tnotifierType = EventNotifier::Write;\n \t\tbufferType_ = caps_.isMultiplanar()\n \t\t\t    ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE\n \t\t\t    : V4L2_BUF_TYPE_VIDEO_OUTPUT;\n \t\tbreak;\n \tcase V4L2_BUF_TYPE_VIDEO_CAPTURE:\n-\t\tfdEvent_ = new EventNotifier(fd(), EventNotifier::Read);\n+\t\tnotifierType = EventNotifier::Read;\n \t\tbufferType_ = caps_.isMultiplanar()\n \t\t\t    ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE\n \t\t\t    : V4L2_BUF_TYPE_VIDEO_CAPTURE;\n@@ -717,8 +722,9 @@ int V4L2VideoDevice::open(int handle, enum v4l2_buf_type type)\n \t\treturn -EINVAL;\n \t}\n \n-\tfdEvent_->activated.connect(this, &V4L2VideoDevice::bufferAvailable);\n-\tfdEvent_->setEnabled(false);\n+\tfdBufferNotifier_ = new EventNotifier(fd(), notifierType);\n+\tfdBufferNotifier_->activated.connect(this, &V4L2VideoDevice::bufferAvailable);\n+\tfdBufferNotifier_->setEnabled(false);\n \n \tLOG(V4L2, Debug)\n \t\t<< \"Opened device \" << caps_.bus_info() << \": \"\n@@ -736,7 +742,7 @@ void V4L2VideoDevice::close()\n \t\treturn;\n \n \treleaseBuffers();\n-\tdelete fdEvent_;\n+\tdelete fdBufferNotifier_;\n \n \tV4L2Device::close();\n }\n@@ -1477,7 +1483,7 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n \t}\n \n \tif (queuedBuffers_.empty())\n-\t\tfdEvent_->setEnabled(true);\n+\t\tfdBufferNotifier_->setEnabled(true);\n \n \tqueuedBuffers_[buf.index] = buffer;\n \n@@ -1544,7 +1550,7 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()\n \tqueuedBuffers_.erase(it);\n \n \tif (queuedBuffers_.empty())\n-\t\tfdEvent_->setEnabled(false);\n+\t\tfdBufferNotifier_->setEnabled(false);\n \n \tbuffer->metadata_.status = buf.flags & V4L2_BUF_FLAG_ERROR\n \t\t\t\t ? FrameMetadata::FrameError\n@@ -1617,7 +1623,7 @@ int V4L2VideoDevice::streamOff()\n \t}\n \n \tqueuedBuffers_.clear();\n-\tfdEvent_->setEnabled(false);\n+\tfdBufferNotifier_->setEnabled(false);\n \n \treturn 0;\n }\n",
    "prefixes": [
        "libcamera-devel",
        "1/2"
    ]
}