[v1,5/5] libcamera: shared_mem_object: Remove is_standard_layout restriction
diff mbox series

Message ID 20240502080925.31730-6-naush@raspberrypi.com
State Superseded
Headers show
Series
  • Pre Raspberry Pi 5 support changes
Related show

Commit Message

Naushir Patuck May 2, 2024, 8:09 a.m. UTC
The shared_mem_object may be used to construct complex classes, so
remove the standard layout type restriction.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 include/libcamera/internal/shared_mem_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jacopo Mondi May 2, 2024, 10:08 a.m. UTC | #1
Hi Naush

On Thu, May 02, 2024 at 09:09:25AM GMT, Naushir Patuck wrote:
> The shared_mem_object may be used to construct complex classes, so
> remove the standard layout type restriction.
>
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

Can you already tell which non-standard-layout class you need to wrap
in a SharedMemObject ?

My only concern is
"Standard layout types are useful for communicating with code written
in other programming languages."

but as SharedMemObject is internal maybe I'm just over-concerned

> ---
>  include/libcamera/internal/shared_mem_object.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/libcamera/internal/shared_mem_object.h b/include/libcamera/internal/shared_mem_object.h
> index 9b1d939302a8..c9c0482062bd 100644
> --- a/include/libcamera/internal/shared_mem_object.h
> +++ b/include/libcamera/internal/shared_mem_object.h
> @@ -56,7 +56,7 @@ private:
>  	Span<uint8_t> mem_;
>  };
>
> -template<class T, typename = std::enable_if_t<std::is_standard_layout<T>::value>>
> +template<class T>
>  class SharedMemObject : public SharedMem
>  {
>  public:
> --
> 2.34.1
>
Naushir Patuck May 2, 2024, 10:43 a.m. UTC | #2
Hi Jacopo,

On Thu, 2 May 2024 at 11:08, Jacopo Mondi <jacopo.mondi@ideasonboard.com> wrote:
>
> Hi Naush
>
> On Thu, May 02, 2024 at 09:09:25AM GMT, Naushir Patuck wrote:
> > The shared_mem_object may be used to construct complex classes, so
> > remove the standard layout type restriction.
> >
> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
>
> Can you already tell which non-standard-layout class you need to wrap
> in a SharedMemObject ?
>
> My only concern is
> "Standard layout types are useful for communicating with code written
> in other programming languages."
>
> but as SharedMemObject is internal maybe I'm just over-concerned

I am using the SharedMemObject to wrap the BackEnd and FrontEnd class
objects (from libpisp) in the Pi 5 pipeline handler and IPA.

My original implementation did not include this constraint, I think it
would be quite limiting if we could not use it for C++ objects in our
case :)

Regards,
Naush

>
>
> > ---
> >  include/libcamera/internal/shared_mem_object.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/libcamera/internal/shared_mem_object.h b/include/libcamera/internal/shared_mem_object.h
> > index 9b1d939302a8..c9c0482062bd 100644
> > --- a/include/libcamera/internal/shared_mem_object.h
> > +++ b/include/libcamera/internal/shared_mem_object.h
> > @@ -56,7 +56,7 @@ private:
> >       Span<uint8_t> mem_;
> >  };
> >
> > -template<class T, typename = std::enable_if_t<std::is_standard_layout<T>::value>>
> > +template<class T>
> >  class SharedMemObject : public SharedMem
> >  {
> >  public:
> > --
> > 2.34.1
> >

Patch
diff mbox series

diff --git a/include/libcamera/internal/shared_mem_object.h b/include/libcamera/internal/shared_mem_object.h
index 9b1d939302a8..c9c0482062bd 100644
--- a/include/libcamera/internal/shared_mem_object.h
+++ b/include/libcamera/internal/shared_mem_object.h
@@ -56,7 +56,7 @@  private:
 	Span<uint8_t> mem_;
 };
 
-template<class T, typename = std::enable_if_t<std::is_standard_layout<T>::value>>
+template<class T>
 class SharedMemObject : public SharedMem
 {
 public: