[{"id":20577,"web_url":"https://patchwork.libcamera.org/comment/20577/","msgid":"<27a090d6-4053-f2e6-3352-a9aa403b071f@ideasonboard.com>","date":"2021-10-27T13:05:53","subject":"Re: [libcamera-devel] [PATCH v2] libcamera: v4l2_videodevice:\n\tprovide hasMediaController()","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hello,\n\nOn 10/27/21 6:28 PM, Kieran Bingham wrote:\n> The V4L2Capability has helpers to interogate the capabilities\n> of a device.\n>\n> V4L2VideoDevice::enumPixelformats accesses the raw capabilites to check\n> if the device is supported by a MediaController device.\n>\n> Provide a helper, and update the usage.\n>\n> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n>\n> ---\n> This might also be used in the upcoming RPi MediaController series, but\n> shouldn't block integration of that ...\n>\n> v2:\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(-)\n>\n> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> index 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\n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index 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 {};","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 3E4D6BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 13:06:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 955D664882;\n\tWed, 27 Oct 2021 15:06:00 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0E0D560123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 15:05:59 +0200 (CEST)","from [192.168.1.106] (unknown [103.251.226.211])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 417A0292;\n\tWed, 27 Oct 2021 15:05:58 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"RtOBmdRa\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635339958;\n\tbh=JOKKYQpVbP4ff8j2cHuYMCUCeSNBNzkr0SnHUsmkqNg=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=RtOBmdRaGbM9JajMhdvVcSZKbfqUNAcNQFaUjPlSTzBzXtMbCnbhwGjSzokkkYlDc\n\tBS9oniFhcRdM4mOwZzCL7NtJY0Bgn+Poac/OMxB+jhw2hq/L/gixwd6I4MHqtp30G2\n\tjiii5XwVeMCJJYxx1xSoly7Uddh+ENTTdLxrxWKc=","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","References":"<20211027125800.2266841-1-kieran.bingham@ideasonboard.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<27a090d6-4053-f2e6-3352-a9aa403b071f@ideasonboard.com>","Date":"Wed, 27 Oct 2021 18:35:53 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.10.2","MIME-Version":"1.0","In-Reply-To":"<20211027125800.2266841-1-kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH v2] libcamera: v4l2_videodevice:\n\tprovide hasMediaController()","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>"}}]