{"id":8409,"url":"https://patchwork.libcamera.org/api/1.1/patches/8409/?format=json","web_url":"https://patchwork.libcamera.org/patch/8409/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20200624145256.48266-12-paul.elder@ideasonboard.com>","date":"2020-06-24T14:52:45","name":"[libcamera-devel,v4,11/22] v4l2: v4l2_camera_proxy: Implement VIDIOC_ENUM_FRAMESIZES","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"f4fe16e39792e20d2489d74a71a97bc4aefc90ac","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8409/mbox/","series":[{"id":1041,"url":"https://patchwork.libcamera.org/api/1.1/series/1041/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1041","date":"2020-06-24T14:52:34","name":"Support v4l2-compliance","version":4,"mbox":"https://patchwork.libcamera.org/series/1041/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8409/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8409/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 BC979609B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Jun 2020 16:53:42 +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 BE0B42A8;\n\tWed, 24 Jun 2020 16:53:40 +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=\"UHPBfqKe\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593010422;\n\tbh=9A/tCXnsu07q67BIzOfac4YKy3YgDnXJDDGvyaF5yNs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=UHPBfqKewXSZqx50/pkWCPmGoKTk/VUm69uk6tioFBKnUTswGcQdJxw+T8wXhrmpk\n\twz0fq4OQZceT2Q0L5bbNg5BSU2DZZ5T2/gXmAbysDFpzTGOInvq+OF2SpyvwFCF7eV\n\teIYNew/iQWEV0wwFBXUwPViWgnuDAUjbh4NL4TOw=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 24 Jun 2020 23:52:45 +0900","Message-Id":"<20200624145256.48266-12-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200624145256.48266-1-paul.elder@ideasonboard.com>","References":"<20200624145256.48266-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 11/22] v4l2: v4l2_camera_proxy:\n\tImplement VIDIOC_ENUM_FRAMESIZES","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":"Wed, 24 Jun 2020 14:53:43 -0000"},"content":"Implement VIDIOC_ENUM_FRAMESIZES in the V4L2 compatibility layer.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nNo change in v4\n\nChanges in v3:\n- cosmetic changes\n\nChanges in v2:\n- use V4L2CameraFile instead of fd\n- added todo for not many pipeline handlers reporting StreamFormats\n---\n src/v4l2/v4l2_camera_proxy.cpp | 26 ++++++++++++++++++++++++++\n src/v4l2/v4l2_camera_proxy.h   |  1 +\n 2 files changed, 27 insertions(+)","diff":"diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 2bbe821..b027f8f 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -241,6 +241,28 @@ int V4L2CameraProxy::vidioc_querycap(struct v4l2_capability *arg)\n \treturn 0;\n }\n \n+int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_frmsizeenum *arg)\n+{\n+\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_framesizes fd = \" << file->efd();\n+\n+\tPixelFormat argFormat = v4l2ToDrm(arg->pixel_format);\n+\t/*\n+\t * \\todo This might need to be expanded as few pipeline handlers\n+\t * report StreamFormats.\n+\t */\n+\tconst std::vector<Size> &frameSizes = streamConfig_.formats().sizes(argFormat);\n+\n+\tif (arg->index >= frameSizes.size())\n+\t\treturn -EINVAL;\n+\n+\targ->type = V4L2_FRMSIZE_TYPE_DISCRETE;\n+\targ->discrete.width = frameSizes[arg->index].width;\n+\targ->discrete.height = frameSizes[arg->index].height;\n+\tmemset(arg->reserved, 0, sizeof(arg->reserved));\n+\n+\treturn 0;\n+}\n+\n int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg)\n {\n \tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_fmt fd = \" << file->efd();\n@@ -628,6 +650,7 @@ int V4L2CameraProxy::vidioc_streamoff(V4L2CameraFile *file, int *arg)\n \n const std::set<unsigned long> V4L2CameraProxy::supportedIoctls_ = {\n \tVIDIOC_QUERYCAP,\n+\tVIDIOC_ENUM_FRAMESIZES,\n \tVIDIOC_ENUM_FMT,\n \tVIDIOC_G_FMT,\n \tVIDIOC_S_FMT,\n@@ -667,6 +690,9 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long request, void *ar\n \tcase VIDIOC_QUERYCAP:\n \t\tret = vidioc_querycap(static_cast<struct v4l2_capability *>(arg));\n \t\tbreak;\n+\tcase VIDIOC_ENUM_FRAMESIZES:\n+\t\tret = vidioc_enum_framesizes(file, static_cast<struct v4l2_frmsizeenum *>(arg));\n+\t\tbreak;\n \tcase VIDIOC_ENUM_FMT:\n \t\tret = vidioc_enum_fmt(file, static_cast<struct v4l2_fmtdesc *>(arg));\n \t\tbreak;\ndiff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\nindex 707a0de..5de2c5a 100644\n--- a/src/v4l2/v4l2_camera_proxy.h\n+++ b/src/v4l2/v4l2_camera_proxy.h\n@@ -48,6 +48,7 @@ private:\n \tvoid freeBuffers();\n \n \tint vidioc_querycap(struct v4l2_capability *arg);\n+\tint vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_frmsizeenum *arg);\n \tint vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg);\n \tint vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg);\n \tint vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg);\n","prefixes":["libcamera-devel","v4","11/22"]}