[Mesa-dev] EGL_MESA_query_renderer

Haehnle, Nicolai Nicolai.Haehnle at amd.com
Mon Oct 8 13:20:59 UTC 2018


Hi Veluri,

On 07.10.2018 21:31, Veluri Mithun wrote:
> All these days I worked on packaging since I didn't find much time last 
> month in my new academic schedule, I finished it if you wish you may 
> download it 
> here(https://flathub.org/apps/details/br.com.jeanhertel.adriconf). 
> Currently, it can configure drivers in X11 server.

That's awesome :)


> I started to work on this extension and I have few doubts
> 
>  1. https://gitlab.freedesktop.org/mesa/mesa/blob/master/src/glx/dri_glx.c#L254
>     this functions gets the driver configs in X11. what is the use of
>     this line? what does it do? why we are doing mutex_lock at start and
>     mutex_unlock at end? I saw this in many other functions also.

Are you asking what a mutex is? Just look it up on Wikipedia :)

In this particular case, the function is reading and possibly writing a 
global data structure, namely the driver_config_cache.

If multiple threads were to access the structure simultaneously, we'd 
obviously be in serious trouble (e.g., two threads modify the list at 
the same time, leading to memory leaks or, worse, corruption), and the 
mutex protects against this.

Remember, there's nothing preventing two threads from calling that 
function simultaneously.

(In some other cases in GL / GLX, some protections exist. For example, 
two threads cannot simultaneously call a GL function on the same 
context. So a GL function which only accesses per-context data doesn't 
need any locking. However, GL functions that access data which may be 
shared between contexts, such as textures, do need locking.)


> On Wed, Aug 22, 2018 at 11:23 AM Nicolai Hähnle <nicolai.haehnle at amd.com 
> <mailto:nicolai.haehnle at amd.com>> wrote:
> 
>     In a separate email, Rob wrote:
> 
>       > so, it was earlier discussed that
>       > glXGetScreenDriver()/glXGetDriverConfig() equivalents could be
>     lumped
>       > into this extension, which is I guess not what you have done.
> 
>     I'm fairly agnostic on this, but if you do lump it into one extension,
>     please make the GetDriverConfig part optional.
> 
> 2. How to make this part optional?

The extension should probably say somewhere that the function must 
exist, but it's correct to return NULL instead of a string containing 
the XML which describes driver config options.

(There are other possibilities, but that one just makes sense to me.)

Cheers,
Nicolai


> 
> 
>     There are non-Mesa drivers which implement GLX_MESA_query_renderer, and
>     it'd be good if the same were at least possible for
>     EGL_MESA_query_renderer as well.
> 
>     Cheers,
>     Nicolai
> 
> 
> Cheers,
> Veluri.



More information about the mesa-dev mailing list