tests: don't delay/skip frames due to glReadPixel concerns
authorRobert Bragg <robert@linux.intel.com>
Thu, 8 Jul 2010 18:20:33 +0000 (19:20 +0100)
committerRobert Bragg <robert@linux.intel.com>
Thu, 8 Jul 2010 21:40:35 +0000 (22:40 +0100)
This greatly speeds up running all the conformance tests by no longer
delaying many of the tests for a number of dummy frames to be painted.

We used to skip frames because we thought there was a problem with the
driver's glReadPixels implementation. Although we have seen driver
issues at times the real reason the delay was needed was because
resizing the stage usually happens asynchronously (because a non
synchronous X request is used by clutter_stage_set_size()). We now force
all X requests to be synchronized for the conformance tests so this is
no longer a problem and we can avoid these hacks.

16 files changed:
tests/conform/test-cogl-blend-strings.c
tests/conform/test-cogl-depth-test.c
tests/conform/test-cogl-materials.c
tests/conform/test-cogl-multitexture.c
tests/conform/test-cogl-npot-texture.c
tests/conform/test-cogl-pixel-buffer.c
tests/conform/test-cogl-premult.c
tests/conform/test-cogl-sub-texture.c
tests/conform/test-cogl-texture-mipmaps.c
tests/conform/test-cogl-texture-rectangle.c
tests/conform/test-cogl-vertex-buffer-contiguous.c
tests/conform/test-cogl-vertex-buffer-interleved.c
tests/conform/test-cogl-vertex-buffer-mutability.c
tests/conform/test-cogl-wrap-modes.c
tests/conform/test-pick.c
tests/conform/test-texture-fbo.c

index 6c09ed5..1024d17 100644 (file)
@@ -24,7 +24,6 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
 
 typedef struct _TestState
 {
-  guint frame;
   ClutterGeometry stage_geom;
 } TestState;
 
@@ -127,12 +126,6 @@ test_blend (TestState *state,
   y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2);
   x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2);
 
-  /* XXX:
-   * We haven't always had good luck with GL drivers implementing glReadPixels
-   * reliably and skipping the first two frames improves our chances... */
-  if (state->frame <= 2)
-    return;
-
   cogl_read_pixels (x_off, y_off, 1, 1,
                     COGL_READ_PIXELS_COLOR_BUFFER,
                     COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -257,12 +250,6 @@ test_tex_combine (TestState *state,
   y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2);
   x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2);
 
-  /* XXX:
-   * We haven't always had good luck with GL drivers implementing glReadPixels
-   * reliably and skipping the first two frames improves our chances... */
-  if (state->frame <= 2)
-    return;
-
   cogl_read_pixels (x_off, y_off, 1, 1,
                     COGL_READ_PIXELS_COLOR_BUFFER,
                     COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -287,8 +274,6 @@ test_tex_combine (TestState *state,
 static void
 on_paint (ClutterActor *actor, TestState *state)
 {
-  int frame_num;
-
   test_blend (state, 0, 0, /* position */
               0xff0000ff, /* src */
               0xffffffff, /* dst */
@@ -401,19 +386,8 @@ on_paint (ClutterActor *actor, TestState *state)
                     "A = REPLACE (PREVIOUS)",
                     0x2a2a2abb); /* expected */
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  frame_num = state->frame++;
-  if (frame_num < 2)
-    g_usleep (G_USEC_PER_SEC);
-
   /* Comment this out if you want visual feedback for what this test paints */
-#if 1
-  if (frame_num == 3)
-    clutter_main_quit ();
-#endif
+  clutter_main_quit ();
 }
 
 static gboolean
@@ -433,8 +407,6 @@ test_cogl_blend_strings (TestConformSimpleFixture *fixture,
   ClutterActor *group;
   guint idle_source;
 
-  state.frame = 0;
-
   stage = clutter_stage_get_default ();
 
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
@@ -443,9 +415,9 @@ test_cogl_blend_strings (TestConformSimpleFixture *fixture,
   group = clutter_group_new ();
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
 
-  /* We force continuous redrawing of the stage, since we need to skip
-   * the first few frames, and we wont be doing anything else that
-   * will trigger redrawing. */
+  /* We force continuous redrawing incase someone comments out the
+   * clutter_main_quit and wants visual feedback for the test since we
+   * wont be doing anything else that will trigger redrawing. */
   idle_source = g_idle_add (queue_redraw, stage);
 
   g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
index 4cc36c6..4ea545a 100644 (file)
@@ -26,7 +26,6 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
 
 typedef struct _TestState
 {
-  guint frame;
   ClutterGeometry stage_geom;
 } TestState;
 
@@ -136,12 +135,6 @@ test_depth (TestState *state,
   y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2);
   x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2);
 
-  /* XXX:
-   * We haven't always had good luck with GL drivers implementing glReadPixels
-   * reliably and skipping the first two frames improves our chances... */
-  if (state->frame <= 2)
-    return;
-
   cogl_read_pixels (x_off, y_off, 1, 1,
                     COGL_READ_PIXELS_COLOR_BUFFER,
                     COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -153,7 +146,6 @@ test_depth (TestState *state,
 static void
 on_paint (ClutterActor *actor, TestState *state)
 {
-  int frame_num;
   CoglMatrix projection_save;
   CoglMatrix identity;
 
@@ -294,18 +286,7 @@ on_paint (ClutterActor *actor, TestState *state)
   cogl_pop_matrix ();
   cogl_set_projection_matrix (&projection_save);
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds: */
-  frame_num = state->frame++;
-  if (frame_num < 2)
-    g_usleep (G_USEC_PER_SEC);
-
-  /* Comment this out if you want visual feedback for what this test paints */
-#if 1
-  if (frame_num == 3)
-    clutter_main_quit ();
-#endif
+  clutter_main_quit ();
 }
 
 static gboolean
@@ -325,8 +306,6 @@ test_cogl_depth_test (TestConformSimpleFixture *fixture,
   ClutterActor *group;
   guint idle_source;
 
-  state.frame = 0;
-
   stage = clutter_stage_get_default ();
 
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
@@ -335,9 +314,9 @@ test_cogl_depth_test (TestConformSimpleFixture *fixture,
   group = clutter_group_new ();
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
 
-  /* We force continuous redrawing of the stage, since we need to skip
-   * the first few frames, and we wont be doing anything else that
-   * will trigger redrawing. */
+  /* We force continuous redrawing incase someone comments out the
+   * clutter_main_quit and wants visual feedback for the test since we
+   * wont be doing anything else that will trigger redrawing. */
   idle_source = g_idle_add (queue_redraw, stage);
 
   g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
index ebc3474..8ea013f 100644 (file)
@@ -20,11 +20,8 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
 #define MASK_BLUE(COLOR)  ((COLOR & 0xff00) >> 8);
 #define MASK_ALPHA(COLOR) (COLOR & 0xff);
 
-#define SKIP_FRAMES 2
-
 typedef struct _TestState
 {
-  guint frame;
   ClutterGeometry stage_geom;
 } TestState;
 
@@ -46,12 +43,6 @@ check_pixel (TestState *state, int x, int y, guint32 color)
   y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2);
   x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2);
 
-  /* XXX:
-   * We haven't always had good luck with GL drivers implementing glReadPixels
-   * reliably and skipping the first two frames improves our chances... */
-  if (state->frame <= SKIP_FRAMES)
-    return;
-
   cogl_read_pixels (x_off, y_off, 1, 1,
                     COGL_READ_PIXELS_COLOR_BUFFER,
                     COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -226,8 +217,6 @@ test_invalid_texture_layers_with_constant_colors (TestState *state,
 static void
 on_paint (ClutterActor *actor, TestState *state)
 {
-  int frame_num;
-
   test_invalid_texture_layers (state,
                                0, 0 /* position */
                                );
@@ -238,18 +227,9 @@ on_paint (ClutterActor *actor, TestState *state)
                          2, 0 /* position */
                          );
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  frame_num = state->frame++;
-  if (frame_num < SKIP_FRAMES)
-    g_usleep (G_USEC_PER_SEC);
-
   /* Comment this out if you want visual feedback for what this test paints */
 #if 1
-  if (frame_num > SKIP_FRAMES)
-    clutter_main_quit ();
+  clutter_main_quit ();
 #endif
 }
 
@@ -270,8 +250,6 @@ test_cogl_materials (TestConformSimpleFixture *fixture,
   ClutterActor *group;
   guint idle_source;
 
-  state.frame = 0;
-
   stage = clutter_stage_get_default ();
 
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
index 97b01ed..6f8305a 100644 (file)
@@ -15,7 +15,7 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
 
 typedef struct _TestState
 {
-  guint frame;
+  guint padding;
 } TestState;
 
 static void
@@ -111,15 +111,6 @@ on_paint (ClutterActor *actor, TestState *state)
     0.5, 0.5, 1, 1 /* tex1 */
   };
 
-  /* XXX:
-   * We haven't always had good luck with GL drivers implementing glReadPixels
-   * reliably and skipping the first two frames improves our chances... */
-  if (state->frame++ <= 2)
-    {
-      g_usleep (G_USEC_PER_SEC);
-      return;
-    }
-
   tex0 = make_texture (0x00);
   tex1 = make_texture (0x11);
 
@@ -191,8 +182,6 @@ test_cogl_multitexture (TestConformSimpleFixture *fixture,
   ClutterActor *group;
   guint idle_source;
 
-  state.frame = 0;
-
   stage = clutter_stage_get_default ();
 
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
@@ -200,9 +189,9 @@ test_cogl_multitexture (TestConformSimpleFixture *fixture,
   group = clutter_group_new ();
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
 
-  /* We force continuous redrawing of the stage, since we need to skip
-   * the first few frames, and we wont be doing anything else that
-   * will trigger redrawing. */
+  /* We force continuous redrawing incase someone comments out the
+   * clutter_main_quit and wants visual feedback for the test since we
+   * wont be doing anything else that will trigger redrawing. */
   idle_source = g_idle_add (queue_redraw, stage);
 
   g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
index 8ca9206..9466de5 100644 (file)
@@ -95,17 +95,12 @@ on_paint (ClutterActor *actor, TestState *state)
   cogl_set_source_texture (state->texture);
   cogl_rectangle (0, 0, TEXTURE_RENDER_SIZE, TEXTURE_RENDER_SIZE);
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  /* Need to increment frame first because clutter_stage_read_pixels
-     fires a redraw */
+  /* XXX: validate_result calls clutter_stage_read_pixels which will result in
+   * another paint run so to avoid infinite recursion we only aim to validate
+   * the first frame. */
   frame_num = state->frame++;
-  if (frame_num == 2)
+  if (frame_num == 1)
     validate_result (state);
-  else if (frame_num < 2)
-    g_usleep (G_USEC_PER_SEC);
 }
 
 static gboolean
index 20f51b5..112c646 100644 (file)
@@ -247,17 +247,12 @@ on_paint (ClutterActor *actor, TestState *state)
 
   draw_frame (state);
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  /* Need to increment frame first because clutter_stage_read_pixels
-     fires a redraw */
+  /* XXX: validate_result calls clutter_stage_read_pixels which will result in
+   * another paint run so to avoid infinite recursion we only aim to validate
+   * the first frame. */
   frame_num = state->frame++;
-  if (frame_num == 2)
+  if (frame_num == 1)
     validate_result (state);
-  else if (frame_num < 2)
-    g_usleep (G_USEC_PER_SEC);
 }
 
 static gboolean
index caaa24e..4ebafb1 100644 (file)
@@ -19,11 +19,8 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
 #define MASK_BLUE(COLOR)  ((COLOR & 0xff00) >> 8);
 #define MASK_ALPHA(COLOR) (COLOR & 0xff);
 
-#define SKIP_FRAMES 2
-
 typedef struct _TestState
 {
-  guint frame;
   ClutterGeometry stage_geom;
   CoglHandle passthrough_material;
 } TestState;
@@ -118,12 +115,6 @@ check_texture (TestState *state,
   y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2);
   x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2);
 
-  /* XXX:
-   * We haven't always had good luck with GL drivers implementing glReadPixels
-   * reliably and skipping the first two frames improves our chances... */
-  if (state->frame <= SKIP_FRAMES)
-    return;
-
   cogl_read_pixels (x_off, y_off, 1, 1,
                     COGL_READ_PIXELS_COLOR_BUFFER,
                     COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -141,13 +132,12 @@ check_texture (TestState *state,
 static void
 on_paint (ClutterActor *actor, TestState *state)
 {
-  int frame_num;
   CoglHandle tex;
   guchar *tex_data;
 
   /* If the user explicitly specifies an unmultiplied internal format then
    * Cogl shouldn't automatically premultiply the given texture data... */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("make_texture (0xff00ff80, "
                             "src = RGBA_8888, internal = RGBA_8888)\n");
   tex = make_texture (0xff00ff80,
@@ -160,7 +150,7 @@ on_paint (ClutterActor *actor, TestState *state)
   /* If the user explicitly requests a premultiplied internal format and
    * gives unmultiplied src data then Cogl should always premultiply that
    * for us */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("make_texture (0xff00ff80, "
                             "src = RGBA_8888, internal = RGBA_8888_PRE)\n");
   tex = make_texture (0xff00ff80,
@@ -174,7 +164,7 @@ on_paint (ClutterActor *actor, TestState *state)
    * by default Cogl should premultiply the given texture data...
    * (In the future there will be additional Cogl API to control this
    *  behaviour) */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("make_texture (0xff00ff80, "
                             "src = RGBA_8888, internal = ANY)\n");
   tex = make_texture (0xff00ff80,
@@ -187,7 +177,7 @@ on_paint (ClutterActor *actor, TestState *state)
   /* If the user requests a premultiplied internal texture format and supplies
    * premultiplied source data, Cogl should never modify that source data...
    */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("make_texture (0x80008080, "
                             "src = RGBA_8888_PRE, "
                             "internal = RGBA_8888_PRE)\n");
@@ -201,7 +191,7 @@ on_paint (ClutterActor *actor, TestState *state)
   /* If the user requests an unmultiplied internal texture format, but
    * supplies premultiplied source data, then Cogl should always
    * un-premultiply the source data... */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("make_texture (0x80008080, "
                             "src = RGBA_8888_PRE, internal = RGBA_8888)\n");
   tex = make_texture (0x80008080,
@@ -215,7 +205,7 @@ on_paint (ClutterActor *actor, TestState *state)
    * source data then by default Cogl shouldn't modify the source data...
    * (In the future there will be additional Cogl API to control this
    *  behaviour) */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("make_texture (0x80008080, "
                             "src = RGBA_8888_PRE, internal = ANY)\n");
   tex = make_texture (0x80008080,
@@ -229,13 +219,13 @@ on_paint (ClutterActor *actor, TestState *state)
    * Test cogl_texture_set_region() ....
    */
 
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("make_texture (0xDEADBEEF, "
                             "src = RGBA_8888, internal = RGBA_8888)\n");
   tex = make_texture (0xDEADBEEF,
                       COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
                       COGL_PIXEL_FORMAT_RGBA_8888); /* internal format */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("set_region (0xff00ff80, RGBA_8888)\n");
   tex_data = gen_tex_data (0xff00ff80);
   cogl_texture_set_region (tex,
@@ -253,13 +243,13 @@ on_paint (ClutterActor *actor, TestState *state)
   /* Updating a texture region for an unmultiplied texture using premultiplied
    * region data should result in Cogl unmultiplying the given region data...
    */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("make_texture (0xDEADBEEF, "
                             "src = RGBA_8888, internal = RGBA_8888)\n");
   tex = make_texture (0xDEADBEEF,
                       COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
                       COGL_PIXEL_FORMAT_RGBA_8888); /* internal format */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
   tex_data = gen_tex_data (0x80008080);
   cogl_texture_set_region (tex,
@@ -275,14 +265,14 @@ on_paint (ClutterActor *actor, TestState *state)
                  0xff00ff80); /* expected */
 
 
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("make_texture (0xDEADBEEF, "
                             "src = RGBA_8888_PRE, "
                             "internal = RGBA_8888_PRE)\n");
   tex = make_texture (0xDEADBEEF,
                       COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
                       COGL_PIXEL_FORMAT_RGBA_8888_PRE); /* internal format */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
   tex_data = gen_tex_data (0x80008080);
   cogl_texture_set_region (tex,
@@ -301,14 +291,14 @@ on_paint (ClutterActor *actor, TestState *state)
   /* Updating a texture region for a premultiplied texture using unmultiplied
    * region data should result in Cogl premultiplying the given region data...
    */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("make_texture (0xDEADBEEF, "
                             "src = RGBA_8888_PRE, "
                             "internal = RGBA_8888_PRE)\n");
   tex = make_texture (0xDEADBEEF,
                       COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
                       COGL_PIXEL_FORMAT_RGBA_8888_PRE); /* internal format */
-  if (state->frame > SKIP_FRAMES && g_test_verbose ())
+  if (g_test_verbose ())
     g_print ("set_region (0xff00ff80, RGBA_8888)\n");
   tex_data = gen_tex_data (0xff00ff80);
   cogl_texture_set_region (tex,
@@ -323,20 +313,8 @@ on_paint (ClutterActor *actor, TestState *state)
                  tex,
                  0x80008080); /* expected */
 
-
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  frame_num = state->frame++;
-  if (frame_num < SKIP_FRAMES)
-    g_usleep (G_USEC_PER_SEC);
-
   /* Comment this out if you want visual feedback for what this test paints */
-#if 1
-  if (frame_num > SKIP_FRAMES)
-    clutter_main_quit ();
-#endif
+  clutter_main_quit ();
 }
 
 static gboolean
@@ -356,7 +334,6 @@ test_cogl_premult (TestConformSimpleFixture *fixture,
   ClutterActor *group;
   guint idle_source;
 
-  state.frame = 0;
   state.passthrough_material = cogl_material_new ();
   cogl_material_set_blend (state.passthrough_material,
                            "RGBA = ADD (SRC_COLOR, 0)", NULL);
@@ -371,9 +348,9 @@ test_cogl_premult (TestConformSimpleFixture *fixture,
   group = clutter_group_new ();
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
 
-  /* We force continuous redrawing of the stage, since we need to skip
-   * the first few frames, and we wont be doing anything else that
-   * will trigger redrawing. */
+  /* We force continuous redrawing incase someone comments out the
+   * clutter_main_quit and wants visual feedback for the test since we
+   * wont be doing anything else that will trigger redrawing. */
   idle_source = g_idle_add (queue_redraw, stage);
 
   g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
index 49a278c..b876a68 100644 (file)
@@ -312,17 +312,12 @@ on_paint (ClutterActor *actor, TestState *state)
 
   draw_frame (state);
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  /* Need to increment frame first because clutter_stage_read_pixels
-     fires a redraw */
+  /* XXX: validate_result calls clutter_stage_read_pixels which will result in
+   * another paint run so to avoid infinite recursion we only aim to validate
+   * the first frame. */
   frame_num = state->frame++;
-  if (frame_num == 2)
+  if (frame_num == 1)
     validate_result (state);
-  else if (frame_num < 2)
-    g_usleep (G_USEC_PER_SEC);
 }
 
 static gboolean
index a07e1e6..d62b542 100644 (file)
@@ -10,7 +10,7 @@ static const ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
 
 typedef struct _TestState
 {
-  guint frame;
+  guint padding;
 } TestState;
 
 /* Creates a texture where the pixels are evenly divided between
@@ -51,15 +51,6 @@ on_paint (ClutterActor *actor, TestState *state)
   CoglHandle material;
   guint8 pixels[8];
 
-  /* XXX:
-   * We haven't always had good luck with GL drivers implementing glReadPixels
-   * reliably and skipping the first two frames improves our chances... */
-  if (state->frame++ <= 2)
-    {
-      g_usleep (G_USEC_PER_SEC);
-      return;
-    }
-
   tex = make_texture ();
   material = cogl_material_new ();
   cogl_material_set_layer (material, 0, tex);
@@ -120,8 +111,6 @@ test_cogl_texture_mipmaps (TestConformSimpleFixture *fixture,
   ClutterActor *group;
   guint idle_source;
 
-  state.frame = 0;
-
   stage = clutter_stage_get_default ();
 
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
index 3822c71..eed5383 100644 (file)
@@ -8,7 +8,6 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
 typedef struct _TestState
 {
   ClutterActor *stage;
-  guint frame;
 } TestState;
 
 static CoglHandle
@@ -198,21 +197,9 @@ validate_result (TestState *state)
 static void
 on_paint (ClutterActor *actor, TestState *state)
 {
-  int frame_num;
-
   draw_frame (state);
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  /* Need to increment frame first because clutter_stage_read_pixels
-     fires a redraw */
-  frame_num = state->frame++;
-  if (frame_num == 2)
-    validate_result (state);
-  else if (frame_num < 2)
-    g_usleep (G_USEC_PER_SEC);
+  validate_result (state);
 }
 
 static gboolean
@@ -257,8 +244,6 @@ test_cogl_texture_rectangle (TestConformSimpleFixture *fixture,
   guint idle_source;
   guint paint_handler;
 
-  state.frame = 0;
-
   state.stage = clutter_stage_get_default ();
 
   /* Check whether GL supports the rectangle extension. If not we'll
index 41766f7..dbc0697 100644 (file)
@@ -21,7 +21,6 @@ typedef struct _TestState
   CoglHandle texture;
   CoglHandle material;
   ClutterGeometry stage_geom;
-  guint frame;
 } TestState;
 
 static void
@@ -139,16 +138,7 @@ on_paint (ClutterActor *actor, TestState *state)
                            0, /* first */
                            3); /* count */
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  if (state->frame >= 2)
-    validate_result (state);
-  else
-    g_usleep (G_USEC_PER_SEC);
-
-  state->frame++;
+  validate_result (state);
 }
 
 static gboolean
@@ -177,8 +167,6 @@ test_cogl_vertex_buffer_contiguous (TestConformSimpleFixture *fixture,
     0x00, 0xff, 0x00, 0xff
   };
 
-  state.frame = 0;
-
   stage = clutter_stage_get_default ();
 
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
@@ -190,9 +178,9 @@ test_cogl_vertex_buffer_contiguous (TestConformSimpleFixture *fixture,
                          state.stage_geom.height);
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
 
-  /* We force continuous redrawing of the stage, since we need to skip
-   * the first few frames, and we wont be doing anything else that
-   * will trigger redrawing. */
+  /* We force continuous redrawing incase someone comments out the
+   * clutter_main_quit and wants visual feedback for the test since we
+   * wont be doing anything else that will trigger redrawing. */
   idle_source = g_idle_add (queue_redraw, stage);
 
   g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
index 46449d7..d8cd7cc 100644 (file)
@@ -16,7 +16,6 @@ typedef struct _TestState
 {
   CoglHandle buffer;
   ClutterGeometry stage_geom;
-  guint frame;
 } TestState;
 
 typedef struct _InterlevedVertex
@@ -72,16 +71,7 @@ on_paint (ClutterActor *actor, TestState *state)
                           0, /* first */
                           3); /* count */
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  if (state->frame >= 2)
-    validate_result (state);
-  else
-    g_usleep (G_USEC_PER_SEC);
-
-  state->frame++;
+  validate_result (state);
 }
 
 static gboolean
@@ -102,8 +92,6 @@ test_cogl_vertex_buffer_interleved (TestConformSimpleFixture *fixture,
   ClutterActor *group;
   guint idle_source;
 
-  state.frame = 0;
-
   stage = clutter_stage_get_default ();
 
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
@@ -115,9 +103,9 @@ test_cogl_vertex_buffer_interleved (TestConformSimpleFixture *fixture,
                          state.stage_geom.height);
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
 
-  /* We force continuous redrawing of the stage, since we need to skip
-   * the first few frames, and we wont be doing anything else that
-   * will trigger redrawing. */
+  /* We force continuous redrawing incase someone comments out the
+   * clutter_main_quit and wants visual feedback for the test since we
+   * wont be doing anything else that will trigger redrawing. */
   idle_source = g_idle_add (queue_redraw, stage);
 
   g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
index 32a52fe..023df61 100644 (file)
@@ -15,7 +15,6 @@ typedef struct _TestState
 {
   CoglHandle buffer;
   ClutterGeometry stage_geom;
-  guint frame;
 } TestState;
 
 static void
@@ -115,17 +114,7 @@ on_paint (ClutterActor *actor, TestState *state)
                           0, /* first */
                           3); /* count */
 
-
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  if (state->frame >= 2)
-    validate_result (state);
-  else
-    g_usleep (G_USEC_PER_SEC);
-
-  state->frame++;
+  validate_result (state);
 }
 
 static gboolean
@@ -146,8 +135,6 @@ test_cogl_vertex_buffer_mutability (TestConformSimpleFixture *fixture,
   ClutterActor *group;
   guint idle_source;
 
-  state.frame = 0;
-
   stage = clutter_stage_get_default ();
 
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
@@ -159,9 +146,9 @@ test_cogl_vertex_buffer_mutability (TestConformSimpleFixture *fixture,
                          state.stage_geom.height);
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
 
-  /* We force continuous redrawing of the stage, since we need to skip
-   * the first few frames, and we wont be doing anything else that
-   * will trigger redrawing. */
+  /* We force continuous redrawing incase someone comments out the
+   * clutter_main_quit and wants visual feedback for the test since we
+   * wont be doing anything else that will trigger redrawing. */
   idle_source = g_idle_add (queue_redraw, stage);
 
   g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
index 53e6103..0a5eaea 100644 (file)
@@ -11,7 +11,6 @@ typedef struct _TestState
 {
   ClutterActor *stage;
   CoglHandle texture;
-  guint frame;
 } TestState;
 
 static CoglHandle
@@ -273,21 +272,9 @@ validate_result (TestState *state)
 static void
 on_paint (ClutterActor *actor, TestState *state)
 {
-  int frame_num;
-
   draw_frame (state);
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  /* Need to increment frame first because clutter_stage_read_pixels
-     fires a redraw */
-  frame_num = state->frame++;
-  if (frame_num == 2)
-    validate_result (state);
-  else if (frame_num < 2)
-    g_usleep (G_USEC_PER_SEC);
+  validate_result (state);
 }
 
 static gboolean
@@ -306,8 +293,6 @@ test_cogl_wrap_modes (TestConformSimpleFixture *fixture,
   guint idle_source;
   guint paint_handler;
 
-  state.frame = 0;
-
   state.stage = clutter_stage_get_default ();
 
   clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color);
index cd36f28..d57c7d8 100644 (file)
@@ -149,7 +149,7 @@ test_pick (TestConformSimpleFixture *fixture,
 
   clutter_actor_show (state.stage);
 
-  g_timeout_add (250, (GSourceFunc) on_timeout, &state);
+  g_idle_add ((GSourceFunc) on_timeout, &state);
 
   clutter_main ();
 
index 3a8dbc6..c4a3819 100644 (file)
@@ -153,17 +153,12 @@ on_paint (ClutterActor *actor, TestState *state)
 {
   int frame_num;
 
-  /* XXX: Experiments have shown that for some buggy drivers, when using
-   * glReadPixels there is some kind of race, so we delay our test for a
-   * few frames and a few seconds:
-   */
-  /* Need to increment frame first because clutter_stage_read_pixels
-     fires a redraw */
+  /* XXX: validate_result calls clutter_stage_read_pixels which will result in
+   * another paint run so to avoid infinite recursion we only aim to validate
+   * the first frame. */
   frame_num = state->frame++;
-  if (frame_num == 2)
+  if (frame_num == 1)
     validate_result (state);
-  else if (frame_num < 2)
-    g_usleep (G_USEC_PER_SEC);
 }
 
 static gboolean