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 <mic...@daenzer.net> wrote:
>>> From: Michel Dänzer <michel.daen...@amd.com>
>>>
>>> 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 <michel.daen...@amd.com>
>>> ---
>>>  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 <mic...@daenzer.net> wrote:
>> From: Michel Dänzer <michel.daen...@amd.com>
>>
>> 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 <michel.daen...@amd.com>
>> ---
>>  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


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 <mic...@daenzer.net> wrote:
>> From: Michel Dänzer <michel.daen...@amd.com>
>>
>> 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


[waffle] [PATCH] wayland: Wrap wl_proxy_marshal_constructor_versioned v2

2016-04-14 Thread Michel Dänzer
From: Michel Dänzer <michel.daen...@amd.com>

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 <michel.daen...@amd.com>
---
 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


[waffle] [PATCH] wayland: Wrap wl_proxy_marshal_constructor_versioned

2016-04-07 Thread Michel Dänzer
From: Michel Dänzer <michel.daen...@amd.com>

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

Signed-off-by: Michel Dänzer <michel.daen...@amd.com>
---
 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..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


[waffle] [PATCH] linux: Use full libGLES*.so.[12] SONAMEs

2015-05-31 Thread Michel Dänzer
From: Michel Dänzer michel.daen...@amd.com

The libGLES*.so symlinks are intended for the compile-time linker and
not available everywhere at runtime.

v2: * Continue using libGLES*.so on Android, the full SONAMEs aren't
  available there.
* Remove stale comment line

Signed-off-by: Michel Dänzer michel.daen...@amd.com
---
 man/waffle_config.3.xml |  2 +-
 man/waffle_dl.3.xml |  6 +++---
 src/waffle/linux/linux_dl.c | 13 ++---
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/man/waffle_config.3.xml b/man/waffle_config.3.xml
index 8dc2fae..a8cb98d 100644
--- a/man/waffle_config.3.xml
+++ b/man/waffle_config.3.xml
@@ -535,7 +535,7 @@ struct waffle_config;
   itemizedlist
 listitem
   para
-GLX supports creation of an OpenGL ES2 context only if 
libGLESv2.so is installed and if
+GLX supports creation of an OpenGL ES2 context only if 
libGLESv2.so.2 is installed and if
 GLX_EXT_create_context_es2_profile is exposed as both 
a server and client extension.
   /para
 /listitem
diff --git a/man/waffle_dl.3.xml b/man/waffle_dl.3.xml
index 463081f..ffcfad4 100644
--- a/man/waffle_dl.3.xml
+++ b/man/waffle_dl.3.xml
@@ -72,9 +72,9 @@
 para
   For example, on Linux, the constantWAFFLE_DL_*/constant enums map to
   filenamelibGL.so.1/filename,
-  filenamelibGLESv1_CM.so/filename,
-  filenamelibGLESv2.so/filename, and
-  filenamelibGLESv2.so/filename, respectively.
+  filenamelibGLESv1_CM.so.1/filename,
+  filenamelibGLESv2.so.2/filename, and
+  filenamelibGLESv2.so.2/filename, respectively.
 /para
 
 variablelist
diff --git a/src/waffle/linux/linux_dl.c b/src/waffle/linux/linux_dl.c
index 1e14684..33eb69d 100644
--- a/src/waffle/linux/linux_dl.c
+++ b/src/waffle/linux/linux_dl.c
@@ -34,7 +34,7 @@
 #include linux_dl.h
 
 struct linux_dl {
-/// @brief For example, libGLESv2.so.
+/// @brief For example, libGLESv2.so.2.
 const char *name;
 
 /// @brief The library obtained with dlopen().
@@ -50,17 +50,24 @@ linux_dl_get_name(int32_t waffle_dl)
 case WAFFLE_DL_OPENGL:
 return libGL.so.1;
 case WAFFLE_DL_OPENGL_ES1:
+#ifdef WAFFLE_HAS_ANDROID
 return libGLESv1_CM.so;
+#else
+return libGLESv1_CM.so.1;
+#endif
 case WAFFLE_DL_OPENGL_ES2:
 case WAFFLE_DL_OPENGL_ES3:
 // As of 2014-04-20, Mesa statically provides the ES2 and ES3
-// symbols symbols in libGLESv2.so and provides no ES3-only library
+// symbols symbols in libGLESv2.so.2 and provides no ES3-only 
library
 // 
-// Even though Waffle does not use the library's soname, note that
 // Mesa did not change the library's soname when it added the ES3
 // symbols. The soname was and is libGLESv2.so.2 before and after
 // ES3.
+#ifdef WAFFLE_HAS_ANDROID
 return libGLESv2.so;
+#else
+return libGLESv2.so.2;
+#endif
 default:
 wcore_error_internal(waffle_dl has bad value %#x, waffle_dl);
 return NULL;
-- 
2.1.4

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