summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglapi.c
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2010-06-04 14:28:59 -0400
committerKristian Høgsberg <[email protected]>2010-08-25 09:17:47 -0400
commitb7a8893a2413adfddf4dc836676a19463fb6ffd7 (patch)
treeea03799b61f31600f49601c27bbe40ce8a18d9b1 /src/egl/main/eglapi.c
parent29bcbf5e797a18430285c75abb8a9300c8defe1d (diff)
egl: Add EGL_MESA_drm_image extension
Create EGLImages from DRM buffer handles.
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r--src/egl/main/eglapi.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index c62459ec6fb..31c5419bbc3 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -894,6 +894,10 @@ eglGetProcAddress(const char *procname)
#ifdef EGL_NOK_swap_region
{ "eglSwapBuffersRegionNOK", (_EGLProc) eglSwapBuffersRegionNOK },
#endif
+#ifdef EGL_MESA_drm_image
+ { "eglCreateDRMImageMESA", (_EGLProc) eglCreateDRMImageMESA },
+ { "eglExportDRMImageMESA", (_EGLProc) eglExportDRMImageMESA },
+#endif
{ NULL, NULL }
};
EGLint i;
@@ -1416,3 +1420,42 @@ eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface,
}
#endif /* EGL_NOK_swap_region */
+
+
+#ifdef EGL_MESA_drm_image
+
+EGLImageKHR EGLAPIENTRY
+eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list)
+{
+ _EGLDisplay *disp = _eglLockDisplay(dpy);
+ _EGLDriver *drv;
+ _EGLImage *img;
+ EGLImageKHR ret;
+
+ _EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv);
+
+ img = drv->API.CreateDRMImageMESA(drv, disp, attr_list);
+ ret = (img) ? _eglLinkImage(img, disp) : EGL_NO_IMAGE_KHR;
+
+ RETURN_EGL_EVAL(disp, ret);
+}
+
+EGLBoolean EGLAPIENTRY
+eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image,
+ EGLint *name, EGLint *handle, EGLint *stride)
+{
+ _EGLDisplay *disp = _eglLockDisplay(dpy);
+ _EGLImage *img = _eglLookupImage(image, disp);
+ _EGLDriver *drv;
+ EGLBoolean ret;
+
+ _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
+ if (!img)
+ RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
+
+ ret = drv->API.ExportDRMImageMESA(drv, disp, img, name, handle, stride);
+
+ RETURN_EGL_EVAL(disp, ret);
+}
+
+#endif