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

Cheng-Hao Yang chenghaoyang at chromium.org
Wed Oct 23 08:51:35 CEST 2024


Hi Laurent,

On Mon, Oct 21, 2024 at 12:49 AM Laurent Pinchart
<laurent.pinchart at ideasonboard.com> wrote:
>
> On Sun, Oct 20, 2024 at 12:35:57PM +0800, Cheng-Hao Yang wrote:
> > On Sun, Oct 20, 2024 at 6:45 AM Kieran Bingham 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.
>
> Please detail in the commit message both the expected behaviour on the
> libcamera side and on the proxy worker side.

Updated.

>
> > > > 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 disconnected()
>         {
>                 exit_ = true;
>         }
>

Thanks, will be updated in the next version.

BR,
Harvey

> > > > +
> > > >         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_) {
>
> --
> Regards,
>
> Laurent Pinchart


More information about the libcamera-devel mailing list