perf_tests: Work around stalls in gl_null test teardown.

The Clear command in the draw call benchmark was not being properly
no-op'ed. This would cause the driver to get a huge queue of GL
command, which it would only flush when the test was torn down. This
manifested as a 5+ second stall on test teardown.

Looking at the clear command, it does some work with binding
and then calling GL functions, so properly filtering out the driver
commands would be a bit more complicated. For now, we can hack in a
workaround for the draw call test (the only one that uses the GL
NULL renderer at the moment) to not call clear when it would give
us problems.

BUG=620687

Change-Id: I64a2ed1883e8d3bf0d4c423c8bce0902ae9bf8df
Reviewed-on: https://chromium-review.googlesource.com/352828
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/tests/perf_tests/DrawCallPerf.cpp b/src/tests/perf_tests/DrawCallPerf.cpp
index ab418ec..e5007e1 100644
--- a/src/tests/perf_tests/DrawCallPerf.cpp
+++ b/src/tests/perf_tests/DrawCallPerf.cpp
@@ -180,7 +180,16 @@
 
 void DrawCallPerfBenchmark::drawBenchmark()
 {
-    glClear(GL_COLOR_BUFFER_BIT);
+    // This workaround fixes a huge queue of graphics commands accumulating on the GL
+    // back-end. The GL back-end doesn't have a proper NULL device at the moment.
+    // TODO(jmadill): Remove this when/if we ever get a proper OpenGL NULL device.
+    const auto &eglParams = GetParam().eglParameters;
+    if (eglParams.deviceType != EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE ||
+        (eglParams.renderer != EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE &&
+         eglParams.renderer != EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE))
+    {
+        glClear(GL_COLOR_BUFFER_BIT);
+    }
 
     const auto &params = GetParam();