Cover Letter Detail
Show a cover letter.
GET /api/1.1/covers/2716/?format=api
{ "id": 2716, "url": "https://patchwork.libcamera.org/api/1.1/covers/2716/?format=api", "web_url": "https://patchwork.libcamera.org/cover/2716/", "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": "<20200122205723.8865-1-laurent.pinchart@ideasonboard.com>", "date": "2020-01-22T20:57:10", "name": "[libcamera-devel,v2,00/13] Initial libcamera threading model", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/cover/2716/mbox/", "series": [ { "id": 645, "url": "https://patchwork.libcamera.org/api/1.1/series/645/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=645", "date": "2020-01-22T20:57:10", "name": "Initial libcamera threading model", "version": 2, "mbox": "https://patchwork.libcamera.org/series/645/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/covers/2716/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 002E260804\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jan 2020 21:57: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 7E5772E5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jan 2020 21:57:42 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1579726662;\n\tbh=cxE+OaB6j4J4mZ5CaB1VwO1VLpUGTzZOTm8zevCsbCg=;\n\th=From:To:Subject:Date:From;\n\tb=uMt3gFjjKIUQ8/OX4VahNnoxDqxBV+CtRZwn4uoyOZtbZ3jmbdl5hB3luRscw4SLg\n\t2Dx0eLNlhpCKw+YGWki+ALQvD06rAhVMxttcU7zs65bIHmWM+ZCUURGdFTVwAWr0j6\n\tYMKCl9KzCBjIcM277hcvxKseX9fsSSeAFlI+OPXk=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 22 Jan 2020 22:57:10 +0200", "Message-Id": "<20200122205723.8865-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 v2 00/13] 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": "Wed, 22 Jan 2020 20:57: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\nSome of the preparatory work from v1 has been merged already, but the\nseries still starts with 5 preparatory patches (some of them being split\nfrom the larger \"libcamera: camera_manager: Run the camera manager in a\nthread\" patch). The most notable change there is the move of private\ndata members of the CameraManager and Camera classes to private classes,\nhelping with ABI breakage avoidance in future work.\n\nThe next two patches consist solely of documentation. Patch 06/13\ndefines the threading model and patch 07/13 documents it in core\nclasses. Patch 08/13 then makes signal connection and disconnection\nthread-safe to support multi-threaded contexts.\n\nPatch 09/13 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 10/13 to 11/13 then document and implement the threading model\nin the Camera and PipelineHandler classes. Note that patch 09/13 breaks\noperation of libcamera, and patch 10/13 fixes that. This is caused by\nthe threading model implementation being split in two patches. I have\ndecided to organize the changes this way to keep changes reviewable, but\nI'm open to squashing the two patches together, especially now that\n09/13 has become smaller.\n\nPatches 12/13 and 13/13 finally simplify the V4L2 compatibility and\nAndroid camera HAL layers by removing the internal threads, as libcamera\ndoesn't require an externally-provided event loop anymore. I have tested\n12/13 with yavta, but 13/13 is currently only compile-tested.\n\nLaurent Pinchart (13):\n libcamera: Fix documentation of buffer allocation/export functions\n libcamera: camera_manager: Move private data members to private\n implementation\n libcamera: camera_manager: Return a copy of the vector from cameras()\n libcamera: camera: Move private data members to private implementation\n libcamera: camera: Centralize state checks in Private class\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: Implement the threading model\n libcamera: pipeline_handler: Document the threading model\n v4l2: Remove internal thread\n android: Remove internal thread\n\n Documentation/Doxyfile.in | 5 +-\n include/libcamera/camera.h | 28 +-\n include/libcamera/camera_manager.h | 13 +-\n src/android/camera3_hal.cpp | 8 +-\n src/android/camera_device.cpp | 48 +--\n src/android/camera_device.h | 16 +-\n src/android/camera_hal_manager.cpp | 78 ++---\n src/android/camera_hal_manager.h | 17 +-\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/camera.cpp | 362 ++++++++++++++++-------\n src/libcamera/camera_manager.cpp | 298 ++++++++++++++-----\n src/libcamera/device_enumerator.cpp | 2 +\n src/libcamera/event_notifier.cpp | 2 +\n src/libcamera/framebuffer_allocator.cpp | 50 +---\n src/libcamera/include/pipeline_handler.h | 4 +-\n src/libcamera/ipc_unixsocket.cpp | 2 +\n src/libcamera/object.cpp | 10 +-\n src/libcamera/pipeline_handler.cpp | 44 ++-\n src/libcamera/signal.cpp | 33 +++\n src/libcamera/thread.cpp | 86 ++++++\n src/libcamera/timer.cpp | 20 +-\n src/libcamera/v4l2_videodevice.cpp | 5 +-\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 30 files changed, 906 insertions(+), 666 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" }