From patchwork Mon Dec 23 07:26:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 2443 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 81D776046D for ; Mon, 23 Dec 2019 08:26:46 +0100 (CET) Received: from neptunite.amanokami.net (173-16-160-11.client.mchsi.com [173.16.160.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0A696330; Mon, 23 Dec 2019 08:26:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1577086005; bh=ZIaCv5TjCk+dabR9tG0F0yqkAqCsAhQOS8+OKZtesM4=; h=From:To:Cc:Subject:Date:From; b=lmMVniVBVDguHqLGT6g1QhB19vffYki3uXC3sQ4Q4yGGdW+QvV5fehFMJBRJFt5G0 veDPMal4KGGwP42E+4TIgCbNqkDRiFmYRFgC+f94TYe4kGGsRbQeuq/AAs6+bz63F8 8UMM7Bjrx0VcYlcGsmIikTzfX0akWoQkKJ3QnaLw= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 23 Dec 2019 01:26:14 -0600 Message-Id: <20191223072620.13022-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 0/6] V4L2 compatibility layer X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 07:26:46 -0000 Implement the initial version of the V4L2 compatibility layer. In v3 we newly retrieve libcamera Cameras based on the device number of the V4L2 device that the applications open()s. This device number to Camera mapping is optionally determined by the device enumerator. If the mapping is not assigned, then there is simply no V4L2 device node that can be opened that will map to a libcamera Camera. Patches 2/6, 3/6, and 4/6 prepare the infrastructure in the pipeline handler, the uvcvideo pipeline handler, and the camera manager for this to work. The other major change in v3 is the addition of the FrameMetadata class that extracts the necessary information from a Buffer to expose a v4l2_buffer, as well as a new mechanism using this FrameMetadata to cache the state of all completed buffers in the V4L2CameraProxy to reduce the number of cross-thread calls. Patche 5/6 is the main implementation, and patch 6/6 contains the new buffer state component. Paul Elder (6): libcamera: v4l2_device, v4l2_videodevice: call open system call directly libcamera: pipeline_handler: Add map from devnum to cameras libcamera: pipeline_handler: uvcvideo: register all Cameras along with a devnum libcamera: camera_manager: allow retrieving cameras by devnum v4l2: v4l2_compat: Add V4L2 compatibility layer v4l2: v4l2-compat: add buffer state tracking to V4L2CameraProxy include/libcamera/camera_manager.h | 3 + meson_options.txt | 5 + src/libcamera/camera_manager.cpp | 24 ++ src/libcamera/include/pipeline_handler.h | 6 + src/libcamera/pipeline/uvcvideo.cpp | 7 +- src/libcamera/pipeline_handler.cpp | 30 ++ src/libcamera/v4l2_device.cpp | 3 +- src/libcamera/v4l2_videodevice.cpp | 3 +- src/meson.build | 4 + src/v4l2/meson.build | 31 ++ src/v4l2/v4l2_camera.cpp | 240 +++++++++++ src/v4l2/v4l2_camera.h | 83 ++++ src/v4l2/v4l2_camera_proxy.cpp | 528 +++++++++++++++++++++++ src/v4l2/v4l2_camera_proxy.h | 73 ++++ src/v4l2/v4l2_compat.cpp | 78 ++++ src/v4l2/v4l2_compat_manager.cpp | 379 ++++++++++++++++ src/v4l2/v4l2_compat_manager.h | 86 ++++ 17 files changed, 1579 insertions(+), 4 deletions(-) create mode 100644 src/v4l2/meson.build create mode 100644 src/v4l2/v4l2_camera.cpp create mode 100644 src/v4l2/v4l2_camera.h create mode 100644 src/v4l2/v4l2_camera_proxy.cpp create mode 100644 src/v4l2/v4l2_camera_proxy.h create mode 100644 src/v4l2/v4l2_compat.cpp create mode 100644 src/v4l2/v4l2_compat_manager.cpp create mode 100644 src/v4l2/v4l2_compat_manager.h