summaryrefslogtreecommitdiff
path: root/src/egl/main/eglapi.c
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-08-15 22:58:13 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-01-25 11:28:27 +0800
commita1c4a8a3c855d52fbfef10023b9a8f116e163a97 (patch)
tree4e5138454e78a3ec05d9adce04420f7c5047e427 /src/egl/main/eglapi.c
parent95f8f75ad8bdb1d8e1cc16ea91fed8c407c36abd (diff)
egl: Add support for EGL_KHR_image.
Individual drivers still need to implement the API hooks.
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r--src/egl/main/eglapi.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index e57ce211b8..218de3ab6b 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -65,6 +65,7 @@
#include "eglconfig.h"
#include "eglscreen.h"
#include "eglmode.h"
+#include "eglimage.h"
/**
@@ -700,6 +701,10 @@ eglGetProcAddress(const char *procname)
{ "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA },
{ "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA },
#endif /* EGL_MESA_screen_surface */
+#ifdef EGL_KHR_image_base
+ { "eglCreateImageKHR", (_EGLProc) eglCreateImageKHR },
+ { "eglDestroyImageKHR", (_EGLProc) eglDestroyImageKHR },
+#endif /* EGL_KHR_image_base */
{ NULL, NULL }
};
EGLint i;
@@ -995,3 +1000,52 @@ eglReleaseThread(void)
#endif /* EGL_VERSION_1_2 */
+
+
+#ifdef EGL_KHR_image_base
+
+
+EGLImageKHR
+eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
+ EGLClientBuffer buffer, const EGLint *attr_list)
+{
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLContext *context = _eglLookupContext(ctx, disp);
+ _EGLDriver *drv;
+ _EGLImage *img;
+
+ drv = _eglCheckDisplay(disp, __FUNCTION__);
+ if (!drv)
+ return EGL_NO_IMAGE_KHR;
+ if (!context && ctx != EGL_NO_CONTEXT) {
+ _eglError(EGL_BAD_CONTEXT, __FUNCTION__);
+ return EGL_NO_IMAGE_KHR;
+ }
+
+ img = drv->API.CreateImageKHR(drv,
+ disp, context, target, buffer, attr_list);
+ if (img)
+ return _eglLinkImage(img, disp);
+ else
+ return EGL_NO_IMAGE_KHR;
+}
+
+
+EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
+{
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLImage *img = _eglLookupImage(image, disp);
+ _EGLDriver *drv;
+
+ drv = _eglCheckDisplay(disp, __FUNCTION__);
+ if (!drv)
+ return EGL_FALSE;
+ if (!img)
+ return _eglError(EGL_BAD_PARAMETER, __FUNCTION__);
+
+ _eglUnlinkImage(img);
+ return drv->API.DestroyImageKHR(drv, disp, img);
+}
+
+
+#endif /* EGL_KHR_image_base */