[waffle] [PATCH] wayland: add support for wl_proxy_marshal_constructor_versioned

2016-04-14 Thread Dylan Baker
This fixes waffle to build against wayland 1.10.

Thanks to Jason Eckstrand for help getting this working.

Fixes #38

cc: Chad Versace 
cc: Mark Janes 
Signed-off-by: Dylan Baker 
---
 src/waffle/wayland/wayland_wrapper.c | 1 +
 src/waffle/wayland/wayland_wrapper.h | 8 
 2 files changed, 9 insertions(+)

diff --git a/src/waffle/wayland/wayland_wrapper.c 
b/src/waffle/wayland/wayland_wrapper.c
index 6ffd5a9..06fa336 100644
--- a/src/waffle/wayland/wayland_wrapper.c
+++ b/src/waffle/wayland/wayland_wrapper.c
@@ -106,6 +106,7 @@ wayland_wrapper_init(void)
 RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_add_listener);
 RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal);
 RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor);
+RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor_versioned);
 #undef RETRIEVE_WL_CLIENT_SYMBOL
 
 error:
diff --git a/src/waffle/wayland/wayland_wrapper.h 
b/src/waffle/wayland/wayland_wrapper.h
index 40a581a..e45ff64 100644
--- a/src/waffle/wayland/wayland_wrapper.h
+++ b/src/waffle/wayland/wayland_wrapper.h
@@ -75,6 +75,13 @@ struct wl_proxy *
 const struct wl_interface *interface,
 ...);
 
+struct wl_proxy *
+(*wfl_wl_proxy_marshal_constructor_versioned)(struct wl_proxy *proxy,
+  uint32_t opcode,
+  const struct wl_interface 
*interface,
+  uint32_t version,
+  ...);
+
 #ifdef _WAYLAND_CLIENT_H
 #error Do not include wayland-client.h ahead of wayland_wrapper.h
 #endif
@@ -92,3 +99,4 @@ struct wl_proxy *
 #define wl_proxy_add_listener (*wfl_wl_proxy_add_listener)
 #define wl_proxy_marshal (*wfl_wl_proxy_marshal)
 #define wl_proxy_marshal_constructor (*wfl_wl_proxy_marshal_constructor)
+#define wl_proxy_marshal_constructor_versioned 
(*wfl_wl_proxy_marshal_constructor_versioned)
-- 
2.8.0

___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH] wayland: add support for wl_proxy_marshal_constructor_versioned

2016-04-14 Thread Emil Velikov
On 14 April 2016 at 19:12, Dylan Baker  wrote:
> This fixes waffle to build against wayland 1.10.
>
> Thanks to Jason Eckstrand for help getting this working.
>
I can never get names right, although this one seems off -
s/Eckstrand/Ekstrand/ ;-)

> Fixes #38
>
> cc: Chad Versace 
> cc: Mark Janes 
Michel already sent v2 [1] although I'm a little concerned with the
approach. If things are urgent please apply it locally until we hear
from Chad/Michel/others.

-Emil

[1] https://lists.freedesktop.org/archives/waffle/2016-April/001423.html
___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH] wayland: Wrap wl_proxy_marshal_constructor_versioned v2

2016-04-14 Thread Michel Dänzer
On 15.04.2016 11:14, Michel Dänzer wrote:
> On 14.04.2016 22:16, Emil Velikov wrote:
>> On 14 April 2016 at 09:23, Michel Dänzer  wrote:
>>> From: Michel Dänzer 
>>>
>>> Fixes build failure due to wl_proxy_marshal_constructor_versioned being
>>> unresolved when building against current wayland.
>>>
>>> This API was introduced in wayland 1.9.91 by commit 557032e3 ("Track
>>> protocol object versions inside wl_proxy."). The waffle code doesn't
>>> reference wl_proxy_marshal_constructor_versioned directly but
>>> indirectly via wayland-scanner.
>>>
>>> v2:
>>> * Add paragraph about how wl_proxy_marshal_constructor_versioned was
>>>   introduced. (Emil Velikov)
>>> * Only resolve wl_proxy_marshal_constructor_versioned with wayland >=
>>>   1.9.91.
>>>
>>> Signed-off-by: Michel Dänzer 
>>> ---
>>>  src/waffle/wayland/wayland_wrapper.c | 5 +
>>>  src/waffle/wayland/wayland_wrapper.h | 8 
>>>  2 files changed, 13 insertions(+)
>>>
>>> diff --git a/src/waffle/wayland/wayland_wrapper.c 
>>> b/src/waffle/wayland/wayland_wrapper.c
>>> index 6ffd5a9..fb66f9a 100644
>>> --- a/src/waffle/wayland/wayland_wrapper.c
>>> +++ b/src/waffle/wayland/wayland_wrapper.c
>>> @@ -106,6 +106,11 @@ wayland_wrapper_init(void)
>>>  RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_add_listener);
>>>  RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal);
>>>  RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor);
>>> +#if WAYLAND_VERSION_MAJOR == 1 && \
>>> +(WAYLAND_VERSION_MINOR > 9 || \
>>> + (WAYLAND_VERSION_MINOR == 9 && WAYLAND_VERSION_MICRO >= 91))
>>> +RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor_versioned);
>>> +#endif
>>>  #undef RETRIEVE_WL_CLIENT_SYMBOL
>>>
>> I am slightly worried about this approach. It adds a so called 'hidden
>> dependency' and with it a possibility of things going horribly wrong.
>> It is something that we try to avoid with mesa as the deps version at
>> build time != run-time one. Or in other words, one might build against
>> wayland 1.9 and things will go crazy as you run wayland 1.10, or vice
>> versa.
>>
>> Obviously that's not perfect, although unavoidable. Why ? As distros
>> do not know about the requirement (i.e. it's not mandated at configure
>> time) they won't rebuild and things won't work. At the same time if
>> they do rebuild (again without the explicit requirement), things will
>> break if one needs to revert to older (yet still in version range as
>> per the deps list) wayland.
> 
> That's not true at least for Debian and derivatives, which keep track of
> which symbols were added in which version and generate accordingly
> versioned dependencies.

It occurred to me (just after sending out the previous post, sigh...)
that this automatic mechanism might not work for waffle's dependency on
wayland if we don't link the wayland libraries directly. Even so, IME
this is a common issue distro maintainers of libraries have to deal
with, nothing particularly tricky.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH] wayland: Wrap wl_proxy_marshal_constructor_versioned v2

2016-04-14 Thread Michel Dänzer
On 14.04.2016 22:16, Emil Velikov wrote:
> On 14 April 2016 at 09:23, Michel Dänzer  wrote:
>> From: Michel Dänzer 
>>
>> Fixes build failure due to wl_proxy_marshal_constructor_versioned being
>> unresolved when building against current wayland.
>>
>> This API was introduced in wayland 1.9.91 by commit 557032e3 ("Track
>> protocol object versions inside wl_proxy."). The waffle code doesn't
>> reference wl_proxy_marshal_constructor_versioned directly but
>> indirectly via wayland-scanner.
>>
>> v2:
>> * Add paragraph about how wl_proxy_marshal_constructor_versioned was
>>   introduced. (Emil Velikov)
>> * Only resolve wl_proxy_marshal_constructor_versioned with wayland >=
>>   1.9.91.
>>
>> Signed-off-by: Michel Dänzer 
>> ---
>>  src/waffle/wayland/wayland_wrapper.c | 5 +
>>  src/waffle/wayland/wayland_wrapper.h | 8 
>>  2 files changed, 13 insertions(+)
>>
>> diff --git a/src/waffle/wayland/wayland_wrapper.c 
>> b/src/waffle/wayland/wayland_wrapper.c
>> index 6ffd5a9..fb66f9a 100644
>> --- a/src/waffle/wayland/wayland_wrapper.c
>> +++ b/src/waffle/wayland/wayland_wrapper.c
>> @@ -106,6 +106,11 @@ wayland_wrapper_init(void)
>>  RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_add_listener);
>>  RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal);
>>  RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor);
>> +#if WAYLAND_VERSION_MAJOR == 1 && \
>> +(WAYLAND_VERSION_MINOR > 9 || \
>> + (WAYLAND_VERSION_MINOR == 9 && WAYLAND_VERSION_MICRO >= 91))
>> +RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor_versioned);
>> +#endif
>>  #undef RETRIEVE_WL_CLIENT_SYMBOL
>>
> I am slightly worried about this approach. It adds a so called 'hidden
> dependency' and with it a possibility of things going horribly wrong.
> It is something that we try to avoid with mesa as the deps version at
> build time != run-time one. Or in other words, one might build against
> wayland 1.9 and things will go crazy as you run wayland 1.10, or vice
> versa.
> 
> Obviously that's not perfect, although unavoidable. Why ? As distros
> do not know about the requirement (i.e. it's not mandated at configure
> time) they won't rebuild and things won't work. At the same time if
> they do rebuild (again without the explicit requirement), things will
> break if one needs to revert to older (yet still in version range as
> per the deps list) wayland.

That's not true at least for Debian and derivatives, which keep track of
which symbols were added in which version and generate accordingly
versioned dependencies. If other distros aren't doing this yet, that's
not upstream's problem.


> TL;DR: The situation is quite sensitive and fragile. The only robust
> solutions that I can think of are: a) non-fatal (only for newer
> symbols) dlsym

The problem with that is that we wouldn't catch the lack of a symbol
which is really required, even when we know perfectly well that it's
required (we know which versions of wayland-scanner generate references
to which symbols).


> or b) bumping the req. version at configure time.

That's not necessary.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle


[waffle] [PATCH] wayland: Wrap wl_proxy_marshal_constructor_versioned v2

2016-04-14 Thread Michel Dänzer
From: Michel Dänzer 

Fixes build failure due to wl_proxy_marshal_constructor_versioned being
unresolved when building against current wayland.

This API was introduced in wayland 1.9.91 by commit 557032e3 ("Track
protocol object versions inside wl_proxy."). The waffle code doesn't
reference wl_proxy_marshal_constructor_versioned directly but
indirectly via wayland-scanner.

v2:
* Add paragraph about how wl_proxy_marshal_constructor_versioned was
  introduced. (Emil Velikov)
* Only resolve wl_proxy_marshal_constructor_versioned with wayland >=
  1.9.91.

Signed-off-by: Michel Dänzer 
---
 src/waffle/wayland/wayland_wrapper.c | 5 +
 src/waffle/wayland/wayland_wrapper.h | 8 
 2 files changed, 13 insertions(+)

diff --git a/src/waffle/wayland/wayland_wrapper.c 
b/src/waffle/wayland/wayland_wrapper.c
index 6ffd5a9..fb66f9a 100644
--- a/src/waffle/wayland/wayland_wrapper.c
+++ b/src/waffle/wayland/wayland_wrapper.c
@@ -106,6 +106,11 @@ wayland_wrapper_init(void)
 RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_add_listener);
 RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal);
 RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor);
+#if WAYLAND_VERSION_MAJOR == 1 && \
+(WAYLAND_VERSION_MINOR > 9 || \
+ (WAYLAND_VERSION_MINOR == 9 && WAYLAND_VERSION_MICRO >= 91))
+RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor_versioned);
+#endif
 #undef RETRIEVE_WL_CLIENT_SYMBOL
 
 error:
diff --git a/src/waffle/wayland/wayland_wrapper.h 
b/src/waffle/wayland/wayland_wrapper.h
index 40a581a..3282587 100644
--- a/src/waffle/wayland/wayland_wrapper.h
+++ b/src/waffle/wayland/wayland_wrapper.h
@@ -75,6 +75,13 @@ struct wl_proxy *
 const struct wl_interface *interface,
 ...);
 
+struct wl_proxy *
+(*wfl_wl_proxy_marshal_constructor_versioned)(struct wl_proxy *proxy,
+ uint32_t opcode,
+ const struct wl_interface 
*interface,
+ uint32_t version,
+ ...);
+
 #ifdef _WAYLAND_CLIENT_H
 #error Do not include wayland-client.h ahead of wayland_wrapper.h
 #endif
@@ -92,3 +99,4 @@ struct wl_proxy *
 #define wl_proxy_add_listener (*wfl_wl_proxy_add_listener)
 #define wl_proxy_marshal (*wfl_wl_proxy_marshal)
 #define wl_proxy_marshal_constructor (*wfl_wl_proxy_marshal_constructor)
+#define wl_proxy_marshal_constructor_versioned 
(*wfl_wl_proxy_marshal_constructor_versioned)
-- 
2.8.0.rc3

___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH] wayland: Wrap wl_proxy_marshal_constructor_versioned

2016-04-14 Thread Michel Dänzer
On 08.04.2016 00:28, Emil Velikov wrote:
> On 7 April 2016 at 09:20, Michel Dänzer  wrote:
>> From: Michel Dänzer 
>>
>> Fixes build failure due to wl_proxy_marshal_constructor_versioned being
>> unresolved when building against current wayland.
>>
> Thanks for that patch. Can you please add the commit (and/or version)
> where this API is introduced ?

Added in v2.


> I recently sent out a similar patch [1] can you please take a look ? I
> would love to hear your input on the proposed topic.
[...]
> [1] https://lists.freedesktop.org/archives/waffle/2016-April/001406.html

I mostly agree with your analysis, but instead of always allowing dlsym
to fail for some symbols, I think it's better to guard their
RETRIEVE_WL_CLIENT_SYMBOL lines by version checks as I did in v2.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer

___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH] wayland: Wrap wl_proxy_marshal_constructor_versioned v2

2016-04-14 Thread Emil Velikov
On 14 April 2016 at 09:23, Michel Dänzer  wrote:
> From: Michel Dänzer 
>
> Fixes build failure due to wl_proxy_marshal_constructor_versioned being
> unresolved when building against current wayland.
>
> This API was introduced in wayland 1.9.91 by commit 557032e3 ("Track
> protocol object versions inside wl_proxy."). The waffle code doesn't
> reference wl_proxy_marshal_constructor_versioned directly but
> indirectly via wayland-scanner.
>
> v2:
> * Add paragraph about how wl_proxy_marshal_constructor_versioned was
>   introduced. (Emil Velikov)
> * Only resolve wl_proxy_marshal_constructor_versioned with wayland >=
>   1.9.91.
>
> Signed-off-by: Michel Dänzer 
> ---
>  src/waffle/wayland/wayland_wrapper.c | 5 +
>  src/waffle/wayland/wayland_wrapper.h | 8 
>  2 files changed, 13 insertions(+)
>
> diff --git a/src/waffle/wayland/wayland_wrapper.c 
> b/src/waffle/wayland/wayland_wrapper.c
> index 6ffd5a9..fb66f9a 100644
> --- a/src/waffle/wayland/wayland_wrapper.c
> +++ b/src/waffle/wayland/wayland_wrapper.c
> @@ -106,6 +106,11 @@ wayland_wrapper_init(void)
>  RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_add_listener);
>  RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal);
>  RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor);
> +#if WAYLAND_VERSION_MAJOR == 1 && \
> +(WAYLAND_VERSION_MINOR > 9 || \
> + (WAYLAND_VERSION_MINOR == 9 && WAYLAND_VERSION_MICRO >= 91))
> +RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor_versioned);
> +#endif
>  #undef RETRIEVE_WL_CLIENT_SYMBOL
>
I am slightly worried about this approach. It adds a so called 'hidden
dependency' and with it a possibility of things going horribly wrong.
It is something that we try to avoid with mesa as the deps version at
build time != run-time one. Or in other words, one might build against
wayland 1.9 and things will go crazy as you run wayland 1.10, or vice
versa.

Obviously that's not perfect, although unavoidable. Why ? As distros
do not know about the requirement (i.e. it's not mandated at configure
time) they won't rebuild and things won't work. At the same time if
they do rebuild (again without the explicit requirement), things will
break if one needs to revert to older (yet still in version range as
per the deps list) wayland.

TL;DR: The situation is quite sensitive and fragile. The only robust
solutions that I can think of are: a) non-fatal (only for newer
symbols) dlsym or b) bumping the req. version at configure time.

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