OSDN Git Service

remove libui dependency on libEGL
authorMathias Agopian <mathias@google.com>
Sat, 25 Feb 2012 00:42:46 +0000 (16:42 -0800)
committerMathias Agopian <mathias@google.com>
Sat, 25 Feb 2012 00:42:46 +0000 (16:42 -0800)
Change-Id: I1194f04085637d5c384e134967249430cc43b6ee

41 files changed:
include/ui/EGLUtils.h [deleted file]
libs/ui/Android.mk
opengl/tests/angeles/Android.mk
opengl/tests/angeles/app-linux.cpp
opengl/tests/angeles/gpustate.c [deleted file]
opengl/tests/fillrate/Android.mk
opengl/tests/fillrate/fillrate.cpp
opengl/tests/filter/Android.mk
opengl/tests/filter/filter.cpp
opengl/tests/finish/Android.mk
opengl/tests/finish/finish.cpp
opengl/tests/gl2_basic/Android.mk
opengl/tests/gl2_basic/gl2_basic.cpp
opengl/tests/gl2_copyTexImage/Android.mk
opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
opengl/tests/gl2_yuvtex/Android.mk
opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
opengl/tests/gl_basic/Android.mk
opengl/tests/gl_basic/gl_basic.cpp
opengl/tests/gl_perf/Android.mk
opengl/tests/gl_perf/gl2_perf.cpp
opengl/tests/gl_yuvtex/Android.mk
opengl/tests/gl_yuvtex/gl_yuvtex.cpp
opengl/tests/hwc/hwcColorEquiv.cpp
opengl/tests/hwc/hwcCommit.cpp
opengl/tests/hwc/hwcRects.cpp
opengl/tests/hwc/hwcStress.cpp
opengl/tests/hwc/hwcTestLib.cpp
opengl/tests/hwc/hwcTestLib.h
opengl/tests/include/EGLUtils.h [moved from libs/ui/EGLUtils.cpp with 83% similarity]
opengl/tests/include/glTestLib.h
opengl/tests/lib/glTestLib.cpp
opengl/tests/linetex/Android.mk
opengl/tests/linetex/linetex.cpp
opengl/tests/swapinterval/Android.mk
opengl/tests/swapinterval/swapinterval.cpp
opengl/tests/textures/Android.mk
opengl/tests/textures/textures.cpp
opengl/tests/tritex/Android.mk
opengl/tests/tritex/tritex.cpp
services/surfaceflinger/DisplayHardware/DisplayHardware.cpp

diff --git a/include/ui/EGLUtils.h b/include/ui/EGLUtils.h
deleted file mode 100644 (file)
index a5bff81..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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 */
index c029291..5aff7a4 100644 (file)
@@ -16,7 +16,6 @@ LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES:= \
-       EGLUtils.cpp \
        FramebufferNativeWindow.cpp \
        GraphicBuffer.cpp \
        GraphicBufferAllocator.cpp \
@@ -28,7 +27,6 @@ LOCAL_SRC_FILES:= \
 LOCAL_SHARED_LIBRARIES := \
        libcutils \
        libutils \
-       libEGL \
        libhardware
 
 ifneq ($(BOARD_FRAMEBUFFER_FORCE_FORMAT),)
index d0c3221..84b754b 100644 (file)
@@ -4,14 +4,7 @@ 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_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)
index 4d10ee5..6ac68a2 100644 (file)
@@ -53,7 +53,7 @@
 #include <GLES/gl.h>
 
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
diff --git a/opengl/tests/angeles/gpustate.c b/opengl/tests/angeles/gpustate.c
deleted file mode 100644 (file)
index 3c540c9..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#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;
-}
index 191c59b..835f858 100644 (file)
@@ -11,6 +11,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv1_CM \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-fillrate
 
 LOCAL_MODULE_TAGS := optional
index 911d354..a708647 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <utils/StopWatch.h>
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index a254127..d780362 100644 (file)
@@ -10,6 +10,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv1_CM \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-filter
 
 LOCAL_MODULE_TAGS := optional
index 2351909..0067327 100644 (file)
@@ -6,7 +6,7 @@
 #include <GLES/glext.h>
 
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index aa607c6..8f4f9c3 100644 (file)
@@ -11,6 +11,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv1_CM \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-finish
 
 LOCAL_MODULE_TAGS := optional
index 91f5c45..11f0c22 100644 (file)
@@ -27,7 +27,7 @@
 #include <utils/Timers.h>
 
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index a642eaf..07469a0 100644 (file)
@@ -10,6 +10,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv2 \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-gl2_basic
 
 LOCAL_MODULE_TAGS := optional
index f274c7c..7007871 100644 (file)
@@ -27,7 +27,7 @@
 #include <utils/Timers.h>
 
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index bef1f90..b616428 100644 (file)
@@ -10,6 +10,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv2 \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-gl2_copyTexImage
 
 LOCAL_MODULE_TAGS := optional
index c2bfdec..988d7ac 100644 (file)
@@ -27,7 +27,7 @@
 #include <utils/Timers.h>
 
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index 6304700..e36f319 100644 (file)
@@ -10,6 +10,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv2 \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-gl2_yuvtex
 
 LOCAL_MODULE_TAGS := optional
index f0b8d12..d3e4932 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <ui/FramebufferNativeWindow.h>
 #include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index 6b6341f..2ba327b 100644 (file)
@@ -10,6 +10,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv1_CM \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-gl_basic
 
 LOCAL_MODULE_TAGS := optional
index 0cc8398..23ce934 100644 (file)
@@ -6,7 +6,7 @@
 #include <GLES/glext.h>
 
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 #include <stdio.h>
 
index 37647ca..f32abd3 100644 (file)
@@ -11,6 +11,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv2 \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-gl2_perf
 
 LOCAL_MODULE_TAGS := optional
index 9dfcf1c..224acaf 100644 (file)
@@ -27,7 +27,7 @@
 #include <utils/Timers.h>
 
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index a78db25..5b87f2e 100644 (file)
@@ -10,6 +10,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv1_CM \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-gl_yuvtex
 
 LOCAL_MODULE_TAGS := optional
index fbe65f1..7a00f76 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <ui/FramebufferNativeWindow.h>
 #include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index 1d03948..bb305dc 100644 (file)
@@ -87,7 +87,6 @@
 
 #include <ui/FramebufferNativeWindow.h>
 #include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
 
 #define LOG_TAG "hwcColorEquivTest"
 #include <utils/Log.h>
index 66ccdae..685dc5d 100644 (file)
@@ -98,7 +98,6 @@
 
 #include <ui/FramebufferNativeWindow.h>
 #include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
 
 #define LOG_TAG "hwcCommitTest"
 #include <utils/Log.h>
index 523e3de..80cde23 100644 (file)
 
 #include <ui/FramebufferNativeWindow.h>
 #include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
 
 #define LOG_TAG "hwcRectsTest"
 #include <utils/Log.h>
index 1cefb4b..7d7bc1f 100644 (file)
 
 #include <ui/FramebufferNativeWindow.h>
 #include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
 
 #define LOG_TAG "hwcStressTest"
 #include <utils/Log.h>
index 925405e..63f42ba 100644 (file)
@@ -27,6 +27,8 @@
 
 #include <hwc/hwcTestLib.h>
 
+#include "EGLUtils.h"
+
 // Defines
 #define NUMA(a) (sizeof(a) / sizeof(a [0]))
 
index 99ee608..b0c3012 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <ui/FramebufferNativeWindow.h>
 #include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
 
 #include <utils/Log.h>
 #include <testUtil.h>
similarity index 83%
rename from libs/ui/EGLUtils.cpp
rename to opengl/tests/include/EGLUtils.h
index f24a71d..014c261 100644 (file)
  */
 
 
-#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){
@@ -55,7 +76,7 @@ const char *EGLUtils::strerror(EGLint err)
 status_t EGLUtils::selectConfigForPixelFormat(
         EGLDisplay dpy,
         EGLint const* attrs,
-        PixelFormat format,
+        int32_t format,
         EGLConfig* outConfig)
 {
     EGLint numConfigs = -1, n=0;
@@ -65,7 +86,7 @@ status_t EGLUtils::selectConfigForPixelFormat(
 
     if (outConfig == NULL)
         return BAD_VALUE;
-    
+
     // Get all the "potential match" configs...
     if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE)
         return BAD_VALUE;
@@ -75,7 +96,7 @@ status_t EGLUtils::selectConfigForPixelFormat(
         free(configs);
         return BAD_VALUE;
     }
-    
+
     int i;
     EGLConfig config = NULL;
     for (i=0 ; i<n ; i++) {
@@ -88,7 +109,7 @@ status_t EGLUtils::selectConfigForPixelFormat(
     }
 
     free(configs);
-    
+
     if (i<n) {
         *outConfig = config;
         return NO_ERROR;
@@ -105,10 +126,10 @@ status_t EGLUtils::selectConfigForNativeWindow(
 {
     int err;
     int format;
-    
+
     if (!window)
         return BAD_VALUE;
-    
+
     if ((err = window->query(window, NATIVE_WINDOW_FORMAT, &format)) < 0) {
         return err;
     }
@@ -119,3 +140,5 @@ status_t EGLUtils::selectConfigForNativeWindow(
 // ----------------------------------------------------------------------------
 }; // namespace android
 // ----------------------------------------------------------------------------
+
+#endif /* ANDROID_UI_EGLUTILS_H */
index 06fbf5d..c91c594 100644 (file)
@@ -24,9 +24,7 @@
 #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);
index 052cbd7..b434fc7 100644 (file)
@@ -26,7 +26,7 @@
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
 
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 #include <utils/Log.h>
 #include <testUtil.h>
index 6ff248d..261940e 100644 (file)
@@ -10,6 +10,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv1_CM \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-linetex
 
 LOCAL_MODULE_TAGS := optional
index 6842940..8669492 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <utils/StopWatch.h>
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index 9a4145e..d014cc9 100644 (file)
@@ -11,6 +11,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv1_CM \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-swapinterval
 
 LOCAL_MODULE_TAGS := optional
index 8ca031b..a0f4bc4 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <utils/StopWatch.h>
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index b2fa185..fe9f43c 100644 (file)
@@ -10,6 +10,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv1_CM \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-textures
 
 LOCAL_MODULE_TAGS := optional
index cbe8ffd..5d3d94e 100644 (file)
@@ -23,7 +23,7 @@
 #include <GLES/glext.h>
 
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 using namespace android;
 
index 6db3f49..fc544e4 100644 (file)
@@ -10,6 +10,8 @@ LOCAL_SHARED_LIBRARIES := \
     libGLESv1_CM \
     libui
 
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
 LOCAL_MODULE:= test-opengl-tritex
 
 LOCAL_MODULE_TAGS := optional
index 3365ab4..f183483 100644 (file)
@@ -9,7 +9,7 @@
 #include <GLES/glext.h>
 
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
 
 #include <stdio.h>\r
 #include <stdlib.h>
index 986aec5..cea17f8 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <ui/PixelFormat.h>
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
 
 #include <GLES/gl.h>
 #include <EGL/egl.h>
@@ -60,6 +59,29 @@ void checkGLErrors()
 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)",