diff options
Diffstat (limited to 'opengl')
37 files changed, 261 insertions, 73 deletions
diff --git a/opengl/tests/angeles/Android.mk b/opengl/tests/angeles/Android.mk index ae4f76d..c78224e 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 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 @@ 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 4dade21..21ff52a 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 a708647..1d9b026 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 d3e4d38..4cf9c96 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 0067327..289e6cc 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 aa8adca..0b9b7ea 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 11f0c22..ea3a60f 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 d7819a1..520395c 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 7007871..cdbf1cf 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 005c383..ff43558 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 988d7ac..405a3f0 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 bb3cc0c..42cf771 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 d3e4932..98d8aa8 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 46bcc60..7f2259e 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 23ce934..e50d88f 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 b0f825c..9a93fab 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 224acaf..35df84f 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 e0e2c16..7f2020a 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 7a00f76..c923b07 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 160906d..c4624d2 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 3681fbb..1bd5fdf 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 ec0403f..9b57623 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 dfaa6c1..b1d6c76 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 9b224e2..7fae5e5 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 d403308..a942c10 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 0000000..0ec1404 --- /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 0352a37..a2752cd 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 0000000..7b57dfd --- /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 5b6384e..968756a 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 8669492..7921f80 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 5517f60..b0b15eb 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 a0f4bc4..3a8a8a1 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 97697d7..bee61f9 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 5d3d94e..1e55db0 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 89faa87..64382ed 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 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 @@ 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, |