Conversation
Mesa drivers such as i965_dri.so use symbols from libglapi but do not pull in libglapi (https://bugs.freedesktop.org/show_bug.cgi?id=57702) so dlopen libglapi before we need it.
Afaik one does not use gbm directly but via libEGL(at least in the context of waffle), and the latter already ldopens libglapi.so.0. Thus this should not be needed. Additionally I've send some patches that link the dri modules against libglapi, but I'm yet to get any input on them. |
I stand corrected. The semantics of gbm and EGL dictates that gbm is to be used first, which requires that the symbols in the dri modules must be resolved by/around the former. Perhaps we ought to fix the dri modules once and for all, with all projects using gbm bumping their requirement to mesa 10.4 (due in a couple of months) ? |
@fjhenigman I see a problem with you fix, unless I don't understand things correctly. Won't this break Waffle on systems that don't have Mesa? I'm specifically thinking about Mali with minigbm. Even if this fix doesn't break non-Mesa GBM, I still think this solution violates Mesa's ABI contract. libglapi is a Mesa-private library, even if vendors don't package it as such. I think it's wrong to dlopen a private library that belongs to a separate project. As you state in [https://bugs.freedesktop.org/show_bug.cgi?id=57702], I think the proper fix belongs in GBM itself. I'll talk to Kristian about that on Monday. I see that Chromium and Weston also implement this hack. But, have you encountered any real problems using Waffle without this hack? I'm curious, because this problem has not affected me yet in my Waffle usage. |
@evelikov is trying to get this fixed in mesa: http://patchwork.freedesktop.org/patch/36392/ I did have a real problem: wflinfo would not run with the gbm backend. dlopen(libglapi) can silently fail with no harm, so the hack shouldn't cause problems? |
@chadversary now that I've dropped the libGL dependency in waffle (patches are coming shortly), the issue is quite prominent. My take on the whole issue is this:
@fjhenigman do you have an example when dlopen(libglapi) from libgbm will fail, and things will work considering that the hacks in the users [1] are nuked ? [1] Chromium, Weston, any other program that uses libgbm. |
@evelikov To answer your question, if dlopen(libglapi) fails (whether it's done inside mesa or in user code) then the program fails unless it's linked with libGL or something that pulls in libglapi. But you know that so ... sorry, I don't understand what you actually wanted to know. Can you elaborate the question? |
@fjhenigman After this discussion, I'm now ok with merging your fix. As you pointed out, the workaround causes no harm.
I'll merge it in the morning. (It's late for me, and I avoid committing code when I'm sleepy. Too easy to make mistakes). |
Mesa drivers such as i965_dri.so use symbols from libglapi but do not
pull in libglapi (https://bugs.freedesktop.org/show_bug.cgi?id=57702)
so dlopen libglapi before we need it.