From patchwork Tue Dec 31 05:33:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 2477 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 872EC60465 for ; Tue, 31 Dec 2019 06:33:23 +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 66670DF; Tue, 31 Dec 2019 06:33:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1577770403; bh=mtWsdsyWmNS0DL47DnyWpCBuS+aW8FUgdRjX99Uyb0c=; h=From:To:Cc:Subject:Date:From; b=E6SO5btSKLnMvpKvKSUPQYcduS+lMVTsE/VnVIUlCWeoy7n2oeKr2qkTOBHeIDz1u XkJ8yi/mog+J0oyPWiYwnDb6JucdUvztiOO1i7Btb4HLAK/LHAr32yiql4O2LmFm++ qthM4boRvirt5qOfwabWIttAtse3GTqsB9Q8f/+w= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 30 Dec 2019 23:33:10 -0600 Message-Id: <20191231053314.20063-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 0/4] 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: Tue, 31 Dec 2019 05:33:23 -0000 Implement the initial version of the V4L2 compatibility layer. In v3 we retrieved 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 pipeline handler. 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. In v4 the infrastructure between the camera manager and the pipeline handler to assign and retrieve, respectively, this mapping is simplified. This is 2/4. 3/4 implements the mapping assignment for the uvcvideo pipeline handler. In v3 we also saw the addition of the FrameMetadata class that extracted 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. In v4 this buffer tracking mechanism is squashed into the main V4L2 compatibility layer patch, 4/4. There are really no other major changes on this scale, aside from minor fixes and cosmetic changes. Paul Elder (4): libcamera: v4l2_device, v4l2_videodevice: call open system call directly libcamera: camera_manager, pipeline_handler: allow retrieving cameras by device numbers libcamera: pipeline_handler: uvcvideo: register all Cameras along with a devnum v4l2: v4l2_compat: Add V4L2 compatibility layer include/libcamera/camera_manager.h | 5 +- meson_options.txt | 5 + src/libcamera/camera_manager.cpp | 37 +- src/libcamera/include/pipeline_handler.h | 3 +- src/libcamera/pipeline/uvcvideo.cpp | 7 +- src/libcamera/pipeline_handler.cpp | 13 +- src/libcamera/v4l2_device.cpp | 3 +- src/libcamera/v4l2_videodevice.cpp | 4 +- src/meson.build | 4 + src/v4l2/meson.build | 31 ++ src/v4l2/v4l2_camera.cpp | 233 ++++++++ src/v4l2/v4l2_camera.h | 83 +++ src/v4l2/v4l2_camera_proxy.cpp | 649 +++++++++++++++++++++++ src/v4l2/v4l2_camera_proxy.h | 82 +++ src/v4l2/v4l2_compat.cpp | 80 +++ src/v4l2/v4l2_compat_manager.cpp | 255 +++++++++ src/v4l2/v4l2_compat_manager.h | 77 +++ 17 files changed, 1562 insertions(+), 9 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