Merge branch 'staging' into mesa_3

This commit is contained in:
Matthew Bauer
2019-05-02 17:37:20 -04:00
committed by GitHub
11257 changed files with 487607 additions and 251764 deletions

View File

@@ -2,12 +2,14 @@
, pkgconfig, intltool, autoreconfHook
, file, expat, libdrm, xorg, wayland, wayland-protocols, openssl
, llvmPackages, libffi, libomxil-bellagio, libva-minimal
, libelf, libvdpau, valgrind-light, python2
, libelf, libvdpau, valgrind-light, python2, python2Packages
, libglvnd
, enableRadv ? true
, galliumDrivers ? null
, driDrivers ? null
, vulkanDrivers ? null
, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
, OpenGL, Xplugin
}:
/** Packaging design:
@@ -23,28 +25,27 @@
with stdenv.lib;
if ! lists.elem stdenv.system platforms.mesaPlatforms then
if ! elem stdenv.hostPlatform.system platforms.mesaPlatforms then
throw "${stdenv.system}: unsupported platform for Mesa"
else
let
inherit (stdenv) hostPlatform;
# platforms that have PCIe slots and thus can use most non-integrated GPUs
pciePlatform = !hostPlatform.isAarch32 && !hostPlatform.isAarch64;
defaultGalliumDrivers = [ "virgl" ]
pciePlatform = !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64;
defaultGalliumDrivers = optionals (elem "drm" eglPlatforms) ([ "virgl" ]
++ lib.optionals pciePlatform [ "r300" "r600" "radeonsi" ]
++ lib.optionals (pciePlatform || hostPlatform.isAarch32 || hostPlatform.isAarch64) [ "nouveau" ]
++ lib.optionals hostPlatform.isx86 [ "i915" "svga" ]
++ lib.optionals (hostPlatform.isAarch32 || hostPlatform.isAarch64) [ "vc4" ]
++ lib.optionals hostPlatform.isAarch64 [ "freedreno" "etnaviv" "imx" ]
;
defaultDriDrivers = [ ]
++ lib.optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ]
++ lib.optionals stdenv.hostPlatform.isx86 [ "i915" "svga" ]
++ lib.optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "vc4" ]
++ lib.optionals stdenv.hostPlatform.isAarch64 [ "freedreno" "etnaviv" "imx" ]
);
defaultDriDrivers = optionals (elem "drm" eglPlatforms) ([ ]
++ lib.optionals pciePlatform [ "radeon" "r200" ]
++ lib.optionals (pciePlatform || hostPlatform.isAarch32 || hostPlatform.isAarch64) [ "nouveau" ]
++ lib.optionals hostPlatform.isx86 [ "i915" "i965" ];
defaultVulkanDrivers =
lib.optional hostPlatform.isx86 "intel"
++ lib.optional enableRadv "radeon";
++ lib.optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ]
++ lib.optionals stdenv.hostPlatform.isx86 [ "i915" "i965" ]);
defaultVulkanDrivers = optionals stdenv.hostPlatform.isLinux ([ ]
++ lib.optional stdenv.hostPlatform.isx86 "intel"
++ lib.optional enableRadv "radeon");
in
let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in
@@ -54,11 +55,11 @@ let
(if gallium_ == null
then defaultGalliumDrivers
else gallium_)
++ ["swrast" "virgl"];
++ lib.optional stdenv.isLinux "swrast";
driDrivers =
(if dri_ == null
then defaultDriDrivers
else dri_) ++ ["swrast"];
then optionals (elem "drm" eglPlatforms) defaultDriDrivers
else dri_) ++ lib.optional stdenv.isLinux "swrast";
vulkanDrivers =
if vulkan_ == null
then defaultVulkanDrivers
@@ -66,7 +67,7 @@ let
in
let
version = "18.1.5";
version = "18.3.4";
branch = head (splitString "." version);
in
@@ -80,7 +81,7 @@ let self = stdenv.mkDerivation {
"ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz"
"https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
];
sha256 = "69dbe6f1a6660386f5beb85d4fcf003ee23023ed7b9a603de84e9a37e8d98dea";
sha256 = "01xv03ah4l5lcfx015n3fg1620dh4nbbv6gmhh6zhdsx6sj4sc9j";
};
prePatch = "patchShebangs .";
@@ -94,7 +95,8 @@ let self = stdenv.mkDerivation {
./disk_cache-include-dri-driver-path-in-cache-key.patch
];
outputs = [ "out" "dev" "drivers" "osmesa" ];
outputs = [ "out" "dev" "drivers" ]
++ lib.optional (elem "swrast" galliumDrivers) "osmesa";
# TODO: Figure out how to enable opencl without having a runtime dependency on clang
configureFlags = [
@@ -102,18 +104,11 @@ let self = stdenv.mkDerivation {
"--localstatedir=/var"
"--with-dri-driverdir=$(drivers)/lib/dri"
"--with-dri-searchpath=${libglvnd.driverLink}/lib/dri"
"--with-platforms=x11,wayland,drm"
]
++ (optional (galliumDrivers != [])
("--with-gallium-drivers=" +
builtins.concatStringsSep "," galliumDrivers))
++ (optional (driDrivers != [])
("--with-dri-drivers=" +
builtins.concatStringsSep "," driDrivers))
++ (optional (vulkanDrivers != [])
("--with-vulkan-drivers=" +
builtins.concatStringsSep "," vulkanDrivers))
++ [
"--with-platforms=${concatStringsSep "," eglPlatforms}"
"--with-gallium-drivers=${concatStringsSep "," galliumDrivers}"
"--with-dri-drivers=${concatStringsSep "," driDrivers}"
"--with-vulkan-drivers=${concatStringsSep "," vulkanDrivers}"
"--enable-texture-float"
(enableFeature stdenv.isLinux "dri3")
(enableFeature stdenv.isLinux "nine") # Direct3D in Wine
"--enable-libglvnd"
@@ -124,34 +119,38 @@ let self = stdenv.mkDerivation {
"--enable-glx"
# https://bugs.freedesktop.org/show_bug.cgi?id=35268
(enableFeature (!stdenv.hostPlatform.isMusl) "glx-tls")
"--enable-gallium-osmesa" # used by wine
# used by wine
(enableFeature (elem "swrast" galliumDrivers) "gallium-osmesa")
"--enable-llvm"
"--enable-egl"
"--enable-xa" # used in vmware driver
"--enable-gbm"
(enableFeature stdenv.isLinux "egl")
(enableFeature stdenv.isLinux "xa") # used in vmware driver
(enableFeature stdenv.isLinux "gbm")
"--enable-xvmc"
"--enable-vdpau"
"--enable-shared-glapi"
"--enable-llvm-shared-libs"
"--enable-omx-bellagio"
"--enable-va"
(enableFeature stdenv.isLinux "omx-bellagio")
(enableFeature stdenv.isLinux "va")
"--disable-opencl"
];
nativeBuildInputs = [ autoreconfHook intltool pkgconfig file ];
nativeBuildInputs = [
autoreconfHook intltool pkgconfig file
python2 python2Packages.Mako
];
propagatedBuildInputs = with xorg;
[ libXdamage libXxf86vm ]
++ optional stdenv.isLinux libdrm;
propagatedBuildInputs = with xorg; [
libXdamage libXxf86vm
] ++ optional stdenv.isLinux libdrm
++ optionals stdenv.isDarwin [ OpenGL Xplugin ];
buildInputs = with xorg; [
expat llvmPackages.llvm libglvnd
glproto dri2proto dri3proto presentproto
libX11 libXext libxcb libXt libXfixes libxshmfence
libffi wayland wayland-protocols libvdpau libelf libXvMC
libomxil-bellagio libva-minimal libpthreadstubs openssl/*or another sha1 provider*/
valgrind-light python2 python2.pkgs.Mako
];
expat llvmPackages.llvm libglvnd xorgproto
libX11 libXext libxcb libXt libXfixes libxshmfence libXrandr
libffi libvdpau libelf libXvMC
libpthreadstubs openssl /*or another sha1 provider*/
] ++ lib.optionals (elem "wayland" eglPlatforms) [ wayland wayland-protocols ]
++ lib.optionals stdenv.isLinux [ valgrind-light libomxil-bellagio libva-minimal ];
enableParallelBuilding = true;
doCheck = false;
@@ -164,6 +163,9 @@ let self = stdenv.mkDerivation {
# TODO: probably not all .la files are completely fixed, but it shouldn't matter;
postInstall = ''
# Some installs don't have any drivers so this directory is never created.
mkdir -p $drivers
'' + optionalString (galliumDrivers != []) ''
# move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
mv -t "$drivers/lib/" \
$out/lib/libXvMC* \
@@ -217,7 +219,7 @@ let self = stdenv.mkDerivation {
# TODO:
# check $out doesn't depend on llvm: builder failures are ignored
# for some reason grep -qv '${llvmPackages.llvm}' -R "$out";
postFixup = ''
postFixup = optionalString (galliumDrivers != []) ''
# add RPATH so the drivers can find the moved libgallium and libdricore9
# moved here to avoid problems with stripping patchelfed files
for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
@@ -237,7 +239,9 @@ let self = stdenv.mkDerivation {
# Use stub libraries from libglvnd and headers from Mesa.
buildCommand = ''
ln -s ${libglvnd.out} $out
mkdir -p $out/nix-support
ln -s ${libglvnd.out}/lib $out/lib
mkdir -p $dev/{,lib/pkgconfig,nix-support}
echo "$out" > $dev/nix-support/propagated-build-inputs
ln -s ${self.dev}/include $dev/include
@@ -259,6 +263,8 @@ let self = stdenv.mkDerivation {
genPkgConfig egl EGL
genPkgConfig glesv1_cm GLESv1_CM
genPkgConfig glesv2 GLESv2
'' + lib.optionalString stdenv.isDarwin ''
echo ${OpenGL} > $out/nix-support/propagated-build-inputs
'';
};
};
@@ -267,7 +273,7 @@ let self = stdenv.mkDerivation {
description = "An open source implementation of OpenGL";
homepage = https://www.mesa3d.org/;
license = licenses.mit; # X11 variant, in most files
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ vcunat ];
};
};

View File

@@ -1,4 +1,4 @@
From 9c9df280b318c26aece9873cf77b32e4f95634c1 Mon Sep 17 00:00:00 2001
From 2a1e32b4105fe95413a615a44d40938920ea1a19 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Mon, 6 Aug 2018 15:52:11 -0300
Subject: [PATCH] disk_cache: include dri driver path in cache key
@@ -11,10 +11,10 @@ timestamps in /nix/store are zero.
2 files changed, 6 insertions(+)
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 07bf052175..aea09f60b3 100644
index bafb57439a..a22e2e41eb 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -30,6 +30,9 @@ noinst_LTLIBRARIES = \
@@ -35,6 +35,9 @@ noinst_LTLIBRARIES = \
libmesautil.la \
libxmlconfig.la
@@ -25,28 +25,28 @@ index 07bf052175..aea09f60b3 100644
$(PTHREAD_CFLAGS) \
-I$(top_srcdir)/include
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 4a762eff20..8086c0be75 100644
index 368ec41792..071220b2ba 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -388,8 +388,10 @@ disk_cache_create(const char *gpu_name, const char *timestamp,
@@ -388,8 +388,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
/* Create driver id keys */
size_t ts_size = strlen(timestamp) + 1;
size_t id_size = strlen(driver_id) + 1;
+ size_t key_size = strlen(DISK_CACHE_KEY) + 1;
size_t gpu_name_size = strlen(gpu_name) + 1;
cache->driver_keys_blob_size += ts_size;
cache->driver_keys_blob_size += id_size;
+ cache->driver_keys_blob_size += key_size;
cache->driver_keys_blob_size += gpu_name_size;
/* We sometimes store entire structs that contains a pointers in the cache,
@@ -410,6 +412,7 @@ disk_cache_create(const char *gpu_name, const char *timestamp,
@@ -410,6 +412,7 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
uint8_t *drv_key_blob = cache->driver_keys_blob;
DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size)
DRV_KEY_CPY(drv_key_blob, timestamp, ts_size)
DRV_KEY_CPY(drv_key_blob, driver_id, id_size)
+ DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size)
DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size)
DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size)
DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size)
--
2.18.0
2.19.1

View File

@@ -32,16 +32,6 @@
#include <unistd.h>
#include <fcntl.h>
#else
--- ./src/mesa/drivers/dri/i965/brw_bufmgr.h
+++ ./src/mesa/drivers/dri/i965/brw_bufmgr.h
@@ -37,6 +37,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
+#include <time.h>
#include "util/u_atomic.h"
#include "util/list.h"
--- ./src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
+++ ./src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
@@ -28,6 +28,8 @@