[{"id":28243,"web_url":"https://patchwork.libcamera.org/comment/28243/","msgid":"<290b1a078ef2156e02de2dcef8c14e5c69270587.camel@collabora.com>","date":"2023-12-05T14:00:10","subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","submitter":{"id":31,"url":"https://patchwork.libcamera.org/api/people/31/","name":"Nicolas Dufresne","email":"nicolas.dufresne@collabora.com"},"content":"Hi,\n\nLe lundi 04 décembre 2023 à 16:27 -0500, Nicolas Dufresne via libcamera-devel a\nécrit :\n> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> \n> This change to the build system will prepend the plugin build directory\n> to GST_PLUGIN_PATH environment. This makes the built plugin visible to\n> GStreamer inside meson devenv enabling uninstalled testing.\n\nIn case of positive feedback, I'd like to make a V2 that updates the\ndocumentation. Instead of:\n\n  export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer\n\nI'd document:\n\n  meson devenv -C build/\n\nDevenv is nicer since it prepends to the path, it will also blend well if\nlibcamera is made a subproject of another project using devenv (notably mesa\nand/or GStreamer). In cross-compilation, the env can be generated on the build\ncomputer, and used as a script on the target with help of the --dump option.\n\nNicolas\n\n> ---\n>  src/gstreamer/meson.build | 7 +++++++\n>  1 file changed, 7 insertions(+)\n> \n> diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build\n> index 20784b71..3810a15b 100644\n> --- a/src/gstreamer/meson.build\n> +++ b/src/gstreamer/meson.build\n> @@ -46,3 +46,10 @@ libcamera_gst = shared_library('gstlibcamera',\n>      install : true,\n>      install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),\n>  )\n> +\n> +# Makes the plugin visble to GStreamer inside meson devenv\n> +fs = import('fs')\n> +plugin_path = fs.parent(libcamera_gst.full_path())\n> +env = environment()\n> +env.prepend('GST_PLUGIN_PATH', fs.parent(plugin_path))\n> +meson.add_devenv(env)","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 C28A1C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Dec 2023 14:00:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4611D629DF;\n\tTue,  5 Dec 2023 15:00:20 +0100 (CET)","from madras.collabora.co.uk (madras.collabora.co.uk\n\t[46.235.227.172])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D49061D9B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Dec 2023 15:00:19 +0100 (CET)","from nicolas-tpx395.localdomain (cola.collaboradmins.com\n\t[195.201.22.229])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (4096 bits)\n\tserver-digest SHA256)\n\t(No client certificate requested) (Authenticated sender: nicolas)\n\tby madras.collabora.co.uk (Postfix) with ESMTPSA id CD86C66072EC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Dec 2023 14:00:18 +0000 (GMT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1701784820;\n\tbh=hQDJSyBCXqDmHjTxioHhnDBBSIqiDHymil5j7H9by1w=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=i1LxaOJWYXROWoPEXr1xutbUjfHW8yygYL05sgzeVlKvZpK19JDjqQHvXzWvXR+rO\n\tPY1qac25RHPVsOq+F2kRUjNypX5jiZRQmhjzsAItNZHXefZ7QCSGsmNNyd1575B6NU\n\tHGrtdKS9wQsoTb+llaPD+h3WSAxYo3F03/uLYQ8pLgvV4BwGY160Aba6VnG66SyUrx\n\tC3lv0CC0AOizaK5e2InZIuJp/XStoHlb60mwYyX1f5yXh35jK4d/9XfZL8V8+D3YD6\n\tpL5eAgTwAr5QvZEmtlPmPeS6E0QiGofwuNrSQUiFkjHHGSjYqXyVlasWb00ggyQyN/\n\tYbhm1xFS4LxuA==","v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com;\n\ts=mail; t=1701784819;\n\tbh=hQDJSyBCXqDmHjTxioHhnDBBSIqiDHymil5j7H9by1w=;\n\th=Subject:From:To:Date:In-Reply-To:References:From;\n\tb=ZQfSMpbgRcmAcKshEx/BRJai/cw/6dKYKRsH1xZm8z7B8ROuJi3YJuP977lF2WjVQ\n\tPzETAf1MPvnf4kYSjOJAuN4F2UF4cnSJvry8Zmv7Rc0CxvPnSRnIlW68hcQ/goZAad\n\tiyWE6GuS0OgtpdFpuCHxQJKRhIUbmOaUWiYpSu2GBBmsJ57dFVEWcaC8SwbuvPauot\n\tWkLy+GWrrvCFaoBEByyQtw+kVztbY0niXA12ZCR/+6jFzEKNH6telUyD3uNapqpdPm\n\tLjApDj3TctEcqLzP4qCqkEHYx8AthsdBKOepe6DarZ118wUVsiyeqORzOr+y+oXDcT\n\tCLRlJTsueCdcg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=collabora.com\n\theader.i=@collabora.com\n\theader.b=\"ZQfSMpbg\"; dkim-atps=neutral","Message-ID":"<290b1a078ef2156e02de2dcef8c14e5c69270587.camel@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 05 Dec 2023 09:00:10 -0500","In-Reply-To":"<20231204212747.581968-1-nicolas@ndufresne.ca>","References":"<20231204212747.581968-1-nicolas@ndufresne.ca>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.48.4 (3.48.4-1.fc38) ","MIME-Version":"1.0","Subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","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":"Nicolas Dufresne via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28249,"web_url":"https://patchwork.libcamera.org/comment/28249/","msgid":"<20231205161943.GB22607@pendragon.ideasonboard.com>","date":"2023-12-05T16:19:43","subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Nicolas,\n\nThank you for the patch.\n\nOn Tue, Dec 05, 2023 at 09:00:10AM -0500, Nicolas Dufresne via libcamera-devel wrote:\n> Le lundi 04 décembre 2023 à 16:27 -0500, Nicolas Dufresne via libcamera-devel a écrit :\n> > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > \n> > This change to the build system will prepend the plugin build directory\n> > to GST_PLUGIN_PATH environment. This makes the built plugin visible to\n> > GStreamer inside meson devenv enabling uninstalled testing.\n> \n> In case of positive feedback, I'd like to make a V2 that updates the\n> documentation. Instead of:\n> \n>   export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer\n> \n> I'd document:\n> \n>   meson devenv -C build/\n> \n> Devenv is nicer since it prepends to the path, it will also blend well if\n> libcamera is made a subproject of another project using devenv (notably mesa\n> and/or GStreamer). In cross-compilation, the env can be generated on the build\n> computer, and used as a script on the target with help of the --dump option.\n\nI didn't know about meson devenv, it seems to be an interesting feature.\nWe have a bit of code in libcamera and in the unit tests to explicitly\nsupport running the libcamera test executables and the unit tests from\nthe build directory and find the correct resources. I would be happy to\nremove that if it could be replaced by meson devenv.\n\nRelated to this patch, we have the following code in\ntest/gstreamer/gstreamer_test.cpp:\n\n\t/*\n\t * Remove the system libcamera plugin, if any, and add the plugin from\n\t * the build directory.\n\t */\n\tGstRegistry *registry = gst_registry_get();\n\tg_autoptr(GstPlugin) plugin = gst_registry_lookup(registry, \"libgstlibcamera.so\");\n\tif (plugin)\n\t\tgst_registry_remove_plugin(registry, plugin);\n\n\tstd::string path = libcamera::utils::libcameraBuildPath() + \"src/gstreamer\";\n\tif (!gst_registry_scan_path(registry, path.c_str())) {\n\t\tg_printerr(\"Failed to add plugin to registry\\n\");\n\n\t\tstatus_ = TestFail;\n\t\treturn;\n\t}\n\nDo you think this could be dropped ? I haven't checked if the meson unit\ntests are run in a similar environment as devenv though.\n\n> > ---\n> >  src/gstreamer/meson.build | 7 +++++++\n> >  1 file changed, 7 insertions(+)\n> > \n> > diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build\n> > index 20784b71..3810a15b 100644\n> > --- a/src/gstreamer/meson.build\n> > +++ b/src/gstreamer/meson.build\n> > @@ -46,3 +46,10 @@ libcamera_gst = shared_library('gstlibcamera',\n> >      install : true,\n> >      install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),\n> >  )\n> > +\n> > +# Makes the plugin visble to GStreamer inside meson devenv\n> > +fs = import('fs')\n> > +plugin_path = fs.parent(libcamera_gst.full_path())\n> > +env = environment()\n> > +env.prepend('GST_PLUGIN_PATH', fs.parent(plugin_path))\n> > +meson.add_devenv(env)","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 66BCCC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Dec 2023 16:19:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B5667629E1;\n\tTue,  5 Dec 2023 17:19:37 +0100 (CET)","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 7357E61D9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Dec 2023 17:19:36 +0100 (CET)","from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ABD6A844;\n\tTue,  5 Dec 2023 17:18:55 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1701793177;\n\tbh=I53ALMbmh1ewFNG9poo2Bz7lv0rLnDAe/H8Xdb8SeFw=;\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:Cc:\n\tFrom;\n\tb=oPr4dnKwN3rsxbs3LFxaBQ3fEhQQaUz/EUUourFkVX9uht+0oC+b4Y7tFIBYpTL3S\n\tp2JyOR+eSamvGQhW1SuZQh7QA/qhlioUY8b55vxYq7e8FftOPVnHp+2QUCS1J4SSml\n\tZET/IrBJ6eUxGSTNvxg3ctYHKmVgC20OHKGCUhX5HP2RR/bhLpNm3amuoMO8Jb9cLl\n\tNDKvcTa1Fb7oy8LJ9csuScsh7Shc4fbJWOifQ94IMPmNh8DpTnrD3q0ekqMc1AeC5x\n\tG7yEjc6cY7U2WyNBwknzAgpVBNZWhDUAPc6wyWa5gYQsMOAQkRMx4w1lMyjYWgOO3E\n\tyWGZdnlHhkDoQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1701793135;\n\tbh=I53ALMbmh1ewFNG9poo2Bz7lv0rLnDAe/H8Xdb8SeFw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=vhvsl/GZSWTgJm7qqTmRQpm4ffNkNFrNZjB3dnOrGi9l1kssu1e6GX7oWCr03Njjq\n\tHZqCd8FBr71lQqYuhS7iUVM/tDWqproAHGkzvtpf7B3Kc7yp6vjNIOXCobcjzsfYuR\n\tWwtw/OPaPh/qiRXI+wrqsYIOsYcSjBYni/MuqJn8="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"vhvsl/GZ\"; dkim-atps=neutral","Date":"Tue, 5 Dec 2023 18:19:43 +0200","To":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Message-ID":"<20231205161943.GB22607@pendragon.ideasonboard.com>","References":"<20231204212747.581968-1-nicolas@ndufresne.ca>\n\t<290b1a078ef2156e02de2dcef8c14e5c69270587.camel@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<290b1a078ef2156e02de2dcef8c14e5c69270587.camel@collabora.com>","Subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28250,"web_url":"https://patchwork.libcamera.org/comment/28250/","msgid":"<2776468b4af1024c5ef5a99a2e5d3587c490f1c0.camel@collabora.com>","date":"2023-12-05T20:18:47","subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","submitter":{"id":31,"url":"https://patchwork.libcamera.org/api/people/31/","name":"Nicolas Dufresne","email":"nicolas.dufresne@collabora.com"},"content":"Hi,\n\nLe mardi 05 décembre 2023 à 18:19 +0200, Laurent Pinchart a écrit :\n> Hi Nicolas,\n> \n> Thank you for the patch.\n> \n> On Tue, Dec 05, 2023 at 09:00:10AM -0500, Nicolas Dufresne via libcamera-devel wrote:\n> > Le lundi 04 décembre 2023 à 16:27 -0500, Nicolas Dufresne via libcamera-devel a écrit :\n> > > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > > \n> > > This change to the build system will prepend the plugin build directory\n> > > to GST_PLUGIN_PATH environment. This makes the built plugin visible to\n> > > GStreamer inside meson devenv enabling uninstalled testing.\n> > \n> > In case of positive feedback, I'd like to make a V2 that updates the\n> > documentation. Instead of:\n> > \n> >   export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer\n> > \n> > I'd document:\n> > \n> >   meson devenv -C build/\n> > \n> > Devenv is nicer since it prepends to the path, it will also blend well if\n> > libcamera is made a subproject of another project using devenv (notably mesa\n> > and/or GStreamer). In cross-compilation, the env can be generated on the build\n> > computer, and used as a script on the target with help of the --dump option.\n> \n> I didn't know about meson devenv, it seems to be an interesting feature.\n> We have a bit of code in libcamera and in the unit tests to explicitly\n> support running the libcamera test executables and the unit tests from\n> the build directory and find the correct resources. I would be happy to\n> remove that if it could be replaced by meson devenv.\n\nTests have their own \"env\" option, which does not need to match the devenv.\n\nhttps://mesonbuild.com/Unit-tests.html\n\n> \n> Related to this patch, we have the following code in\n> test/gstreamer/gstreamer_test.cpp:\n> \n> \t/*\n> \t * Remove the system libcamera plugin, if any, and add the plugin from\n> \t * the build directory.\n> \t */\n> \tGstRegistry *registry = gst_registry_get();\n> \tg_autoptr(GstPlugin) plugin = gst_registry_lookup(registry, \"libgstlibcamera.so\");\n> \tif (plugin)\n> \t\tgst_registry_remove_plugin(registry, plugin);\n> \n> \tstd::string path = libcamera::utils::libcameraBuildPath() + \"src/gstreamer\";\n> \tif (!gst_registry_scan_path(registry, path.c_str())) {\n> \t\tg_printerr(\"Failed to add plugin to registry\\n\");\n> \n> \t\tstatus_ = TestFail;\n> \t\treturn;\n> \t}\n> \n> Do you think this could be dropped ? I haven't checked if the meson unit\n> tests are run in a similar environment as devenv though.\n\nWe can certainly drop this and just use the same env for devenv and the meson\ntest. The registry cache is invalidate when the env changes and path order is\nrespected.\n\n> \n> > > ---\n> > >  src/gstreamer/meson.build | 7 +++++++\n> > >  1 file changed, 7 insertions(+)\n> > > \n> > > diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build\n> > > index 20784b71..3810a15b 100644\n> > > --- a/src/gstreamer/meson.build\n> > > +++ b/src/gstreamer/meson.build\n> > > @@ -46,3 +46,10 @@ libcamera_gst = shared_library('gstlibcamera',\n> > >      install : true,\n> > >      install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),\n> > >  )\n> > > +\n> > > +# Makes the plugin visble to GStreamer inside meson devenv\n> > > +fs = import('fs')\n> > > +plugin_path = fs.parent(libcamera_gst.full_path())\n> > > +env = environment()\n> > > +env.prepend('GST_PLUGIN_PATH', fs.parent(plugin_path))\n> > > +meson.add_devenv(env)\n>","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 E311AC322E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Dec 2023 20:19:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 477EA61D9F;\n\tTue,  5 Dec 2023 21:19:00 +0100 (CET)","from madras.collabora.co.uk (madras.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DA3B261D9B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Dec 2023 21:18:58 +0100 (CET)","from nicolas-tpx395.localdomain (cola.collaboradmins.com\n\t[195.201.22.229])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (4096 bits)\n\tserver-digest SHA256)\n\t(No client certificate requested) (Authenticated sender: nicolas)\n\tby madras.collabora.co.uk (Postfix) with ESMTPSA id 093986607090;\n\tTue,  5 Dec 2023 20:18:57 +0000 (GMT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1701807540;\n\tbh=0fTSs3jb/G93tn+pxMLUMryeQ9oxKwxZGGmPDIvIKBY=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=KIH7dEXss51qhtSSKiKL31jcO4z9lsFzqov+ke38ty7OSCSFOXBe2ewx0twTWtYYH\n\tV6lXaqMgDRnF6QWTk/qLC2mhcqpyjeu0W/0JdNqJwBN4/GG3zw/YFCeTQs29X1CLaA\n\th1e2Jdd0S/dzIUaDoFPeL3B2PLdd0yia/DrYXVayVnrRG0pTarHR1x1t/HeMZR0tdq\n\tr2OdOkRfXsTpF/pB6dUKyGjtzlZhal+dO/+tBzCOTS/+f0c7Bxl6+DGMO2LEBvHUr9\n\t3gvnt6BfFsL4aArme7P78THdL9XlFx+6OOIUXpUPMTbJporAYHDXhB/8dK9bAd+78t\n\t6HFR28gDqjBGw==","v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com;\n\ts=mail; t=1701807538;\n\tbh=0fTSs3jb/G93tn+pxMLUMryeQ9oxKwxZGGmPDIvIKBY=;\n\th=Subject:From:To:Cc:Date:In-Reply-To:References:From;\n\tb=iwsmttbzqaQboqI1iawMc2YHvr+288IYwixgay8MgNWDYyqcwJxcPDMdfMMUT6PvZ\n\t7J/oCXxUQ4etvaEpCETHKceQTuknx3mpINtpqR4NRIGMiUy+mrJLc+C6ldYo6RhjQv\n\tVzQCZN+/dIAUfRjWAJ+iwSt78ZXm3cs/9aSWh/2JoaOfkY++mAqOquO5xmTIpVEEXA\n\taYvuJjGHKfZ75DZ+N4FOth+o1lcbiHkM9JIu4Aw9JPPMcpWub6Y1j7r3FfQ8c7qcMD\n\tdE8y2zMNEa/R1TuExp4RI3HFU5HbcY0qP4tOkkDPErZG1H5ugQBQxo7j+BqZKc1fzj\n\tSWoglQfKP2Ywg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=collabora.com\n\theader.i=@collabora.com\n\theader.b=\"iwsmttbz\"; dkim-atps=neutral","Message-ID":"<2776468b4af1024c5ef5a99a2e5d3587c490f1c0.camel@collabora.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Tue, 05 Dec 2023 15:18:47 -0500","In-Reply-To":"<20231205161943.GB22607@pendragon.ideasonboard.com>","References":"<20231204212747.581968-1-nicolas@ndufresne.ca>\n\t<290b1a078ef2156e02de2dcef8c14e5c69270587.camel@collabora.com>\n\t<20231205161943.GB22607@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.48.4 (3.48.4-1.fc38) ","MIME-Version":"1.0","Subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","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":"Nicolas Dufresne via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28366,"web_url":"https://patchwork.libcamera.org/comment/28366/","msgid":"<170419376945.3044059.15270249383584788635@ping.linuxembedded.co.uk>","date":"2024-01-02T11:09:29","subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Nicolas Dufresne via libcamera-devel (2023-12-05 20:18:47)\n> Hi,\n> \n> Le mardi 05 décembre 2023 à 18:19 +0200, Laurent Pinchart a écrit :\n> > Hi Nicolas,\n> > \n> > Thank you for the patch.\n> > \n> > On Tue, Dec 05, 2023 at 09:00:10AM -0500, Nicolas Dufresne via libcamera-devel wrote:\n> > > Le lundi 04 décembre 2023 à 16:27 -0500, Nicolas Dufresne via libcamera-devel a écrit :\n> > > > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > > > \n> > > > This change to the build system will prepend the plugin build directory\n> > > > to GST_PLUGIN_PATH environment. This makes the built plugin visible to\n> > > > GStreamer inside meson devenv enabling uninstalled testing.\n> > > \n> > > In case of positive feedback, I'd like to make a V2 that updates the\n> > > documentation. Instead of:\n> > > \n> > >   export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer\n> > > \n> > > I'd document:\n> > > \n> > >   meson devenv -C build/\n\nAck.\n\n> > > \n> > > Devenv is nicer since it prepends to the path, it will also blend well if\n> > > libcamera is made a subproject of another project using devenv (notably mesa\n> > > and/or GStreamer). In cross-compilation, the env can be generated on the build\n> > > computer, and used as a script on the target with help of the --dump option.\n> > \n> > I didn't know about meson devenv, it seems to be an interesting feature.\n> > We have a bit of code in libcamera and in the unit tests to explicitly\n> > support running the libcamera test executables and the unit tests from\n> > the build directory and find the correct resources. I would be happy to\n> > remove that if it could be replaced by meson devenv.\n> \n> Tests have their own \"env\" option, which does not need to match the devenv.\n> \n> https://mesonbuild.com/Unit-tests.html\n\nHrm ... looks like that would need to be added to every test (at least\nevery test that needs it - but perhaps it's better to add it to all to\nbe consistent).\n\nSo we might have to make this env global to libcamera as a\nlibcamera_runtime_env or such.\n\nCould be done later though ... Not this patch.\n\n> > Related to this patch, we have the following code in\n> > test/gstreamer/gstreamer_test.cpp:\n> > \n> >       /*\n> >        * Remove the system libcamera plugin, if any, and add the plugin from\n> >        * the build directory.\n> >        */\n> >       GstRegistry *registry = gst_registry_get();\n> >       g_autoptr(GstPlugin) plugin = gst_registry_lookup(registry, \"libgstlibcamera.so\");\n> >       if (plugin)\n> >               gst_registry_remove_plugin(registry, plugin);\n> > \n> >       std::string path = libcamera::utils::libcameraBuildPath() + \"src/gstreamer\";\n> >       if (!gst_registry_scan_path(registry, path.c_str())) {\n> >               g_printerr(\"Failed to add plugin to registry\\n\");\n> > \n> >               status_ = TestFail;\n> >               return;\n> >       }\n> > \n> > Do you think this could be dropped ? I haven't checked if the meson unit\n> > tests are run in a similar environment as devenv though.\n> \n> We can certainly drop this and just use the same env for devenv and the meson\n> test. The registry cache is invalidate when the env changes and path order is\n> respected.\n\nSounds like we could look to removing the isLibcameraInstalled()\nDT_RUNPATH/DT_RPATH workaround too?\n\n\n> > > > ---\n> > > >  src/gstreamer/meson.build | 7 +++++++\n> > > >  1 file changed, 7 insertions(+)\n> > > > \n> > > > diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build\n> > > > index 20784b71..3810a15b 100644\n> > > > --- a/src/gstreamer/meson.build\n> > > > +++ b/src/gstreamer/meson.build\n> > > > @@ -46,3 +46,10 @@ libcamera_gst = shared_library('gstlibcamera',\n> > > >      install : true,\n> > > >      install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),\n> > > >  )\n> > > > +\n> > > > +# Makes the plugin visble to GStreamer inside meson devenv\n> > > > +fs = import('fs')\n> > > > +plugin_path = fs.parent(libcamera_gst.full_path())\n> > > > +env = environment()\n> > > > +env.prepend('GST_PLUGIN_PATH', fs.parent(plugin_path))\n> > > > +meson.add_devenv(env)\n\n - Cc: Tomi - Is this something that should be added for Python too?\n\nThis patch does seem fairly self sufficient though, and otherwise\nunobtrusive, (and seemingly beneficial).\n\nWith or without your proposed update to README.rst\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n--\nKieran","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 9867FBE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Jan 2024 11:09:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D02DF62B3F;\n\tTue,  2 Jan 2024 12:09:33 +0100 (CET)","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 108F562B32\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Jan 2024 12:09:32 +0100 (CET)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A2DDE6DE;\n\tTue,  2 Jan 2024 12:08:32 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1704193773;\n\tbh=vcq7e8HQgUPaL5R+XyEq/RyTv5mN22lsZTEpiXrtqLo=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=uSxCwUhfm94HLsIU/MA2nlPf22nYPLfEUPAlZPJqB6wNncC5gnUfAbIPv6AvxsOgJ\n\tFfZDXDgxzC/wQnt0eiPQfwiWFPovUTpRZ2MmXk2+vm4nRpomOS6S76jbdNgPD/JYRT\n\t2N8LExb5wrvM9P6FQ5rX4EKcO9P7OgA/mkWCM9BjXHGbmMAPKxiw0YMldour9K52o/\n\tMyJv5FAPeN/daq8WSI5CgInv0JJHhj2CafkGH12IJs1vUZ7qvOu92qA7LB0O51weHC\n\tT3oVwLVUevxM4/WDu3fEtaXp7oVARf+tyAYZ3VDIbmZLFu32RvKCx1v/ux0eI8LUp3\n\t5x2lk0InAcd9A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1704193712;\n\tbh=vcq7e8HQgUPaL5R+XyEq/RyTv5mN22lsZTEpiXrtqLo=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=pGikluob4QyC6tLjohJ+KptHHZMMpIJrSxfS17rYfCUBmG6DBco22yFjWvHWsvHpH\n\tJ/kWgs2B0gZ+deIxG3SLir8CdJlbn3DU/FBAyMmvM5GFTwk4dxrZDiLuSSRVV7qDwV\n\ttxfv8XvbsWs1KklIHAn3FZ3V+93h87+fplOPSboA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"pGikluob\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<2776468b4af1024c5ef5a99a2e5d3587c490f1c0.camel@collabora.com>","References":"<20231204212747.581968-1-nicolas@ndufresne.ca>\n\t<290b1a078ef2156e02de2dcef8c14e5c69270587.camel@collabora.com>\n\t<20231205161943.GB22607@pendragon.ideasonboard.com>\n\t<2776468b4af1024c5ef5a99a2e5d3587c490f1c0.camel@collabora.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tNicolas Dufresne <nicolas.dufresne@collabora.com>,\n\tNicolas Dufresne via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Date":"Tue, 02 Jan 2024 11:09:29 +0000","Message-ID":"<170419376945.3044059.15270249383584788635@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28391,"web_url":"https://patchwork.libcamera.org/comment/28391/","msgid":"<818cc1b9c5c53a553765151dcc4e969912ceb744.camel@collabora.com>","date":"2024-01-08T15:42:06","subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","submitter":{"id":31,"url":"https://patchwork.libcamera.org/api/people/31/","name":"Nicolas Dufresne","email":"nicolas.dufresne@collabora.com"},"content":"Hi,\n\nLe mardi 02 janvier 2024 à 11:09 +0000, Kieran Bingham a écrit :\n> Quoting Nicolas Dufresne via libcamera-devel (2023-12-05 20:18:47)\n> > Hi,\n> > \n> > Le mardi 05 décembre 2023 à 18:19 +0200, Laurent Pinchart a écrit :\n> > > Hi Nicolas,\n> > > \n> > > Thank you for the patch.\n> > > \n> > > On Tue, Dec 05, 2023 at 09:00:10AM -0500, Nicolas Dufresne via libcamera-devel wrote:\n> > > > Le lundi 04 décembre 2023 à 16:27 -0500, Nicolas Dufresne via libcamera-devel a écrit :\n> > > > > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > > > > \n> > > > > This change to the build system will prepend the plugin build directory\n> > > > > to GST_PLUGIN_PATH environment. This makes the built plugin visible to\n> > > > > GStreamer inside meson devenv enabling uninstalled testing.\n> > > > \n> > > > In case of positive feedback, I'd like to make a V2 that updates the\n> > > > documentation. Instead of:\n> > > > \n> > > >   export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer\n> > > > \n> > > > I'd document:\n> > > > \n> > > >   meson devenv -C build/\n> \n> Ack.\n> \n> > > > \n> > > > Devenv is nicer since it prepends to the path, it will also blend well if\n> > > > libcamera is made a subproject of another project using devenv (notably mesa\n> > > > and/or GStreamer). In cross-compilation, the env can be generated on the build\n> > > > computer, and used as a script on the target with help of the --dump option.\n> > > \n> > > I didn't know about meson devenv, it seems to be an interesting feature.\n> > > We have a bit of code in libcamera and in the unit tests to explicitly\n> > > support running the libcamera test executables and the unit tests from\n> > > the build directory and find the correct resources. I would be happy to\n> > > remove that if it could be replaced by meson devenv.\n> > \n> > Tests have their own \"env\" option, which does not need to match the devenv.\n> > \n> > https://mesonbuild.com/Unit-tests.html\n> \n> Hrm ... looks like that would need to be added to every test (at least\n> every test that needs it - but perhaps it's better to add it to all to\n> be consistent).\n> \n> So we might have to make this env global to libcamera as a\n> libcamera_runtime_env or such.\n> \n> Could be done later though ... Not this patch.\n\nI'll give it some further thought while making v2, but as said, we can split\nadding devenv from setting tests env initially.\n\n> \n> > > Related to this patch, we have the following code in\n> > > test/gstreamer/gstreamer_test.cpp:\n> > > \n> > >       /*\n> > >        * Remove the system libcamera plugin, if any, and add the plugin from\n> > >        * the build directory.\n> > >        */\n> > >       GstRegistry *registry = gst_registry_get();\n> > >       g_autoptr(GstPlugin) plugin = gst_registry_lookup(registry, \"libgstlibcamera.so\");\n> > >       if (plugin)\n> > >               gst_registry_remove_plugin(registry, plugin);\n> > > \n> > >       std::string path = libcamera::utils::libcameraBuildPath() + \"src/gstreamer\";\n> > >       if (!gst_registry_scan_path(registry, path.c_str())) {\n> > >               g_printerr(\"Failed to add plugin to registry\\n\");\n> > > \n> > >               status_ = TestFail;\n> > >               return;\n> > >       }\n> > > \n> > > Do you think this could be dropped ? I haven't checked if the meson unit\n> > > tests are run in a similar environment as devenv though.\n> > \n> > We can certainly drop this and just use the same env for devenv and the meson\n> > test. The registry cache is invalidate when the env changes and path order is\n> > respected.\n> \n> Sounds like we could look to removing the isLibcameraInstalled()\n> DT_RUNPATH/DT_RPATH workaround too?\n\nI did think about this, but the workaround is something that just work without\nhaving to interact with meson. What would happen is that some people workflow\nwould be affected. For this reason another subject that is best handled\nseparately. Are you aware of known maintenance issue with the current approach ?\n\n> \n> \n> > > > > ---\n> > > > >  src/gstreamer/meson.build | 7 +++++++\n> > > > >  1 file changed, 7 insertions(+)\n> > > > > \n> > > > > diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build\n> > > > > index 20784b71..3810a15b 100644\n> > > > > --- a/src/gstreamer/meson.build\n> > > > > +++ b/src/gstreamer/meson.build\n> > > > > @@ -46,3 +46,10 @@ libcamera_gst = shared_library('gstlibcamera',\n> > > > >      install : true,\n> > > > >      install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),\n> > > > >  )\n> > > > > +\n> > > > > +# Makes the plugin visble to GStreamer inside meson devenv\n> > > > > +fs = import('fs')\n> > > > > +plugin_path = fs.parent(libcamera_gst.full_path())\n> > > > > +env = environment()\n> > > > > +env.prepend('GST_PLUGIN_PATH', fs.parent(plugin_path))\n> > > > > +meson.add_devenv(env)\n> \n>  - Cc: Tomi - Is this something that should be added for Python too?\n> \n> This patch does seem fairly self sufficient though, and otherwise\n> unobtrusive, (and seemingly beneficial).\n> \n> With or without your proposed update to README.rst\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nThank you, I'll refresh my memory and rebase locally and will soon come back\nwith at least an updated readme, which I want for my self too.\n\nNicolas\n\n> \n> --\n> Kieran","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 BDFCCBDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Jan 2024 15:42:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8FC0F62B41;\n\tMon,  8 Jan 2024 16:42:13 +0100 (CET)","from madrid.collaboradmins.com (madrid.collaboradmins.com\n\t[46.235.227.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0EEF261D7E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Jan 2024 16:42:11 +0100 (CET)","from nicolas-tpx395.localdomain (cola.collaboradmins.com\n\t[195.201.22.229])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (4096 bits)\n\tserver-digest SHA256)\n\t(No client certificate requested) (Authenticated sender: nicolas)\n\tby madrid.collaboradmins.com (Postfix) with ESMTPSA id 06CB33780C22; \n\tMon,  8 Jan 2024 15:42:09 +0000 (UTC)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1704728533;\n\tbh=CPZagfl1P/+lWNf45vpNSEoZevoCFd1LcC+A+5MVZOs=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=jctN14MMFOz5SDCP25sMqOnTCotN7Zfjd+fmSD9hIQfsYP8S33umHhxVAnSHztjWg\n\tW14OHqpxHCao0SksLmzukwMOI8gZMMubV6+wo2bFap8E7RZg2+dPW53kf1Oj/E0PGL\n\tkkgn/38AZJ3SfLEZvmmsITAycVpkUqisVty59qeq3dWCpMXmoz6Vk678PIZLIqoToq\n\trx14e3R7zpn1yJFVhXTdxnIkrt5KCumoHrMkYnfdlCZq+qHN1qAbeAx893nyHANZQa\n\t0yFbuamX3EsHMvioIuvnma7IzJs5F1hgEMpHxCGyvwRjoPooFsZdxrIZ0Wds2rmss+\n\tDTkPmlWfCDKuw==","v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com;\n\ts=mail; t=1704728530;\n\tbh=CPZagfl1P/+lWNf45vpNSEoZevoCFd1LcC+A+5MVZOs=;\n\th=Subject:From:To:Date:In-Reply-To:References:From;\n\tb=Owc36BIjIK1nEkt1QxB9zyyR/4Xw2Q0oJJNEheROb+eBJ/b3VS5GUFiEkwAOY53wL\n\t2+3NWw8BLMHUi5sMy/b6PVtCtE1OkqelBsD9TVsBMAsuDxcX/jFXubhBSBvY3xCbdv\n\txuSAttOy8snyp/ECEiWrN2+jhCLkh66jDzFcKBFcNakwooKrA1QVClFS/b2uGoYXgC\n\tOAGOX/uRO+L+9gNfqswvo6TpmVFQkx6rXjSxZXKbZP8vycN/Wzlmz9V5BZFbqYWxCL\n\tqqU0zohdaZU2rFucAyzWy4Fk0rvgpw0qbkAHws0uvJUAa/yO+q7e0EdAoGrCJFWtrq\n\tydJoOh0w5XykQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=collabora.com\n\theader.i=@collabora.com\n\theader.b=\"Owc36BIj\"; dkim-atps=neutral","Message-ID":"<818cc1b9c5c53a553765151dcc4e969912ceb744.camel@collabora.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>, Laurent Pinchart\n\t<laurent.pinchart@ideasonboard.com>, Nicolas Dufresne via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Date":"Mon, 08 Jan 2024 10:42:06 -0500","In-Reply-To":"<170419376945.3044059.15270249383584788635@ping.linuxembedded.co.uk>","References":"<20231204212747.581968-1-nicolas@ndufresne.ca>\n\t<290b1a078ef2156e02de2dcef8c14e5c69270587.camel@collabora.com>\n\t<20231205161943.GB22607@pendragon.ideasonboard.com>\n\t<2776468b4af1024c5ef5a99a2e5d3587c490f1c0.camel@collabora.com>\n\t<170419376945.3044059.15270249383584788635@ping.linuxembedded.co.uk>","Autocrypt":"addr=nicolas.dufresne@collabora.com; prefer-encrypt=mutual;\n\tkeydata=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","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.50.2 (3.50.2-1.fc39) ","MIME-Version":"1.0","Subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","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":"Nicolas Dufresne via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28513,"web_url":"https://patchwork.libcamera.org/comment/28513/","msgid":"<20240122102819.GN4378@pendragon.ideasonboard.com>","date":"2024-01-22T10:28:19","subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Nicolas,\n\nOn Mon, Jan 08, 2024 at 10:42:06AM -0500, Nicolas Dufresne wrote:\n> Le mardi 02 janvier 2024 à 11:09 +0000, Kieran Bingham a écrit :\n> > Quoting Nicolas Dufresne via libcamera-devel (2023-12-05 20:18:47)\n> > > Le mardi 05 décembre 2023 à 18:19 +0200, Laurent Pinchart a écrit :\n> > > > On Tue, Dec 05, 2023 at 09:00:10AM -0500, Nicolas Dufresne via libcamera-devel wrote:\n> > > > > Le lundi 04 décembre 2023 à 16:27 -0500, Nicolas Dufresne via libcamera-devel a écrit :\n> > > > > > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > > > > > \n> > > > > > This change to the build system will prepend the plugin build directory\n> > > > > > to GST_PLUGIN_PATH environment. This makes the built plugin visible to\n> > > > > > GStreamer inside meson devenv enabling uninstalled testing.\n> > > > > \n> > > > > In case of positive feedback, I'd like to make a V2 that updates the\n> > > > > documentation. Instead of:\n> > > > > \n> > > > >   export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer\n> > > > > \n> > > > > I'd document:\n> > > > > \n> > > > >   meson devenv -C build/\n> > \n> > Ack.\n> > \n> > > > > \n> > > > > Devenv is nicer since it prepends to the path, it will also blend well if\n> > > > > libcamera is made a subproject of another project using devenv (notably mesa\n> > > > > and/or GStreamer). In cross-compilation, the env can be generated on the build\n> > > > > computer, and used as a script on the target with help of the --dump option.\n> > > > \n> > > > I didn't know about meson devenv, it seems to be an interesting feature.\n> > > > We have a bit of code in libcamera and in the unit tests to explicitly\n> > > > support running the libcamera test executables and the unit tests from\n> > > > the build directory and find the correct resources. I would be happy to\n> > > > remove that if it could be replaced by meson devenv.\n> > > \n> > > Tests have their own \"env\" option, which does not need to match the devenv.\n> > > \n> > > https://mesonbuild.com/Unit-tests.html\n> > \n> > Hrm ... looks like that would need to be added to every test (at least\n> > every test that needs it - but perhaps it's better to add it to all to\n> > be consistent).\n> > \n> > So we might have to make this env global to libcamera as a\n> > libcamera_runtime_env or such.\n> > \n> > Could be done later though ... Not this patch.\n> \n> I'll give it some further thought while making v2, but as said, we can split\n> adding devenv from setting tests env initially.\n> \n> > > > Related to this patch, we have the following code in\n> > > > test/gstreamer/gstreamer_test.cpp:\n> > > > \n> > > >       /*\n> > > >        * Remove the system libcamera plugin, if any, and add the plugin from\n> > > >        * the build directory.\n> > > >        */\n> > > >       GstRegistry *registry = gst_registry_get();\n> > > >       g_autoptr(GstPlugin) plugin = gst_registry_lookup(registry, \"libgstlibcamera.so\");\n> > > >       if (plugin)\n> > > >               gst_registry_remove_plugin(registry, plugin);\n> > > > \n> > > >       std::string path = libcamera::utils::libcameraBuildPath() + \"src/gstreamer\";\n> > > >       if (!gst_registry_scan_path(registry, path.c_str())) {\n> > > >               g_printerr(\"Failed to add plugin to registry\\n\");\n> > > > \n> > > >               status_ = TestFail;\n> > > >               return;\n> > > >       }\n> > > > \n> > > > Do you think this could be dropped ? I haven't checked if the meson unit\n> > > > tests are run in a similar environment as devenv though.\n> > > \n> > > We can certainly drop this and just use the same env for devenv and the meson\n> > > test. The registry cache is invalidate when the env changes and path order is\n> > > respected.\n> > \n> > Sounds like we could look to removing the isLibcameraInstalled()\n> > DT_RUNPATH/DT_RPATH workaround too?\n> \n> I did think about this, but the workaround is something that just work without\n> having to interact with meson. What would happen is that some people workflow\n> would be affected. For this reason another subject that is best handled\n> separately. Are you aware of known maintenance issue with the current approach ?\n\nNot really. I just think the current mechanism is a bit of a hack, and\nis likely fragile, I would be happy to drop it if we could. There's no\nurgency though.\n\nWhen it comes to running binaries from the build directory for quick\ntesting, it's not a workflow we've committed to support in the same way\nforever. I think requiring usage of meson devenv would be reasonable, if\nit gives us all we need in a simple way.\n\n> > > > > > ---\n> > > > > >  src/gstreamer/meson.build | 7 +++++++\n> > > > > >  1 file changed, 7 insertions(+)\n> > > > > > \n> > > > > > diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build\n> > > > > > index 20784b71..3810a15b 100644\n> > > > > > --- a/src/gstreamer/meson.build\n> > > > > > +++ b/src/gstreamer/meson.build\n> > > > > > @@ -46,3 +46,10 @@ libcamera_gst = shared_library('gstlibcamera',\n> > > > > >      install : true,\n> > > > > >      install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),\n> > > > > >  )\n> > > > > > +\n> > > > > > +# Makes the plugin visble to GStreamer inside meson devenv\n> > > > > > +fs = import('fs')\n> > > > > > +plugin_path = fs.parent(libcamera_gst.full_path())\n> > > > > > +env = environment()\n> > > > > > +env.prepend('GST_PLUGIN_PATH', fs.parent(plugin_path))\n> > > > > > +meson.add_devenv(env)\n> > \n> >  - Cc: Tomi - Is this something that should be added for Python too?\n> > \n> > This patch does seem fairly self sufficient though, and otherwise\n> > unobtrusive, (and seemingly beneficial).\n> > \n> > With or without your proposed update to README.rst\n> > \n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> Thank you, I'll refresh my memory and rebase locally and will soon come back\n> with at least an updated readme, which I want for my self too.","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 AA10AC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Jan 2024 10:28:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A5F5662936;\n\tMon, 22 Jan 2024 11:28:16 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 84884628AD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Jan 2024 11:28:15 +0100 (CET)","from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi\n\t[89.27.53.110])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 49499BEB;\n\tMon, 22 Jan 2024 11:27:02 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1705919296;\n\tbh=8TvmLTwI0TxrfBZg4e4fsuiT6t3sBJ/Mi2fiGqYPovY=;\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:Cc:\n\tFrom;\n\tb=CniaPrqDycgjK/D5SqWVrfsnWWc3s1JtVtzMqs2jUeErRvNAKeZUxCo5UYU7Y4eiH\n\tiP7j99b6dMCwuhzImqp3i0J17Ua3o9dKXCg61WTUFm9z6LpN+YMwhWWrJrdoIdJXCl\n\tq51VcDKqXRkk3Cq0tgdYwwFrRo8rS8KQHH7UZxlwel/Xq7TedjftXcVvF7EUXax8k1\n\tV+usX3nUM2pzBIMSsAfpCRJMXMwWahKcF6gfUZDMocudFzCEl72eumTZskNlrgGkSB\n\t3zR+mkCG7n2nj9CeWwkOHZpeztyyReiEc9/GE/NqHzgy/AerFp4OD4HUfVJsVHZ9PB\n\tV3+S1w4YRyYCg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1705919222;\n\tbh=8TvmLTwI0TxrfBZg4e4fsuiT6t3sBJ/Mi2fiGqYPovY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=TTmcg7Mi0tX8Uwa2wynZAOefT/fi3swfuSBn5gYA8vQw3ZrltLvXvkbH9yKqqsfSl\n\t0HalT8sg+CWhIgex7tmOx+baKKp48gChM7fDV6nComVd3iDkCiZ5ruq1VA+Oy38UR7\n\tzKjgAjLOdCtNBI2sJIzDZevcp0lpWNEx9nsTt6ak="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"TTmcg7Mi\"; dkim-atps=neutral","Date":"Mon, 22 Jan 2024 12:28:19 +0200","To":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Message-ID":"<20240122102819.GN4378@pendragon.ideasonboard.com>","References":"<20231204212747.581968-1-nicolas@ndufresne.ca>\n\t<290b1a078ef2156e02de2dcef8c14e5c69270587.camel@collabora.com>\n\t<20231205161943.GB22607@pendragon.ideasonboard.com>\n\t<2776468b4af1024c5ef5a99a2e5d3587c490f1c0.camel@collabora.com>\n\t<170419376945.3044059.15270249383584788635@ping.linuxembedded.co.uk>\n\t<818cc1b9c5c53a553765151dcc4e969912ceb744.camel@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<818cc1b9c5c53a553765151dcc4e969912ceb744.camel@collabora.com>","Subject":"Re: [libcamera-devel] [PATCH] gstreamer: Add meson devenv support","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Nicolas Dufresne via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]