{"id":14368,"url":"https://patchwork.libcamera.org/api/1.1/patches/14368/?format=json","web_url":"https://patchwork.libcamera.org/patch/14368/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20211027125800.2266841-1-kieran.bingham@ideasonboard.com>","date":"2021-10-27T12:58:00","name":"[libcamera-devel,v2] libcamera: v4l2_videodevice: provide hasMediaController()","commit_ref":"0a1aaa8d55cdd2530f41e70242dc8ea9a3b46577","pull_url":null,"state":"accepted","archived":false,"hash":"2c5b464f1596fbdde5edaa11c46fddde71852c79","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14368/mbox/","series":[{"id":2665,"url":"https://patchwork.libcamera.org/api/1.1/series/2665/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2665","date":"2021-10-27T12:58:00","name":"[libcamera-devel,v2] libcamera: v4l2_videodevice: provide hasMediaController()","version":2,"mbox":"https://patchwork.libcamera.org/series/2665/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14368/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14368/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C31D8BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 12:58:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3380E6487F;\n\tWed, 27 Oct 2021 14:58:06 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7796A60123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 14:58:04 +0200 (CEST)","from Monstersaurus.local\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EFD2B596;\n\tWed, 27 Oct 2021 14:58:03 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mwkmD1wK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635339484;\n\tbh=7VGsEfP2wwZaXmszPCNIvRJXntIS/rUQdPM8kO03PA4=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=mwkmD1wKdzBSoom4ij6P6XI6HPlTWwdQTa9952Kenk265UpnSkZz8a/gVgbAq5I7V\n\thK01Q01NK2bcNCyJLixrq//tRTCRTNFUOlaSKj09rQXwB/qXaJO2sfIYYxU+SDifZC\n\t/ihQ5PeiyCxvoFQg6K5OzBtMYp6/OVqwDD40+pS4=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Wed, 27 Oct 2021 13:58:00 +0100","Message-Id":"<20211027125800.2266841-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.30.2","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2] libcamera: v4l2_videodevice: provide\n\thasMediaController()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The V4L2Capability has helpers to interogate the capabilities\nof a device.\n\nV4L2VideoDevice::enumPixelformats accesses the raw capabilites to check\nif the device is supported by a MediaController device.\n\nProvide a helper, and update the usage.\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nThis might also be used in the upcoming RPi MediaController series, but\nshouldn't block integration of that ...\n\nv2:\n - Add documentation\n - Simplify usage in V4L2VideoDevice::enumPixelformats\n---\n include/libcamera/internal/v4l2_videodevice.h | 4 ++++\n src/libcamera/v4l2_videodevice.cpp            | 8 +++++++-\n 2 files changed, 11 insertions(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex efe34d47e72b..a1c458e45088 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -109,6 +109,10 @@ struct V4L2Capability final : v4l2_capability {\n \t{\n \t\treturn device_caps() & V4L2_CAP_STREAMING;\n \t}\n+\tbool hasMediaController() const\n+\t{\n+\t\treturn device_caps() & V4L2_CAP_IO_MC;\n+\t}\n };\n \n class V4L2BufferCache\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 0cc622f91f2d..4f04212df672 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -140,6 +140,12 @@ LOG_DECLARE_CATEGORY(V4L2)\n  * \\return True if the video device provides Streaming I/O IOCTLs\n  */\n \n+/**\n+ * \\fn V4L2Capability::hasMediaController()\n+ * \\brief Determine if the video device uses Media Controller to configure I/O\n+ * \\return True if the video device is controlled by a Media Controller device\n+ */\n+\n /**\n  * \\class V4L2BufferCache\n  * \\brief Hot cache of associations between V4L2 buffer indexes and FrameBuffer\n@@ -1019,7 +1025,7 @@ std::vector<V4L2PixelFormat> V4L2VideoDevice::enumPixelformats(uint32_t code)\n \tstd::vector<V4L2PixelFormat> formats;\n \tint ret;\n \n-\tif (code && !(caps_.device_caps() & V4L2_CAP_IO_MC)) {\n+\tif (code && !caps_.hasMediaController()) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Media bus code filtering not supported by the device\";\n \t\treturn {};\n","prefixes":["libcamera-devel","v2"]}