Reset poky to before our libpam hacks

Things got a bit out of synch with openbmc-config due to the libpam
issues and the migration from the meta-* layers.

Revert the two previous commits and then put the latest poky in with the
libpam revert and get openbmc-config right again.

Revert "Revert "libpam: update 1.3.1 -> 1.5.1""

This reverts commit 87ddd3eab4df68e624b5350ccaab28b3b97547c0.

Revert "poky: subtree update:796be0593a..10c69538c0"

This reverts commit c723b72979bfac6362509cf1fe086900f6641f28.

Change-Id: I3a1f405193aee6a21fe0cd24be9927c143a23d9a
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/poky/meta/recipes-graphics/mesa/files/0001-meson-Add-xcb-fixes-to-loader-when-using-x11-and-dri.patch b/poky/meta/recipes-graphics/mesa/files/0001-meson-Add-xcb-fixes-to-loader-when-using-x11-and-dri.patch
new file mode 100644
index 0000000..9ee7288
--- /dev/null
+++ b/poky/meta/recipes-graphics/mesa/files/0001-meson-Add-xcb-fixes-to-loader-when-using-x11-and-dri.patch
@@ -0,0 +1,36 @@
+From cf17d6251653f4a98e7c4f904ea2f0bc0ecedd5c Mon Sep 17 00:00:00 2001
+From: Duncan Hopkins <duncan@duncanhopkins.me.uk>
+Date: Thu, 15 Oct 2020 12:14:57 +0100
+Subject: [PATCH] meson: Add xcb-fixes to loader when using x11 and dri3. Fixes
+ undefined symbol for xcb_xfixes_create_region in loader_dri3_helper.c
+
+loader_dr3_helper.c uses xcb_xfixes_create_region() that requires dep_xcb_xfixes to link. This is dependent on with_platform_x11 and with_dri3.
+But the source meson file does not set this up dependent on with_dri3.
+The build was initialsed using platforms=x11 and gallium-drivers=zink,swrast.
+
+Reviewed-by: Eric Anholt <eric@anholt.net>
+Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7164>
+
+Upstream-Status: Backport [cf17d6251653f4a98e7c4f904ea2f0bc0ecedd5c]
+
+---
+ meson.build | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index cfe02fa6373..3cb3c904927 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1782,7 +1782,8 @@ if with_platform_x11
+       dep_xxf86vm = dependency('xxf86vm')
+     endif
+   endif
+-  if (with_egl or (
++  if (with_egl or 
++      with_dri3 or (
+       with_gallium_vdpau or with_gallium_xvmc or with_gallium_xa or
+       with_gallium_omx != 'disabled'))
+     dep_xcb_xfixes = dependency('xcb-xfixes')
+-- 
+2.17.1
+
diff --git a/poky/meta/recipes-graphics/mesa/files/0002-meson.build-make-TLS-ELF-optional.patch b/poky/meta/recipes-graphics/mesa/files/0002-meson.build-make-TLS-ELF-optional.patch
index 89c0d15..74f7fe5 100644
--- a/poky/meta/recipes-graphics/mesa/files/0002-meson.build-make-TLS-ELF-optional.patch
+++ b/poky/meta/recipes-graphics/mesa/files/0002-meson.build-make-TLS-ELF-optional.patch
@@ -6,21 +6,6 @@
 USE_ELF_TLS has replaced GLX_USE_TLS so this patch is the original "make
 TLS GLX optional again" patch updated to the latest mesa.
 
-For details, see:
-https://gitlab.freedesktop.org/mesa/mesa/-/issues/966
-
-This prevents runtime segfault on musl:
-
-Traceback (most recent call last):
-  File "/home/pokybuild/yocto-worker/musl-qemux86/build/meta/lib/oeqa/core/decorator/__init__.py", line 36, in wrapped_f
-    return func(*args, **kwargs)
-  File "/home/pokybuild/yocto-worker/musl-qemux86/build/meta/lib/oeqa/runtime/cases/parselogs.py", line 378, in test_parselogs
-    self.assertEqual(errcount, 0, msg=self.msg)
-AssertionError: 1 != 0 : Log: /home/pokybuild/yocto-worker/musl-qemux86/build/build/tmp/work/qemux86-poky-linux-musl/core-image-sato-sdk/1.0-r0/target_logs/Xorg.0.log
------------------------
-Central error: [    10.477] (EE) Failed to load /usr/lib/xorg/modules/extensions/libglx.so: Error relocating /usr/lib/libGL.so.1: alphasort: initial-exec TLS resolves to dynamic definition in /usr/lib/libGL.so.1
-***********************
-
 Upstream-Status: Inappropriate [configuration]
 Signed-off-by: Alistair Francis <alistair@alistair23.me>
 
diff --git a/poky/meta/recipes-graphics/mesa/files/0004-Revert-mesa-Enable-asm-unconditionally-now-that-gen_.patch b/poky/meta/recipes-graphics/mesa/files/0004-Revert-mesa-Enable-asm-unconditionally-now-that-gen_.patch
new file mode 100644
index 0000000..8337423
--- /dev/null
+++ b/poky/meta/recipes-graphics/mesa/files/0004-Revert-mesa-Enable-asm-unconditionally-now-that-gen_.patch
@@ -0,0 +1,147 @@
+From 43d9e40db7357f27e91002b2bb7688b6775ebb43 Mon Sep 17 00:00:00 2001
+From: Alistair Francis <alistair@alistair23.me>
+Date: Thu, 14 Nov 2019 09:06:02 -0800
+Subject: [PATCH] Revert "mesa: Enable asm unconditionally, now that
+ gen_matypes is gone."
+
+This reverts commit 20294dceebc23236e33b22578245f7e6f41b6997.
+
+Upstream-Status: Inappropriate [configuration]
+Signed-off-by: Alistair Francis <alistair@alistair23.me>
+
+---
+ meson.build       | 94 ++++++++++++++++++++++++++++++-----------------
+ meson_options.txt |  6 +++
+ 2 files changed, 67 insertions(+), 33 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index e7dc599..e2fc934 100644
+--- a/meson.build
++++ b/meson.build
+@@ -52,6 +52,7 @@ pre_args = [
+ with_vulkan_icd_dir = get_option('vulkan-icd-dir')
+ with_tests = get_option('build-tests')
+ with_aco_tests = get_option('build-aco-tests')
++with_asm = get_option('asm')
+ with_glx_read_only_text = get_option('glx-read-only-text')
+ with_glx_direct = get_option('glx-direct')
+ with_osmesa = get_option('osmesa')
+@@ -1154,41 +1155,68 @@ dep_ws2_32 = cc.find_library('ws2_32', required : with_platform_windows)
+ 
+ # TODO: shared/static? Is this even worth doing?
+ 
++# When cross compiling we generally need to turn off the use of assembly,
++# because mesa's assembly relies on building an executable for the host system,
++# and running it to get information about struct sizes. There is at least one
++# case of cross compiling where we can use asm, and that's x86_64 -> x86 when
++# host OS == build OS, since in that case the build machine can run the host's
++# binaries.
++if with_asm and meson.is_cross_build()
++  if build_machine.system() != host_machine.system()
++    # TODO: It may be possible to do this with an exe_wrapper (like wine).
++    message('Cross compiling from one OS to another, disabling assembly.')
++    with_asm = false
++  elif not (build_machine.cpu_family().startswith('x86') and host_machine.cpu_family() == 'x86')
++    # FIXME: Gentoo always sets -m32 for x86_64 -> x86 builds, resulting in an
++    # x86 -> x86 cross compile. We use startswith rather than == to handle this
++    # case.
++    # TODO: There may be other cases where the 64 bit version of the
++    # architecture can run 32 bit binaries (aarch64 and armv7 for example)
++    message('''
++      Cross compiling to different architectures, and the host cannot run
++      the build machine's binaries. Disabling assembly.
++    ''')
++    with_asm = false
++  endif
++endif
++
+ with_asm_arch = ''
+-if host_machine.cpu_family() == 'x86'
+-  if system_has_kms_drm or host_machine.system() == 'gnu'
+-    with_asm_arch = 'x86'
+-    pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
+-                 '-DUSE_SSE_ASM']
+-
+-    if with_glx_read_only_text
+-      pre_args += ['-DGLX_X86_READONLY_TEXT']
++if with_asm
++  if host_machine.cpu_family() == 'x86'
++    if system_has_kms_drm or host_machine.system() == 'gnu'
++      with_asm_arch = 'x86'
++      pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
++                   '-DUSE_SSE_ASM']
++
++      if with_glx_read_only_text
++         pre_args += ['-DGLX_X86_READONLY_TEXT']
++      endif
++    endif
++  elif host_machine.cpu_family() == 'x86_64'
++    if system_has_kms_drm
++      with_asm_arch = 'x86_64'
++      pre_args += ['-DUSE_X86_64_ASM']
++    endif
++  elif host_machine.cpu_family() == 'arm'
++    if system_has_kms_drm
++      with_asm_arch = 'arm'
++      pre_args += ['-DUSE_ARM_ASM']
++    endif
++  elif host_machine.cpu_family() == 'aarch64'
++    if system_has_kms_drm
++      with_asm_arch = 'aarch64'
++      pre_args += ['-DUSE_AARCH64_ASM']
++    endif
++  elif host_machine.cpu_family() == 'sparc64'
++    if system_has_kms_drm
++      with_asm_arch = 'sparc'
++      pre_args += ['-DUSE_SPARC_ASM']
++    endif
++  elif host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
++    if system_has_kms_drm
++      with_asm_arch = 'ppc64le'
++      pre_args += ['-DUSE_PPC64LE_ASM']
+     endif
+-  endif
+-elif host_machine.cpu_family() == 'x86_64'
+-  if system_has_kms_drm
+-    with_asm_arch = 'x86_64'
+-    pre_args += ['-DUSE_X86_64_ASM']
+-  endif
+-elif host_machine.cpu_family() == 'arm'
+-  if system_has_kms_drm
+-    with_asm_arch = 'arm'
+-    pre_args += ['-DUSE_ARM_ASM']
+-  endif
+-elif host_machine.cpu_family() == 'aarch64'
+-  if system_has_kms_drm
+-    with_asm_arch = 'aarch64'
+-    pre_args += ['-DUSE_AARCH64_ASM']
+-  endif
+-elif host_machine.cpu_family() == 'sparc64'
+-  if system_has_kms_drm
+-    with_asm_arch = 'sparc'
+-    pre_args += ['-DUSE_SPARC_ASM']
+-  endif
+-elif host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
+-  if system_has_kms_drm
+-    with_asm_arch = 'ppc64le'
+-    pre_args += ['-DUSE_PPC64LE_ASM']
+   endif
+ endif
+ 
+diff --git a/meson_options.txt b/meson_options.txt
+index 147cccb..562b059 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -254,6 +254,12 @@ option(
+   value : false,
+   description : 'Enable GLVND support.'
+ )
++option(
++  'asm',
++  type : 'boolean',
++  value : true,
++  description : 'Build assembly code if possible'
++)
+ option(
+    'glx-read-only-text',
+    type : 'boolean',
diff --git a/poky/meta/recipes-graphics/mesa/files/0005-vc4-use-intmax_t-for-formatted-output-of-timespec-me.patch b/poky/meta/recipes-graphics/mesa/files/0005-vc4-use-intmax_t-for-formatted-output-of-timespec-me.patch
new file mode 100644
index 0000000..dacb1ea
--- /dev/null
+++ b/poky/meta/recipes-graphics/mesa/files/0005-vc4-use-intmax_t-for-formatted-output-of-timespec-me.patch
@@ -0,0 +1,51 @@
+From 281a636353666bfdd373c62591e744087e750e89 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 4 Dec 2019 14:15:28 -0800
+Subject: [PATCH] vc4: use intmax_t for formatted output of timespec members
+
+32bit architectures which have 64bit time_t does not fit the assumption
+of time_t being same as system long int
+
+Fixes
+error: format specifies type 'long' but the argument has type 'time_t' (aka 'long long') [-Werror,-Wformat]
+                        time.tv_sec);
+                        ^~~~~~~~~~~
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2966]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ src/gallium/drivers/v3d/v3d_bufmgr.c | 4 ++--
+ src/gallium/drivers/vc4/vc4_bufmgr.c | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/gallium/drivers/v3d/v3d_bufmgr.c b/src/gallium/drivers/v3d/v3d_bufmgr.c
+index 31a0803..cc2e2af 100644
+--- a/src/gallium/drivers/v3d/v3d_bufmgr.c
++++ b/src/gallium/drivers/v3d/v3d_bufmgr.c
+@@ -80,8 +80,8 @@ v3d_bo_dump_stats(struct v3d_screen *screen)
+ 
+                 struct timespec time;
+                 clock_gettime(CLOCK_MONOTONIC, &time);
+-                fprintf(stderr, "  now:               %ld\n",
+-                        (long)time.tv_sec);
++                fprintf(stderr, "  now:               %jd\n",
++                        (intmax_t)time.tv_sec);
+         }
+ }
+ 
+diff --git a/src/gallium/drivers/vc4/vc4_bufmgr.c b/src/gallium/drivers/vc4/vc4_bufmgr.c
+index a786e8e..975d49e 100644
+--- a/src/gallium/drivers/vc4/vc4_bufmgr.c
++++ b/src/gallium/drivers/vc4/vc4_bufmgr.c
+@@ -99,8 +99,8 @@ vc4_bo_dump_stats(struct vc4_screen *screen)
+ 
+                 struct timespec time;
+                 clock_gettime(CLOCK_MONOTONIC, &time);
+-                fprintf(stderr, "  now:               %ld\n",
+-                        (long)time.tv_sec);
++                fprintf(stderr, "  now:               %jd\n",
++                        (intmax_t)time.tv_sec);
+         }
+ }
+ 
diff --git a/poky/meta/recipes-graphics/mesa/mesa-gl_20.3.1.bb b/poky/meta/recipes-graphics/mesa/mesa-gl_20.2.4.bb
similarity index 100%
rename from poky/meta/recipes-graphics/mesa/mesa-gl_20.3.1.bb
rename to poky/meta/recipes-graphics/mesa/mesa-gl_20.2.4.bb
diff --git a/poky/meta/recipes-graphics/mesa/mesa.inc b/poky/meta/recipes-graphics/mesa/mesa.inc
index 883c244..7956d95 100644
--- a/poky/meta/recipes-graphics/mesa/mesa.inc
+++ b/poky/meta/recipes-graphics/mesa/mesa.inc
@@ -17,12 +17,15 @@
 SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
            file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \
            file://0002-meson.build-make-TLS-ELF-optional.patch \
+           file://0004-Revert-mesa-Enable-asm-unconditionally-now-that-gen_.patch \
+           file://0005-vc4-use-intmax_t-for-formatted-output-of-timespec-me.patch \
            file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
            file://0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch \
            file://0001-anv-fix-a-build-race-between-generating-a-header-and.patch \
+           file://0001-meson-Add-xcb-fixes-to-loader-when-using-x11-and-dri.patch \
            "
 
-SRC_URI[sha256sum] = "af751b49bb2ab0264d58c31e73d869e80333de02b2d1becc93f1b28c67aa780f"
+SRC_URI[sha256sum] = "0572dc6015d2e1c50f67823edd16855ae9b6feded0a1470598404e75e64aa092"
 
 UPSTREAM_CHECK_GITTAGREGEX = "mesa-(?P<pver>\d+(\.\d+)+)"
 
@@ -50,7 +53,9 @@
 
 ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan"
 
-PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}"
+PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \
+               ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)} \
+               surfaceless"
 
 export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
 export YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}"
@@ -73,7 +78,7 @@
 MESON_BUILDTYPE = "${@check_buildtype(d)}"
 
 EXTRA_OEMESON = " \
-    -Dshared-glapi=enabled \
+    -Dshared-glapi=true \
     -Dgallium-opencl=disabled \
     -Dglx-read-only-text=true \
     -Dplatforms='${@",".join("${PLATFORMS}".split())}' \
@@ -94,13 +99,13 @@
 PACKAGECONFIG_remove_libc-musl = "elf-tls"
 
 # "gbm" requires "dri", "opengl"
-PACKAGECONFIG[gbm] = "-Dgbm=enabled,-Dgbm=disabled"
+PACKAGECONFIG[gbm] = "-Dgbm=true,-Dgbm=false"
 
 X11_DEPS = "xorgproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes xrandr"
 # "x11" requires "opengl"
 PACKAGECONFIG[x11] = ",-Dglx=disabled,${X11_DEPS}"
 PACKAGECONFIG[elf-tls] = "-Delf-tls=true, -Delf-tls=false"
-PACKAGECONFIG[xvmc] = "-Dgallium-xvmc=enabled,-Dgallium-xvmc=disabled,libxvmc"
+PACKAGECONFIG[xvmc] = "-Dgallium-xvmc=true,-Dgallium-xvmc=false,libxvmc"
 PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm wayland-protocols"
 
 DRIDRIVERS_class-native = "swrast"
@@ -109,7 +114,7 @@
 DRIDRIVERS_append_x86-64_class-target = ",r100,r200,nouveau,i965,i915"
 # "dri" requires "opengl"
 PACKAGECONFIG[dri] = "-Ddri-drivers=${@strip_comma('${DRIDRIVERS}')}, -Ddri-drivers='', xorgproto libdrm"
-PACKAGECONFIG[dri3] = "-Ddri3=enabled, -Ddri3=disabled, xorgproto libxshmfence"
+PACKAGECONFIG[dri3] = "-Ddri3=true, -Ddri3=false, xorgproto libxshmfence"
 
 # Vulkan drivers need dri3 enabled
 # amd could be enabled as well but requires gallium-llvm with llvm >= 3.9
@@ -122,10 +127,10 @@
 PACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=false"
 
 # "gles" requires "opengl"
-PACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, -Dgles1=disabled -Dgles2=disabled"
+PACKAGECONFIG[gles] = "-Dgles1=true -Dgles2=true, -Dgles1=false -Dgles2=false"
 
 # "egl" requires "dri", "opengl"
-PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
+PACKAGECONFIG[egl] = "-Degl=true, -Degl=false"
 
 PACKAGECONFIG[etnaviv] = ""
 PACKAGECONFIG[freedreno] = ""
@@ -155,12 +160,12 @@
 GALLIUMDRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'virgl', ',virgl', '', d)}"
 
 PACKAGECONFIG[gallium] = "-Dgallium-drivers=${@strip_comma('${GALLIUMDRIVERS}')}, -Dgallium-drivers=''"
-PACKAGECONFIG[gallium-llvm] = "-Dllvm=enabled -Dshared-llvm=enabled, -Dllvm=disabled, llvm${MESA_LLVM_RELEASE} llvm-native \
+PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, llvm${MESA_LLVM_RELEASE} llvm-native \
                                elfutils"
-PACKAGECONFIG[xa]  = "-Dgallium-xa=enabled, -Dgallium-xa=disabled"
-PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial"
+PACKAGECONFIG[xa]  = "-Dgallium-xa=true, -Dgallium-xa=false"
+PACKAGECONFIG[va] = "-Dgallium-va=true,-Dgallium-va=false,libva-initial"
 
-PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau"
+PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=true,-Dgallium-vdpau=false,libvdpau"
 
 PACKAGECONFIG[lima] = ""
 GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}"
@@ -171,7 +176,10 @@
 OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium', 'classic', d)}"
 PACKAGECONFIG[osmesa] = "-Dosmesa=${OSMESA},-Dosmesa=none"
 
-PACKAGECONFIG[unwind] = "-Dlibunwind=enabled,-Dlibunwind=disabled,libunwind"
+PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind"
+
+# mesa tries to run cross-built gen_matypes on build machine to get struct size information
+EXTRA_OEMESON_append = " -Dasm=false"
 
 # llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
 FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
diff --git a/poky/meta/recipes-graphics/mesa/mesa_20.3.1.bb b/poky/meta/recipes-graphics/mesa/mesa_20.2.4.bb
similarity index 100%
rename from poky/meta/recipes-graphics/mesa/mesa_20.3.1.bb
rename to poky/meta/recipes-graphics/mesa/mesa_20.2.4.bb