Improve glFlush() & glFinish() tests
authorPyry Haulos <phaulos@google.com>
Wed, 6 May 2015 20:32:39 +0000 (13:32 -0700)
committerPyry Haulos <phaulos@google.com>
Wed, 6 May 2015 20:32:39 +0000 (13:32 -0700)
 * Use tcu::warmupCPU() instead of simple busy wait for warmup.

 * Ensure that wait time is always longer than estimated render time.

Change-Id: I891771d41a9bd48e58ad493f4b4dc7f28c571c30

modules/gles2/functional/es2fFlushFinishTests.cpp
modules/gles3/functional/es3fFlushFinishTests.cpp

index 9256e08..0c865a3 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "tcuTestLog.hpp"
 #include "tcuRenderTarget.hpp"
+#include "tcuCPUWarmup.hpp"
 
 #include "glwEnums.hpp"
 #include "glwFunctions.hpp"
@@ -421,8 +422,7 @@ FlushFinishCase::IterateResult FlushFinishCase::iterate (void)
        vector<Sample>          samples         (NUM_SAMPLES);
        CalibrationParams       params;
 
-       // Try to poke CPU into full speed. \todo [2013-12-26 pyry] Use more robust method.
-       busyWait(10);
+       tcu::warmupCPU();
 
        setupRenderState();
 
index 19da1c1..5ee2d26 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "tcuTestLog.hpp"
 #include "tcuRenderTarget.hpp"
+#include "tcuCPUWarmup.hpp"
 
 #include "glwEnums.hpp"
 #include "glwFunctions.hpp"
@@ -63,14 +64,16 @@ namespace
 enum
 {
        MAX_VIEWPORT_SIZE               = 256,
-       MAX_SAMPLE_DURATION_US  = 200*1000,
-       WAIT_TIME_MS                    = 150,
+       MAX_SAMPLE_DURATION_US  = 150*1000,
+       WAIT_TIME_MS                    = 200,
        MIN_DRAW_CALL_COUNT             = 10,
        MAX_DRAW_CALL_COUNT             = 1<<20,
        MAX_SHADER_ITER_COUNT   = 1<<10,
        NUM_SAMPLES                             = 50
 };
 
+DE_STATIC_ASSERT(MAX_SAMPLE_DURATION_US < 1000*WAIT_TIME_MS);
+
 const float            NO_CORR_COEF_THRESHOLD          = 0.1f;
 const float            FLUSH_COEF_THRESHOLD            = 0.2f;
 const float            CORRELATED_COEF_THRESHOLD       = 0.5f;
@@ -492,8 +495,7 @@ FlushFinishCase::IterateResult FlushFinishCase::iterate (void)
        vector<Sample>          samples         (NUM_SAMPLES);
        CalibrationParams       params;
 
-       // Try to poke CPU into full speed. \todo [2013-12-26 pyry] Use more robust method.
-       busyWait(10);
+       tcu::warmupCPU();
 
        setupRenderState();