[{"id":36068,"web_url":"https://patchwork.libcamera.org/comment/36068/","msgid":"<175933430075.756374.11522376619442542509@ping.linuxembedded.co.uk>","date":"2025-10-01T15:58:20","subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2025-09-29 08:47:06)\n> Debayering is carried out on `ispWorkerThread_`. When stopping, the queued\n> work needs to be flushed or cancelled to ensure that the next time it starts,\n> it won't process stale data. So remove all messages targeting the `Debayer`\n> object on the worker thread.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> ---\n>  src/libcamera/software_isp/software_isp.cpp | 1 +\n>  1 file changed, 1 insertion(+)\n> \n> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n> index b7651b7d2..fdadf79e1 100644\n> --- a/src/libcamera/software_isp/software_isp.cpp\n> +++ b/src/libcamera/software_isp/software_isp.cpp\n> @@ -358,6 +358,7 @@ void SoftwareIsp::stop()\n>  {\n>         ispWorkerThread_.exit();\n>         ispWorkerThread_.wait();\n> +       ispWorkerThread_.removeMessages(debayer_.get());\n\nAs the ispWorkerThread_ has just been asked to exit() shouldn't /all/\nmessages be dropped?\n\nShould we wrap a helper to the thread class that will \n - Exit the thread\n - Block until it's stopped\n - Remove all messages ?\n\nThat seems like a common 'requirement' for a thread that could be\nrestarted perhaps ?\n\n\n\n>  \n>         Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);\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 6A02BC328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 Oct 2025 15:58:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 54FD16B5AA;\n\tWed,  1 Oct 2025 17:58:25 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DCE846B58E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 Oct 2025 17:58:23 +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 83D5B316;\n\tWed,  1 Oct 2025 17:56:54 +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=\"erwMvkzc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759334214;\n\tbh=KiaqzhXBzWPuvvgIu2XSY7lzT7f52VRioPnNFF2TShs=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=erwMvkzcITvz/vpaCfLik0krbB0J6RIdnSU68RD2kXH6lHl1kweUjVFGHuQZYKOpL\n\txJC8vepjYokoYgGjmx29pHTlCtUajaXGTXQNlHM/QfxOfAABHLEuL3R5nMil3HiBA/\n\t+nLEauzGNEyLfFKeAyDBJFbFNVKBF8Fi1BuPkX18=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250929074706.420894-1-barnabas.pocze@ideasonboard.com>","References":"<20250929074706.420894-1-barnabas.pocze@ideasonboard.com>","Subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 01 Oct 2025 16:58:20 +0100","Message-ID":"<175933430075.756374.11522376619442542509@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":36069,"web_url":"https://patchwork.libcamera.org/comment/36069/","msgid":"<cc783357-86be-4f4f-9086-cb9aef3f7ddf@ideasonboard.com>","date":"2025-10-02T08:11:28","subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2025. 10. 01. 17:58 keltezéssel, Kieran Bingham írta:\n> Quoting Barnabás Pőcze (2025-09-29 08:47:06)\n>> Debayering is carried out on `ispWorkerThread_`. When stopping, the queued\n>> work needs to be flushed or cancelled to ensure that the next time it starts,\n>> it won't process stale data. So remove all messages targeting the `Debayer`\n>> object on the worker thread.\n>>\n>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n>> ---\n>>   src/libcamera/software_isp/software_isp.cpp | 1 +\n>>   1 file changed, 1 insertion(+)\n>>\n>> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n>> index b7651b7d2..fdadf79e1 100644\n>> --- a/src/libcamera/software_isp/software_isp.cpp\n>> +++ b/src/libcamera/software_isp/software_isp.cpp\n>> @@ -358,6 +358,7 @@ void SoftwareIsp::stop()\n>>   {\n>>          ispWorkerThread_.exit();\n>>          ispWorkerThread_.wait();\n>> +       ispWorkerThread_.removeMessages(debayer_.get());\n> \n> As the ispWorkerThread_ has just been asked to exit() shouldn't /all/\n> messages be dropped?\n\nI believe there is only the debayer object that lives on that thread and\nreceives messages.\n\n\n> \n> Should we wrap a helper to the thread class that will\n>   - Exit the thread\n>   - Block until it's stopped\n>   - Remove all messages ?\n> \n> That seems like a common 'requirement' for a thread that could be\n> restarted perhaps ?\n\nI'm not sure. I would think it depends on the exact setup and the objects\nin question. And also one usually has to do two things: clear/flush the\nmessages on the thread, and then clear/flush all signals that came from\nthat thread.\n\nAnd as far as I can tell, this change will be superseded by the introduction of\ngpu debayering because that introduces a blocking \"stop()\" call which will flush\nall messages.\n\n\nRegards,\nBarnabás Pőcze\n\n> \n> \n> \n>>   \n>>          Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);\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 09A34C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Oct 2025 08:11:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A24EC6B5AA;\n\tThu,  2 Oct 2025 10:11:34 +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 52496613AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Oct 2025 10:11:32 +0200 (CEST)","from [192.168.33.12] (185.221.142.146.nat.pool.zt.hu\n\t[185.221.142.146])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C18C017D8;\n\tThu,  2 Oct 2025 10:10:02 +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=\"YfYnErVd\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759392602;\n\tbh=hYXcyOpoXMIKL65XwnLBu2I1oISxddzUCD3O54ZnS0Y=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=YfYnErVd88A/fCWey2d5zgg9wthxpNsE0OWQ5mE/Y6RhxxqFrwPNSWrvXj6P0rsdK\n\tLe3D2aiUGFbjpW8jVICHTdL9wOudduFR2+tOfq6siV8eSc/FGP/wdyZXjLQQ74m2Wl\n\tDDtw0UqBnUbhxgFDBlMfNXyz7JDAG26Sfaj57Th8=","Message-ID":"<cc783357-86be-4f4f-9086-cb9aef3f7ddf@ideasonboard.com>","Date":"Thu, 2 Oct 2025 10:11:28 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20250929074706.420894-1-barnabas.pocze@ideasonboard.com>\n\t<175933430075.756374.11522376619442542509@ping.linuxembedded.co.uk>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<175933430075.756374.11522376619442542509@ping.linuxembedded.co.uk>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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":36071,"web_url":"https://patchwork.libcamera.org/comment/36071/","msgid":"<175939732638.1246375.3721888721897164047@ping.linuxembedded.co.uk>","date":"2025-10-02T09:28:46","subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2025-10-02 09:11:28)\n> Hi\n> \n> 2025. 10. 01. 17:58 keltezéssel, Kieran Bingham írta:\n> > Quoting Barnabás Pőcze (2025-09-29 08:47:06)\n> >> Debayering is carried out on `ispWorkerThread_`. When stopping, the queued\n> >> work needs to be flushed or cancelled to ensure that the next time it starts,\n> >> it won't process stale data. So remove all messages targeting the `Debayer`\n> >> object on the worker thread.\n> >>\n> >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> >> ---\n> >>   src/libcamera/software_isp/software_isp.cpp | 1 +\n> >>   1 file changed, 1 insertion(+)\n> >>\n> >> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n> >> index b7651b7d2..fdadf79e1 100644\n> >> --- a/src/libcamera/software_isp/software_isp.cpp\n> >> +++ b/src/libcamera/software_isp/software_isp.cpp\n> >> @@ -358,6 +358,7 @@ void SoftwareIsp::stop()\n> >>   {\n> >>          ispWorkerThread_.exit();\n> >>          ispWorkerThread_.wait();\n> >> +       ispWorkerThread_.removeMessages(debayer_.get());\n> > \n> > As the ispWorkerThread_ has just been asked to exit() shouldn't /all/\n> > messages be dropped?\n> \n> I believe there is only the debayer object that lives on that thread and\n> receives messages.\n> \n> \n> > \n> > Should we wrap a helper to the thread class that will\n> >   - Exit the thread\n> >   - Block until it's stopped\n> >   - Remove all messages ?\n> > \n> > That seems like a common 'requirement' for a thread that could be\n> > restarted perhaps ?\n> \n> I'm not sure. I would think it depends on the exact setup and the objects\n> in question. And also one usually has to do two things: clear/flush the\n> messages on the thread, and then clear/flush all signals that came from\n> that thread.\n> \n> And as far as I can tell, this change will be superseded by the introduction of\n> gpu debayering because that introduces a blocking \"stop()\" call which will flush\n> all messages.\n\n\nI see. Do you still want to merge this patch ? If so I'm fine with it.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> \n> Regards,\n> Barnabás Pőcze\n> \n> > \n> > \n> > \n> >>   \n> >>          Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);\n> >>   \n> >> -- \n> >> 2.51.0\n> >>\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 DD3C4C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Oct 2025 09:28:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B2D4C6B5AA;\n\tThu,  2 Oct 2025 11:28:51 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BCCFC613AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Oct 2025 11:28:49 +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 260BD122A;\n\tThu,  2 Oct 2025 11:27:20 +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=\"nt3wK/8G\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759397240;\n\tbh=/YMqT6kVkTE4dHlWvAShNEXeeHuax946Nlh7OcI5f/M=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=nt3wK/8Gj9fP4lKQ1FZpoDP1tePmMsfo22dV+rmfr/6BSTfe9Z3yjnZxGh874selM\n\tveLrnLyJNH7ZiwcGhEThwF126llMnB4TJLyjDUKtH1eJ7REXdg65R6tke9xOlJQ70u\n\t7OzLl/BUM9Nhy7WUN8SaGQlW1AWdjjNxZf22iNws=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<cc783357-86be-4f4f-9086-cb9aef3f7ddf@ideasonboard.com>","References":"<20250929074706.420894-1-barnabas.pocze@ideasonboard.com>\n\t<175933430075.756374.11522376619442542509@ping.linuxembedded.co.uk>\n\t<cc783357-86be-4f4f-9086-cb9aef3f7ddf@ideasonboard.com>","Subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 02 Oct 2025 10:28:46 +0100","Message-ID":"<175939732638.1246375.3721888721897164047@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":36073,"web_url":"https://patchwork.libcamera.org/comment/36073/","msgid":"<83b5afab-1629-4f42-9e15-5df714c4bf34@ideasonboard.com>","date":"2025-10-02T09:45:41","subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2025. 10. 02. 11:28 keltezéssel, Kieran Bingham írta:\n> Quoting Barnabás Pőcze (2025-10-02 09:11:28)\n>> Hi\n>>\n>> 2025. 10. 01. 17:58 keltezéssel, Kieran Bingham írta:\n>>> Quoting Barnabás Pőcze (2025-09-29 08:47:06)\n>>>> Debayering is carried out on `ispWorkerThread_`. When stopping, the queued\n>>>> work needs to be flushed or cancelled to ensure that the next time it starts,\n>>>> it won't process stale data. So remove all messages targeting the `Debayer`\n>>>> object on the worker thread.\n>>>>\n>>>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n>>>> ---\n>>>>    src/libcamera/software_isp/software_isp.cpp | 1 +\n>>>>    1 file changed, 1 insertion(+)\n>>>>\n>>>> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n>>>> index b7651b7d2..fdadf79e1 100644\n>>>> --- a/src/libcamera/software_isp/software_isp.cpp\n>>>> +++ b/src/libcamera/software_isp/software_isp.cpp\n>>>> @@ -358,6 +358,7 @@ void SoftwareIsp::stop()\n>>>>    {\n>>>>           ispWorkerThread_.exit();\n>>>>           ispWorkerThread_.wait();\n>>>> +       ispWorkerThread_.removeMessages(debayer_.get());\n>>>\n>>> As the ispWorkerThread_ has just been asked to exit() shouldn't /all/\n>>> messages be dropped?\n>>\n>> I believe there is only the debayer object that lives on that thread and\n>> receives messages.\n>>\n>>\n>>>\n>>> Should we wrap a helper to the thread class that will\n>>>    - Exit the thread\n>>>    - Block until it's stopped\n>>>    - Remove all messages ?\n>>>\n>>> That seems like a common 'requirement' for a thread that could be\n>>> restarted perhaps ?\n>>\n>> I'm not sure. I would think it depends on the exact setup and the objects\n>> in question. And also one usually has to do two things: clear/flush the\n>> messages on the thread, and then clear/flush all signals that came from\n>> that thread.\n>>\n>> And as far as I can tell, this change will be superseded by the introduction of\n>> gpu debayering because that introduces a blocking \"stop()\" call which will flush\n>> all messages.\n> \n> \n> I see. Do you still want to merge this patch ? If so I'm fine with it.\n\nYes.\n\n\n> \n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n>>\n>>\n>> Regards,\n>> Barnabás Pőcze\n>>\n>>>\n>>>\n>>>\n>>>>\n>>>>           Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);\n>>>>\n>>>> --\n>>>> 2.51.0\n>>>>\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 6D1EAC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Oct 2025 09:45:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6C0FE6B5F3;\n\tThu,  2 Oct 2025 11:45: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 99DCD613AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Oct 2025 11:45:44 +0200 (CEST)","from [192.168.33.12] (185.221.142.146.nat.pool.zt.hu\n\t[185.221.142.146])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BBEEFE01;\n\tThu,  2 Oct 2025 11:44:14 +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=\"kwebzs7z\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759398255;\n\tbh=+YfoGozGY3edDlbvvRThSJD0Eq5NX1SBhjPJQRhbXYM=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=kwebzs7z838KncmLOtItta8bw4Pby/hq82XxnzJngNW0+nt3tpW06pk2a3u7pydz+\n\tQGj4k/of6NpkB60mVjaSpHToK5jdURt2dASByPglPFKclTaS+5XC42brjZoAr8sfAO\n\tBiujTPwzJD7hUEzt9GKAc4YLhoCwAaJramo22vZo=","Message-ID":"<83b5afab-1629-4f42-9e15-5df714c4bf34@ideasonboard.com>","Date":"Thu, 2 Oct 2025 11:45:41 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20250929074706.420894-1-barnabas.pocze@ideasonboard.com>\n\t<175933430075.756374.11522376619442542509@ping.linuxembedded.co.uk>\n\t<cc783357-86be-4f4f-9086-cb9aef3f7ddf@ideasonboard.com>\n\t<JkjyhrJ811kRohWTWbvNHOzH43D-mc7nSHqDxFwarJMYC2gk6Pr3voNogvI-K8LXd4vcKI4IJ7KjG9BFN0Z-nw==@protonmail.internalid>\n\t<175939732638.1246375.3721888721897164047@ping.linuxembedded.co.uk>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<175939732638.1246375.3721888721897164047@ping.linuxembedded.co.uk>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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":36215,"web_url":"https://patchwork.libcamera.org/comment/36215/","msgid":"<176034920856.756374.5377278068383767322@ping.linuxembedded.co.uk>","date":"2025-10-13T09:53:28","subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi all,\n\nDoes anyone else have any comments or thoughts on this patch?\n\nBarnabás tells me he'd like it in the 0.6 release ....\n\nAny blockers to merging ?\n\n\n\nQuoting Barnabás Pőcze (2025-10-02 10:45:41)\n> 2025. 10. 02. 11:28 keltezéssel, Kieran Bingham írta:\n> > Quoting Barnabás Pőcze (2025-10-02 09:11:28)\n> >> Hi\n> >>\n> >> 2025. 10. 01. 17:58 keltezéssel, Kieran Bingham írta:\n> >>> Quoting Barnabás Pőcze (2025-09-29 08:47:06)\n> >>>> Debayering is carried out on `ispWorkerThread_`. When stopping, the queued\n> >>>> work needs to be flushed or cancelled to ensure that the next time it starts,\n> >>>> it won't process stale data. So remove all messages targeting the `Debayer`\n> >>>> object on the worker thread.\n> >>>>\n> >>>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> >>>> ---\n> >>>>    src/libcamera/software_isp/software_isp.cpp | 1 +\n> >>>>    1 file changed, 1 insertion(+)\n> >>>>\n> >>>> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n> >>>> index b7651b7d2..fdadf79e1 100644\n> >>>> --- a/src/libcamera/software_isp/software_isp.cpp\n> >>>> +++ b/src/libcamera/software_isp/software_isp.cpp\n> >>>> @@ -358,6 +358,7 @@ void SoftwareIsp::stop()\n> >>>>    {\n> >>>>           ispWorkerThread_.exit();\n> >>>>           ispWorkerThread_.wait();\n> >>>> +       ispWorkerThread_.removeMessages(debayer_.get());\n> >>>\n> >>> As the ispWorkerThread_ has just been asked to exit() shouldn't /all/\n> >>> messages be dropped?\n> >>\n> >> I believe there is only the debayer object that lives on that thread and\n> >> receives messages.\n> >>\n> >>\n> >>>\n> >>> Should we wrap a helper to the thread class that will\n> >>>    - Exit the thread\n> >>>    - Block until it's stopped\n> >>>    - Remove all messages ?\n> >>>\n> >>> That seems like a common 'requirement' for a thread that could be\n> >>> restarted perhaps ?\n> >>\n> >> I'm not sure. I would think it depends on the exact setup and the objects\n> >> in question. And also one usually has to do two things: clear/flush the\n> >> messages on the thread, and then clear/flush all signals that came from\n> >> that thread.\n> >>\n> >> And as far as I can tell, this change will be superseded by the introduction of\n> >> gpu debayering because that introduces a blocking \"stop()\" call which will flush\n> >> all messages.\n> > \n> > \n> > I see. Do you still want to merge this patch ? If so I'm fine with it.\n> \n> Yes.\n> \n> \n> > \n> > \n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > \n> >>\n> >>\n> >> Regards,\n> >> Barnabás Pőcze\n> >>\n> >>>\n> >>>\n> >>>\n> >>>>\n> >>>>           Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);\n> >>>>\n> >>>> --\n> >>>> 2.51.0\n> >>>>\n> >>\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 31781BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Oct 2025 09:53:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D6ADD6046E;\n\tMon, 13 Oct 2025 11:53:32 +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 5853B60317\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Oct 2025 11:53:31 +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 ABA33FE;\n\tMon, 13 Oct 2025 11:51:53 +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=\"qKuVQPkw\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1760349113;\n\tbh=XuQdJAfGWGeLaUtlSOixir4L9h0EAV+iz0Dfl53KQiE=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=qKuVQPkwq2OMzBNiskct2+nQ/JkaDuIcHPgwr4zKoMLQ+b9uxgsrrgvaZ6OX9ThK2\n\tp7CGOJ5nEO2b6cVHOsheW06bYqQZ2EvkhuZG9fxLp+liYeovRDWsRrWyr75QrwJh7T\n\tz/XDcB21OwjoTSMlIzJzZY4y5i1Qq5RxnDRa5gzo=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<83b5afab-1629-4f42-9e15-5df714c4bf34@ideasonboard.com>","References":"<20250929074706.420894-1-barnabas.pocze@ideasonboard.com>\n\t<175933430075.756374.11522376619442542509@ping.linuxembedded.co.uk>\n\t<cc783357-86be-4f4f-9086-cb9aef3f7ddf@ideasonboard.com>\n\t<JkjyhrJ811kRohWTWbvNHOzH43D-mc7nSHqDxFwarJMYC2gk6Pr3voNogvI-K8LXd4vcKI4IJ7KjG9BFN0Z-nw==@protonmail.internalid>\n\t<175939732638.1246375.3721888721897164047@ping.linuxembedded.co.uk>\n\t<83b5afab-1629-4f42-9e15-5df714c4bf34@ideasonboard.com>","Subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org,\n\tMilan Zamazal <mzamazal@redhat.com>, Robert Mader\n\t<robert.mader@collabora.com>, Hans de Goede <hansg@kernel.org>,","Date":"Mon, 13 Oct 2025 10:53:28 +0100","Message-ID":"<176034920856.756374.5377278068383767322@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":36218,"web_url":"https://patchwork.libcamera.org/comment/36218/","msgid":"<f45f7c4b-990b-4de6-8609-31230f50cc77@collabora.com>","date":"2025-10-13T10:40:41","subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"On 10/13/25 11:53, Kieran Bingham wrote:\n> Hi all,\n>\n> Does anyone else have any comments or thoughts on this patch?\n>\n> Barnabás tells me he'd like it in the 0.6 release ....\n>\n> Any blockers to merging ?\n\nQuickly tested it on two devices with swISP and didn't spot any regressions.\n\nAnd from what I can see it would be good to have in 0.6 until a blocking \nstop call gets introduced, so thumbsup from my side.\n\n> Quoting Barnabás Pőcze (2025-10-02 10:45:41)\n>> 2025. 10. 02. 11:28 keltezéssel, Kieran Bingham írta:\n>>> Quoting Barnabás Pőcze (2025-10-02 09:11:28)\n>>>> Hi\n>>>>\n>>>> 2025. 10. 01. 17:58 keltezéssel, Kieran Bingham írta:\n>>>>> Quoting Barnabás Pőcze (2025-09-29 08:47:06)\n>>>>>> Debayering is carried out on `ispWorkerThread_`. When stopping, the queued\n>>>>>> work needs to be flushed or cancelled to ensure that the next time it starts,\n>>>>>> it won't process stale data. So remove all messages targeting the `Debayer`\n>>>>>> object on the worker thread.\n>>>>>>\n>>>>>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n>>>>>> ---\n>>>>>>     src/libcamera/software_isp/software_isp.cpp | 1 +\n>>>>>>     1 file changed, 1 insertion(+)\n>>>>>>\n>>>>>> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n>>>>>> index b7651b7d2..fdadf79e1 100644\n>>>>>> --- a/src/libcamera/software_isp/software_isp.cpp\n>>>>>> +++ b/src/libcamera/software_isp/software_isp.cpp\n>>>>>> @@ -358,6 +358,7 @@ void SoftwareIsp::stop()\n>>>>>>     {\n>>>>>>            ispWorkerThread_.exit();\n>>>>>>            ispWorkerThread_.wait();\n>>>>>> +       ispWorkerThread_.removeMessages(debayer_.get());\n>>>>> As the ispWorkerThread_ has just been asked to exit() shouldn't /all/\n>>>>> messages be dropped?\n>>>> I believe there is only the debayer object that lives on that thread and\n>>>> receives messages.\n>>>>\n>>>>\n>>>>> Should we wrap a helper to the thread class that will\n>>>>>     - Exit the thread\n>>>>>     - Block until it's stopped\n>>>>>     - Remove all messages ?\n>>>>>\n>>>>> That seems like a common 'requirement' for a thread that could be\n>>>>> restarted perhaps ?\n>>>> I'm not sure. I would think it depends on the exact setup and the objects\n>>>> in question. And also one usually has to do two things: clear/flush the\n>>>> messages on the thread, and then clear/flush all signals that came from\n>>>> that thread.\n>>>>\n>>>> And as far as I can tell, this change will be superseded by the introduction of\n>>>> gpu debayering because that introduces a blocking \"stop()\" call which will flush\n>>>> all messages.\n>>>\n>>> I see. Do you still want to merge this patch ? If so I'm fine with it.\n>> Yes.\n>>\n>>\n>>>\n>>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>>\n>>>>\n>>>> Regards,\n>>>> Barnabás Pőcze\n>>>>\n>>>>>\n>>>>>\n>>>>>>            Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);\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 A16C3BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Oct 2025 10:40:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 00B9160468;\n\tMon, 13 Oct 2025 12:40:53 +0200 (CEST)","from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com\n\t[136.143.188.112])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 42CC76031A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Oct 2025 12:40:51 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1760352046695185.53772737295412; \n\tMon, 13 Oct 2025 03:40:46 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"iC8DZ5hn\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1760352049; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=MkWlOG7FAN8mCT9m1GBxsPSYtjlWMPc1ZtzhkYo9VYvqR6rYiv4+EFCDtviGqHfMmd+dZnHyxtMjk9wz/+LQH4tV6E7JoHxufJ/FYPSjDdv5MXtHALtUbI7YCA32uZex2MITfWBe4nrhSMPMNmFMFm0sD4CPwov8OfSh4TBC14E=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1760352049;\n\th=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=s+ukk4kxsFOk3Dh6wYtbgAUEW65l6Il+av3Q6MUivPs=; \n\tb=Xu+H+kteXQ6ZmOj3DyJceyXs0iKvo7cCIiCcyfR6pL3/FZytb+d+CGVKdbb2jedmSTdfE4krH3VwkJ4bMjkxFY9wFHSZ1qdLnKN2kSJ+4JfE535WERyXBGsvWF0MQws26MOfRPkIIASdgbVrMsTD1Trcu6WOlilx4o6K8ywxzsc=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1760352048;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc;\n\tbh=s+ukk4kxsFOk3Dh6wYtbgAUEW65l6Il+av3Q6MUivPs=;\n\tb=iC8DZ5hnVn7+RWDaE9fU7iGQLOK/KWEeO4cKxDHxVjyi+EB4QkDo9n6vi3OaRbGr\n\tSJQBqQ7rCrsh2eFMv97owcEUn02Y+8+Am3irh/mBouodvUxnegMVfuML1FB/dkhnqn7\n\tySe190jDWwq4NDPbp/Gfe99uiafeNaEO1oUGniCk=","Message-ID":"<f45f7c4b-990b-4de6-8609-31230f50cc77@collabora.com>","Date":"Mon, 13 Oct 2025 12:40:41 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>, =?utf-8?q?Barnab?=\n\t=?utf-8?b?w6FzIFDFkWN6ZQ==?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org,\n\tMilan Zamazal <mzamazal@redhat.com>,  Hans de Goede <hansg@kernel.org>","References":"<20250929074706.420894-1-barnabas.pocze@ideasonboard.com>\n\t<175933430075.756374.11522376619442542509@ping.linuxembedded.co.uk>\n\t<cc783357-86be-4f4f-9086-cb9aef3f7ddf@ideasonboard.com>\n\t<JkjyhrJ811kRohWTWbvNHOzH43D-mc7nSHqDxFwarJMYC2gk6Pr3voNogvI-K8LXd4vcKI4IJ7KjG9BFN0Z-nw==@protonmail.internalid>\n\t<175939732638.1246375.3721888721897164047@ping.linuxembedded.co.uk>\n\t<83b5afab-1629-4f42-9e15-5df714c4bf34@ideasonboard.com>\n\t<176034920856.756374.5377278068383767322@ping.linuxembedded.co.uk>","Content-Language":"en-US, de-DE","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<176034920856.756374.5377278068383767322@ping.linuxembedded.co.uk>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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":36219,"web_url":"https://patchwork.libcamera.org/comment/36219/","msgid":"<176035310889.935713.15722245797395943247@ping.linuxembedded.co.uk>","date":"2025-10-13T10:58:28","subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Robert Mader (2025-10-13 11:40:41)\n> On 10/13/25 11:53, Kieran Bingham wrote:\n> > Hi all,\n> >\n> > Does anyone else have any comments or thoughts on this patch?\n> >\n> > Barnabás tells me he'd like it in the 0.6 release ....\n> >\n> > Any blockers to merging ?\n> \n> Quickly tested it on two devices with swISP and didn't spot any regressions.\n\nCan we turn that into a \n\nTested-by ... ?\n\n\n\n> \n> And from what I can see it would be good to have in 0.6 until a blocking \n> stop call gets introduced, so thumbsup from my side.\n> \n> > Quoting Barnabás Pőcze (2025-10-02 10:45:41)\n> >> 2025. 10. 02. 11:28 keltezéssel, Kieran Bingham írta:\n> >>> Quoting Barnabás Pőcze (2025-10-02 09:11:28)\n> >>>> Hi\n> >>>>\n> >>>> 2025. 10. 01. 17:58 keltezéssel, Kieran Bingham írta:\n> >>>>> Quoting Barnabás Pőcze (2025-09-29 08:47:06)\n> >>>>>> Debayering is carried out on `ispWorkerThread_`. When stopping, the queued\n> >>>>>> work needs to be flushed or cancelled to ensure that the next time it starts,\n> >>>>>> it won't process stale data. So remove all messages targeting the `Debayer`\n> >>>>>> object on the worker thread.\n> >>>>>>\n> >>>>>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> >>>>>> ---\n> >>>>>>     src/libcamera/software_isp/software_isp.cpp | 1 +\n> >>>>>>     1 file changed, 1 insertion(+)\n> >>>>>>\n> >>>>>> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n> >>>>>> index b7651b7d2..fdadf79e1 100644\n> >>>>>> --- a/src/libcamera/software_isp/software_isp.cpp\n> >>>>>> +++ b/src/libcamera/software_isp/software_isp.cpp\n> >>>>>> @@ -358,6 +358,7 @@ void SoftwareIsp::stop()\n> >>>>>>     {\n> >>>>>>            ispWorkerThread_.exit();\n> >>>>>>            ispWorkerThread_.wait();\n> >>>>>> +       ispWorkerThread_.removeMessages(debayer_.get());\n> >>>>> As the ispWorkerThread_ has just been asked to exit() shouldn't /all/\n> >>>>> messages be dropped?\n> >>>> I believe there is only the debayer object that lives on that thread and\n> >>>> receives messages.\n> >>>>\n> >>>>\n> >>>>> Should we wrap a helper to the thread class that will\n> >>>>>     - Exit the thread\n> >>>>>     - Block until it's stopped\n> >>>>>     - Remove all messages ?\n> >>>>>\n> >>>>> That seems like a common 'requirement' for a thread that could be\n> >>>>> restarted perhaps ?\n> >>>> I'm not sure. I would think it depends on the exact setup and the objects\n> >>>> in question. And also one usually has to do two things: clear/flush the\n> >>>> messages on the thread, and then clear/flush all signals that came from\n> >>>> that thread.\n> >>>>\n> >>>> And as far as I can tell, this change will be superseded by the introduction of\n> >>>> gpu debayering because that introduces a blocking \"stop()\" call which will flush\n> >>>> all messages.\n> >>>\n> >>> I see. Do you still want to merge this patch ? If so I'm fine with it.\n> >> Yes.\n> >>\n> >>\n> >>>\n> >>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >>>\n> >>>>\n> >>>> Regards,\n> >>>> Barnabás Pőcze\n> >>>>\n> >>>>>\n> >>>>>\n> >>>>>>            Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);\n> >>>>>>\n> >>>>>> --\n> >>>>>> 2.51.0\n> >>>>>>\n> -- \n> Robert Mader\n> Consultant Software Developer\n> \n> Collabora Ltd.\n> Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK\n> Registered in England & Wales, no. 5513718\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 CFDABBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Oct 2025 10:58:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BA4A660469;\n\tMon, 13 Oct 2025 12:58:35 +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 0FEDA6031A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Oct 2025 12:58:34 +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 D128B6F9;\n\tMon, 13 Oct 2025 12:56:55 +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=\"dpxTmvb0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1760353016;\n\tbh=WomU7F0Q6MCCoOfhLogR/icekTjgkWI1T3bFJMgrqrc=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=dpxTmvb09lx30Y33+RrE8wxBzNzWf9F7wE11XoBbnkzpGa8auTJf3+Ma5dzZaOQU3\n\t+Y5sZajY62CABrnrBhQYxQhcksNvsobHV2sYwm2vCoeeHocMM05ZmSRPSz0NY+Ko3c\n\tpl+aat80uQV1J18L6tmHOtEiOP6u6ESTIrXz75U4=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<f45f7c4b-990b-4de6-8609-31230f50cc77@collabora.com>","References":"<20250929074706.420894-1-barnabas.pocze@ideasonboard.com>\n\t<175933430075.756374.11522376619442542509@ping.linuxembedded.co.uk>\n\t<cc783357-86be-4f4f-9086-cb9aef3f7ddf@ideasonboard.com>\n\t<JkjyhrJ811kRohWTWbvNHOzH43D-mc7nSHqDxFwarJMYC2gk6Pr3voNogvI-K8LXd4vcKI4IJ7KjG9BFN0Z-nw==@protonmail.internalid>\n\t<175939732638.1246375.3721888721897164047@ping.linuxembedded.co.uk>\n\t<83b5afab-1629-4f42-9e15-5df714c4bf34@ideasonboard.com>\n\t<176034920856.756374.5377278068383767322@ping.linuxembedded.co.uk>\n\t<f45f7c4b-990b-4de6-8609-31230f50cc77@collabora.com>","Subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tHans de Goede <hansg@kernel.org>, Milan Zamazal <mzamazal@redhat.com>, \n\tRobert Mader <robert.mader@collabora.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 13 Oct 2025 11:58:28 +0100","Message-ID":"<176035310889.935713.15722245797395943247@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":36220,"web_url":"https://patchwork.libcamera.org/comment/36220/","msgid":"<308d3919-c623-42f0-ad09-61317baeeb37@collabora.com>","date":"2025-10-13T11:01:02","subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"On 10/13/25 12:58, Kieran Bingham wrote:\n> Quoting Robert Mader (2025-10-13 11:40:41)\n>> On 10/13/25 11:53, Kieran Bingham wrote:\n>>> Hi all,\n>>>\n>>> Does anyone else have any comments or thoughts on this patch?\n>>>\n>>> Barnabás tells me he'd like it in the 0.6 release ....\n>>>\n>>> Any blockers to merging ?\n>> Quickly tested it on two devices with swISP and didn't spot any regressions.\n> Can we turn that into a\n>\n> Tested-by ... ?\n\nNot super throughout, but yes:\n\nTested-by: Robert Mader<robert.mader@collabora.com>\n\n>> And from what I can see it would be good to have in 0.6 until a blocking\n>> stop call gets introduced, so thumbsup from my side.\n>>\n>>> Quoting Barnabás Pőcze (2025-10-02 10:45:41)\n>>>> 2025. 10. 02. 11:28 keltezéssel, Kieran Bingham írta:\n>>>>> Quoting Barnabás Pőcze (2025-10-02 09:11:28)\n>>>>>> Hi\n>>>>>>\n>>>>>> 2025. 10. 01. 17:58 keltezéssel, Kieran Bingham írta:\n>>>>>>> Quoting Barnabás Pőcze (2025-09-29 08:47:06)\n>>>>>>>> Debayering is carried out on `ispWorkerThread_`. When stopping, the queued\n>>>>>>>> work needs to be flushed or cancelled to ensure that the next time it starts,\n>>>>>>>> it won't process stale data. So remove all messages targeting the `Debayer`\n>>>>>>>> object on the worker thread.\n>>>>>>>>\n>>>>>>>> Signed-off-by: Barnabás Pőcze<barnabas.pocze@ideasonboard.com>\n>>>>>>>> ---\n>>>>>>>>      src/libcamera/software_isp/software_isp.cpp | 1 +\n>>>>>>>>      1 file changed, 1 insertion(+)\n>>>>>>>>\n>>>>>>>> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n>>>>>>>> index b7651b7d2..fdadf79e1 100644\n>>>>>>>> --- a/src/libcamera/software_isp/software_isp.cpp\n>>>>>>>> +++ b/src/libcamera/software_isp/software_isp.cpp\n>>>>>>>> @@ -358,6 +358,7 @@ void SoftwareIsp::stop()\n>>>>>>>>      {\n>>>>>>>>             ispWorkerThread_.exit();\n>>>>>>>>             ispWorkerThread_.wait();\n>>>>>>>> +       ispWorkerThread_.removeMessages(debayer_.get());\n>>>>>>> As the ispWorkerThread_ has just been asked to exit() shouldn't /all/\n>>>>>>> messages be dropped?\n>>>>>> I believe there is only the debayer object that lives on that thread and\n>>>>>> receives messages.\n>>>>>>\n>>>>>>\n>>>>>>> Should we wrap a helper to the thread class that will\n>>>>>>>      - Exit the thread\n>>>>>>>      - Block until it's stopped\n>>>>>>>      - Remove all messages ?\n>>>>>>>\n>>>>>>> That seems like a common 'requirement' for a thread that could be\n>>>>>>> restarted perhaps ?\n>>>>>> I'm not sure. I would think it depends on the exact setup and the objects\n>>>>>> in question. And also one usually has to do two things: clear/flush the\n>>>>>> messages on the thread, and then clear/flush all signals that came from\n>>>>>> that thread.\n>>>>>>\n>>>>>> And as far as I can tell, this change will be superseded by the introduction of\n>>>>>> gpu debayering because that introduces a blocking \"stop()\" call which will flush\n>>>>>> all messages.\n>>>>> I see. Do you still want to merge this patch ? If so I'm fine with it.\n>>>> Yes.\n>>>>\n>>>>\n>>>>> Reviewed-by: Kieran Bingham<kieran.bingham@ideasonboard.com>\n>>>>>\n>>>>>> Regards,\n>>>>>> Barnabás Pőcze\n>>>>>>\n>>>>>>>\n>>>>>>>>             Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);\n>>>>>>>>\n>>>>>>>> --\n>>>>>>>> 2.51.0\n>>>>>>>>\n>> -- \n>> Robert Mader\n>> Consultant Software Developer\n>>\n>> Collabora Ltd.\n>> Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK\n>> Registered in England & Wales, no. 5513718\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 3099ABE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Oct 2025 11:01:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 575C26031A;\n\tMon, 13 Oct 2025 13:01:14 +0200 (CEST)","from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com\n\t[136.143.188.112])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E61D16031A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Oct 2025 13:01:11 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1760353266046590.8609603465544;\n\tMon, 13 Oct 2025 04:01:06 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"httJxMK3\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1760353267; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=VRdWbGg6vxpBpEkrP1apodf+R4j+HGwAdddwx8aJJO3kqYBkzOwqT94xv9NC9FD1jt7SEGwsEAgKqSOdRAYUpbGS0TkRlbYfZwSVZ9oJIvqwOmG6fwMTMDZoJL61iGGibxkNUyjiAByHvZVRqLnPQaytTvtG8/9wj4Xediy/1k4=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1760353267;\n\th=Content-Type:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=1hYusY4uYMEt9mKtgCGfYfntVb/J9SGhEOqCdcJPTPw=; \n\tb=lP7Sh1/v0n+Km7qSsz3yDpzdAxILvDTJ5QNcq5tms96PhPfKUOhprxgxYfzYOxO1kwu9YB2VAoVnhVOZGmB1lg5LWXhx7p7HJQPpaDkK42KkpeG89oBZjkN0X574WYiDPReSggXs/Fyx+myDTGPv0wlU0L97Qy14Ia2//Dxbpms=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1760353267;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Content-Type:Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Message-Id:Reply-To:Cc;\n\tbh=1hYusY4uYMEt9mKtgCGfYfntVb/J9SGhEOqCdcJPTPw=;\n\tb=httJxMK3x8GcPJWjJkx99uyJKWyE0xeZXnAz1q4GsXpWyylu/zNVt+9JwCYjEpQN\n\twdiacC4BPNj/WB0s1M1Vn6euAFgH1LMa14i/UXKoMRBepCoZ65bPfs79hv+Mnr4S45M\n\t1POAKa81kgWj4nXJdbSPTXaifiiMy280WPHbxgHw=","Content-Type":"multipart/alternative;\n\tboundary=\"------------pJBjewd2NYG7990IZcGZefYO\"","Message-ID":"<308d3919-c623-42f0-ad09-61317baeeb37@collabora.com>","Date":"Mon, 13 Oct 2025 13:01:02 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [RFC PATCH v1] libcamera: software_isp: Clear pending async work","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>, =?utf-8?q?Barnab?=\n\t=?utf-8?b?w6FzIFDFkWN6ZQ==?= <barnabas.pocze@ideasonboard.com>,\n\tHans de Goede <hansg@kernel.org>, Milan Zamazal <mzamazal@redhat.com>, \n\tlibcamera-devel@lists.libcamera.org","References":"<20250929074706.420894-1-barnabas.pocze@ideasonboard.com>\n\t<175933430075.756374.11522376619442542509@ping.linuxembedded.co.uk>\n\t<cc783357-86be-4f4f-9086-cb9aef3f7ddf@ideasonboard.com>\n\t<JkjyhrJ811kRohWTWbvNHOzH43D-mc7nSHqDxFwarJMYC2gk6Pr3voNogvI-K8LXd4vcKI4IJ7KjG9BFN0Z-nw==@protonmail.internalid>\n\t<175939732638.1246375.3721888721897164047@ping.linuxembedded.co.uk>\n\t<83b5afab-1629-4f42-9e15-5df714c4bf34@ideasonboard.com>\n\t<176034920856.756374.5377278068383767322@ping.linuxembedded.co.uk>\n\t<f45f7c4b-990b-4de6-8609-31230f50cc77@collabora.com>\n\t<176035310889.935713.15722245797395943247@ping.linuxembedded.co.uk>","Content-Language":"en-US, de-DE","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<176035310889.935713.15722245797395943247@ping.linuxembedded.co.uk>","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>"}}]