about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/mesa
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-02-26 16:20:28 +0100
committerAlyssa Ross <hi@alyssa.is>2024-02-26 16:20:28 +0100
commit647438344bfc1f77791391e2b4f98eef865c63dc (patch)
treeef580867fc6cc413940e4330d939cf1afda082cb /nixpkgs/pkgs/development/libraries/mesa
parentb084c6a0fab7f32c904c5c8e8db8dddcefbe507f (diff)
parente3474e1d1e53b70e2b2af73ea26d6340e82f6b8b (diff)
downloadnixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.gz
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.bz2
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.lz
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.xz
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.zst
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.zip
Merge commit 'e3474e1d1e53'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/mesa')
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa/backports/0001-dri-added-build-dependencies-for-systems-using-non-s.patch56
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa/backports/0002-util-Update-util-libdrm.h-stubs-to-allow-loader.c-to.patch103
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa/backports/0003-glx-fix-automatic-zink-fallback-loading-between-hw-a.patch53
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa/default.nix93
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa/musl.patch59
5 files changed, 57 insertions, 307 deletions
diff --git a/nixpkgs/pkgs/development/libraries/mesa/backports/0001-dri-added-build-dependencies-for-systems-using-non-s.patch b/nixpkgs/pkgs/development/libraries/mesa/backports/0001-dri-added-build-dependencies-for-systems-using-non-s.patch
deleted file mode 100644
index c0b239c92598..000000000000
--- a/nixpkgs/pkgs/development/libraries/mesa/backports/0001-dri-added-build-dependencies-for-systems-using-non-s.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: "duncan.hopkins" <duncan.hopkins@foundry.com>
-Date: Tue, 17 Oct 2023 09:34:31 +0100
-Subject: [PATCH] dri: added build dependencies for systems using non-standard
- prefixed X11 libs.
-
-To get MacOS to build, some extra dependencies need to be added to a couple of build targets.
-This mainly shows up when not installing the dependencies in the default prefix locations.
-On MacOS, this happens when using a custom build of brew to install the dependencies to 'odd' locations.
-
-Reviewed-by: Adam Jackson <ajax@redhat.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25992>
----
- src/gallium/targets/dri/meson.build | 2 +-
- src/glx/meson.build                 | 2 +-
- src/loader/meson.build              | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src/gallium/targets/dri/meson.build b/src/gallium/targets/dri/meson.build
-index 66619bba0db..6d3ef197e74 100644
---- a/src/gallium/targets/dri/meson.build
-+++ b/src/gallium/targets/dri/meson.build
-@@ -49,7 +49,7 @@ libgallium_dri = shared_library(
-   link_depends : gallium_dri_link_depends,
-   link_with : [
-     libdri, libmesa, libgalliumvl,
--    libgallium, libglapi, libpipe_loader_static, libws_null, libwsw, libswdri,
-+    libgallium, libglapi, libloader, libpipe_loader_static, libws_null, libwsw, libswdri,
-     libswkmsdri,
-   ],
-   dependencies : [
-diff --git a/src/glx/meson.build b/src/glx/meson.build
-index 7ec3e3e0d88..1a5e9833956 100644
---- a/src/glx/meson.build
-+++ b/src/glx/meson.build
-@@ -136,7 +136,7 @@ libglx = static_library(
-   ],
-   dependencies : [
-     idep_mesautil, idep_xmlconfig,
--    dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd, dep_xxf86vm, dep_xshmfence
-+    dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_xext, dep_glvnd, dep_xxf86vm, dep_xshmfence
-   ],
- )
- 
-diff --git a/src/loader/meson.build b/src/loader/meson.build
-index 35f9991ba2f..043cc852112 100644
---- a/src/loader/meson.build
-+++ b/src/loader/meson.build
-@@ -47,6 +47,6 @@ libloader = static_library(
-   c_args : loader_c_args,
-   gnu_symbol_visibility : 'hidden',
-   include_directories : [inc_include, inc_src, inc_util],
--  dependencies : [dep_libdrm, dep_thread, dep_xcb_xrandr],
-+  dependencies : [dep_libdrm, dep_thread, dep_xcb, dep_xcb_xrandr],
-   build_by_default : false,
- )
diff --git a/nixpkgs/pkgs/development/libraries/mesa/backports/0002-util-Update-util-libdrm.h-stubs-to-allow-loader.c-to.patch b/nixpkgs/pkgs/development/libraries/mesa/backports/0002-util-Update-util-libdrm.h-stubs-to-allow-loader.c-to.patch
deleted file mode 100644
index 5a48ace8fbbc..000000000000
--- a/nixpkgs/pkgs/development/libraries/mesa/backports/0002-util-Update-util-libdrm.h-stubs-to-allow-loader.c-to.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: "duncan.hopkins" <duncan.hopkins@foundry.com>
-Date: Tue, 17 Oct 2023 14:36:39 +0100
-Subject: [PATCH] util: Update util/libdrm.h stubs to allow loader.c to compile
- on MacOS.
-
-MacOS does not have the libdrm libraries so is missing xf86drm.h.
-util/libdrm.h already has a collection of stubs for systems that do not support the libraries.
-
-A compile on MacOS will fail with the source that uses newer drm functions and structures.
-Update adds in missing items that MacOS code needs to compile and run.
-New code is copied from the public repository: https://gitlab.freedesktop.org/mesa/drm/-/blob/main/xf86drm.h
-
-Reviewed-by: Adam Jackson <ajax@redhat.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25992>
----
- src/util/libdrm.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 57 insertions(+)
-
-diff --git a/src/util/libdrm.h b/src/util/libdrm.h
-index cc153cf88ab..e3af494b8d1 100644
---- a/src/util/libdrm.h
-+++ b/src/util/libdrm.h
-@@ -44,22 +44,79 @@
- #define DRM_BUS_PLATFORM  2
- #define DRM_BUS_HOST1X    3
- 
-+typedef struct _drmPciDeviceInfo {
-+    uint16_t vendor_id;
-+    uint16_t device_id;
-+    uint16_t subvendor_id;
-+    uint16_t subdevice_id;
-+    uint8_t revision_id;
-+} drmPciDeviceInfo, *drmPciDeviceInfoPtr;
-+
-+#define DRM_PLATFORM_DEVICE_NAME_LEN 512
-+
-+typedef struct _drmPlatformBusInfo {
-+    char fullname[DRM_PLATFORM_DEVICE_NAME_LEN];
-+} drmPlatformBusInfo, *drmPlatformBusInfoPtr;
-+
-+typedef struct _drmPlatformDeviceInfo {
-+    char **compatible; /* NULL terminated list of compatible strings */
-+} drmPlatformDeviceInfo, *drmPlatformDeviceInfoPtr;
-+
-+#define DRM_HOST1X_DEVICE_NAME_LEN 512
-+
-+typedef struct _drmHost1xBusInfo {
-+    char fullname[DRM_HOST1X_DEVICE_NAME_LEN];
-+} drmHost1xBusInfo, *drmHost1xBusInfoPtr;
-+
-+typedef struct _drmPciBusInfo {
-+   uint16_t domain;
-+   uint8_t bus;
-+   uint8_t dev;
-+   uint8_t func;
-+} drmPciBusInfo, *drmPciBusInfoPtr;
-+
- typedef struct _drmDevice {
-     char **nodes; /* DRM_NODE_MAX sized array */
-     int available_nodes; /* DRM_NODE_* bitmask */
-     int bustype;
-+    union {
-+       drmPciBusInfoPtr pci;
-+       drmPlatformBusInfoPtr platform;
-+       drmHost1xBusInfoPtr host1x;
-+    } businfo;
-+    union {
-+        drmPciDeviceInfoPtr pci;
-+    } deviceinfo;
-     /* ... */
- } drmDevice, *drmDevicePtr;
- 
-+static inline int
-+drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device)
-+{
-+   return -ENOENT;
-+}
-+
- static inline int
- drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices)
- {
-    return -ENOENT;
- }
- 
-+static inline int
-+drmGetDeviceFromDevId(dev_t dev_id, uint32_t flags, drmDevicePtr *device)
-+{
-+   return -ENOENT;
-+}
-+
-+static inline void
-+drmFreeDevice(drmDevicePtr *device) {}
-+
- static inline void
- drmFreeDevices(drmDevicePtr devices[], int count) {}
- 
-+static inline char*
-+drmGetDeviceNameFromFd2(int fd) { return NULL;}
-+
- typedef struct _drmVersion {
-     int     version_major;        /**< Major version */
-     int     version_minor;        /**< Minor version */
diff --git a/nixpkgs/pkgs/development/libraries/mesa/backports/0003-glx-fix-automatic-zink-fallback-loading-between-hw-a.patch b/nixpkgs/pkgs/development/libraries/mesa/backports/0003-glx-fix-automatic-zink-fallback-loading-between-hw-a.patch
deleted file mode 100644
index c7bde6411d8e..000000000000
--- a/nixpkgs/pkgs/development/libraries/mesa/backports/0003-glx-fix-automatic-zink-fallback-loading-between-hw-a.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: "duncan.hopkins" <duncan.hopkins@foundry.com>
-Date: Wed, 1 Nov 2023 11:31:13 +0000
-Subject: [PATCH] glx: fix automatic zink fallback loading between hw and sw
- drivers on MacOS
-
-The combination of defines used when compile the code on MacOS is hiding variables.
-Patch allows basic MacOS build to compile and run.
-
-Reviewed-by: Adam Jackson <ajax@redhat.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25992>
----
- src/glx/glxext.c | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/src/glx/glxext.c b/src/glx/glxext.c
-index 7712e54c1d6..454f2c36a77 100644
---- a/src/glx/glxext.c
-+++ b/src/glx/glxext.c
-@@ -878,12 +878,16 @@ __glXInitialize(Display * dpy)
- 
-    dpyPriv->glXDrawHash = __glxHashCreate();
- 
-+   Bool zink = False;
-+   Bool try_zink = False;
-+
- #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
-    Bool glx_direct = !debug_get_bool_option("LIBGL_ALWAYS_INDIRECT", false);
-    Bool glx_accel = !debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
-    const char *env = getenv("MESA_LOADER_DRIVER_OVERRIDE");
--   Bool zink = env && !strcmp(env, "zink");
--   Bool try_zink = False;
-+
-+   zink = env && !strcmp(env, "zink");
-+   try_zink = False;
- 
-    dpyPriv->drawHash = __glxHashCreate();
- 
-@@ -928,12 +932,14 @@ __glXInitialize(Display * dpy)
- 
-    if (!AllocAndFetchScreenConfigs(dpy, dpyPriv, zink | try_zink)) {
-       Bool fail = True;
-+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
-       if (try_zink) {
-          free(dpyPriv->screens);
-          dpyPriv->driswDisplay->destroyDisplay(dpyPriv->driswDisplay);
-          dpyPriv->driswDisplay = driswCreateDisplay(dpy, false);
-          fail = !AllocAndFetchScreenConfigs(dpy, dpyPriv, False);
-       }
-+#endif
-       if (fail) {
-          free(dpyPriv);
-          return NULL;
diff --git a/nixpkgs/pkgs/development/libraries/mesa/default.nix b/nixpkgs/pkgs/development/libraries/mesa/default.nix
index 38b73f56cab6..dff2f0021d46 100644
--- a/nixpkgs/pkgs/development/libraries/mesa/default.nix
+++ b/nixpkgs/pkgs/development/libraries/mesa/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, fetchpatch, buildPackages
+{ stdenv, lib, fetchurl, fetchpatch, fetchCrate, buildPackages
 , meson, pkg-config, ninja
 , intltool, bison, flex, file, python3Packages, wayland-scanner
 , expat, libdrm, xorg, wayland, wayland-protocols, openssl
@@ -10,6 +10,7 @@
   if stdenv.isLinux then
     [
       "d3d12" # WSL emulated GPU (aka Dozen)
+      "kmsro" # special "render only" driver for GPUs without a display controller
       "nouveau" # Nvidia
       "radeonsi" # new AMD (GCN+)
       "r300" # very old AMD
@@ -38,6 +39,7 @@
     [
       "amd" # AMD (aka RADV)
       "microsoft-experimental" # WSL virtualized GPU (aka DZN/Dozen)
+      "nouveau-experimental" # Nouveau (aka NVK)
       "swrast" # software renderer (aka Lavapipe)
     ]
     ++ lib.optionals (stdenv.hostPlatform.isAarch -> lib.versionAtLeast stdenv.hostPlatform.parsed.cpu.version "6") [
@@ -66,6 +68,7 @@
 , enableOpenCL ? stdenv.isLinux && stdenv.isx86_64
 , enablePatentEncumberedCodecs ? true
 , jdupes
+, rustPlatform
 , rust-bindgen
 , rustc
 , spirv-llvm-translator
@@ -74,20 +77,12 @@
 , udev
 }:
 
-/** Packaging design:
-  - The basic mesa ($out) contains headers and libraries (GLU is in libGLU now).
-    This or the mesa attribute (which also contains GLU) are small (~ 2 MB, mostly headers)
-    and are designed to be the buildInput of other packages.
-  - DRI drivers are compiled into $drivers output, which is much bigger and
-    depends on LLVM. These should be searched at runtime in
-    "/run/opengl-driver{,-32}/lib/*" and so are kind-of impure (given by NixOS).
-    (I suppose on non-NixOS one would create the appropriate symlinks from there.)
-  - libOSMesa is in $osmesa (~4 MB)
-*/
+# When updating this package, please verify at least these build (assuming x86_64-linux):
+# nix build .#mesa .#pkgsi686Linux.mesa .#pkgsCross.aarch64-multiplatform.mesa .#pkgsMusl.mesa
 
 let
-  version = "23.3.5";
-  hash = "sha256-acyxJ4ZB/1utccoPhmGIrrGpKq3E27nTX1CuvsW4tQ8=";
+  version = "24.0.1";
+  hash = "sha256-84cZKwjEccVFWQ3RIjCio0MkSAS1/oZv7GrqAuq1dhM=";
 
   # Release calendar: https://www.mesa3d.org/release-calendar.html
   # Release frequency: https://www.mesa3d.org/releasing.html#schedule
@@ -98,6 +93,37 @@ let
   haveWayland = lib.elem "wayland" eglPlatforms;
   haveZink = lib.elem "zink" galliumDrivers;
   haveDozen = (lib.elem "d3d12" galliumDrivers) || (lib.elem "microsoft-experimental" vulkanDrivers);
+
+  rustDeps = [
+    {
+      pname = "proc-macro2";
+      version = "1.0.70";
+      hash = "sha256-e4ZgyZUTu5nAtaH5QVkLelqJQX/XPj/rWkzf/g2c+1g=";
+    }
+    {
+      pname = "quote";
+      version = "1.0.33";
+      hash = "sha256-VWRCZJO0/DJbNu0/V9TLaqlwMot65YjInWT9VWg57DY=";
+    }
+    {
+    pname = "syn";
+      version = "2.0.39";
+      hash = "sha256-Mjen2L/omhVbhU/+Ao65mogs3BP3fY+Bodab3uU63EI=";
+    }
+    {
+      pname = "unicode-ident";
+      version = "1.0.12";
+      hash = "sha256-KX8NqYYw6+rGsoR9mdZx8eT1HIPEUUyxErdk2H/Rlj8=";
+    }
+  ];
+
+  copyRustDep = dep: ''
+    cp -R --no-preserve=mode,ownership ${fetchCrate dep} subprojects/${dep.pname}-${dep.version}
+    cp -R subprojects/packagefiles/${dep.pname}/* subprojects/${dep.pname}-${dep.version}/
+  '';
+
+  copyRustDeps = lib.concatStringsSep "\n" (builtins.map copyRustDep rustDeps);
+
 self = stdenv.mkDerivation {
   pname = "mesa";
   inherit version;
@@ -113,22 +139,8 @@ self = stdenv.mkDerivation {
     inherit hash;
   };
 
-  # TODO:
-  #  revive ./dricore-gallium.patch when it gets ported (from Ubuntu), as it saved
-  #  ~35 MB in $drivers; watch https://launchpad.net/ubuntu/+source/mesa/+changelog
   patches = [
-    # fixes pkgsMusl.mesa build
-    ./musl.patch
-
     ./opencl.patch
-
-    # Backports to fix build
-    # FIXME: remove when applied upstream
-
-    # Fix build on macOS
-    ./backports/0001-dri-added-build-dependencies-for-systems-using-non-s.patch
-    ./backports/0002-util-Update-util-libdrm.h-stubs-to-allow-loader.c-to.patch
-    ./backports/0003-glx-fix-automatic-zink-fallback-loading-between-hw-a.patch
   ];
 
   postPatch = ''
@@ -141,6 +153,8 @@ self = stdenv.mkDerivation {
       "get_option('datadir')" "'${placeholder "out"}/share'"
     substituteInPlace src/amd/vulkan/meson.build --replace \
       "get_option('datadir')" "'${placeholder "out"}/share'"
+
+    ${copyRustDeps}
   '';
 
   outputs = [ "out" "dev" "drivers" ]
@@ -152,15 +166,15 @@ self = stdenv.mkDerivation {
     # in case anything wants to use it at some point
     ++ lib.optional haveDozen "spirv2dxil";
 
-  # FIXME: this fixes rusticl/iris segfaulting on startup, _somehow_.
-  # Needs more investigating.
+  # Keep build-ids so drivers can use them for caching, etc.
+  # Also some drivers segfault without this.
   separateDebugInfo = true;
 
+  # Needed to discover llvm-config for cross
   preConfigure = ''
     PATH=${llvmPackages.libllvm.dev}/bin:$PATH
   '';
 
-  # TODO: Figure out how to enable opencl without having a runtime dependency on clang
   mesonFlags = [
     "--sysconfdir=/etc"
     "--datadir=${placeholder "drivers"}/share" # Vendor files
@@ -212,21 +226,23 @@ self = stdenv.mkDerivation {
     "-Dopencl-spirv=true"
 
     # Rusticl, new OpenCL frontend
-    "-Dgallium-rusticl=true" "-Drust_std=2021"
+    "-Dgallium-rusticl=true"
     "-Dclang-libdir=${llvmPackages.clang-unwrapped.lib}/lib"
   ]  ++ lib.optionals (!withValgrind) [
     "-Dvalgrind=disabled"
   ]  ++ lib.optionals (!withLibunwind) [
     "-Dlibunwind=disabled"
   ] ++ lib.optional enablePatentEncumberedCodecs
-    "-Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec"
+    "-Dvideo-codecs=all"
   ++ lib.optional (vulkanLayers != []) "-D vulkan-layers=${builtins.concatStringsSep "," vulkanLayers}";
 
+  strictDeps = true;
+
   buildInputs = with xorg; [
     expat glslang llvmPackages.libllvm libglvnd xorgproto
     libX11 libXext libxcb libXt libXfixes libxshmfence libXrandr
     libffi libvdpau libelf libXvMC
-    libpthreadstubs openssl /*or another sha1 provider*/
+    libpthreadstubs openssl
     zstd
   ] ++ lib.optionals withLibunwind [
     libunwind
@@ -240,15 +256,20 @@ self = stdenv.mkDerivation {
     ++ lib.optional haveDozen directx-headers;
 
   depsBuildBuild = [ pkg-config ]
-    ++ lib.optional enableOpenCL buildPackages.stdenv.cc;
+    # Adding this unconditionally makes x86_64-darwin pick up an older toolchain, as
+    # we explicitly call Mesa with 11.0 stdenv, but buildPackages is still 10.something,
+    # and Mesa can't build with that.
+    # FIXME: figure this out, or figure out how to get rid of Mesa on Darwin,
+    # whichever is easier.
+    ++ lib.optional (!stdenv.isDarwin) buildPackages.stdenv.cc;
 
   nativeBuildInputs = [
     meson pkg-config ninja
     intltool bison flex file
     python3Packages.python python3Packages.mako python3Packages.ply
     jdupes glslang
-  ] ++ lib.optionals enableOpenCL [ rust-bindgen rustc ]
-    ++ lib.optional haveWayland wayland-scanner;
+    rustc rust-bindgen rustPlatform.bindgenHook
+  ] ++ lib.optional haveWayland wayland-scanner;
 
   propagatedBuildInputs = with xorg; [
     libXdamage libXxf86vm
diff --git a/nixpkgs/pkgs/development/libraries/mesa/musl.patch b/nixpkgs/pkgs/development/libraries/mesa/musl.patch
deleted file mode 100644
index 687a159c1788..000000000000
--- a/nixpkgs/pkgs/development/libraries/mesa/musl.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
-index 06ca90564f0..bb244f8f358 100644
---- 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"
-diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
-index 22f99c41909..2f3195926be 100644
---- a/src/gallium/drivers/freedreno/freedreno_util.h
-+++ b/src/gallium/drivers/freedreno/freedreno_util.h
-@@ -108,6 +108,8 @@ extern bool fd_binning_enabled;
- #include <sys/types.h>
- #include <sys/syscall.h>
- 
-+#define gettid() ((pid_t)syscall(SYS_gettid))
-+
- #define DBG(fmt, ...)                                                          \
-    do {                                                                        \
-       if (FD_DBG(MSGS))                                                        \
-diff --git a/src/gallium/frontends/nine/nine_debug.c b/src/gallium/frontends/nine/nine_debug.c
-index f3a6a945025..f4a6c41a612 100644
---- a/src/gallium/frontends/nine/nine_debug.c
-+++ b/src/gallium/frontends/nine/nine_debug.c
-@@ -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) {
-diff --git a/src/util/rand_xor.c b/src/util/rand_xor.c
-index 81b64f1ea71..56ebd2eccdf 100644
---- a/src/util/rand_xor.c
-+++ b/src/util/rand_xor.c
-@@ -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