Show a patch.

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

{
    "id": 3244,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3244/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3244/",
    "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": "<20200323142205.28342-2-laurent.pinchart@ideasonboard.com>",
    "date": "2020-03-23T14:21:45",
    "name": "[libcamera-devel,01/21] qcam: Remove custom event dispatcher",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "4fe15048cb7cfeff3dc5f4a110ccee1b3529e382",
    "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/3244/mbox/",
    "series": [
        {
            "id": 760,
            "url": "https://patchwork.libcamera.org/api/1.1/series/760/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=760",
            "date": "2020-03-23T14:21:44",
            "name": "qcam: Bypass format conversion when not required",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/760/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3244/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3244/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 B6E6C6041A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 15:22:18 +0100 (CET)",
            "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 5724EA31\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 15:22:18 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584973338;\n\tbh=izU4WjE5TNQPEidrpNUe1+lyYISq/HVG9nGGsESm39U=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=NY8jDXIh36mjdCeRUOSVQbJB5/OxioLewFKUSm93wwN48SGtcDtH1d69A39H0NCNi\n\tXHrlDKiO7AeNGqSiKbdFUrPMxCpb/0d9C56LEvsujLmc81Aw8q2jbUlDZt5zXfTUll\n\tsPu5t7dHzpkjjJw0cTeToT2XPoucLNnmbHD5ElFk=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 23 Mar 2020 16:21:45 +0200",
        "Message-Id": "<20200323142205.28342-2-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 01/21] qcam: Remove custom event dispatcher",
        "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": "Mon, 23 Mar 2020 14:22:18 -0000"
    },
    "content": "The qcam application installs a custom event dispatcher based on the Qt\nevent loop. As the camera manager now creates an internal thread, it\ndoesn't use that event dispatcher of the application thread at all.\n\nFurthermore, the custom event dispatcher is buggy, as it doesn't\ndispatch messages posted to the main thread's event loop. This isn't an\nissue as no messages are posted there in the first place, but would\ncause incorrect behaviour if we were to use that feature (for instance\nto deliver signals from the camera manager thread to the application\nthread).\n\nFixing the event dispatcher requires a change in the libcamera public\nAPI, as there's currently no way to dispatch messages using the public\nAPI (Thread::dispatchMessages() is not exposed). This isn't worth it at\nthe moment, so just remove the custom event dispatcher. If qcam later\nneeds the libcamera request and buffer completion signals to be\ndelivered in the application thread, it will need to handle that\ninternally, using Qt's cross-thread signal delivery.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/qcam/main.cpp                |   3 -\n src/qcam/meson.build             |   1 -\n src/qcam/qt_event_dispatcher.cpp | 152 -------------------------------\n src/qcam/qt_event_dispatcher.h   |  62 -------------\n 4 files changed, 218 deletions(-)\n delete mode 100644 src/qcam/qt_event_dispatcher.cpp\n delete mode 100644 src/qcam/qt_event_dispatcher.h",
    "diff": "diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\nindex a7ff5c52663b..297453914ae9 100644\n--- a/src/qcam/main.cpp\n+++ b/src/qcam/main.cpp\n@@ -15,7 +15,6 @@\n \n #include \"main_window.h\"\n #include \"../cam/options.h\"\n-#include \"qt_event_dispatcher.h\"\n \n void signalHandler(int signal)\n {\n@@ -62,9 +61,7 @@ int main(int argc, char **argv)\n \tsa.sa_handler = &signalHandler;\n \tsigaction(SIGINT, &sa, nullptr);\n \n-\tstd::unique_ptr<EventDispatcher> dispatcher(new QtEventDispatcher());\n \tCameraManager *cm = new CameraManager();\n-\tcm->setEventDispatcher(std::move(dispatcher));\n \n \tret = cm->start();\n \tif (ret) {\ndiff --git a/src/qcam/meson.build b/src/qcam/meson.build\nindex 5150631b55c8..214bfb12aabb 100644\n--- a/src/qcam/meson.build\n+++ b/src/qcam/meson.build\n@@ -3,7 +3,6 @@ qcam_sources = files([\n     'main.cpp',\n     'main_window.cpp',\n     '../cam/options.cpp',\n-    'qt_event_dispatcher.cpp',\n     'viewfinder.cpp',\n ])\n \ndiff --git a/src/qcam/qt_event_dispatcher.cpp b/src/qcam/qt_event_dispatcher.cpp\ndeleted file mode 100644\nindex 2780c9123ac3..000000000000\n--- a/src/qcam/qt_event_dispatcher.cpp\n+++ /dev/null\n@@ -1,152 +0,0 @@\n-/* SPDX-License-Identifier: GPL-2.0-or-later */\n-/*\n- * Copyright (C) 2019, Google Inc.\n- *\n- * qt_event_dispatcher.cpp - qcam - Qt-based event dispatcher\n- */\n-\n-#include <chrono>\n-#include <iostream>\n-\n-#include <QAbstractEventDispatcher>\n-#include <QCoreApplication>\n-#include <QSocketNotifier>\n-#include <QTimerEvent>\n-\n-#include <libcamera/event_notifier.h>\n-#include <libcamera/timer.h>\n-\n-#include \"qt_event_dispatcher.h\"\n-\n-using namespace libcamera;\n-\n-QtEventDispatcher::QtEventDispatcher()\n-{\n-}\n-\n-QtEventDispatcher::~QtEventDispatcher()\n-{\n-\tfor (auto &it : notifiers_) {\n-\t\tNotifierSet &set = it.second;\n-\t\tdelete set.read.qnotifier;\n-\t\tdelete set.write.qnotifier;\n-\t\tdelete set.exception.qnotifier;\n-\t}\n-}\n-\n-void QtEventDispatcher::registerEventNotifier(EventNotifier *notifier)\n-{\n-\tNotifierSet &set = notifiers_[notifier->fd()];\n-\tQSocketNotifier::Type qtype;\n-\tvoid (QtEventDispatcher::*method)(int);\n-\tNotifierPair *pair;\n-\n-\tswitch (notifier->type()) {\n-\tcase EventNotifier::Read:\n-\tdefault:\n-\t\tqtype = QSocketNotifier::Read;\n-\t\tmethod = &QtEventDispatcher::readNotifierActivated;\n-\t\tpair = &set.read;\n-\t\tbreak;\n-\n-\tcase EventNotifier::Write:\n-\t\tqtype = QSocketNotifier::Write;\n-\t\tmethod = &QtEventDispatcher::writeNotifierActivated;\n-\t\tpair = &set.write;\n-\t\tbreak;\n-\n-\tcase EventNotifier::Exception:\n-\t\tqtype = QSocketNotifier::Exception;\n-\t\tmethod = &QtEventDispatcher::exceptionNotifierActivated;\n-\t\tpair = &set.exception;\n-\t\tbreak;\n-\t}\n-\n-\tQSocketNotifier *qnotifier = new QSocketNotifier(notifier->fd(), qtype);\n-\tconnect(qnotifier, &QSocketNotifier::activated, this, method);\n-\tpair->notifier = notifier;\n-\tpair->qnotifier = qnotifier;\n-}\n-\n-void QtEventDispatcher::unregisterEventNotifier(EventNotifier *notifier)\n-{\n-\tNotifierSet &set = notifiers_[notifier->fd()];\n-\tNotifierPair *pair;\n-\n-\tswitch (notifier->type()) {\n-\tcase EventNotifier::Read:\n-\tdefault:\n-\t\tpair = &set.read;\n-\t\tbreak;\n-\n-\tcase EventNotifier::Write:\n-\t\tpair = &set.write;\n-\t\tbreak;\n-\n-\tcase EventNotifier::Exception:\n-\t\tpair = &set.exception;\n-\t\tbreak;\n-\t}\n-\n-\tdelete pair->qnotifier;\n-\tpair->qnotifier = nullptr;\n-\tpair->notifier = nullptr;\n-}\n-\n-void QtEventDispatcher::readNotifierActivated(int socket)\n-{\n-\tEventNotifier *notifier = notifiers_[socket].read.notifier;\n-\tnotifier->activated.emit(notifier);\n-}\n-\n-void QtEventDispatcher::writeNotifierActivated(int socket)\n-{\n-\tEventNotifier *notifier = notifiers_[socket].write.notifier;\n-\tnotifier->activated.emit(notifier);\n-}\n-\n-void QtEventDispatcher::exceptionNotifierActivated(int socket)\n-{\n-\tEventNotifier *notifier = notifiers_[socket].exception.notifier;\n-\tnotifier->activated.emit(notifier);\n-}\n-\n-void QtEventDispatcher::registerTimer(Timer *timer)\n-{\n-\tstd::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();\n-\tstd::chrono::steady_clock::duration duration = timer->deadline() - now;\n-\tstd::chrono::milliseconds msec =\n-\t\tstd::chrono::duration_cast<std::chrono::milliseconds>(duration);\n-\tint timerId = startTimer(msec.count());\n-\ttimers_[timerId] = timer;\n-\ttimerIds_[timer] = timerId;\n-}\n-\n-void QtEventDispatcher::unregisterTimer(Timer *timer)\n-{\n-\tauto it = timerIds_.find(timer);\n-\tif (it == timerIds_.end())\n-\t\treturn;\n-\n-\ttimers_.erase(it->second);\n-\tkillTimer(it->second);\n-\ttimerIds_.erase(it);\n-}\n-\n-void QtEventDispatcher::timerEvent(QTimerEvent *event)\n-{\n-\tTimer *timer = timers_[event->timerId()];\n-\ttimer->stop();\n-\ttimer->timeout.emit(timer);\n-}\n-\n-void QtEventDispatcher::processEvents()\n-{\n-\tstd::cout << \"QtEventDispatcher::processEvents() should not be called\"\n-\t\t  << std::endl;\n-}\n-\n-void QtEventDispatcher::interrupt()\n-{\n-\tQCoreApplication::eventDispatcher()->interrupt();\n-}\ndiff --git a/src/qcam/qt_event_dispatcher.h b/src/qcam/qt_event_dispatcher.h\ndeleted file mode 100644\nindex b0f123e52d06..000000000000\n--- a/src/qcam/qt_event_dispatcher.h\n+++ /dev/null\n@@ -1,62 +0,0 @@\n-/* SPDX-License-Identifier: GPL-2.0-or-later */\n-/*\n- * Copyright (C) 2019, Google Inc.\n- *\n- * qt_event_dispatcher.h - qcam - Qt-based event dispatcher\n- */\n-#ifndef __QCAM_QT_EVENT_DISPATCHER_H__\n-#define __QCAM_QT_EVENT_DISPATCHER_H__\n-\n-#include <map>\n-\n-#include <libcamera/event_dispatcher.h>\n-\n-using namespace libcamera;\n-\n-class QSocketNotifier;\n-\n-class QtEventDispatcher final : public EventDispatcher, public QObject\n-{\n-public:\n-\tQtEventDispatcher();\n-\t~QtEventDispatcher();\n-\n-\tvoid registerEventNotifier(EventNotifier *notifier);\n-\tvoid unregisterEventNotifier(EventNotifier *notifier);\n-\n-\tvoid registerTimer(Timer *timer);\n-\tvoid unregisterTimer(Timer *timer);\n-\n-\tvoid processEvents();\n-\n-\tvoid interrupt();\n-\n-protected:\n-\tvoid timerEvent(QTimerEvent *event);\n-\n-private:\n-\tvoid readNotifierActivated(int socket);\n-\tvoid writeNotifierActivated(int socket);\n-\tvoid exceptionNotifierActivated(int socket);\n-\n-\tstruct NotifierPair {\n-\t\tNotifierPair()\n-\t\t\t: notifier(nullptr), qnotifier(nullptr)\n-\t\t{\n-\t\t}\n-\t\tEventNotifier *notifier;\n-\t\tQSocketNotifier *qnotifier;\n-\t};\n-\n-\tstruct NotifierSet {\n-\t\tNotifierPair read;\n-\t\tNotifierPair write;\n-\t\tNotifierPair exception;\n-\t};\n-\n-\tstd::map<int, NotifierSet> notifiers_;\n-\tstd::map<int, Timer *> timers_;\n-\tstd::map<Timer *, int> timerIds_;\n-};\n-\n-#endif /* __QCAM_QT_EVENT_DISPATCHER_H__ */\n",
    "prefixes": [
        "libcamera-devel",
        "01/21"
    ]
}