[Mesa-dev] [PATCH v2 7/8] egl: add optional plat_opt to _eglFindDisplay()

Emil Velikov emil.l.velikov at gmail.com
Tue Sep 4 18:33:04 UTC 2018


From: Emil Velikov <emil.velikov at collabora.com>

The EGL_EXT_platform_device extension will be coming shortly. It will
effectively require comparing the platform specific options, passed via
the attribs array.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
I'm not a huge fan of this. Yet again the other platform (x11) that uses
these has a number of issues, see below for details. Once those are resolved
we could try and make this more uniform.

 a) spec does not mention if a new (or the existing) EGLDislay should be
given for same native_dpy/screen_no combo.
 b) the implementation has number of issues:
 - screen 0 is hardcoded when using DEFAULT_DISPLAY
 - screen is _ignored_ when using !DEFAULT_DISPLAY
---
 src/egl/main/eglapi.c     |  2 +-
 src/egl/main/egldisplay.c | 12 +++++++-----
 src/egl/main/egldisplay.h |  2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 6df5e841463..0f018ff62ff 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -371,7 +371,7 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay)
    native_display_ptr = (void*) nativeDisplay;
 
    plat = _eglGetNativePlatform(native_display_ptr);
-   dpy = _eglFindDisplay(plat, native_display_ptr);
+   dpy = _eglFindDisplay(plat, native_display_ptr, NULL);
    return _eglGetDisplayHandle(dpy);
 }
 
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 387df6a66d0..94f94bb96e6 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -211,9 +211,11 @@ _eglFiniDisplay(void)
 /**
  * Find the display corresponding to the specified native display, or create a
  * new one.
+ *
+ * Certain platform types can use plat_opt.
  */
 _EGLDisplay *
-_eglFindDisplay(_EGLPlatformType plat, void *plat_dpy)
+_eglFindDisplay(_EGLPlatformType plat, void *plat_dpy, void *plat_opt)
 {
    _EGLDisplay *dpy;
 
@@ -477,7 +479,7 @@ _eglGetX11Display(Display *native_display,
                   const EGLAttrib *attrib_list)
 {
    _EGLDisplay *display = _eglFindDisplay(_EGL_PLATFORM_X11,
-                                          native_display);
+                                          native_display, NULL);
 
    if (!display) {
       _eglError(EGL_BAD_ALLOC, "eglGetPlatformDisplay");
@@ -503,7 +505,7 @@ _eglGetGbmDisplay(struct gbm_device *native_display,
       return NULL;
    }
 
-   return _eglFindDisplay(_EGL_PLATFORM_DRM, native_display);
+   return _eglFindDisplay(_EGL_PLATFORM_DRM, native_display, NULL);
 }
 #endif /* HAVE_DRM_PLATFORM */
 
@@ -518,7 +520,7 @@ _eglGetWaylandDisplay(struct wl_display *native_display,
       return NULL;
    }
 
-   return _eglFindDisplay(_EGL_PLATFORM_WAYLAND, native_display);
+   return _eglFindDisplay(_EGL_PLATFORM_WAYLAND, native_display, NULL);
 }
 #endif /* HAVE_WAYLAND_PLATFORM */
 
@@ -539,6 +541,6 @@ _eglGetSurfacelessDisplay(void *native_display,
       return NULL;
    }
 
-   return _eglFindDisplay(_EGL_PLATFORM_SURFACELESS, native_display);
+   return _eglFindDisplay(_EGL_PLATFORM_SURFACELESS, native_display, NULL);
 }
 #endif /* HAVE_SURFACELESS_PLATFORM */
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index fae90520368..f43d7b589fa 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -201,7 +201,7 @@ _eglFiniDisplay(void);
 
 
 extern _EGLDisplay *
-_eglFindDisplay(_EGLPlatformType plat, void *plat_dpy);
+_eglFindDisplay(_EGLPlatformType plat, void *plat_dpy, void *plat_opt);
 
 
 extern void
-- 
2.18.0



More information about the mesa-dev mailing list