summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andy McFadden <fadden@android.com> 2014-03-05 15:06:53 -0800
committer Andy McFadden <fadden@android.com> 2014-03-06 16:46:59 -0800
commit6ef57d7b368ebbac5f2b27c36a9032fee1cda8b1 (patch)
treeb3d4b6f7b16a28d4759711e1f79c6aa19d033449
parentc0c6a0cd4cc2121ffb61576482758aa542acf215 (diff)
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
-rw-r--r--opengl/tests/angeles/Android.mk3
-rw-r--r--opengl/tests/angeles/app-linux.cpp11
-rw-r--r--opengl/tests/fillrate/Android.mk5
-rw-r--r--opengl/tests/fillrate/fillrate.cpp7
-rw-r--r--opengl/tests/filter/Android.mk6
-rw-r--r--opengl/tests/filter/filter.cpp9
-rw-r--r--opengl/tests/finish/Android.mk5
-rw-r--r--opengl/tests/finish/finish.cpp7
-rw-r--r--opengl/tests/gl2_basic/Android.mk6
-rw-r--r--opengl/tests/gl2_basic/gl2_basic.cpp7
-rw-r--r--opengl/tests/gl2_copyTexImage/Android.mk6
-rw-r--r--opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp7
-rw-r--r--opengl/tests/gl2_yuvtex/Android.mk6
-rw-r--r--opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp7
-rw-r--r--opengl/tests/gl_basic/Android.mk6
-rw-r--r--opengl/tests/gl_basic/gl_basic.cpp13
-rw-r--r--opengl/tests/gl_perf/Android.mk6
-rw-r--r--opengl/tests/gl_perf/gl2_perf.cpp7
-rw-r--r--opengl/tests/gl_yuvtex/Android.mk5
-rw-r--r--opengl/tests/gl_yuvtex/gl_yuvtex.cpp7
-rw-r--r--opengl/tests/hwc/hwcColorEquiv.cpp1
-rw-r--r--opengl/tests/hwc/hwcCommit.cpp1
-rw-r--r--opengl/tests/hwc/hwcRects.cpp1
-rw-r--r--opengl/tests/hwc/hwcStress.cpp1
-rw-r--r--opengl/tests/hwc/hwcTestLib.cpp6
-rw-r--r--opengl/tests/hwc/hwcTestLib.h1
-rw-r--r--opengl/tests/include/WindowSurface.h49
-rw-r--r--opengl/tests/lib/Android.mk2
-rw-r--r--opengl/tests/lib/WindowSurface.cpp75
-rw-r--r--opengl/tests/linetex/Android.mk6
-rw-r--r--opengl/tests/linetex/linetex.cpp9
-rw-r--r--opengl/tests/swapinterval/Android.mk5
-rw-r--r--opengl/tests/swapinterval/swapinterval.cpp7
-rw-r--r--opengl/tests/textures/Android.mk6
-rw-r--r--opengl/tests/textures/textures.cpp9
-rw-r--r--opengl/tests/tritex/Android.mk6
-rw-r--r--opengl/tests/tritex/tritex.cpp13
37 files changed, 261 insertions, 73 deletions
diff --git a/opengl/tests/angeles/Android.mk b/opengl/tests/angeles/Android.mk
index ae4f76d91f..c78224ee18 100644
--- a/opengl/tests/angeles/Android.mk
+++ b/opengl/tests/angeles/Android.mk
@@ -3,7 +3,8 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= app-linux.cpp demo.c.arm
-LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM libui
+LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM libui libgui libutils
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
LOCAL_MODULE:= angeles
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/angeles/app-linux.cpp b/opengl/tests/angeles/app-linux.cpp
index 6ac68a2aee..e490351d58 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 @@ static void checkEGLErrors()
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 @@ static int initGraphics(unsigned samples)
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 @@ int main(int argc, char *argv[])
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;
diff --git a/opengl/tests/fillrate/Android.mk b/opengl/tests/fillrate/Android.mk
index 4dade214b9..21ff52a9a6 100644
--- a/opengl/tests/fillrate/Android.mk
+++ b/opengl/tests/fillrate/Android.mk
@@ -9,7 +9,10 @@ LOCAL_SHARED_LIBRARIES := \
libutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
diff --git a/opengl/tests/fillrate/fillrate.cpp b/opengl/tests/fillrate/fillrate.cpp
index a708647a9a..1d9b026121 100644
--- a/opengl/tests/fillrate/fillrate.cpp
+++ b/opengl/tests/fillrate/fillrate.cpp
@@ -25,8 +25,8 @@
#include <GLES/glext.h>
#include <utils/StopWatch.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
@@ -45,7 +45,8 @@ int main(int argc, char** argv)
EGLint w, h;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
diff --git a/opengl/tests/filter/Android.mk b/opengl/tests/filter/Android.mk
index d3e4d38775..4cf9c962de 100644
--- a/opengl/tests/filter/Android.mk
+++ b/opengl/tests/filter/Android.mk
@@ -8,7 +8,11 @@ LOCAL_SHARED_LIBRARIES := \
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/filter/filter.cpp b/opengl/tests/filter/filter.cpp
index 0067327550..289e6cc585 100644
--- a/opengl/tests/filter/filter.cpp
+++ b/opengl/tests/filter/filter.cpp
@@ -5,8 +5,8 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
@@ -40,8 +40,10 @@ int main(int argc, char** argv)
EGLDisplay dpy;
EGLNativeWindowType window = 0;
+ WindowSurface* windowSurface = NULL;
if (!usePbuffer) {
- window = android_createDisplaySurface();
+ windowSurface = new WindowSurface();
+ window = windowSurface->getSurface();
}
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
@@ -186,5 +188,6 @@ int main(int argc, char** argv)
}
eglTerminate(dpy);
+ delete windowSurface;
return 0;
}
diff --git a/opengl/tests/finish/Android.mk b/opengl/tests/finish/Android.mk
index aa8adca792..0b9b7ea255 100644
--- a/opengl/tests/finish/Android.mk
+++ b/opengl/tests/finish/Android.mk
@@ -9,7 +9,10 @@ LOCAL_SHARED_LIBRARIES := \
libutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
diff --git a/opengl/tests/finish/finish.cpp b/opengl/tests/finish/finish.cpp
index 11f0c22c33..ea3a60f514 100644
--- a/opengl/tests/finish/finish.cpp
+++ b/opengl/tests/finish/finish.cpp
@@ -26,8 +26,8 @@
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
@@ -46,7 +46,8 @@ int main(int argc, char** argv)
EGLint w, h;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
diff --git a/opengl/tests/gl2_basic/Android.mk b/opengl/tests/gl2_basic/Android.mk
index d7819a1473..520395c041 100644
--- a/opengl/tests/gl2_basic/Android.mk
+++ b/opengl/tests/gl2_basic/Android.mk
@@ -8,7 +8,11 @@ LOCAL_SHARED_LIBRARIES := \
libcutils \
libEGL \
libGLESv2 \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
diff --git a/opengl/tests/gl2_basic/gl2_basic.cpp b/opengl/tests/gl2_basic/gl2_basic.cpp
index 7007871dad..cdbf1cfca2 100644
--- a/opengl/tests/gl2_basic/gl2_basic.cpp
+++ b/opengl/tests/gl2_basic/gl2_basic.cpp
@@ -26,8 +26,8 @@
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
@@ -298,7 +298,8 @@ int main(int argc, char** argv) {
checkEglError("printEGLConfigurations");
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig);
if (returnValue) {
printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue);
diff --git a/opengl/tests/gl2_copyTexImage/Android.mk b/opengl/tests/gl2_copyTexImage/Android.mk
index 005c383078..ff43558d31 100644
--- a/opengl/tests/gl2_copyTexImage/Android.mk
+++ b/opengl/tests/gl2_copyTexImage/Android.mk
@@ -8,7 +8,11 @@ LOCAL_SHARED_LIBRARIES := \
libcutils \
libEGL \
libGLESv2 \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
diff --git a/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp b/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
index 988d7ac0ff..405a3f029c 100644
--- a/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
+++ b/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
@@ -26,8 +26,8 @@
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
@@ -406,7 +406,8 @@ int main(int argc, char** argv) {
checkEglError("printEGLConfigurations");
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
EGLint numConfigs = -1, n = 0;
eglChooseConfig(dpy, s_configAttribs, 0, 0, &numConfigs);
if (numConfigs) {
diff --git a/opengl/tests/gl2_yuvtex/Android.mk b/opengl/tests/gl2_yuvtex/Android.mk
index bb3cc0ce7f..42cf771f19 100644
--- a/opengl/tests/gl2_yuvtex/Android.mk
+++ b/opengl/tests/gl2_yuvtex/Android.mk
@@ -9,7 +9,11 @@ LOCAL_SHARED_LIBRARIES := \
libEGL \
libGLESv2 \
libutils \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
diff --git a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
index d3e4932634..98d8aa8cbc 100644
--- a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
+++ b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
@@ -27,9 +27,9 @@
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
+#include <WindowSurface.h>
#include <ui/GraphicBuffer.h>
-#include "EGLUtils.h"
+#include <EGLUtils.h>
using namespace android;
@@ -364,7 +364,8 @@ int main(int argc, char** argv) {
return 0;
}
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig);
if (returnValue) {
printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue);
diff --git a/opengl/tests/gl_basic/Android.mk b/opengl/tests/gl_basic/Android.mk
index 46bcc605bb..7f2259e8e0 100644
--- a/opengl/tests/gl_basic/Android.mk
+++ b/opengl/tests/gl_basic/Android.mk
@@ -8,7 +8,11 @@ LOCAL_SHARED_LIBRARIES := \
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/gl_basic/gl_basic.cpp b/opengl/tests/gl_basic/gl_basic.cpp
index 23ce93480f..e50d88fab1 100644
--- a/opengl/tests/gl_basic/gl_basic.cpp
+++ b/opengl/tests/gl_basic/gl_basic.cpp
@@ -5,8 +5,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>
@@ -23,7 +23,7 @@ GLuint texture;
#define FIXED_ONE 0x10000
#define ITERATIONS 50
-int init_gl_surface(void);
+int init_gl_surface(const WindowSurface& windowSurface);
void free_gl_surface(void);
void init_scene(void);
void render();
@@ -194,7 +194,8 @@ int main(int argc, char **argv)
int q;
int start, end;
printf("Initializing EGL...\n");
- if(!init_gl_surface())
+ WindowSurface windowSurface;
+ if(!init_gl_surface(windowSurface))
{
printf("GL initialisation failed - exiting\n");
return 0;
@@ -209,7 +210,7 @@ int main(int argc, char **argv)
return 0;
}
-int init_gl_surface(void)
+int init_gl_surface(const WindowSurface& windowSurface)
{
EGLint numConfigs = 1;
EGLConfig myConfig = {0};
@@ -236,7 +237,7 @@ int init_gl_surface(void)
return 0;
}
- EGLNativeWindowType window = android_createDisplaySurface();
+ EGLNativeWindowType window = windowSurface.getSurface();
EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig);
if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig,
diff --git a/opengl/tests/gl_perf/Android.mk b/opengl/tests/gl_perf/Android.mk
index b0f825c10d..9a93fab9db 100644
--- a/opengl/tests/gl_perf/Android.mk
+++ b/opengl/tests/gl_perf/Android.mk
@@ -10,7 +10,11 @@ LOCAL_SHARED_LIBRARIES := \
liblog \
libEGL \
libGLESv2 \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
diff --git a/opengl/tests/gl_perf/gl2_perf.cpp b/opengl/tests/gl_perf/gl2_perf.cpp
index 224acafa7a..35df84fc0a 100644
--- a/opengl/tests/gl_perf/gl2_perf.cpp
+++ b/opengl/tests/gl_perf/gl2_perf.cpp
@@ -26,8 +26,8 @@
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
@@ -86,7 +86,8 @@ int main(int argc, char** argv) {
return 0;
}
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig);
if (returnValue) {
printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue);
diff --git a/opengl/tests/gl_yuvtex/Android.mk b/opengl/tests/gl_yuvtex/Android.mk
index e0e2c168b4..7f2020ab62 100644
--- a/opengl/tests/gl_yuvtex/Android.mk
+++ b/opengl/tests/gl_yuvtex/Android.mk
@@ -9,7 +9,10 @@ LOCAL_SHARED_LIBRARIES := \
libEGL \
libGLESv1_CM \
libutils \
- libui
+ libui \
+ libgui
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
diff --git a/opengl/tests/gl_yuvtex/gl_yuvtex.cpp b/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
index 7a00f76f84..c923b07362 100644
--- a/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
+++ b/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
@@ -27,9 +27,9 @@
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
+#include <WindowSurface.h>
#include <ui/GraphicBuffer.h>
-#include "EGLUtils.h"
+#include <EGLUtils.h>
using namespace android;
@@ -254,7 +254,8 @@ int main(int argc, char** argv) {
return 0;
}
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig);
if (returnValue) {
printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue);
diff --git a/opengl/tests/hwc/hwcColorEquiv.cpp b/opengl/tests/hwc/hwcColorEquiv.cpp
index 160906ddbb..c4624d2d3a 100644
--- a/opengl/tests/hwc/hwcColorEquiv.cpp
+++ b/opengl/tests/hwc/hwcColorEquiv.cpp
@@ -85,7 +85,6 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
#define LOG_TAG "hwcColorEquivTest"
diff --git a/opengl/tests/hwc/hwcCommit.cpp b/opengl/tests/hwc/hwcCommit.cpp
index 3681fbbe9f..1bd5fdf3a2 100644
--- a/opengl/tests/hwc/hwcCommit.cpp
+++ b/opengl/tests/hwc/hwcCommit.cpp
@@ -96,7 +96,6 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
#define LOG_TAG "hwcCommitTest"
diff --git a/opengl/tests/hwc/hwcRects.cpp b/opengl/tests/hwc/hwcRects.cpp
index ec0403f6e5..9b57623925 100644
--- a/opengl/tests/hwc/hwcRects.cpp
+++ b/opengl/tests/hwc/hwcRects.cpp
@@ -104,7 +104,6 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
#define LOG_TAG "hwcRectsTest"
diff --git a/opengl/tests/hwc/hwcStress.cpp b/opengl/tests/hwc/hwcStress.cpp
index dfaa6c1202..b1d6c764f8 100644
--- a/opengl/tests/hwc/hwcStress.cpp
+++ b/opengl/tests/hwc/hwcStress.cpp
@@ -101,7 +101,6 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
#define LOG_TAG "hwcStressTest"
diff --git a/opengl/tests/hwc/hwcTestLib.cpp b/opengl/tests/hwc/hwcTestLib.cpp
index 9b224e2e29..7fae5e598d 100644
--- a/opengl/tests/hwc/hwcTestLib.cpp
+++ b/opengl/tests/hwc/hwcTestLib.cpp
@@ -80,7 +80,11 @@ void hwcTestInitDisplay(bool verbose, EGLDisplay *dpy, EGLSurface *surface,
exit(71);
}
- EGLNativeWindowType window = android_createDisplaySurface();
+ // The tests want to stop the framework and play with the hardware
+ // composer, which means it doesn't make sense to use WindowSurface
+ // here. android_createDisplaySurface() is going away, so just
+ // politely fail here.
+ EGLNativeWindowType window = NULL; //android_createDisplaySurface();
if (window == NULL) {
testPrintE("android_createDisplaySurface failed");
exit(72);
diff --git a/opengl/tests/hwc/hwcTestLib.h b/opengl/tests/hwc/hwcTestLib.h
index d403308a63..a942c10e34 100644
--- a/opengl/tests/hwc/hwcTestLib.h
+++ b/opengl/tests/hwc/hwcTestLib.h
@@ -27,7 +27,6 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
#include <utils/Log.h>
diff --git a/opengl/tests/include/WindowSurface.h b/opengl/tests/include/WindowSurface.h
new file mode 100644
index 0000000000..0ec1404556
--- /dev/null
+++ b/opengl/tests/include/WindowSurface.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OPENGL_TESTS_WINDOWSURFACE_H
+#define OPENGL_TESTS_WINDOWSURFACE_H
+
+#include <gui/SurfaceControl.h>
+
+#include <EGL/egl.h>
+
+namespace android {
+
+/*
+ * A window that covers the entire display surface.
+ *
+ * The window is destroyed when this object is destroyed, so don't try
+ * to use the surface after that point.
+ */
+class WindowSurface {
+public:
+ // Creates the window.
+ WindowSurface();
+
+ // Retrieves a handle to the window.
+ EGLNativeWindowType getSurface() const;
+
+private:
+ WindowSurface(const WindowSurface&);
+ WindowSurface& operator=(const WindowSurface&);
+
+ sp<SurfaceControl> mSurfaceControl;
+};
+
+} // namespace android
+
+#endif /* OPENGL_TESTS_WINDOWSURFACE_H */
diff --git a/opengl/tests/lib/Android.mk b/opengl/tests/lib/Android.mk
index 0352a370a8..a2752cd9fa 100644
--- a/opengl/tests/lib/Android.mk
+++ b/opengl/tests/lib/Android.mk
@@ -17,7 +17,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE:= libglTest
-LOCAL_SRC_FILES:= glTestLib.cpp
+LOCAL_SRC_FILES:= glTestLib.cpp WindowSurface.cpp
LOCAL_C_INCLUDES += system/extras/tests/include \
bionic \
bionic/libstdc++/include \
diff --git a/opengl/tests/lib/WindowSurface.cpp b/opengl/tests/lib/WindowSurface.cpp
new file mode 100644
index 0000000000..7b57dfd542
--- /dev/null
+++ b/opengl/tests/lib/WindowSurface.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <WindowSurface.h>
+
+#include <gui/SurfaceComposerClient.h>
+#include <gui/ISurfaceComposer.h>
+#include <gui/Surface.h>
+#include <ui/DisplayInfo.h>
+
+using namespace android;
+
+WindowSurface::WindowSurface() {
+ status_t err;
+
+ sp<SurfaceComposerClient> surfaceComposerClient = new SurfaceComposerClient;
+ err = surfaceComposerClient->initCheck();
+ if (err != NO_ERROR) {
+ fprintf(stderr, "SurfaceComposerClient::initCheck error: %#x\n", err);
+ return;
+ }
+
+ // Get main display parameters.
+ sp<IBinder> mainDpy = SurfaceComposerClient::getBuiltInDisplay(
+ ISurfaceComposer::eDisplayIdMain);
+ DisplayInfo mainDpyInfo;
+ err = SurfaceComposerClient::getDisplayInfo(mainDpy, &mainDpyInfo);
+ if (err != NO_ERROR) {
+ fprintf(stderr, "ERROR: unable to get display characteristics\n");
+ return;
+ }
+
+ sp<SurfaceControl> sc = surfaceComposerClient->createSurface(
+ String8("Benchmark"), mainDpyInfo.w, mainDpyInfo.h,
+ PIXEL_FORMAT_RGBA_8888, ISurfaceComposerClient::eOpaque);
+ if (sc == NULL || !sc->isValid()) {
+ fprintf(stderr, "Failed to create SurfaceControl\n");
+ return;
+ }
+
+ SurfaceComposerClient::openGlobalTransaction();
+ err = sc->setLayer(0x7FFFFFFF); // always on top
+ if (err != NO_ERROR) {
+ fprintf(stderr, "SurfaceComposer::setLayer error: %#x\n", err);
+ return;
+ }
+
+ err = sc->show();
+ if (err != NO_ERROR) {
+ fprintf(stderr, "SurfaceComposer::show error: %#x\n", err);
+ return;
+ }
+ SurfaceComposerClient::closeGlobalTransaction();
+
+ mSurfaceControl = sc;
+}
+
+EGLNativeWindowType WindowSurface::getSurface() const {
+ sp<ANativeWindow> anw = mSurfaceControl->getSurface();
+ return (EGLNativeWindowType) anw.get();
+}
+
diff --git a/opengl/tests/linetex/Android.mk b/opengl/tests/linetex/Android.mk
index 5b6384e4d7..968756a737 100644
--- a/opengl/tests/linetex/Android.mk
+++ b/opengl/tests/linetex/Android.mk
@@ -8,7 +8,11 @@ LOCAL_SHARED_LIBRARIES := \
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/linetex/linetex.cpp b/opengl/tests/linetex/linetex.cpp
index 86694921c3..7921f8096e 100644
--- a/opengl/tests/linetex/linetex.cpp
+++ b/opengl/tests/linetex/linetex.cpp
@@ -15,8 +15,6 @@
** limitations under the License.
*/
-#define LOG_TAG "fillrate"
-
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -26,8 +24,8 @@
#include <GLES/glext.h>
#include <utils/StopWatch.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
@@ -46,7 +44,8 @@ int main(int argc, char** argv)
EGLint w, h;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
diff --git a/opengl/tests/swapinterval/Android.mk b/opengl/tests/swapinterval/Android.mk
index 5517f602e9..b0b15ebec4 100644
--- a/opengl/tests/swapinterval/Android.mk
+++ b/opengl/tests/swapinterval/Android.mk
@@ -9,7 +9,10 @@ LOCAL_SHARED_LIBRARIES := \
libutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
diff --git a/opengl/tests/swapinterval/swapinterval.cpp b/opengl/tests/swapinterval/swapinterval.cpp
index a0f4bc4663..3a8a8a184d 100644
--- a/opengl/tests/swapinterval/swapinterval.cpp
+++ b/opengl/tests/swapinterval/swapinterval.cpp
@@ -23,8 +23,8 @@
#include <GLES/glext.h>
#include <utils/StopWatch.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
@@ -45,7 +45,8 @@ int main(int argc, char** argv)
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
diff --git a/opengl/tests/textures/Android.mk b/opengl/tests/textures/Android.mk
index 97697d72a8..bee61f94ed 100644
--- a/opengl/tests/textures/Android.mk
+++ b/opengl/tests/textures/Android.mk
@@ -8,7 +8,11 @@ LOCAL_SHARED_LIBRARIES := \
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/textures/textures.cpp b/opengl/tests/textures/textures.cpp
index 5d3d94e7da..1e55db0e07 100644
--- a/opengl/tests/textures/textures.cpp
+++ b/opengl/tests/textures/textures.cpp
@@ -22,8 +22,8 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
@@ -42,7 +42,8 @@ int main(int argc, char** argv)
EGLint w, h;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
@@ -114,5 +115,7 @@ int main(int argc, char** argv)
glDrawTexiOES(dim/2, dim/2, 0, dim/2, dim/2);
eglSwapBuffers(dpy, surface);
+
+ sleep(2); // so you have a chance to admire it
return 0;
}
diff --git a/opengl/tests/tritex/Android.mk b/opengl/tests/tritex/Android.mk
index 89faa878b4..64382edd33 100644
--- a/opengl/tests/tritex/Android.mk
+++ b/opengl/tests/tritex/Android.mk
@@ -8,7 +8,11 @@ LOCAL_SHARED_LIBRARIES := \
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 f18348367d..2db73ef13a 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 @@ GLuint texture;
#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 @@ int main(int argc, char **argv)
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 @@ int main(int argc, char **argv)
return 0;
}
-int init_gl_surface(void)
+int init_gl_surface(const WindowSurface& windowSurface)
{
EGLint numConfigs = 1;
EGLConfig myConfig = {0};
@@ -140,7 +141,7 @@ int init_gl_surface(void)
return 0;
}
- EGLNativeWindowType window = android_createDisplaySurface();
+ EGLNativeWindowType window = windowSurface.getSurface();
EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig);
if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig,