[Piglit] [PATCH 1/4] utils/glx: Don't create X pixmaps unsupported by x-screen. (v2)
Mario Kleiner
mario.kleiner.de at gmail.com
Thu Sep 7 02:43:26 UTC 2017
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 does not
support depth 30 pixmaps.
On RGB10 enabled Mesa fixes these tests on depth 24 screen:
glx-visuals-depth -pixmap
glx-visuals-stencil -pixmap
v2: Switch from checking against DefaultDepth of root window
to checking against XListDepths() list of supported depths,
as suggested by Michel.
Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
Cc: Michel Dänzer <michel.daenzer at amd.com>
---
tests/util/piglit-glx-util.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index 95e33ae..eca3249 100644
--- a/tests/util/piglit-glx-util.c
+++ b/tests/util/piglit-glx-util.c
@@ -269,10 +269,12 @@ piglit_glx_iterate_pixmap_fbconfigs(enum piglit_result (*draw)(Display *dpy,
int screen;
GLXFBConfig *configs;
int n_configs;
- int i;
+ int i, j;
bool any_fail = false;
bool any_pass = false;
Window root_win;
+ int *depths;
+ int n_depths;
Display *dpy = XOpenDisplay(NULL);
if (!dpy) {
@@ -288,6 +290,12 @@ piglit_glx_iterate_pixmap_fbconfigs(enum piglit_result (*draw)(Display *dpy,
piglit_report_result(PIGLIT_SKIP);
}
+ depths = XListDepths(dpy, screen, &n_depths);
+ if (!depths) {
+ fprintf(stderr, "No supported screen depths\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
for (i = 0; i < n_configs; i++) {
GLXFBConfig config = configs[i];
enum piglit_result result;
@@ -305,6 +313,11 @@ piglit_glx_iterate_pixmap_fbconfigs(enum piglit_result (*draw)(Display *dpy,
glXGetFBConfigAttrib(dpy, config, GLX_BUFFER_SIZE,
&depth);
+
+ for (j = 0; (j < n_depths) && (depth != depths[j]); j++);
+ if (j == n_depths)
+ continue;
+
ctx = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE,
NULL, true);
pix = XCreatePixmap(dpy, root_win,
@@ -323,6 +336,8 @@ piglit_glx_iterate_pixmap_fbconfigs(enum piglit_result (*draw)(Display *dpy,
glXDestroyContext(dpy, ctx);
}
+ XFree(depths);
+
if (any_fail)
return PIGLIT_FAIL;
else if (any_pass)
--
2.7.4
More information about the Piglit
mailing list