[libcamera-devel] [PATCH v3 00/17] libcamera: Introduce UniqueFD
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Nov 29 00:57:35 CET 2021
Hello,
This patch series is a continuation of Hiro's work on the ScopedFD class
([1]). The class is a std::unique_ptr<>-like wrapper around file
descriptors, which complements the existing shared-ownership
FileDescriptor.
Compared to v2, the main changes are a rename of ScopedFD to UniqueFD,
and to match that, of FileDescriptor to SharedFD. Patches 01/17 to 03/17
refactor headers a little bit first, patch 05/17 is new too and adds a
unit test for the UniqueFD class, and patch 07/17 changes the
FileDescriptor::dup() function to make it easier to interoperate with
UniqueFD. Other minor changes are listed in the changelog of individual
patches.
[1] https://patchwork.libcamera.org/project/libcamera/list/?series=2115
Hirokazu Honda (11):
libcamera: base: Introduce UniqueFD
libcamera: base: file_descriptor: Add constructor from UniqueFD
libcamera: event_dispatcher_poll: Manage fd by UniqueFD
libcamera: file: Manage fd by UniqueFD
libcamera: ipc_unixsocket: Use UniqueFD for a file descriptor
libcamera: process: Manage pipe fds by UniqueFD
libcamera: media_device: Manage fd by UniqueFD
libcamera: v4l2_device: Use UniqueFD for a file descriptor
libcamera: v4l2_videodevice: Use fd for a file descriptor
libcamera: pipeline: raspberrypi: DmaHeaps: Use UniqueFD for a file
descriptor
v4l2: v4l2_camera: Return int in getBufferFd()
Laurent Pinchart (6):
libcamera: Move compiler.h to base/
libcamera: Move file_descriptor.h to base/
libcamera: base: file_descriptor: Move inode() function to File class
test: Add UniqueFD test
libcamera: base: file_descriptor: Return UniqueFD from dup()
libcamera: base: Rename FileDescriptor to SharedFD
include/libcamera/{ => base}/compiler.h | 0
.../libcamera/base/event_dispatcher_poll.h | 3 +-
include/libcamera/base/file.h | 8 +-
include/libcamera/base/meson.build | 3 +
.../{file_descriptor.h => base/shared_fd.h} | 26 +-
include/libcamera/base/unique_fd.h | 69 +++++
include/libcamera/framebuffer.h | 5 +-
include/libcamera/geometry.h | 2 +-
.../libcamera/internal/ipa_data_serializer.h | 40 +--
include/libcamera/internal/ipc_pipe.h | 9 +-
include/libcamera/internal/ipc_unixsocket.h | 7 +-
include/libcamera/internal/media_device.h | 3 +-
include/libcamera/internal/process.h | 4 +-
include/libcamera/internal/v4l2_device.h | 9 +-
include/libcamera/internal/v4l2_videodevice.h | 4 +-
include/libcamera/ipa/core.mojom | 6 +-
include/libcamera/ipa/raspberrypi.mojom | 2 +-
include/libcamera/meson.build | 2 -
src/android/camera_device.cpp | 2 +-
src/ipa/raspberrypi/raspberrypi.cpp | 4 +-
src/libcamera/base/event_dispatcher_poll.cpp | 11 +-
src/libcamera/base/file.cpp | 48 +++-
src/libcamera/base/meson.build | 2 +
src/libcamera/base/shared_fd.cpp | 262 +++++++++++++++++
src/libcamera/base/unique_fd.cpp | 123 ++++++++
src/libcamera/file_descriptor.cpp | 272 ------------------
src/libcamera/framebuffer.cpp | 11 +-
src/libcamera/ipa_data_serializer.cpp | 100 +++----
src/libcamera/ipc_pipe.cpp | 4 +-
src/libcamera/ipc_pipe_unixsocket.cpp | 8 +-
src/libcamera/ipc_unixsocket.cpp | 43 +--
src/libcamera/media_device.cpp | 36 +--
src/libcamera/meson.build | 1 -
.../pipeline/raspberrypi/dma_heaps.cpp | 28 +-
.../pipeline/raspberrypi/dma_heaps.h | 10 +-
.../pipeline/raspberrypi/raspberrypi.cpp | 11 +-
src/libcamera/process.cpp | 16 +-
src/libcamera/v4l2_device.cpp | 23 +-
src/libcamera/v4l2_videodevice.cpp | 51 ++--
src/v4l2/v4l2_camera.cpp | 6 +-
src/v4l2/v4l2_camera.h | 4 +-
src/v4l2/v4l2_camera_proxy.cpp | 6 +-
test/ipc/unixsocket.cpp | 14 +-
test/ipc/unixsocket_ipc.cpp | 8 +-
test/meson.build | 3 +-
.../ipa_data_serializer_test.cpp | 14 +-
test/{file-descriptor.cpp => shared-fd.cpp} | 47 ++-
test/unique-fd.cpp | 220 ++++++++++++++
.../module_ipa_proxy.cpp.tmpl | 2 +-
.../module_ipa_proxy.h.tmpl | 2 +-
.../module_ipa_proxy_worker.cpp.tmpl | 13 +-
.../libcamera_templates/proxy_functions.tmpl | 2 +-
.../libcamera_templates/serializer.tmpl | 22 +-
.../generators/mojom_libcamera_generator.py | 6 +-
54 files changed, 1030 insertions(+), 607 deletions(-)
rename include/libcamera/{ => base}/compiler.h (100%)
rename include/libcamera/{file_descriptor.h => base/shared_fd.h} (52%)
create mode 100644 include/libcamera/base/unique_fd.h
create mode 100644 src/libcamera/base/shared_fd.cpp
create mode 100644 src/libcamera/base/unique_fd.cpp
delete mode 100644 src/libcamera/file_descriptor.cpp
rename test/{file-descriptor.cpp => shared-fd.cpp} (80%)
create mode 100644 test/unique-fd.cpp
base-commit: cb1de3990787c2e4e3b4a214758157b2869482cc
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list