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
#include <EGL/egl.h>
#include <GLES/gl.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <EGLUtils.h>
+#include <WindowSurface.h>
using namespace android;
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,
EGLint w, h;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
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;
libutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <GLES/glext.h>
#include <utils/StopWatch.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
EGLint w, h;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
libcutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <GLES/gl.h>
#include <GLES/glext.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
EGLDisplay dpy;
EGLNativeWindowType window = 0;
+ WindowSurface* windowSurface = NULL;
if (!usePbuffer) {
- window = android_createDisplaySurface();
+ windowSurface = new WindowSurface();
+ window = windowSurface->getSurface();
}
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
}
eglTerminate(dpy);
+ delete windowSurface;
return 0;
}
libutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
EGLint w, h;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
libcutils \
libEGL \
libGLESv2 \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
checkEglError("printEGLConfigurations");
- EGLNativeWindowType window = android_createDisplaySurface();\r
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig);
if (returnValue) {
printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue);
libcutils \
libEGL \
libGLESv2 \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
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) {
libEGL \
libGLESv2 \
libutils \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
+#include <WindowSurface.h>
#include <ui/GraphicBuffer.h>
-#include "EGLUtils.h"
+#include <EGLUtils.h>
using namespace android;
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);
libcutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <GLES/gl.h>
#include <GLES/glext.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
#include <stdio.h>
#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();
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;
return 0;
}
-int init_gl_surface(void)
+int init_gl_surface(const WindowSurface& windowSurface)
{
EGLint numConfigs = 1;
EGLConfig myConfig = {0};
return 0;
}
- EGLNativeWindowType window = android_createDisplaySurface();
+ EGLNativeWindowType window = windowSurface.getSurface();
EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig);
if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig,
liblog \
libEGL \
libGLESv2 \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
return 0;
}
- EGLNativeWindowType window = android_createDisplaySurface();\r
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig);
if (returnValue) {
printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue);
libEGL \
libGLESv1_CM \
libutils \
- libui
+ libui \
+ libgui
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <utils/Timers.h>
-#include <ui/FramebufferNativeWindow.h>
+#include <WindowSurface.h>
#include <ui/GraphicBuffer.h>
-#include "EGLUtils.h"
+#include <EGLUtils.h>
using namespace android;
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);
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
#define LOG_TAG "hwcColorEquivTest"
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
#define LOG_TAG "hwcCommitTest"
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
#define LOG_TAG "hwcRectsTest"
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
#define LOG_TAG "hwcStressTest"
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);
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
#include <utils/Log.h>
--- /dev/null
+/*
+ * 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 */
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 \
--- /dev/null
+/*
+ * 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();
+}
+
libcutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
** limitations under the License.
*/
-#define LOG_TAG "fillrate"
-
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <GLES/glext.h>
#include <utils/StopWatch.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
EGLint w, h;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
libutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <GLES/glext.h>
#include <utils/StopWatch.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
libcutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <GLES/gl.h>
#include <GLES/glext.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
using namespace android;
EGLint w, h;
EGLDisplay dpy;
- EGLNativeWindowType window = android_createDisplaySurface();
+ WindowSurface windowSurface;
+ EGLNativeWindowType window = windowSurface.getSurface();
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
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;
}
libcutils \
libEGL \
libGLESv1_CM \
- libui
+ libui \
+ libgui \
+ libutils
+
+LOCAL_STATIC_LIBRARIES += libglTest
LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
#include <GLES/gl.h>
#include <GLES/glext.h>
-#include <ui/FramebufferNativeWindow.h>
-#include "EGLUtils.h"
+#include <WindowSurface.h>
+#include <EGLUtils.h>
#include <stdio.h>\r
#include <stdlib.h>
#define FIXED_ONE 0x10000
#define ITERATIONS 50\r
\r
-int init_gl_surface(void);\r
+int init_gl_surface(const WindowSurface&);\r
void free_gl_surface(void);\r
void init_scene(void);\r
void render(int quads);\r
printf("Initializing EGL...\n");
\r
- if(!init_gl_surface())\r
+ WindowSurface windowSurface;
+ if(!init_gl_surface(windowSurface))\r
{\r
printf("GL initialisation failed - exiting\n");\r
return 0;\r
return 0;\r
}\r
\r
-int init_gl_surface(void)\r
+int init_gl_surface(const WindowSurface& windowSurface)\r
{\r
EGLint numConfigs = 1;\r
EGLConfig myConfig = {0};\r
return 0;\r
}\r
- EGLNativeWindowType window = android_createDisplaySurface();\r
+ EGLNativeWindowType window = windowSurface.getSurface();\r
EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig);\r
\r
if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig,