summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-10-01 15:27:42 -0400
committerChia-I Wu <olvaffe@gmail.com>2011-03-16 20:18:39 +0800
commitf2d8241f014ea0f7f0a82cda9992986c93ed7962 (patch)
tree165987b4058d725c1fd88d0743ae5952b010ca70
parentf9172081caa67d1894af91220c776648f88ddbd2 (diff)
android: Add Android EGL extensions.
-rw-r--r--include/EGL/eglext.h14
-rw-r--r--src/egl/main/eglapi.c25
-rw-r--r--src/egl/main/eglapi.h8
-rw-r--r--src/egl/main/egldisplay.h3
-rw-r--r--src/egl/main/eglmisc.c3
5 files changed, 53 insertions, 0 deletions
diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
index fa523a5..44bae42 100644
--- a/include/EGL/eglext.h
+++ b/include/EGL/eglext.h
@@ -390,6 +390,20 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EG
#define EGL_Y_INVERTED_NOK 0x307F
#endif /* EGL_NOK_texture_from_pixmap */
+#ifndef EGL_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+struct android_native_buffer_t;
+#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_ANDROID_swap_rectangle
+#define EGL_ANDROID_swap_rectangle 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSetSwapRectangleANDROID (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSWAPRECTANGLEANDROIDPROC) (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
+#endif
+
#ifdef __cplusplus
}
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 19dfd57..90f6226 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -918,6 +918,9 @@ eglGetProcAddress(const char *procname)
{ "eglBindWaylandDisplayWL", (_EGLProc) eglBindWaylandDisplayWL },
{ "eglUnbindWaylandDisplayWL", (_EGLProc) eglUnbindWaylandDisplayWL },
#endif
+#ifdef EGL_ANDROID_swap_rectangle
+ { "eglSetSwapRectangleANDROID", (_EGLProc) eglSetSwapRectangleANDROID },
+#endif
{ NULL, NULL }
};
EGLint i;
@@ -1535,3 +1538,25 @@ eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
RETURN_EGL_EVAL(disp, ret);
}
#endif
+
+#ifdef EGL_ANDROID_swap_rectangle
+EGLBoolean EGLAPIENTRY
+eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
+ EGLint left, EGLint top,
+ EGLint width, EGLint height)
+{
+ _EGLDisplay *disp = _eglLockDisplay(dpy);
+ _EGLSurface *surf = _eglLookupSurface(draw, disp);
+ _EGLDriver *drv;
+ EGLBoolean ret;
+
+ _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
+
+ if (!disp->Extensions.ANDROID_swap_rectangle)
+ RETURN_EGL_EVAL(disp, EGL_FALSE);
+
+ ret = drv->API.SetSwapRectangleANDROID(drv, disp, surf, left, top, width, height);
+
+ RETURN_EGL_EVAL(disp, ret);
+}
+#endif
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index c9913f1..cb83bc0 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -101,6 +101,10 @@ typedef EGLBoolean (*BindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp,
typedef EGLBoolean (*UnbindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display);
#endif
+#ifdef EGL_ANDROID_swap_rectangle
+typedef EGLBoolean (*SetSwapRectangleANDROID_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw, EGLint left, EGLint top, EGLint width, EGLint height);
+#endif
+
/**
* The API dispatcher jumps through these functions
*/
@@ -180,6 +184,10 @@ struct _egl_api
BindWaylandDisplayWL_t BindWaylandDisplayWL;
UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL;
#endif
+
+#ifdef EGL_ANDROID_swap_rectangle
+ SetSwapRectangleANDROID_t SetSwapRectangleANDROID;
+#endif
};
#endif /* EGLAPI_INCLUDED */
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index b1547e4..8bbb9e9 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -78,6 +78,9 @@ struct _egl_extensions
EGLBoolean NOK_swap_region;
EGLBoolean NOK_texture_from_pixmap;
+
+ EGLBoolean ANDROID_image_native_buffer;
+ EGLBoolean ANDROID_swap_rectangle;
};
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index 6bb2498..32f0c03 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -111,6 +111,9 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
_EGL_CHECK_EXTENSION(NOK_swap_region);
_EGL_CHECK_EXTENSION(NOK_texture_from_pixmap);
+
+ _EGL_CHECK_EXTENSION(ANDROID_image_native_buffer);
+ _EGL_CHECK_EXTENSION(ANDROID_swap_rectangle);
#undef _EGL_CHECK_EXTENSION
}