[PATCH 2/4] libcamera: Use disconnect signal in ipa proxy worker

Cheng-Hao Yang chenghaoyang at chromium.org
Sun Oct 20 06:35:57 CEST 2024


Hi Kieran,

On Sun, Oct 20, 2024 at 6:45 AM Kieran Bingham
<kieran.bingham at ideasonboard.com> wrote:
>
> Quoting Harvey Yang (2024-10-18 08:57:35)
> > Previously the worker might not receive the disconnect signal, and the
> > forked process might stay alive forever.
> >
> > This CL also helps DMA buf recycling, as the algo process might hold DMA
> > buf file descriptors.
>
> Should this just be part of the previous patch? Or is it somehow
> distinct?

Yes, I'm also fine with merging them. Will do in the next version.

BR,
Harvey

>
> >
> > Signed-off-by: Harvey Yang <chenghaoyang at chromium.org>
> > Co-developed-by: Yudhistira Erlandinata <yerlandinata at chromium.org>
> > Signed-off-by: Yudhistira Erlandinata <yerlandinata at chromium.org>
> > ---
> >  .../libcamera_templates/module_ipa_proxy_worker.cpp.tmpl     | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
> > index 1f990d3f9..68d68c4a5 100644
> > --- a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
> > +++ b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
> > @@ -60,6 +60,10 @@ public:
> >
> >         ~{{proxy_worker_name}}() {}
> >
> > +       void disconnected() {
> > +               exit_ = true;
> > +       }
> > +
> >         void readyRead()
> >         {
> >                 IPCUnixSocket::Payload _message;
> > @@ -131,6 +135,7 @@ public:
> >                         return EXIT_FAILURE;
> >                 }
> >                 socket_.readyRead.connect(this, &{{proxy_worker_name}}::readyRead);
> > +               socket_.disconnected.connect(this, &{{proxy_worker_name}}::disconnected);
> >
> >                 ipa_ = dynamic_cast<{{interface_name}} *>(ipam->createInterface());
> >                 if (!ipa_) {
> > --
> > 2.47.0.rc1.288.g06298d1525-goog
> >


More information about the libcamera-devel mailing list