{"id":4182,"url":"https://patchwork.libcamera.org/api/patches/4182/?format=json","web_url":"https://patchwork.libcamera.org/patch/4182/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20200623190836.53446-9-paul.elder@ideasonboard.com>","date":"2020-06-23T19:08:22","name":"[libcamera-devel,v3,08/22] v4l2: v4l2_camera_proxy: Fix v4l2-compliance support for extended formats","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"779f9a93e8c41138f368ffdb30bfd9f898d6372a","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/4182/mbox/","series":[{"id":1034,"url":"https://patchwork.libcamera.org/api/series/1034/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1034","date":"2020-06-23T19:08:14","name":"Support v4l2-compliance","version":3,"mbox":"https://patchwork.libcamera.org/series/1034/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/4182/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/4182/checks/","tags":{},"headers":{"Return-Path":"<paul.elder@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 BC9D4609A5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jun 2020 21:09:21 +0200 (CEST)","from jade.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:8147:f2a2:a8c6:9087])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 73F8F329;\n\tTue, 23 Jun 2020 21:09:18 +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=\"cvlTOY9Q\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592939361;\n\tbh=rTkYKNzZAQg8jgKw/pjKFdDFqPXwMDAUOfcKZ/i7Ah4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cvlTOY9QvYjCUZuz5V8dpINudms2QhbtTocWsu9qRZjs3uXZOP30i3DwS8GeUd/h9\n\tPM5fdjZzcjdL43uFrrBeFdXXa1ROXAsjA7aM+TxbxXSTy8HmB4uL3MB9vhdLx6M3df\n\tFH09u3Ml3MMiq6Z0eSmwqpUnFY/9b6XI5BH5wdgw=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 24 Jun 2020 04:08:22 +0900","Message-Id":"<20200623190836.53446-9-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200623190836.53446-1-paul.elder@ideasonboard.com>","References":"<20200623190836.53446-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 08/22] 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":"Tue, 23 Jun 2020 19:09:22 -0000"},"content":"Fix the following v4l2-compliance error:\n\nfail: v4l2-compliance.cpp(652): !(caps & V4L2_CAP_EXT_PIX_FORMAT)\n\nSimply add V4L2_CAP_EXT_PIX_FORMAT to capabilities in querycap.\n\nIn addition, populate the necessary fields in struct v4l2_pix_format to\nsupport extended pixel formats in try_fmt and g/s_fmt, and clear the\nreserved field for enum_fmt.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nAcked-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nChanges in v3:\n- also populate xfer_func\n\nChanges 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 | 20 +++++++++++++++++---\n 1 file changed, 17 insertions(+), 3 deletions(-)","diff":"diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex b7d3644..bf14ba0 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -162,6 +162,10 @@ 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+\tcurV4L2Format_.fmt.pix.xfer_func = V4L2_XFER_FUNC_DEFAULT;\n }\n \n unsigned int V4L2CameraProxy::calculateSizeImage(StreamConfiguration &streamConfig)\n@@ -188,7 +192,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+\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@@ -237,11 +243,15 @@ int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *\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@@ -281,6 +291,10 @@ 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+\targ->fmt.pix.xfer_func    = V4L2_XFER_FUNC_DEFAULT;\n }\n \n int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n","prefixes":["libcamera-devel","v3","08/22"]}