Restore old OpenGL tests
These tests call android_createDisplaySurface() to get a
FramebufferNativeWindow that is passed to EGL. This relies on the
existence of the framebuffer HAL, which is not supported on many
recent devices.
This change adds a new "window surface" object that the tests
can use to get a window from SurfaceFlinger instead. All tests
except for the HWC tests now appear to do things.
The HWC tests don't do anything useful, but they no longer depend
on the android_createDisplaySurface() function.
Bug 13323813
Change-Id: I2cbfbacb3452fb658c29e945b0c7ae7c94c1a4ba
diff --git a/opengl/tests/tritex/Android.mk b/opengl/tests/tritex/Android.mk
index 89faa87..64382ed 100644
--- a/opengl/tests/tritex/Android.mk
+++ b/opengl/tests/tritex/Android.mk
@@ -8,7 +8,11 @@
libcutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
diff --git a/opengl/tests/tritex/tritex.cpp b/opengl/tests/tritex/tritex.cpp
index f183483..2db73ef 100644
--- a/opengl/tests/tritex/tritex.cpp
+++ b/opengl/tests/tritex/tritex.cpp
@@ -8,8 +8,8 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
#include <stdio.h>
#include <stdlib.h>
@@ -25,7 +25,7 @@
#define FIXED_ONE 0x10000
#define ITERATIONS 50
-int init_gl_surface(void);
+int init_gl_surface(const WindowSurface&);
void free_gl_surface(void);
void init_scene(void);
void render(int quads);
@@ -98,7 +98,8 @@
printf("Initializing EGL...\n");
- if(!init_gl_surface())
+ WindowSurface windowSurface;
+ if(!init_gl_surface(windowSurface))
{
printf("GL initialisation failed - exiting\n");
return 0;
@@ -117,7 +118,7 @@
return 0;
}
-int init_gl_surface(void)
+int init_gl_surface(const WindowSurface& windowSurface)
{
EGLint numConfigs = 1;
EGLConfig myConfig = {0};
@@ -140,7 +141,7 @@
return 0;
}
- EGLNativeWindowType window = android_createDisplaySurface();
+ EGLNativeWindowType window = windowSurface.getSurface();
EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig);
if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig,