egl: add Android-specific extensions
authorChia-I Wu <olvaffe@gmail.com>
Fri, 1 Oct 2010 19:27:42 +0000 (15:27 -0400)
committerChia-I Wu <olvaffe@gmail.com>
Sat, 20 Aug 2011 18:01:48 +0000 (02:01 +0800)
Add EGL_ANDROID_image_native_buffer and EGL_ANDROID_swap_rectangle.
There is no spec for them though.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
include/EGL/eglext.h
src/egl/main/eglapi.c
src/egl/main/eglapi.h
src/egl/main/egldisplay.h
src/egl/main/eglmisc.c

index 9915b8cab3bbaf1dd9e81e254f846ec37607829b..0449ae2cd1a669dad1b32cdf52c052984c8f6a23 100644 (file)
@@ -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
 }
index 5d186c60e5a761617843601d50bad9d2f6558a19..3cb1a5baaf381adafa2903d1443e2283bccf30d6 100644 (file)
@@ -947,6 +947,9 @@ eglGetProcAddress(const char *procname)
 #ifdef EGL_WL_bind_wayland_display
       { "eglBindWaylandDisplayWL", (_EGLProc) eglBindWaylandDisplayWL },
       { "eglUnbindWaylandDisplayWL", (_EGLProc) eglUnbindWaylandDisplayWL },
+#endif
+#ifdef EGL_ANDROID_swap_rectangle
+      { "eglSetSwapRectangleANDROID", (_EGLProc) eglSetSwapRectangleANDROID },
 #endif
       { NULL, NULL }
    };
@@ -1565,3 +1568,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
index 4fcbe40cd4c8961f0d526fd1245ea45c7066cdd3..1e0aef69dd7004142f59b3ff05f518bcb6ce5336 100644 (file)
@@ -131,6 +131,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
  */
@@ -210,6 +214,10 @@ struct _egl_api
    BindWaylandDisplayWL_t BindWaylandDisplayWL;
    UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL;
 #endif
+
+#ifdef EGL_ANDROID_swap_rectangle
+   SetSwapRectangleANDROID_t SetSwapRectangleANDROID;
+#endif
 };
 
 #endif /* EGLAPI_INCLUDED */
index f0815d028dfc4455f1e6dd7e74d1f0635c940b7e..cddea803c24433b3ac225c6b615c764b3605af4b 100644 (file)
@@ -108,6 +108,9 @@ struct _egl_extensions
 
    EGLBoolean NOK_swap_region;
    EGLBoolean NOK_texture_from_pixmap;
+
+   EGLBoolean ANDROID_image_native_buffer;
+   EGLBoolean ANDROID_swap_rectangle;
 };
 
 
index da189b689a316534ec760b9f1197cfc3be67eb64..ab48bc68218255529830c8d243c3204e4c0a0f98 100644 (file)
@@ -113,6 +113,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
 }