[Piglit] [PATCH 1/4] utils/glx: Don't create X pixmaps deeper than the root window.

Mario Kleiner mario.kleiner.de at gmail.com
Wed Sep 6 08:22:58 UTC 2017


On 09/06/2017 10:20 AM, Michel Dänzer wrote:
> On 06/09/17 05:13 PM, Mario Kleiner wrote:
>> On 09/06/2017 09:30 AM, Michel Dänzer wrote:
>>> On 05/09/17 02:52 PM, Mario Kleiner wrote:
>>>> XCreatePixmap doesn't like that. Fixes piglit regression if the
>>>> GL implementation exposes RGB10 depth 30 FBConfigs, but the X-Screen
>>>> is set to default DefaultDepth of 24 bits, and therefore the root
>>>> window only supports depth 24 pixmaps.
>>>>
>>>> On RGB10 enabled Mesa fixes these tests on depth 24 screen:
>>>>
>>>> glx-visuals-depth -pixmap
>>>> glx-visuals-stencil -pixmap
>>>>
>>>> Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
>>>> ---
>>>>    tests/util/piglit-glx-util.c | 6 ++++++
>>>>    1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
>>>> index 95e33ae..643692a 100644
>>>> --- a/tests/util/piglit-glx-util.c
>>>> +++ b/tests/util/piglit-glx-util.c
>>>> @@ -273,6 +273,7 @@ piglit_glx_iterate_pixmap_fbconfigs(enum
>>>> piglit_result (*draw)(Display *dpy,
>>>>        bool any_fail = false;
>>>>        bool any_pass = false;
>>>>        Window root_win;
>>>> +    int root_depth;
>>>>          Display *dpy = XOpenDisplay(NULL);
>>>>        if (!dpy) {
>>>> @@ -281,6 +282,7 @@ piglit_glx_iterate_pixmap_fbconfigs(enum
>>>> piglit_result (*draw)(Display *dpy,
>>>>        }
>>>>        screen = DefaultScreen(dpy);
>>>>        root_win = RootWindow(dpy, screen);
>>>> +    root_depth = DefaultDepth(dpy, screen);
>>>>          configs = glXGetFBConfigs(dpy, screen, &n_configs);
>>>>        if (!configs) {
>>>> @@ -305,6 +307,10 @@ piglit_glx_iterate_pixmap_fbconfigs(enum
>>>> piglit_result (*draw)(Display *dpy,
>>>>              glXGetFBConfigAttrib(dpy, config, GLX_BUFFER_SIZE,
>>>>                         &depth);
>>>> +
>>>> +        if (depth > root_depth)
>>>> +            continue;
>>>> +
>>>>            ctx = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE,
>>>>                          NULL, true);
>>>>            pix = XCreatePixmap(dpy, root_win,
>>>>
>>>
>>> This is not correct. This X server, running at depth 24, supports the
>>> following pixmap depths according to xdpyinfo:
>>>
>>> number of supported pixmap formats:    7
>>> supported pixmap formats:
>>>       depth 1, bits_per_pixel 1, scanline_pad 32
>>>       depth 4, bits_per_pixel 8, scanline_pad 32
>>>       depth 8, bits_per_pixel 8, scanline_pad 32
>>>       depth 15, bits_per_pixel 16, scanline_pad 32
>>>       depth 16, bits_per_pixel 16, scanline_pad 32
>>>       depth 24, bits_per_pixel 32, scanline_pad 32
>>>       depth 32, bits_per_pixel 32, scanline_pad 32
>>>
>>> It sounds like this doesn't list depth 30 for you, which indicates an
>>> issue with the Xorg (driver) changes for depth 30 support.
>>
>> What i see is the same as above for DefaultDepth 24, but for
>> DefaultDepth 30 i additionally get
>>
>>        depth 30, bits_per_pixel 32, scanline_pad 32
> 
> A side point is that the X server should at least theoretically be able
> to support depth 30 pixmaps even if the screen depth != 30.
> 
> 
>> But i think re-reading the XCreatePixmap man page i think i know what
>> you mean. It actually says "The depth argument must be one of the depths
>> supported by the screen of the specified drawable, or a BadValue error
>> results."
>>
>> So that check is too strict, as it doesn't matter what the root window
>> has by default, but what the screen associated with the root window
>> supports.
>>
>> So i think a proper check would be to get all supported depths via
>> XListDepths() and then skip configs with a 'depth' that isn't contained
>> in the returned list?
> 
> Exactly.
> 

Ok, i'll change that. Thanks.


More information about the Piglit mailing list