Mesa (master): egl: Add support for EGL_MESA_drm_display.

Chia-I Wu olv at kemper.freedesktop.org
Wed Jun 23 00:15:59 PDT 2010


Module: Mesa
Branch: master
Commit: 78d70ddbbd41d73b7f6040f392eb87758c39dc37
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=78d70ddbbd41d73b7f6040f392eb87758c39dc37

Author: Chia-I Wu <olv at lunarg.com>
Date:   Thu Jun 17 17:09:01 2010 +0800

egl: Add support for EGL_MESA_drm_display.

The extension defines eglGetDRMDisplay that creates an EGLDisplay from a
DRM fd.  Calling eglCreateWindowSurace or eglCreatePixmapSurface with
such displays will generate EGL_BAD_NATIVE_WINDOW or
EGL_BAD_NATIVE_PIXMAP.

---

 include/EGL/eglext.h      |   11 +++++++++++
 src/egl/main/eglapi.c     |   14 ++++++++++++++
 src/egl/main/egldisplay.h |    1 +
 src/egl/main/eglmisc.c    |    1 +
 4 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
index ce1dca3..68591bd 100644
--- a/include/EGL/eglext.h
+++ b/include/EGL/eglext.h
@@ -208,6 +208,17 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYCONTEXTMESA) (EGLDisplay dpy, EGLCont
 
 #endif /* EGL_MESA_copy_context */
 
+#ifndef EGL_MESA_drm_display
+#define EGL_MESA_drm_display 1
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDRMDisplayMESA(int fd);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDRMDISPLAYMESA) (int fd);
+
+#endif /* EGL_MESA_drm_display */
+
 #ifndef EGL_KHR_image_base
 #define EGL_KHR_image_base 1
 /* Most interfaces defined by EGL_KHR_image_pixmap above */
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 32a79d8..1ec1486 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -843,6 +843,9 @@ eglGetProcAddress(const char *procname)
       { "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA },
       { "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA },
 #endif /* EGL_MESA_screen_surface */
+#ifdef EGL_MESA_drm_display
+      { "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA },
+#endif
 #ifdef EGL_KHR_image_base
       { "eglCreateImageKHR", (_EGLProc) eglCreateImageKHR },
       { "eglDestroyImageKHR", (_EGLProc) eglDestroyImageKHR },
@@ -1105,6 +1108,17 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
 #endif /* EGL_MESA_screen_surface */
 
 
+#ifdef EGL_MESA_drm_display
+
+EGLDisplay EGLAPIENTRY
+eglGetDRMDisplayMESA(int fd)
+{
+   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) fd);
+   return _eglGetDisplayHandle(dpy);
+}
+
+#endif /* EGL_MESA_drm_display */
+
 /**
  ** EGL 1.2
  **/
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 65dfdc3..0b325f7 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -51,6 +51,7 @@ struct _egl_extensions
 {
    EGLBoolean MESA_screen_surface;
    EGLBoolean MESA_copy_context;
+   EGLBoolean MESA_drm_display;
    EGLBoolean KHR_image_base;
    EGLBoolean KHR_image_pixmap;
    EGLBoolean KHR_vg_parent_image;
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index 4652969..281138c 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -84,6 +84,7 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
 
    _EGL_CHECK_EXTENSION(MESA_screen_surface);
    _EGL_CHECK_EXTENSION(MESA_copy_context);
+   _EGL_CHECK_EXTENSION(MESA_drm_display);
 
    _EGL_CHECK_EXTENSION(KHR_image_base);
    _EGL_CHECK_EXTENSION(KHR_image_pixmap);



More information about the mesa-commit mailing list