[{"id":19384,"web_url":"https://patchwork.libcamera.org/comment/19384/","msgid":"<d499405c-5d4a-635a-664a-f8fc9e1ee84f@ideasonboard.com>","date":"2021-09-05T16:17:40","subject":"Re: [libcamera-devel] [PATCH] v4l2: Use\n\tV4L2PixelFormat::toPixelFormat()","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 9/4/21 1:53 AM, Laurent Pinchart wrote:\n> Replace the open-coded PixelFormat lookup with the\n> V4L2PixelFormat::toPixelFormat() helper function. This simplifies the\n> implementation.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>   src/v4l2/v4l2_camera_proxy.cpp | 10 ++++------\n>   1 file changed, 4 insertions(+), 6 deletions(-)\n>\n> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> index 7682c4bddf90..07b1a90aa32f 100644\n> --- a/src/v4l2/v4l2_camera_proxy.cpp\n> +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> @@ -243,7 +243,7 @@ int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_fr\n>   \tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_framesizes fd = \" << file->efd();\n>   \n>   \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->pixel_format);\n> -\tPixelFormat format = PixelFormatInfo::info(v4l2Format).format;\n> +\tPixelFormat format = v4l2Format.toPixelFormat();\n>   \t/*\n>   \t * \\todo This might need to be expanded as few pipeline handlers\n>   \t * report StreamFormats.\n> @@ -299,7 +299,7 @@ int V4L2CameraProxy::vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>   int V4L2CameraProxy::tryFormat(struct v4l2_format *arg)\n>   {\n>   \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->fmt.pix.pixelformat);\n> -\tPixelFormat format = PixelFormatInfo::info(v4l2Format).format;\n> +\tPixelFormat format = v4l2Format.toPixelFormat();\n>   \tSize size(arg->fmt.pix.width, arg->fmt.pix.height);\n>   \n>   \tStreamConfiguration config;\n> @@ -348,8 +348,7 @@ int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>   \n>   \tSize size(arg->fmt.pix.width, arg->fmt.pix.height);\n>   \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->fmt.pix.pixelformat);\n> -\tret = vcam_->configure(&streamConfig_, size,\n> -\t\t\t       PixelFormatInfo::info(v4l2Format).format,\n> +\tret = vcam_->configure(&streamConfig_, size, v4l2Format.toPixelFormat(),\n>   \t\t\t       bufferCount_);\n>   \tif (ret < 0)\n>   \t\treturn -EINVAL;\n> @@ -491,8 +490,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n>   \tSize size(v4l2PixFormat_.width, v4l2PixFormat_.height);\n>   \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(v4l2PixFormat_.pixelformat);\n>   \tint ret = vcam_->configure(&streamConfig_, size,\n> -\t\t\t\t   PixelFormatInfo::info(v4l2Format).format,\n> -\t\t\t\t   arg->count);\n> +\t\t\t\t   v4l2Format.toPixelFormat(), arg->count);\n>   \tif (ret < 0)\n>   \t\treturn -EINVAL;\n>","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 95DE7BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  5 Sep 2021 16:18:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 86B7C6916A;\n\tSun,  5 Sep 2021 18:18:02 +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 DC9F860253\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  5 Sep 2021 18:17:45 +0200 (CEST)","from [192.168.1.104] (unknown [103.251.226.76])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BE0D945E;\n\tSun,  5 Sep 2021 18:17:44 +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=\"dRb4wdyr\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630858665;\n\tbh=UcLJb94GmlAr/eiHqk85PbAVnaUlHJCqyVJdgJvyUiI=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=dRb4wdyrOP9cCBcXWOSzJ6su7J3Fbtuv7LRTxKAbYr3ZP2+9bqDDEfWwCmXmNTyWt\n\tkmv5mRqC+zAtu9seXRoIVuwQ+C75s/LE35WeTz405/O16iCLB9yKgWJI/m1EuEEmEB\n\t2S7mbEfDLJ8iEWfz7oQJ5KCP7q28hke8q5jqWhlY=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210903202305.17689-1-laurent.pinchart@ideasonboard.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<d499405c-5d4a-635a-664a-f8fc9e1ee84f@ideasonboard.com>","Date":"Sun, 5 Sep 2021 21:47:40 +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":"<20210903202305.17689-1-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH] v4l2: Use\n\tV4L2PixelFormat::toPixelFormat()","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>"}},{"id":19385,"web_url":"https://patchwork.libcamera.org/comment/19385/","msgid":"<996733b4-8227-e874-204a-c57048663c6f@ideasonboard.com>","date":"2021-09-05T18:54:01","subject":"Re: [libcamera-devel] [PATCH] v4l2: Use\n\tV4L2PixelFormat::toPixelFormat()","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 03/09/2021 21:23, Laurent Pinchart wrote:\n> Replace the open-coded PixelFormat lookup with the\n> V4L2PixelFormat::toPixelFormat() helper function. This simplifies the\n> implementation.\n\nLooks ok to me too,\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasoboard.com>\n\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/v4l2/v4l2_camera_proxy.cpp | 10 ++++------\n>  1 file changed, 4 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> index 7682c4bddf90..07b1a90aa32f 100644\n> --- a/src/v4l2/v4l2_camera_proxy.cpp\n> +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> @@ -243,7 +243,7 @@ int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_fr\n>  \tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_framesizes fd = \" << file->efd();\n>  \n>  \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->pixel_format);\n> -\tPixelFormat format = PixelFormatInfo::info(v4l2Format).format;\n> +\tPixelFormat format = v4l2Format.toPixelFormat();\n>  \t/*\n>  \t * \\todo This might need to be expanded as few pipeline handlers\n>  \t * report StreamFormats.\n> @@ -299,7 +299,7 @@ int V4L2CameraProxy::vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>  int V4L2CameraProxy::tryFormat(struct v4l2_format *arg)\n>  {\n>  \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->fmt.pix.pixelformat);\n> -\tPixelFormat format = PixelFormatInfo::info(v4l2Format).format;\n> +\tPixelFormat format = v4l2Format.toPixelFormat();\n>  \tSize size(arg->fmt.pix.width, arg->fmt.pix.height);\n>  \n>  \tStreamConfiguration config;\n> @@ -348,8 +348,7 @@ int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>  \n>  \tSize size(arg->fmt.pix.width, arg->fmt.pix.height);\n>  \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->fmt.pix.pixelformat);\n> -\tret = vcam_->configure(&streamConfig_, size,\n> -\t\t\t       PixelFormatInfo::info(v4l2Format).format,\n> +\tret = vcam_->configure(&streamConfig_, size, v4l2Format.toPixelFormat(),\n>  \t\t\t       bufferCount_);\n>  \tif (ret < 0)\n>  \t\treturn -EINVAL;\n> @@ -491,8 +490,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n>  \tSize size(v4l2PixFormat_.width, v4l2PixFormat_.height);\n>  \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(v4l2PixFormat_.pixelformat);\n>  \tint ret = vcam_->configure(&streamConfig_, size,\n> -\t\t\t\t   PixelFormatInfo::info(v4l2Format).format,\n> -\t\t\t\t   arg->count);\n> +\t\t\t\t   v4l2Format.toPixelFormat(), arg->count);\n>  \tif (ret < 0)\n>  \t\treturn -EINVAL;\n>  \n>","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 2A964BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  5 Sep 2021 18:54:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7DB6869168;\n\tSun,  5 Sep 2021 20:54:07 +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 0AC7260253\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  5 Sep 2021 20:54:05 +0200 (CEST)","from [192.168.0.20]\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 7899D45E;\n\tSun,  5 Sep 2021 20:54:04 +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=\"Hytx4p3N\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630868044;\n\tbh=Tr4+oZH4l2zcTcrBI5Gq2X4eMaG2fnzuHNV2Q2jY3NA=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=Hytx4p3N90M3fbpH/tkcacH0swvD7UsaC6kjCkvRCCttHPEGqnJrcrahnjsI13300\n\tYaNx7myaw5YpslkOsIyHG0lt/VhqsiPhtkrV8DpHOAr4NL17bWtU5YAg7mAg5qcU1d\n\tnhxhh1zG9uRjjQDaO5U8v1Ob2jvyk4eW8SmqhswY=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210903202305.17689-1-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<996733b4-8227-e874-204a-c57048663c6f@ideasonboard.com>","Date":"Sun, 5 Sep 2021 19:54:01 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<20210903202305.17689-1-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] v4l2: Use\n\tV4L2PixelFormat::toPixelFormat()","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>"}}]