[Mesa-dev] Mismatch between Mesas dispatch table and the one used by the X server

Stefan Brüns stefan.bruens at rwth-aachen.de
Sun Mar 10 11:24:10 PDT 2013

Hi everyone,

I have run into a problem leading to a crashing X server for a bunch of 
indirect GLX calls.

This problem affects any OpenGL clients using indirect rendering and calling 
functions which are outside the ABI. Problems range from malfunctioning to 

Problem analysis:

The dispatcher functions in glx/indirect_dispatch.c demarshall the function 
arguments from the GLX wire protocol and then call the appropriate function of 
the GL library. Function calls are done using dispatch table with the help of 
the CALL_* helper macros defined in dispatch.h.

Unfortunately there is a mismatch between the dispatch table expected by the 
xserver - which follows the layout e.g. found in glapitable.h - and the one 
provided by the GL library, e.g. Mesa.

Although both tables are created from the definitions in the various xml files 
part of Mesa, the xserver table omits the slots for the EGL methods and 
various others.

Possible solutions:

1. Use the approach used by XQuartz, i.e. allocate a table und fill the slots 
using dlsym.
Pros: works independend on X/Mesa version, no additional runtime cost
Cons: increased startup time

2. Make sure the Xserver uses the same table layout, i.e. insert some empty 
slots in the right positions.
Pros: no additional runtime or setup cost
Cons: new slots must only be appended to the table

3. Use the remap table
Pros: adapts to changes in the GL library
Cons: needs the (mesa internal) remap table, i.e. only applicable to Mesa, 
runtime cost due to the extra level of indirection.

Which would be the preferred approach, are there any other?

A bug has been filed against the Xserver: 



Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
phone: +49 241 53809034     mobile: +49 151 50412019

More information about the mesa-dev mailing list