pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/graphics/MesaLib MesaLib: fix issues in TLS dispatch c...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b7c450d75e51
branches:  trunk
changeset: 411751:b7c450d75e51
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Wed Feb 19 21:03:41 2020 +0000

description:
MesaLib: fix issues in TLS dispatch code on NetBSD/amd64. Bump.

- workaround for toolchain/50277 had bitrotted after meson switch
- make tls dispatch stub template behave correct (with input from joerg@)
- double alignment of stubs to accommodate slightly larger code size

Fixes among other things Xorg crash in glamor_egl_init().

diffstat:

 graphics/MesaLib/Makefile                                    |   4 +-
 graphics/MesaLib/distinfo                                    |   6 +-
 graphics/MesaLib/patches/patch-src_glx_glxcurrent.c          |  16 ++-
 graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h |  47 ++++++++---
 4 files changed, 46 insertions(+), 27 deletions(-)

diffs (152 lines):

diff -r 97ad6905652d -r b7c450d75e51 graphics/MesaLib/Makefile
--- a/graphics/MesaLib/Makefile Wed Feb 19 19:08:46 2020 +0000
+++ b/graphics/MesaLib/Makefile Wed Feb 19 21:03:41 2020 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.183 2020/01/21 14:41:26 nia Exp $
+# $NetBSD: Makefile,v 1.184 2020/02/19 21:03:41 tnn Exp $
 
 DISTNAME=      mesa-19.2.7
 PKGNAME=       ${DISTNAME:S/mesa/MesaLib/}
-PKGREVISION=   3
+PKGREVISION=   4
 CATEGORIES=    graphics
 MASTER_SITES=  https://mesa.freedesktop.org/archive/
 EXTRACT_SUFX=  .tar.xz
diff -r 97ad6905652d -r b7c450d75e51 graphics/MesaLib/distinfo
--- a/graphics/MesaLib/distinfo Wed Feb 19 19:08:46 2020 +0000
+++ b/graphics/MesaLib/distinfo Wed Feb 19 21:03:41 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.147 2020/01/21 14:41:26 nia Exp $
+$NetBSD: distinfo,v 1.148 2020/02/19 21:03:41 tnn Exp $
 
 SHA1 (mesa-19.2.7.tar.xz) = 9b8ebf66770353a48bd710e12e2727fb33645f44
 RMD160 (mesa-19.2.7.tar.xz) = 5323b623ac22c168b86548cf6d842ce004e346a9
@@ -24,13 +24,13 @@
 SHA1 (patch-src_glx_dri__common.h) = 0274877f8c65a4bb729536a897df4704897a4c6e
 SHA1 (patch-src_glx_dri__glx.c) = 8fd48776e9953b18bd17ba130d90ae2935e67242
 SHA1 (patch-src_glx_glxclient.h) = f0358179ae397bc8677597b0ccb9a471f40f15de
-SHA1 (patch-src_glx_glxcurrent.c) = 8b8e949eded13491c5865601253c6e7d4b06e228
+SHA1 (patch-src_glx_glxcurrent.c) = a872950c2cb08f60c1d018d0490c610a764ab468
 SHA1 (patch-src_glx_glxext.c) = 15c2c5e0c6b5095ce849fb86ad148aa05d7d907a
 SHA1 (patch-src_intel_compiler_brw__fs__bank__conflicts.cpp) = 6276d2c6846bb4dd08699921bec4e20202a17478
 SHA1 (patch-src_intel_perf_gen__perf.c) = 526f36d96bd9d72893764da2b9e78cb9b70de92b
 SHA1 (patch-src_intel_tools_aubinator__error__decode.c) = d8f636e3c3e76763a505a1dce23de0b198ad62fa
 SHA1 (patch-src_loader_loader.c) = 303e941f9b8afa6ee8053107af01e2c26e6ff118
-SHA1 (patch-src_mapi_entry__x86-64__tls.h) = 11b7ef1da435fa17fc7025a46a123d447d6a7d07
+SHA1 (patch-src_mapi_entry__x86-64__tls.h) = 7cb6a31dd17e73dad3c3b9cfdf058da1a2a7ecd3
 SHA1 (patch-src_mapi_entry__x86__tls.h) = 11c0f5302d305a77f3a1780d44a2c61f48a66273
 SHA1 (patch-src_mapi_u__current.c) = 4e3ec6e253af3737f77ecd43e56044ba2b81e699
 SHA1 (patch-src_mapi_u__current.h) = 9f4744681381a0959fda2926a436f296c89577f3
diff -r 97ad6905652d -r b7c450d75e51 graphics/MesaLib/patches/patch-src_glx_glxcurrent.c
--- a/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c       Wed Feb 19 19:08:46 2020 +0000
+++ b/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c       Wed Feb 19 21:03:41 2020 +0000
@@ -1,13 +1,13 @@
-$NetBSD: patch-src_glx_glxcurrent.c,v 1.3 2019/08/21 13:35:28 nia Exp $
+$NetBSD: patch-src_glx_glxcurrent.c,v 1.4 2020/02/19 21:03:41 tnn Exp $
 
 Interim fix for toolchain/50277.
 
 NetBSD only supports zero-initialized initial-exec tls variables in conjuction
 with dlopen(3) at the moment.
 
---- src/glx/glxcurrent.c.orig  2018-02-09 02:17:59.000000000 +0000
+--- src/glx/glxcurrent.c.orig  2019-12-04 22:10:12.000000000 +0000
 +++ src/glx/glxcurrent.c
-@@ -40,6 +40,18 @@
+@@ -40,6 +40,20 @@
  #include "glx_error.h"
  
  /*
@@ -15,10 +15,12 @@
 + * We need these to not be extern in libGL.so because of
 + * PR toolchain/50277
 + */
-+#if defined(GLX_USE_TLS) && defined(__NetBSD__)
-+_X_EXPORT __thread struct _glapi_table * _glapi_tls_Dispatch
++#if defined(USE_ELF_TLS) && defined(__NetBSD__)
++#define u_current_table _glapi_tls_Dispatch
++#define u_current_context _glapi_tls_Context
++_X_EXPORT __thread struct _glapi_table *u_current_table
 +    __attribute__((tls_model("initial-exec"))) = NULL;
-+_X_EXPORT __thread void * _glapi_tls_Context
++_X_EXPORT __thread void * u_current_context
 +    __attribute__((tls_model("initial-exec")));
 +#endif
 +
@@ -26,7 +28,7 @@
  ** We setup some dummy structures here so that the API can be used
  ** even if no context is current.
  */
-@@ -77,7 +89,11 @@ _X_HIDDEN pthread_mutex_t __glXmutex = P
+@@ -77,7 +91,11 @@ _X_HIDDEN pthread_mutex_t __glXmutex = P
   * \c __glXGetCurrentContext can be implemented as trivial macro.
   */
  __thread void *__glX_tls_Context __attribute__ ((tls_model("initial-exec")))
diff -r 97ad6905652d -r b7c450d75e51 graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h
--- a/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h      Wed Feb 19 19:08:46 2020 +0000
+++ b/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h      Wed Feb 19 21:03:41 2020 +0000
@@ -1,32 +1,49 @@
-$NetBSD: patch-src_mapi_entry__x86-64__tls.h,v 1.3 2019/08/21 13:35:28 nia Exp $
+$NetBSD: patch-src_mapi_entry__x86-64__tls.h,v 1.4 2020/02/19 21:03:41 tnn Exp $
 
 NetBSD only supports zero-initialized initial-exec tls variables in conjuction
 with dlopen(3) at the moment.
 
-Fix --enable-glx-tls with clang. From FreeBSD.
-
 table_noop_array is only defined for shared-glapi.
 es1api and es2api are not going to be patched for NetBSD.
 
---- src/mapi/entry_x86-64_tls.h.orig   2017-11-20 14:25:47.000000000 +0000
+--- src/mapi/entry_x86-64_tls.h.orig   2019-12-04 22:10:14.000000000 +0000
 +++ src/mapi/entry_x86-64_tls.h
-@@ -43,10 +43,19 @@ __asm__(".text\n"
+@@ -32,13 +32,13 @@
+ #endif
+ 
+ __asm__(".text\n"
+-        ".balign 32\n"
++        ".balign 64\n"
+         "x86_64_entry_start:");
+ 
+ #define STUB_ASM_ENTRY(func)                             \
+    ".globl " func "\n"                                   \
+    ".type " func ", @function\n"                         \
+-   ".balign 32\n"                                        \
++   ".balign 64\n"                                        \
+    func ":"
  
  #ifndef __ILP32__
- 
-+#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
+@@ -46,7 +46,12 @@ __asm__(".text\n"
  #define STUB_ASM_CODE(slot)                              \
     "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t"  \
     "movq %fs:(%rax), %r11\n\t"                           \
+-   "jmp *(8 * " slot ")(%r11)"
 +   "testq %r11, %r11\n\t"                                \
-+   "cmoveq table_noop_array@GOTPCREL(%rip), %r11\n\t"    \
-    "jmp *(8 * " slot ")(%r11)"
-+#else
-+#define STUB_ASM_CODE(slot)                              \
-+   "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t"  \
-+   "movq %fs:(%rax), %r11\n\t"                           \
-+   "jmp *(8 * " slot ")(%r11)"
-+#endif
++   "je 1f\n\t"                                           \
++   "jmp *(8 * " slot ")(%r11)\n\t"                       \
++   "1:\n\t"                                              \
++   "call " ENTRY_CURRENT_TABLE_GET "\n\t"                \
++   "jmp *(8 * " slot ")(%rax)"
  
  #else
  
+@@ -77,7 +82,7 @@ x86_64_entry_start[] HIDDEN;
+ mapi_func
+ entry_get_public(int slot)
+ {
+-   return (mapi_func) (x86_64_entry_start + slot * 32);
++   return (mapi_func) (x86_64_entry_start + slot * 64);
+ }
+ 
+ void



Home | Main Index | Thread Index | Old Index