On 02/12/2015 05:56 AM, Emil Velikov wrote:
> Hello all,
> 
> In case you've been wondering what happened with that here it goes:
> 
> Currently the following libraries could be nuked
> 
>   NEEDED               libwayland-client.so.0
>   NEEDED               libwayland-egl.so.1
>   NEEDED               libX11-xcb.so.1
>   NEEDED               libX11.so.6
>   NEEDED               libxcb.so.1
>   NEEDED               libudev.so.1
> 
> From the above we're using the following problematic APIs:
> 
> X11/xcb
> * XGetXCBConnection
> 
> libwayland-client
> * wl_registry_add_listener
> * wl_shell_surface_add_listener
> * Others ?
> 
> On the X11/xcb side we can fix this by transitioning to a xcb only
> implementation, but that means (a) breaking the API/ABI and (b)
> updating all the users (with XLookupString being the messiest).

We shouldn't break Waffle's X11 API. If you want to expose an XCB-only
backend, then it would make sense to add a new platform type,
WAFFLE_PLATFORM_XCB_EGL, which shares most of its code with
WAFFLE_PLATFORM_X11_EGL.

Is there any reason why Waffle can't use dlsym() to get XGetXCBConnection?
 
> Why problematic - the functions are defined as "static inline" within
> the respective headers, which means that they are expanded during
> compilation. My biggest concern is that (imho) there is no guarantee
> by either library that the current implementation will stay the same,
> thus we cannot manually inline them in waffle.
> 
> Should be bite the bullet and do it anyway ? Does anyone know a lovely
> trick to resolve this ?

There is an easy way to dlsym() the Wayland functions. The inline protocol 
functions
in wayland-client-protocol.h are all implemented by real library calls to 
wl_proxy_* functions.
The wl_proxy functions *do* have stable ABI. So, to stop linking to 
libwayland-client,
for each wl_proxy function used by wayland-client-protocol.h (there's about a 
dozen),
Waffle needs to provide its own definition of the wl_proxy function that 
forwards its
arguments to a dlysm() wl_proxy function. Like this:

void
wl_proxy_add_dispatcher(struct wl_proxy *proxy, wl_dispatcher_func_t 
dispatcher_func,
                        const void *dispatcher_data, void *data)
{
    // This is a function pointer dlsym'd during waffle_init().
    wfl_wl_proxy_add_dispatcher(prox, dispatcher_func, dispatcher_data, data);
}

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
waffle mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/waffle

Reply via email to