Show a cover letter.

GET /api/covers/2688/?format=api
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2688,
    "url": "https://patchwork.libcamera.org/api/covers/2688/?format=api",
    "web_url": "https://patchwork.libcamera.org/cover/2688/",
    "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": "<20200120002437.6633-1-laurent.pinchart@ideasonboard.com>",
    "date": "2020-01-20T00:24:18",
    "name": "[libcamera-devel,00/19] Initial libcamera threading model",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/cover/2688/mbox/",
    "series": [
        {
            "id": 641,
            "url": "https://patchwork.libcamera.org/api/series/641/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=641",
            "date": "2020-01-20T00:24:19",
            "name": "Initial libcamera threading model",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/641/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/covers/2688/comments/",
    "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 E076F60454\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jan 2020 01:24:42 +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 20857504\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jan 2020 01:24:42 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1579479882;\n\tbh=W/UQ/hA3M+jQVgiF4jfspF3OIahwe215bVt756Qadfg=;\n\th=From:To:Subject:Date:From;\n\tb=d+9/rc1PqrjUtizIo+1ek9fohSw0z9Hg9iPcJm/EP17LO72lH1+udG5JQZ+L8Iozi\n\tlJlY3nVBwW48jjgHTT7LM1lU1ODDLztgqoKr/5/Dhg4ff/nlMwE+j8N3v/H0pEhFdO\n\tVZM6LVva/mCqWn9u5MIoM07WwvG3z6X1vX0vCdys=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 20 Jan 2020 02:24:18 +0200",
        "Message-Id": "<20200120002437.6633-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 00/19] Initial libcamera threading model",
        "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, 20 Jan 2020 00:24:43 -0000"
    },
    "content": "Hello,\n\nThis series defines and implements an initial version of the threading\nmodel.\n\nlibcamera currently relies on the application providing an event loop.\nThis cumbersome when the direct user of libcamera is not an application\nbut a framework, as no event loop is available in that case. The Android\ncamera HAL and the V4L2 adaptation layers had to create an internal\nthread to make an event loop available to libcamera, and handle\nsynchronization between calls from the upper framework and the internal\nthread. A GStreamer element would require a similar implementation,\nresulting in lots of code duplication.\n\nFurthermore, relying on an application event loop may block libcamera\nfrom processing events if the application performs long blocking\noperations. This is not compatible with the real-time constraints of\npipeline handlers and IPAs.\n\nFor this reason, creating and managing threads internally to libcamera\nis a better option. This requires defining a threading model, as all of\na sudden multiple contexts of execution will be available when only one\ncontext existed before.\n\nThe first 7 patches are preparatory work in the form of small\nmiscellaneous fixes or cleanups (01/19 and 05/19 to 07/19) and\nenhancements (making ConnectionTypeBlocking more useful in 02/19, and\nbetter log support for multithreading contexts in 03/19 and 04/19).\nPatch 08/19 then adds a test case to the signal test to catch an\nexisting bug, and patch 09/19 fixes the bug while reworking the Signal\nimplementation.\n\nThe next two patches consist solely of documentation. Patch 10/19\ndefines the threading model and patch 11/19 documents it in core\nclasses. Patch 12/19 then makes signal connection and disconnection\nthread-safe to support multi-threaded contexts.\n\nPatch 13/19 is the most disruptive change, as it creates an thread for\nthe CameraManager. At the moment this is the only thread created by\nlibcamera, and all pipeline handlers and camera are bound to it. This\nmodel is likely too simple and will need to be extended with more\nthreads in the future to avoid low-priority blocking operations\ninterfering with real-time camera constraints. The change is however a\nstep in the right direction, as it brings consideration of multiple\nthreads to all of libcamera.\n\nPatches 14/19 to 17/19 then document and implement the threading model\nin the Camera and PipelineHandler classes. As a side effect, along with\n13/19, they move private data members of the CameraManager and Camera\nclasses to private classes, helping with ABI breakage avoidance in\nfuture work.\n\nNote that patch 13/19 breaks operation of libcamera, and patch 16/19\nfixes that. This is caused by the threading model implementation being\nsplit in two patches. I have decided to organize the changes this way to\nkeep changes reviewable, but I'm open to alternatives.\n\nPatches 18/19 and 19/19 then simplify the V4L2 compatibility and Android\ncamera HAL layers by removing the internal threads, as libcamera doesn't\nrequire an externally-provided event loop anymore. I have tested 18/19\nwith yavta, but 19/19 is currently only compile-tested.\n\nLaurent Pinchart (19):\n  test: buffer_import: Propagate status code from buffer allocation\n  libcamera: bound_method: Avoid deadlock with ConnectionTypeBlocking\n  libcamera: thread: Add a method to return the ID of the current thread\n  libcamera: log: Print the thread ID in the log\n  libcamera: Replace ARRAY_SIZE with std::array\n  libcamera: bound_method: Use std::index_sequence\n  libcamera: Declare static local variables as const where applicable\n  test: signal: Add additional disconnection tests for Object\n  libcamera: signal: Make slots list private\n  libcamera: Define the threading model\n  libcamera: Document thread-safety attributes of core classes\n  libcamera: signal: Make connection and disconnection thread-safe\n  libcamera: camera_manager: Run the camera manager in a thread\n  libcamera: camera: Move private data members to private implementation\n  libcamera: camera: Centralize state checks in Private class\n  libcamera: camera: Implement the threading model\n  libcamera: pipeline_handler: Implement the threading model\n  v4l2: Remove internal thread\n  android: Remove internal thread\n\n Documentation/Doxyfile.in                |   5 +-\n include/libcamera/bound_method.h         |  38 +--\n include/libcamera/camera.h               |  28 +-\n include/libcamera/camera_manager.h       |  13 +-\n include/libcamera/object.h               |   4 +-\n include/libcamera/signal.h               |  88 +++---\n src/android/camera3_hal.cpp              |   8 +-\n src/android/camera_device.cpp            |  48 +--\n src/android/camera_device.h              |  17 +-\n src/android/camera_hal_manager.cpp       |  78 ++---\n src/android/camera_hal_manager.h         |  16 +-\n src/android/camera_ops.cpp               |  96 ++++++\n src/android/camera_ops.h                 |  15 +\n src/android/camera_proxy.cpp             | 180 -----------\n src/android/camera_proxy.h               |  42 ---\n src/android/meson.build                  |   2 +-\n src/libcamera/bound_method.cpp           |  22 +-\n src/libcamera/camera.cpp                 | 364 +++++++++++++++--------\n src/libcamera/camera_manager.cpp         | 295 +++++++++++++-----\n src/libcamera/controls.cpp               |   2 +-\n src/libcamera/device_enumerator.cpp      |   2 +\n src/libcamera/event_notifier.cpp         |   2 +\n src/libcamera/formats.cpp                |   2 +-\n src/libcamera/framebuffer_allocator.cpp  |  49 +--\n src/libcamera/include/pipeline_handler.h |   4 +-\n src/libcamera/include/thread.h           |   2 +\n src/libcamera/include/utils.h            |   2 -\n src/libcamera/ipa_module.cpp             |   8 +-\n src/libcamera/ipc_unixsocket.cpp         |   2 +\n src/libcamera/log.cpp                    |  21 +-\n src/libcamera/object.cpp                 |  17 +-\n src/libcamera/pipeline_handler.cpp       |  41 ++-\n src/libcamera/signal.cpp                 |  69 +++++\n src/libcamera/thread.cpp                 | 106 +++++++\n src/libcamera/timer.cpp                  |  20 +-\n src/libcamera/utils.cpp                  |   5 -\n src/libcamera/v4l2_videodevice.cpp       |   9 +-\n src/v4l2/v4l2_camera.h                   |   2 +-\n src/v4l2/v4l2_camera_proxy.cpp           |  43 +--\n src/v4l2/v4l2_compat_manager.cpp         |  48 +--\n src/v4l2/v4l2_compat_manager.h           |  13 +-\n test/camera/buffer_import.cpp            |  18 +-\n test/ipc/unixsocket.cpp                  |   8 +-\n test/object-invoke.cpp                   |  20 ++\n test/signal.cpp                          |  24 ++\n 45 files changed, 1112 insertions(+), 786 deletions(-)\n create mode 100644 src/android/camera_ops.cpp\n create mode 100644 src/android/camera_ops.h\n delete mode 100644 src/android/camera_proxy.cpp\n delete mode 100644 src/android/camera_proxy.h"
}