[Mesa-dev] mesa/llvmpipe select alpha visual

Roland Scheidegger sroland at vmware.com
Sat Oct 1 00:46:13 UTC 2016


Am 30.09.2016 um 01:49 schrieb Thomas Søndergaard:
> My application window becomes transparent when I run my application with
> llvmpipe by setting LD_LIBRARY_PATH instead of the proprietary NVIDIA
> driver that I otherwise use. I've come to the understanding, after
> digging into the code for a few hours, that mesa selects this Visual
> even though my application hasn't asked for an alpha channel:
> 
> Visual ID: 23  depth=32  class=TrueColor, type=(none)
>     bufferSize=32 level=0 renderType=rgba doubleBuffer=1 stereo=0
>     rgba: redSize=8 greenSize=8 blueSize=8 alphaSize=8 float=N sRGB=N
>     auxBuffers=0 depthSize=24 stencilSize=8
>     accum: redSize=16 greenSize=16 blueSize=16 alphaSize=0
>     multiSample=0  multiSampleBuffers=0
>     visualCaveat=None
> 
> My application uses Qt-5 and if I modify it to not set
> 
> GLX_RED_SIZE=1
> GLX_GREEN_SIZE=1
> GLX_BLUE_SIZE=1
> 
> Then I get the following visual instead and my window is no longer
> blended with the background based on the alpha values in the framebuffer.
> 
> Visual ID: 21  depth=24  class=TrueColor, type=(none)
>     bufferSize=24 level=0 renderType=rgba doubleBuffer=1 stereo=0
>     rgba: redSize=8 greenSize=8 blueSize=8 alphaSize=8 float=N sRGB=N
>     auxBuffers=0 depthSize=24 stencilSize=8
>     accum: redSize=16 greenSize=16 blueSize=16 alphaSize=16
>     multiSample=0  multiSampleBuffers=0
>     visualCaveat=None
>     Opaque.
> 
> I've digged a little in the mesa code and I can see that if either of
> GLX_RED_SIZE, GLX_GREEN_SIZE and GLX_BLUE_SIZE is set then
> choose_x_visual() in mesa/src/gallium/state_trackers/glx/xlib/glx_api.c
> starts the search for a visual from the deep end, where-as if none of
> them are set it starts from the shallow end when searching for visuals?
> 
> Why does it do that?
> 
> The consequence is that I get a 32-bit visual visual with an alpha
> channel, even though I haven't asked for an alpha channel.
> 
> I've found out that I can set XLIB_SKIP_ARGB_VISUALS=1 as a workaround,
> but it would be nice with a real fix. Is there anything I can do to help?
> 
> Would it make sense to simply always search from the shallow end? Or to
> only search from 24-bit and down if GLX_ALPHA_SIZE is 0? I saw a comment
> in rc/gallium/state_trackers/glx/xlib/glx_api.cc that mesa is limited to
> 8-bit per channel, so there doesn't seem to be any point in looking for
> a visual with higher depth if we don't want alpha.
> 
> That was a long mail - if you got this far, I thank you for your
> patience :-)
> 

I'm not familiar with this code but presumably the xlib code is less
tested than dri one, so if it differs there changing it probably
wouldn't hurt.
IIRC in the past there were actually apps which were quite sensitive to
this stuff (for instance, things like not requesting depth buffer and
still expecting one and similar), albeit the apps were buggy in this case.
I'm not actually even sure that even with visual which has alpha this
should actually be visible in the end? Totally not my area of expertise,
unfortunately...

Roland




More information about the mesa-dev mailing list