drm-tests: swrast_test: check for EGL_KHR_no_config_context
eglCreateContext can only take a NULL config if the
EGL_KHR_no_config_context extension is supported by the driver. The
Mali and Imagination drivers don't support this, and passing in a
null config doesn't seem critical to the test, so let's add a check
here.
BUG=chromium:654131
TEST=swrast_test works on mali driver
Change-Id: I97fd1bf3477548f8bd746473636d09e5288b604e
Reviewed-on: https://chromium-review.googlesource.com/446013
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
diff --git a/Makefile b/Makefile
index 243af6b..07cb59a 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,7 @@
CC_BINARY(linear_bo_test): linear_bo_test.o CC_STATIC_LIBRARY(libbsdrm.pic.a)
CC_BINARY(linear_bo_test): LDLIBS += -lGLESv2
-CC_BINARY(swrast_test): swrast_test.o
+CC_BINARY(swrast_test): swrast_test.o CC_STATIC_LIBRARY(libbsdrm.pic.a)
CC_BINARY(swrast_test): LDLIBS += -lGLESv2
CC_BINARY(atomictest): atomictest.o CC_STATIC_LIBRARY(libbsdrm.pic.a)
diff --git a/swrast_test.c b/swrast_test.c
index 592a0e2..56dc599 100644
--- a/swrast_test.c
+++ b/swrast_test.c
@@ -3,18 +3,7 @@
* found in the LICENSE file.
*/
-#include <errno.h>
-#include <fcntl.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
+#include "bs_drm.h"
const char * get_gl_error()
{
@@ -270,10 +259,18 @@
goto terminate_display;
}
- ctx.egl_ctx = eglCreateContext(ctx.egl_display,
- NULL /* No framebuffer */,
- EGL_NO_CONTEXT /* No shared context */,
- context_attribs);
+ if (bs_egl_has_extension(extensions, "EGL_KHR_no_config_context")) {
+ ctx.egl_ctx = eglCreateContext(ctx.egl_display,
+ NULL /* No Config */,
+ EGL_NO_CONTEXT /* No shared context */,
+ context_attribs);
+ } else {
+ ctx.egl_ctx = eglCreateContext(ctx.egl_display,
+ egl_config,
+ EGL_NO_CONTEXT /* No shared context */,
+ context_attribs);
+ }
+
if (ctx.egl_ctx == EGL_NO_CONTEXT) {
fprintf(stderr, "failed to create OpenGL ES Context: %s\n",
get_egl_error());