Re: [Mesa-dev] [PATCH v2] wayland-drm: static inline wayland_drm_buffer_get

2017-10-30 Thread Dylan Baker
for the meson bits:
Reviewed-by: Dylan Baker 

Please do make sure that Daniel or someone else with wayland expertise looks at
this tool, I am not qualified to review that.

Dylan

Quoting Emil Velikov (2017-10-27 16:50:25)
> On 24 October 2017 at 17:14, Emil Velikov  wrote:
> > From: Emil Velikov 
> >
> > The function is effectively a direct function call into
> > libwayland-server.so.
> >
> > Thus GBM no longer depends on the wayland-drm static library, making the
> > build more straight forward. And the resulting binary is a bit smaller.
> >
> > Note: we need to move struct wayland_drm_callbacks further up,
> > otherwise we'll get an error since the type is incomplete.
> >
> > v2: Rebase, beef-up commit message, update meson, move struct
> > wayland_drm_callbacks.
> >
> > Cc: Dylan Baker 
> > Cc: Daniel Stone 
> > Signed-off-by: Emil Velikov 
> > Reviewed-by: Daniel Stone  (v1)
> > ---
> > Dylan can you check the meson bits? Can one say to meson, build object X
> > while only using the depA CFLAGS? It seems to me that it currently links
> > against depA even when you don't want it to.
> >
> Dylan, can you please take a look at the meson bit?
> 
> -Emil


signature.asc
Description: signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] wayland-drm: static inline wayland_drm_buffer_get

2017-10-30 Thread Dylan Baker
Quoting Eric Engestrom (2017-10-30 07:12:32)
> On Monday, 2017-10-30 13:39:00 +, Emil Velikov wrote:
> > On 30 October 2017 at 12:02, Eric Engestrom  
> > wrote:
> > > On Tuesday, 2017-10-24 17:14:20 +0100, Emil Velikov wrote:
> > >> From: Emil Velikov 
> > >>
> > >> The function is effectively a direct function call into
> > >> libwayland-server.so.
> > >>
> > >> Thus GBM no longer depends on the wayland-drm static library, making the
> > >> build more straight forward. And the resulting binary is a bit smaller.
> > >>
> > >> Note: we need to move struct wayland_drm_callbacks further up,
> > >> otherwise we'll get an error since the type is incomplete.
> > >>
> > >> v2: Rebase, beef-up commit message, update meson, move struct
> > >> wayland_drm_callbacks.
> > >>
> > >> Cc: Dylan Baker 
> > >> Cc: Daniel Stone 
> > >> Signed-off-by: Emil Velikov 
> > >> Reviewed-by: Daniel Stone  (v1)
> > >> ---
> > >> Dylan can you check the meson bits? Can one say to meson, build object X
> > >> while only using the depA CFLAGS? It seems to me that it currently links
> > >> against depA even when you don't want it to.
> > >
> > > I'm not sure I understand what you're asking: you want to include
> > > wayland-drm.h's path in libgbm's CFLAGS but not link libgbm against
> > > libwayland_drm?
> > >
> > > That looks like what's already happening here:
> > > libgbm has `include_directories('../egl/wayland/wayland-drm')`, and you
> > > removed libwayland_drm from `link_with:`
> > 
> > It's more of a generic question, which I _really_ should not have
> > mentioned here :-\
> 
> I guess IRC's better for this :)
> You should ask your question again there, there are many people who know
> more about meson than me.
> 
> > 
> > When dealing with dependencies (aka executable/shared_library(...
> > dependencies: ...) does meson distinguish between CFLAGS and LIBS?
> > Say you need the CFLAGS but you don't want the linking, or vise-versa.
> 
> The normal case is, you want both, which is what meson does with
> dependency()
> 
> > 
> > Reading through the docs [1], does not say anything on the topic.
> > It seems to me that it will link regardless, which is quite bad.
> 
> I'm no meson expert, but I don't think you can do this split thing
> another way than you did here. And that was only for -I cflags, you'd
> probably have to manually play with get_pkgconfig_variable() if you want
> other things from the .pc

That's exactly what you'd have to do. Give me a sec and I'll build/review.

> 
> > 
> > [1] http://mesonbuild.com/Dependencies.html
> > 
> > >
> > > I haven't tested your patch, but it looks correct to me.
> > >
> > Thanks, can you make it a formal r-b/ack/t-b ;-)
> 
> Sure:
> Reviewed-by: Eric Engestrom  # meson bit only
> Acked-by: Eric Engestrom  # for the rest
> 
> > 
> > -Emil
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] wayland-drm: static inline wayland_drm_buffer_get

2017-10-30 Thread Eric Engestrom
On Monday, 2017-10-30 13:39:00 +, Emil Velikov wrote:
> On 30 October 2017 at 12:02, Eric Engestrom  wrote:
> > On Tuesday, 2017-10-24 17:14:20 +0100, Emil Velikov wrote:
> >> From: Emil Velikov 
> >>
> >> The function is effectively a direct function call into
> >> libwayland-server.so.
> >>
> >> Thus GBM no longer depends on the wayland-drm static library, making the
> >> build more straight forward. And the resulting binary is a bit smaller.
> >>
> >> Note: we need to move struct wayland_drm_callbacks further up,
> >> otherwise we'll get an error since the type is incomplete.
> >>
> >> v2: Rebase, beef-up commit message, update meson, move struct
> >> wayland_drm_callbacks.
> >>
> >> Cc: Dylan Baker 
> >> Cc: Daniel Stone 
> >> Signed-off-by: Emil Velikov 
> >> Reviewed-by: Daniel Stone  (v1)
> >> ---
> >> Dylan can you check the meson bits? Can one say to meson, build object X
> >> while only using the depA CFLAGS? It seems to me that it currently links
> >> against depA even when you don't want it to.
> >
> > I'm not sure I understand what you're asking: you want to include
> > wayland-drm.h's path in libgbm's CFLAGS but not link libgbm against
> > libwayland_drm?
> >
> > That looks like what's already happening here:
> > libgbm has `include_directories('../egl/wayland/wayland-drm')`, and you
> > removed libwayland_drm from `link_with:`
> 
> It's more of a generic question, which I _really_ should not have
> mentioned here :-\

I guess IRC's better for this :)
You should ask your question again there, there are many people who know
more about meson than me.

> 
> When dealing with dependencies (aka executable/shared_library(...
> dependencies: ...) does meson distinguish between CFLAGS and LIBS?
> Say you need the CFLAGS but you don't want the linking, or vise-versa.

The normal case is, you want both, which is what meson does with
dependency()

> 
> Reading through the docs [1], does not say anything on the topic.
> It seems to me that it will link regardless, which is quite bad.

I'm no meson expert, but I don't think you can do this split thing
another way than you did here. And that was only for -I cflags, you'd
probably have to manually play with get_pkgconfig_variable() if you want
other things from the .pc

> 
> [1] http://mesonbuild.com/Dependencies.html
> 
> >
> > I haven't tested your patch, but it looks correct to me.
> >
> Thanks, can you make it a formal r-b/ack/t-b ;-)

Sure:
Reviewed-by: Eric Engestrom  # meson bit only
Acked-by: Eric Engestrom  # for the rest

> 
> -Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] wayland-drm: static inline wayland_drm_buffer_get

2017-10-30 Thread Emil Velikov
On 30 October 2017 at 12:02, Eric Engestrom  wrote:
> On Tuesday, 2017-10-24 17:14:20 +0100, Emil Velikov wrote:
>> From: Emil Velikov 
>>
>> The function is effectively a direct function call into
>> libwayland-server.so.
>>
>> Thus GBM no longer depends on the wayland-drm static library, making the
>> build more straight forward. And the resulting binary is a bit smaller.
>>
>> Note: we need to move struct wayland_drm_callbacks further up,
>> otherwise we'll get an error since the type is incomplete.
>>
>> v2: Rebase, beef-up commit message, update meson, move struct
>> wayland_drm_callbacks.
>>
>> Cc: Dylan Baker 
>> Cc: Daniel Stone 
>> Signed-off-by: Emil Velikov 
>> Reviewed-by: Daniel Stone  (v1)
>> ---
>> Dylan can you check the meson bits? Can one say to meson, build object X
>> while only using the depA CFLAGS? It seems to me that it currently links
>> against depA even when you don't want it to.
>
> I'm not sure I understand what you're asking: you want to include
> wayland-drm.h's path in libgbm's CFLAGS but not link libgbm against
> libwayland_drm?
>
> That looks like what's already happening here:
> libgbm has `include_directories('../egl/wayland/wayland-drm')`, and you
> removed libwayland_drm from `link_with:`

It's more of a generic question, which I _really_ should not have
mentioned here :-\

When dealing with dependencies (aka executable/shared_library(...
dependencies: ...) does meson distinguish between CFLAGS and LIBS?
Say you need the CFLAGS but you don't want the linking, or vise-versa.

Reading through the docs [1], does not say anything on the topic.
It seems to me that it will link regardless, which is quite bad.

[1] http://mesonbuild.com/Dependencies.html

>
> I haven't tested your patch, but it looks correct to me.
>
Thanks, can you make it a formal r-b/ack/t-b ;-)

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] wayland-drm: static inline wayland_drm_buffer_get

2017-10-30 Thread Eric Engestrom
On Tuesday, 2017-10-24 17:14:20 +0100, Emil Velikov wrote:
> From: Emil Velikov 
> 
> The function is effectively a direct function call into
> libwayland-server.so.
> 
> Thus GBM no longer depends on the wayland-drm static library, making the
> build more straight forward. And the resulting binary is a bit smaller.
> 
> Note: we need to move struct wayland_drm_callbacks further up,
> otherwise we'll get an error since the type is incomplete.
> 
> v2: Rebase, beef-up commit message, update meson, move struct
> wayland_drm_callbacks.
> 
> Cc: Dylan Baker 
> Cc: Daniel Stone 
> Signed-off-by: Emil Velikov 
> Reviewed-by: Daniel Stone  (v1)
> ---
> Dylan can you check the meson bits? Can one say to meson, build object X 
> while only using the depA CFLAGS? It seems to me that it currently links 
> against depA even when you don't want it to.

I'm not sure I understand what you're asking: you want to include
wayland-drm.h's path in libgbm's CFLAGS but not link libgbm against
libwayland_drm?

That looks like what's already happening here:
libgbm has `include_directories('../egl/wayland/wayland-drm')`, and you
removed libwayland_drm from `link_with:`

I haven't tested your patch, but it looks correct to me.

> 
>  src/Makefile.am   |  2 +-
>  src/egl/wayland/wayland-drm/wayland-drm.c | 26 -
>  src/egl/wayland/wayland-drm/wayland-drm.h | 48 
> +++
>  src/gbm/Makefile.am   |  2 +-
>  src/gbm/meson.build   |  4 +--
>  5 files changed, 39 insertions(+), 43 deletions(-)
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 5ef2d4f55ea..20e90c3d0b8 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -64,7 +64,7 @@ endif
>  # include only conditionally ?
>  SUBDIRS += compiler
>  
> -## Optionally required by GBM, EGL
> +## Optionally required by EGL
>  if HAVE_PLATFORM_WAYLAND
>  SUBDIRS += egl/wayland/wayland-drm
>  endif
> diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
> b/src/egl/wayland/wayland-drm/wayland-drm.c
> index 73dfba9600e..81f6f528527 100644
> --- a/src/egl/wayland/wayland-drm/wayland-drm.c
> +++ b/src/egl/wayland/wayland-drm/wayland-drm.c
> @@ -39,19 +39,6 @@
>  
>  #define MIN(x,y) (((x)<(y))?(x):(y))
>  
> -struct wl_drm {
> - struct wl_display *display;
> - struct wl_global *wl_drm_global;
> -
> - void *user_data;
> - char *device_name;
> -uint32_t flags;
> -
> - struct wayland_drm_callbacks callbacks;
> -
> -struct wl_buffer_interface buffer_interface;
> -};
> -
>  static void
>  destroy_buffer(struct wl_resource *resource)
>  {
> @@ -244,19 +231,6 @@ bind_drm(struct wl_client *client, void *data, uint32_t 
> version, uint32_t id)
> wl_resource_post_event(resource, WL_DRM_CAPABILITIES, 
> capabilities);
>  }
>  
> -struct wl_drm_buffer *
> -wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource)
> -{
> - if (resource == NULL)
> - return NULL;
> -
> -if (wl_resource_instance_of(resource, &wl_buffer_interface,
> -&drm->buffer_interface))
> - return wl_resource_get_user_data(resource);
> -else
> - return NULL;
> -}
> -
>  struct wl_drm *
>  wayland_drm_init(struct wl_display *display, char *device_name,
>   const struct wayland_drm_callbacks *callbacks, void 
> *user_data,
> diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h 
> b/src/egl/wayland/wayland-drm/wayland-drm.h
> index 111383ff1d6..36e5bf042a7 100644
> --- a/src/egl/wayland/wayland-drm/wayland-drm.h
> +++ b/src/egl/wayland/wayland-drm/wayland-drm.h
> @@ -4,8 +4,31 @@
>  #include 
>  
>  struct wl_display;
> -struct wl_drm;
>  struct wl_resource;
> +struct wl_drm_buffer;
> +
> +struct wayland_drm_callbacks {
> + int (*authenticate)(void *user_data, uint32_t id);
> +
> + void (*reference_buffer)(void *user_data, uint32_t name, int fd,
> + struct wl_drm_buffer *buffer);
> +
> + void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer);
> +};
> +
> +
> +struct wl_drm {
> + struct wl_display *display;
> + struct wl_global *wl_drm_global;
> +
> + void *user_data;
> + char *device_name;
> + uint32_t flags;
> +
> + struct wayland_drm_callbacks callbacks;
> +
> + struct wl_buffer_interface buffer_interface;
> +};
>  
>  struct wl_drm_buffer {
>   struct wl_resource *resource;
> @@ -18,19 +41,20 @@ struct wl_drm_buffer {
>   void *driver_buffer;
>  };
>  
> -struct wayland_drm_callbacks {
> - int (*authenticate)(void *user_data, uint32_t id);
> -
> -void (*reference_buffer)(void *user_data, uint32_t name, int fd,
> - struct wl_drm_buffer *buffer);
> -
> - void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer);
> -};
> -
>  enum { WAYLAND_DRM_PRIME = 0x01 };
>  
> -struct wl_drm_buffer *
> -wayland_

Re: [Mesa-dev] [PATCH v2] wayland-drm: static inline wayland_drm_buffer_get

2017-10-27 Thread Emil Velikov
On 24 October 2017 at 17:14, Emil Velikov  wrote:
> From: Emil Velikov 
>
> The function is effectively a direct function call into
> libwayland-server.so.
>
> Thus GBM no longer depends on the wayland-drm static library, making the
> build more straight forward. And the resulting binary is a bit smaller.
>
> Note: we need to move struct wayland_drm_callbacks further up,
> otherwise we'll get an error since the type is incomplete.
>
> v2: Rebase, beef-up commit message, update meson, move struct
> wayland_drm_callbacks.
>
> Cc: Dylan Baker 
> Cc: Daniel Stone 
> Signed-off-by: Emil Velikov 
> Reviewed-by: Daniel Stone  (v1)
> ---
> Dylan can you check the meson bits? Can one say to meson, build object X
> while only using the depA CFLAGS? It seems to me that it currently links
> against depA even when you don't want it to.
>
Dylan, can you please take a look at the meson bit?

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2] wayland-drm: static inline wayland_drm_buffer_get

2017-10-24 Thread Emil Velikov
From: Emil Velikov 

The function is effectively a direct function call into
libwayland-server.so.

Thus GBM no longer depends on the wayland-drm static library, making the
build more straight forward. And the resulting binary is a bit smaller.

Note: we need to move struct wayland_drm_callbacks further up,
otherwise we'll get an error since the type is incomplete.

v2: Rebase, beef-up commit message, update meson, move struct
wayland_drm_callbacks.

Cc: Dylan Baker 
Cc: Daniel Stone 
Signed-off-by: Emil Velikov 
Reviewed-by: Daniel Stone  (v1)
---
Dylan can you check the meson bits? Can one say to meson, build object X 
while only using the depA CFLAGS? It seems to me that it currently links 
against depA even when you don't want it to.

 src/Makefile.am   |  2 +-
 src/egl/wayland/wayland-drm/wayland-drm.c | 26 -
 src/egl/wayland/wayland-drm/wayland-drm.h | 48 +++
 src/gbm/Makefile.am   |  2 +-
 src/gbm/meson.build   |  4 +--
 5 files changed, 39 insertions(+), 43 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 5ef2d4f55ea..20e90c3d0b8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -64,7 +64,7 @@ endif
 # include only conditionally ?
 SUBDIRS += compiler
 
-## Optionally required by GBM, EGL
+## Optionally required by EGL
 if HAVE_PLATFORM_WAYLAND
 SUBDIRS += egl/wayland/wayland-drm
 endif
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
b/src/egl/wayland/wayland-drm/wayland-drm.c
index 73dfba9600e..81f6f528527 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -39,19 +39,6 @@
 
 #define MIN(x,y) (((x)<(y))?(x):(y))
 
-struct wl_drm {
-   struct wl_display *display;
-   struct wl_global *wl_drm_global;
-
-   void *user_data;
-   char *device_name;
-uint32_t flags;
-
-   struct wayland_drm_callbacks callbacks;
-
-struct wl_buffer_interface buffer_interface;
-};
-
 static void
 destroy_buffer(struct wl_resource *resource)
 {
@@ -244,19 +231,6 @@ bind_drm(struct wl_client *client, void *data, uint32_t 
version, uint32_t id)
wl_resource_post_event(resource, WL_DRM_CAPABILITIES, capabilities);
 }
 
-struct wl_drm_buffer *
-wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource)
-{
-   if (resource == NULL)
-   return NULL;
-
-if (wl_resource_instance_of(resource, &wl_buffer_interface,
-&drm->buffer_interface))
-   return wl_resource_get_user_data(resource);
-else
-   return NULL;
-}
-
 struct wl_drm *
 wayland_drm_init(struct wl_display *display, char *device_name,
  const struct wayland_drm_callbacks *callbacks, void 
*user_data,
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h 
b/src/egl/wayland/wayland-drm/wayland-drm.h
index 111383ff1d6..36e5bf042a7 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.h
+++ b/src/egl/wayland/wayland-drm/wayland-drm.h
@@ -4,8 +4,31 @@
 #include 
 
 struct wl_display;
-struct wl_drm;
 struct wl_resource;
+struct wl_drm_buffer;
+
+struct wayland_drm_callbacks {
+   int (*authenticate)(void *user_data, uint32_t id);
+
+   void (*reference_buffer)(void *user_data, uint32_t name, int fd,
+ struct wl_drm_buffer *buffer);
+
+   void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer);
+};
+
+
+struct wl_drm {
+   struct wl_display *display;
+   struct wl_global *wl_drm_global;
+
+   void *user_data;
+   char *device_name;
+   uint32_t flags;
+
+   struct wayland_drm_callbacks callbacks;
+
+   struct wl_buffer_interface buffer_interface;
+};
 
 struct wl_drm_buffer {
struct wl_resource *resource;
@@ -18,19 +41,20 @@ struct wl_drm_buffer {
void *driver_buffer;
 };
 
-struct wayland_drm_callbacks {
-   int (*authenticate)(void *user_data, uint32_t id);
-
-void (*reference_buffer)(void *user_data, uint32_t name, int fd,
- struct wl_drm_buffer *buffer);
-
-   void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer);
-};
-
 enum { WAYLAND_DRM_PRIME = 0x01 };
 
-struct wl_drm_buffer *
-wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource);
+static inline struct wl_drm_buffer *
+wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource)
+{
+   if (resource == NULL)
+   return NULL;
+
+   if (wl_resource_instance_of(resource, &wl_buffer_interface,
+   &drm->buffer_interface))
+   return wl_resource_get_user_data(resource);
+   else
+   return NULL;
+}
 
 struct wl_drm *
 wayland_drm_init(struct wl_display *display, char *device_name,
diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
index 805208a3ca9..088ff3a309a 100644
--- a/src/gbm/Makefile.am
+