[{"id":5294,"web_url":"https://patchwork.libcamera.org/comment/5294/","msgid":"<20200620011728.GR5823@pendragon.ideasonboard.com>","date":"2020-06-20T01:17:28","subject":"Re: [libcamera-devel] [PATCH v2 04/17] v4l2: v4l2_camera_proxy: Fix\n\tv4l2-compliance support for extended formats","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Fri, Jun 19, 2020 at 02:41:10PM +0900, Paul Elder wrote:\n> Fix the following v4l2-compliance error:\n> \n> fail: v4l2-compliance.cpp(652): !(caps & V4L2_CAP_EXT_PIX_FORMAT)\n> \n> Simply add V4L2_CAP_EXT_PIX_FORMAT to capabilities in querycap.\n> \n> In addition, populate the necessary fields in struct v4l2_pix_format to\n> support extended pixel formats in try_fmt and g/s_fmt, and clear the\n> reserved field for enum_fmt.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> Acked-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> ---\n> Changes in v2:\n> - squashed the \"Fix v4l2-compliance format tests\" into this one, since\n>   those fixes were a necessity of this fix (plus they're related)\n> - use _DEFAULT for ycbcr_enc and quantization\n> ---\n>  src/v4l2/v4l2_camera_proxy.cpp | 18 +++++++++++++++---\n>  1 file changed, 15 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> index cff6562..117d7ff 100644\n> --- a/src/v4l2/v4l2_camera_proxy.cpp\n> +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> @@ -168,6 +168,9 @@ void V4L2CameraProxy::setFmtFromConfig(StreamConfiguration &streamConfig)\n>  \t\t\t  curV4L2Format_.fmt.pix.width,\n>  \t\t\t  curV4L2Format_.fmt.pix.height);\n>  \tcurV4L2Format_.fmt.pix.colorspace = V4L2_COLORSPACE_SRGB;\n> +\tcurV4L2Format_.fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n> +\tcurV4L2Format_.fmt.pix.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;\n> +\tcurV4L2Format_.fmt.pix.quantization = V4L2_QUANTIZATION_DEFAULT;\n\nShouldn't you also set xfer_func ? Same below.\n\n>  }\n>  \n>  unsigned int V4L2CameraProxy::calculateSizeImage(StreamConfiguration &streamConfig)\n> @@ -194,7 +197,9 @@ void V4L2CameraProxy::querycap(std::shared_ptr<Camera> camera)\n>  \t\t       sizeof(capabilities_.bus_info));\n>  \t/* \\todo Put this in a header/config somewhere. */\n>  \tcapabilities_.version = KERNEL_VERSION(5, 2, 0);\n> -\tcapabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;\n> +\tcapabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE\n> +\t\t\t\t  | V4L2_CAP_STREAMING\n\nYou could keep these two in a single line, up to you.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t\t\t\t  | V4L2_CAP_EXT_PIX_FORMAT;\n>  \tcapabilities_.capabilities = capabilities_.device_caps\n>  \t\t\t\t   | V4L2_CAP_DEVICE_CAPS;\n>  \tmemset(capabilities_.reserved, 0, sizeof(capabilities_.reserved));\n> @@ -243,11 +248,15 @@ int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *cf, struct v4l2_fmtdesc *ar\n>  \t    arg->index >= streamConfig_.formats().pixelformats().size())\n>  \t\treturn -EINVAL;\n>  \n> +\t/* \\todo Set V4L2_FMT_FLAG_COMPRESSED for compressed formats. */\n> +\targ->flags = 0;\n>  \t/* \\todo Add map from format to description. */\n> -\tutils::strlcpy(reinterpret_cast<char *>(arg->description), \"Video Format Description\",\n> -\t\t       sizeof(arg->description));\n> +\tutils::strlcpy(reinterpret_cast<char *>(arg->description),\n> +\t\t       \"Video Format Description\", sizeof(arg->description));\n>  \targ->pixelformat = drmToV4L2(streamConfig_.formats().pixelformats()[arg->index]);\n>  \n> +\tmemset(arg->reserved, 0, sizeof(arg->reserved));\n> +\n>  \treturn 0;\n>  }\n>  \n> @@ -287,6 +296,9 @@ void V4L2CameraProxy::tryFormat(struct v4l2_format *arg)\n>  \t\t\t\t\t      arg->fmt.pix.width,\n>  \t\t\t\t\t      arg->fmt.pix.height);\n>  \targ->fmt.pix.colorspace   = V4L2_COLORSPACE_SRGB;\n> +\targ->fmt.pix.priv         = V4L2_PIX_FMT_PRIV_MAGIC;\n> +\targ->fmt.pix.ycbcr_enc    = V4L2_YCBCR_ENC_DEFAULT;\n> +\targ->fmt.pix.quantization = V4L2_QUANTIZATION_DEFAULT;\n>  }\n>  \n>  int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *cf, struct v4l2_format *arg)","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 DA569609A5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Jun 2020 03:17:52 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4F3E9308;\n\tSat, 20 Jun 2020 03:17:52 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ValSjUfE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592615872;\n\tbh=gsc6KnYDgH5b8ASSdN7+K8mFPrEGMDkyYmyYQcg6Jp8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ValSjUfEupiJNDFlsJmM//9XGniXqJ5OJ1CGGDMVdtJ6cGeNfgzM7P0wkBgmQLUhK\n\tzY1rrTtObZlpsGnxCpUPuvC0Le1hrDELfbDsQ53jz3S1Hm3s7p3sSGfKYmjYgQPMkt\n\tJtbfJsQ3VZV93uNLd6sOXDdhVgMrtqsgnmMcknv0=","Date":"Sat, 20 Jun 2020 04:17:28 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200620011728.GR5823@pendragon.ideasonboard.com>","References":"<20200619054123.19052-1-paul.elder@ideasonboard.com>\n\t<20200619054123.19052-5-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200619054123.19052-5-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 04/17] v4l2: v4l2_camera_proxy: Fix\n\tv4l2-compliance support for extended formats","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>","X-List-Received-Date":"Sat, 20 Jun 2020 01:17:53 -0000"}}]