Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ef57d7b authored by Andy McFadden's avatar Andy McFadden
Browse files

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
parent c0c6a0cd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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
+6 −5
Original line number Diff line number Diff line
@@ -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;
+4 −1
Original line number Diff line number Diff line
@@ -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)

+4 −3
Original line number Diff line number Diff line
@@ -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);
+5 −1
Original line number Diff line number Diff line
@@ -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)

Loading