summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorArne Coucheron <arco68@gmail.com>2011-12-18 07:24:45 +0100
committertoastcfh <toastcfh@gmail.com>2011-12-20 19:05:17 -0500
commit55a39f8f8752e47810802cae104c36207a902410 (patch)
tree2850a53b7c84f0fe7366b64ebd6cdb2690a8f6f6 /opengl
parent6abe6e0aab530f74f18fa9d4a92c50aaf1c3b653 (diff)
downloadframeworks_base-55a39f8f8752e47810802cae104c36207a902410.zip
frameworks_base-55a39f8f8752e47810802cae104c36207a902410.tar.gz
frameworks_base-55a39f8f8752e47810802cae104c36207a902410.tar.bz2
opengl/libs/EGL: Bring back eglRenderBufferANDROID extention
This change brings back the eglGetRenderBufferANDROID extension Define EGL_EGLEXT_PROTOTYPES in order to be able to use this extension. Revert "cleanup EGL a bit. remove unused extension." This reverts commit 9d75f1341524910b00d35dd4eeb426d7e7791f6e. Change-Id: I8b3805157cb1f72af507bc823d16910b738cec4c
Diffstat (limited to 'opengl')
-rw-r--r--opengl/include/EGL/eglext.h14
-rw-r--r--opengl/libagl/Android.mk3
-rw-r--r--opengl/libagl/egl.cpp42
-rw-r--r--opengl/libs/Android.mk4
-rw-r--r--opengl/libs/EGL/eglApi.cpp24
-rw-r--r--opengl/libs/EGL/egl_display.cpp3
6 files changed, 90 insertions, 0 deletions
diff --git a/opengl/include/EGL/eglext.h b/opengl/include/EGL/eglext.h
index ca11863..8034f74 100644
--- a/opengl/include/EGL/eglext.h
+++ b/opengl/include/EGL/eglext.h
@@ -229,6 +229,20 @@ struct ANativeWindowBuffer;
#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
#endif
+#ifdef QCOM_HARDWARE
+#ifndef EGL_EGLEXT_PROTOTYPES
+#define EGL_EGLEXT_PROTOTYPES 1
+#endif
+
+#ifndef EGL_ANDROID_get_render_buffer
+#define EGL_ANDROID_get_render_buffer 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLClientBuffer EGLAPIENTRY eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw);
+#endif
+typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLGETRENDERBUFFERANDROIDPROC) (EGLDisplay dpy, EGLSurface draw);
+#endif
+#endif // QCOM_HARDWARE
+
#ifndef EGL_ANDROID_recordable
#define EGL_ANDROID_recordable 1
#define EGL_RECORDABLE_ANDROID 0x3142 /* EGLConfig attribute */
diff --git a/opengl/libagl/Android.mk b/opengl/libagl/Android.mk
index ce55093..33ecbe8 100644
--- a/opengl/libagl/Android.mk
+++ b/opengl/libagl/Android.mk
@@ -47,6 +47,9 @@ endif
ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
endif
+ifeq ($(BOARD_USES_QCOM_HARDWARE),true)
+ LOCAL_CFLAGS += -DQCOM_HARDWARE
+endif
LOCAL_C_INCLUDES += bionic/libc/private
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 6d4098c..4c6d306 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -165,6 +165,9 @@ struct egl_surface_t
virtual EGLint getSwapBehavior() const;
virtual EGLBoolean swapBuffers();
virtual EGLBoolean setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h);
+#ifdef QCOM_HARDWARE
+ virtual EGLClientBuffer getRenderBuffer() const;
+#endif
protected:
GGLSurface depth;
};
@@ -208,6 +211,11 @@ EGLBoolean egl_surface_t::setSwapRectangle(
{
return EGL_FALSE;
}
+#ifdef QCOM_HARDWARE
+EGLClientBuffer egl_surface_t::getRenderBuffer() const {
+ return 0;
+}
+#endif
// ----------------------------------------------------------------------------
@@ -233,6 +241,9 @@ struct egl_window_surface_v2_t : public egl_surface_t
virtual EGLint getRefreshRate() const;
virtual EGLint getSwapBehavior() const;
virtual EGLBoolean setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h);
+#ifdef QCOM_HARDWARE
+ virtual EGLClientBuffer getRenderBuffer() const;
+#endif
private:
status_t lock(ANativeWindowBuffer* buf, int usage, void** vaddr);
@@ -571,6 +582,13 @@ EGLBoolean egl_window_surface_v2_t::setSwapRectangle(
return EGL_TRUE;
}
+#ifdef QCOM_HARDWARE
+EGLClientBuffer egl_window_surface_v2_t::getRenderBuffer() const
+{
+ return buffer;
+}
+#endif
+
EGLBoolean egl_window_surface_v2_t::bindDrawSurface(ogles_context_t* gl)
{
GGLSurface buffer;
@@ -800,6 +818,9 @@ static char const * const gExtensionsString =
// "KHR_image_pixmap "
"EGL_ANDROID_image_native_buffer "
"EGL_ANDROID_swap_rectangle "
+#ifdef QCOM_HARDWARE
+ "EGL_ANDROID_get_render_buffer "
+#endif
;
// ----------------------------------------------------------------------------
@@ -852,6 +873,10 @@ static const extention_map_t gExtentionMap[] = {
(__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR },
{ "eglSetSwapRectangleANDROID",
(__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID },
+#ifdef QCOM_HARDWARE
+ { "eglGetRenderBufferANDROID",
+ (__eglMustCastToProperFunctionPointerType)&eglGetRenderBufferANDROID },
+#endif
};
/*
@@ -2077,3 +2102,20 @@ EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
return EGL_TRUE;
}
+
+#ifdef QCOM_HARDWARE
+EGLClientBuffer eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw)
+{
+ if (egl_display_t::is_valid(dpy) == EGL_FALSE)
+ return setError(EGL_BAD_DISPLAY, (EGLClientBuffer)0);
+
+ egl_surface_t* d = static_cast<egl_surface_t*>(draw);
+ if (!d->isValid())
+ return setError(EGL_BAD_SURFACE, (EGLClientBuffer)0);
+ if (d->dpy != dpy)
+ return setError(EGL_BAD_DISPLAY, (EGLClientBuffer)0);
+
+ // post the surface
+ return d->getRenderBuffer();
+}
+#endif
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 993e379..8243be2 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -58,6 +58,10 @@ ifneq ($(MAX_EGL_CACHE_SIZE),)
LOCAL_CFLAGS += -DMAX_EGL_CACHE_SIZE=$(MAX_EGL_CACHE_SIZE)
endif
+ifeq ($(BOARD_USES_QCOM_HARDWARE),true)
+ LOCAL_CFLAGS += -DQCOM_HARDWARE
+endif
+
include $(BUILD_SHARED_LIBRARY)
installed_libEGL := $(LOCAL_INSTALLED_MODULE)
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 2b0ed5d..7310093 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -69,6 +69,10 @@ static const extention_map_t sExtentionMap[] = {
(__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeFrequencyNV },
{ "eglGetSystemTimeNV",
(__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeNV },
+#ifdef QCOM_HARDWARE
+ { "eglGetRenderBufferANDROID",
+ (__eglMustCastToProperFunctionPointerType)&eglGetRenderBufferANDROID },
+#endif
};
// accesses protected by sExtensionMapMutex
@@ -1444,6 +1448,26 @@ EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute
/* ANDROID extensions entry-point go here */
+#ifdef QCOM_HARDWARE
+EGLClientBuffer eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw)
+{
+ clearError();
+
+ egl_display_t const * const dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ SurfaceRef _s(dp, draw);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, (EGLClientBuffer*)0);
+
+ egl_surface_t const * const s = get_surface(draw);
+ if (s->cnx->egl.eglGetRenderBufferANDROID) {
+ return s->cnx->egl.eglGetRenderBufferANDROID(
+ dp->disp[s->impl].dpy, s->surface);
+ }
+ return setError(EGL_BAD_DISPLAY, (EGLClientBuffer*)0);
+}
+#endif
+
// ----------------------------------------------------------------------------
// NVIDIA extensions
// ----------------------------------------------------------------------------
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index 31119f9..c8916b8 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -51,6 +51,9 @@ static char const * const sExtensionString =
"EGL_KHR_fence_sync "
"EGL_NV_system_time "
"EGL_ANDROID_image_native_buffer " // mandatory
+#ifdef QCOM_HARDWARE
+ "EGL_ANDROID_get_render_buffer "
+#endif
;
// extensions not exposed to applications but used by the ANDROID system