From patchwork Wed Jan 17 14:42:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 19415 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 3195DC323E for ; Wed, 17 Jan 2024 14:42:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D837F628BA; Wed, 17 Jan 2024 15:42:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1705502566; bh=gx2IqGOSyxJd6ItcxIWAxzYthLERK6fhd0alJ1r0AFQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=mzV3jkm7tJpgCePh+Na81HjDAnto0lAvV6aEIuPz5pc0kadp3XXJFDljvamOAUHsd y57V2rnT/Tl/2BiB0Tz2QaavPnnne3VjsApm4y52xLaR6ZQHAORRo3IEyMnHCbFzvo rCR/RaEAMad1s1vDw0q0YxAfUKtlWgdqpeo/KeMPJB/aZQA6sWUfGHckrKAdDVOmnv 9+taTbbFrOedsttQ/zOfFf8F/C3Y7i7jdnoC7XfRutLmvu7Mc9ij08PwknMVXjZW5n accgfG9CVNt1o2I4n9LMNnXgqX3QtwHf7S4nuXGhgoI6+1dPhD7SZP7DJHlDwJhcYN mQIRVxsGb2KPg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 51258628B6 for ; Wed, 17 Jan 2024 15:42:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="epGf+DCW"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi [89.27.53.110]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6DD897EC; Wed, 17 Jan 2024 15:41:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1705502492; bh=gx2IqGOSyxJd6ItcxIWAxzYthLERK6fhd0alJ1r0AFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=epGf+DCWShxlOHpo4POyZP+CaIeYXVksuiuXODXr1tOjMNi2qHIUfexcXObZtwihw FvgDmZkmFkuDX490Ym99i+iiMg89Lmvy+jC82e0tJe89HigutwV/gVZAU9iUox01DW rDoKibo6DYJ2DPDZnpjE80OX4kXcZLQSODgfG6NI= To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Jan 2024 16:42:35 +0200 Message-ID: <20240117144242.9903-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240117144242.9903-1-laurent.pinchart@ideasonboard.com> References: <20240117144242.9903-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: v4l2_subdevice: Enable streams API when supported 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-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The streams API needs to be enabled explictly by setting a subdev client capability. Do so unconditionally for subdevs that expose streams support. We don't need any kernel version check to use the VIDIOC_SUBDEV_S_CLIENT_CAP ioctl, as it is guaranteed to be supported by kernels that support streams. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Tested-by: Kieran Bingham --- src/libcamera/v4l2_subdevice.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 15e8206a915c..75ad11e55272 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -359,6 +359,21 @@ int V4L2Subdevice::open() return ret; } + /* If the subdev supports streams, enable the streams API. */ + if (caps_.hasStreams()) { + struct v4l2_subdev_client_capability clientCaps{}; + clientCaps.capabilities = V4L2_SUBDEV_CLIENT_CAP_STREAMS; + + ret = ioctl(VIDIOC_SUBDEV_S_CLIENT_CAP, &clientCaps); + if (ret < 0) { + ret = -errno; + LOG(V4L2, Error) + << "Unable to set client capabilities: " + << strerror(-ret); + return ret; + } + } + return 0; }