Show a patch.

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

{
    "id": 16118,
    "url": "https://patchwork.libcamera.org/api/patches/16118/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16118/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20220530142722.57618-12-tomi.valkeinen@ideasonboard.com>",
    "date": "2022-05-30T14:27:17",
    "name": "[libcamera-devel,v4,11/16] py: merge read_event() and get_ready_requests()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "570a9d64247f96364e7397f9c342f3ef3083ab8d",
    "submitter": {
        "id": 109,
        "url": "https://patchwork.libcamera.org/api/people/109/?format=api",
        "name": "Tomi Valkeinen",
        "email": "tomi.valkeinen@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16118/mbox/",
    "series": [
        {
            "id": 3149,
            "url": "https://patchwork.libcamera.org/api/series/3149/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3149",
            "date": "2022-05-30T14:27:06",
            "name": "More misc Python patches",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3149/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16118/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16118/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 F1E4DC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 May 2022 14:27:53 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 951AB6564C;\n\tMon, 30 May 2022 16:27:53 +0200 (CEST)",
            "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 D93F465641\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 May 2022 16:27:44 +0200 (CEST)",
            "from deskari.lan (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 511E7145B;\n\tMon, 30 May 2022 16:27:44 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653920873;\n\tbh=nImSIZ5uytByW9XxCoN6/Shcks/45bpyiqqgaYQ2cEE=;\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=sRRmP3Vhi4a5274RMh8fr3NfvNB2tDI3nfhaj8tEOtuIfWir825BOzQpNuVoBizt4\n\tfkqqBR93XWg5TbfMx22OPZx/mV752y7qHyPBJItk7KRfKknmZbBKvYqWA5unAklWcA\n\tx69HXc5ITf/EAyUkYjrJ+2XU7AUaRF7Z4KhtiYYEI+YUqhTA18VJMCSwMO/P+LtaJQ\n\tN1knvVRUT6HV4odfn0Q19skw2gJlrOE1zF37AqeYnDlx9QK5sUcmkXEyoj38jUjMk7\n\ttr6vGnfAGEj4pkmLsSFgE0+1jhzXn9bSeD9G63NhfEl+Mnpp+MAA3VhkVAStzRCDn2\n\tPR04vwQwxMg5A==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653920864;\n\tbh=nImSIZ5uytByW9XxCoN6/Shcks/45bpyiqqgaYQ2cEE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gNfQ1dDumnu8RcJZQYZ16P2wPLcPxFW8FFC8iXM61kpDaLHz3Jk5olIo1ceF3RCoD\n\trAYaDo/bYNmVleWZI2wDb21+fQfjzHcWEMLWW2O1LVx2OnnGErxQ3Y1XGH2ZRyg370\n\t5HEEgk3+DekvjwNBH2lsAboI3Xfd+k+8bZkbuj+I="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"gNfQ1dDu\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tJacopo Mondi <jacopo@jmondi.org>",
        "Date": "Mon, 30 May 2022 17:27:17 +0300",
        "Message-Id": "<20220530142722.57618-12-tomi.valkeinen@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220530142722.57618-1-tomi.valkeinen@ideasonboard.com>",
        "References": "<20220530142722.57618-1-tomi.valkeinen@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 11/16] py: merge read_event() and\n\tget_ready_requests()",
        "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": "Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "We always call CameraManager.read_event() and\nCameraManager.get_ready_requests(), so to simplify the use merge the\nread_event() into the get_ready_requests().\n\nThis has the side effect that get_ready_requests() will now block if\nthere is no event ready. If we ever need to call get_ready_requests() in\na polling manner we will need a new function which behaves differently.\n\nHowever, afaics the only sensible way to manage the event loop is to use\nselect/poll on the eventfd and then call get_ready_requests() once,\nwhich is the use case what the current merged function supports.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n---\n src/py/cam/cam.py            | 2 --\n src/py/libcamera/py_main.cpp | 7 ++-----\n test/py/unittests.py         | 4 ----\n 3 files changed, 2 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/src/py/cam/cam.py b/src/py/cam/cam.py\nindex bf8529d9..2ae89fa8 100755\n--- a/src/py/cam/cam.py\n+++ b/src/py/cam/cam.py\n@@ -243,8 +243,6 @@ class CaptureState:\n     # Called from renderer when there is a libcamera event\n     def event_handler(self):\n         try:\n-            self.cm.read_event()\n-\n             reqs = self.cm.get_ready_requests()\n \n             for req in reqs:\ndiff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp\nindex fcf009f0..505cc3dc 100644\n--- a/src/py/libcamera/py_main.cpp\n+++ b/src/py/libcamera/py_main.cpp\n@@ -213,15 +213,12 @@ PYBIND11_MODULE(_libcamera, m)\n \t\t\treturn gEventfd;\n \t\t})\n \n-\t\t.def(\"read_event\", [](CameraManager &) {\n+\t\t.def(\"get_ready_requests\", [](CameraManager &) {\n \t\t\tuint8_t buf[8];\n \n-\t\t\tint ret = read(gEventfd, buf, 8);\n-\t\t\tif (ret != 8)\n+\t\t\tif (read(gEventfd, buf, 8) != 8)\n \t\t\t\tthrow std::system_error(errno, std::generic_category());\n-\t\t})\n \n-\t\t.def(\"get_ready_requests\", [](CameraManager &) {\n \t\t\tstd::vector<Request *> v;\n \n \t\t\t{\ndiff --git a/test/py/unittests.py b/test/py/unittests.py\nindex 33b35a0a..9adc4337 100755\n--- a/test/py/unittests.py\n+++ b/test/py/unittests.py\n@@ -210,8 +210,6 @@ class SimpleCaptureMethods(CameraTesterBase):\n         reqs = []\n \n         while True:\n-            cm.read_event()\n-\n             ready_reqs = cm.get_ready_requests()\n \n             reqs += ready_reqs\n@@ -283,8 +281,6 @@ class SimpleCaptureMethods(CameraTesterBase):\n         while running:\n             events = sel.select()\n             for key, _ in events:\n-                cm.read_event()\n-\n                 ready_reqs = cm.get_ready_requests()\n \n                 reqs += ready_reqs\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "11/16"
    ]
}