[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libglvnd: Changes to 'debian-unstable'



 README.md                                      |   74 ++++
 configure.ac                                   |   26 +
 debian/changelog                               |    9 
 debian/libglvnd0.symbols                       |    2 
 debian/libglx0.symbols                         |    1 
 include/glvnd/GLdispatchABI.h                  |   10 
 include/glvnd/libeglabi.h                      |   26 +
 src/EGL/libegl.c                               |   36 ++
 src/EGL/libeglvendor.c                         |    9 
 src/EGL/libeglvendor.h                         |    1 
 src/GL/Makefile.am                             |    1 
 src/GL/libgl.c                                 |    5 
 src/GL/libgl.h                                 |    8 
 src/GLX/libglx.c                               |   50 ++-
 src/GLX/libglxgl.h                             |   44 ++
 src/GLX/libglxmapping.c                        |    1 
 src/GLdispatch/vnd-glapi/entry_aarch64_tsd.c   |   36 --
 src/GLdispatch/vnd-glapi/entry_armv7_tsd.c     |  113 ++++---
 src/GLdispatch/vnd-glapi/entry_files.mk        |   21 +
 src/GLdispatch/vnd-glapi/entry_ppc64le_tls.c   |  168 +++++++++++
 src/GLdispatch/vnd-glapi/entry_ppc64le_tsd.c   |  216 ++++++++++++++
 src/GLdispatch/vnd-glapi/entry_simple_asm.c    |   81 +++++
 src/GLdispatch/vnd-glapi/entry_x86_64_common.c |   79 -----
 src/GLdispatch/vnd-glapi/entry_x86_64_tls.c    |   72 +++-
 src/generate/gen_libgl_glxstubs.py             |   33 +-
 src/util/glvnd_genentry.c                      |   48 ++-
 tests/Makefile.am                              |   20 -
 tests/dummy/EGL_dummy.c                        |    1 
 tests/dummy/GLX_dummy.c                        |    2 
 tests/dummy/patchentrypoints.c                 |   70 ++++
 tests/dummy/patchentrypoints.h                 |    4 
 tests/testgldispatch.c                         |  379 +++++++++++++++++++++++++
 tests/testgldispatch_generated.sh              |    4 
 tests/testgldispatch_patched.sh                |    4 
 tests/testgldispatch_static.sh                 |    4 
 tests/testpatchentrypoints_gldispatch.c        |  185 ------------
 tests/testpatchentrypoints_gldispatch.sh       |    4 
 37 files changed, 1384 insertions(+), 463 deletions(-)

New commits:
commit bf103f9ec1595e827307edee7de2d74cd374fe2f
Author: Timo Aaltonen <tjaalton@debian.org>
Date:   Wed Aug 2 09:49:15 2017 +0300

    release to unstable

diff --git a/debian/changelog b/debian/changelog
index 28a76d9..543bc64 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,11 @@
-libglvnd (0.2.999+git20170802-1) UNRELEASED; urgency=medium
+libglvnd (0.2.999+git20170802-1) unstable; urgency=medium
 
   * New upstream snapshot.
   * libglx0.symbols: Updated.
   * libglvnd0.symbols: Arm64 doesn't have support for TLS stubs yet.
     (Closes: #870444)
 
- -- Timo Aaltonen <tjaalton@debian.org>  Wed, 02 Aug 2017 08:29:50 +0300
+ -- Timo Aaltonen <tjaalton@debian.org>  Wed, 02 Aug 2017 09:33:03 +0300
 
 libglvnd (0.2.999+git20170201-4) experimental; urgency=medium
 

commit daf3877f6690eb9d7a2188d7780268a527c52302
Author: Timo Aaltonen <tjaalton@debian.org>
Date:   Wed Aug 2 09:13:21 2017 +0300

    libglvnd0.symbols: Arm64 doesn't have support for TLS stubs yet. (Closes: #870444)

diff --git a/debian/changelog b/debian/changelog
index 8519727..28a76d9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ libglvnd (0.2.999+git20170802-1) UNRELEASED; urgency=medium
 
   * New upstream snapshot.
   * libglx0.symbols: Updated.
+  * libglvnd0.symbols: Arm64 doesn't have support for TLS stubs yet.
+    (Closes: #870444)
 
  -- Timo Aaltonen <tjaalton@debian.org>  Wed, 02 Aug 2017 08:29:50 +0300
 
diff --git a/debian/libglvnd0.symbols b/debian/libglvnd0.symbols
index 2b00533..cbcfd58 100644
--- a/debian/libglvnd0.symbols
+++ b/debian/libglvnd0.symbols
@@ -16,4 +16,4 @@ libGLdispatch.so.0 libglvnd0 #MINVER#
  __glDispatchUnregisterStubCallbacks@Base 0
  _glapi_Current@Base 0
  _glapi_get_current@Base 0
- _glapi_tls_Current@Base 0
+ (arch=!arm64) _glapi_tls_Current@Base 0

commit b2ca40ff11e84d68f97a031b694558de0e726395
Author: Timo Aaltonen <tjaalton@debian.org>
Date:   Wed Aug 2 08:36:44 2017 +0300

    libglx0.symbols: Updated.

diff --git a/debian/changelog b/debian/changelog
index adb7d0d..8519727 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 libglvnd (0.2.999+git20170802-1) UNRELEASED; urgency=medium
 
   * New upstream snapshot.
+  * libglx0.symbols: Updated.
 
  -- Timo Aaltonen <tjaalton@debian.org>  Wed, 02 Aug 2017 08:29:50 +0300
 
diff --git a/debian/libglx0.symbols b/debian/libglx0.symbols
index c0e8f3d..9a2636d 100644
--- a/debian/libglx0.symbols
+++ b/debian/libglx0.symbols
@@ -1,4 +1,5 @@
 libGLX.so.0 libglx0 #MINVER#
+ __GLXGL_CORE_FUNCTIONS@Base 0
  __glXGLLoadGLXFunction@Base 0
  glXChooseFBConfig@Base 0
  glXChooseVisual@Base 0

commit 0531fd187491765e1623b7523cd05f00e13123d0
Author: Timo Aaltonen <tjaalton@debian.org>
Date:   Wed Aug 2 08:36:25 2017 +0300

    update the changelog

diff --git a/debian/changelog b/debian/changelog
index 4be6b55..adb7d0d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libglvnd (0.2.999+git20170802-1) UNRELEASED; urgency=medium
+
+  * New upstream snapshot.
+
+ -- Timo Aaltonen <tjaalton@debian.org>  Wed, 02 Aug 2017 08:29:50 +0300
+
 libglvnd (0.2.999+git20170201-4) experimental; urgency=medium
 
   * copyright: Updated.

commit a14972089e27d6c191491d8287bc283790a5d74d
Author: Kyle Brenneman <kbrenneman@nvidia.com>
Date:   Tue Jul 25 08:50:10 2017 -0600

    EGL: Fix handling a malloc failure in eglQueryString.
    
    In GetClientExtensionString, if it runs into a malloc failure, then return NULL
    instead of trying to dereference the result.

diff --git a/src/EGL/libegl.c b/src/EGL/libegl.c
index 0cd33cc..6586ada 100644
--- a/src/EGL/libegl.c
+++ b/src/EGL/libegl.c
@@ -870,7 +870,7 @@ static char *GetClientExtensionString(void)
         if (vendorString != NULL && vendorString[0] != '\0') {
             result = UnionExtensionStrings(result, vendorString);
             if (result == NULL) {
-                break;
+                return NULL;
             }
         }
     }

commit 75c77c4f9e0891603c38d7fc88b8563e1d41e4c6
Author: Kyle Brenneman <kbrenneman@nvidia.com>
Date:   Tue Jul 25 08:46:47 2017 -0600

    GLX: Fix an error in handling GLX dispatch stubs.
    
    In __glXGetGLXDispatchAddress, add a missing call to
    __GLXapiImports::getProcAddress.

diff --git a/src/GLX/libglxmapping.c b/src/GLX/libglxmapping.c
index bddbb52..5f909ba 100644
--- a/src/GLX/libglxmapping.c
+++ b/src/GLX/libglxmapping.c
@@ -198,6 +198,7 @@ __GLXextFuncPtr __glXGetGLXDispatchAddress(const GLubyte *procName)
         // it does, then that means this is really a GL function that happens
         // to start with "glX".
         HASH_ITER(hh, _LH(__glXVendorNameHash), pEntry, tmp) {
+            addr = pEntry->vendor.glxvc->getProcAddress((const GLubyte *) procName);
             if (addr != NULL) {
                 break;
             }

commit d850cdde46dd0633405e758fbee49119e384b639
Author: Kyle Brenneman <kbrenneman@users.noreply.github.com>
Date:   Tue Jun 20 12:53:54 2017 -0600

    GL: Use a table to look up core GLX functions. (#127)
    
    libGL.so now looks up the GLX core functions using a simple table, so that it
    doesn't have the overhead of looking them up by name every time it's loaded.
    
    Removed the (mutex != NULL) checks from __glXGLLoadGLXFunction, since it's no
    longer called without a mutex.
    
    Removed __glXWrapperInit, since it doesn't do anything anymore. Also removed the header file libgl.h, which only contained the declaration for __glXWrapperInit.

diff --git a/src/GL/Makefile.am b/src/GL/Makefile.am
index b0b1c68..05b4ad4 100644
--- a/src/GL/Makefile.am
+++ b/src/GL/Makefile.am
@@ -32,7 +32,6 @@ MAPI = $(top_srcdir)/$(MAPI_PREFIX)
 GLAPI = $(MAPI)/glapi
 
 noinst_HEADERS =        \
-	libgl.h             \
 	g_glapi_mapi_gl_tmp.h
 
 include $(top_srcdir)/src/GLdispatch/vnd-glapi/entry_files.mk
diff --git a/src/GL/libgl.c b/src/GL/libgl.c
index 42ef173..5326016 100644
--- a/src/GL/libgl.c
+++ b/src/GL/libgl.c
@@ -30,7 +30,7 @@
 #include <dlfcn.h>
 #include <GL/gl.h>
 #include <GL/glx.h>
-#include "libgl.h"
+#include "libglxgl.h"
 #include "compiler.h"
 #include "entry.h"
 #include "stub.h"
@@ -53,9 +53,6 @@ void _init(void)
     // Register these entrypoints with GLdispatch so they can be overwritten at
     // runtime
     patchStubId = __glDispatchRegisterStubCallbacks(stub_get_patch_callbacks());
-
-    // Lookup function pointers from libGLX for the GLX entrypoints
-    __glXWrapperInit();
 }
 
 #if defined(USE_ATTRIBUTE_CONSTRUCTOR)
diff --git a/src/GL/libgl.h b/src/GL/libgl.h
deleted file mode 100644
index 2a1eb4a..0000000
--- a/src/GL/libgl.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __libgl_h__
-#define __libgl_h__
-
-#include "libglxgl.h"
-
-extern void __glXWrapperInit(void);
-
-#endif
diff --git a/src/GLX/libglx.c b/src/GLX/libglx.c
index a2a9502..8779981 100644
--- a/src/GLX/libglx.c
+++ b/src/GLX/libglx.c
@@ -1783,9 +1783,7 @@ PUBLIC __GLXextFuncPtr __glXGLLoadGLXFunction(const char *name,
 {
     __GLXextFuncPtr func;
 
-    if (mutex != NULL) {
-        __glvndPthreadFuncs.mutex_lock(mutex);
-    }
+    __glvndPthreadFuncs.mutex_lock(mutex);
 
     func = *ptr;
     if (func == NULL) {
@@ -1793,9 +1791,7 @@ PUBLIC __GLXextFuncPtr __glXGLLoadGLXFunction(const char *name,
         *ptr = func;
     }
 
-    if (mutex != NULL) {
-        __glvndPthreadFuncs.mutex_unlock(mutex);
-    }
+    __glvndPthreadFuncs.mutex_unlock(mutex);
     return func;
 }
 
@@ -1975,6 +1971,48 @@ static void __glXResetOnFork(void)
     __glXMappingTeardown(True);
 }
 
+PUBLIC const __glXGLCoreFunctions __GLXGL_CORE_FUNCTIONS = {
+    glXChooseFBConfig,
+    glXChooseVisual,
+    glXCopyContext,
+    glXCreateContext,
+    glXCreateGLXPixmap,
+    glXCreateNewContext,
+    glXCreatePbuffer,
+    glXCreatePixmap,
+    glXCreateWindow,
+    glXDestroyContext,
+    glXDestroyGLXPixmap,
+    glXDestroyPbuffer,
+    glXDestroyPixmap,
+    glXDestroyWindow,
+    glXGetClientString,
+    glXGetConfig,
+    glXGetCurrentContext,
+    glXGetCurrentDrawable,
+    glXGetCurrentReadDrawable,
+    glXGetFBConfigAttrib,
+    glXGetFBConfigs,
+    glXGetProcAddress,
+    glXGetProcAddressARB,
+    glXGetSelectedEvent,
+    glXGetVisualFromFBConfig,
+    glXIsDirect,
+    glXMakeContextCurrent,
+    glXMakeCurrent,
+    glXQueryContext,
+    glXQueryDrawable,
+    glXQueryExtension,
+    glXQueryExtensionsString,
+    glXQueryServerString,
+    glXQueryVersion,
+    glXSelectEvent,
+    glXSwapBuffers,
+    glXUseXFont,
+    glXWaitGL,
+    glXWaitX,
+};
+
 #if defined(USE_ATTRIBUTE_CONSTRUCTOR)
 void __attribute__ ((constructor)) __glXInit(void)
 #else
diff --git a/src/GLX/libglxgl.h b/src/GLX/libglxgl.h
index 33e8ce3..359369a 100644
--- a/src/GLX/libglxgl.h
+++ b/src/GLX/libglxgl.h
@@ -8,6 +8,48 @@
  * Glue header defining the ABI between libGLX and the libGL wrapper library.
  */
 
+typedef struct {
+    GLXFBConfig * (* ptr_glXChooseFBConfig) (Display *dpy, int screen, const int *attrib_list, int *nelements);
+    XVisualInfo * (* ptr_glXChooseVisual) (Display *dpy, int screen, int *attribList);
+    void (* ptr_glXCopyContext) (Display *dpy, GLXContext src, GLXContext dst, unsigned long mask);
+    GLXContext (* ptr_glXCreateContext) (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
+    GLXPixmap (* ptr_glXCreateGLXPixmap) (Display *dpy, XVisualInfo *visual, Pixmap pixmap);
+    GLXContext (* ptr_glXCreateNewContext) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
+    GLXPbuffer (* ptr_glXCreatePbuffer) (Display *dpy, GLXFBConfig config, const int *attrib_list);
+    GLXPixmap (* ptr_glXCreatePixmap) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
+    GLXWindow (* ptr_glXCreateWindow) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
+    void (* ptr_glXDestroyContext) (Display *dpy, GLXContext ctx);
+    void (* ptr_glXDestroyGLXPixmap) (Display *dpy, GLXPixmap pixmap);
+    void (* ptr_glXDestroyPbuffer) (Display *dpy, GLXPbuffer pbuf);
+    void (* ptr_glXDestroyPixmap) (Display *dpy, GLXPixmap pixmap);
+    void (* ptr_glXDestroyWindow) (Display *dpy, GLXWindow win);
+    const char * (* ptr_glXGetClientString) (Display *dpy, int name);
+    int (* ptr_glXGetConfig) (Display *dpy, XVisualInfo *visual, int attrib, int *value);
+    GLXContext (* ptr_glXGetCurrentContext) (void);
+    GLXDrawable (* ptr_glXGetCurrentDrawable) (void);
+    GLXDrawable (* ptr_glXGetCurrentReadDrawable) (void);
+    int (* ptr_glXGetFBConfigAttrib) (Display *dpy, GLXFBConfig config, int attribute, int *value);
+    GLXFBConfig * (* ptr_glXGetFBConfigs) (Display *dpy, int screen, int *nelements);
+    __GLXextFuncPtr (* ptr_glXGetProcAddress) (const GLubyte *procName);
+    __GLXextFuncPtr (* ptr_glXGetProcAddressARB) (const GLubyte *procName);
+    void (* ptr_glXGetSelectedEvent) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
+    XVisualInfo * (* ptr_glXGetVisualFromFBConfig) (Display *dpy, GLXFBConfig config);
+    Bool (* ptr_glXIsDirect) (Display *dpy, GLXContext ctx);
+    Bool (* ptr_glXMakeContextCurrent) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
+    Bool (* ptr_glXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx);
+    int (* ptr_glXQueryContext) (Display *dpy, GLXContext ctx, int attribute, int *value);
+    void (* ptr_glXQueryDrawable) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
+    Bool (* ptr_glXQueryExtension) (Display *dpy, int *errorb, int *event);
+    const char * (* ptr_glXQueryExtensionsString) (Display *dpy, int screen);
+    const char * (* ptr_glXQueryServerString) (Display *dpy, int screen, int name);
+    Bool (* ptr_glXQueryVersion) (Display *dpy, int *maj, int *min);
+    void (* ptr_glXSelectEvent) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
+    void (* ptr_glXSwapBuffers) (Display *dpy, GLXDrawable drawable);
+    void (* ptr_glXUseXFont) (Font font, int first, int count, int list);
+    void (* ptr_glXWaitGL) (void);
+    void (* ptr_glXWaitX) (void);
+} __glXGLCoreFunctions;
+
 /**
  * Called from libGL.so to load a GLX function.
  *
@@ -28,4 +70,6 @@
  */
 extern __GLXextFuncPtr __glXGLLoadGLXFunction(const char *name, __GLXextFuncPtr *ptr, glvnd_mutex_t *mutex);
 
+extern const __glXGLCoreFunctions __GLXGL_CORE_FUNCTIONS;
+
 #endif // !defined(__LIB_GLX_GL_H)
diff --git a/src/generate/gen_libgl_glxstubs.py b/src/generate/gen_libgl_glxstubs.py
index df56035..acbe731 100755
--- a/src/generate/gen_libgl_glxstubs.py
+++ b/src/generate/gen_libgl_glxstubs.py
@@ -84,19 +84,15 @@ _SKIP_GLX_FUNCTIONS = frozenset((
     "glXDestroyGLXVideoSourceSGIX",
 ))
 
-def generateGLXStubFunction(func):
+def generateGLXExtensionStubFunction(func):
     text = ""
     text += "typedef {f.rt} (*fn_{f.name}_ptr)({f.decArgs});\n"
     text += "static fn_{f.name}_ptr __real_{f.name};\n"
-    if (func.name not in _LIBGLX_FUNCTIONS):
-        text += "static glvnd_mutex_t __mutex_{f.name} = GLVND_MUTEX_INITIALIZER;\n"
+    text += "static glvnd_mutex_t __mutex_{f.name} = GLVND_MUTEX_INITIALIZER;\n"
     text += "PUBLIC {f.rt} {f.name}({f.decArgs})\n"
     text += "{{\n"
     text += "    fn_{f.name}_ptr _real = "
-    if (func.name not in _LIBGLX_FUNCTIONS):
-        text += "(fn_{f.name}_ptr) LOAD_GLX_FUNC({f.name});\n"
-    else:
-        text += "__real_{f.name};\n"
+    text += "(fn_{f.name}_ptr) LOAD_GLX_FUNC({f.name});\n"
 
     text += "    if(_real != NULL) {{\n"
     if (func.hasReturn()):
@@ -110,6 +106,16 @@ def generateGLXStubFunction(func):
 
     return text.format(f=func, retVal=getDefaultReturnValue(func))
 
+def generateGLXCoreStubFunction(func):
+    text = "PUBLIC {f.rt} {f.name}({f.decArgs})\n"
+    text += "{{\n"
+    text += "    "
+    if (func.hasReturn()):
+        text += "return "
+    text += "__GLXGL_CORE_FUNCTIONS.ptr_{f.name}({f.callArgs});\n"
+    text += "}}\n\n"
+    return text.format(f=func)
+
 def generateLibGLXStubs(functions):
     text = r"""
 /*
@@ -119,7 +125,7 @@ def generateLibGLXStubs(functions):
 #include <X11/Xlib.h>
 #include <GL/glx.h>
 #include "compiler.h"
-#include "libgl.h"
+#include "libglxgl.h"
 #include "glvnd_pthread.h"
 
 """.lstrip("\n")
@@ -127,15 +133,10 @@ def generateLibGLXStubs(functions):
     text += "#define LOAD_GLX_FUNC(name) __glXGLLoadGLXFunction(#name, (__GLXextFuncPtr *) &__real_##name, &__mutex_##name)\n\n"
 
     for func in functions:
-        text += generateGLXStubFunction(func)
-
-    text += "\n"
-    text += "void __glXWrapperInit(void)\n"
-    text += "{\n"
-    for func in functions:
         if (func.name in _LIBGLX_FUNCTIONS):
-            text += '    __glXGLLoadGLXFunction("{f.name}", (__GLXextFuncPtr *) &__real_{f.name}, NULL);\n'.format(f=func)
-    text += "}\n"
+            text += generateGLXCoreStubFunction(func)
+        else:
+            text += generateGLXExtensionStubFunction(func)
 
     return text
 

commit 71226b013c7412b925a7100770e84e3620069d5a
Author: Kyle Brenneman <kbrenneman@users.noreply.github.com>
Date:   Tue Jun 20 12:50:40 2017 -0600

    EGL: Allow vendor libraries to identify platforms for eglGetDisplay. (#124)
    
    EGL: Allow vendor libraries to identify platforms for eglGetDisplay.
    
    Add a new optional function __EGLapiImports::findNativeDisplayPlatform. Vendor
    libraries can provide that function to identify the platform for the native
    display passed to eglGetDisplay.
    
    Reviewed-by: Emil Velikov emil.velikov@collabora.com

diff --git a/include/glvnd/libeglabi.h b/include/glvnd/libeglabi.h
index 087c330..1079c3c 100644
--- a/include/glvnd/libeglabi.h
+++ b/include/glvnd/libeglabi.h
@@ -86,7 +86,7 @@ extern "C" {
  * will still work.
  */
 #define EGL_VENDOR_ABI_MAJOR_VERSION ((uint32_t) 0)
-#define EGL_VENDOR_ABI_MINOR_VERSION ((uint32_t) 0)
+#define EGL_VENDOR_ABI_MINOR_VERSION ((uint32_t) 1)
 #define EGL_VENDOR_ABI_VERSION ((EGL_VENDOR_ABI_MAJOR_VERSION << 16) | EGL_VENDOR_ABI_MINOR_VERSION)
 static inline uint32_t EGL_VENDOR_ABI_GET_MAJOR_VERSION(uint32_t version)
 {
@@ -388,6 +388,30 @@ typedef struct __EGLapiImportsRec {
      */
     void (*patchThreadAttach)(void);
 
+    /*!
+     * (OPTIONAL) Tries to determine the platform type for a native display.
+     *
+     * If the vendor library provides this function, then libglvnd will call it
+     * to determine which platform to use for a native display handle in
+     * eglGetDisplay.
+     *
+     * If no vendor library identifies the platform, then libglvnd will fall
+     * back to its own platform detection logic.
+     *
+     * Libglvnd can call this function for any native display handle except
+     * \c EGL_DEFAULT_DISPLAY.
+     *
+     * No matter what the value of \p native_display, the vendor library must
+     * not crash, and must not return a false match. If the vendor library
+     * can't identify the display, then it must return \c EGL_NONE.
+     *
+     * In particular, that means that a vendor library must not return any sort
+     * of default or fallback platform.
+     *
+     * \param native_display The native display handle passed to eglGetDisplay.
+     * \return Either a platform type enum or EGL_NONE.
+     */
+    EGLenum (* findNativeDisplayPlatform) (void *native_display);
 } __EGLapiImports;
 
 /*****************************************************************************/
diff --git a/src/EGL/libegl.c b/src/EGL/libegl.c
index 0052efa..0cd33cc 100644
--- a/src/EGL/libegl.c
+++ b/src/EGL/libegl.c
@@ -212,7 +212,17 @@ static EGLenum GuessPlatformType(EGLNativeDisplayType display_id)
     struct glvnd_list *vendorList = __eglLoadVendors();
     __EGLvendorInfo *vendor;
 
-    // First, see if this is a valid EGLDisplayEXT handle.
+    // First, see if any of the vendor libraries can identify the display.
+    glvnd_list_for_each_entry(vendor, vendorList, entry) {
+        if (vendor->eglvc.findNativeDisplayPlatform != NULL) {
+            EGLenum platform = vendor->eglvc.findNativeDisplayPlatform((void *) display_id);
+            if (platform != EGL_NONE) {
+                return platform;
+            }
+        }
+    }
+
+    // Next, see if this is a valid EGLDisplayEXT handle.
     if (__eglGetVendorFromDevice((EGLDeviceEXT) display_id)) {
         return EGL_PLATFORM_DEVICE_EXT;
     }

commit 7751d668e54aff3aeea5ddb2f5202267d19c23f1
Author: Kyle Brenneman <kbrenneman@nvidia.com>
Date:   Mon Jun 12 12:38:00 2017 -0600

    configure: Remove AC_PROG_CXX.
    
    Libglvnd doesn't use C++ anywhere, so it doesn't need the C++ compiler.

diff --git a/configure.ac b/configure.ac
index 3665c87..5443734 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,8 +19,6 @@ AM_INIT_AUTOMAKE([1.11 foreign silent-rules])
 AM_SILENT_RULES([yes])
 
 dnl Checks for programs.
-AC_PROG_CXX
-
 AC_PROG_CC
 AC_PROG_CC_C99
 AM_PROG_AS

commit 8b4f6aeb7ad76b36407a51e3d8cd50198b45677e
Author: Kyle Brenneman <kbrenneman@nvidia.com>
Date:   Mon Jun 12 14:10:45 2017 -0600

    PPC64LE: Fix the cache clear instructions.
    
    Change the cache clear instructions for generated PPC64LE code so that it uses
    an input variable instead of an output variable.
    
    With an output variable, it doesn't use the correct address for the dcbst and
    icbi instructions, possibly causing it to crash.

diff --git a/src/GLdispatch/vnd-glapi/entry_ppc64le_tls.c b/src/GLdispatch/vnd-glapi/entry_ppc64le_tls.c
index 5d3d2f6..269fc40 100644
--- a/src/GLdispatch/vnd-glapi/entry_ppc64le_tls.c
+++ b/src/GLdispatch/vnd-glapi/entry_ppc64le_tls.c
@@ -162,7 +162,7 @@ void entry_generate_default_code(char *entry, int slot)
                          "  sync\n\t"
                          "  icbi 0, %0\n\t"
                          "  isync\n"
-                         : "=r" (writeEntry)
+                         : : "r" (writeEntry)
                      );
 }
 
diff --git a/src/GLdispatch/vnd-glapi/entry_ppc64le_tsd.c b/src/GLdispatch/vnd-glapi/entry_ppc64le_tsd.c
index de18e2c..974bc60 100644
--- a/src/GLdispatch/vnd-glapi/entry_ppc64le_tsd.c
+++ b/src/GLdispatch/vnd-glapi/entry_ppc64le_tsd.c
@@ -210,7 +210,7 @@ void entry_generate_default_code(char *entry, int slot)
                          "  sync\n\t"
                          "  icbi 0, %0\n\t"
                          "  isync\n"
-                         : "=r" (writeEntry)
+                         : : "r" (writeEntry)
                      );
 }
 
diff --git a/src/util/glvnd_genentry.c b/src/util/glvnd_genentry.c
index 15390e6..1f321fc 100644
--- a/src/util/glvnd_genentry.c
+++ b/src/util/glvnd_genentry.c
@@ -327,7 +327,7 @@ void SetDispatchFuncPointer(GLVNDGenEntrypoint *entry,
                          "  sync\n\t"
                          "  icbi 0, %0\n\t"
                          "  isync\n"
-                         : "=r" (code)
+                         : : "r" (code)
                      );
 #else
 #error "Can't happen -- not implemented"
diff --git a/tests/dummy/patchentrypoints.c b/tests/dummy/patchentrypoints.c
index ec38312..6d57a5a 100644
--- a/tests/dummy/patchentrypoints.c
+++ b/tests/dummy/patchentrypoints.c
@@ -204,7 +204,7 @@ static void patch_ppc64le(char *writeEntry, const char *execEntry,
                          "  sync\n\t"
                          "  icbi 0, %0\n\t"
                          "  isync\n"
-                         : "=r" (writeEntry)
+                         : : "r" (writeEntry)
                      );
 #else
     assert(0); // Should not be calling this

commit 94691a3ee25366d237004088dc1d71091606ac14
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Tue Jun 6 16:00:43 2017 +0100

    EGL: honour eglGetPlatformDisplay's attrib_list
    
    Currently we simply drop them on the floor.
    
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/EGL/libegl.c b/src/EGL/libegl.c
index 9c3e8ec..0052efa 100644
--- a/src/EGL/libegl.c
+++ b/src/EGL/libegl.c
@@ -391,7 +391,7 @@ PUBLIC EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform, void *nati
         return EGL_NO_DISPLAY;
     }
 
-    return GetPlatformDisplayCommon(platform, native_display, NULL, "eglGetPlatformDisplay");
+    return GetPlatformDisplayCommon(platform, native_display, attrib_list, "eglGetPlatformDisplay");
 }
 
 EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)

commit f6c14fabfa271caab1365adb0eba75de13640e66
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Tue Jun 6 16:26:30 2017 +0100

    EGL: alias "drm" to gbm when using EGL_PLATFORM
    
    Since the inseption of EGL/GBM the unofficial way to force
    the platform was via EGL_PLATFORM="drm".
    
    Strictly speaking one could remove the gbm one, but it should have no
    side effects. Plus it's more consistent with other platforms.
    
    In either case, one should not be using eglGetDisplay but the Platform
    version of the API.
    
    Signed-off-by: Emil Velikov <emil.velikov@gmail.com>

diff --git a/src/EGL/libegl.c b/src/EGL/libegl.c
index c655c43..9c3e8ec 100644
--- a/src/EGL/libegl.c
+++ b/src/EGL/libegl.c
@@ -102,6 +102,7 @@ static const struct {
    { EGL_PLATFORM_WAYLAND_KHR, "wayland" },
    { EGL_PLATFORM_ANDROID_KHR, "android" },
    { EGL_PLATFORM_GBM_KHR, "gbm" },
+   { EGL_PLATFORM_GBM_KHR, "drm" },
    { EGL_PLATFORM_DEVICE_EXT, "device" },
    { EGL_NONE, NULL }
 };

commit a6120e6ec57164b3d61cca3b26d7ec83cfc98dff
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Tue Jun 6 16:00:27 2017 +0100

    EGL: add platform gbm detection in eglGetDisplay
    
    Without it any applications that depend on the platform will fail to
    run.
    
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/EGL/libegl.c b/src/EGL/libegl.c
index 931afd3..c655c43 100644
--- a/src/EGL/libegl.c
+++ b/src/EGL/libegl.c
@@ -155,6 +155,18 @@ static void *SafeDereference(void *ptr)
     return NULL;
 }
 
+static EGLBoolean IsGbmDisplay(void *native_display)
+{
+    void *first_pointer = SafeDereference(native_display);
+    Dl_info info;
+
+    if (dladdr(first_pointer, &info) == 0) {
+        return EGL_FALSE;
+    }
+
+    return !strcmp(info.dli_sname, "gbm_create_device");
+}
+
 static EGLBoolean IsX11Display(void *dpy)
 {
     void *alloc;
@@ -193,6 +205,7 @@ static EGLBoolean IsWaylandDisplay(void *native_display)
  */
 static EGLenum GuessPlatformType(EGLNativeDisplayType display_id)
 {
+    EGLBoolean gbmSupported = EGL_FALSE;
     EGLBoolean waylandSupported = EGL_FALSE;
     EGLBoolean x11Supported = EGL_FALSE;
     struct glvnd_list *vendorList = __eglLoadVendors();
@@ -205,6 +218,9 @@ static EGLenum GuessPlatformType(EGLNativeDisplayType display_id)
 
     // Check if any vendor supports EGL_KHR_platform_wayland.
     glvnd_list_for_each_entry(vendor, vendorList, entry) {
+        if (vendor->supportsPlatformGbm) {
+            gbmSupported = EGL_TRUE;
+        }
         if (vendor->supportsPlatformWayland) {
             waylandSupported = EGL_TRUE;
         }
@@ -213,6 +229,9 @@ static EGLenum GuessPlatformType(EGLNativeDisplayType display_id)
         }
     }
 
+    if (gbmSupported && IsGbmDisplay(display_id)) {
+        return EGL_PLATFORM_GBM_KHR;
+    }
     if (waylandSupported && IsWaylandDisplay(display_id)) {
         return EGL_PLATFORM_WAYLAND_KHR;
     }

commit b559273fbd5b55e9e3af0fdcc5a79f3ea7ca2eb7
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Mon Jun 5 18:30:06 2017 +0100

    EGL: detect platform gbm vendor capability
    
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/EGL/libeglvendor.c b/src/EGL/libeglvendor.c
index 6d6961a..88ee060 100644
--- a/src/EGL/libeglvendor.c
+++ b/src/EGL/libeglvendor.c
@@ -369,6 +369,8 @@ static void CheckVendorExtensionString(__EGLvendorInfo *vendor, const char *str)
     static const char NAME_DEVICE_BASE[] = "EGL_EXT_device_base";
     static const char NAME_DEVICE_ENUM[] = "EGL_EXT_device_enumeration";
     static const char NAME_PLATFORM_DEVICE[] = "EGL_EXT_platform_device";
+    static const char NAME_MESA_PLATFORM_GBM[] = "EGL_MESA_platform_gbm";
+    static const char NAME_KHR_PLATFORM_GBM[] = "EGL_KHR_platform_gbm";
     static const char NAME_EXT_PLATFORM_WAYLAND[] = "EGL_EXT_platform_wayland";
     static const char NAME_KHR_PLATFORM_WAYLAND[] = "EGL_KHR_platform_wayland";
     static const char NAME_EXT_PLATFORM_X11[] = "EGL_EXT_platform_x11";
@@ -391,6 +393,13 @@ static void CheckVendorExtensionString(__EGLvendorInfo *vendor, const char *str)
         }
     }
 
+    if (!vendor->supportsPlatformGbm) {
+        if (IsTokenInString(str, NAME_MESA_PLATFORM_GBM, sizeof(NAME_MESA_PLATFORM_GBM) - 1, " ")
+                || IsTokenInString(str, NAME_KHR_PLATFORM_GBM, sizeof(NAME_KHR_PLATFORM_GBM) - 1, " ")) {
+            vendor->supportsPlatformGbm = EGL_TRUE;
+        }
+    }
+
     if (!vendor->supportsPlatformWayland) {
         if (IsTokenInString(str, NAME_EXT_PLATFORM_WAYLAND, sizeof(NAME_EXT_PLATFORM_WAYLAND) - 1, " ")
                 || IsTokenInString(str, NAME_KHR_PLATFORM_WAYLAND, sizeof(NAME_KHR_PLATFORM_WAYLAND) - 1, " ")) {
diff --git a/src/EGL/libeglvendor.h b/src/EGL/libeglvendor.h
index 8b2e6a2..443f285 100644
--- a/src/EGL/libeglvendor.h
+++ b/src/EGL/libeglvendor.h
@@ -31,6 +31,7 @@ struct __EGLvendorInfoRec {
 
     EGLBoolean supportsDevice;
     EGLBoolean supportsPlatformDevice;
+    EGLBoolean supportsPlatformGbm;
     EGLBoolean supportsPlatformX11;
     EGLBoolean supportsPlatformWayland;
 

commit cd502b4c1a4ba822da5ca49dcb8bdec56cde1045
Author: Kyle Brenneman <kbrenneman@nvidia.com>
Date:   Wed Apr 26 15:28:00 2017 -0600

    GLdispatch: Rename entry_x86_64_common.c to entry_simple_asm.c.
    
    Rename the file entry_x86_64_common.c to entry_simple_asm.c, since it's used
    for more than just x86 systems.
    
    In addition, it's now used for aarch64 as well.

diff --git a/src/GLdispatch/vnd-glapi/entry_aarch64_tsd.c b/src/GLdispatch/vnd-glapi/entry_aarch64_tsd.c
index 7fbcb39..b77ec95 100644
--- a/src/GLdispatch/vnd-glapi/entry_aarch64_tsd.c
+++ b/src/GLdispatch/vnd-glapi/entry_aarch64_tsd.c
@@ -150,12 +150,6 @@ static const int TEMPLATE_OFFSET_CURRENT_TABLE     = AARCH64_BYTECODE_SIZE - 3*8
 static const int TEMPLATE_OFFSET_CURRENT_TABLE_GET = AARCH64_BYTECODE_SIZE - 2*8;
 static const int TEMPLATE_OFFSET_SLOT              = AARCH64_BYTECODE_SIZE - 8;
 
-void
-entry_init_public(void)
-{
-    STATIC_ASSERT(AARCH64_BYTECODE_SIZE <= AARCH64_ENTRY_SIZE);
-}
-
 void entry_generate_default_code(char *entry, int slot)
 {
     char *writeEntry;
@@ -175,33 +169,3 @@ void entry_generate_default_code(char *entry, int slot)
     // See http://community.arm.com/groups/processors/blog/2010/02/17/caches-and-self-modifying-code
     __builtin___clear_cache(writeEntry, writeEntry + AARCH64_BYTECODE_SIZE);
 }
-
-// Note: The rest of these functions could also be used for aarch64 TLS stubs,
-// once those are implemented.
-
-mapi_func
-entry_get_public(int index)
-{
-    return (mapi_func)(public_entry_start + (index * entry_stub_size));
-}
-
-void entry_get_patch_addresses(mapi_func entry, void **writePtr, const void **execPtr)
-{
-    // Get the actual beginning of the stub allocation
-    *execPtr = (const void *) entry;
-    *writePtr = u_execmem_get_writable((void *) entry);
-}
-
-#if !defined(STATIC_DISPATCH_ONLY)
-mapi_func entry_generate(int slot)
-{
-    void *code = u_execmem_alloc(entry_stub_size);
-    if (!code) {
-        return NULL;
-    }
-
-    entry_generate_default_code(code, slot);
-
-    return (mapi_func) code;
-}
-#endif // !defined(STATIC_DISPATCH_ONLY)
diff --git a/src/GLdispatch/vnd-glapi/entry_files.mk b/src/GLdispatch/vnd-glapi/entry_files.mk
index f3cc01a..ce72f07 100644
--- a/src/GLdispatch/vnd-glapi/entry_files.mk
+++ b/src/GLdispatch/vnd-glapi/entry_files.mk
@@ -4,25 +4,25 @@
 
 if GLDISPATCH_TYPE_X86_TLS
 MAPI_GLDISPATCH_ENTRY_FILES = entry_x86_tls.c
-MAPI_GLDISPATCH_ENTRY_FILES += entry_x86_64_common.c
+MAPI_GLDISPATCH_ENTRY_FILES += entry_simple_asm.c
 MAPI_GLDISPATCH_ENTRY_FILES += entry_common.c
 endif
 
 if GLDISPATCH_TYPE_X86_TSD
 MAPI_GLDISPATCH_ENTRY_FILES = entry_x86_tsd.c
-MAPI_GLDISPATCH_ENTRY_FILES += entry_x86_64_common.c
+MAPI_GLDISPATCH_ENTRY_FILES += entry_simple_asm.c
 MAPI_GLDISPATCH_ENTRY_FILES += entry_common.c
 endif
 
 if GLDISPATCH_TYPE_X86_64_TLS
 MAPI_GLDISPATCH_ENTRY_FILES = entry_x86_64_tls.c
-MAPI_GLDISPATCH_ENTRY_FILES += entry_x86_64_common.c
+MAPI_GLDISPATCH_ENTRY_FILES += entry_simple_asm.c
 MAPI_GLDISPATCH_ENTRY_FILES += entry_common.c
 endif
 
 if GLDISPATCH_TYPE_X86_64_TSD
 MAPI_GLDISPATCH_ENTRY_FILES = entry_x86_64_tsd.c
-MAPI_GLDISPATCH_ENTRY_FILES += entry_x86_64_common.c
+MAPI_GLDISPATCH_ENTRY_FILES += entry_simple_asm.c
 MAPI_GLDISPATCH_ENTRY_FILES += entry_common.c
 endif
 
@@ -34,18 +34,19 @@ endif
 
 if GLDISPATCH_TYPE_AARCH64_TSD
 MAPI_GLDISPATCH_ENTRY_FILES = entry_aarch64_tsd.c
+MAPI_GLDISPATCH_ENTRY_FILES += entry_simple_asm.c
 MAPI_GLDISPATCH_ENTRY_FILES += entry_common.c
 endif
 
 if GLDISPATCH_TYPE_PPC64LE_TSD
 MAPI_GLDISPATCH_ENTRY_FILES = entry_ppc64le_tsd.c
-MAPI_GLDISPATCH_ENTRY_FILES += entry_x86_64_common.c
+MAPI_GLDISPATCH_ENTRY_FILES += entry_simple_asm.c
 MAPI_GLDISPATCH_ENTRY_FILES += entry_common.c
 endif
 
 if GLDISPATCH_TYPE_PPC64LE_TLS
 MAPI_GLDISPATCH_ENTRY_FILES = entry_ppc64le_tls.c
-MAPI_GLDISPATCH_ENTRY_FILES += entry_x86_64_common.c
+MAPI_GLDISPATCH_ENTRY_FILES += entry_simple_asm.c
 MAPI_GLDISPATCH_ENTRY_FILES += entry_common.c
 endif
 
diff --git a/src/GLdispatch/vnd-glapi/entry_simple_asm.c b/src/GLdispatch/vnd-glapi/entry_simple_asm.c
new file mode 100644
index 0000000..245b362
--- /dev/null
+++ b/src/GLdispatch/vnd-glapi/entry_simple_asm.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010 LunarG Inc.
+ * Copyright (c) 2015, NVIDIA CORPORATION.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Chia-I Wu <olv@lunarg.com>
+ *    Kyle Brenneman <kbrenneman@nvidia.com>
+ */
+
+#include "entry.h"
+#include "entry_common.h"
+
+#include <string.h>
+#include <stdint.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <assert.h>
+
+#include "glapi.h"
+#include "u_macros.h"
+#include "u_current.h"
+#include "utils_misc.h"
+
+/**
+ * \file
+ *
+ * Common functions for assembly stubs other than ARMv7.
+ *
+ * These functions are used for the assembly stubs on every architecture except
+ * for ARMv7.
+ *
+ * ARMv7 is different because the ARM stubs have to add 1 to the address of
+ * each entrypoint to force switching to Thumb mode.
+ */
+
+void entry_init_public(void)
+{
+}
+
+mapi_func entry_get_public(int index)
+{
+    return (mapi_func)(public_entry_start + (index * entry_stub_size));
+}
+
+void entry_get_patch_addresses(mapi_func entry, void **writePtr, const void **execPtr)
+{
+    *execPtr = (const void *) entry;
+    *writePtr = u_execmem_get_writable(entry);
+}
+
+#if !defined(STATIC_DISPATCH_ONLY)
+mapi_func entry_generate(int slot)
+{
+    void *code = u_execmem_alloc(entry_stub_size);
+    if (!code) {
+        return NULL;
+    }
+
+    entry_generate_default_code(code, slot);
+
+    return (mapi_func) code;
+}
+#endif // !defined(STATIC_DISPATCH_ONLY)


Reply to: