From patchwork Fri Jun 19 05:41:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 4080 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 089F3603BF for ; Fri, 19 Jun 2020 07:41:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="b2dPwGTC"; dkim-atps=neutral Received: from jade.flets-east.jp (unknown [IPv6:2400:4051:61:600:e972:d773:e99a:4f79]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 99971556; Fri, 19 Jun 2020 07:41:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1592545294; bh=sfXo4kfmDRYhcUlkbwKs8iiO25MRv1VywCK7brO0/QI=; h=From:To:Cc:Subject:Date:From; b=b2dPwGTC3VMrq45HdR8THdGAS9vDLMtmG0GK0MNeCtMrVfgAkh5+jy8eQAX3xNuuW iiqtHypedb1Lz3p21HCOFCBTJpecmMvROKqnaV3DLtoIIdlChgZWAgSVVuc4DvSLLJ 5HPIHV+lX0OZEY4Xj8OYj20HuZ/ER0WecUr7qhQ4= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 19 Jun 2020 14:41:06 +0900 Message-Id: <20200619054123.19052-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 00/17] Support v4l2-compliance 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: Fri, 19 Jun 2020 05:41:36 -0000 This patchset makes the V4L2 compatibility layer comply with v4l2-compliance, and v4l2-compliance -s. I have gotten zero failues and 2 warnings with a uvcvideo libcamera camera. The two warnings are that VIDIOC_S_FMT doesn't work from a second fd (after a different fd has already called it), and that VIDIOC_CREATEBUFS is not supported, which I think are fair to not support. Note that there are a couple failues when using a vimc libcamera camera, as these cameras doesn't support setting frame sizes that are not multiples of 3. Also, while trying to comply with v4l2-compliance I lost support for firefox. I'll look into this. qv4l2 still works, though. The biggest change in v2 was adding V4L2CameraFile to contain all the information related to the open file instance, instead of containing maps for them within V4L2CameraProxy. dup is handled solely in V4L2CompatManager, by adding another fd -> V4L2CameraFile map. The V4L2CameraFile recount is handled automatically by V4L2CompatManager with shared pointers, while V4L2CameraProxy recount is handled manually, since it is not constructed and deconstructed but rather is open()ed and close()d. The other changes are minor in comparison. One is consolidating the null arg checks in the ioctl handlerrs. Another is splitting all the v4l2-compliance streaming test fixes to their own patches. Paul Elder (17): v4l2: v4l2_camera_file: Add V4L2CameraFile to model the opened camera file v4l2: v4l2_compat: Support multiple open v4l2: v4l2_camera_proxy: Check for null arg values in main ioctl handler v4l2: v4l2_camera_proxy: Fix v4l2-compliance support for extended formats v4l2: v4l2_camera_proxy: Implement VIDIOC_G/S_PRIORITY v4l2: v4l2_camera_proxy: Implement VIDIOC_ENUMINPUT, VIDIOC_G/S_INPUT v4l2: v4l2_camera_proxy: Implement VIDIOC_ENUM_FRAMESIZES v4l2: v4l2_camera: Add isRunning() v4l2: v4l2_camera_proxy: Disallow dqbuf when not streaming v4l2: v4l2_camera_proxy: noop if streamon when stream is already on v4l2: v4l2_camera_proxy: Reset buffer flags on reqbufs 0 v4l2: v4l2_camera: Don't use libcamera::Semaphore for available buffers v4l2: v4l2_camera: Clear pending requests on freeBuffers and streamOff v4l2: v4l2_camera_proxy: Check arg->index bounds for querybuf, qbuf, dqbuf v4l2: v4l2_camera_proxy: Don't allow streamon if no buffers have been requested v4l2: v4l2_camera_proxy: Don't allow buffers to be freed if still mmaped v4l2: v4l2_camera_proxy: Fix buffer flags related to queueing src/v4l2/meson.build | 1 + src/v4l2/v4l2_camera.cpp | 44 +++- src/v4l2/v4l2_camera.h | 10 +- src/v4l2/v4l2_camera_file.cpp | 45 ++++ src/v4l2/v4l2_camera_file.h | 35 +++ src/v4l2/v4l2_camera_proxy.cpp | 402 +++++++++++++++++++++++++------ src/v4l2/v4l2_camera_proxy.h | 57 +++-- src/v4l2/v4l2_compat_manager.cpp | 71 +++--- src/v4l2/v4l2_compat_manager.h | 4 +- 9 files changed, 539 insertions(+), 130 deletions(-) create mode 100644 src/v4l2/v4l2_camera_file.cpp create mode 100644 src/v4l2/v4l2_camera_file.h