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/angeles/app-linux.cpp b/opengl/tests/angeles/app-linux.cpp
index 6ac68a2..e490351 100644
--- a/opengl/tests/angeles/app-linux.cpp
+++ b/opengl/tests/angeles/app-linux.cpp
@@ -52,8 +52,8 @@
#include <EGL/egl.h>
#include <GLES/gl.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <EGLUtils.h>
+#include <WindowSurface.h>
using namespace android;
@@ -118,7 +118,7 @@
fprintf(stderr, "EGL Error: 0x%04x\n", (int)error);
}
-static int initGraphics(unsigned samples)
+static int initGraphics(unsigned samples, const WindowSurface& windowSurface)
{
EGLint configAttribs[] = {
EGL_DEPTH_SIZE, 16,
@@ -135,7 +135,7 @@
EGLint w, h;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
@@ -193,7 +193,8 @@
printf("Multisample enabled: GL_SAMPLES = %u\n", samples);
}
- if (!initGraphics(samples))
+ WindowSurface windowSurface;
+ if (!initGraphics(samples, windowSurface))
{
fprintf(stderr, "Graphics initialization failed.\n");
return EXIT_FAILURE;