{"id":9735,"url":"https://patchwork.libcamera.org/api/1.1/patches/9735/?format=json","web_url":"https://patchwork.libcamera.org/patch/9735/","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":"<20200922133537.258098-32-paul.elder@ideasonboard.com>","date":"2020-09-22T13:35:30","name":"[libcamera-devel,31/38] libcamera: IPAProxy: Remove registration mechanism","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ccb3904acdbb8ecd8ceb3ecc95fd925df7e3ed6b","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/9735/mbox/","series":[{"id":1309,"url":"https://patchwork.libcamera.org/api/1.1/series/1309/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1309","date":"2020-09-22T13:34:59","name":"IPA isolation implementation","version":1,"mbox":"https://patchwork.libcamera.org/series/1309/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9735/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9735/checks/","tags":{},"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 52DD5BF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Sep 2020 13:39:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2117A62FE7;\n\tTue, 22 Sep 2020 15:39:42 +0200 (CEST)","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 6239D62FD6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Sep 2020 15:39:40 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6967A2D7;\n\tTue, 22 Sep 2020 15:39:25 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"MUG8LgEE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600781972;\n\tbh=SGpV92jJBBmZOx6K0yn90AmH2q09GBFjmsIyhOIG9vY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=MUG8LgEEN+L1yJhMYyMXh9EQ+IqJmcvBqkI5sfAGxHag36E+WHJy4yU+hZeEsaryf\n\t+Lo4C7/63Q6xEZ6CBdPrQCHfFxsDC02M7obObjlgiGyTBNuh4EMFd2kAZYNaNBTGd9\n\tVWaT+DQV6AA+RdfCFcllX3z/s/ym/1vRSRD9u6ak=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Sep 2020 22:35:30 +0900","Message-Id":"<20200922133537.258098-32-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200922133537.258098-1-paul.elder@ideasonboard.com>","References":"<20200922133537.258098-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 31/38] libcamera: IPAProxy: Remove\n\tregistration mechanism","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>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Implementations of IPA proxies use a registration mechanism to register\nthemselves with the main IPA proxy factory. This registration declares\nstatic objects, causing a risk of things being constructed before the\nproper libcamera facilities are ready. Since each pipeline handler has\nits own IPA proxy and knows the type, it isn't necessary to have a proxy\nfactory. Remove it to alleviate the risk of early construction.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n---\nChanges in v2:\n- remove documentation\n---\n include/libcamera/internal/ipa_proxy.h | 29 --------\n src/libcamera/ipa_proxy.cpp            | 93 --------------------------\n 2 files changed, 122 deletions(-)","diff":"diff --git a/include/libcamera/internal/ipa_proxy.h b/include/libcamera/internal/ipa_proxy.h\nindex 1903150e..f651a3ae 100644\n--- a/include/libcamera/internal/ipa_proxy.h\n+++ b/include/libcamera/internal/ipa_proxy.h\n@@ -36,35 +36,6 @@ private:\n \tIPAModule *ipam_;\n };\n \n-class IPAProxyFactory\n-{\n-public:\n-\tIPAProxyFactory(const char *name);\n-\tvirtual ~IPAProxyFactory() {}\n-\n-\tvirtual std::unique_ptr<IPAProxy> create(IPAModule *ipam, bool isolate) = 0;\n-\n-\tconst std::string &name() const { return name_; }\n-\n-\tstatic void registerType(IPAProxyFactory *factory);\n-\tstatic std::vector<IPAProxyFactory *> &factories();\n-\n-private:\n-\tstd::string name_;\n-};\n-\n-#define REGISTER_IPA_PROXY(proxy)\t\t\t\t\t\\\n-class proxy##Factory final : public IPAProxyFactory\t\t\t\\\n-{\t\t\t\t\t\t\t\t\t\\\n-public:\t\t\t\t\t\t\t\t\t\\\n-\tproxy##Factory() : IPAProxyFactory(#proxy) {}\t\t\t\\\n-\tstd::unique_ptr<IPAProxy> create(IPAModule *ipam, bool isolate)\t\\\n-\t{\t\t\t\t\t\t\t\t\\\n-\t\treturn std::make_unique<proxy>(ipam, isolate);\t\t\\\n-\t}\t\t\t\t\t\t\t\t\\\n-};\t\t\t\t\t\t\t\t\t\\\n-static proxy##Factory global_##proxy##Factory;\n-\n } /* namespace libcamera */\n \n #endif /* __LIBCAMERA_INTERNAL_IPA_PROXY_H__ */\ndiff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp\nindex ee5e6f3e..29c0e9e0 100644\n--- a/src/libcamera/ipa_proxy.cpp\n+++ b/src/libcamera/ipa_proxy.cpp\n@@ -30,17 +30,11 @@ LOG_DEFINE_CATEGORY(IPAProxy)\n  * \\brief IPA Proxy\n  *\n  * Isolate IPA into separate process.\n- *\n- * Every subclass of proxy shall be registered with libcamera using\n- * the REGISTER_IPA_PROXY() macro.\n  */\n \n /**\n  * \\brief Construct an IPAProxy instance\n  * \\param[in] ipam The IPA module\n- *\n- * IPAProxy instances shall be constructed through the IPAProxyFactory::create()\n- * method implemented by the respective factories.\n  */\n IPAProxy::IPAProxy(IPAModule *ipam)\n \t: valid_(false), ipam_(ipam)\n@@ -219,91 +213,4 @@ std::string IPAProxy::resolvePath(const std::string &file) const\n  * construction.\n  */\n \n-/**\n- * \\class IPAProxyFactory\n- * \\brief Registration of IPAProxy classes and creation of instances\n- *\n- * To facilitate discovery and instantiation of IPAProxy classes, the\n- * IPAProxyFactory class maintains a registry of IPAProxy classes. Each\n- * IPAProxy subclass shall register itself using the REGISTER_IPA_PROXY()\n- * macro, which will create a corresponding instance of a IPAProxyFactory\n- * subclass and register it with the static list of factories.\n- */\n-\n-/**\n- * \\brief Construct a IPAProxy factory\n- * \\param[in] name Name of the IPAProxy class\n- *\n- * Creating an instance of the factory registers is with the global list of\n- * factories, accessible through the factories() function.\n- *\n- * The factory \\a name is used for debugging and IPAProxy matching purposes\n- * and shall be unique.\n- */\n-IPAProxyFactory::IPAProxyFactory(const char *name)\n-\t: name_(name)\n-{\n-\tregisterType(this);\n-}\n-\n-/**\n- * \\fn IPAProxyFactory::create()\n- * \\brief Create an instance of the IPAProxy corresponding to the factory\n- * \\param[in] ipam The IPA module\n- * \\param[in] isolate Flag to isolate the IPA module\n- *\n- * This virtual function is implemented by the REGISTER_IPA_PROXY() macro.\n- * It creates a IPAProxy instance that isolates an IPA interface designated\n- * by the IPA module \\a ipam. If \\a isolate is true, then the IPA module will\n- * be isolated.\n- *\n- * \\return A pointer to a newly constructed instance of the IPAProxy subclass\n- * corresponding to the factory\n- */\n-\n-/**\n- * \\fn IPAProxyFactory::name()\n- * \\brief Retrieve the factory name\n- * \\return The factory name\n- */\n-\n-/**\n- * \\brief Add a IPAProxy class to the registry\n- * \\param[in] factory Factory to use to construct the IPAProxy\n- *\n- * The caller is responsible to guarantee the uniqueness of the IPAProxy name.\n- */\n-void IPAProxyFactory::registerType(IPAProxyFactory *factory)\n-{\n-\tstd::vector<IPAProxyFactory *> &factories = IPAProxyFactory::factories();\n-\n-\tfactories.push_back(factory);\n-\n-\tLOG(IPAProxy, Debug)\n-\t\t<< \"Registered proxy \\\"\" << factory->name() << \"\\\"\";\n-}\n-\n-/**\n- * \\brief Retrieve the list of all IPAProxy factories\n- *\n- * The static factories map is defined inside the function to ensure it gets\n- * initialized on first use, without any dependency on link order.\n- *\n- * \\return The list of pipeline handler factories\n- */\n-std::vector<IPAProxyFactory *> &IPAProxyFactory::factories()\n-{\n-\tstatic std::vector<IPAProxyFactory *> factories;\n-\treturn factories;\n-}\n-\n-/**\n- * \\def REGISTER_IPA_PROXY\n- * \\brief Register a IPAProxy with the IPAProxy factory\n- * \\param[in] proxy Class name of IPAProxy derived class to register\n- *\n- * Register a proxy subclass with the factory and make it available to\n- * isolate IPA modules.\n- */\n-\n } /* namespace libcamera */\n","prefixes":["libcamera-devel","31/38"]}