---

I finally got around to testing your buffer age code.  It's pretty
close to working, but it turns out the other tests I wanted to add
caught bugs.  So, here's improvement to the testcase, and I'll send
out Mesa patches in a moment.  I'd like to squash patches 1-3 in with
your patch, in which case I'd put my Reviewed-by on it.  Then patch 4
and 5 are actual new functionality, that I'd probably leave as
separate commits.

Does this look good to you, Adel?  If so, a reviewed-by from you for
4/5 means we can land this whole thing.

 tests/glx/glx-buffer-age.c | 97 ++++++++++++++++++++++++----------------------
 1 file changed, 50 insertions(+), 47 deletions(-)

diff --git a/tests/glx/glx-buffer-age.c b/tests/glx/glx-buffer-age.c
index 8c19ef0..55ac4a3 100644
--- a/tests/glx/glx-buffer-age.c
+++ b/tests/glx/glx-buffer-age.c
@@ -51,65 +51,68 @@ static XVisualInfo *visinfo;
 enum piglit_result
 draw(Display *dpy)
 {
-    GLXContext ctx;
-    GLboolean pass;
-    unsigned int age;
-    int i;
-    static GLfloat colors[3][4] = {{1.0, 0.0, 0.0, 1.0},
-                                   {0.0, 1.0, 0.0, 1.0},
-                                   {0.0, 0.0, 1.0, 1.0}};
-    GLfloat probe[4];
-    enum piglit_result result;
-
-    ctx = piglit_get_glx_context(dpy, visinfo);
-    glXMakeCurrent(dpy, window, ctx);
-    piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
-    for (i = 0; i < 3; i++) {
-        glClearColor(colors[i][0], colors[i][1], colors[i][2], colors[i][3]);
-        glClear(GL_COLOR_BUFFER_BIT);
-        glXSwapBuffers(dpy, window);
-    }
-
-    glXQueryDrawable(dpy, window, GLX_BACK_BUFFER_AGE_EXT, &age);
-
-    if (age == 0 || age > 3) {
-        result = PIGLIT_SKIP;
-        goto out;
-    }
-
-    glReadBuffer(GL_BACK);
-    pass = piglit_probe_pixel_rgba_silent(0, 0, colors[3 - age], probe);
-    result = pass ? PIGLIT_PASS : PIGLIT_FAIL;
+       GLXContext ctx;
+       GLboolean pass;
+       unsigned int age;
+       int i;
+       static GLfloat colors[3][4] = {{1.0, 0.0, 0.0, 1.0},
+                                      {0.0, 1.0, 0.0, 1.0},
+                                      {0.0, 0.0, 1.0, 1.0}};
+       GLfloat probe[4];
+       enum piglit_result result;
+
+       ctx = piglit_get_glx_context(dpy, visinfo);
+       glXMakeCurrent(dpy, window, ctx);
+       piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
+
+       for (i = 0; i < 3; i++) {
+               glClearColor(colors[i][0],
+                            colors[i][1],
+                            colors[i][2],
+                            colors[i][3]);
+               glClear(GL_COLOR_BUFFER_BIT);
+               glXSwapBuffers(dpy, window);
+       }
+
+       glXQueryDrawable(dpy, window, GLX_BACK_BUFFER_AGE_EXT, &age);
+
+       if (age == 0 || age > 3) {
+               result = PIGLIT_SKIP;
+               goto out;
+       }
+
+       glReadBuffer(GL_BACK);
+       pass = piglit_probe_pixel_rgba_silent(0, 0, colors[3 - age], probe);
+       result = pass ? PIGLIT_PASS : PIGLIT_FAIL;
 
 out:
-    glXMakeCurrent(dpy, None, NULL);
-    glXDestroyContext(dpy, ctx);
+       glXMakeCurrent(dpy, None, NULL);
+       glXDestroyContext(dpy, ctx);
 
-    return result;
+       return result;
 }
 
 
 int
 main(int argc, char **argv)
 {
-    int i;
+       int i;
 
-    for(i = 1; i < argc; i++) {
-        if (!strcmp(argv[i], "-auto"))
-            piglit_automatic = 1;
-        else
-            fprintf(stderr, "Unknown option: %s\n", argv[i]);
-    }
+       for(i = 1; i < argc; i++) {
+               if (!strcmp(argv[i], "-auto"))
+                       piglit_automatic = 1;
+               else
+                       fprintf(stderr, "Unknown option: %s\n", argv[i]);
+       }
 
-    dpy = piglit_get_glx_display();
-    piglit_require_glx_extension(dpy, "EXT_buffer_age");
-    visinfo = piglit_get_glx_visual(dpy);
-    window = piglit_get_glx_window(dpy, visinfo);
+       dpy = piglit_get_glx_display();
+       piglit_require_glx_extension(dpy, "EXT_buffer_age");
+       visinfo = piglit_get_glx_visual(dpy);
+       window = piglit_get_glx_window(dpy, visinfo);
 
-    XMapWindow(dpy, window);
+       XMapWindow(dpy, window);
 
-    piglit_glx_event_loop(dpy, draw);
+       piglit_glx_event_loop(dpy, draw);
 
-    return 0;
+       return 0;
 }
-- 
1.9.0

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to