[{"id":2062,"web_url":"https://patchwork.libcamera.org/comment/2062/","msgid":"<20190701001314.GO7043@pendragon.ideasonboard.com>","date":"2019-07-01T00:13:14","subject":"Re: [libcamera-devel] [RFC 1/8] libcamera: v4l2_videodevice:\n\tRe-group operations","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Sun, Jun 30, 2019 at 08:10:42PM +0200, Jacopo Mondi wrote:\n> Group together operations to enumerate formats and operations to handle\n> memory handling, alternating public and private operations but\n> respecting the ordering within each group. Cosmetic change to prepare\n> for a re-work of the memory handling operations.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/libcamera/include/v4l2_videodevice.h |   6 +-\n>  src/libcamera/v4l2_videodevice.cpp       | 170 +++++++++++------------\n>  2 files changed, 88 insertions(+), 88 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\n> index 734b34f1dc53..b92df882568f 100644\n> --- a/src/libcamera/include/v4l2_videodevice.h\n> +++ b/src/libcamera/include/v4l2_videodevice.h\n> @@ -160,13 +160,13 @@ private:\n>  \tint getFormatSingleplane(V4L2DeviceFormat *format);\n>  \tint setFormatSingleplane(V4L2DeviceFormat *format);\n>  \n> +\tstd::vector<unsigned int> enumPixelformats();\n> +\tstd::vector<SizeRange> enumSizes(unsigned int pixelFormat);\n> +\n>  \tint requestBuffers(unsigned int count);\n>  \tint createPlane(Buffer *buffer, unsigned int plane,\n>  \t\t\tunsigned int length);\n>  \n> -\tstd::vector<unsigned int> enumPixelformats();\n> -\tstd::vector<SizeRange> enumSizes(unsigned int pixelFormat);\n> -\n>  \tBuffer *dequeueBuffer();\n>  \tvoid bufferAvailable(EventNotifier *notifier);\n>  \n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index 12af3bd0639b..2d1e87a76c6f 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -627,6 +627,91 @@ ImageFormats V4L2VideoDevice::formats()\n>  \treturn formats;\n>  }\n>  \n> +std::vector<unsigned int> V4L2VideoDevice::enumPixelformats()\n> +{\n> +\tstd::vector<unsigned int> formats;\n> +\tint ret;\n> +\n> +\tfor (unsigned int index = 0; ; index++) {\n> +\t\tstruct v4l2_fmtdesc pixelformatEnum = {};\n> +\t\tpixelformatEnum.index = index;\n> +\t\tpixelformatEnum.type = bufferType_;\n> +\n> +\t\tret = ioctl(VIDIOC_ENUM_FMT, &pixelformatEnum);\n> +\t\tif (ret)\n> +\t\t\tbreak;\n> +\n> +\t\tformats.push_back(pixelformatEnum.pixelformat);\n> +\t}\n> +\n> +\tif (ret && ret != -EINVAL) {\n> +\t\tLOG(V4L2, Error)\n> +\t\t\t<< \"Unable to enumerate pixel formats: \"\n> +\t\t\t<< strerror(-ret);\n> +\t\treturn {};\n> +\t}\n> +\n> +\treturn formats;\n> +}\n> +\n> +std::vector<SizeRange> V4L2VideoDevice::enumSizes(unsigned int pixelFormat)\n> +{\n> +\tstd::vector<SizeRange> sizes;\n> +\tint ret;\n> +\n> +\tfor (unsigned int index = 0;; index++) {\n> +\t\tstruct v4l2_frmsizeenum frameSize = {};\n> +\t\tframeSize.index = index;\n> +\t\tframeSize.pixel_format = pixelFormat;\n> +\n> +\t\tret = ioctl(VIDIOC_ENUM_FRAMESIZES, &frameSize);\n> +\t\tif (ret)\n> +\t\t\tbreak;\n> +\n> +\t\tif (index != 0 &&\n> +\t\t    frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE) {\n> +\t\t\tLOG(V4L2, Error)\n> +\t\t\t\t<< \"Non-zero index for non discrete type\";\n> +\t\t\treturn {};\n> +\t\t}\n> +\n> +\t\tswitch (frameSize.type) {\n> +\t\tcase V4L2_FRMSIZE_TYPE_DISCRETE:\n> +\t\t\tsizes.emplace_back(frameSize.discrete.width,\n> +\t\t\t\t\t   frameSize.discrete.height);\n> +\t\t\tbreak;\n> +\t\tcase V4L2_FRMSIZE_TYPE_CONTINUOUS:\n> +\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> +\t\t\t\t\t   frameSize.stepwise.min_height,\n> +\t\t\t\t\t   frameSize.stepwise.max_width,\n> +\t\t\t\t\t   frameSize.stepwise.max_height);\n> +\t\t\tbreak;\n> +\t\tcase V4L2_FRMSIZE_TYPE_STEPWISE:\n> +\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> +\t\t\t\t\t   frameSize.stepwise.min_height,\n> +\t\t\t\t\t   frameSize.stepwise.max_width,\n> +\t\t\t\t\t   frameSize.stepwise.max_height,\n> +\t\t\t\t\t   frameSize.stepwise.step_width,\n> +\t\t\t\t\t   frameSize.stepwise.step_height);\n> +\t\t\tbreak;\n> +\t\tdefault:\n> +\t\t\tLOG(V4L2, Error)\n> +\t\t\t\t<< \"Unknown VIDIOC_ENUM_FRAMESIZES type \"\n> +\t\t\t\t<< frameSize.type;\n> +\t\t\treturn {};\n> +\t\t}\n> +\t}\n> +\n> +\tif (ret && ret != -EINVAL) {\n> +\t\tLOG(V4L2, Error)\n> +\t\t\t<< \"Unable to enumerate frame sizes: \"\n> +\t\t\t<< strerror(-ret);\n> +\t\treturn {};\n> +\t}\n> +\n> +\treturn sizes;\n> +}\n> +\n>  int V4L2VideoDevice::requestBuffers(unsigned int count)\n>  {\n>  \tstruct v4l2_requestbuffers rb = {};\n> @@ -754,91 +839,6 @@ int V4L2VideoDevice::createPlane(Buffer *buffer, unsigned int planeIndex,\n>  \treturn 0;\n>  }\n>  \n> -std::vector<unsigned int> V4L2VideoDevice::enumPixelformats()\n> -{\n> -\tstd::vector<unsigned int> formats;\n> -\tint ret;\n> -\n> -\tfor (unsigned int index = 0; ; index++) {\n> -\t\tstruct v4l2_fmtdesc pixelformatEnum = {};\n> -\t\tpixelformatEnum.index = index;\n> -\t\tpixelformatEnum.type = bufferType_;\n> -\n> -\t\tret = ioctl(VIDIOC_ENUM_FMT, &pixelformatEnum);\n> -\t\tif (ret)\n> -\t\t\tbreak;\n> -\n> -\t\tformats.push_back(pixelformatEnum.pixelformat);\n> -\t}\n> -\n> -\tif (ret && ret != -EINVAL) {\n> -\t\tLOG(V4L2, Error)\n> -\t\t\t<< \"Unable to enumerate pixel formats: \"\n> -\t\t\t<< strerror(-ret);\n> -\t\treturn {};\n> -\t}\n> -\n> -\treturn formats;\n> -}\n> -\n> -std::vector<SizeRange> V4L2VideoDevice::enumSizes(unsigned int pixelFormat)\n> -{\n> -\tstd::vector<SizeRange> sizes;\n> -\tint ret;\n> -\n> -\tfor (unsigned int index = 0;; index++) {\n> -\t\tstruct v4l2_frmsizeenum frameSize = {};\n> -\t\tframeSize.index = index;\n> -\t\tframeSize.pixel_format = pixelFormat;\n> -\n> -\t\tret = ioctl(VIDIOC_ENUM_FRAMESIZES, &frameSize);\n> -\t\tif (ret)\n> -\t\t\tbreak;\n> -\n> -\t\tif (index != 0 &&\n> -\t\t    frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE) {\n> -\t\t\tLOG(V4L2, Error)\n> -\t\t\t\t<< \"Non-zero index for non discrete type\";\n> -\t\t\treturn {};\n> -\t\t}\n> -\n> -\t\tswitch (frameSize.type) {\n> -\t\tcase V4L2_FRMSIZE_TYPE_DISCRETE:\n> -\t\t\tsizes.emplace_back(frameSize.discrete.width,\n> -\t\t\t\t\t   frameSize.discrete.height);\n> -\t\t\tbreak;\n> -\t\tcase V4L2_FRMSIZE_TYPE_CONTINUOUS:\n> -\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> -\t\t\t\t\t   frameSize.stepwise.min_height,\n> -\t\t\t\t\t   frameSize.stepwise.max_width,\n> -\t\t\t\t\t   frameSize.stepwise.max_height);\n> -\t\t\tbreak;\n> -\t\tcase V4L2_FRMSIZE_TYPE_STEPWISE:\n> -\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> -\t\t\t\t\t   frameSize.stepwise.min_height,\n> -\t\t\t\t\t   frameSize.stepwise.max_width,\n> -\t\t\t\t\t   frameSize.stepwise.max_height,\n> -\t\t\t\t\t   frameSize.stepwise.step_width,\n> -\t\t\t\t\t   frameSize.stepwise.step_height);\n> -\t\t\tbreak;\n> -\t\tdefault:\n> -\t\t\tLOG(V4L2, Error)\n> -\t\t\t\t<< \"Unknown VIDIOC_ENUM_FRAMESIZES type \"\n> -\t\t\t\t<< frameSize.type;\n> -\t\t\treturn {};\n> -\t\t}\n> -\t}\n> -\n> -\tif (ret && ret != -EINVAL) {\n> -\t\tLOG(V4L2, Error)\n> -\t\t\t<< \"Unable to enumerate frame sizes: \"\n> -\t\t\t<< strerror(-ret);\n> -\t\treturn {};\n> -\t}\n> -\n> -\treturn sizes;\n> -}\n> -\n>  /**\n>   * \\brief Import the externally allocated \\a pool of buffers\n>   * \\param[in] pool BufferPool of buffers to import\n> -- \n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 417D760BC0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2019 02:13:34 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C5F76255;\n\tMon,  1 Jul 2019 02:13:33 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561940013;\n\tbh=ymtTWdh04mC1OoBaYaQ+0kxrz3uiLwT/BdOqm5/+2/I=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=peBWZzC/GZa9SA3QFJFs7LuBeei09G/2R8RtYsjaEWLlLvMXw3fZblsjHhaIgFVkZ\n\t9RcULD1k2TWk8jvVCrVnbX371C/YdQi85WUNp/3xnCJcYl95+5coe7hmAUd4XjrdqB\n\tbmcy4YuWj14ASlC5Dm9PQlE9sbFTDnNprGBSwWL8=","Date":"Mon, 1 Jul 2019 03:13:14 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190701001314.GO7043@pendragon.ideasonboard.com>","References":"<20190630181049.9548-1-jacopo@jmondi.org>\n\t<20190630181049.9548-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190630181049.9548-2-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [RFC 1/8] libcamera: v4l2_videodevice:\n\tRe-group operations","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Mon, 01 Jul 2019 00:13:34 -0000"}},{"id":2094,"web_url":"https://patchwork.libcamera.org/comment/2094/","msgid":"<20190701222834.GB11004@bigcity.dyn.berto.se>","date":"2019-07-01T22:28:34","subject":"Re: [libcamera-devel] [RFC 1/8] libcamera: v4l2_videodevice:\n\tRe-group operations","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2019-06-30 20:10:42 +0200, Jacopo Mondi wrote:\n> Group together operations to enumerate formats and operations to handle\n> memory handling, alternating public and private operations but\n> respecting the ordering within each group. Cosmetic change to prepare\n> for a re-work of the memory handling operations.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/include/v4l2_videodevice.h |   6 +-\n>  src/libcamera/v4l2_videodevice.cpp       | 170 +++++++++++------------\n>  2 files changed, 88 insertions(+), 88 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\n> index 734b34f1dc53..b92df882568f 100644\n> --- a/src/libcamera/include/v4l2_videodevice.h\n> +++ b/src/libcamera/include/v4l2_videodevice.h\n> @@ -160,13 +160,13 @@ private:\n>  \tint getFormatSingleplane(V4L2DeviceFormat *format);\n>  \tint setFormatSingleplane(V4L2DeviceFormat *format);\n>  \n> +\tstd::vector<unsigned int> enumPixelformats();\n> +\tstd::vector<SizeRange> enumSizes(unsigned int pixelFormat);\n> +\n>  \tint requestBuffers(unsigned int count);\n>  \tint createPlane(Buffer *buffer, unsigned int plane,\n>  \t\t\tunsigned int length);\n>  \n> -\tstd::vector<unsigned int> enumPixelformats();\n> -\tstd::vector<SizeRange> enumSizes(unsigned int pixelFormat);\n> -\n>  \tBuffer *dequeueBuffer();\n>  \tvoid bufferAvailable(EventNotifier *notifier);\n>  \n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index 12af3bd0639b..2d1e87a76c6f 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -627,6 +627,91 @@ ImageFormats V4L2VideoDevice::formats()\n>  \treturn formats;\n>  }\n>  \n> +std::vector<unsigned int> V4L2VideoDevice::enumPixelformats()\n> +{\n> +\tstd::vector<unsigned int> formats;\n> +\tint ret;\n> +\n> +\tfor (unsigned int index = 0; ; index++) {\n> +\t\tstruct v4l2_fmtdesc pixelformatEnum = {};\n> +\t\tpixelformatEnum.index = index;\n> +\t\tpixelformatEnum.type = bufferType_;\n> +\n> +\t\tret = ioctl(VIDIOC_ENUM_FMT, &pixelformatEnum);\n> +\t\tif (ret)\n> +\t\t\tbreak;\n> +\n> +\t\tformats.push_back(pixelformatEnum.pixelformat);\n> +\t}\n> +\n> +\tif (ret && ret != -EINVAL) {\n> +\t\tLOG(V4L2, Error)\n> +\t\t\t<< \"Unable to enumerate pixel formats: \"\n> +\t\t\t<< strerror(-ret);\n> +\t\treturn {};\n> +\t}\n> +\n> +\treturn formats;\n> +}\n> +\n> +std::vector<SizeRange> V4L2VideoDevice::enumSizes(unsigned int pixelFormat)\n> +{\n> +\tstd::vector<SizeRange> sizes;\n> +\tint ret;\n> +\n> +\tfor (unsigned int index = 0;; index++) {\n> +\t\tstruct v4l2_frmsizeenum frameSize = {};\n> +\t\tframeSize.index = index;\n> +\t\tframeSize.pixel_format = pixelFormat;\n> +\n> +\t\tret = ioctl(VIDIOC_ENUM_FRAMESIZES, &frameSize);\n> +\t\tif (ret)\n> +\t\t\tbreak;\n> +\n> +\t\tif (index != 0 &&\n> +\t\t    frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE) {\n> +\t\t\tLOG(V4L2, Error)\n> +\t\t\t\t<< \"Non-zero index for non discrete type\";\n> +\t\t\treturn {};\n> +\t\t}\n> +\n> +\t\tswitch (frameSize.type) {\n> +\t\tcase V4L2_FRMSIZE_TYPE_DISCRETE:\n> +\t\t\tsizes.emplace_back(frameSize.discrete.width,\n> +\t\t\t\t\t   frameSize.discrete.height);\n> +\t\t\tbreak;\n> +\t\tcase V4L2_FRMSIZE_TYPE_CONTINUOUS:\n> +\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> +\t\t\t\t\t   frameSize.stepwise.min_height,\n> +\t\t\t\t\t   frameSize.stepwise.max_width,\n> +\t\t\t\t\t   frameSize.stepwise.max_height);\n> +\t\t\tbreak;\n> +\t\tcase V4L2_FRMSIZE_TYPE_STEPWISE:\n> +\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> +\t\t\t\t\t   frameSize.stepwise.min_height,\n> +\t\t\t\t\t   frameSize.stepwise.max_width,\n> +\t\t\t\t\t   frameSize.stepwise.max_height,\n> +\t\t\t\t\t   frameSize.stepwise.step_width,\n> +\t\t\t\t\t   frameSize.stepwise.step_height);\n> +\t\t\tbreak;\n> +\t\tdefault:\n> +\t\t\tLOG(V4L2, Error)\n> +\t\t\t\t<< \"Unknown VIDIOC_ENUM_FRAMESIZES type \"\n> +\t\t\t\t<< frameSize.type;\n> +\t\t\treturn {};\n> +\t\t}\n> +\t}\n> +\n> +\tif (ret && ret != -EINVAL) {\n> +\t\tLOG(V4L2, Error)\n> +\t\t\t<< \"Unable to enumerate frame sizes: \"\n> +\t\t\t<< strerror(-ret);\n> +\t\treturn {};\n> +\t}\n> +\n> +\treturn sizes;\n> +}\n> +\n>  int V4L2VideoDevice::requestBuffers(unsigned int count)\n>  {\n>  \tstruct v4l2_requestbuffers rb = {};\n> @@ -754,91 +839,6 @@ int V4L2VideoDevice::createPlane(Buffer *buffer, unsigned int planeIndex,\n>  \treturn 0;\n>  }\n>  \n> -std::vector<unsigned int> V4L2VideoDevice::enumPixelformats()\n> -{\n> -\tstd::vector<unsigned int> formats;\n> -\tint ret;\n> -\n> -\tfor (unsigned int index = 0; ; index++) {\n> -\t\tstruct v4l2_fmtdesc pixelformatEnum = {};\n> -\t\tpixelformatEnum.index = index;\n> -\t\tpixelformatEnum.type = bufferType_;\n> -\n> -\t\tret = ioctl(VIDIOC_ENUM_FMT, &pixelformatEnum);\n> -\t\tif (ret)\n> -\t\t\tbreak;\n> -\n> -\t\tformats.push_back(pixelformatEnum.pixelformat);\n> -\t}\n> -\n> -\tif (ret && ret != -EINVAL) {\n> -\t\tLOG(V4L2, Error)\n> -\t\t\t<< \"Unable to enumerate pixel formats: \"\n> -\t\t\t<< strerror(-ret);\n> -\t\treturn {};\n> -\t}\n> -\n> -\treturn formats;\n> -}\n> -\n> -std::vector<SizeRange> V4L2VideoDevice::enumSizes(unsigned int pixelFormat)\n> -{\n> -\tstd::vector<SizeRange> sizes;\n> -\tint ret;\n> -\n> -\tfor (unsigned int index = 0;; index++) {\n> -\t\tstruct v4l2_frmsizeenum frameSize = {};\n> -\t\tframeSize.index = index;\n> -\t\tframeSize.pixel_format = pixelFormat;\n> -\n> -\t\tret = ioctl(VIDIOC_ENUM_FRAMESIZES, &frameSize);\n> -\t\tif (ret)\n> -\t\t\tbreak;\n> -\n> -\t\tif (index != 0 &&\n> -\t\t    frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE) {\n> -\t\t\tLOG(V4L2, Error)\n> -\t\t\t\t<< \"Non-zero index for non discrete type\";\n> -\t\t\treturn {};\n> -\t\t}\n> -\n> -\t\tswitch (frameSize.type) {\n> -\t\tcase V4L2_FRMSIZE_TYPE_DISCRETE:\n> -\t\t\tsizes.emplace_back(frameSize.discrete.width,\n> -\t\t\t\t\t   frameSize.discrete.height);\n> -\t\t\tbreak;\n> -\t\tcase V4L2_FRMSIZE_TYPE_CONTINUOUS:\n> -\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> -\t\t\t\t\t   frameSize.stepwise.min_height,\n> -\t\t\t\t\t   frameSize.stepwise.max_width,\n> -\t\t\t\t\t   frameSize.stepwise.max_height);\n> -\t\t\tbreak;\n> -\t\tcase V4L2_FRMSIZE_TYPE_STEPWISE:\n> -\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> -\t\t\t\t\t   frameSize.stepwise.min_height,\n> -\t\t\t\t\t   frameSize.stepwise.max_width,\n> -\t\t\t\t\t   frameSize.stepwise.max_height,\n> -\t\t\t\t\t   frameSize.stepwise.step_width,\n> -\t\t\t\t\t   frameSize.stepwise.step_height);\n> -\t\t\tbreak;\n> -\t\tdefault:\n> -\t\t\tLOG(V4L2, Error)\n> -\t\t\t\t<< \"Unknown VIDIOC_ENUM_FRAMESIZES type \"\n> -\t\t\t\t<< frameSize.type;\n> -\t\t\treturn {};\n> -\t\t}\n> -\t}\n> -\n> -\tif (ret && ret != -EINVAL) {\n> -\t\tLOG(V4L2, Error)\n> -\t\t\t<< \"Unable to enumerate frame sizes: \"\n> -\t\t\t<< strerror(-ret);\n> -\t\treturn {};\n> -\t}\n> -\n> -\treturn sizes;\n> -}\n> -\n>  /**\n>   * \\brief Import the externally allocated \\a pool of buffers\n>   * \\param[in] pool BufferPool of buffers to import\n> -- \n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x142.google.com (mail-lf1-x142.google.com\n\t[IPv6:2a00:1450:4864:20::142])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 75C8E60BF8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Jul 2019 00:28:36 +0200 (CEST)","by mail-lf1-x142.google.com with SMTP id x144so9870703lfa.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 01 Jul 2019 15:28:36 -0700 (PDT)","from localhost (customer-145-14-112-32.stosn.net. [145.14.112.32])\n\tby smtp.gmail.com with ESMTPSA id\n\ti2sm3482164ljc.96.2019.07.01.15.28.35\n\t(version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);\n\tMon, 01 Jul 2019 15:28:35 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=mq/UH7hcZYTjfzzVxH7/2V8ddxv7OcMaDAPK4yqoiSA=;\n\tb=DnrHJ8lFYkHBbkT9BEcZWLIolX83NqEDBtDeqJ95CpgLJ3hXDWEULcDTFOjoqd7qZn\n\tRvD5CfmzrNR9Mrl0qJ63jAR6bD0TOC7FKUFR/AAIz4b1CT3jFkL7de0pfLe/DRPSPJQd\n\toFMcNEVGBiRapzAYamC2PQmVUBIMJAf0RxdVTBwNCbesPyWtV4GRqeU0YEEUslCynmk+\n\timhg4TS36mQEqz2MfBZf4lzhYPuTIiRFrP69GoGMH1YZsTD0spEbQnrrgvNH9a/rIdmf\n\tltII8Cis9QuNTGjWCvURodhDDLp/uoA/mdxhuCYEHp9x4zINU+yF09C6/wwt4xh5ANVN\n\tx3NA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=mq/UH7hcZYTjfzzVxH7/2V8ddxv7OcMaDAPK4yqoiSA=;\n\tb=UuAPNnFXt5gOE8NHrJnW7XbCEM/SaH6iMXslgrbUOOmsgzCjwzXtBVfmhlPhav6rMP\n\tL7DNQich+5cIJqacm2RjWd7jk2Gf529Clwjkb7cz6CLcRvVC/XCLq32BJ35yK93NiTIt\n\tO2j0JrlL9CCmYj0cZICrOnC6QNjhVARxDjMOAN7nNtDxnUhGIvBZPEnYlXVqfotGWVMa\n\tYiiQdYf441SXi7Oi58M6OQNvAZJu5IJjXbUSOgRzuJRukWU/ddfp6ADUNSIqxJXo0vx7\n\tU6I38HlhuGKOaaA2CYEMGiaJ/xEe+y5S/XvWnOOc/la1hnHypXvZIwAV/EurORAv9bcg\n\tVdcw==","X-Gm-Message-State":"APjAAAVBZBj8tCfiyB90MC1TijqGWzqHZH3flGCUS4rcosn2hC52r3Qu\n\tFQkWhKC9CjwTKxUX/V3Otz6u7HWm3pI=","X-Google-Smtp-Source":"APXvYqzGFGduGdLhY6tj7XXwptI56lxjrJLFW+RgrLdNyAA475NYvdsrrtnkOesLT+AEBFgn6fn+Hg==","X-Received":"by 2002:ac2:4c3c:: with SMTP id\n\tu28mr13299697lfq.136.1562020115907; \n\tMon, 01 Jul 2019 15:28:35 -0700 (PDT)","Date":"Tue, 2 Jul 2019 00:28:34 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190701222834.GB11004@bigcity.dyn.berto.se>","References":"<20190630181049.9548-1-jacopo@jmondi.org>\n\t<20190630181049.9548-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190630181049.9548-2-jacopo@jmondi.org>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [RFC 1/8] libcamera: v4l2_videodevice:\n\tRe-group operations","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Mon, 01 Jul 2019 22:28:36 -0000"}},{"id":2118,"web_url":"https://patchwork.libcamera.org/comment/2118/","msgid":"<20190702074044.onl4va4u5a3awop5@uno.localdomain>","date":"2019-07-02T07:40:44","subject":"Re: [libcamera-devel] [RFC 1/8] libcamera: v4l2_videodevice:\n\tRe-group operations","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hello,\n\nOn Tue, Jul 02, 2019 at 12:28:34AM +0200, Niklas Söderlund wrote:\n> Hi Jacopo,\n>\n> Thanks for your work.\n>\n> On 2019-06-30 20:10:42 +0200, Jacopo Mondi wrote:\n> > Group together operations to enumerate formats and operations to handle\n> > memory handling, alternating public and private operations but\n> > respecting the ordering within each group. Cosmetic change to prepare\n> > for a re-work of the memory handling operations.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n>\n\nWith Niklas' and Laurent's tags, I'm now pushing this to reduce the\nbacklog of this series.\n\nThanks\n   j\n\n> > ---\n> >  src/libcamera/include/v4l2_videodevice.h |   6 +-\n> >  src/libcamera/v4l2_videodevice.cpp       | 170 +++++++++++------------\n> >  2 files changed, 88 insertions(+), 88 deletions(-)\n> >\n> > diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\n> > index 734b34f1dc53..b92df882568f 100644\n> > --- a/src/libcamera/include/v4l2_videodevice.h\n> > +++ b/src/libcamera/include/v4l2_videodevice.h\n> > @@ -160,13 +160,13 @@ private:\n> >  \tint getFormatSingleplane(V4L2DeviceFormat *format);\n> >  \tint setFormatSingleplane(V4L2DeviceFormat *format);\n> >\n> > +\tstd::vector<unsigned int> enumPixelformats();\n> > +\tstd::vector<SizeRange> enumSizes(unsigned int pixelFormat);\n> > +\n> >  \tint requestBuffers(unsigned int count);\n> >  \tint createPlane(Buffer *buffer, unsigned int plane,\n> >  \t\t\tunsigned int length);\n> >\n> > -\tstd::vector<unsigned int> enumPixelformats();\n> > -\tstd::vector<SizeRange> enumSizes(unsigned int pixelFormat);\n> > -\n> >  \tBuffer *dequeueBuffer();\n> >  \tvoid bufferAvailable(EventNotifier *notifier);\n> >\n> > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> > index 12af3bd0639b..2d1e87a76c6f 100644\n> > --- a/src/libcamera/v4l2_videodevice.cpp\n> > +++ b/src/libcamera/v4l2_videodevice.cpp\n> > @@ -627,6 +627,91 @@ ImageFormats V4L2VideoDevice::formats()\n> >  \treturn formats;\n> >  }\n> >\n> > +std::vector<unsigned int> V4L2VideoDevice::enumPixelformats()\n> > +{\n> > +\tstd::vector<unsigned int> formats;\n> > +\tint ret;\n> > +\n> > +\tfor (unsigned int index = 0; ; index++) {\n> > +\t\tstruct v4l2_fmtdesc pixelformatEnum = {};\n> > +\t\tpixelformatEnum.index = index;\n> > +\t\tpixelformatEnum.type = bufferType_;\n> > +\n> > +\t\tret = ioctl(VIDIOC_ENUM_FMT, &pixelformatEnum);\n> > +\t\tif (ret)\n> > +\t\t\tbreak;\n> > +\n> > +\t\tformats.push_back(pixelformatEnum.pixelformat);\n> > +\t}\n> > +\n> > +\tif (ret && ret != -EINVAL) {\n> > +\t\tLOG(V4L2, Error)\n> > +\t\t\t<< \"Unable to enumerate pixel formats: \"\n> > +\t\t\t<< strerror(-ret);\n> > +\t\treturn {};\n> > +\t}\n> > +\n> > +\treturn formats;\n> > +}\n> > +\n> > +std::vector<SizeRange> V4L2VideoDevice::enumSizes(unsigned int pixelFormat)\n> > +{\n> > +\tstd::vector<SizeRange> sizes;\n> > +\tint ret;\n> > +\n> > +\tfor (unsigned int index = 0;; index++) {\n> > +\t\tstruct v4l2_frmsizeenum frameSize = {};\n> > +\t\tframeSize.index = index;\n> > +\t\tframeSize.pixel_format = pixelFormat;\n> > +\n> > +\t\tret = ioctl(VIDIOC_ENUM_FRAMESIZES, &frameSize);\n> > +\t\tif (ret)\n> > +\t\t\tbreak;\n> > +\n> > +\t\tif (index != 0 &&\n> > +\t\t    frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE) {\n> > +\t\t\tLOG(V4L2, Error)\n> > +\t\t\t\t<< \"Non-zero index for non discrete type\";\n> > +\t\t\treturn {};\n> > +\t\t}\n> > +\n> > +\t\tswitch (frameSize.type) {\n> > +\t\tcase V4L2_FRMSIZE_TYPE_DISCRETE:\n> > +\t\t\tsizes.emplace_back(frameSize.discrete.width,\n> > +\t\t\t\t\t   frameSize.discrete.height);\n> > +\t\t\tbreak;\n> > +\t\tcase V4L2_FRMSIZE_TYPE_CONTINUOUS:\n> > +\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> > +\t\t\t\t\t   frameSize.stepwise.min_height,\n> > +\t\t\t\t\t   frameSize.stepwise.max_width,\n> > +\t\t\t\t\t   frameSize.stepwise.max_height);\n> > +\t\t\tbreak;\n> > +\t\tcase V4L2_FRMSIZE_TYPE_STEPWISE:\n> > +\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> > +\t\t\t\t\t   frameSize.stepwise.min_height,\n> > +\t\t\t\t\t   frameSize.stepwise.max_width,\n> > +\t\t\t\t\t   frameSize.stepwise.max_height,\n> > +\t\t\t\t\t   frameSize.stepwise.step_width,\n> > +\t\t\t\t\t   frameSize.stepwise.step_height);\n> > +\t\t\tbreak;\n> > +\t\tdefault:\n> > +\t\t\tLOG(V4L2, Error)\n> > +\t\t\t\t<< \"Unknown VIDIOC_ENUM_FRAMESIZES type \"\n> > +\t\t\t\t<< frameSize.type;\n> > +\t\t\treturn {};\n> > +\t\t}\n> > +\t}\n> > +\n> > +\tif (ret && ret != -EINVAL) {\n> > +\t\tLOG(V4L2, Error)\n> > +\t\t\t<< \"Unable to enumerate frame sizes: \"\n> > +\t\t\t<< strerror(-ret);\n> > +\t\treturn {};\n> > +\t}\n> > +\n> > +\treturn sizes;\n> > +}\n> > +\n> >  int V4L2VideoDevice::requestBuffers(unsigned int count)\n> >  {\n> >  \tstruct v4l2_requestbuffers rb = {};\n> > @@ -754,91 +839,6 @@ int V4L2VideoDevice::createPlane(Buffer *buffer, unsigned int planeIndex,\n> >  \treturn 0;\n> >  }\n> >\n> > -std::vector<unsigned int> V4L2VideoDevice::enumPixelformats()\n> > -{\n> > -\tstd::vector<unsigned int> formats;\n> > -\tint ret;\n> > -\n> > -\tfor (unsigned int index = 0; ; index++) {\n> > -\t\tstruct v4l2_fmtdesc pixelformatEnum = {};\n> > -\t\tpixelformatEnum.index = index;\n> > -\t\tpixelformatEnum.type = bufferType_;\n> > -\n> > -\t\tret = ioctl(VIDIOC_ENUM_FMT, &pixelformatEnum);\n> > -\t\tif (ret)\n> > -\t\t\tbreak;\n> > -\n> > -\t\tformats.push_back(pixelformatEnum.pixelformat);\n> > -\t}\n> > -\n> > -\tif (ret && ret != -EINVAL) {\n> > -\t\tLOG(V4L2, Error)\n> > -\t\t\t<< \"Unable to enumerate pixel formats: \"\n> > -\t\t\t<< strerror(-ret);\n> > -\t\treturn {};\n> > -\t}\n> > -\n> > -\treturn formats;\n> > -}\n> > -\n> > -std::vector<SizeRange> V4L2VideoDevice::enumSizes(unsigned int pixelFormat)\n> > -{\n> > -\tstd::vector<SizeRange> sizes;\n> > -\tint ret;\n> > -\n> > -\tfor (unsigned int index = 0;; index++) {\n> > -\t\tstruct v4l2_frmsizeenum frameSize = {};\n> > -\t\tframeSize.index = index;\n> > -\t\tframeSize.pixel_format = pixelFormat;\n> > -\n> > -\t\tret = ioctl(VIDIOC_ENUM_FRAMESIZES, &frameSize);\n> > -\t\tif (ret)\n> > -\t\t\tbreak;\n> > -\n> > -\t\tif (index != 0 &&\n> > -\t\t    frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE) {\n> > -\t\t\tLOG(V4L2, Error)\n> > -\t\t\t\t<< \"Non-zero index for non discrete type\";\n> > -\t\t\treturn {};\n> > -\t\t}\n> > -\n> > -\t\tswitch (frameSize.type) {\n> > -\t\tcase V4L2_FRMSIZE_TYPE_DISCRETE:\n> > -\t\t\tsizes.emplace_back(frameSize.discrete.width,\n> > -\t\t\t\t\t   frameSize.discrete.height);\n> > -\t\t\tbreak;\n> > -\t\tcase V4L2_FRMSIZE_TYPE_CONTINUOUS:\n> > -\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> > -\t\t\t\t\t   frameSize.stepwise.min_height,\n> > -\t\t\t\t\t   frameSize.stepwise.max_width,\n> > -\t\t\t\t\t   frameSize.stepwise.max_height);\n> > -\t\t\tbreak;\n> > -\t\tcase V4L2_FRMSIZE_TYPE_STEPWISE:\n> > -\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n> > -\t\t\t\t\t   frameSize.stepwise.min_height,\n> > -\t\t\t\t\t   frameSize.stepwise.max_width,\n> > -\t\t\t\t\t   frameSize.stepwise.max_height,\n> > -\t\t\t\t\t   frameSize.stepwise.step_width,\n> > -\t\t\t\t\t   frameSize.stepwise.step_height);\n> > -\t\t\tbreak;\n> > -\t\tdefault:\n> > -\t\t\tLOG(V4L2, Error)\n> > -\t\t\t\t<< \"Unknown VIDIOC_ENUM_FRAMESIZES type \"\n> > -\t\t\t\t<< frameSize.type;\n> > -\t\t\treturn {};\n> > -\t\t}\n> > -\t}\n> > -\n> > -\tif (ret && ret != -EINVAL) {\n> > -\t\tLOG(V4L2, Error)\n> > -\t\t\t<< \"Unable to enumerate frame sizes: \"\n> > -\t\t\t<< strerror(-ret);\n> > -\t\treturn {};\n> > -\t}\n> > -\n> > -\treturn sizes;\n> > -}\n> > -\n> >  /**\n> >   * \\brief Import the externally allocated \\a pool of buffers\n> >   * \\param[in] pool BufferPool of buffers to import\n> > --\n> > 2.21.0\n> >\n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel\n>\n> --\n> Regards,\n> Niklas Söderlund","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C288C60C01\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Jul 2019 09:39:28 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 552211BF216;\n\tTue,  2 Jul 2019 07:39:28 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Tue, 2 Jul 2019 09:40:44 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190702074044.onl4va4u5a3awop5@uno.localdomain>","References":"<20190630181049.9548-1-jacopo@jmondi.org>\n\t<20190630181049.9548-2-jacopo@jmondi.org>\n\t<20190701222834.GB11004@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"umpzz26c4egmtrea\"","Content-Disposition":"inline","In-Reply-To":"<20190701222834.GB11004@bigcity.dyn.berto.se>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [RFC 1/8] libcamera: v4l2_videodevice:\n\tRe-group operations","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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, 02 Jul 2019 07:39:28 -0000"}}]