diff options
author | Tony Vroon <chainsaw@gentoo.org> | 2008-05-07 16:33:41 +0000 |
---|---|---|
committer | Tony Vroon <chainsaw@gentoo.org> | 2008-05-07 16:33:41 +0000 |
commit | f1de99b0014e4190dee35a873afe2ceadbf0053d (patch) | |
tree | 5dd0558738097083e71f994b11f3c70b23dd8817 /x11-drivers | |
parent | calling php-ext-source-r1_src_unpack explicitly, bug 220519 (diff) | |
download | gentoo-2-f1de99b0014e4190dee35a873afe2ceadbf0053d.tar.gz gentoo-2-f1de99b0014e4190dee35a873afe2ceadbf0053d.tar.bz2 gentoo-2-f1de99b0014e4190dee35a873afe2ceadbf0053d.zip |
Masked beta driver 173.08 with upstream patch from Zander ( http://www.nvnews.net/vbulletin/showpost.php?p=1648357&postcount=35 ) for >=2.6.26-rc1 compatibility. Dropped keywords as this has only been tested on 2.6.26-rc1-00166-gc0a1811 SMP x86_64 so far. Now installs module control file in modprobe.d where it belongs. Upstream advises to use PAT over MTRR. Some reports of low performance and 2D corruption, tread carefully. Quoted variables for greater repoman happiness.
(Portage version: 2.1.5_rc7)
Diffstat (limited to 'x11-drivers')
11 files changed, 1164 insertions, 47 deletions
diff --git a/x11-drivers/nvidia-drivers/ChangeLog b/x11-drivers/nvidia-drivers/ChangeLog index 821879113ba3..0df7ed013677 100644 --- a/x11-drivers/nvidia-drivers/ChangeLog +++ b/x11-drivers/nvidia-drivers/ChangeLog @@ -1,6 +1,26 @@ # ChangeLog for x11-drivers/nvidia-drivers # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/ChangeLog,v 1.93 2008/04/18 19:54:04 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/ChangeLog,v 1.94 2008/05/07 16:33:40 chainsaw Exp $ + + 07 May 2008; <chainsaw@gentoo.org> + +files/NVIDIA_kernel-173.08-2404825.diff, nvidia-drivers-71.86.01.ebuild, + nvidia-drivers-71.86.04.ebuild, nvidia-drivers-96.43.01.ebuild, + nvidia-drivers-96.43.05.ebuild, nvidia-drivers-100.14.09.ebuild, + nvidia-drivers-100.14.11.ebuild, nvidia-drivers-100.14.19.ebuild, + nvidia-drivers-100.14.23.ebuild, +nvidia-drivers-173.08.ebuild: + Quote variables where appropriate. + +*nvidia-drivers-173.08 (07 May 2008) + + 07 May 2008; <chainsaw@gentoo.org> + +files/NVIDIA_kernel-173.08-2404825.diff, +nvidia-drivers-173.08.ebuild: + Masked beta driver 173.08 with upstream patch from Zander ( + http://www.nvnews.net/vbulletin/showpost.php?p=1648357&postcount=35 ) for + >=2.6.26-rc1 compatibility. Dropped keywords as this has only been tested + on 2.6.26-rc1-00166-gc0a1811 SMP x86_64 so far. Now installs module + control file in modprobe.d where it belongs. Upstream advises to use PAT + over MTRR. Some reports of low performance and 2D corruption, tread + carefully. 18 Apr 2008; Mike Frysinger <vapier@gentoo.org> +files/NVIDIA_kernel-96.43.05-2290218.diff, diff --git a/x11-drivers/nvidia-drivers/files/NVIDIA_kernel-173.08-2404825.diff b/x11-drivers/nvidia-drivers/files/NVIDIA_kernel-173.08-2404825.diff new file mode 100644 index 000000000000..75726c58d4d5 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/NVIDIA_kernel-173.08-2404825.diff @@ -0,0 +1,586 @@ +diff -ru usr/src/nv/nv-linux.h usr/src/nv.2404825/nv-linux.h +--- usr/src/nv/nv-linux.h 2008-04-02 01:17:56.000000000 -0700 ++++ usr/src/nv.2404825/nv-linux.h 2008-05-06 16:22:16.603101044 -0700 +@@ -145,16 +145,19 @@ + #endif + + #if (defined(NVCPU_X86) || defined(NVCPU_X86_64)) && !defined(CONFIG_XEN) +-#define NV_BUILD_NV_PAT_SUPPORT 1 ++#define NV_ENABLE_PAT_SUPPORT + #endif + +-#if defined(NV_BUILD_NV_PAT_SUPPORT) +-#include "pat.h" ++#define NV_PAT_MODE_DISABLED 0 ++#define NV_PAT_MODE_KERNEL 1 ++#define NV_PAT_MODE_BUILTIN 2 ++ ++extern int nv_pat_mode; ++ + #if defined(CONFIG_HOTPLUG_CPU) + #include <linux/cpu.h> /* CPU hotplug support */ + #include <linux/notifier.h> /* struct notifier_block, etc */ + #endif +-#endif + + #if (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) + #include <linux/i2c.h> +@@ -681,6 +684,13 @@ + #define nv_down(lock) down(&lock) + #define nv_up(lock) up(&lock) + ++#define NV_INIT_MUTEX(mutex) \ ++ { \ ++ struct semaphore __mutex = \ ++ __SEMAPHORE_INITIALIZER(*(mutex), 1); \ ++ *(mutex) = __mutex; \ ++ } ++ + #if defined (KERNEL_2_4) + # define NV_IS_SUSER() suser() + # define NV_PCI_DEVICE_NAME(dev) ((dev)->name) +@@ -1029,20 +1039,6 @@ + return new_prot; + } + #endif +- +-#if defined(NV_BUILD_NV_PAT_SUPPORT) && !defined (pgprot_writecombined) +-static inline pgprot_t pgprot_writecombined(pgprot_t old_prot) +- { +- pgprot_t new_prot = old_prot; +- if (boot_cpu_data.x86 > 3) +- { +- pgprot_val(old_prot) &= ~(_PAGE_PCD | _PAGE_PWT); +- new_prot = __pgprot(pgprot_val(old_prot) | _PAGE_WRTCOMB); +- } +- return new_prot; +- } +-#endif +- + #endif /* defined(NVCPU_X86) || defined(NVCPU_X86_64) */ + + #if defined(KERNEL_2_4) && defined(NVCPU_X86) && !defined(pfn_to_page) +@@ -1142,8 +1138,6 @@ + struct semaphore at_lock; + } nv_linux_state_t; + +-extern int nv_pat_enabled; +- + #if defined(NV_LINUX_ACPI_EVENTS_SUPPORTED) + /* + * acpi data storage structure +diff -ru usr/src/nv/nv-reg.h usr/src/nv.2404825/nv-reg.h +--- usr/src/nv/nv-reg.h 2008-04-02 01:17:56.000000000 -0700 ++++ usr/src/nv.2404825/nv-reg.h 2008-05-06 16:22:16.603101044 -0700 +@@ -471,6 +471,37 @@ + #define __NV_RM_EDGE_INTR_CHECK RMEdgeIntrCheck + #define NV_REG_RM_EDGE_INTR_CHECK NV_REG_STRING(__NV_RM_EDGE_INTR_CHECK) + ++/* ++ * Option: UsePageAttributeTable ++ * ++ * Description: ++ * ++ * Enable/disable use of the page attribute table (PAT) available in ++ * modern x86/x86-64 processors to set the effective memory type of memory ++ * mappings to write-combining (WC). If disabled, the driver will fall ++ * back to using MTRRs, if possible. ++ * ++ * If enabled, an x86 processor with PAT support is present and the host ++ * system's Linux kernel did not configure one of the PAT entries to ++ * indicate the WC memory type, the driver will change the second entry in ++ * the PAT from its default (write-through (WT)) to WC at module load ++ * time. If the kernel did update one of the PAT entries, the driver will ++ * not modify the PAT. ++ * ++ * In both cases, the driver will honor attempts to map memory with the WC ++ * memory type by selecting the appropriate PAT entry using the correct ++ * set of PTE flags. ++ * ++ * Possible values: ++ * ++ * ~0 = use the NVIDIA driver's default logic (default) ++ * 1 = enable use of the PAT for WC mappings. ++ * 0 = disable use of the PAT for WC mappings. ++ */ ++ ++#define __NV_USE_PAGE_ATTRIBUTE_TABLE UsePageAttributeTable ++#define NV_USE_PAGE_ATTRIBUTE_TABLE NV_REG_STRING(__NV_USE_PAGE_ATTRIBUTE_TABLE) ++ + + + #if defined(NV_DEFINE_REGISTRY_KEY_TABLE) +@@ -495,6 +526,7 @@ + NV_DEFINE_REG_ENTRY(__NV_UPDATE_MEMORY_TYPES, ~0); + NV_DEFINE_REG_ENTRY(__NV_USE_VBIOS, 1); + NV_DEFINE_REG_ENTRY(__NV_RM_EDGE_INTR_CHECK, 1); ++NV_DEFINE_REG_ENTRY(__NV_USE_PAGE_ATTRIBUTE_TABLE, ~0); + + #if defined(NV_LINUX) + NV_DEFINE_REG_STRING_ENTRY(__NV_REGISTRY_DWORDS, NULL); +@@ -540,6 +572,7 @@ + NV_DEFINE_PARAMS_TABLE_ENTRY(__NV_UPDATE_MEMORY_TYPES), + NV_DEFINE_PARAMS_TABLE_ENTRY(__NV_USE_VBIOS), + NV_DEFINE_PARAMS_TABLE_ENTRY(__NV_RM_EDGE_INTR_CHECK), ++ NV_DEFINE_PARAMS_TABLE_ENTRY(__NV_USE_PAGE_ATTRIBUTE_TABLE), + {NULL, NULL, NULL} + }; + +diff -ru usr/src/nv/nv.c usr/src/nv.2404825/nv.c +--- usr/src/nv/nv.c 2008-04-02 01:17:56.000000000 -0700 ++++ usr/src/nv.2404825/nv.c 2008-05-06 16:22:16.603101044 -0700 +@@ -22,10 +22,9 @@ + #endif + + #if defined(KERNEL_2_4) && (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) +-// weak linking? + extern int i2c_add_adapter (struct i2c_adapter *) __attribute__ ((weak)); + extern int i2c_del_adapter (struct i2c_adapter *) __attribute__ ((weak)); +-#endif // defined(KERNEL_2_4) && (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) ++#endif + + /* + * our global state; one per device +@@ -41,14 +40,7 @@ + static struct pm_dev *apm_nv_dev[NV_MAX_DEVICES] = { 0 }; + #endif + +-int nv_pat_enabled = 0; +- +-#if !defined(NV_BUILD_NV_PAT_SUPPORT) +-static int nv_disable_pat = 1; +-#else +-static int nv_disable_pat = 0; +-NV_MODULE_PARAMETER(nv_disable_pat); +-#endif ++int nv_pat_mode = NV_PAT_MODE_DISABLED; + + #if defined(NVCPU_X86) || defined(NVCPU_X86_64) + NvU64 __nv_supported_pte_mask = ~_PAGE_NX; +@@ -611,7 +603,7 @@ + nv_state_t *nv; + nv_linux_state_t *nvl; + +- proc_nvidia = create_proc_entry("nvidia", d_flags, proc_root_driver); ++ proc_nvidia = create_proc_entry("driver/nvidia", d_flags, NULL); + if (!proc_nvidia) + goto failed; + +@@ -863,18 +855,20 @@ + static int __nv_enable_pat_support (void); + static void __nv_disable_pat_support (void); + +-#if defined(NV_BUILD_NV_PAT_SUPPORT) ++#if defined(NV_ENABLE_PAT_SUPPORT) + /* +- * Private PAT support for use by the NVIDIA driver. This is an +- * interim solution until the kernel offers PAT support. ++ * Private PAT support for use by the NVIDIA driver. This is used on ++ * kernels that do not modify the PAT to include a write-combining ++ * entry. + */ + static int __check_pat_support (void); + static void __nv_setup_pat_entries (void *); + static void __nv_restore_pat_entries (void *); + +-#define NV_READ_PAT_ENTRIES(pat1, pat2) rdmsr(IA32_CR_PAT, (pat1), (pat2)) +-#define NV_WRITE_PAT_ENTRIES(pat1, pat2) wrmsr(IA32_CR_PAT, (pat1), (pat2)) +-#define NV_PAT_ENTRY(pat, index) (((pat) & (0xff<<((index)*8)))>>((index)*8)) ++#define NV_READ_PAT_ENTRIES(pat1, pat2) rdmsr(0x277, (pat1), (pat2)) ++#define NV_WRITE_PAT_ENTRIES(pat1, pat2) wrmsr(0x277, (pat1), (pat2)) ++#define NV_PAT_ENTRY(pat, index) \ ++ (((pat) & (0xff << ((index)*8))) >> ((index)*8)) + + static inline void __nv_disable_caches(unsigned long *cr4) + { +@@ -898,8 +892,10 @@ + static int __check_pat_support() + { + unsigned int pat1, pat2, i; ++ U008 PAT_WC_index; + +- if (!test_bit(X86_FEATURE_PAT, (volatile unsigned long *)&boot_cpu_data.x86_capability)) ++ if (!test_bit(X86_FEATURE_PAT, ++ (volatile unsigned long *)&boot_cpu_data.x86_capability)) + { + nv_printf(NV_DBG_ERRORS, + "NVRM: CPU does not support the PAT, falling back to MTRRs.\n"); +@@ -907,24 +903,30 @@ + } + + NV_READ_PAT_ENTRIES(pat1, pat2); ++ PAT_WC_index = 0xf; + + for (i = 0; i < 4; i++) + { +- // we plan to mark PAT entry 1 as WC. if it's already marked such, +- // that's fine, since it would be no different than us setting it. +- if ((i != 1) && NV_PAT_ENTRY(pat1, i) == 1) +- { +- nv_printf(NV_DBG_ERRORS, "NVRM: PAT index %d already configured for Write-Combining!\n", i); +- nv_printf(NV_DBG_ERRORS, "NVRM: Aborting, due to PAT already being configured\n"); +- return 0; +- } +- +- if (NV_PAT_ENTRY(pat2, i) == 1) +- { +- nv_printf(NV_DBG_ERRORS, "NVRM: PAT index %d already configured for Write-Combining!\n", i + 4); +- nv_printf(NV_DBG_ERRORS, "NVRM: Aborting, due to PAT already being configured\n"); +- return 0; +- } ++ if (NV_PAT_ENTRY(pat1, i) == 0x01) ++ { ++ PAT_WC_index = i; ++ break; ++ } ++ ++ if (NV_PAT_ENTRY(pat2, i) == 0x01) ++ { ++ PAT_WC_index = (i + 4); ++ break; ++ } ++ } ++ ++ if (PAT_WC_index == 1) ++ nv_pat_mode = NV_PAT_MODE_KERNEL; ++ else if (PAT_WC_index != 0xf) ++ { ++ nv_printf(NV_DBG_ERRORS, ++ "NVRM: PAT configuration unsupported, falling back to MTRRs.\n"); ++ return 0; + } + + return 1; +@@ -978,20 +980,22 @@ + __nv_enable_caches(cr4); + NV_RESTORE_FLAGS(eflags); + } +- +-#endif /* defined(NV_BUILD_NV_PAT_SUPPORT) */ ++#endif + + static int __nv_enable_pat_support() + { +-#if defined(NV_BUILD_NV_PAT_SUPPORT) ++#if defined(NV_ENABLE_PAT_SUPPORT) + unsigned long pat1, pat2; + +- if (nv_pat_enabled) ++ if (nv_pat_mode != NV_PAT_MODE_DISABLED) + return 1; + + if (!__check_pat_support()) + return 0; + ++ if (nv_pat_mode != NV_PAT_MODE_DISABLED) ++ return 1; ++ + NV_READ_PAT_ENTRIES(orig_pat1, orig_pat2); + nv_printf(NV_DBG_SETUP, "saved orig pats as 0x%lx 0x%lx\n", orig_pat1, orig_pat2); + +@@ -1001,31 +1005,30 @@ + return 0; + } + +- nv_pat_enabled = 1; ++ nv_pat_mode = NV_PAT_MODE_BUILTIN; + + NV_READ_PAT_ENTRIES(pat1, pat2); + nv_printf(NV_DBG_SETUP, "changed pats to 0x%lx 0x%lx\n", pat1, pat2); +-#endif /* defined(NV_BUILD_NV_PAT_SUPPORT) */ +- ++#endif + return 1; + } + + static void __nv_disable_pat_support() + { +-#if defined(NV_BUILD_NV_PAT_SUPPORT) ++#if defined(NV_ENABLE_PAT_SUPPORT) + unsigned long pat1, pat2; + +- if (!nv_pat_enabled) ++ if (nv_pat_mode != NV_PAT_MODE_BUILTIN) + return; + + if (nv_execute_on_all_cpus(__nv_restore_pat_entries, NULL) != 0) + return; + +- nv_pat_enabled = 0; ++ nv_pat_mode = NV_PAT_MODE_DISABLED; + + NV_READ_PAT_ENTRIES(pat1, pat2); + nv_printf(NV_DBG_SETUP, "restored orig pats as 0x%lx 0x%lx\n", pat1, pat2); +-#endif /* defined(NV_BUILD_NV_PAT_SUPPORT) */ ++#endif + } + + #if defined(NV_CHANGE_PAGE_ATTR_BUG_PRESENT) +@@ -1242,7 +1245,7 @@ + break; + default: + expected = pgprot_val(PAGE_KERNEL_NOCACHE); +- if ((flags & ~_PAGE_NX) == (expected & ~_PAGE_NX)) ++ if ((flags & ~(_PAGE_NX | _PAGE_PWT)) == (expected & ~(_PAGE_NX | _PAGE_PWT))) + retval = 0; + break; + } +@@ -1273,7 +1276,7 @@ + #endif + } + +-#if defined(NV_BUILD_NV_PAT_SUPPORT) && defined(CONFIG_HOTPLUG_CPU) ++#if defined(NV_ENABLE_PAT_SUPPORT) && defined(CONFIG_HOTPLUG_CPU) + static int + nv_kern_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) + { +@@ -1305,8 +1308,7 @@ + .notifier_call = nv_kern_cpu_callback, + .priority = 0 + }; +- +-#endif /* defined(NV_BUILD_NV_PAT_SUPPORT) && defined(CONFIG_HOTPLUG_CPU) */ ++#endif + + + /*** +@@ -1315,7 +1317,7 @@ + + static int __init nvidia_init_module(void) + { +- int rc; ++ int rc, disable_pat = 0; + U032 i, count, data; + nv_state_t *nv = NV_STATE_PTR(&nv_ctl_device); + nv_stack_t *sp = NULL; +@@ -1443,18 +1445,6 @@ + nv_printf(NV_DBG_ERRORS, "NVRM: pte cache allocation failed\n"); + goto failed; + } +- +-#if defined(NV_BUILD_NV_PAT_SUPPORT) && defined(CONFIG_HOTPLUG_CPU) +- if (!nv_disable_pat) +- { +- if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0) +- { +- rc = -EIO; +- nv_printf(NV_DBG_ERRORS, "NVRM: CPU hotplug notifier registration failed!\n"); +- goto failed; +- } +- } +-#endif + + #if defined(NV_SG_MAP_BUFFERS) + rm_read_registry_dword(sp, nv, "NVreg", "RemapLimit", &nv_remap_limit); +@@ -1532,8 +1522,30 @@ + + nvos_proc_add_warning_file("README", __README_warning); + +- if (!nv_disable_pat) ++ rc = rm_read_registry_dword(sp, nv, ++ "NVreg", NV_USE_PAGE_ATTRIBUTE_TABLE, &data); ++ if ((rc == 0) && ((int)data != ~0)) ++ { ++ disable_pat = (data == 0); ++ } ++ ++ if (!disable_pat) ++ { + __nv_enable_pat_support(); ++#if defined(NV_ENABLE_PAT_SUPPORT) && defined(CONFIG_HOTPLUG_CPU) ++ if (nv_pat_mode == NV_PAT_MODE_BUILTIN) ++ { ++ if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0)) ++ { ++ __nv_disable_pat_support(); ++ rc = -EIO; ++ nv_printf(NV_DBG_ERRORS, ++ "NVRM: CPU hotplug notifier registration failed!\n"); ++ goto failed; ++ } ++ } ++#endif ++ } + else + { + nv_printf(NV_DBG_ERRORS, +@@ -1686,10 +1698,10 @@ + rm_unregister_compatible_ioctls(sp); + #endif + +- if (nv_pat_enabled) ++ if (nv_pat_mode == NV_PAT_MODE_BUILTIN) + { + __nv_disable_pat_support(); +-#if defined(NV_BUILD_NV_PAT_SUPPORT) && defined(CONFIG_HOTPLUG_CPU) ++#if defined(NV_ENABLE_PAT_SUPPORT) && defined(CONFIG_HOTPLUG_CPU) + unregister_hotcpu_notifier(&nv_hotcpu_nfb); + #endif + } +@@ -1825,6 +1837,8 @@ + } + } + ++#if !defined(NV_VM_INSERT_PAGE_PRESENT) ++static + struct page *nv_kern_vma_nopage( + struct vm_area_struct *vma, + unsigned long address, +@@ -1835,22 +1849,21 @@ + #endif + ) + { +-#if !defined(NV_VM_INSERT_PAGE_PRESENT) + struct page *page; + + page = pfn_to_page(vma->vm_pgoff); + get_page(page); + + return page; +-#else +- return NOPAGE_SIGBUS; +-#endif + } ++#endif + + struct vm_operations_struct nv_vm_ops = { + .open = nv_kern_vma_open, + .close = nv_kern_vma_release, /* "close" */ ++#if !defined(NV_VM_INSERT_PAGE_PRESENT) + .nopage = nv_kern_vma_nopage, ++#endif + }; + + static nv_file_private_t * +@@ -1864,7 +1877,7 @@ + + memset(nvfp, 0, sizeof(nv_file_private_t)); + +- sema_init(&nvfp->sp_lock, 1); ++ NV_INIT_MUTEX(&nvfp->sp_lock); + + // initialize this file's event queue + init_waitqueue_head(&nvfp->waitqueue); +@@ -2214,11 +2227,12 @@ + break; + #if defined(NVCPU_X86) || defined(NVCPU_X86_64) + case NV_MEMORY_WRITECOMBINED: +-#if defined(NV_BUILD_NV_PAT_SUPPORT) +- if (nv_pat_enabled && +- (memory_type != NV_MEMORY_TYPE_REGISTERS)) ++#if defined(NV_ENABLE_PAT_SUPPORT) ++ if ((nv_pat_mode != NV_PAT_MODE_DISABLED) && ++ (memory_type != NV_MEMORY_TYPE_REGISTERS)) + { +- *prot = pgprot_writecombined(*prot); ++ pgprot_val(*prot) &= ~(_PAGE_PSE | _PAGE_PCD | _PAGE_PWT); ++ *prot = __pgprot(pgprot_val(*prot) | _PAGE_PWT); + break; + } + #endif +@@ -2242,7 +2256,6 @@ + return 1; + #endif + case NV_MEMORY_CACHED: +- //case NV_MEMORY_WRITEBACK: + #if !defined(NVCPU_X86) && !defined(NVCPU_X86_64) + if (memory_type != NV_MEMORY_TYPE_REGISTERS) + break; +@@ -2264,8 +2277,6 @@ + if (memory_type == NV_MEMORY_TYPE_SYSTEM) + break; + #endif +- //case NV_MEMORY_WRITETHRU: +- //case NV_MEMORY_WRITEPROTECT: + default: + if(nv_ext_encode_caching(prot, cache_type, memory_type) == 0) + return 0; +@@ -3501,6 +3512,10 @@ + BOOL kern + ) + { ++#if defined(NV_SET_PAGES_UC_PRESENT) && defined(NVCPU_X86) ++ nv_printf(NV_DBG_ERRORS, ++ "NVRM: can't translate address in nv_get_phys_address()!\n"); ++#else + struct mm_struct *mm; + pgd_t *pgd = NULL; + pmd_t *pmd = NULL; +@@ -3513,15 +3528,7 @@ + down_read(&mm->mmap_sem); + } + else +- { +-#if defined(NV_SET_PAGES_UC_PRESENT) && defined(NVCPU_X86) +- nv_printf(NV_DBG_ERRORS, +- "NVRM: can't translate KVA in nv_get_phys_address()!\n"); +- return 0; +-#else + mm = NULL; +-#endif +- } + + pgd = NV_PGD_OFFSET(address, kern, mm); + if (!NV_PGD_PRESENT(pgd)) +@@ -3549,6 +3556,7 @@ + failed: + if (!kern) + up_read(&mm->mmap_sem); ++#endif + return 0; + } + +@@ -3789,8 +3797,9 @@ + + nv_init_lock(nvl->rm_lock); + +- sema_init(&nvl->ldata_lock, 1); +- sema_init(&nvl->at_lock, 1); ++ NV_INIT_MUTEX(&nvl->ldata_lock); ++ NV_INIT_MUTEX(&nvl->at_lock); ++ + NV_ATOMIC_SET(nvl->usage_count, 0); + + nvl->rm_lock_cpu = -1; +diff -ru usr/src/nv/os-agp.c usr/src/nv.2404825/os-agp.c +--- usr/src/nv/os-agp.c 2008-04-02 01:17:56.000000000 -0700 ++++ usr/src/nv.2404825/os-agp.c 2008-05-06 16:22:16.603101044 -0700 +@@ -115,7 +115,7 @@ + goto release; + } + +- if (!nv_pat_enabled) ++ if (nv_pat_mode == NV_PAT_MODE_DISABLED) + { + #ifdef CONFIG_MTRR + /* +@@ -175,7 +175,7 @@ + + failed: + #ifdef CONFIG_MTRR +- if (!nv_pat_enabled) ++ if (nv_pat_mode == NV_PAT_MODE_DISABLED) + mtrr_del(-1, agp_info.aper_base, agp_info.aper_size << 20); + #endif + release: +@@ -205,7 +205,7 @@ + nvl = NV_GET_NVL_FROM_NV_STATE(nv); + + #ifdef CONFIG_MTRR +- if (!nv_pat_enabled) ++ if (nv_pat_mode == NV_PAT_MODE_DISABLED) + mtrr_del(-1, nv->agp.address, nv->agp.size); + #endif + +diff -ru usr/src/nv/os-interface.c usr/src/nv.2404825/os-interface.c +--- usr/src/nv/os-interface.c 2008-04-02 01:17:56.000000000 -0700 ++++ usr/src/nv.2404825/os-interface.c 2008-05-06 16:22:16.607101272 -0700 +@@ -1355,7 +1355,7 @@ + + BOOL NV_API_CALL os_pat_supported(void) + { +- return nv_pat_enabled; ++ return (nv_pat_mode != NV_PAT_MODE_DISABLED); + } + + void NV_API_CALL os_dump_stack() diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.09.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.09.ebuild index 6c6600a01ad8..660b04b1a245 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.09.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.09.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.09.ebuild,v 1.11 2007/10/07 15:38:58 cardoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.09.ebuild,v 1.12 2008/05/07 16:33:40 chainsaw Exp $ inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver @@ -169,7 +169,7 @@ src_unpack() { if ! use x86-fbsd; then cd "${WORKDIR}" - bash ${DISTDIR}/${NV_PACKAGE}${PKG_V}.run --extract-only + bash "${DISTDIR}/${NV_PACKAGE}${PKG_V}.run" --extract-only else unpack ${A} fi @@ -405,9 +405,9 @@ pkg_preinst() { if ! has_version x11-base/xorg-server ; then for dir in lib lib32 lib64 ; do - if [[ -d ${NV_D}/usr/${dir}/xorg ]] ; then - mv ${NV_D}/usr/${dir}/xorg/* ${NV_D}/usr/${dir} - rmdir ${NV_D}/usr/${dir}/xorg + if [[ -d "${NV_D}/usr/${dir}/xorg" ]] ; then + mv "${NV_D}/usr/${dir}"/xorg/* "${NV_D}/usr/${dir}" + rmdir "${NV_D}/usr/${dir}/xorg" fi done fi diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.11.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.11.ebuild index 86d5a159e505..fa5cfd966be3 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.11.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.11.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.11.ebuild,v 1.12 2007/10/07 15:38:58 cardoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.11.ebuild,v 1.13 2008/05/07 16:33:40 chainsaw Exp $ inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver @@ -169,7 +169,7 @@ src_unpack() { if ! use x86-fbsd; then cd "${WORKDIR}" - bash ${DISTDIR}/${NV_PACKAGE}${PKG_V}.run --extract-only + bash "${DISTDIR}/${NV_PACKAGE}${PKG_V}.run" --extract-only else unpack ${A} fi @@ -405,9 +405,9 @@ pkg_preinst() { if ! has_version x11-base/xorg-server ; then for dir in lib lib32 lib64 ; do - if [[ -d ${NV_D}/usr/${dir}/xorg ]] ; then - mv ${NV_D}/usr/${dir}/xorg/* ${NV_D}/usr/${dir} - rmdir ${NV_D}/usr/${dir}/xorg + if [[ -d "${NV_D}/usr/${dir}/xorg" ]] ; then + mv "${NV_D}/usr/${dir}"/xorg/* "${NV_D}/usr/${dir}" + rmdir "${NV_D}/usr/${dir}/xorg" fi done fi diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.19.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.19.ebuild index 2eae00ae9cc6..ef08a21485b7 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.19.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.19.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.19.ebuild,v 1.11 2007/12/27 19:43:03 cardoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.19.ebuild,v 1.12 2008/05/07 16:33:40 chainsaw Exp $ inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver @@ -169,7 +169,7 @@ src_unpack() { if ! use x86-fbsd; then cd "${WORKDIR}" - bash ${DISTDIR}/${NV_PACKAGE}${PKG_V}.run --extract-only + bash "${DISTDIR}/${NV_PACKAGE}${PKG_V}.run" --extract-only else unpack ${A} fi @@ -411,9 +411,9 @@ pkg_preinst() { if ! has_version x11-base/xorg-server ; then for dir in lib lib32 lib64 ; do - if [[ -d ${NV_D}/usr/${dir}/xorg ]] ; then - mv ${NV_D}/usr/${dir}/xorg/* ${NV_D}/usr/${dir} - rmdir ${NV_D}/usr/${dir}/xorg + if [[ -d "${NV_D}/usr/${dir}/xorg" ]] ; then + mv "${NV_D}/usr/${dir}"/xorg/* "${NV_D}/usr/${dir}" + rmdir "${NV_D}/usr/${dir}/xorg" fi done fi diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.23.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.23.ebuild index 8ff2dc542398..c107fda8cbd4 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.23.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.23.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.23.ebuild,v 1.3 2007/12/26 19:47:24 cardoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-100.14.23.ebuild,v 1.4 2008/05/07 16:33:40 chainsaw Exp $ inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver @@ -169,7 +169,7 @@ src_unpack() { if ! use x86-fbsd; then cd "${WORKDIR}" - bash ${DISTDIR}/${NV_PACKAGE}${PKG_V}.run --extract-only + bash "${DISTDIR}/${NV_PACKAGE}${PKG_V}.run" --extract-only else unpack ${A} fi @@ -411,9 +411,9 @@ pkg_preinst() { if ! has_version x11-base/xorg-server ; then for dir in lib lib32 lib64 ; do - if [[ -d ${NV_D}/usr/${dir}/xorg ]] ; then - mv ${NV_D}/usr/${dir}/xorg/* ${NV_D}/usr/${dir} - rmdir ${NV_D}/usr/${dir}/xorg + if [[ -d "${NV_D}/usr/${dir}/xorg" ]] ; then + mv "${NV_D}/usr/${dir}"/xorg/* "${NV_D}/usr/${dir}" + rmdir "${NV_D}/usr/${dir}/xorg" fi done fi diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-173.08.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-173.08.ebuild new file mode 100644 index 000000000000..582090b536c9 --- /dev/null +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-173.08.ebuild @@ -0,0 +1,511 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-173.08.ebuild,v 1.1 2008/05/07 16:33:40 chainsaw Exp $ + +inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver + +X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}" +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}" +X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}" + +DESCRIPTION="NVIDIA X11 driver and GLX libraries" +HOMEPAGE="http://www.nvidia.com/" +SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run ) + amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run ) + x86-fbsd? ( http://us.download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )" + +LICENSE="NVIDIA" +SLOT="0" +KEYWORDS="-* ~amd64" +IUSE="acpi custom-cflags gtk multilib kernel_linux" +RESTRICT="strip" +EMULTILIB_PKG="true" + +COMMON="x11-base/xorg-server + multilib? ( app-emulation/emul-linux-x86-xlibs ) + kernel_FreeBSD? ( !media-video/nvidia-freebsd ) + !app-emulation/emul-linux-x86-nvidia + !x11-drivers/nvidia-legacy-drivers" +DEPEND="${COMMON} + kernel_linux? ( virtual/linux-sources ) + app-admin/eselect-opengl" +RDEPEND="${COMMON} + kernel_linux? ( virtual/modutils ) + media-libs/mesa + acpi? ( sys-power/acpid )" +PDEPEND="gtk? ( media-video/nvidia-settings )" + +QA_TEXTRELS_x86="usr/lib/libXvMCNVIDIA.so.${PV} + usr/lib/opengl/nvidia/no-tls/libnvidia-tls.so.${PV} + usr/lib/opengl/nvidia/tls/libnvidia-tls.so.${PV} + usr/lib/opengl/nvidia/lib/libGL.so.${PV} + usr/lib/opengl/nvidia/lib/libnvidia-cfg.so.${PV} + usr/lib/opengl/nvidia/lib/libGLcore.so.${PV} + usr/lib/opengl/nvidia/extensions/libglx.so + usr/lib/xorg/modules/drivers/nvidia_drv.so + usr/lib/libcuda.so.${PV}" + +QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko + usr/lib/opengl/nvidia/lib/libGL.so.1 + usr/lib/opengl/nvidia/lib/libGLcore.so.1 + usr/lib/opengl/nvidia/lib/libnvidia-cfg.so.1 + usr/lib/opengl/nvidia/no-tls/libnvidia-tls.so.1 + usr/lib/opengl/nvidia/extensions/libglx.so + usr/lib/xorg/modules/drivers/nvidia_drv.so" + +QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/tls/libnvidia-tls.so.${PV} + usr/lib32/opengl/nvidia/no-tls/libnvidia-tls.so.${PV} + usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV} + usr/lib32/opengl/nvidia/lib/libGL.so.${PV} + usr/lib32/opengl/nvidia/lib/libnvidia-cfg.so.${PV} + usr/lib32/libcuda.so.${PV}" + +QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV} + usr/lib/opengl/nvidia/lib/libGLcore.so.${PV} + usr/lib/opengl/nvidia/extensions/libglx.so" + +QA_EXECSTACK_amd64="usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV} + usr/lib32/opengl/nvidia/lib/libGL.so.${PV} + usr/lib64/xorg/modules/drivers/nvidia_drv.so + usr/lib64/libXvMCNVIDIA.so.${PV} + usr/lib64/opengl/nvidia/tls/libnvidia-tls.so.${PV} + usr/lib64/opengl/nvidia/no-tls/libnvidia-tls.so.${PV} + usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV} + usr/lib64/opengl/nvidia/lib/libGL.so.${PV} + usr/lib64/opengl/nvidia/lib/libnvidia-cfg.so.${PV} + usr/lib64/opengl/nvidia/extensions/libglx.so + usr/bin/nvidia-xconfig" + +QA_WX_LOAD_x86="usr/lib/opengl/nvidia/lib/libGLcore.so.${PV} + usr/lib/opengl/nvidia/lib/libGL.so.${PV} + usr/lib/opengl/nvidia/extensions/libglx.so" + +QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV} + usr/lib32/opengl/nvidia/lib/libGL.so.${PV} + usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV} + usr/lib64/opengl/nvidia/lib/libGL.so.${PV} + usr/lib64/opengl/nvidia/extensions/libglx.so" + +if use x86; then + PKG_V="-pkg0" + NV_PACKAGE="${X86_NV_PACKAGE}" +elif use amd64; then + PKG_V="-pkg2" + NV_PACKAGE="${AMD64_NV_PACKAGE}" +elif use x86-fbsd; then + PKG_V="" + NV_PACKAGE="${X86_FBSD_NV_PACKAGE}" +fi + +S="${WORKDIR}/${NV_PACKAGE}${PKG_V}" + +mtrr_check() { + ebegin "Checking for MTRR support" + linux_chkconfig_present MTRR + eend $? + + if [[ $? -ne 0 ]] ; then + eerror "Please enable MTRR support in your kernel config, found at:" + eerror + eerror " Processor type and features" + eerror " [*] MTRR (Memory Type Range Register) support" + eerror + eerror "and recompile your kernel ..." + die "MTRR support not detected!" + fi +} + +paravirt_check() { + ebegin "Checking for Paravirtualized guest support" + linux_chkconfig_present PARAVIRT + + if [[ $? -eq 0 ]]; then + eerror "Please disable PARAVIRT in your kernel config, found at:" + eerror + eerror " Processor type and features" + eerror " [*] Paravirtualized guest support" + eerror + eerror "or XEN support" + eerror + eerror "and recompile your kernel .." + die "PARAVIRT support detected!" + fi +} + +pkg_setup() { + # try to turn off distcc and ccache for people that have a problem with it + export DISTCC_DISABLE=1 + export CCACHE_DISABLE=1 + + if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then + eerror "This ebuild doesn't currently support changing your default abi." + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}" + fi + + if use kernel_linux; then + linux-mod_pkg_setup + MODULE_NAMES="nvidia(video:${S}/usr/src/nv)" + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \ + SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)" + mtrr_check + paravirt_check + fi + + # On BSD userland it wants real make command + use userland_BSD && MAKE="$(get_bmake)" + + export _POSIX2_VERSION="199209" + + # Since Nvidia ships 3 different series of drivers, we need to give the user + # some kind of guidance as to what version they should install. This tries + # to point the user in the right direction but can't be perfect. check + # nvidia-driver.eclass + nvidia-driver-check-warning + + # set variables to where files are in the package structure + if use kernel_FreeBSD; then + NV_DOC="${S}/doc" + NV_EXEC="${S}/obj" + NV_SRC="${S}/src" + elif use kernel_linux; then + NV_DOC="${S}/usr/share/doc" + NV_EXEC="${S}/usr/bin" + NV_SRC="${S}/usr/src/nv" + else + die "Could not determine proper NVIDIA package" + fi +} + +src_unpack() { + if use kernel_linux && kernel_is lt 2 6 7; then + echo + ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" + ewarn "This is not officially supported for ${P}. It is likely you" + ewarn "will not be able to compile or use the kernel module." + ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7" + echo + ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored." + fi + + if ! use x86-fbsd; then + cd "${WORKDIR}" + bash "${DISTDIR}"/${NV_PACKAGE}${PKG_V}.run --extract-only + else + unpack ${A} + fi + + # Patches go below here, add brief description + cd "${S}" + use x86-fbsd && cd doc + + # Use the correct defines to make gtkglext build work + epatch "${FILESDIR}"/NVIDIA_glx-defines.patch + # Use some more sensible gl headers and make way for new glext.h + epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch + + # allow on board sensors to work with lm_sensors + if use kernel_linux; then + epatch "${FILESDIR}"/NVIDIA_i2c-hwmon.patch + + kernel_is ge 2 6 26 && epatch "${FILESDIR}"/NVIDIA_kernel-173.08-2404825.diff + fi + + if use kernel_linux; then + # Quiet down warnings the user does not need to see + sed -i \ + -e 's:-Wpointer-arith::g' \ + -e 's:-Wsign-compare::g' \ + "${NV_SRC}"/Makefile.kbuild + + # If you set this then it's your own fault when stuff breaks :) + use custom-cflags && sed -i "s:-O:${CFLAGS}:" Makefile.* + + # If greater than 2.6.5 use M= instead of SUBDIR= + convert_to_m "${NV_SRC}"/Makefile.kbuild + fi +} + +src_compile() { + # This is already the default on Linux, as there's no toplevel Makefile, but + # on FreeBSD there's one and triggers the kernel module build, as we install + # it by itself, pass this. + + cd "${NV_SRC}" + if use x86-fbsd; then + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \ + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die + elif use kernel_linux; then + linux-mod_src_compile + fi +} + +src_install() { + local MLTEST=$(type dyn_unpack) + + cd "${S}" + + if use kernel_linux; then + linux-mod_src_install + + VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)" + if [ -z "$VIDEOGROUP" ]; then + eerror "Failed to determine the video group gid." + die "Failed to determine the video group gid." + fi + + # Add the aliases + [ -f "${FILESDIR}/nvidia" ] || die "nvidia missing in FILESDIR" + sed -e 's:PACKAGE:'${PF}':g' \ + -e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \ + "${WORKDIR}"/nvidia + insinto /etc/modprobe.d + doins "${WORKDIR}"/nvidia || die + elif use x86-fbsd; then + insinto /boot/modules + doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die + + exeinto /boot/modules + doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die + fi + + if has_multilib_profile ; then + local OABI=${ABI} + for ABI in $(get_install_abis) ; do + src_install-libs + done + ABI=${OABI} + unset OABI + elif use amd64 ; then + src_install-libs lib32 $(get_multilibdir) + src_install-libs lib $(get_libdir) + + rm -rf "${D}"/usr/$(get_multilibdir)/opengl/nvidia/include + rm -rf "${D}"/usr/$(get_multilibdir)/opengl/nvidia/extensions + else + src_install-libs + fi + + is_final_abi || return 0 + + # Documentation + dodoc "${NV_DOC}"/{XF86Config.sample,Copyrights} + dohtml "${NV_DOC}"/html/* + if use x86-fbsd; then + dodoc "${NV_DOC}/README" + else + # Docs + newdoc "${NV_DOC}/README.txt" README + dodoc "${NV_DOC}/NVIDIA_Changelog" + fi + + # Helper Apps + dobin ${NV_EXEC}/nvidia-xconfig || die + dobin ${NV_EXEC}/nvidia-bug-report.sh || die +} + +# Install nvidia library: +# the first parameter is the place where to install it +# the second parameter is the base name of the library +# the third parameter is the provided soversion +donvidia() { + dodir $1 + exeinto $1 + + libname=$(basename $2) + + doexe $2.$3 + dosym ${libname}.$3 $1/${libname} + + [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1 +} + +src_install-libs() { + local pkglibdir=lib + local inslibdir=$(get_libdir) + + if [[ ${#} -eq 2 ]] ; then + pkglibdir=${1} + inslibdir=${2} + elif has_multilib_profile && [[ ${ABI} == "x86" ]] ; then + pkglibdir=lib32 + fi + + local usrpkglibdir=usr/${pkglibdir} + local libdir=usr/X11R6/${pkglibdir} + local drvdir=${libdir}/modules/drivers + local extdir=${libdir}/modules/extensions + local incdir=usr/include/GL + local sover=${PV} + local NV_ROOT="/usr/${inslibdir}/opengl/nvidia" + local NO_TLS_ROOT="${NV_ROOT}/no-tls" + local TLS_ROOT="${NV_ROOT}/tls" + local X11_LIB_DIR="/usr/${inslibdir}/xorg" + + if use x86-fbsd; then + # on FreeBSD everything is on obj/ + pkglibdir=obj + usrpkglibdir=obj + x11pkglibdir=obj + drvdir=obj + extdir=obj + + # don't ask me why the headers are there.. glxext.h is missing + incdir=doc + + # on FreeBSD it has just .1 suffix + sover=1 + fi + + # The GLX libraries + donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGL.so ${sover} + donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGLcore.so ${sover} + + donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libnvidia-cfg.so ${sover} + + dodir ${NO_TLS_ROOT} + donvidia ${NO_TLS_ROOT} ${usrpkglibdir}/libnvidia-tls.so ${sover} + + if ! use x86-fbsd; then + donvidia ${TLS_ROOT} ${usrpkglibdir}/tls/libnvidia-tls.so ${sover} + fi + + if want_tls ; then + dosym ../tls/libnvidia-tls.so ${NV_ROOT}/lib + dosym ../tls/libnvidia-tls.so.1 ${NV_ROOT}/lib + dosym ../tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib + else + dosym ../no-tls/libnvidia-tls.so ${NV_ROOT}/lib + dosym ../no-tls/libnvidia-tls.so.1 ${NV_ROOT}/lib + dosym ../no-tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib + fi + + if ! use x86-fbsd; then + # Install the .la file for libtool, to prevent e.g. bug #176423 + [ -f "${FILESDIR}/libGL.la-r2" ] || die "libGL.la-r2 missing in FILESDIR" + local ver1=$(get_version_component_range 1) + local ver2=$(get_version_component_range 2) + local ver3=$(get_version_component_range 3) + sed -e "s:\${PV}:${PV}:" \ + -e "s:\${ver1}:${ver1}:" \ + -e "s:\${ver2}:${ver2}:" \ + -e "s:\${ver3}:${ver3}:" \ + -e "s:\${libdir}:${inslibdir}:" \ + "${FILESDIR}"/libGL.la-r2 > "${D}"/${NV_ROOT}/lib/libGL.la + fi + + exeinto ${X11_LIB_DIR}/modules/drivers + + [[ -f ${drvdir}/nvidia_drv.so ]] && \ + doexe ${drvdir}/nvidia_drv.so + + insinto /usr/${inslibdir} + [[ -f ${libdir}/libXvMCNVIDIA.a ]] && \ + doins ${libdir}/libXvMCNVIDIA.a + exeinto /usr/${inslibdir} + # fix Bug 131315 + [[ -f ${libdir}/libXvMCNVIDIA.so.${PV} ]] && \ + doexe ${libdir}/libXvMCNVIDIA.so.${PV} && \ + dosym libXvMCNVIDIA.so.${PV} \ + /usr/${inslibdir}/libXvMCNVIDIA.so + + exeinto ${NV_ROOT}/extensions + [[ -f ${libdir}/modules/libnvidia-wfb.so.${sover} ]] && \ + newexe ${libdir}/modules/libnvidia-wfb.so.${sover} libwfb.so + [[ -f ${extdir}/libglx.so.${sover} ]] && \ + newexe ${extdir}/libglx.so.${sover} libglx.so + + # Includes + insinto ${NV_ROOT}/include + doins ${incdir}/*.h + + #cuda + if [[ -f usr/include/cuda/cuda.h ]]; then + dodir /usr/include/cuda + insinto /usr/include/cuda + doins usr/include/cuda/*.h + + dolib.so usr/${pkglibdir}/libcuda.so.${PV} + dosym libcuda.so.${PV} /usr/${inslibdir}/libcuda.so.1 + dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so + fi +} + +pkg_preinst() { + + # Clean the dynamic libGL stuff's home to ensure + # we dont have stale libs floating around + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/* + fi + # Make sure we nuke the old nvidia-glx's env.d file + if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then + rm -f "${ROOT}"/etc/env.d/09nvidia + fi +} + +pkg_postinst() { + if use kernel_linux; then + linux-mod_pkg_postinst + fi + + # Switch to the nvidia implementation + eselect opengl set --use-old nvidia + + echo + elog "You must be in the video group to use the NVIDIA device" + elog "For more info, read the docs at" + elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6" + elog + + elog "This ebuild installs a kernel module and X driver. Both must" + elog "match explicitly in their version. This means, if you restart" + elog "X, you most modprobe -r nvidia before starting it back up" + elog + + elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\"" + elog + elog "nVidia has requested that any bug reports submitted have the" + elog "output of /usr/bin/nvidia-bug-report.sh included." + elog + elog "To work with compiz, you must enable the AddARGBGLXVisuals option." + elog + elog "If you are having resolution problems, try disabling DynamicTwinView." + echo +} + +want_tls() { + # For uclibc or anything non glibc, return false + has_version sys-libs/glibc || return 1 + + # Old versions of glibc were lt/no-tls only + has_version '<sys-libs/glibc-2.3.2' && return 1 + + if use x86 ; then + case ${CHOST/-*} in + i486|i586|i686) ;; + *) return 1 ;; + esac + fi + + # If we've got nptl, we've got tls + built_with_use --missing true sys-libs/glibc nptl && return 0 + + # 2.3.5 turned off tls for linuxthreads glibc on i486 and i586 + if use x86 && has_version '>=sys-libs/glibc-2.3.5' ; then + case ${CHOST/-*} in + i486|i586) return 1 ;; + esac + fi + + # These versions built linuxthreads version to support tls, too + has_version '>=sys-libs/glibc-2.3.4.20040619-r2' && return 0 + + return 1 +} + +pkg_postrm() { + if use kernel_linux; then + linux-mod_pkg_postrm + fi + eselect opengl set --use-old xorg-x11 +} diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.01.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.01.ebuild index 0e42ac80e46e..06e4f71bf506 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.01.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.01.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.01.ebuild,v 1.5 2007/11/20 12:05:02 opfer Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.01.ebuild,v 1.6 2008/05/07 16:33:40 chainsaw Exp $ inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver @@ -169,7 +169,7 @@ src_unpack() { if ! use x86-fbsd; then cd "${WORKDIR}" - bash ${DISTDIR}/${NV_PACKAGE}${PKG_V}.run --extract-only + bash "${DISTDIR}/${NV_PACKAGE}${PKG_V}.run" --extract-only else unpack ${A} fi @@ -397,9 +397,9 @@ pkg_preinst() { if ! has_version x11-base/xorg-server ; then for dir in lib lib32 lib64 ; do - if [[ -d ${NV_D}/usr/${dir}/xorg ]] ; then - mv ${NV_D}/usr/${dir}/xorg/* ${NV_D}/usr/${dir} - rmdir ${NV_D}/usr/${dir}/xorg + if [[ -d "${NV_D}/usr/${dir}/xorg" ]] ; then + mv "${NV_D}/usr/${dir}"/xorg/* "${NV_D}/usr/${dir}" + rmdir "${NV_D}/usr/${dir}/xorg" fi done fi diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.04.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.04.ebuild index 34851040140d..eca92eb42741 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.04.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.04.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.04.ebuild,v 1.1 2008/02/04 17:52:58 cardoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-71.86.04.ebuild,v 1.2 2008/05/07 16:33:40 chainsaw Exp $ inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver @@ -168,7 +168,7 @@ src_unpack() { if ! use x86-fbsd; then cd "${WORKDIR}" - bash ${DISTDIR}/${NV_PACKAGE}${PKG_V}.run --extract-only + bash "${DISTDIR}/${NV_PACKAGE}${PKG_V}.run" --extract-only else unpack ${A} fi @@ -396,9 +396,9 @@ pkg_preinst() { if ! has_version x11-base/xorg-server ; then for dir in lib lib32 lib64 ; do - if [[ -d ${NV_D}/usr/${dir}/xorg ]] ; then - mv ${NV_D}/usr/${dir}/xorg/* ${NV_D}/usr/${dir} - rmdir ${NV_D}/usr/${dir}/xorg + if [[ -d "${NV_D}/usr/${dir}/xorg" ]] ; then + mv "${NV_D}/usr/${dir}"/xorg/* "${NV_D}/usr/${dir}" + rmdir "${NV_D}/usr/${dir}/xorg" fi done fi diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.01.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.01.ebuild index fd4915645044..5ac915d55e6f 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.01.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.01.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.01.ebuild,v 1.5 2007/11/14 15:03:59 beandog Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.01.ebuild,v 1.6 2008/05/07 16:33:40 chainsaw Exp $ inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver @@ -169,7 +169,7 @@ src_unpack() { if ! use x86-fbsd; then cd "${WORKDIR}" - bash ${DISTDIR}/${NV_PACKAGE}${PKG_V}.run --extract-only + bash "${DISTDIR}/${NV_PACKAGE}${PKG_V}.run" --extract-only else unpack ${A} fi @@ -405,9 +405,9 @@ pkg_preinst() { if ! has_version x11-base/xorg-server ; then for dir in lib lib32 lib64 ; do - if [[ -d ${NV_D}/usr/${dir}/xorg ]] ; then - mv ${NV_D}/usr/${dir}/xorg/* ${NV_D}/usr/${dir} - rmdir ${NV_D}/usr/${dir}/xorg + if [[ -d "${NV_D}/usr/${dir}/xorg" ]] ; then + mv "${NV_D}/usr/${dir}"/xorg/* "${NV_D}/usr/${dir}" + rmdir "${NV_D}/usr/${dir}/xorg" fi done fi diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.05.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.05.ebuild index 6e35a74f9346..64745332f163 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.05.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.05.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.05.ebuild,v 1.3 2008/04/18 19:54:04 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.05.ebuild,v 1.4 2008/05/07 16:33:40 chainsaw Exp $ inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver @@ -168,7 +168,7 @@ src_unpack() { if ! use x86-fbsd; then cd "${WORKDIR}" - bash ${DISTDIR}/${NV_PACKAGE}${PKG_V}.run --extract-only + bash "${DISTDIR}/${NV_PACKAGE}${PKG_V}.run" --extract-only else unpack ${A} fi @@ -405,9 +405,9 @@ pkg_preinst() { if ! has_version x11-base/xorg-server ; then for dir in lib lib32 lib64 ; do - if [[ -d ${NV_D}/usr/${dir}/xorg ]] ; then - mv ${NV_D}/usr/${dir}/xorg/* ${NV_D}/usr/${dir} - rmdir ${NV_D}/usr/${dir}/xorg + if [[ -d "${NV_D}/usr/${dir}/xorg" ]] ; then + mv "${NV_D}/usr/${dir}"/xorg/* "${NV_D}/usr/${dir}" + rmdir "${NV_D}/usr/${dir}/xorg" fi done fi |