[{"id":24304,"web_url":"https://patchwork.libcamera.org/comment/24304/","msgid":"<0a7fe3e3-8e07-2247-778e-8b4b599b57e3@ideasonboard.com>","date":"2022-08-02T11:01:34","subject":"Re: [libcamera-devel] [PATCH 08/13] libcamera: v4l2_subdevice: Add\n\tsupport for the V4L2 subdev routing API","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 01/08/2022 03:05, Laurent Pinchart via libcamera-devel wrote:\n> From: Jacopo Mondi <jacopo@jmondi.org>\n> \n> Extend the V4L2Subdevice class to support getting and setting routing\n> tables.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n> Changes on top of Jacopo's initial work:\n> \n> - Turn Routing struct into a class, an inherit from std::vector\n> - Drop Routing::numRoutes\n> ---\n>   include/libcamera/internal/v4l2_subdevice.h |   9 ++\n>   src/libcamera/v4l2_subdevice.cpp            | 105 ++++++++++++++++++++\n>   2 files changed, 114 insertions(+)\n> \n> diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\n> index a1d3144c6a7f..00be17bb1465 100644\n> --- a/include/libcamera/internal/v4l2_subdevice.h\n> +++ b/include/libcamera/internal/v4l2_subdevice.h\n> @@ -61,6 +61,12 @@ public:\n>   \t\tActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE,\n>   \t};\n>   \n> +\tclass Routing : public std::vector<struct v4l2_subdev_route>\n> +\t{\n> +\tpublic:\n> +\t\tstd::string toString() const;\n> +\t};\n> +\n>   \texplicit V4L2Subdevice(const MediaEntity *entity);\n>   \t~V4L2Subdevice();\n>   \n> @@ -80,6 +86,9 @@ public:\n>   \tint setFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n>   \t\t      Whence whence = ActiveFormat);\n>   \n> +\tint getRouting(Routing *routing, Whence whence = ActiveFormat);\n> +\tint setRouting(Routing *routing, Whence whence = ActiveFormat);\n> +\n>   \tconst std::string &model();\n>   \tconst V4L2SubdeviceCapability &caps() const { return caps_; }\n>   \n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index a1672b2365f2..fe8b8e4eae2a 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -288,6 +288,32 @@ std::ostream &operator<<(std::ostream &out, const V4L2SubdeviceFormat &f)\n>    * \\brief The format operation applies to TRY formats\n>    */\n>   \n> +/**\n> + * \\class V4L2Subdevice::Routing\n> + * \\brief V4L2 subdevice routing table\n> + *\n> + * This class stores a subdevice routing table as a vector of routes.\n> + */\n> +\n> +/**\n> + * \\brief Assemble and return a string describing the routing table\n> + * \\return A string describing the routing table\n> + */\n> +std::string V4L2Subdevice::Routing::toString() const\n> +{\n> +\tstd::stringstream routing;\n> +\n> +\tfor (const auto &[i, route] : utils::enumerate(*this)) {\n> +\t\trouting << \"[\" << i << \"] \"\n> +\t\t\t<< route.sink_pad << \"/\" << route.sink_stream << \" -> \"\n> +\t\t\t<< route.source_pad << \"/\" << route.source_stream;\n\nI would also add the route flags. Even if it's just a hex number in the \nprint, it may help catching bugs.\n\nOther than that:\n\nReviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n\n  Tomi","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 C1075BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Aug 2022 11:01:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2B8F76330F;\n\tTue,  2 Aug 2022 13:01:40 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DE9DE603E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Aug 2022 13:01:37 +0200 (CEST)","from [192.168.1.111] (91-158-154-79.elisa-laajakaista.fi\n\t[91.158.154.79])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6C44D25B;\n\tTue,  2 Aug 2022 13:01:37 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659438100;\n\tbh=6DR2xPq39mEyTTvyTi9Ee9H0ciqVmSiM/F7Awn6BQgE=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=SZvd7yGgwnAWKG4bDdBIiRwOe6NXsHAY3+tRoixfxUp9umok+iwpnXOW/KunBfLY4\n\tNUujkFjx1cX5UbVUyB5QfQlQHDqwezSf8uzmhbl4qPsZ6mD9J71Vgwe4B0XUnrnAVp\n\tts1QzGrLHncoXIpWQlvOpozfxREdCh+Dk2DYmffs77PP9QVRttr79/2mRlF96gye4q\n\to1Bw9qWl2SybIEUQSZI6LF0NnVMA4SZ89Axn/RY7khOQyP3xMJYmth9XZSP1e8v34Y\n\t1nu/67JVG6tbePDDqhaRmO/qj5egK/4/eiQs7GwkWlJjRihCNpZSiuy96x6qGB2qPY\n\t96VbrkvmfQFHQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659438097;\n\tbh=6DR2xPq39mEyTTvyTi9Ee9H0ciqVmSiM/F7Awn6BQgE=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=Kj7Rw0nQSLIzzf7hz9uA4NLTFdFMAu8hMhSPyeXV+C8FYFHQYNuTRcnorLmT2XIis\n\t9V411HnFeRDdxnSQJpQG0c1vuYNX+uDJWkSfUtcYV+4TH/9KB3IQXEti1dTb64IO/S\n\tsSKvsb6b+JPXO5bpHnZjC0aat+0I1KmXDeJ+OeME="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Kj7Rw0nQ\"; dkim-atps=neutral","Message-ID":"<0a7fe3e3-8e07-2247-778e-8b4b599b57e3@ideasonboard.com>","Date":"Tue, 2 Aug 2022 14:01:34 +0300","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.11.0","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220801000543.3501-1-laurent.pinchart@ideasonboard.com>\n\t<20220801000543.3501-9-laurent.pinchart@ideasonboard.com>","In-Reply-To":"<20220801000543.3501-9-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 08/13] libcamera: v4l2_subdevice: Add\n\tsupport for the V4L2 subdev routing API","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>","From":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]