[{"id":36270,"web_url":"https://patchwork.libcamera.org/comment/36270/","msgid":"<176056720167.162040.318635138677955191@ping.linuxembedded.co.uk>","date":"2025-10-15T22:26:41","subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Bryan O'Donoghue (2025-10-15 02:22:28)\n> EGL requires both configure() and process() to operate on the same\n> thread. As preparation for that, move current CPU configure into the\n> WorkerThread with a ConnectionTypeBlocking invocation of\n> &DebayerCpu::configure.\n> \n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n> ---\n>  src/libcamera/software_isp/software_isp.cpp | 12 ++++++++++--\n>  1 file changed, 10 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n> index 500858ab..df72b1c3 100644\n> --- a/src/libcamera/software_isp/software_isp.cpp\n> +++ b/src/libcamera/software_isp/software_isp.cpp\n> @@ -266,7 +266,15 @@ int SoftwareIsp::configure(const StreamConfiguration &inputCfg,\n>  \n>         ispWorkerThread_.start();\n>  \n> -       return debayer_->configure(inputCfg, outputCfgs, ccmEnabled_);\n> +       ret = debayer_->invokeMethod(&Debayer::configure,\n> +                                    ConnectionTypeBlocking, inputCfg,\n> +                                    outputCfgs, ccmEnabled_);\n> +       if (ret) {\n> +               ispWorkerThread_.exit();\n> +               ispWorkerThread_.wait();\n> +       }\n\nAgain, I think having the thread always available when the object is\nthere is probably less overhead than starting and stopping the thread on\neach configure cycle.\n\nI don't \"think\" threads are expensive...\n\n> +\n> +       return ret;\n>  }\n>  \n>  /**\n> @@ -389,7 +397,7 @@ void SoftwareIsp::stop()\n>  void SoftwareIsp::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output)\n>  {\n>         ipa_->computeParams(frame);\n> -       debayer_->invokeMethod(&DebayerCpu::process,\n> +       debayer_->invokeMethod(&Debayer::process,\n\nIs this a separate change?\n\n>                                ConnectionTypeQueued, frame, input, output, debayerParams_);\n>  }\n>  \n> -- \n> 2.51.0\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 DEDF2C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 22:26:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CC10C60633;\n\tThu, 16 Oct 2025 00:26:46 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9B75B605F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 00:26:44 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2EC12558;\n\tThu, 16 Oct 2025 00:25:05 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"sM8jGGQf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1760567105;\n\tbh=dSn55JR9yx3RRapzEQtCeC9cIFelfRaj5AAvnoNUVNw=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=sM8jGGQfosIS2oUA6LrZgyIpFcJj2HNCfGpW0PQY/5HDOLBt87+V57YHOoNZy6xmY\n\tugCNZ9VTcABmFDLYRnovebateFE7WFxHxzu5KMgPuQXe44JEzfzo0NYwWD3m62LGHx\n\tiuL3H0qBP2ObG0yXNDkTlRoZRTLhXjBfRftoSNQs=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251015012251.17508-17-bryan.odonoghue@linaro.org>","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>\n\t<20251015012251.17508-17-bryan.odonoghue@linaro.org>","Subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"hdegoede@redhat.com, mzamazal@redhat.com, bryan.odonoghue@linaro.org,\n\tbod.linux@nxsw.ie","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 15 Oct 2025 23:26:41 +0100","Message-ID":"<176056720167.162040.318635138677955191@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":36273,"web_url":"https://patchwork.libcamera.org/comment/36273/","msgid":"<f88b56bf-44a2-4806-ae7a-bd687fb759e6@linaro.org>","date":"2025-10-15T22:31:24","subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"content":"On 15/10/2025 23:26, Kieran Bingham wrote:\n>> -       debayer_->invokeMethod(&DebayerCpu::process,\n>> +       debayer_->invokeMethod(&Debayer::process,\n> Is this a separate change?\n\nThis should squash into the next patch and then the next patch should \nprecede this patch.\n\n---\nbod","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 9AF9EBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 22:31:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5059560638;\n\tThu, 16 Oct 2025 00:31:28 +0200 (CEST)","from mail-wm1-x336.google.com (mail-wm1-x336.google.com\n\t[IPv6:2a00:1450:4864:20::336])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5B8C7605F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 00:31:26 +0200 (CEST)","by mail-wm1-x336.google.com with SMTP id\n\t5b1f17b1804b1-4710a1f9e4cso710675e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Oct 2025 15:31:26 -0700 (PDT)","from [192.168.0.19] (188-141-3-146.dynamic.upc.ie. [188.141.3.146])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-46fb489af92sm352586625e9.17.2025.10.15.15.31.25\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 15 Oct 2025 15:31:25 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"L4g3fytG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1760567486; x=1761172286;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:in-reply-to:content-language:from\n\t:references:cc:to:subject:user-agent:mime-version:date:message-id\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=7rG59JUwnvF/tEBLSzwwVdE29PytWWPVETRxuXad1TY=;\n\tb=L4g3fytG4YBTxsbfMnzEDGwSidi+7xGQslShBjJt6dR08oFiXPVpB3ZR/l/0pu5LoZ\n\tJr6kYZwojHhDa4KyqB9eFdzNxOk7aIxjbFFOKIYj26hXrpJZeq1TQQR+SAoxtAjFH58L\n\tjeMpc8nUYwoy7NGcT/4t3vwk0WpVO9yz0QYwiJvWlvDcaW44L/SXvk2WeYiElZgRR6LZ\n\tFQjjTrHzeIL7B+MaiUKEAhrZR41BxgJMK3wg+g7ywMTUYs1qEdwqqhXA5GL8w9nxCt17\n\tX8M+9MtDEF+VD1Z3pIOcXLl++YlaJ6eFppSiEoAkcpy50F0t9NBCDuPy1SGfF1Q/77SC\n\tQPig==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1760567486; x=1761172286;\n\th=content-transfer-encoding:in-reply-to:content-language:from\n\t:references:cc:to:subject:user-agent:mime-version:date:message-id\n\t:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n\tbh=7rG59JUwnvF/tEBLSzwwVdE29PytWWPVETRxuXad1TY=;\n\tb=HjFWHAnLt6HmZ6yqAakBGcHJgtAVLOIpNAJMtsKq4aZ/ilJCCdZrXRyDtNpeRH3VjF\n\tFT1Hkqnt+dUQU6VKh+4ZamCZpqviGLkB8oJiAKc+9gQgS4T7MwDBjIIdzg+rDglfzR3q\n\tXP1LUiVqi+k1PFgVLEuYQDofloHkQsPvlVOhkKbwmEH//DH3qCJ9xhfz1i1hHyOJ0ae2\n\tK4R7LBFXo7F9MmglUq/A6EISTXlAYiwANr40Td3NEojigY5Rsd+dtLmyapIgaDM2oQP/\n\tw0t+GMazTpFBc5orDP46M0+hWl9WeA3bAA12V8DMOcWCRtuMOdUrMeDZCpR7IjpopAtc\n\tOdng==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCX8J4pInu3VaIvpGb90ZSf1KcuXb27JK9y7Ca97o+/tkh3WyFHHPuRQ0XYe7HfmB6ilYajMtMsQRJsXXy3PuhU=@lists.libcamera.org","X-Gm-Message-State":"AOJu0Ywq5ijl3dcQjlMIa8lbFpw2YexqfUVozyYc5LluCddQFldqGQVj\n\tXcq0HohLU22E0DykwhRW/PCD0xTvJJ+C62A9fo4n0ynxitQ39f5Tw1bDkCaIYtNX1SA=","X-Gm-Gg":"ASbGncsO2G8CkNrZrkCaLpCJBwAZNUXFR+NbOzjgyzWQX3pG/UigABMX6uXIXzO5Fpl\n\tY6yirR3Oj7lnFB/dm1x9Ec8hhMaJ2krxbbvMixLnQfXdDaf/3rZE2vsPsA9QYxjP94q1j5PCvUk\n\tWv4bLTe5bxTN0vlCCVdyihJSIGkslRITDHIIWx9PCG8jLP61W/k+RP28qJrqw6mTvpOJNpWZ3kG\n\tpI+7wU1KvQGcJZeF2ds9Bc1Gi+mgh2x5aBeKFi7FS0ZaXJnsZApSJ+IZx2DK9hSG4k5hBribkQe\n\tKVKrR+1931gF+2BIvz+/DVpbcd5hilUVEt5/8vgPJBv7llZwIY7QjH2UySpEjnoJorPAoYmhtET\n\tTtA+4FSNe4Vdig7A490G1jW9Zr7yZGrD1buUTh2Md1AtmRm+eFN/ikFDfV5+Ro3Wvzar4NZl8/x\n\tFb0VpTrXN14BxL1S/kkP482dcsXdZxIwsvk/ZEn5j4r1k7ijESvIJvZDvR","X-Google-Smtp-Source":"AGHT+IGVubjHA10LMHragz6Oul+14ehvJEt9D0L5+wMkzSlnxSesYx7+6yvrOSg4BHyKMl2zjqjYUg==","X-Received":"by 2002:a05:600c:8487:b0:45b:80ff:58f7 with SMTP id\n\t5b1f17b1804b1-46fa9b16570mr224953415e9.36.1760567485927; \n\tWed, 15 Oct 2025 15:31:25 -0700 (PDT)","Message-ID":"<f88b56bf-44a2-4806-ae7a-bd687fb759e6@linaro.org>","Date":"Wed, 15 Oct 2025 23:31:24 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"hdegoede@redhat.com, mzamazal@redhat.com, bod.linux@nxsw.ie","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>\n\t<20251015012251.17508-17-bryan.odonoghue@linaro.org>\n\t<176056720167.162040.318635138677955191@ping.linuxembedded.co.uk>","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Content-Language":"en-US","In-Reply-To":"<176056720167.162040.318635138677955191@ping.linuxembedded.co.uk>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":36274,"web_url":"https://patchwork.libcamera.org/comment/36274/","msgid":"<176056791797.635357.13814825923591385966@ping.linuxembedded.co.uk>","date":"2025-10-15T22:38:37","subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Bryan O'Donoghue (2025-10-15 23:31:24)\n> On 15/10/2025 23:26, Kieran Bingham wrote:\n> >> -       debayer_->invokeMethod(&DebayerCpu::process,\n> >> +       debayer_->invokeMethod(&Debayer::process,\n> > Is this a separate change?\n> \n> This should squash into the next patch and then the next patch should \n> precede this patch.\n\nAgreed on squash. I was about to suggest that too.\n\n> \n> ---\n> bod","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 35AB5C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 22:38:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 69BA360647;\n\tThu, 16 Oct 2025 00:38: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 000F2605F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 00:38:40 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 77CEA558;\n\tThu, 16 Oct 2025 00:37:01 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"EvEzvwze\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1760567821;\n\tbh=Qm6W/NOaL37s7DuXvIkMk5mnC3GusS/Ya9AbkYMS36Q=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=EvEzvwze8zjcdzapM1R2X3I2i0barV0Ogwth92Zfl/EcoiVFsIExyWcwR607vGvlj\n\tOlN/KMTPtMzi81ZMBOk72j6i7/5sEs28gdrMFqOk4xx9jRCQzsbR2Wqjj8TgKh9M9U\n\tepCbbgG9tO7yuTqMTKArXXUMMgNUEUbQKDIHThL8=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<f88b56bf-44a2-4806-ae7a-bd687fb759e6@linaro.org>","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>\n\t<20251015012251.17508-17-bryan.odonoghue@linaro.org>\n\t<176056720167.162040.318635138677955191@ping.linuxembedded.co.uk>\n\t<f88b56bf-44a2-4806-ae7a-bd687fb759e6@linaro.org>","Subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"hdegoede@redhat.com, mzamazal@redhat.com, bod.linux@nxsw.ie","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 15 Oct 2025 23:38:37 +0100","Message-ID":"<176056791797.635357.13814825923591385966@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":36275,"web_url":"https://patchwork.libcamera.org/comment/36275/","msgid":"<f54d992f-7d32-4ce4-a18a-16ff07f0eab6@linaro.org>","date":"2025-10-15T22:40:20","subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"content":"On 15/10/2025 23:26, Kieran Bingham wrote:\n>> +       ret = debayer_->invokeMethod(&Debayer::configure,\n>> +                                    ConnectionTypeBlocking, inputCfg,\n>> +                                    outputCfgs, ccmEnabled_);\n>> +       if (ret) {\n>> +               ispWorkerThread_.exit();\n>> +               ispWorkerThread_.wait();\n>> +       }\n> Again, I think having the thread always available when the object is\n> there is probably less overhead than starting and stopping the thread on\n> each configure cycle.\n> \n> I don't \"think\" threads are expensive...\n\nSo ... the point here is that all of this eGL/OpenGL stuff has no handle \nto the context.\n\nI've never looked at the code but, there is something like a handle that \ngets associated with the PID/TID that sets up the initial GL state.\n\nSo long as the constructor and destructor run in the same thead id - \ngettid(); then this will work, if not then this is not technically feasible.\n\nHoops must be jumped through because you can't get a pointer/handle to \nyour eGL context and pass that handle between threads.\n\nWhen we say Mesa/OpenGL/GLES isn't thread safe, its not that it has no \nsynchronisation primitives, its that the implicit handle - I really must \nlook into the code to speak about this more authoritatively - the \nimplicit handle can't be passed from one thread to another.\n\nTL;DR I get what you're saying nicer to start/stop in \nconstructor/destructor but I'm not sure what the impact on thread-id and \nhence implicit GL \"handles\" will be in the end.\n\nNeed to look further.\n\n---\nbod","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 BE4E2C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 22:40:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2DB926063D;\n\tThu, 16 Oct 2025 00:40:26 +0200 (CEST)","from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n\t[IPv6:2a00:1450:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 84C8D605F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 00:40:24 +0200 (CEST)","by mail-wr1-x436.google.com with SMTP id\n\tffacd0b85a97d-3f42b54d1b9so90054f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Oct 2025 15:40:24 -0700 (PDT)","from [192.168.0.19] (188-141-3-146.dynamic.upc.ie. [188.141.3.146])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-426ce5cfe74sm30813918f8f.35.2025.10.15.15.40.21\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 15 Oct 2025 15:40:22 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"x8o48O1m\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1760568024; x=1761172824;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:in-reply-to:content-language:from\n\t:references:cc:to:subject:user-agent:mime-version:date:message-id\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=FiSXBswaJg7y5uNN42HM1jz1Ft4fTOHDVyI3ehDyfTM=;\n\tb=x8o48O1m8C5CShJm2/8ttpdI760M31He6m1+I3L3sRIwbkIXcf6FUU4UYwY2GxQN1q\n\tPKgN+QPiI0+2RtnGqe3e7eFpFdPhxCck0DyShvibGkZLH6qepIqdCGC0BktnRtSoJC3P\n\tRF0we8LmzPAAqDImBsjGrp7zhKCNAMBtUqt4RTB+CtCi6JcP3UyU7G88Q2UP2tq8qEAd\n\tT6/wgpaVeSx5VufN11AHVYCBE6G4LfYB6y8eA+emM7rWK78Czbg07rb1HjMSB9c7ubh9\n\twShetGiHvgqPfX5+I8Zr5AR1GNzizApht/+GTUrR9bwmbQ00MJQ227bCoTiEcxrkY3dO\n\tB4yQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1760568024; x=1761172824;\n\th=content-transfer-encoding:in-reply-to:content-language:from\n\t:references:cc:to:subject:user-agent:mime-version:date:message-id\n\t:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n\tbh=FiSXBswaJg7y5uNN42HM1jz1Ft4fTOHDVyI3ehDyfTM=;\n\tb=uF8qF+f6/6vb95tNaWouEYkEhXGuJoo2mgo02I/ZeAFOAlITkrEvdwiR94BF/GluMJ\n\tG6GSIjx6379d1g6RAsjaFLxCyIWYstSjrfjPKOUQJ1MflUqpQtJu5LKyrkAmMFIOxTCO\n\taDrKNdV1JUorD6bU3BqrOLyN8vWPoCtKhKDFAUbwp3FiwwBdq6eB7oa08spknOnQPJcC\n\t3E37EB0EcNe/2BK6XPFk6x/FWtqCi0THUt1dEqdYl3NH3xCHa6dV6pL98jl+qGLlrdaZ\n\t8/LNTCHu4MKDBLnIbP3LlhCASXbsWreB8MfHYRalHlqdN0DST4nMofcwnf25ZbkCP+BN\n\tBNbQ==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCVlNxqh+H7VPHUlFX3np/1A22987UTqPS3UosmJj+XxVurJC/Z2FmYoOWZHpkzjxpWq8i/s54GXtpqkkEoy+Kw=@lists.libcamera.org","X-Gm-Message-State":"AOJu0YzxPrvD22CrqtRp401+LnhwVcG45l5vX9uqp5g7IuNR+307uW+W\n\tx67JB1Tfy/xTYL7EPyOR7hbL27duk6SvfMcmaHZNciFBJDL1O+SzPOSD9CmR7QPJbC0=","X-Gm-Gg":"ASbGncuPnli+4vjQLGdtpR7gwoXJDKePCZwA4M/unUW9AvRwrdqX1rJU3BmMdwAYEO6\n\t3RKR0HPO6JnE8o5NMGdhgpZ/Nl49Xny0pgU2bawZmcFiJLdD9KSi5SiURtAGZR78xYKu0eTSvbG\n\tYPGZEQ2h0C3rL3Ljv/U1fLwx3oymoRWKg7k63g7rWM+7I7HDSaR8rP+fakvpmD0sVGqJ1I/r/xw\n\tgJeiCL9XIaYSXtUdnq/pihqjW3h9NyhGySQqHCgREpK+mu0bJ9r0g0H8wAE5AgCIu3Z+aYdMnJ0\n\tZOJKbat5rWYDn350Kbr51BYwC6BmQl82uSK0DMSGmRUSMkeRZzvnCjylX9nhRcELMYG4Kd3Cqiv\n\tJiQYP5sVhpLgotL1nbf+L5m1dEqHmPVKFHMokSQFvxZi/j7dDsZ+wYuACcBWd/ieknQzHd16clJ\n\t7fx5gkPHIDFRg9MBdlx2FgS6YlDX1IIen97pz6icU9gOGuqGmolIAxLYjX","X-Google-Smtp-Source":"AGHT+IEJDXN0qYDR7HGawQBMtV7FLv7mxaXfGq0mJt3vZ22aAvNrBkmPGzMEOjcP24StUzZvLfe+nQ==","X-Received":"by 2002:a05:6000:420c:b0:3ea:ad2c:c166 with SMTP id\n\tffacd0b85a97d-4266e8dc04fmr20454588f8f.49.1760568023552; \n\tWed, 15 Oct 2025 15:40:23 -0700 (PDT)","Message-ID":"<f54d992f-7d32-4ce4-a18a-16ff07f0eab6@linaro.org>","Date":"Wed, 15 Oct 2025 23:40:20 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"hdegoede@redhat.com, mzamazal@redhat.com, bod.linux@nxsw.ie","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>\n\t<20251015012251.17508-17-bryan.odonoghue@linaro.org>\n\t<176056720167.162040.318635138677955191@ping.linuxembedded.co.uk>","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Content-Language":"en-US","In-Reply-To":"<176056720167.162040.318635138677955191@ping.linuxembedded.co.uk>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":36277,"web_url":"https://patchwork.libcamera.org/comment/36277/","msgid":"<176056830503.162040.2821725635602299879@ping.linuxembedded.co.uk>","date":"2025-10-15T22:45:05","subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Bryan O'Donoghue (2025-10-15 23:40:20)\n> On 15/10/2025 23:26, Kieran Bingham wrote:\n> >> +       ret = debayer_->invokeMethod(&Debayer::configure,\n> >> +                                    ConnectionTypeBlocking, inputCfg,\n> >> +                                    outputCfgs, ccmEnabled_);\n> >> +       if (ret) {\n> >> +               ispWorkerThread_.exit();\n> >> +               ispWorkerThread_.wait();\n> >> +       }\n> > Again, I think having the thread always available when the object is\n> > there is probably less overhead than starting and stopping the thread on\n> > each configure cycle.\n> > \n> > I don't \"think\" threads are expensive...\n> \n> So ... the point here is that all of this eGL/OpenGL stuff has no handle \n> to the context.\n> \n> I've never looked at the code but, there is something like a handle that \n> gets associated with the PID/TID that sets up the initial GL state.\n> \n> So long as the constructor and destructor run in the same thead id - \n> gettid(); then this will work, if not then this is not technically feasible.\n> \n\nBut aren't you pushing all the work to happen on the ispWorkerThread ?\nIsn't that the point ? \n\nMy only concern is around the lifetime of /that/ thread. I don't think\ncalling thread->start() and then calling thread->start() again is a good\nthing - and applications are free to call configure as many times as\nthey like before starting the camera.\n\n\n\n> Hoops must be jumped through because you can't get a pointer/handle to \n> your eGL context and pass that handle between threads.\n> \n> When we say Mesa/OpenGL/GLES isn't thread safe, its not that it has no \n> synchronisation primitives, its that the implicit handle - I really must \n> look into the code to speak about this more authoritatively - the \n> implicit handle can't be passed from one thread to another.\n> \n> TL;DR I get what you're saying nicer to start/stop in \n> constructor/destructor but I'm not sure what the impact on thread-id and \n> hence implicit GL \"handles\" will be in the end.\n\nAs far as I understand - you need to create a thread to do all the work\nin a single place. I would expect you can start that thread as early as\nyou like - and you can keep it around for as long as you think you might\nhave work to do regarding eGL ... and if you keep the thread as long as\nthe camera is constructed - I don't think that's a big expense ?\n\n> \n> Need to look further.\n> \n> ---\n> bod","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 739D2BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 22:45:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 81DE060640;\n\tThu, 16 Oct 2025 00:45:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DC445605F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 00:45:07 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4533B558;\n\tThu, 16 Oct 2025 00:43:28 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"JGCR7urv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1760568208;\n\tbh=eDQAdqxK6oodqotArlB1syBTpkNYCG54ydH0n8R2HlQ=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=JGCR7urvLpxPGIBlGMzxTNI5R6haLRNT3jICdBLUsKIWg3GxRwf59U1rPBBdvzSS3\n\tzLm87T65m+WOzuQk/9UbG/6pzqqn9SdcLAArIAinnZP4VgFYa6MjizH7QkcbUiOPqa\n\tu4ZbQIqY7oBNrj6ly3XqpQ1OmNsvO65oU/dvOo/0=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<f54d992f-7d32-4ce4-a18a-16ff07f0eab6@linaro.org>","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>\n\t<20251015012251.17508-17-bryan.odonoghue@linaro.org>\n\t<176056720167.162040.318635138677955191@ping.linuxembedded.co.uk>\n\t<f54d992f-7d32-4ce4-a18a-16ff07f0eab6@linaro.org>","Subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"hdegoede@redhat.com, mzamazal@redhat.com, bod.linux@nxsw.ie","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 15 Oct 2025 23:45:05 +0100","Message-ID":"<176056830503.162040.2821725635602299879@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":36319,"web_url":"https://patchwork.libcamera.org/comment/36319/","msgid":"<bbadb7a7-d240-4897-b63e-9561ca25a990@nxsw.ie>","date":"2025-10-16T15:37:07","subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","submitter":{"id":226,"url":"https://patchwork.libcamera.org/api/people/226/","name":"Bryan O'Donoghue","email":"bod.linux@nxsw.ie"},"content":"On 15/10/2025 23:45, Kieran Bingham wrote:\n>> TL;DR I get what you're saying nicer to start/stop in\n>> constructor/destructor but I'm not sure what the impact on thread-id and\n>> hence implicit GL \"handles\" will be in the end.\n> As far as I understand - you need to create a thread to do all the work\n> in a single place. I would expect you can start that thread as early as\n> you like - and you can keep it around for as long as you think you might\n> have work to do regarding eGL ... and if you keep the thread as long as\n> the camera is constructed - I don't think that's a big expense ?\n\nIn principle agreed.\n\nI can't actually think of why doing start in the constructor would be \nwrong or how it might affect the thread ownership as it should be the \nsame thread...\n\nNo, this _should_ work, agreed.\n\n---\nbod","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 27882BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 16 Oct 2025 15:37:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8A28660689;\n\tThu, 16 Oct 2025 17:37:13 +0200 (CEST)","from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4FE4F605D7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 17:37:12 +0200 (CEST)","from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby sea.source.kernel.org (Postfix) with ESMTP id 4CD0B40540;\n\tThu, 16 Oct 2025 15:37:10 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id E1F7FC4CEF1;\n\tThu, 16 Oct 2025 15:37:08 +0000 (UTC)"],"Message-ID":"<bbadb7a7-d240-4897-b63e-9561ca25a990@nxsw.ie>","Date":"Thu, 16 Oct 2025 16:37:07 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 16/39] libcamera: software_isp: Move configure to\n\tworker thread","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"hdegoede@redhat.com, mzamazal@redhat.com","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>\n\t<20251015012251.17508-17-bryan.odonoghue@linaro.org>\n\t<176056720167.162040.318635138677955191@ping.linuxembedded.co.uk>\n\t<f54d992f-7d32-4ce4-a18a-16ff07f0eab6@linaro.org>\n\t<Bp4W9Irs6ZRY_NTtX_cfZAWHx2xXvhLCSiLHS1tXm14E-SfYBd52PABSfPbRMPM3K-q7yGmhjJ2J9dj8ZYXqCw==@protonmail.internalid>\n\t<176056830503.162040.2821725635602299879@ping.linuxembedded.co.uk>","From":"Bryan O'Donoghue <bod.linux@nxsw.ie>","Content-Language":"en-US","In-Reply-To":"<176056830503.162040.2821725635602299879@ping.linuxembedded.co.uk>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]