Skip to Content.
Sympa Menu

sm-commit - Re: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (3466b6f87cdf28e0806308dfeb8d9afabfc6dd01)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Pavel Vinogradov <vin.public AT gmail.com>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: Re: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (3466b6f87cdf28e0806308dfeb8d9afabfc6dd01)
  • Date: Tue, 10 Aug 2021 17:38:01 -0400

BUILD also needs if... == "stable"... then for use_elf_tls.

On Tue, Aug 10, 2021 at 09:24:16PM +0000, Ismael Luceno wrote:
> GIT changes to master grimoire by Ismael Luceno <ismael AT sourcemage.org>:
>
> graphics-libs/mesa/BUILD | 1
> graphics-libs/mesa/HISTORY | 5 +
> graphics-libs/mesa/PRE_BUILD | 4 +
> graphics-libs/mesa/patches/add-use-elf-tls.patch | 35 ++++++++++++
> graphics-libs/mesa/patches/musl-endian.patch | 21 +++++++
> graphics-libs/mesa/patches/musl-stacksize.patch | 37 +++++++++++++
> graphics-libs/mesa/patches/musl.patch | 64
> +++++++++++++++++++++++
> 7 files changed, 167 insertions(+)
>
> New commits:
> commit 3466b6f87cdf28e0806308dfeb8d9afabfc6dd01
> Author: Ismael Luceno <ismael AT sourcemage.org>
> Commit: Ismael Luceno <ismael AT sourcemage.org>
>
> mesa: Add patches for musl-based systems
>
> - Add option to disable initial-exec TLS model (see comment on BUILD)
> - Fix endianness test on musl
> - Fix stack size issue on musl
> - Fix thread id type and missing includes on musl
>
> diff --git a/graphics-libs/mesa/BUILD b/graphics-libs/mesa/BUILD
> index 1004204..6e6b62e 100755
> --- a/graphics-libs/mesa/BUILD
> +++ b/graphics-libs/mesa/BUILD
> @@ -30,6 +30,7 @@ OPTS+=" dri-drivers=${dri// /,} \
> glx=${MESA_GLX// /,} \
> tools=${MESA_TOOLS// /,} \
> swr-arches=${MESA_ARCH// /,} \
> + use-elf-tls=false \
> $MESA_GLES1 $MESA_GLES2" &&
> echo "OPTS=$OPTS" &&
> PREFIX=/usr &&
> diff --git a/graphics-libs/mesa/HISTORY b/graphics-libs/mesa/HISTORY
> index 6761277..6a3d3e2 100644
> --- a/graphics-libs/mesa/HISTORY
> +++ b/graphics-libs/mesa/HISTORY
> @@ -1,3 +1,8 @@
> +2021-08-10 Ismael Luceno <ismael AT sourcemage.org>
> + * PRE_BUILD, patches/add-use-elf-tls.patch, patches/musl-endian.patch,
> + patches/musl-stacksize.patch, patches/musl.patch:
> + Added fixes for musl libc systems
> +
> 2021-08-07 Justin Boffemmyer <flux AT sourcemage.org>
> * CONFIGURE: strip leading spaces from driver lists,
> make DRI, Gallium, and Vulkan naming/messges consistent
> diff --git a/graphics-libs/mesa/PRE_BUILD b/graphics-libs/mesa/PRE_BUILD
> index 43e52fa..348da29 100755
> --- a/graphics-libs/mesa/PRE_BUILD
> +++ b/graphics-libs/mesa/PRE_BUILD
> @@ -1,6 +1,10 @@
> default_pre_build &&
> cd "$SOURCE_DIRECTORY" &&
>
> +if [[ "${MESA_BRANCH}" == "stable" ]]; then
> + apply_patch_dir patches
> +fi &&
> +
> if is_depends_enabled "$SPELL" smgl-gl_select; then
> patch -fp1 -i "$SPELL_DIRECTORY"/0001-install-GL-headers-in-.mesa.patch
> fi
> diff --git a/graphics-libs/mesa/patches/add-use-elf-tls.patch
> b/graphics-libs/mesa/patches/add-use-elf-tls.patch
> new file mode 100644
> index 0000000..c61c3dc
> --- /dev/null
> +++ b/graphics-libs/mesa/patches/add-use-elf-tls.patch
> @@ -0,0 +1,35 @@
> +Upstream: https://gitlab.freedesktop.org/mesa/mesa/issues/966
> +Origin: Void Linux
> +Status: Pending
> +
> +diff --git meson.build meson.build
> +index e1e94e71049..96ab3fb3e45 100644
> +--- a/meson.build
> ++++ b/meson.build
> +@@ -447,7 +447,8 @@ endif
> +
> + # Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF
> TLS.
> + use_elf_tls = false
> +-if (not ['freebsd', 'openbsd', 'haiku'].contains(host_machine.system())
> and
> ++with_use_elf_tls = get_option('use-elf-tls')
> ++if (not ['freebsd', 'openbsd', 'haiku'].contains(host_machine.system())
> and with_use_elf_tls and
> + (not with_platform_android or get_option('platform-sdk-version') >=
> 29) and
> + (not with_platform_windows or not with_shared_glapi))
> + pre_args += '-DUSE_ELF_TLS'
> +diff --git meson_options.txt meson_options.txt
> +index a7030aba31e..966cfeca298 100644
> +--- a/meson_options.txt
> ++++ b/meson_options.txt
> +@@ -446,6 +446,12 @@ option(
> + value : 25,
> + description : 'Android Platform SDK version. Default: Nougat version.'
> + )
> ++option(
> ++ 'use-elf-tls',
> ++ type : 'boolean',
> ++ value : true,
> ++ description : 'Build support for initial-exec TLS model'
> ++)
> + option(
> + 'zstd',
> + type : 'combo',
> diff --git a/graphics-libs/mesa/patches/musl-endian.patch
> b/graphics-libs/mesa/patches/musl-endian.patch
> new file mode 100644
> index 0000000..2c19378
> --- /dev/null
> +++ b/graphics-libs/mesa/patches/musl-endian.patch
> @@ -0,0 +1,21 @@
> +Origin: Void Linux
> +
> +--- a/src/util/u_endian.h 2017-12-21 18:31:22.000000000 +0100
> ++++ b/src/util/u_endian.h 2017-12-26 09:22:52.597199480 +0100
> +@@ -68,6 +68,16 @@
> +
> + #define PIPE_ARCH_LITTLE_ENDIAN
> +
> ++#else
> ++/* Musl libc */
> ++#include <endian.h>
> ++
> ++#if __BYTE_ORDER == __LITTLE_ENDIAN
> ++# define PIPE_ARCH_LITTLE_ENDIAN
> ++#elif __BYTE_ORDER == __BIG_ENDIAN
> ++# define PIPE_ARCH_BIG_ENDIAN
> ++#endif
> ++
> + #endif
> +
> + #endif
> diff --git a/graphics-libs/mesa/patches/musl-stacksize.patch
> b/graphics-libs/mesa/patches/musl-stacksize.patch
> new file mode 100644
> index 0000000..db76699
> --- /dev/null
> +++ b/graphics-libs/mesa/patches/musl-stacksize.patch
> @@ -0,0 +1,37 @@
> +Origin: Void Linux
> +
> +diff --git ./include/c11/threads_posix.h ./include/c11/threads_posix.h
> +index 45cb6075e6..1a2ea1a450 100644
> +--- a/include/c11/threads_posix.h
> ++++ b/include/c11/threads_posix.h
> +@@ -281,15 +281,29 @@ static inline int
> + thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
> + {
> + struct impl_thrd_param *pack;
> ++#ifdef __GLIBC__
> ++ pthread_attr_t *attrp = NULL;
> ++#else
> ++ pthread_attr_t attr = { 0 };
> ++ pthread_attr_init(&attr);
> ++ pthread_attr_setstacksize(&attr, 8388608);
> ++ pthread_attr_t *attrp = &attr;
> ++#endif
> + assert(thr != NULL);
> + pack = (struct impl_thrd_param *)malloc(sizeof(struct
> impl_thrd_param));
> + if (!pack) return thrd_nomem;
> + pack->func = func;
> + pack->arg = arg;
> +- if (pthread_create(thr, NULL, impl_thrd_routine, pack) != 0) {
> ++ if (pthread_create(thr, attrp, impl_thrd_routine, pack) != 0) {
> ++#ifndef __GLIBC__
> ++ pthread_attr_destroy(&attr);
> ++#endif
> + free(pack);
> + return thrd_error;
> + }
> ++#ifndef __GLIBC__
> ++ pthread_attr_destroy(&attr);
> ++#endif
> + return thrd_success;
> + }
> +
> diff --git a/graphics-libs/mesa/patches/musl.patch
> b/graphics-libs/mesa/patches/musl.patch
> new file mode 100644
> index 0000000..5b9270c
> --- /dev/null
> +++ b/graphics-libs/mesa/patches/musl.patch
> @@ -0,0 +1,64 @@
> +Origin: Void Linux
> +
> +--- a/src/gallium/winsys/svga/drm/vmw_screen.h 2015-05-07
> 14:02:28.033079796 +0200
> ++++ b/src/gallium/winsys/svga/drm/vmw_screen.h 2015-05-07
> 14:02:48.832054666 +0200
> +@@ -35,6 +35,8 @@
> + #define VMW_SCREEN_H_
> +
> +
> ++#include <sys/types.h> /* dev_t */
> ++
> + #include "pipe/p_compiler.h"
> + #include "pipe/p_state.h"
> +
> +--- a/src/gallium/frontends/nine/threadpool.h 2015-05-07
> 14:10:53.443337212 +0200
> ++++ b/src/gallium/frontends/nine/threadpool.h 2015-05-07
> 14:11:04.210307653 +0200
> +@@ -24,6 +24,8 @@
> + #ifndef _THREADPOOL_H_
> + #define _THREADPOOL_H_
> +
> ++#include <pthread.h>
> ++
> + #define MAXTHREADS 1
> +
> + struct threadpool {
> +--- a/src/util/rand_xor.c 2020-10-03 12:27:48.489024729 +0200
> ++++ b/src/util/rand_xor.c 2020-10-03 12:31:05.927113521 +0200
> +@@ -28,6 +28,7 @@
> + #if defined(HAVE_GETRANDOM)
> + #include <sys/random.h>
> + #endif
> ++#include <sys/types.h> /* size_t, ssize_t */
> + #include <unistd.h>
> + #include <fcntl.h>
> + #endif
> +--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
> ++++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
> +@@ -30,6 +30,7 @@
> +
> + #include <amdgpu.h>
> + #include <pthread.h>
> ++#include <sys/types.h>
> + #include "util/list.h"
> + #include "util/rwlock.h"
> + #include "ac_gpu_info.h"
> +--- a/src/gallium/frontends/nine/nine_debug.c 2020-03-06
> 07:46:48.278918421 +0100
> ++++ b/src/gallium/frontends/nine/nine_debug.c 2020-03-06
> 07:51:32.919964119 +0100
> +@@ -65,7 +65,7 @@ _nine_debug_printf( unsigned long flag,
> + {
> + static boolean first = TRUE;
> + static unsigned long dbg_flags = DBG_ERROR | DBG_WARN;
> +- unsigned long tid = 0;
> ++ pthread_t tid = 0;
> +
> + if (first) {
> + first = FALSE;
> +@@ -74,7 +74,7 @@ _nine_debug_printf( unsigned long flag,
> +
> + #if defined(HAVE_PTHREAD)
> + if (dbg_flags & DBG_TID)
> +- tid = (unsigned long)pthread_self();
> ++ tid = pthread_self();
> + #endif
> +
> + if (dbg_flags & flag) {
> _______________________________________________
> SM-Commit mailing list
> SM-Commit AT lists.ibiblio.org
> https://lists.ibiblio.org/mailman/listinfo/sm-commit




Archive powered by MHonArc 2.6.24.

Top of Page