summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2013-03-27 14:30:19 -0700
committerMathias Agopian <mathias@google.com>2013-03-28 14:17:54 -0700
commite9b3dfb7d5cc233747407381a51a081c335dc076 (patch)
tree3f46926296bb835a4a3ee326e2e0dd4ac8a0f990
parentcaa81f0ed8a4471c210956d0343458b3bca922de (diff)
downloadframeworks_native-e9b3dfb7d5cc233747407381a51a081c335dc076.zip
frameworks_native-e9b3dfb7d5cc233747407381a51a081c335dc076.tar.gz
frameworks_native-e9b3dfb7d5cc233747407381a51a081c335dc076.tar.bz2
cleanup EGL extensions strings and entry-points
- move all the code related to EGL extensions in one place - add missing extension strings: EGL_KHR_lock_surface EGL_KHR_reusable_sync - add public extensions strings and entry-points EGL_ANDROID_wait_sync EGL_ANDROID_presentation_time - add missing entry-points for EGL_KHR_reusable_sync Change-Id: Ifd98966b549e8efd8ef5385eba0efde8c4cbc77b
-rw-r--r--opengl/libs/EGL/eglApi.cpp110
-rw-r--r--opengl/libs/EGL/egl_display.cpp32
-rw-r--r--opengl/libs/EGL/egl_entries.in1
3 files changed, 103 insertions, 40 deletions
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 978ab04..c1f2b2e 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -54,26 +54,106 @@ using namespace android;
#define EGL_VERSION_HW_ANDROID 0x3143
+namespace android {
+
struct extention_map_t {
const char* name;
__eglMustCastToProperFunctionPointerType address;
};
-static const extention_map_t sExtentionMap[] = {
+/*
+ * This is the list of EGL extensions exposed to applications,
+ * some of them are mandatory because used by the ANDROID system.
+ *
+ * Mandatory extensions are required per the CDD and not explicitly
+ * checked during EGL initialization. the system *assumes* these extensions
+ * are present. the system may not function properly if some mandatory
+ * extensions are missing.
+ *
+ * NOTE: gExtensionString MUST have a single space as the last character.
+ */
+extern char const * const gExtensionString =
+ "EGL_KHR_image " // mandatory
+ "EGL_KHR_image_base " // mandatory
+ "EGL_KHR_image_pixmap "
+ "EGL_KHR_lock_surface "
+ "EGL_KHR_gl_texture_2D_image "
+ "EGL_KHR_gl_texture_cubemap_image "
+ "EGL_KHR_gl_renderbuffer_image "
+ "EGL_KHR_reusable_sync "
+ "EGL_KHR_fence_sync "
+ "EGL_EXT_create_context_robustness "
+ "EGL_NV_system_time "
+ "EGL_ANDROID_image_native_buffer " // mandatory
+ "EGL_ANDROID_wait_sync " // strongly recommended
+ "EGL_ANDROID_presentation_time "
+ ;
+
+// extensions not exposed to applications but used by the ANDROID system
+// "EGL_ANDROID_blob_cache " // strongly recommended
+// "EGL_IMG_hibernate_process " // optional
+// "EGL_ANDROID_native_fence_sync " // strongly recommended
+// "EGL_ANDROID_framebuffer_target " // mandatory for HWC 1.1
+// "EGL_ANDROID_recordable " // mandatory
+
+
+/*
+ * EGL Extensions entry-points exposed to 3rd party applications
+ * (keep in sync with gExtensionString above)
+ *
+ */
+static const extention_map_t sExtensionMap[] = {
+ // EGL_KHR_lock_surface
{ "eglLockSurfaceKHR",
(__eglMustCastToProperFunctionPointerType)&eglLockSurfaceKHR },
{ "eglUnlockSurfaceKHR",
(__eglMustCastToProperFunctionPointerType)&eglUnlockSurfaceKHR },
+
+ // EGL_KHR_image, EGL_KHR_image_base
{ "eglCreateImageKHR",
(__eglMustCastToProperFunctionPointerType)&eglCreateImageKHR },
{ "eglDestroyImageKHR",
(__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR },
+
+ // EGL_KHR_reusable_sync, EGL_KHR_fence_sync
+ { "eglCreateSyncKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglCreateSyncKHR },
+ { "eglDestroySyncKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglDestroySyncKHR },
+ { "eglClientWaitSyncKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglClientWaitSyncKHR },
+ { "eglSignalSyncKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglSignalSyncKHR },
+ { "eglGetSyncAttribKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglGetSyncAttribKHR },
+
+ // EGL_NV_system_time
{ "eglGetSystemTimeFrequencyNV",
(__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeFrequencyNV },
{ "eglGetSystemTimeNV",
(__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeNV },
+
+ // EGL_ANDROID_wait_sync
+ { "eglWaitSyncANDROID",
+ (__eglMustCastToProperFunctionPointerType)&eglWaitSyncANDROID },
+
+ // EGL_ANDROID_presentation_time
+ { "eglPresentationTimeANDROID",
+ (__eglMustCastToProperFunctionPointerType)&eglPresentationTimeANDROID },
};
+/*
+ * These extensions entry-points should not be exposed to applications.
+ * They're used internally by the Android EGL layer.
+ */
+#define FILTER_EXTENSIONS(procname) \
+ (!strcmp((procname), "eglSetBlobCacheFuncsANDROID") || \
+ !strcmp((procname), "eglHibernateProcessIMG") || \
+ !strcmp((procname), "eglAwakenProcessIMG") || \
+ !strcmp((procname), "eglDupNativeFenceFDANDROID"))
+
+
+
// accesses protected by sExtensionMapMutex
static DefaultKeyedVector<String8, __eglMustCastToProperFunctionPointerType> sGLExtentionMap;
static int sGLExtentionSlot = 0;
@@ -91,15 +171,16 @@ static void(*findProcAddress(const char* name,
// ----------------------------------------------------------------------------
-namespace android {
extern void setGLHooksThreadSpecific(gl_hooks_t const *value);
extern EGLBoolean egl_init_drivers();
extern const __eglMustCastToProperFunctionPointerType gExtensionForwarders[MAX_NUMBER_OF_GL_EXTENSIONS];
extern int getEGLDebugLevel();
extern void setEGLDebugLevel(int level);
extern gl_hooks_t gHooksTrace;
+
} // namespace android;
+
// ----------------------------------------------------------------------------
static inline void clearError() { egl_tls_t::clearError(); }
@@ -707,18 +788,12 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
return NULL;
}
- // These extensions should not be exposed to applications. They're used
- // internally by the Android EGL layer.
- if (!strcmp(procname, "eglSetBlobCacheFuncsANDROID") ||
- !strcmp(procname, "eglDupNativeFenceFDANDROID") ||
- !strcmp(procname, "eglWaitSyncANDROID") ||
- !strcmp(procname, "eglHibernateProcessIMG") ||
- !strcmp(procname, "eglAwakenProcessIMG")) {
+ if (FILTER_EXTENSIONS(procname)) {
return NULL;
}
__eglMustCastToProperFunctionPointerType addr;
- addr = findProcAddress(procname, sExtentionMap, NELEM(sExtentionMap));
+ addr = findProcAddress(procname, sExtensionMap, NELEM(sExtensionMap));
if (addr) return addr;
@@ -1239,6 +1314,21 @@ EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
return result;
}
+EGLBoolean eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) {
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ EGLBoolean result = EGL_FALSE;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglSignalSyncKHR) {
+ result = cnx->egl.eglSignalSyncKHR(
+ dp->disp.dpy, sync, mode);
+ }
+ return result;
+}
+
EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync,
EGLint flags, EGLTimeKHR timeout)
{
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index 7ca9e40..59dd2d9 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -34,35 +34,7 @@ static char const * const sVendorString = "Android";
static char const * const sVersionString = "1.4 Android META-EGL";
static char const * const sClientApiString = "OpenGL_ES";
-// this is the list of EGL extensions that are exposed to applications
-// some of them are mandatory because used by the ANDROID system.
-//
-// mandatory extensions are required per the CDD and not explicitly
-// checked during EGL initialization. the system *assumes* these extensions
-// are present. the system may not function properly if some mandatory
-// extensions are missing.
-//
-// NOTE: sExtensionString MUST be have a single space as the last character.
-//
-static char const * const sExtensionString =
- "EGL_KHR_image " // mandatory
- "EGL_KHR_image_base " // mandatory
- "EGL_KHR_image_pixmap "
- "EGL_KHR_gl_texture_2D_image "
- "EGL_KHR_gl_texture_cubemap_image "
- "EGL_KHR_gl_renderbuffer_image "
- "EGL_KHR_fence_sync "
- "EGL_EXT_create_context_robustness "
- "EGL_NV_system_time "
- "EGL_ANDROID_image_native_buffer " // mandatory
- ;
-
-// extensions not exposed to applications but used by the ANDROID system
-// "EGL_ANDROID_recordable " // mandatory
-// "EGL_ANDROID_framebuffer_target " // mandatory for HWC 1.1
-// "EGL_ANDROID_blob_cache " // strongly recommended
-// "EGL_ANDROID_native_fence_sync " // strongly recommended
-// "EGL_IMG_hibernate_process " // optional
+extern char const * const gExtensionString;
extern void initEglTraceLevel();
extern void initEglDebugLevel();
@@ -211,7 +183,7 @@ EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) {
mClientApiString.setTo(sClientApiString);
// we only add extensions that exist in the implementation
- char const* start = sExtensionString;
+ char const* start = gExtensionString;
char const* end;
do {
// find the space separating this extension for the next one
diff --git a/opengl/libs/EGL/egl_entries.in b/opengl/libs/EGL/egl_entries.in
index 2ffd417..612c232 100644
--- a/opengl/libs/EGL/egl_entries.in
+++ b/opengl/libs/EGL/egl_entries.in
@@ -56,6 +56,7 @@ EGL_ENTRY(EGLBoolean, eglDestroyImageKHR, EGLDisplay, EGLImageKHR)
EGL_ENTRY(EGLSyncKHR, eglCreateSyncKHR, EGLDisplay, EGLenum, const EGLint *)
EGL_ENTRY(EGLBoolean, eglDestroySyncKHR, EGLDisplay, EGLSyncKHR)
EGL_ENTRY(EGLint, eglClientWaitSyncKHR, EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR)
+EGL_ENTRY(EGLBoolean, eglSignalSyncKHR, EGLDisplay, EGLSyncKHR, EGLenum)
EGL_ENTRY(EGLBoolean, eglGetSyncAttribKHR, EGLDisplay, EGLSyncKHR, EGLint, EGLint *)
/* ANDROID extensions */