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

mesa: Changes to 'upstream-experimental'



Rebased ref, commits from common ancestor:
commit a455f594bb6af2b2d8b61775c3774667db15c4a7
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Mon Jul 24 14:43:29 2017 +0100

    Update version to 17.2.0-rc1
    
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/VERSION b/VERSION
index 250d02e..8530591 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-17.2.0-devel
+17.2.0-rc1

commit a955622c1aee4a89f3d38aa3f3d073a527f1ba32
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Mon Jul 24 15:12:52 2017 +0100

    intel/blorp: ship blorp_genX_exec.h within the tarball
    
    Fixes: c9cb37b2a6c ("intel/blorp: Add a partial resolve pass for MCS")
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
    (cherry picked from commit 5d47dd9c2a7b3a64429aaf7863b5cdad68b683ec)

diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources
index 17027cf..2b3065e 100644
--- a/src/intel/Makefile.sources
+++ b/src/intel/Makefile.sources
@@ -3,6 +3,7 @@ BLORP_FILES = \
 	blorp/blorp.h \
 	blorp/blorp_blit.c \
 	blorp/blorp_clear.c \
+	blorp/blorp_nir_builder.h \
 	blorp/blorp_genX_exec.h \
 	blorp/blorp_priv.h
 

commit 33236a306d1567dd4a9fee09bbfc48fb8afcd7b2
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Mon Jul 24 13:22:06 2017 +0100

    egl: guard wayland header dep. tracking behind HAVE_PLATFORM_WAYLAND
    
    Otherwise we'll attemt to generate the header even we don't need to.
    In that case the dependencies may not be met, leading to build failure.
    
    Fixes: 166852e "configure.ac: rework wayland-protocols handling"
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
    Reviewed-by: Tapani Pälli <tapani.palli@intel.com>

diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index f881145..ecaf148 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -74,10 +74,10 @@ drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h: $(WL_DMABUF_XML)
 	$(MKDIR_GEN)
 	$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
 
+if HAVE_PLATFORM_WAYLAND
 drivers/dri2/linux-dmabuf-unstable-v1-protocol.lo: drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
 drivers/dri2/egl_dri2.lo: drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
 
-if HAVE_PLATFORM_WAYLAND
 AM_CFLAGS += $(WAYLAND_CFLAGS)
 libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
 libEGL_common_la_LIBADD += $(LIBDRM_LIBS)

commit da9e6fdfe27065b8ede8b2fe30c8cccc3b573245
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Mon Jul 24 10:10:49 2017 +0100

    swrast: add dri2ConfigQueryExtension to the correct extension list
    
    The extension should be in the list as returned by getExtensions().
    Seems to have gone unnoticed since close to nobody wants to change the
    vblank mode for the software driver.
    
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 43aef9a..7de90d3 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -208,6 +208,7 @@ static const __DRI2rendererQueryExtension swrast_query_renderer_extension = {
 static const __DRIextension *dri_screen_extensions[] = {
     &swrastTexBufferExtension.base,
     &swrast_query_renderer_extension.base,
+    &dri2ConfigQueryExtension.base,
     &dri2NoErrorExtension.base,
     NULL
 };

commit 3057ca9a50122b7cde701931a34b9e1fdcbbf833
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Mon Jul 24 10:35:04 2017 +0100

    wayland-egl: update the SHA1 of the commit introducing v3
    
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c b/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c
index 40b54c6..4ea3854 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c
+++ b/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c
@@ -78,7 +78,7 @@ struct wl_egl_window_v2 {
     void (*destroy_window_callback)(void *);
 };
 
-/* From: XXX - Miguel A. Vico : wayland-egl: Make wl_egl_window a versioned struct */
+/* From: 2d5d61bc49 - Miguel A. Vico : wayland-egl: Make wl_egl_window a versioned struct */
 #define WL_EGL_WINDOW_VERSION_v3 3
 struct wl_egl_window_v3 {
     const intptr_t version;

commit b6356c023d93ac28bbff552364936cc6087218b6
Author: Miguel A. Vico <mvicomoya@nvidia.com>
Date:   Wed Jul 19 17:27:58 2017 -0700

    wayland-egl: Update ABI checker
    
    This change updates wayland-egl-abi-check.c with the latest changes to
    wl_egl_window.
    
    Signed-off-by: Miguel A. Vico <mvicomoya@nvidia.com>
    Reviewed-by: James Jones <jajones@nvidia.com>
    Acked-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c b/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c
index 9701ea1..40b54c6 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c
+++ b/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c
@@ -61,6 +61,7 @@ struct wl_egl_window_v1 {
 };
 
 /* From: 690ead4a13 - Stencel, Joanna : egl/wayland-egl: Fix for segfault in dri2_wl_destroy_surface. */
+#define WL_EGL_WINDOW_VERSION_v2 2
 struct wl_egl_window_v2 {
     struct wl_surface *surface;
 
@@ -77,6 +78,26 @@ struct wl_egl_window_v2 {
     void (*destroy_window_callback)(void *);
 };
 
+/* From: XXX - Miguel A. Vico : wayland-egl: Make wl_egl_window a versioned struct */
+#define WL_EGL_WINDOW_VERSION_v3 3
+struct wl_egl_window_v3 {
+    const intptr_t version;
+
+    int width;
+    int height;
+    int dx;
+    int dy;
+
+    int attached_width;
+    int attached_height;
+
+    void *private;
+    void (*resize_callback)(struct wl_egl_window *, void *);
+    void (*destroy_window_callback)(void *);
+
+    struct wl_surface *surface;
+};
+
 
 /* This program checks we keep a backwards-compatible struct wl_egl_window
  * definition whenever it is modified in wayland-egl-priv.h.
@@ -87,7 +108,7 @@ struct wl_egl_window_v2 {
 
 #define MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
 
-#define CHECK_MEMBERS(a_ver, b_ver, a_member, b_member)                             \
+#define CHECK_RENAMED_MEMBER(a_ver, b_ver, a_member, b_member)                      \
     do {                                                                            \
         if (offsetof(struct wl_egl_window ## a_ver, a_member) !=                    \
             offsetof(struct wl_egl_window ## b_ver, b_member)) {                    \
@@ -106,7 +127,7 @@ struct wl_egl_window_v2 {
         }                                                                           \
     } while (0)
 
-#define CHECK_MEMBER(a_ver, b_ver, member) CHECK_MEMBERS(a_ver, b_ver, member, member)
+#define CHECK_MEMBER(a_ver, b_ver, member) CHECK_RENAMED_MEMBER(a_ver, b_ver, member, member)
 #define CHECK_MEMBER_CURRENT(a_ver, member) CHECK_MEMBER(a_ver,, member)
 
 #define CHECK_SIZE(a_ver, b_ver)                                                    \
@@ -131,6 +152,28 @@ struct wl_egl_window_v2 {
         }                                                                           \
     } while (0)
 
+#define CHECK_VERSION(a_ver, b_ver)                                                 \
+    do {                                                                            \
+        if ((WL_EGL_WINDOW_VERSION ## a_ver) >=                                     \
+            (WL_EGL_WINDOW_VERSION ## b_ver)) {                                     \
+            printf("Backards incompatible change detected!\n   "                    \
+                   "WL_EGL_WINDOW_VERSION" #a_ver " >= "                            \
+                   "WL_EGL_WINDOW_VERSION" #b_ver "\n");                            \
+            return 1;                                                               \
+        }                                                                           \
+    } while (0)
+
+#define CHECK_VERSION_CURRENT(a_ver)                                                \
+    do {                                                                            \
+        if ((WL_EGL_WINDOW_VERSION ## a_ver) !=                                     \
+            (WL_EGL_WINDOW_VERSION)) {                                              \
+            printf("Backards incompatible change detected!\n   "                    \
+                   "WL_EGL_WINDOW_VERSION" #a_ver " != "                            \
+                   "WL_EGL_WINDOW_VERSION\n");                                      \
+            return 1;                                                               \
+        }                                                                           \
+    } while (0)
+
 int main(int argc, char **argv)
 {
     /* Check wl_egl_window_v1 ABI against wl_egl_window_v0 */
@@ -157,19 +200,36 @@ int main(int argc, char **argv)
 
     CHECK_SIZE(_v1, _v2);
 
-    /* Check current wl_egl_window ABI against wl_egl_window_v2 */
-    CHECK_MEMBER_CURRENT(_v2, surface);
-    CHECK_MEMBER_CURRENT(_v2, width);
-    CHECK_MEMBER_CURRENT(_v2, height);
-    CHECK_MEMBER_CURRENT(_v2, dx);
-    CHECK_MEMBER_CURRENT(_v2, dy);
-    CHECK_MEMBER_CURRENT(_v2, attached_width);
-    CHECK_MEMBER_CURRENT(_v2, attached_height);
-    CHECK_MEMBER_CURRENT(_v2, private);
-    CHECK_MEMBER_CURRENT(_v2, resize_callback);
-    CHECK_MEMBER_CURRENT(_v2, destroy_window_callback);
-
-    CHECK_SIZE_CURRENT(_v2);
+    /* Check wl_egl_window_v3 ABI against wl_egl_window_v2 */
+    CHECK_RENAMED_MEMBER(_v2, _v3, surface, version);
+    CHECK_MEMBER        (_v2, _v3, width);
+    CHECK_MEMBER        (_v2, _v3, height);
+    CHECK_MEMBER        (_v2, _v3, dx);
+    CHECK_MEMBER        (_v2, _v3, dy);
+    CHECK_MEMBER        (_v2, _v3, attached_width);
+    CHECK_MEMBER        (_v2, _v3, attached_height);
+    CHECK_MEMBER        (_v2, _v3, private);
+    CHECK_MEMBER        (_v2, _v3, resize_callback);
+    CHECK_MEMBER        (_v2, _v3, destroy_window_callback);
+
+    CHECK_SIZE   (_v2, _v3);
+    CHECK_VERSION(_v2, _v3);
+
+    /* Check current wl_egl_window ABI against wl_egl_window_v3 */
+    CHECK_MEMBER_CURRENT(_v3, version);
+    CHECK_MEMBER_CURRENT(_v3, width);
+    CHECK_MEMBER_CURRENT(_v3, height);
+    CHECK_MEMBER_CURRENT(_v3, dx);
+    CHECK_MEMBER_CURRENT(_v3, dy);
+    CHECK_MEMBER_CURRENT(_v3, attached_width);
+    CHECK_MEMBER_CURRENT(_v3, attached_height);
+    CHECK_MEMBER_CURRENT(_v3, private);
+    CHECK_MEMBER_CURRENT(_v3, resize_callback);
+    CHECK_MEMBER_CURRENT(_v3, destroy_window_callback);
+    CHECK_MEMBER_CURRENT(_v3, surface);
+
+    CHECK_SIZE_CURRENT   (_v3);
+    CHECK_VERSION_CURRENT(_v3);
 
     return 0;
 }

commit 2d5d61bc491b6cef08ced8f1ad57b154d4fa5f66
Author: Miguel A. Vico <mvicomoya@nvidia.com>
Date:   Wed Jul 19 17:27:12 2017 -0700

    wayland-egl: Make wl_egl_window a versioned struct
    
    We need wl_egl_window to be a versioned struct in order to keep track of
    ABI changes.
    
    This change makes the first member of wl_egl_window the version number.
    
    An heuristic in the wayland driver is added so that we don't break
    backwards compatibility:
    
     - If the first field (version) is an actual pointer, it is an old
       implementation of wl_egl_window, and version points to the wl_surface
       proxy.
    
     - Else, the first field is the version number, and we have
       wl_egl_window::surface pointing to the wl_surface proxy.
    
    Signed-off-by: Miguel A. Vico <mvicomoya@nvidia.com>
    Reviewed-by: James Jones <jajones@nvidia.com>
    Acked-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 211036f..f4c09ac 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -43,6 +43,7 @@
 #include "egl_dri2_fallbacks.h"
 #include "loader.h"
 #include "util/u_vector.h"
+#include "eglglobals.h"
 
 #include <wayland-client.h>
 #include "wayland-drm-client-protocol.h"
@@ -111,6 +112,19 @@ destroy_window_callback(void *data)
    dri2_surf->wl_win = NULL;
 }
 
+static struct wl_surface *
+get_wl_surface_proxy(struct wl_egl_window *window)
+{
+    /* Version 3 of wl_egl_window introduced a version field at the same
+     * location where a pointer to wl_surface was stored. Thus, if
+     * window->version is dereferencable, we've been given an older version of
+     * wl_egl_window, and window->version points to wl_surface */
+   if (_eglPointerIsDereferencable((void *)(window->version))) {
+      return wl_proxy_create_wrapper((void *)(window->version));
+   }
+   return wl_proxy_create_wrapper(window->surface);
+}
+
 /**
  * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
  */
@@ -182,7 +196,7 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
    wl_proxy_set_queue((struct wl_proxy *)dri2_surf->wl_dpy_wrapper,
                       dri2_surf->wl_queue);
 
-   dri2_surf->wl_surface_wrapper = wl_proxy_create_wrapper(window->surface);
+   dri2_surf->wl_surface_wrapper = get_wl_surface_proxy(window);
    if (!dri2_surf->wl_surface_wrapper) {
       _eglError(EGL_BAD_ALLOC, "dri2_create_surface");
       goto cleanup_drm;
diff --git a/src/egl/wayland/wayland-egl/wayland-egl-priv.h b/src/egl/wayland/wayland-egl/wayland-egl-priv.h
index 92c31d9..3b59908 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl-priv.h
+++ b/src/egl/wayland/wayland-egl/wayland-egl-priv.h
@@ -41,8 +41,10 @@
 extern "C" {
 #endif
 
+#define WL_EGL_WINDOW_VERSION 3
+
 struct wl_egl_window {
-	struct wl_surface *surface;
+	const intptr_t version;
 
 	int width;
 	int height;
@@ -55,6 +57,8 @@ struct wl_egl_window {
 	void *private;
 	void (*resize_callback)(struct wl_egl_window *, void *);
 	void (*destroy_window_callback)(void *);
+
+	struct wl_surface *surface;
 };
 
 #ifdef  __cplusplus
diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c b/src/egl/wayland/wayland-egl/wayland-egl.c
index 4a4701a..f16324c 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl.c
+++ b/src/egl/wayland/wayland-egl/wayland-egl.c
@@ -28,6 +28,7 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 
 #include <wayland-client.h>
 #include "wayland-egl.h"
@@ -54,6 +55,7 @@ WL_EGL_EXPORT struct wl_egl_window *
 wl_egl_window_create(struct wl_surface *surface,
 		     int width, int height)
 {
+	struct wl_egl_window _INIT_ = { .version = WL_EGL_WINDOW_VERSION };
 	struct wl_egl_window *egl_window;
 
 	if (width <= 0 || height <= 0)
@@ -63,6 +65,8 @@ wl_egl_window_create(struct wl_surface *surface,
 	if (!egl_window)
 		return NULL;
 
+	memcpy(egl_window, &_INIT_, sizeof *egl_window);
+
 	egl_window->surface = surface;
 	egl_window->private = NULL;
 	egl_window->resize_callback = NULL;

commit 63c251e38f9b4ac3606094a72c8c5b658402f3d0
Author: Miguel A. Vico <mvicomoya@nvidia.com>
Date:   Wed Jul 19 17:25:57 2017 -0700

    egl: Fix _eglPointerIsDereferencable() to ignore page residency
    
    mincore() returns 0 on success, and -1 on failure.  The last parameter
    is a vector of bytes with one entry for each page queried.  mincore
    returns page residency information in the first bit of each byte in the
    vector.
    
    Residency doesn't actually matter when determining whether a pointer is
    dereferenceable, so the output vector can be ignored.  What matters is
    whether mincore succeeds. See:
    
      http://man7.org/linux/man-pages/man2/mincore.2.html
    
    Signed-off-by: Miguel A. Vico <mvicomoya@nvidia.com>
    Acked-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index 6fdc6c3..9071226 100644
--- a/src/egl/main/eglglobals.c
+++ b/src/egl/main/eglglobals.c
@@ -168,7 +168,18 @@ _eglPointerIsDereferencable(void *p)
       return EGL_FALSE;
    }
 
-   return (valid & 0x01) == 0x01;
+   /* mincore() returns 0 on success, and -1 on failure.  The last parameter
+    * is a vector of bytes with one entry for each page queried.  mincore
+    * returns page residency information in the first bit of each byte in the
+    * vector.
+    *
+    * Residency doesn't actually matter when determining whether a pointer is
+    * dereferenceable, so the output vector can be ignored.  What matters is
+    * whether mincore succeeds. See:
+    *
+    *   http://man7.org/linux/man-pages/man2/mincore.2.html
+    */
+   return EGL_TRUE;
 #else
    return p != NULL;
 #endif

commit 045108938c11f507dcc3c50b59b0a8a8529486bd
Author: Miguel A. Vico <mvicomoya@nvidia.com>
Date:   Wed Jul 19 17:25:08 2017 -0700

    egl: Move _eglPointerIsDereferencable() to eglglobals.[ch]
    
    Move _eglPointerIsDereferencable() to eglglobals.[ch] and make it a
    non-static function so it can be used out of egldisplay.c
    
    Signed-off-by: Miguel A. Vico <mvicomoya@nvidia.com>
    Reviewed-by: James Jones <jajones@nvidia.com>
    Acked-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 7aaab3c..690728d 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -49,10 +49,6 @@
 #include "eglsync.h"
 
 /* Includes for _eglNativePlatformDetectNativeDisplay */
-#ifdef HAVE_MINCORE
-#include <unistd.h>
-#include <sys/mman.h>
-#endif
 #ifdef HAVE_WAYLAND_PLATFORM
 #include <wayland-client.h>
 #endif
@@ -106,35 +102,6 @@ _eglGetNativePlatformFromEnv(void)
 
 
 /**
- * Perform validity checks on a generic pointer.
- */
-static EGLBoolean
-_eglPointerIsDereferencable(void *p)
-{
-#ifdef HAVE_MINCORE
-   uintptr_t addr = (uintptr_t) p;
-   unsigned char valid = 0;
-   const long page_size = getpagesize();
-
-   if (p == NULL)
-      return EGL_FALSE;
-
-   /* align addr to page_size */
-   addr &= ~(page_size - 1);
-
-   if (mincore((void *) addr, page_size, &valid) < 0) {
-      _eglLog(_EGL_DEBUG, "mincore failed: %m");
-      return EGL_FALSE;
-   }
-
-   return (valid & 0x01) == 0x01;
-#else
-   return p != NULL;
-#endif
-}
-
-
-/**
  * Try detecting native platform with the help of native display characteristcs.
  */
 static _EGLPlatformType
diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index baf96bb..6fdc6c3 100644
--- a/src/egl/main/eglglobals.c
+++ b/src/egl/main/eglglobals.c
@@ -37,6 +37,12 @@
 #include "eglglobals.h"
 #include "egldisplay.h"
 #include "egldriver.h"
+#include "egllog.h"
+
+#ifdef HAVE_MINCORE
+#include <unistd.h>
+#include <sys/mman.h>
+#endif
 
 
 static mtx_t _eglGlobalMutex = _MTX_INITIALIZER_NP;
@@ -142,3 +148,28 @@ _eglGetClientExtensionString(void)
    mtx_unlock(_eglGlobal.Mutex);
    return ret;
 }
+
+EGLBoolean
+_eglPointerIsDereferencable(void *p)
+{
+#ifdef HAVE_MINCORE
+   uintptr_t addr = (uintptr_t) p;
+   unsigned char valid = 0;
+   const long page_size = getpagesize();
+
+   if (p == NULL)
+      return EGL_FALSE;
+
+   /* align addr to page_size */
+   addr &= ~(page_size - 1);
+
+   if (mincore((void *) addr, page_size, &valid) < 0) {
+      _eglLog(_EGL_DEBUG, "mincore failed: %m");
+      return EGL_FALSE;
+   }
+
+   return (valid & 0x01) == 0x01;
+#else
+   return p != NULL;
+#endif
+}
diff --git a/src/egl/main/eglglobals.h b/src/egl/main/eglglobals.h
index c6ef59d..6655cca 100644
--- a/src/egl/main/eglglobals.h
+++ b/src/egl/main/eglglobals.h
@@ -87,4 +87,10 @@ static inline unsigned int DebugBitFromType(EGLenum type)
 extern const char *
 _eglGetClientExtensionString(void);
 
+/**
+ * Perform validity checks on a generic pointer.
+ */
+extern EGLBoolean
+_eglPointerIsDereferencable(void *p);
+
 #endif /* EGLGLOBALS_INCLUDED */

commit dad0c5d2d7ef91accc768a7192f6c9284080ab6f
Author: Miguel A. Vico <mvicomoya@nvidia.com>
Date:   Wed Jul 19 17:22:44 2017 -0700

    wayland-egl: Add wl_egl_window ABI checker
    
    Add a small ABI checker for wl_egl_window so that we can check for
    backwards incompatible changes at 'make check' time.
    
    Signed-off-by: Miguel A. Vico <mvicomoya@nvidia.com>
    Reviewed-by: James Jones <jajones@nvidia.com>
    Acked-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/egl/wayland/wayland-egl/Makefile.am b/src/egl/wayland/wayland-egl/Makefile.am
index 8c45e8e..846fa62 100644
--- a/src/egl/wayland/wayland-egl/Makefile.am
+++ b/src/egl/wayland/wayland-egl/Makefile.am
@@ -14,7 +14,11 @@ libwayland_egl_la_LDFLAGS = \
 	$(GC_SECTIONS) \
 	$(LD_NO_UNDEFINED)
 
-TESTS = wayland-egl-symbols-check
+TESTS = wayland-egl-symbols-check \
+        wayland-egl-abi-check
+
 EXTRA_DIST = wayland-egl-symbols-check
 
+check_PROGRAMS = wayland-egl-abi-check
+
 include $(top_srcdir)/install-lib-links.mk
diff --git a/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c b/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c
new file mode 100644
index 0000000..9701ea1
--- /dev/null
+++ b/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * 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.
+ */
+
+#include <stddef.h> // offsetof
+#include <stdio.h>  // printf
+
+#include "wayland-egl-priv.h" // Current struct wl_egl_window implementation
+
+/*
+ * Following are previous implementations of wl_egl_window.
+ *
+ * DO NOT EVER CHANGE!
+ */
+
+/* From: 214fc6e850 - Benjamin Franzke : egl: Implement libwayland-egl */
+struct wl_egl_window_v0 {
+    struct wl_surface *surface;
+
+    int width;
+    int height;
+    int dx;
+    int dy;
+
+    int attached_width;
+    int attached_height;
+};
+
+/* From: ca3ed3e024 - Ander Conselvan de Oliveira : egl/wayland: Don't invalidate drawable on swap buffers */
+struct wl_egl_window_v1 {
+    struct wl_surface *surface;
+
+    int width;
+    int height;
+    int dx;
+    int dy;
+
+    int attached_width;
+    int attached_height;
+
+    void *private;
+    void (*resize_callback)(struct wl_egl_window *, void *);
+};
+
+/* From: 690ead4a13 - Stencel, Joanna : egl/wayland-egl: Fix for segfault in dri2_wl_destroy_surface. */
+struct wl_egl_window_v2 {
+    struct wl_surface *surface;
+
+    int width;
+    int height;
+    int dx;
+    int dy;
+
+    int attached_width;
+    int attached_height;
+
+    void *private;
+    void (*resize_callback)(struct wl_egl_window *, void *);
+    void (*destroy_window_callback)(void *);
+};
+
+
+/* This program checks we keep a backwards-compatible struct wl_egl_window
+ * definition whenever it is modified in wayland-egl-priv.h.
+ *
+ * The previous definition should be added above as a new struct
+ * wl_egl_window_vN, and the appropriate checks should be added below
+ */
+
+#define MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
+
+#define CHECK_MEMBERS(a_ver, b_ver, a_member, b_member)                             \
+    do {                                                                            \
+        if (offsetof(struct wl_egl_window ## a_ver, a_member) !=                    \
+            offsetof(struct wl_egl_window ## b_ver, b_member)) {                    \
+            printf("Backards incompatible change detected!\n   "                    \
+                   "offsetof(struct wl_egl_window" #a_ver "::" #a_member ") != "    \
+                   "offsetof(struct wl_egl_window" #b_ver "::" #b_member ")\n");    \
+            return 1;                                                               \
+        }                                                                           \
+                                                                                    \
+        if (MEMBER_SIZE(struct wl_egl_window ## a_ver, a_member) !=                 \
+            MEMBER_SIZE(struct wl_egl_window ## b_ver, b_member)) {                 \
+            printf("Backards incompatible change detected!\n   "                    \
+                   "MEMBER_SIZE(struct wl_egl_window" #a_ver "::" #a_member ") != " \
+                   "MEMBER_SIZE(struct wl_egl_window" #b_ver "::" #b_member ")\n"); \
+            return 1;                                                               \
+        }                                                                           \
+    } while (0)
+
+#define CHECK_MEMBER(a_ver, b_ver, member) CHECK_MEMBERS(a_ver, b_ver, member, member)
+#define CHECK_MEMBER_CURRENT(a_ver, member) CHECK_MEMBER(a_ver,, member)
+
+#define CHECK_SIZE(a_ver, b_ver)                                                    \
+    do {                                                                            \
+        if (sizeof(struct wl_egl_window ## a_ver) >                                 \
+            sizeof(struct wl_egl_window ## b_ver)) {                                \
+            printf("Backards incompatible change detected!\n   "                    \
+                   "sizeof(struct wl_egl_window" #a_ver ") > "                      \
+                   "sizeof(struct wl_egl_window" #b_ver ")\n");                     \
+            return 1;                                                               \
+        }                                                                           \
+    } while (0)
+
+#define CHECK_SIZE_CURRENT(a_ver)                                                   \
+    do {                                                                            \
+        if (sizeof(struct wl_egl_window ## a_ver) !=                                \
+            sizeof(struct wl_egl_window)) {                                         \
+            printf("Backards incompatible change detected!\n   "                    \
+                   "sizeof(struct wl_egl_window" #a_ver ") != "                     \
+                   "sizeof(struct wl_egl_window)\n");                               \
+            return 1;                                                               \
+        }                                                                           \
+    } while (0)
+
+int main(int argc, char **argv)
+{
+    /* Check wl_egl_window_v1 ABI against wl_egl_window_v0 */
+    CHECK_MEMBER(_v0, _v1, surface);
+    CHECK_MEMBER(_v0, _v1, width);
+    CHECK_MEMBER(_v0, _v1, height);
+    CHECK_MEMBER(_v0, _v1, dx);
+    CHECK_MEMBER(_v0, _v1, dy);
+    CHECK_MEMBER(_v0, _v1, attached_width);
+    CHECK_MEMBER(_v0, _v1, attached_height);
+
+    CHECK_SIZE(_v0, _v1);
+
+    /* Check wl_egl_window_v2 ABI against wl_egl_window_v1 */
+    CHECK_MEMBER(_v1, _v2, surface);
+    CHECK_MEMBER(_v1, _v2, width);
+    CHECK_MEMBER(_v1, _v2, height);
+    CHECK_MEMBER(_v1, _v2, dx);
+    CHECK_MEMBER(_v1, _v2, dy);
+    CHECK_MEMBER(_v1, _v2, attached_width);
+    CHECK_MEMBER(_v1, _v2, attached_height);
+    CHECK_MEMBER(_v1, _v2, private);
+    CHECK_MEMBER(_v1, _v2, resize_callback);
+
+    CHECK_SIZE(_v1, _v2);
+
+    /* Check current wl_egl_window ABI against wl_egl_window_v2 */
+    CHECK_MEMBER_CURRENT(_v2, surface);
+    CHECK_MEMBER_CURRENT(_v2, width);
+    CHECK_MEMBER_CURRENT(_v2, height);
+    CHECK_MEMBER_CURRENT(_v2, dx);
+    CHECK_MEMBER_CURRENT(_v2, dy);
+    CHECK_MEMBER_CURRENT(_v2, attached_width);
+    CHECK_MEMBER_CURRENT(_v2, attached_height);
+    CHECK_MEMBER_CURRENT(_v2, private);
+    CHECK_MEMBER_CURRENT(_v2, resize_callback);
+    CHECK_MEMBER_CURRENT(_v2, destroy_window_callback);
+
+    CHECK_SIZE_CURRENT(_v2);
+
+    return 0;
+}

commit 4d53b16f555b2d33216518100fb2cd578428512d
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Fri Jul 21 13:44:22 2017 +0100

    swr: use the correct variable for no undefined symbols
    
    The variable name was missing a leading LD_, which resulted in a missing
    check for unresolved symbols in the backend binaries.
    
    With the link addressed with earlier patches, we can correct the typo.
    
    Thanks to Laurent for the help spotting this.
    
    v2: Split from a larger patch.
    
    Cc: mesa-stable@lists.freedesktop.org
    Cc: Bruce Cherniak <bruce.cherniak@intel.com>
    Cc: Tim Rowley <timothy.o.rowley@intel.com>
    Cc: Laurent Carlier <lordheavym@gmail.com>
    Fixes: 9475251145174882b532 "swr: standardize linkage and check for
                                 unresolved symbols"
    Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
    Reported-by: Laurent Carlier <lordheavym@gmail.com>
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am
index bc7abad..05fc3b3 100644
--- a/src/gallium/drivers/swr/Makefile.am
+++ b/src/gallium/drivers/swr/Makefile.am
@@ -238,7 +238,7 @@ COMMON_LDFLAGS = \
 	-module \
 	-no-undefined \
 	$(GC_SECTIONS) \
-	$(NO_UNDEFINED)
+	$(LD_NO_UNDEFINED)
 
 lib_LTLIBRARIES =
 

commit 9fd23435c29a81df41429ce1003047835b6649ab
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Fri Jul 21 16:49:11 2017 +0100

    swr: don't forget to link KNL/SKX against pthreads
    
    Analogous to previous commit but for the KNL/SKX backends.
    
    Cc: Bruce Cherniak <bruce.cherniak@intel.com>
    Cc: Tim Rowley <timothy.o.rowley@intel.com>
    Cc: Laurent Carlier <lordheavym@gmail.com>
    Fixes: 1cb5a6061ce ("configure/swr: add KNL and SKX architecture targets")
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am
index 0201072..bc7abad 100644
--- a/src/gallium/drivers/swr/Makefile.am
+++ b/src/gallium/drivers/swr/Makefile.am
@@ -283,6 +283,7 @@ if HAVE_SWR_KNL
 lib_LTLIBRARIES += libswrKNL.la
 
 libswrKNL_la_CXXFLAGS = \
+	$(PTHREAD_CFLAGS) \
 	$(SWR_KNL_CXXFLAGS) \
 	-DKNOB_ARCH=KNOB_ARCH_AVX512 -DAVX512F_STRICT \
 	$(COMMON_CXXFLAGS)
@@ -290,6 +291,9 @@ libswrKNL_la_CXXFLAGS = \
 libswrKNL_la_SOURCES = \
 	$(COMMON_SOURCES)
 
+libswrKNL_la_LIBADD = \
+	$(PTHREAD_LIBS)
+
 libswrKNL_la_LDFLAGS = \
 	$(COMMON_LDFLAGS)
 endif
@@ -298,6 +302,7 @@ if HAVE_SWR_SKX
 lib_LTLIBRARIES += libswrSKX.la
 
 libswrSKX_la_CXXFLAGS = \
+	$(PTHREAD_CFLAGS) \
 	$(SWR_SKX_CXXFLAGS) \
 	-DKNOB_ARCH=KNOB_ARCH_AVX512 \
 	$(COMMON_CXXFLAGS)
@@ -305,6 +310,9 @@ libswrSKX_la_CXXFLAGS = \
 libswrSKX_la_SOURCES = \
 	$(COMMON_SOURCES)
 
+libswrSKX_la_LIBADD = \
+	$(PTHREAD_LIBS)
+
 libswrSKX_la_LDFLAGS = \
 	$(COMMON_LDFLAGS)
 endif

commit 33d397ada50a1d1f485205e847003dc48146ec19
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Fri Jul 21 16:44:14 2017 +0100

    swr: don't forget to link AVX/AVX2 against pthreads
    
    Seems like the backends have been using pthreads since day one, yet
    we've been missing the link.
    
    With later commit we'll fix a typo, hence the libraries will be build
    with -Wl,no-undefined, aka failing the build on unresolved symbols.
    
    v2: Split from a larger patch.
    
    Cc: mesa-stable@lists.freedesktop.org
    Cc: Bruce Cherniak <bruce.cherniak@intel.com>
    Cc: Tim Rowley <timothy.o.rowley@intel.com>
    Cc: Laurent Carlier <lordheavym@gmail.com>
    Fixes: c6e67f5a9373e916a8d2 "gallium/swr: add OpenSWR rasterizer"
    Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am
index 6495021..0201072 100644
--- a/src/gallium/drivers/swr/Makefile.am
+++ b/src/gallium/drivers/swr/Makefile.am
@@ -246,6 +246,7 @@ if HAVE_SWR_AVX
 lib_LTLIBRARIES += libswrAVX.la
 
 libswrAVX_la_CXXFLAGS = \
+	$(PTHREAD_CFLAGS) \
 	$(SWR_AVX_CXXFLAGS) \
 	-DKNOB_ARCH=KNOB_ARCH_AVX \
 	$(COMMON_CXXFLAGS)
@@ -253,6 +254,9 @@ libswrAVX_la_CXXFLAGS = \
 libswrAVX_la_SOURCES = \
 	$(COMMON_SOURCES)
 
+libswrAVX_la_LIBADD = \
+	$(PTHREAD_LIBS)
+
 libswrAVX_la_LDFLAGS = \
 	$(COMMON_LDFLAGS)
 endif
@@ -260,6 +264,7 @@ endif
 if HAVE_SWR_AVX2
 lib_LTLIBRARIES += libswrAVX2.la
 libswrAVX2_la_CXXFLAGS = \
+	$(PTHREAD_CFLAGS) \
 	$(SWR_AVX2_CXXFLAGS) \
 	-DKNOB_ARCH=KNOB_ARCH_AVX2 \
 	$(COMMON_CXXFLAGS)
@@ -267,6 +272,9 @@ libswrAVX2_la_CXXFLAGS = \
 libswrAVX2_la_SOURCES = \
 	$(COMMON_SOURCES)
 
+libswrAVX2_la_LIBADD = \
+	$(PTHREAD_LIBS)
+
 libswrAVX2_la_LDFLAGS = \
 	$(COMMON_LDFLAGS)
 endif

commit 166852ee957ff25a1d14dcaa7512917343130fa4
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Thu Jul 20 17:53:01 2017 +0100

    configure.ac: rework wayland-protocols handling
    
    At dist/distcheck time we need to ensure that all the files and their
    respective dependencies are handled.
    
    At the moment we'll bail out as the linux-dmabuf rules are guarded in a
    conditional. Move them outside of it and drop the sources from
    BUILT_SOURCES.
    
    Thus the files will be generated only as needed, which will happen only
    after the wayland-protocols dependency is enforced in configure.ac.
    
    v2: add dependency tracking for the header
    
    Cc: Andres Gomez <agomez@igalia.com>
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
    Reviewed-by: Andres Gomez <agomez@igalia.com>

diff --git a/configure.ac b/configure.ac
index 2689fc5..2736fbf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1681,19 +1681,26 @@ if test "x$WAYLAND_SCANNER" = x; then
     AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:])
 fi
 
+PKG_CHECK_EXISTS([wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED], [have_wayland_protocols=yes], [have_wayland_protocols=no])
+if test "x$have_wayland_protocols" = xyes; then
+    ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
+fi
+AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
+
 # Do per platform setups and checks
 platforms=`IFS=', '; echo $with_platforms`
 for plat in $platforms; do
     case "$plat" in
     wayland)
 
-        PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED wayland-server >= $WAYLAND_REQUIRED wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED])
-        ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
-        AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
+        PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED wayland-server >= $WAYLAND_REQUIRED])
 
         if test "x$WAYLAND_SCANNER" = "x:"; then
                 AC_MSG_ERROR([wayland-scanner is needed to compile the wayland platform])
         fi
+        if test "x$have_wayland_protocols" = xno; then
+                AC_MSG_ERROR([wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED is needed to compile the wayland platform])
+        fi
         DEFINES="$DEFINES -DHAVE_WAYLAND_PLATFORM"
         ;;
 
diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index 7c1a492..f881145 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -64,7 +64,6 @@ libEGL_common_la_LIBADD += $(top_builddir)/src/loader/libloader_dri3_helper.la
 endif
 endif
 
-if HAVE_PLATFORM_WAYLAND
 WL_DMABUF_XML = $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml


Reply to: