+++ /dev/null
-/*
- * Copyright (C) 2009 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 ANDROID_UI_EGLUTILS_H
-#define ANDROID_UI_EGLUTILS_H
-
-#include <utils/Errors.h>
-#include <ui/PixelFormat.h>
-#include <EGL/egl.h>
-
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class EGLUtils
-{
-public:
-
- static const char *strerror(EGLint err);
-
- static status_t selectConfigForPixelFormat(
- EGLDisplay dpy,
- EGLint const* attrs,
- PixelFormat format,
- EGLConfig* outConfig);
-
- static status_t selectConfigForNativeWindow(
- EGLDisplay dpy,
- EGLint const* attrs,
- EGLNativeWindowType window,
- EGLConfig* outConfig);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif /* ANDROID_UI_EGLUTILS_H */
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- EGLUtils.cpp \
FramebufferNativeWindow.cpp \
GraphicBuffer.cpp \
GraphicBufferAllocator.cpp \
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
- libEGL \
libhardware
ifneq ($(BOARD_FRAMEBUFFER_FORCE_FORMAT),)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= app-linux.cpp demo.c.arm
LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
LOCAL_MODULE:= angeles
LOCAL_MODULE_TAGS := optional
include $(BUILD_EXECUTABLE)
-
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= gpustate.c
-LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM
-LOCAL_MODULE:= gpustate
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_EXECUTABLE)
#include <GLES/gl.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
+++ /dev/null
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-static void *map_memory(const char *fn, unsigned base, unsigned size)
-{
- int fd;
- void *ptr;
-
- fd = open(fn, O_RDWR | O_SYNC);
- if(fd < 0) {
- perror("cannot open %s for mapping");
- return MAP_FAILED;
- }
-
- ptr = mmap(0, size, PROT_READ | PROT_WRITE,
- MAP_SHARED, fd, base);
- close(fd);
-
- if(ptr == MAP_FAILED) {
- fprintf(stderr,"cannot map %s (@%08x,%08x)\n", fn, base, size);
- }
- return ptr;
-}
-
-
-int main(int argc, char** argv)
-{
- void *grp_regs = map_memory("/dev/hw3d", 0, 1024 * 1024);
- printf("GPU base mapped at %p\n", grp_regs);
- int state_offset = 0x10140;
- printf("GPU state = %08lx\n",
- *((long*)((char*)grp_regs + state_offset)) );
-
- return 0;
-}
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-fillrate
LOCAL_MODULE_TAGS := optional
#include <utils/StopWatch.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-filter
LOCAL_MODULE_TAGS := optional
#include <GLES/glext.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-finish
LOCAL_MODULE_TAGS := optional
#include <utils/Timers.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
libGLESv2 \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl2_basic
LOCAL_MODULE_TAGS := optional
#include <utils/Timers.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
libGLESv2 \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl2_copyTexImage
LOCAL_MODULE_TAGS := optional
#include <utils/Timers.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
libGLESv2 \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl2_yuvtex
LOCAL_MODULE_TAGS := optional
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl_basic
LOCAL_MODULE_TAGS := optional
#include <GLES/glext.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
#include <stdio.h>
libGLESv2 \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl2_perf
LOCAL_MODULE_TAGS := optional
#include <utils/Timers.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl_yuvtex
LOCAL_MODULE_TAGS := optional
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
#define LOG_TAG "hwcColorEquivTest"
#include <utils/Log.h>
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
#define LOG_TAG "hwcCommitTest"
#include <utils/Log.h>
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
#define LOG_TAG "hwcRectsTest"
#include <utils/Log.h>
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
#define LOG_TAG "hwcStressTest"
#include <utils/Log.h>
#include <hwc/hwcTestLib.h>
+#include "EGLUtils.h"
+
// Defines
#define NUMA(a) (sizeof(a) / sizeof(a [0]))
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
#include <utils/Log.h>
#include <testUtil.h>
*/
-#define LOG_TAG "EGLUtils"
+#ifndef ANDROID_UI_EGLUTILS_H
+#define ANDROID_UI_EGLUTILS_H
-#include <cutils/log.h>
-#include <utils/Errors.h>
-
-#include <ui/EGLUtils.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <system/window.h>
+#include <utils/Errors.h>
#include <EGL/egl.h>
-#include <private/ui/android_natives_priv.h>
// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------
+class EGLUtils
+{
+public:
+
+ static inline const char *strerror(EGLint err);
+
+ static inline status_t selectConfigForPixelFormat(
+ EGLDisplay dpy,
+ EGLint const* attrs,
+ int32_t format,
+ EGLConfig* outConfig);
+
+ static inline status_t selectConfigForNativeWindow(
+ EGLDisplay dpy,
+ EGLint const* attrs,
+ EGLNativeWindowType window,
+ EGLConfig* outConfig);
+};
+
+// ----------------------------------------------------------------------------
+
const char *EGLUtils::strerror(EGLint err)
{
switch (err){
status_t EGLUtils::selectConfigForPixelFormat(
EGLDisplay dpy,
EGLint const* attrs,
- PixelFormat format,
+ int32_t format,
EGLConfig* outConfig)
{
EGLint numConfigs = -1, n=0;
if (outConfig == NULL)
return BAD_VALUE;
-
+
// Get all the "potential match" configs...
if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE)
return BAD_VALUE;
free(configs);
return BAD_VALUE;
}
-
+
int i;
EGLConfig config = NULL;
for (i=0 ; i<n ; i++) {
}
free(configs);
-
+
if (i<n) {
*outConfig = config;
return NO_ERROR;
{
int err;
int format;
-
+
if (!window)
return BAD_VALUE;
-
+
if ((err = window->query(window, NATIVE_WINDOW_FORMAT, &format)) < 0) {
return err;
}
// ----------------------------------------------------------------------------
}; // namespace android
// ----------------------------------------------------------------------------
+
+#endif /* ANDROID_UI_EGLUTILS_H */
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-//#include <ui/FramebufferNativeWindow.h>
-//#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
void glTestPrintGLString(const char *name, GLenum s);
void glTestCheckEglError(const char* op, EGLBoolean returnVal = EGL_TRUE);
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
#include <utils/Log.h>
#include <testUtil.h>
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-linetex
LOCAL_MODULE_TAGS := optional
#include <utils/StopWatch.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-swapinterval
LOCAL_MODULE_TAGS := optional
#include <utils/StopWatch.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-textures
LOCAL_MODULE_TAGS := optional
#include <GLES/glext.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-tritex
LOCAL_MODULE_TAGS := optional
#include <GLES/glext.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
#include <stdio.h>\r
#include <stdlib.h>
#include <ui/PixelFormat.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
#include <GLES/gl.h>
#include <EGL/egl.h>
static __attribute__((noinline))
void checkEGLErrors(const char* token)
{
+ struct EGLUtils {
+ static const char *strerror(EGLint err) {
+ switch (err){
+ case EGL_SUCCESS: return "EGL_SUCCESS";
+ case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED";
+ case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS";
+ case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC";
+ case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE";
+ case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG";
+ case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT";
+ case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
+ case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY";
+ case EGL_BAD_MATCH: return "EGL_BAD_MATCH";
+ case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP";
+ case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW";
+ case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER";
+ case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE";
+ case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST";
+ default: return "UNKNOWN";
+ }
+ }
+ };
+
EGLint error = eglGetError();
if (error && error != EGL_SUCCESS) {
ALOGE("%s: EGL error 0x%04x (%s)",