[Mesa-dev] [PATCH 07/18] egl: add Android-specific extensions
Chad Versace
chad at chad-versace.us
Wed Aug 17 10:34:59 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Reviewed-by: Chad Versace <chad at chad-versace.us>
On 08/16/2011 11:28 PM, Chia-I Wu wrote:
> Add EGL_ANDROID_image_native_buffer and EGL_ANDROID_swap_rectangle.
> There is no spec for them though.
> ---
> include/EGL/eglext.h | 14 ++++++++++++++
> src/egl/main/eglapi.c | 25 +++++++++++++++++++++++++
> src/egl/main/eglapi.h | 8 ++++++++
> src/egl/main/egldisplay.h | 3 +++
> src/egl/main/eglmisc.c | 3 +++
> 5 files changed, 53 insertions(+), 0 deletions(-)
>
> diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
> index 9915b8c..0449ae2 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 5d186c6..3cb1a5b 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -948,6 +948,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;
> @@ -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
> diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
> index 4fcbe40..1e0aef6 100644
> --- a/src/egl/main/eglapi.h
> +++ b/src/egl/main/eglapi.h
> @@ -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 */
> diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
> index f0815d0..cddea80 100644
> --- a/src/egl/main/egldisplay.h
> +++ b/src/egl/main/egldisplay.h
> @@ -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;
> };
>
>
> diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
> index da189b6..ab48bc6 100644
> --- a/src/egl/main/eglmisc.c
> +++ b/src/egl/main/eglmisc.c
> @@ -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
> }
>
- --
Chad Versace
chad at chad-versace.us
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJOS/vDAAoJEAIvNt057x8i4hgP/RQyZexlxPFCeCPkKRXvlg4l
5YnCJumvsTwWgnSmS2QXkTSw+sZKCvdCC88dvlvwiBkbuN3A9sOSCh7DBaqEXM3u
XZefOUiQmr2bbp0W6vNFplgNhB6qjhVdlw9mQFizhE1NJD9aHyYE7NmOE/lYhGKy
DbV+gkTJfpRuTInGqiUyYO1uxlpcLYkj2dU4v5kuoC2H6937g0FbAi6y/IF7Sv21
bSg6muSGNnOhumIvUCPDLljKnBmtBcIeJFbxzc5bZbg/Vzz5UDVKnYEGLINIvgzt
jbAm/CTQ2OIACidENEISc0N0LyTlz7l3ECiDdG9zSFYNKrrRB4i4c/wAlcCAiR9T
0Nnpbb9ByOJxV0+PckI5LPZ8yz9Zxb3KZm6e+6GlxrvhLqUIyRil1eHJglLNxnvD
nfrtOWyd4iZh6QYuRNPj0IYoFfI9mQx2JmlKtC8THLsTqoRQPoRPTRfXuc3qEeec
Oc7FZAR75y9/OFhHCPCMaN1WRf1hZcTxU7/l21wYlTUBB2wHEDuMbkns3Crozkbu
DUQM7hh1RnrAW4USRHDeKlH7FRmcBTF6ikTSJKNw8mQhn/pfY85Sdqw1N3iNkfaG
7vct0bvKdylXaa3etIwDzV2dvXChKL2GWoY7l1PbGHpbMa18JCIdux1YkaaTFHt0
EQ613+vVc5DMtVOge9/h
=tBAX
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list