From patchwork Wed Oct 27 12:07:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 14365 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 D847FBF415 for ; Wed, 27 Oct 2021 12:07:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 380F66487F; Wed, 27 Oct 2021 14:07:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="I+57oqWo"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 96BC060123 for ; Wed, 27 Oct 2021 14:07:17 +0200 (CEST) Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2F289596; Wed, 27 Oct 2021 14:07:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1635336437; bh=slMtmDuAj5Z6tGnsaQJ0kUi/oJseJzdm6qRYl2c6TC0=; h=From:To:Cc:Subject:Date:From; b=I+57oqWowaCoNBJSgWcE6BquR6ea3Hr4TVJfRdZw+4A3+YK+wNDA4wlg+op1iDHri EmFQghKTx25ZmRJ/utKc3mHpa2Sog/4dyRDGMsfGQxZZrtNnLUclLNSc7kTwZzWMeh 0MU/5v23JvckD/sRhncWpudQ0kmf6emkaU2fa5G8= From: Kieran Bingham To: libcamera devel Date: Wed, 27 Oct 2021 13:07:13 +0100 Message-Id: <20211027120713.2240563-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: v4l2_videodevice: provide hasMediaController() 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The V4L2Capability has helpers to interogate the capabilities of a device. V4L2VideoDevice::enumPixelformats accesses the raw capabilites to check if the device is supported by a MediaController device. Provide a helper, and update the usage. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Naushir Patuck --- This might also be used in the upcoming RPi MediaController series, but shouldn't block integration of that ... --- include/libcamera/internal/v4l2_videodevice.h | 4 ++++ src/libcamera/v4l2_videodevice.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index efe34d47e72b..a1c458e45088 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -109,6 +109,10 @@ struct V4L2Capability final : v4l2_capability { { return device_caps() & V4L2_CAP_STREAMING; } + bool hasMediaController() const + { + return device_caps() & V4L2_CAP_IO_MC; + } }; class V4L2BufferCache diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 0cc622f91f2d..0fbf32bcfc00 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1019,7 +1019,7 @@ std::vector V4L2VideoDevice::enumPixelformats(uint32_t code) std::vector formats; int ret; - if (code && !(caps_.device_caps() & V4L2_CAP_IO_MC)) { + if (code && !(caps_.hasMediaController())) { LOG(V4L2, Error) << "Media bus code filtering not supported by the device"; return {};