[Mesa-dev] [PATCH v3 0/4] Disable glthread if libX11 isn't thread-safe

Emil Velikov emil.l.velikov at gmail.com
Mon May 8 15:06:48 UTC 2017


On 5 May 2017 at 18:28, gregory hainaut <gregory.hainaut at gmail.com> wrote:
> On Fri, 5 May 2017 18:17:22 +0100
> Emil Velikov <emil.l.velikov at gmail.com> wrote:
>
>> On 5 May 2017 at 17:58, gregory hainaut <gregory.hainaut at gmail.com> wrote:
>> > On Fri, 5 May 2017 17:45:01 +0200
>> > Axel Davy <axel.davy at normalesup.org> wrote:
>> >
>>  [...]
>> >
>> > Hello Axel,
>> >
>> > Yes it is another possibility. It would requires to track gl calls that end up in X11.
>> > I'm not sure if there is an easy way to list all those gl functions. There are at least the
>> > draw calls and maybe the clear operations. Besides I'm afraid that we will need to handle
>> > various corner cases of the OpenGL API. It is doable but likely more complicated.
>> >
>> > There is also the Nvidia way, i.e. forces the driver to XInitThreads X11. I think it
>> > can be implemented with the help of constructor attribute.
>> >
>> Did you trace the above behaviour? What would happen in the following scenario:
>>  - There is no link against libGL/libEGL
>>  - User gets the dpy primitive w/o calling XInitThreads
>>  - Then user dlopens libGL/libEGL, which in itself calls XInitThreads
>> At that point it's a bit too late isn't it?
>>
>> -Emil
>
> Hello,
>
> No I didn't trace it.
>
> You right, it is too late. You can/must use LD_PRELOAD to ensure that libGL/libEGL is loaded first.
>
> To be honest, the best solution will be to have a thread safe Xlib. No more hack everywhere.
>
Having a look at Xlib might be good indeed.

Then again, the solution you've proposed looks perfectly reasonable,
IMHO. It handles the problem _now_ and should also work when/if we
address Xlib.
I'll take another look today/tomorrow, but I think the series is
perfectly fine to land as-is.

Thanks
Emil


More information about the mesa-dev mailing list