about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/ati-drivers
diff options
context:
space:
mode:
authorMatt McHenry <github@matt.mchenryfamily.org>2016-11-28 13:56:50 -0500
committerFranz Pletz <fpletz@fnordicwalking.de>2016-11-28 19:56:50 +0100
commitf0bdca82c0ce446c827f9f4b10381e558f0a9c31 (patch)
tree6b18d59ac3b39a4fd0bb536baae5c8f5884c6769 /pkgs/os-specific/linux/ati-drivers
parent5d804566dfecaa3928893244399b86453edcacb3 (diff)
downloadnixlib-f0bdca82c0ce446c827f9f4b10381e558f0a9c31.tar
nixlib-f0bdca82c0ce446c827f9f4b10381e558f0a9c31.tar.gz
nixlib-f0bdca82c0ce446c827f9f4b10381e558f0a9c31.tar.bz2
nixlib-f0bdca82c0ce446c827f9f4b10381e558f0a9c31.tar.lz
nixlib-f0bdca82c0ce446c827f9f4b10381e558f0a9c31.tar.xz
nixlib-f0bdca82c0ce446c827f9f4b10381e558f0a9c31.tar.zst
nixlib-f0bdca82c0ce446c827f9f4b10381e558f0a9c31.zip
linuxPackages.ati_drivers_x11: patch for kernel 4.7+ (#19810)
Diffstat (limited to 'pkgs/os-specific/linux/ati-drivers')
-rw-r--r--pkgs/os-specific/linux/ati-drivers/default.nix11
-rw-r--r--pkgs/os-specific/linux/ati-drivers/patches/4.7-arch-cpu_has_pge-v2.patch70
2 files changed, 77 insertions, 4 deletions
diff --git a/pkgs/os-specific/linux/ati-drivers/default.nix b/pkgs/os-specific/linux/ati-drivers/default.nix
index 3bfd59de7ed6..395850384d1e 100644
--- a/pkgs/os-specific/linux/ati-drivers/default.nix
+++ b/pkgs/os-specific/linux/ati-drivers/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, kernel ? null, which
+{ stdenv, lib, fetchurl, kernel ? null, which
 , xorg, makeWrapper, glibc, patchelf, unzip
 , fontconfig, freetype, mesa # for fgl_glxgears
 , # Whether to build the libraries only (i.e. not the kernel module or
@@ -75,9 +75,12 @@ stdenv.mkDerivation rec {
     ./patches/15.9-preempt.patch
     ./patches/15.9-sep_printf.patch ]
   ++ optionals ( kernel != null &&
-                 (builtins.compareVersions kernel.version "4.6") >= 0 )
+                 (lib.versionAtLeast kernel.version "4.6") )
                [ ./patches/kernel-4.6-get_user_pages.patch
-                 ./patches/kernel-4.6-page_cache_release-put_page.patch ];
+                 ./patches/kernel-4.6-page_cache_release-put_page.patch ]
+  ++ optionals ( kernel != null &&
+                 (lib.versionAtLeast kernel.version "4.7") )
+               [ ./patches/4.7-arch-cpu_has_pge-v2.patch ];
 
   buildInputs =
     [ xorg.libXrender xorg.libXext xorg.libX11 xorg.libXinerama xorg.libSM
@@ -124,7 +127,7 @@ stdenv.mkDerivation rec {
     description = "ATI Catalyst display drivers";
     homepage = http://support.amd.com/us/gpudownload/Pages/index.aspx;
     license = licenses.unfree;
-    maintainers = with maintainers; [ marcweber offline jgeerds ];
+    maintainers = with maintainers; [ marcweber offline jgeerds jerith666 ];
     platforms = platforms.linux;
     hydraPlatforms = [];
     # Copied from the nvidia default.nix to prevent a store collision.
diff --git a/pkgs/os-specific/linux/ati-drivers/patches/4.7-arch-cpu_has_pge-v2.patch b/pkgs/os-specific/linux/ati-drivers/patches/4.7-arch-cpu_has_pge-v2.patch
new file mode 100644
index 000000000000..cb86f5aff276
--- /dev/null
+++ b/pkgs/os-specific/linux/ati-drivers/patches/4.7-arch-cpu_has_pge-v2.patch
@@ -0,0 +1,70 @@
+diff -uNr 16.8/common/lib/modules/fglrx/build_mod/firegl_public.c 16.8b/common/lib/modules/fglrx/build_mod/firegl_public.c
+--- 16.8/common/lib/modules/fglrx/build_mod/firegl_public.c	2015-12-18 19:47:41.000000000 +0100
++++ 16.8b/common/lib/modules/fglrx/build_mod/firegl_public.c	2016-08-15 15:09:37.228538907 +0200
+@@ -4518,7 +4518,11 @@
+     write_cr0(cr0);
+     wbinvd();
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
++    if (boot_cpu_has(X86_FEATURE_PGE))
++#else
+     if (cpu_has_pge)
++#endif
+     {
+         cr4 = READ_CR4();
+         WRITE_CR4(cr4 & ~X86_CR4_PGE);
+@@ -4532,7 +4536,11 @@
+     wbinvd();
+     __flush_tlb();
+     write_cr0(cr0 & 0xbfffffff);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
++    if (boot_cpu_has(X86_FEATURE_PGE))
++#else
+     if (cpu_has_pge)
++#endif
+     {
+         WRITE_CR4(cr4);
+     }
+@@ -4559,7 +4567,11 @@
+     write_cr0(cr0);
+     wbinvd();
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
++    if (boot_cpu_has(X86_FEATURE_PGE))
++#else
+     if (cpu_has_pge)
++#endif
+     {
+         cr4 = READ_CR4();
+         WRITE_CR4(cr4 & ~X86_CR4_PGE);
+@@ -4572,7 +4584,11 @@
+     wbinvd();
+     __flush_tlb();
+     write_cr0(cr0 & 0xbfffffff);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
++    if (boot_cpu_has(X86_FEATURE_PGE))
++#else
+     if (cpu_has_pge)
++#endif
+     {
+         WRITE_CR4(cr4);
+     }
+diff -uNr 16.8/common/lib/modules/fglrx/build_mod/firegl_public.h 16.8b/common/lib/modules/fglrx/build_mod/firegl_public.h
+--- 16.8/common/lib/modules/fglrx/build_mod/firegl_public.h	2015-12-18 19:47:41.000000000 +0100
++++ 16.8b/common/lib/modules/fglrx/build_mod/firegl_public.h	2016-08-15 15:09:05.815141238 +0200
+@@ -650,9 +650,15 @@
+ #define cpu_has_pat  test_bit(X86_FEATURE_PAT, (void *) &boot_cpu_data.x86_capability)
+ #endif
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
++#ifndef boot_cpu_has(X86_FEATURE_PGE)
++#define boot_cpu_has(X86_FEATURE_PGE) test_bit(X86_FEATURE_PGE, &boot_cpu_data.x86_capability)
++#endif
++#else
+ #ifndef cpu_has_pge
+ #define cpu_has_pge test_bit(X86_FEATURE_PGE, &boot_cpu_data.x86_capability)
+ #endif
++#endif
+ 
+ /* 2.6.29 defines pgprot_writecombine as a macro which resolves to a
+  * GPL-only function with the same name. So we always use our own