Re-Add x11-drivers/nvidia to make work with 4.7 kernels
This commit is contained in:
parent
d2beffdff7
commit
c0d01dfa00
18
x11-drivers/nvidia-drivers/Manifest
Normal file
18
x11-drivers/nvidia-drivers/Manifest
Normal file
@ -0,0 +1,18 @@
|
||||
AUX 95-nvidia-settings-r1 54 SHA256 cbc6e8cae863b768b2ec570390e409476ec3ca1137006888810a9ec7f0029eb0 SHA512 de9edf678c64ca3d10c912397800b2cb651ef9108b33ece97a4cc1e86dad0a9e81986cca6b96cfe80740d9cb433de7ef93f29be45178db714ee408c7f6570ac7 WHIRLPOOL 032fbfd24378659f30b0ca2d653dff8fa09106aa55803740f22f82515251c099e9637310d420d909135e9f7850cb2890cf4abeac9d6a4b5e390a7d061462b13a
|
||||
AUX nvidia-169.07 639 SHA256 a8c4860f008d53776fda7a17b59524f271236559af688e9a2c9845cbbcba1577 SHA512 3af295c026280dc3a2b73c2cc7772254686b09cad15f1333ab0b4de8cb0ccf78e725ced2a399b10edcf8af6ba42ab1485dc0661af67461b0c3789f786357772f WHIRLPOOL 626ae3c01c879e0cfe05bd373e0b9dfd6f462dd9ef6ae94a7d60276fe2d17c57fbb20aaa4d2a186a0ffc2a860076692aac854d00a3545bc9736e7bb8d0581055
|
||||
AUX nvidia-drivers-370.28-pax.patch 15652 SHA256 bebd277021053bbbd7811a27160ee3cb07e19f5434c4027a95b353d2a8b1ffce SHA512 4713a6133ab4951512115bb67614db26d10a7e1c36e50f54e58e00b9ebc9365055d7a325c60e8b940e16727d7bfee395db55ae680b933b23d7046e00420acdf7 WHIRLPOOL 4251709445cc8150aaf665aeb81937a320dbdcc2c49597d31921871f431b667aaa38237397a78f286c5d515ecb8e2445f8c2c70f51bc5a594243be423d808504
|
||||
AUX nvidia-drivers-370.28-profiles-rc.patch 275 SHA256 709f9a1329ae70337c1ac0e7135b2f6352b6bec561ee4f4ed232d0d2dd1e7c42 SHA512 6f0f6df0ad822a4c1b1e232ee975ee4928b974e139e98bc1d286952a5ac5cd6501bcd07d3b005dbbf31696515ce9be4536fb392b163b98d4e915770754b2d527 WHIRLPOOL db9f2138e94927caa815e69198143093905841bc6ba1b793d1ec61690efb41b15cbe28978e95934a2e41ca6f13fee0f04419e453b708ada083bdae5d496a12fd
|
||||
AUX nvidia-persistenced.conf 250 SHA256 347437868119e8ae12852a574597936e855f534a9ad290fef3f62b4083a38516 SHA512 9c9562bb15bf4552754dd50a1b01dec5df76f7f5666fba2fff642a169f87e9ed421a260f2258ab469f7e4cd9ef8161653355795624387fe7ad5ae6a0d71e5f46 WHIRLPOOL 1422504c6688fce28719146c7d95fe196ca617556942e8dc04c7f8c1412fa80b5b8289c0f86b835eece90eed4b4017093d686779f88d44cd41fa3de1a10e9bbe
|
||||
AUX nvidia-persistenced.init 657 SHA256 ff23bac5419456c41771056be52b763740652043fdd7239086889a43c6a2ab18 SHA512 4933d39dcfb05eae9e143eb549e297114aa306b15395634797e80d0a213b2df5ec2b8c32fd64c634dbe5dc859a8ffebb75729c03c0c8c7155f1bece08b1f3265 WHIRLPOOL 0948e1e38bec773da9bcc0ff04cae421e4935181ce40a9db33eee1acaff95f59a242300bdf3581ba7031d5b8fee24e8d5e1cf4fa54aec111992590a1629047ba
|
||||
AUX nvidia-rmmod.conf 97 SHA256 7b8912f9865958755aa26c2e32930f7c6e6f7eb5e5d0d075059b93e0e5b824f0 SHA512 517e7daf74496f2ec0cca9aa2654ef26eb9f07ee942f03f6e6b97b1b311c0d9915d56ccdd2acd73680dc39373a8090c993b16d5cb9329024609a52027757c240 WHIRLPOOL 586a30a716201820d762e9715b2ef1a7bb729664900ebf18ab2c8a4347ae2add0defe4d6ed76972864a0e986cd257bb51753c5152c52e42708ed05bcac5d1e85
|
||||
AUX nvidia-settings.desktop 185 SHA256 a402fc441e27b6279e38d227d650916a6aa0f872605ade6c539971c70284204f SHA512 30cab269daf282b9716e53ecf2f8993289e8d4ad05c40d6ddaad3ea6e95477c36a4d65a28d0ec3c1c9c7e845fde140df9012944306f70131a02c9ffef0a9f523 WHIRLPOOL 2bea14aed79de7905b41768ca4c4ccd608c41353335607fbc23236471e5b755eb0c0d8d99611949969bf2511ca8d003ce7ed405be0078c2bcf24070ee40a46ec
|
||||
AUX nvidia-smi.init 552 SHA256 1f1481ae98a506a7d249e87654aab9d3975b6a88b9abe7b58ebbd337babbc47c SHA512 e95d20a111be5ae19990c84b4c393e3845916458966e624bf6865cedf9be3ebfdf10f1359f3cf5f9447e7d78638dc5284cab43b78cd7f8b96cf2189d91fcf1ea WHIRLPOOL 23f73a5efd2639bcb98cec13b4c18d2b204846a95400ec33e8c18cf398fd886740af75760bfeb8ba5dac0af7a474fd8412781d02a3879d4ef2d40ad2b6c6c35b
|
||||
AUX nvidia-udev.sh-r1 285 SHA256 5ca08a5329cccd9e32dd3cd573525f510edf7b12d8c531cbe781a70b2ceade63 SHA512 493b0d5f2698d299e3b8d5782ac7fb8174e7ee93f1dae66bc1161eb4dd16d4db91048444dc6e7bea344960936c0a5c825041f6909af004438d8009a3d3fe71c9 WHIRLPOOL 14c2d01d8280dc9c4afaacc75b8ef97875553b5ed50e6dba6209280ebea5cd9c607505870ee37d719530428a9f57034511cd080ba0ab3a1d831b767b4cd15305
|
||||
AUX nvidia.udev-rule 462 SHA256 37b152a5055a16d1947171567178e2841679ddf03dba9d48e7d30f1e3b469ac6 SHA512 96f9edaa0b46bea5fce17596f868bea5265b303d7185af6ba81527bbd7b8fdf92de9311317cbde51a29d222083d451c25ab77c3d6837cbc4072a50d9af89aa86 WHIRLPOOL 89ed95f33db7485a3a1acd91df33ecdfb7d0a249db2d7674f134fb85b35a54653d0458e478503315ce506ae5d3c8dcd4ac20420711fdbdd087ea4bd779627d13
|
||||
DIST NVIDIA-FreeBSD-x86-370.28.tar.gz 58718517 SHA256 52193b15b4ca822b029f860eed4d00270c925f5d24f7bb511a5b7bbea696d58c SHA512 83ffb19069cc240f8836d808a5eb02c142e7ad923fc2e3049a3b316acc12df070d42dfdc5a8a8e1411ccc9fba0bfa4ed84f457435e985434cd86ae966a63a3f4 WHIRLPOOL b1bec4d5e34ea39c3b1b44adcf85b7392cef39517979d32bc800e48a79a57cfb5f1ca5ff82bc302aa67ed12094782e09ab146f021a9c04e18430034a5ab341a9
|
||||
DIST NVIDIA-FreeBSD-x86_64-370.28.tar.gz 57905860 SHA256 5087a93af8aaab6cff35ba60c9d67b4249827f6b7681abaaa571a20784a54552 SHA512 40637d64a0ee5029bb1c5ad7a590c5be61253ef6283c4217666768ad8601d7f51ef0d8705c8711f65c3d0a5a5721490813220c5f9186c6d2d12baf5d9c11122e WHIRLPOOL 361648788b7efb9e550b3e67d2e6022e31dab29f5660c42a1b6c961fe4638216fb8785814ee9fa1636fc39c39afce7caffbdc24fcf8bbd14e4eec5b5eeaeb1eb
|
||||
DIST NVIDIA-Linux-armv7l-gnueabihf-370.28.run 26117701 SHA256 efb60a23aa22b46e94e91d5f5a5fc0c17b47bcf50471e4371653ced5a5350dce SHA512 04699849441bccfb9214fda4c7ff8ecefa11249d1fbfe470e37fefdd132becc225a1bcc16bc976c3fb145a427961f5402c95ecc84b613adb71caef9c96fe7d90 WHIRLPOOL 675a495594c46666ec11c83a76cdc8821e9b57079ee53cd7adcf00e783d121e163b7c5b10598aa55a1fee72eee47defc514fba986685af41c90ab2c5d890abbd
|
||||
DIST NVIDIA-Linux-x86-370.28.run 44189522 SHA256 6323254ccf2a75d7ced1374a76ca56778689d0d8a9819e4ee5378ea3347b9835 SHA512 2df8b3d1064073c8b793287994fe0648625d095f3434b7b67531e19632cbad318994df90b55de18aa457d55a1374b35d64a646564259995d3f2197c48737921c WHIRLPOOL 85a089c833311abdc06bbc1fc68cd5ff8ed43dd5e5887d340dc854f905ae741de0ae4343d024259f493dd668075096c460bc1f93c1795d2befb81dd3c4a4983a
|
||||
DIST NVIDIA-Linux-x86_64-370.28.run 76690360 SHA256 90aa3c186e45b39e6fc0064ab8dbda8bcc897cb61d2e7b7cb30b4ec9a4b39239 SHA512 931476f92a63d142478b2d6b3da4031769fd3b93aee2387800a78b1354b59a5fb5e4e293436b6b4c246627d51c0f55d140ab230de385cb1567bc8b25518eb741 WHIRLPOOL ce866c38291d2ab4aeeff05654a0e61196129f77baea5af93ddbc22fab9574ba39cc05d58020ea2407cc7342f0bcf5c2702d42290f4cc3b53c9e04fb7c617413
|
||||
DIST nvidia-settings-370.28.tar.bz2 1573509 SHA256 59d7818a4837144e373ce958233db059fde59e279477001e187579770ebf0c5f SHA512 c4da6ae54839a8f91d3557153a648f69095e9a486dbaaf73e453d625660f1adcada12ee5c4bccc1afe2cfd454ead13c1df0e59d5d6aa70f6065823d53f7bb461 WHIRLPOOL e5f0a9fd67e50aee42598d6a0ce9a69a162405a6121518c7aaf9ede409e9bdeb44e3102a123eb6f8c963e0fdaca429a8b693f6af2f0467e746c42f57a496d45f
|
||||
EBUILD nvidia-drivers-370.28-r1.ebuild 15412 SHA256 aae547a8765b77e990330630006f6a089dce46fdf79451d3d4f470baf43d02e4 SHA512 a5e750d9cbd3f7ee45c224ae2908d159f612ceb07cdb9d90bb81305a60f3a124d355d4d4604d440afcdba44b3618c088df2cba98bb4bf3073244abe5875005c2 WHIRLPOOL 010bd6f704331f88f9a5ded3122acbd3c75929a64333316116bfb7a7e3e1ed1f62923ed85a5fbe3b2ce433b06d9c328729fa4312debd016d8f7c3c5857a4c898
|
2
x11-drivers/nvidia-drivers/files/95-nvidia-settings-r1
Normal file
2
x11-drivers/nvidia-drivers/files/95-nvidia-settings-r1
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
/usr/bin/nvidia-settings --load-config-only
|
14
x11-drivers/nvidia-drivers/files/nvidia-169.07
Normal file
14
x11-drivers/nvidia-drivers/files/nvidia-169.07
Normal file
@ -0,0 +1,14 @@
|
||||
# Nvidia drivers support
|
||||
alias char-major-195 nvidia
|
||||
alias /dev/nvidiactl char-major-195
|
||||
|
||||
# To tweak the driver the following options can be used, note that
|
||||
# you should be careful, as it could cause instability!! For more
|
||||
# options see /usr/share/doc/PACKAGE/README
|
||||
#
|
||||
# !!! SECURITY WARNING !!!
|
||||
# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW
|
||||
# WHAT YOU ARE DOING.
|
||||
# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH,
|
||||
# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE.
|
||||
options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1
|
403
x11-drivers/nvidia-drivers/files/nvidia-drivers-370.28-pax.patch
Normal file
403
x11-drivers/nvidia-drivers/files/nvidia-drivers-370.28-pax.patch
Normal file
@ -0,0 +1,403 @@
|
||||
diff -urp work.orig/kernel/common/inc/nv-linux.h work/kernel/common/inc/nv-linux.h
|
||||
--- work.orig/kernel/common/inc/nv-linux.h 2016-09-02 03:32:09.000000000 +0200
|
||||
+++ work/kernel/common/inc/nv-linux.h 2016-09-12 21:18:48.100329700 +0200
|
||||
@@ -1312,6 +1312,9 @@ extern void *nvidia_stack_t_cache;
|
||||
#define NV_KMEM_CACHE_CREATE(name, type) \
|
||||
NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, 0, NULL)
|
||||
|
||||
+#define NV_KMEM_CACHE_CREATE_USERCOPY(name, type) \
|
||||
+ NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, SLAB_USERCOPY, NULL)
|
||||
+
|
||||
#define NV_KMEM_CACHE_DESTROY(kmem_cache) \
|
||||
kmem_cache_destroy(kmem_cache)
|
||||
|
||||
diff -urp work.orig/kernel/common/inc/nv-modeset-interface.h work/kernel/common/inc/nv-modeset-interface.h
|
||||
--- work.orig/kernel/common/inc/nv-modeset-interface.h 2016-09-02 03:32:09.000000000 +0200
|
||||
+++ work/kernel/common/inc/nv-modeset-interface.h 2016-09-13 01:57:32.351888874 +0200
|
||||
@@ -72,7 +72,7 @@ typedef struct {
|
||||
* mix nvidia and nvidia-modeset kernel modules from different
|
||||
* releases.
|
||||
*/
|
||||
- const char *version_string;
|
||||
+ // const char *version_string;
|
||||
|
||||
/*
|
||||
* Return system information.
|
||||
@@ -117,6 +117,6 @@ typedef struct {
|
||||
|
||||
} nvidia_modeset_rm_ops_t;
|
||||
|
||||
-NV_STATUS nvidia_get_rm_ops(nvidia_modeset_rm_ops_t *rm_ops);
|
||||
+NV_STATUS nvidia_get_rm_ops(const nvidia_modeset_rm_ops_t **rm_ops, const char **version_string);
|
||||
|
||||
#endif /* _NV_MODESET_INTERFACE_H_ */
|
||||
diff -urp work.orig/kernel/common/inc/nv-register-module.h work/kernel/common/inc/nv-register-module.h
|
||||
--- work.orig/kernel/common/inc/nv-register-module.h 2016-09-02 03:32:09.000000000 +0200
|
||||
+++ work/kernel/common/inc/nv-register-module.h 2016-09-12 21:17:30.880331735 +0200
|
||||
@@ -34,7 +34,7 @@ typedef struct nvidia_module_s {
|
||||
int (*ioctl)(struct inode *, struct file * file, unsigned int cmd, unsigned long arg);
|
||||
unsigned int (*poll)(struct file * file, poll_table *wait);
|
||||
|
||||
-} nvidia_module_t;
|
||||
+} __do_const nvidia_module_t;
|
||||
|
||||
int nvidia_register_module(nvidia_module_t *);
|
||||
int nvidia_unregister_module(nvidia_module_t *);
|
||||
diff -urp work.orig/kernel/nvidia/nv.c work/kernel/nvidia/nv.c
|
||||
--- work.orig/kernel/nvidia/nv.c 2016-09-02 03:32:09.000000000 +0200
|
||||
+++ work/kernel/nvidia/nv.c 2016-09-12 21:19:25.868328704 +0200
|
||||
@@ -660,8 +660,8 @@ int __init nvidia_init_module(void)
|
||||
NV_SPIN_LOCK_INIT(&km_lock);
|
||||
#endif
|
||||
|
||||
- nvidia_stack_t_cache = NV_KMEM_CACHE_CREATE(nvidia_stack_cache_name,
|
||||
- nvidia_stack_t);
|
||||
+ nvidia_stack_t_cache = NV_KMEM_CACHE_CREATE_USERCOPY(nvidia_stack_cache_name,
|
||||
+ nvidia_stack_t);
|
||||
if (nvidia_stack_t_cache == NULL)
|
||||
{
|
||||
nv_printf(NV_DBG_ERRORS, "NVRM: stack cache allocation failed!\n");
|
||||
diff -urp work.orig/kernel/nvidia/nv-chrdev.c work/kernel/nvidia/nv-chrdev.c
|
||||
--- work.orig/kernel/nvidia/nv-chrdev.c 2016-09-02 03:32:09.000000000 +0200
|
||||
+++ work/kernel/nvidia/nv-chrdev.c 2016-09-12 21:17:03.204332465 +0200
|
||||
@@ -20,8 +20,6 @@ int nv_register_chrdev(void *param)
|
||||
{
|
||||
nvidia_module_t *module = (nvidia_module_t *)param;
|
||||
|
||||
- module->instance = nv_module_instance;
|
||||
-
|
||||
return (nvidia_register_module(module));
|
||||
}
|
||||
|
||||
diff -urp work.orig/kernel/nvidia/nv-instance.c work/kernel/nvidia/nv-instance.c
|
||||
--- work.orig/kernel/nvidia/nv-instance.c 2016-09-02 03:32:09.000000000 +0200
|
||||
+++ work/kernel/nvidia/nv-instance.c 2016-09-12 21:16:42.268333017 +0200
|
||||
@@ -51,6 +51,7 @@ struct pci_driver nv_pci_driver = {
|
||||
nvidia_module_t nv_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.module_name = MODULE_NAME,
|
||||
+ .instance = MODULE_INSTANCE_NUMBER,
|
||||
.open = nvidia_open,
|
||||
.close = nvidia_close,
|
||||
.ioctl = nvidia_ioctl,
|
||||
diff -urp work.orig/kernel/nvidia/nv-mmap.c work/kernel/nvidia/nv-mmap.c
|
||||
--- work.orig/kernel/nvidia/nv-mmap.c 2016-09-02 03:32:09.000000000 +0200
|
||||
+++ work/kernel/nvidia/nv-mmap.c 2016-09-13 02:18:54.459855079 +0200
|
||||
@@ -113,12 +113,12 @@ nvidia_vma_release(struct vm_area_struct
|
||||
}
|
||||
|
||||
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_ACCESS)
|
||||
-static int
|
||||
+static ssize_t
|
||||
nvidia_vma_access(
|
||||
struct vm_area_struct *vma,
|
||||
unsigned long addr,
|
||||
void *buffer,
|
||||
- int length,
|
||||
+ size_t length,
|
||||
int write
|
||||
)
|
||||
{
|
||||
diff -urp work.orig/kernel/nvidia/nv-modeset-interface.c work/kernel/nvidia/nv-modeset-interface.c
|
||||
--- work.orig/kernel/nvidia/nv-modeset-interface.c 2016-09-02 03:32:09.000000000 +0200
|
||||
+++ work/kernel/nvidia/nv-modeset-interface.c 2016-09-13 02:01:46.519882174 +0200
|
||||
@@ -100,10 +100,9 @@ static NvU32 nvidia_modeset_enumerate_gp
|
||||
return count;
|
||||
}
|
||||
|
||||
-NV_STATUS nvidia_get_rm_ops(nvidia_modeset_rm_ops_t *rm_ops)
|
||||
+NV_STATUS nvidia_get_rm_ops(const nvidia_modeset_rm_ops_t **rm_ops, const char **version_string)
|
||||
{
|
||||
- const nvidia_modeset_rm_ops_t local_rm_ops = {
|
||||
- .version_string = NV_VERSION_STRING,
|
||||
+ static nvidia_modeset_rm_ops_t local_rm_ops = {
|
||||
.system_info = {
|
||||
.allow_write_combining = NV_FALSE,
|
||||
},
|
||||
@@ -116,16 +115,16 @@ NV_STATUS nvidia_get_rm_ops(nvidia_modes
|
||||
.set_callbacks = nvidia_modeset_set_callbacks,
|
||||
};
|
||||
|
||||
- if (strcmp(rm_ops->version_string, NV_VERSION_STRING) != 0)
|
||||
+ if (strcmp(*version_string, NV_VERSION_STRING) != 0)
|
||||
{
|
||||
- rm_ops->version_string = NV_VERSION_STRING;
|
||||
+ *version_string = NV_VERSION_STRING;
|
||||
return NV_ERR_GENERIC;
|
||||
}
|
||||
|
||||
- *rm_ops = local_rm_ops;
|
||||
+ *rm_ops = (const nvidia_modeset_rm_ops_t *) &local_rm_ops;
|
||||
|
||||
if (NV_ALLOW_WRITE_COMBINING(NV_MEMORY_TYPE_FRAMEBUFFER)) {
|
||||
- rm_ops->system_info.allow_write_combining = NV_TRUE;
|
||||
+ local_rm_ops.system_info.allow_write_combining = NV_TRUE;
|
||||
}
|
||||
|
||||
return NV_OK;
|
||||
diff -urp work.orig/kernel/nvidia-drm/nvidia-drm-drv.c work/kernel/nvidia-drm/nvidia-drm-drv.c
|
||||
--- work.orig/kernel/nvidia-drm/nvidia-drm-drv.c 2016-09-02 03:33:06.000000000 +0200
|
||||
+++ work/kernel/nvidia-drm/nvidia-drm-drv.c 2016-09-12 21:23:12.280322736 +0200
|
||||
@@ -612,7 +612,7 @@ static const struct drm_ioctl_desc nv_dr
|
||||
DRM_CONTROL_ALLOW|DRM_RENDER_ALLOW|DRM_UNLOCKED),
|
||||
};
|
||||
|
||||
-static struct drm_driver nv_drm_driver = {
|
||||
+static drm_driver_no_const nv_drm_driver __read_only = {
|
||||
|
||||
.driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER,
|
||||
|
||||
@@ -673,6 +673,7 @@ static void nvidia_update_drm_driver_fea
|
||||
return;
|
||||
}
|
||||
|
||||
+ pax_open_kernel();
|
||||
nv_drm_driver.driver_features |= DRIVER_MODESET | DRIVER_ATOMIC;
|
||||
|
||||
nv_drm_driver.master_set = nvidia_drm_master_set;
|
||||
@@ -681,6 +682,7 @@ static void nvidia_update_drm_driver_fea
|
||||
nv_drm_driver.dumb_create = nvidia_drm_dumb_create;
|
||||
nv_drm_driver.dumb_map_offset = nvidia_drm_dumb_map_offset;
|
||||
nv_drm_driver.dumb_destroy = drm_gem_dumb_destroy;
|
||||
+ pax_close_kernel();
|
||||
|
||||
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
|
||||
}
|
||||
diff -urp work.orig/kernel/nvidia-modeset/nvidia-modeset-linux.c work/kernel/nvidia-modeset/nvidia-modeset-linux.c
|
||||
--- work.orig/kernel/nvidia-modeset/nvidia-modeset-linux.c 2016-09-02 03:33:06.000000000 +0200
|
||||
+++ work/kernel/nvidia-modeset/nvidia-modeset-linux.c 2016-09-13 02:14:23.111862232 +0200
|
||||
@@ -322,29 +322,29 @@ static void nvkms_resume(NvU32 gpuId)
|
||||
* Interface with resman.
|
||||
*************************************************************************/
|
||||
|
||||
-static nvidia_modeset_rm_ops_t __rm_ops = { 0 };
|
||||
+static const nvidia_modeset_rm_ops_t *__rm_ops;
|
||||
+
|
||||
static nvidia_modeset_callbacks_t nvkms_rm_callbacks = {
|
||||
- nvkms_suspend,
|
||||
- nvkms_resume
|
||||
+ .suspend = nvkms_suspend,
|
||||
+ .resume = nvkms_resume
|
||||
};
|
||||
|
||||
static int nvkms_alloc_rm(void)
|
||||
{
|
||||
NV_STATUS nvstatus;
|
||||
int ret;
|
||||
+ const char * version_string = NV_VERSION_STRING;
|
||||
|
||||
- __rm_ops.version_string = NV_VERSION_STRING;
|
||||
-
|
||||
- nvstatus = nvidia_get_rm_ops(&__rm_ops);
|
||||
+ nvstatus = nvidia_get_rm_ops(&__rm_ops, &version_string);
|
||||
|
||||
if (nvstatus != NV_OK) {
|
||||
printk(KERN_ERR NVKMS_LOG_PREFIX "Version mismatch: "
|
||||
"nvidia.ko(%s) nvidia-modeset.ko(%s)\n",
|
||||
- __rm_ops.version_string, NV_VERSION_STRING);
|
||||
+ version_string, NV_VERSION_STRING);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
- ret = __rm_ops.set_callbacks(&nvkms_rm_callbacks);
|
||||
+ ret = __rm_ops->set_callbacks(&nvkms_rm_callbacks);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR NVKMS_LOG_PREFIX "Failed to register callbacks\n");
|
||||
return ret;
|
||||
@@ -355,20 +355,20 @@ static int nvkms_alloc_rm(void)
|
||||
|
||||
static void nvkms_free_rm(void)
|
||||
{
|
||||
- __rm_ops.set_callbacks(NULL);
|
||||
+ __rm_ops->set_callbacks(NULL);
|
||||
}
|
||||
|
||||
void NVKMS_API_CALL nvkms_call_rm(void *ops)
|
||||
{
|
||||
nvidia_modeset_stack_ptr stack = NULL;
|
||||
|
||||
- if (__rm_ops.alloc_stack(&stack) != 0) {
|
||||
+ if (__rm_ops->alloc_stack(&stack) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
- __rm_ops.op(stack, ops);
|
||||
+ __rm_ops->op(stack, ops);
|
||||
|
||||
- __rm_ops.free_stack(stack);
|
||||
+ __rm_ops->free_stack(stack);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
@@ -690,13 +690,13 @@ NvBool NVKMS_API_CALL nvkms_open_gpu(NvU
|
||||
nvidia_modeset_stack_ptr stack = NULL;
|
||||
NvBool ret;
|
||||
|
||||
- if (__rm_ops.alloc_stack(&stack) != 0) {
|
||||
+ if (__rm_ops->alloc_stack(&stack) != 0) {
|
||||
return NV_FALSE;
|
||||
}
|
||||
|
||||
- ret = __rm_ops.open_gpu(gpuId, stack) == 0;
|
||||
+ ret = __rm_ops->open_gpu(gpuId, stack) == 0;
|
||||
|
||||
- __rm_ops.free_stack(stack);
|
||||
+ __rm_ops->free_stack(stack);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -705,23 +705,23 @@ void NVKMS_API_CALL nvkms_close_gpu(NvU3
|
||||
{
|
||||
nvidia_modeset_stack_ptr stack = NULL;
|
||||
|
||||
- if (__rm_ops.alloc_stack(&stack) != 0) {
|
||||
+ if (__rm_ops->alloc_stack(&stack) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
- __rm_ops.close_gpu(gpuId, stack);
|
||||
+ __rm_ops->close_gpu(gpuId, stack);
|
||||
|
||||
- __rm_ops.free_stack(stack);
|
||||
+ __rm_ops->free_stack(stack);
|
||||
}
|
||||
|
||||
NvU32 NVKMS_API_CALL nvkms_enumerate_gpus(nv_gpu_info_t *gpu_info)
|
||||
{
|
||||
- return __rm_ops.enumerate_gpus(gpu_info);
|
||||
+ return __rm_ops->enumerate_gpus(gpu_info);
|
||||
}
|
||||
|
||||
NvBool NVKMS_API_CALL nvkms_allow_write_combining(void)
|
||||
{
|
||||
- return __rm_ops.system_info.allow_write_combining;
|
||||
+ return __rm_ops->system_info.allow_write_combining;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
diff -urp work.orig/kernel/nvidia-uvm/uvm8_global.c work/kernel/nvidia-uvm/uvm8_global.c
|
||||
--- work.orig/kernel/nvidia-uvm/uvm8_global.c 2016-09-02 03:30:48.000000000 +0200
|
||||
+++ work/kernel/nvidia-uvm/uvm8_global.c 2016-09-13 01:43:42.647910744 +0200
|
||||
@@ -35,17 +35,17 @@
|
||||
#include "nv_uvm_interface.h"
|
||||
|
||||
uvm_global_t g_uvm_global;
|
||||
-static struct UvmOpsUvmEvents g_exported_uvm8_ops;
|
||||
+static struct UvmOpsUvmEvents g_exported_uvm8_ops = {
|
||||
+ .startDevice = NULL,
|
||||
+ .stopDevice = NULL,
|
||||
+ .isrTopHalf = uvm8_isr_top_half,
|
||||
+};
|
||||
static bool g_ops_registered = false;
|
||||
|
||||
static NV_STATUS uvm8_register_callbacks(void)
|
||||
{
|
||||
NV_STATUS status = NV_OK;
|
||||
|
||||
- g_exported_uvm8_ops.startDevice = NULL;
|
||||
- g_exported_uvm8_ops.stopDevice = NULL;
|
||||
- g_exported_uvm8_ops.isrTopHalf = uvm8_isr_top_half;
|
||||
-
|
||||
// Register the UVM callbacks with the main GPU driver:
|
||||
status = uvm_rm_locked_call(nvUvmInterfaceRegisterUvmCallbacks(&g_exported_uvm8_ops));
|
||||
if (status != NV_OK)
|
||||
diff -urp work.orig/kernel/nvidia-uvm/uvm8_gpu_semaphore.c work/kernel/nvidia-uvm/uvm8_gpu_semaphore.c
|
||||
--- work.orig/kernel/nvidia-uvm/uvm8_gpu_semaphore.c 2016-09-02 03:30:48.000000000 +0200
|
||||
+++ work/kernel/nvidia-uvm/uvm8_gpu_semaphore.c 2016-09-13 01:44:14.019909917 +0200
|
||||
@@ -352,7 +352,7 @@ NvU64 uvm_gpu_semaphore_get_gpu_va(uvm_g
|
||||
|
||||
NvU32 uvm_gpu_semaphore_get_payload(uvm_gpu_semaphore_t *semaphore)
|
||||
{
|
||||
- return ACCESS_ONCE(*semaphore->payload);
|
||||
+ return ACCESS_ONCE_RW(*semaphore->payload);
|
||||
}
|
||||
|
||||
void uvm_gpu_semaphore_set_payload(uvm_gpu_semaphore_t *semaphore, NvU32 payload)
|
||||
@@ -368,7 +368,7 @@ void uvm_gpu_semaphore_set_payload(uvm_g
|
||||
// being optimized out on non-SMP configs (we need them for interacting with
|
||||
// the GPU correctly even on non-SMP).
|
||||
mb();
|
||||
- ACCESS_ONCE(*semaphore->payload) = payload;
|
||||
+ ACCESS_ONCE_RW(*semaphore->payload) = payload;
|
||||
}
|
||||
|
||||
// This function is intended to catch channels which have been left dangling in
|
||||
diff -urp work.orig/kernel/nvidia-uvm/uvm8_hal.h work/kernel/nvidia-uvm/uvm8_hal.h
|
||||
--- work.orig/kernel/nvidia-uvm/uvm8_hal.h 2016-09-02 03:30:48.000000000 +0200
|
||||
+++ work/kernel/nvidia-uvm/uvm8_hal.h 2016-09-13 01:44:46.219909068 +0200
|
||||
@@ -316,7 +316,7 @@ typedef struct
|
||||
// fault_buffer_ops: id is a hardware class
|
||||
uvm_fault_buffer_hal_t fault_buffer_ops;
|
||||
} u;
|
||||
-} uvm_hal_class_ops_t;
|
||||
+} __do_const uvm_hal_class_ops_t;
|
||||
|
||||
// When UVM next support is enabled support for future chips in the hal is
|
||||
// enabled by providing additional hal table entries below.
|
||||
diff -urp work.orig/kernel/nvidia-uvm/uvm8_mmu.h work/kernel/nvidia-uvm/uvm8_mmu.h
|
||||
--- work.orig/kernel/nvidia-uvm/uvm8_mmu.h 2016-09-02 03:30:48.000000000 +0200
|
||||
+++ work/kernel/nvidia-uvm/uvm8_mmu.h 2016-09-13 01:45:09.119908464 +0200
|
||||
@@ -24,7 +24,6 @@
|
||||
#ifndef __UVM8_MMU_H__
|
||||
#define __UVM8_MMU_H__
|
||||
|
||||
-#include "uvm8_forward_decl.h"
|
||||
#include "uvm8_hal_types.h"
|
||||
#include "uvm8_pmm_gpu.h"
|
||||
#include "uvmtypes.h"
|
||||
diff -urp work.orig/kernel/nvidia-uvm/uvm_common.c work/kernel/nvidia-uvm/uvm_common.c
|
||||
--- work.orig/kernel/nvidia-uvm/uvm_common.c 2016-09-02 03:30:48.000000000 +0200
|
||||
+++ work/kernel/nvidia-uvm/uvm_common.c 2016-09-13 02:07:06.967873728 +0200
|
||||
@@ -51,7 +51,6 @@
|
||||
#define UVM_SPIN_LOOP_PRINT_TIMEOUT_SEC 30ULL
|
||||
|
||||
static dev_t g_uvmBaseDev;
|
||||
-struct UvmOpsUvmEvents g_exportedUvmOps;
|
||||
|
||||
static char* uvm_driver_mode = "8";
|
||||
|
||||
@@ -178,8 +177,10 @@ static NV_STATUS uvmSetupGpuProvider(voi
|
||||
{
|
||||
NV_STATUS status = NV_OK;
|
||||
|
||||
- g_exportedUvmOps.startDevice = uvm_gpu_event_start_device;
|
||||
- g_exportedUvmOps.stopDevice = uvm_gpu_event_stop_device;
|
||||
+ static struct UvmOpsUvmEvents g_exportedUvmOps = {
|
||||
+ .startDevice = uvm_gpu_event_start_device,
|
||||
+ .stopDevice = uvm_gpu_event_stop_device,
|
||||
+ };
|
||||
|
||||
// call RM to exchange the function pointers.
|
||||
status = nvUvmInterfaceRegisterUvmCallbacks(&g_exportedUvmOps);
|
||||
diff -urp work.orig/kernel/nvidia-uvm/uvm_full_fault_buffer.h work/kernel/nvidia-uvm/uvm_full_fault_buffer.h
|
||||
--- work.orig/kernel/nvidia-uvm/uvm_full_fault_buffer.h 2016-09-02 03:30:48.000000000 +0200
|
||||
+++ work/kernel/nvidia-uvm/uvm_full_fault_buffer.h 2016-09-13 02:14:43.967861682 +0200
|
||||
@@ -30,6 +30,7 @@
|
||||
#ifndef _UVM_FULL_FAULT_BUFFER_H_
|
||||
#define _UVM_FULL_FAULT_BUFFER_H_
|
||||
|
||||
+#include <linux/compiler.h>
|
||||
#include "uvmtypes.h"
|
||||
|
||||
#define MAXWELL_FAULT_BUFFER_A (0xb069)
|
||||
@@ -303,7 +304,7 @@ typedef struct
|
||||
NvUvmControlPrefetch_t controlPrefetch;
|
||||
NvUvmTestFaultBufferOverflow_t testFaultBufferOverflow;
|
||||
NvUvmClearFaultBufferOverflow_t clearFaultBufferOverflow;
|
||||
-} UvmFaultBufferOps;
|
||||
+} __no_const UvmFaultBufferOps;
|
||||
|
||||
/******************************************************************************
|
||||
uvmfull_fault_buffer_init
|
||||
diff -urp work.orig/kernel/nvidia-uvm/uvm_linux.h work/kernel/nvidia-uvm/uvm_linux.h
|
||||
--- work.orig/kernel/nvidia-uvm/uvm_linux.h 2016-09-02 03:30:48.000000000 +0200
|
||||
+++ work/kernel/nvidia-uvm/uvm_linux.h 2016-09-13 01:47:41.487904448 +0200
|
||||
@@ -420,7 +420,7 @@ static inline NvU64 NV_GETTIME(void)
|
||||
|
||||
// WRITE_ONCE/READ_ONCE have incompatible definitions across versions, which produces warnings.
|
||||
// Therefore, we define our own macros
|
||||
-#define UVM_WRITE_ONCE(x, val) (ACCESS_ONCE(x) = (val))
|
||||
+#define UVM_WRITE_ONCE(x, val) (ACCESS_ONCE_RW(x) = (val))
|
||||
#define UVM_READ_ONCE(x) ACCESS_ONCE(x)
|
||||
|
||||
// Added in 3.11
|
@ -0,0 +1,11 @@
|
||||
--- a/nvidia-application-profiles-370.28-rc
|
||||
+++ b/nvidia-application-profiles-370.28-rc
|
||||
@@ -44,7 +44,7 @@
|
||||
{
|
||||
"name" : "NamedVertexAttributesApplyDivisor",
|
||||
"settings" : [ "GL23cd0e", 1 ]
|
||||
- },
|
||||
+ }
|
||||
],
|
||||
"rules" : [
|
||||
{
|
@ -0,0 +1,8 @@
|
||||
# run-time configuration file for /etc/init.d/nvidia-persistenced
|
||||
|
||||
# NVPD_USER: The user nvidia-persistenced is intended to run for
|
||||
NVPD_USER=""
|
||||
|
||||
# ARGS: Additional arguments to set the default persistence mode
|
||||
# (see nvidia-persistenced(1))
|
||||
ARGS=""
|
25
x11-drivers/nvidia-drivers/files/nvidia-persistenced.init
Normal file
25
x11-drivers/nvidia-drivers/files/nvidia-persistenced.init
Normal file
@ -0,0 +1,25 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2014 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
pidfile="/var/run/nvidia-persistenced/nvidia-persistenced.pid"
|
||||
|
||||
start() {
|
||||
if ! [ "${NVPD_USER}x" = x ]; then
|
||||
ebegin "Starting nvidia-persistenced for ${NVPD_USER}"
|
||||
NVPD_USER_ARG="--user ${NVPD_USER}"
|
||||
else
|
||||
ebegin "Starting nvidia-persistenced"
|
||||
fi
|
||||
start-stop-daemon --start --quiet --pidfile ${pidfile} \
|
||||
--background --exec /opt/bin/nvidia-persistenced \
|
||||
-- ${NVPD_USER_ARG} ${ARGS}
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping nvidia-persistenced"
|
||||
start-stop-daemon --stop --quiet --pidfile ${pidfile}
|
||||
eend $?
|
||||
}
|
3
x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf
Normal file
3
x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf
Normal file
@ -0,0 +1,3 @@
|
||||
# Nvidia UVM support
|
||||
|
||||
remove nvidia modprobe -r --ignore-remove nvidia-modeset nvidia-uvm nvidia
|
7
x11-drivers/nvidia-drivers/files/nvidia-settings.desktop
Normal file
7
x11-drivers/nvidia-drivers/files/nvidia-settings.desktop
Normal file
@ -0,0 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=NVIDIA X Server Settings
|
||||
Comment=Configure NVIDIA X Server Settings
|
||||
Exec=/usr/bin/nvidia-settings
|
||||
Icon=nvidia-settings
|
||||
Categories=System;Settings;
|
25
x11-drivers/nvidia-drivers/files/nvidia-smi.init
Normal file
25
x11-drivers/nvidia-drivers/files/nvidia-smi.init
Normal file
@ -0,0 +1,25 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
pidfile="/run/nvidia-smi.pid"
|
||||
|
||||
depend() {
|
||||
after modules
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting NVIDIA System Management Interface"
|
||||
rm -f ${pidfile}
|
||||
start-stop-daemon --start --quiet --pidfile ${pidfile} \
|
||||
--make-pidfile --background --exec /opt/bin/nvidia-smi -- \
|
||||
-q -l 300
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping NVIDIA System Management Interface"
|
||||
start-stop-daemon --stop --quiet --pidfile ${pidfile}
|
||||
eend $?
|
||||
}
|
20
x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r1
Normal file
20
x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r1
Normal file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Invalid args" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
add|ADD)
|
||||
#hopefully this prevents infinite loops like bug #454740
|
||||
if lsmod | grep -iq nvidia; then
|
||||
/opt/bin/nvidia-smi > /dev/null
|
||||
fi
|
||||
;;
|
||||
remove|REMOVE)
|
||||
rm -f /dev/nvidia*
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
6
x11-drivers/nvidia-drivers/files/nvidia.udev-rule
Normal file
6
x11-drivers/nvidia-drivers/files/nvidia.udev-rule
Normal file
@ -0,0 +1,6 @@
|
||||
ACTION=="add", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}"
|
||||
# Previously the ACTION was "add|remove" but one user on bug #376527 had a
|
||||
# problem until he recompiled udev-171-r5, which is one of the versions I
|
||||
# tested with and it was fine. I'm breaking the rules out just to be safe
|
||||
# so someone else doesn't have an issue
|
||||
ACTION=="remove", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}"
|
552
x11-drivers/nvidia-drivers/nvidia-drivers-370.28-r1.ebuild
Normal file
552
x11-drivers/nvidia-drivers/nvidia-drivers-370.28-r1.ebuild
Normal file
@ -0,0 +1,552 @@
|
||||
# Copyright 1999-2016 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
EAPI=5
|
||||
|
||||
inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
|
||||
portability toolchain-funcs unpacker user udev
|
||||
|
||||
NV_URI="http://us.download.nvidia.com/XFree86/"
|
||||
X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
|
||||
AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
|
||||
ARM_NV_PACKAGE="NVIDIA-Linux-armv7l-gnueabihf-${PV}"
|
||||
X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
|
||||
AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
|
||||
|
||||
DESCRIPTION="NVIDIA Accelerated Graphics Driver"
|
||||
HOMEPAGE="http://www.nvidia.com/ http://www.nvidia.com/Download/Find.aspx"
|
||||
SRC_URI="
|
||||
amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
|
||||
amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
|
||||
arm? ( ${NV_URI}Linux-x86-ARM/${PV}/${ARM_NV_PACKAGE}.run )
|
||||
x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
|
||||
x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
|
||||
tools? ( ftp://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-${PV}.tar.bz2 )
|
||||
"
|
||||
|
||||
LICENSE="GPL-2 NVIDIA-r2"
|
||||
SLOT="0/${PV%.*}"
|
||||
KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
|
||||
RESTRICT="bindist mirror"
|
||||
EMULTILIB_PKG="true"
|
||||
|
||||
IUSE="acpi compat +driver gtk3 kernel_FreeBSD kernel_linux +kms multilib pax_kernel static-libs +tools uvm wayland +X"
|
||||
REQUIRED_USE="
|
||||
tools? ( X )
|
||||
static-libs? ( tools )
|
||||
"
|
||||
|
||||
COMMON="
|
||||
app-eselect/eselect-opencl
|
||||
kernel_linux? ( >=sys-libs/glibc-2.6.1 )
|
||||
tools? (
|
||||
dev-libs/atk
|
||||
dev-libs/glib:2
|
||||
dev-libs/jansson
|
||||
gtk3? ( x11-libs/gtk+:3 )
|
||||
x11-libs/cairo
|
||||
x11-libs/gdk-pixbuf[X]
|
||||
x11-libs/gtk+:2
|
||||
x11-libs/libX11
|
||||
x11-libs/libXext
|
||||
x11-libs/libXrandr
|
||||
x11-libs/libXv
|
||||
x11-libs/libXxf86vm
|
||||
x11-libs/pango[X]
|
||||
)
|
||||
X? (
|
||||
>=app-eselect/eselect-opengl-1.0.9
|
||||
app-misc/pax-utils
|
||||
)
|
||||
"
|
||||
DEPEND="
|
||||
${COMMON}
|
||||
kernel_linux? ( virtual/linux-sources )
|
||||
"
|
||||
RDEPEND="
|
||||
${COMMON}
|
||||
acpi? ( sys-power/acpid )
|
||||
tools? ( !media-video/nvidia-settings )
|
||||
wayland? ( dev-libs/wayland )
|
||||
X? (
|
||||
<x11-base/xorg-server-1.18.99:=
|
||||
>=x11-libs/libvdpau-1.0
|
||||
multilib? (
|
||||
>=x11-libs/libX11-1.6.2[abi_x86_32]
|
||||
>=x11-libs/libXext-1.3.2[abi_x86_32]
|
||||
)
|
||||
)
|
||||
"
|
||||
|
||||
QA_PREBUILT="opt/* usr/lib*"
|
||||
|
||||
S=${WORKDIR}/
|
||||
|
||||
pkg_pretend() {
|
||||
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 && kernel_is ge 4 8; then
|
||||
ewarn "Gentoo supports kernels which are supported by NVIDIA"
|
||||
ewarn "which are limited to the following kernels:"
|
||||
ewarn "<sys-kernel/gentoo-sources-4.8"
|
||||
ewarn "<sys-kernel/vanilla-sources-4.8"
|
||||
ewarn ""
|
||||
ewarn "You are free to utilize epatch_user to provide whatever"
|
||||
ewarn "support you feel is appropriate, but will not receive"
|
||||
ewarn "support as a result of those changes."
|
||||
ewarn ""
|
||||
ewarn "Do not file a bug report about this."
|
||||
ewarn ""
|
||||
fi
|
||||
|
||||
# Since Nvidia ships many 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
|
||||
|
||||
# Kernel features/options to check for
|
||||
CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
|
||||
use x86 && CONFIG_CHECK+=" ~HIGHMEM"
|
||||
|
||||
# Now do the above checks
|
||||
use kernel_linux && check_extra_config
|
||||
}
|
||||
|
||||
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 driver && use kernel_linux; then
|
||||
MODULE_NAMES="nvidia(video:${S}/kernel)"
|
||||
use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel)"
|
||||
use kms && MODULE_NAMES+=" nvidia-modeset(video:${S}/kernel) nvidia-drm(video:${S}/kernel)"
|
||||
|
||||
# This needs to run after MODULE_NAMES (so that the eclass checks
|
||||
# whether the kernel supports loadable modules) but before BUILD_PARAMS
|
||||
# is set (so that KV_DIR is populated).
|
||||
linux-mod_pkg_setup
|
||||
|
||||
BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
|
||||
SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC) NV_VERBOSE=1"
|
||||
|
||||
# linux-mod_src_compile calls set_arch_to_kernel, which
|
||||
# sets the ARCH to x86 but NVIDIA's wrapping Makefile
|
||||
# expects x86_64 or i386 and then converts it to x86
|
||||
# later on in the build process
|
||||
BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
|
||||
fi
|
||||
|
||||
if use kernel_linux && kernel_is lt 2 6 9; then
|
||||
eerror "You must build this against 2.6.9 or higher kernels."
|
||||
fi
|
||||
|
||||
# set variables to where files are in the package structure
|
||||
if use kernel_FreeBSD; then
|
||||
use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
|
||||
use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
|
||||
NV_DOC="${S}/doc"
|
||||
NV_OBJ="${S}/obj"
|
||||
NV_SRC="${S}/src"
|
||||
NV_MAN="${S}/x11/man"
|
||||
NV_X11="${S}/obj"
|
||||
NV_SOVER=1
|
||||
elif use kernel_linux; then
|
||||
NV_DOC="${S}"
|
||||
NV_OBJ="${S}"
|
||||
NV_SRC="${S}/kernel"
|
||||
NV_MAN="${S}"
|
||||
NV_X11="${S}"
|
||||
NV_SOVER=${PV}
|
||||
else
|
||||
die "Could not determine proper NVIDIA package"
|
||||
fi
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
epatch "${FILESDIR}"/${P}-profiles-rc.patch
|
||||
|
||||
if use pax_kernel; then
|
||||
ewarn "Using PAX patches is not supported. You will be asked to"
|
||||
ewarn "use a standard kernel should you have issues. Should you"
|
||||
ewarn "need support with these patches, contact the PaX team."
|
||||
epatch "${FILESDIR}"/${PN}-370.28-pax.patch
|
||||
fi
|
||||
|
||||
# Allow user patches so they can support RC kernels and whatever else
|
||||
epatch_user
|
||||
}
|
||||
|
||||
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 kernel_FreeBSD; then
|
||||
MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
|
||||
LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
|
||||
elif use driver && use kernel_linux; then
|
||||
MAKEOPTS=-j1 linux-mod_src_compile
|
||||
fi
|
||||
|
||||
if use tools; then
|
||||
emake -C "${S}"/nvidia-settings-${PV}/src \
|
||||
AR="$(tc-getAR)" \
|
||||
CC="$(tc-getCC)" \
|
||||
LIBDIR="$(get_libdir)" \
|
||||
NV_VERBOSE=1 \
|
||||
RANLIB="$(tc-getRANLIB)" \
|
||||
DO_STRIP= \
|
||||
build-xnvctrl
|
||||
|
||||
emake -C "${S}"/nvidia-settings-${PV}/src \
|
||||
CC="$(tc-getCC)" \
|
||||
GTK3_AVAILABLE=$(usex gtk3 1 0) \
|
||||
LD="$(tc-getCC)" \
|
||||
LIBDIR="$(get_libdir)" \
|
||||
NVML_ENABLED=0 \
|
||||
NV_USE_BUNDLED_LIBJANSSON=0 \
|
||||
NV_VERBOSE=1 \
|
||||
DO_STRIP=
|
||||
fi
|
||||
}
|
||||
|
||||
# Install nvidia library:
|
||||
# the first parameter is the library to install
|
||||
# the second parameter is the provided soversion
|
||||
# the third parameter is the target directory if it is not /usr/lib
|
||||
donvidia() {
|
||||
# Full path to library
|
||||
nv_LIB="${1}"
|
||||
|
||||
# SOVER to use
|
||||
nv_SOVER="$(scanelf -qF'%S#F' ${nv_LIB})"
|
||||
|
||||
# Where to install
|
||||
nv_DEST="${2}"
|
||||
|
||||
# Get just the library name
|
||||
nv_LIBNAME=$(basename "${nv_LIB}")
|
||||
|
||||
if [[ "${nv_DEST}" ]]; then
|
||||
exeinto ${nv_DEST}
|
||||
action="doexe"
|
||||
else
|
||||
nv_DEST="/usr/$(get_libdir)"
|
||||
action="dolib.so"
|
||||
fi
|
||||
|
||||
# Install the library
|
||||
${action} ${nv_LIB} || die "failed to install ${nv_LIBNAME}"
|
||||
|
||||
# If the library has a SONAME and SONAME does not match the library name,
|
||||
# then we need to create a symlink
|
||||
if [[ ${nv_SOVER} ]] && ! [[ "${nv_SOVER}" = "${nv_LIBNAME}" ]]; then
|
||||
dosym ${nv_LIBNAME} ${nv_DEST}/${nv_SOVER} \
|
||||
|| die "failed to create ${nv_DEST}/${nv_SOVER} symlink"
|
||||
fi
|
||||
|
||||
dosym ${nv_LIBNAME} ${nv_DEST}/${nv_LIBNAME/.so*/.so} \
|
||||
|| die "failed to create ${nv_LIBNAME/.so*/.so} symlink"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
if use driver && use kernel_linux; then
|
||||
linux-mod_src_install
|
||||
|
||||
# Add the aliases
|
||||
# This file is tweaked with the appropriate video group in
|
||||
# pkg_preinst, see bug #491414
|
||||
insinto /etc/modprobe.d
|
||||
newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
|
||||
doins "${FILESDIR}"/nvidia-rmmod.conf
|
||||
|
||||
# Ensures that our device nodes are created when not using X
|
||||
exeinto "$(get_udevdir)"
|
||||
newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
|
||||
udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
|
||||
elif use kernel_FreeBSD; then
|
||||
if use x86-fbsd; then
|
||||
insinto /boot/modules
|
||||
doins "${S}/src/nvidia.kld"
|
||||
fi
|
||||
|
||||
exeinto /boot/modules
|
||||
doexe "${S}/src/nvidia.ko"
|
||||
fi
|
||||
|
||||
# NVIDIA kernel <-> userspace driver config lib
|
||||
donvidia ${NV_OBJ}/libnvidia-cfg.so.${NV_SOVER}
|
||||
|
||||
# NVIDIA framebuffer capture library
|
||||
donvidia ${NV_OBJ}/libnvidia-fbc.so.${NV_SOVER}
|
||||
|
||||
# NVIDIA video encode/decode <-> CUDA
|
||||
if use kernel_linux; then
|
||||
donvidia ${NV_OBJ}/libnvcuvid.so.${NV_SOVER}
|
||||
donvidia ${NV_OBJ}/libnvidia-encode.so.${NV_SOVER}
|
||||
fi
|
||||
|
||||
if use X; then
|
||||
# Xorg DDX driver
|
||||
insinto /usr/$(get_libdir)/xorg/modules/drivers
|
||||
doins ${NV_X11}/nvidia_drv.so
|
||||
|
||||
# Xorg GLX driver
|
||||
donvidia ${NV_X11}/libglx.so.${NV_SOVER} \
|
||||
/usr/$(get_libdir)/opengl/nvidia/extensions
|
||||
|
||||
# Xorg nvidia.conf
|
||||
if has_version '>=x11-base/xorg-server-1.16'; then
|
||||
insinto /usr/share/X11/xorg.conf.d
|
||||
newins {,50-}nvidia-drm-outputclass.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# OpenCL ICD for NVIDIA
|
||||
if use kernel_linux; then
|
||||
insinto /etc/OpenCL/vendors
|
||||
doins ${NV_OBJ}/nvidia.icd
|
||||
fi
|
||||
|
||||
# Documentation
|
||||
dohtml ${NV_DOC}/html/*
|
||||
if use kernel_FreeBSD; then
|
||||
dodoc "${NV_DOC}/README"
|
||||
use X && doman "${NV_MAN}/nvidia-xconfig.1"
|
||||
use tools && doman "${NV_MAN}/nvidia-settings.1"
|
||||
else
|
||||
# Docs
|
||||
newdoc "${NV_DOC}/README.txt" README
|
||||
dodoc "${NV_DOC}/NVIDIA_Changelog"
|
||||
doman "${NV_MAN}/nvidia-smi.1.gz"
|
||||
use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
|
||||
use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
|
||||
doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
|
||||
fi
|
||||
|
||||
# Helper Apps
|
||||
exeinto /opt/bin/
|
||||
|
||||
if use X; then
|
||||
doexe ${NV_OBJ}/nvidia-xconfig
|
||||
fi
|
||||
|
||||
if use kernel_linux; then
|
||||
doexe ${NV_OBJ}/nvidia-cuda-mps-control
|
||||
doexe ${NV_OBJ}/nvidia-cuda-mps-server
|
||||
doexe ${NV_OBJ}/nvidia-debugdump
|
||||
doexe ${NV_OBJ}/nvidia-persistenced
|
||||
doexe ${NV_OBJ}/nvidia-smi
|
||||
|
||||
# install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
|
||||
doexe ${NV_OBJ}/nvidia-modprobe
|
||||
fowners root:video /opt/bin/nvidia-modprobe
|
||||
fperms 4710 /opt/bin/nvidia-modprobe
|
||||
dosym /{opt,usr}/bin/nvidia-modprobe
|
||||
|
||||
doman nvidia-cuda-mps-control.1.gz
|
||||
doman nvidia-modprobe.1.gz
|
||||
doman nvidia-persistenced.1.gz
|
||||
newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
|
||||
newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
|
||||
newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
|
||||
fi
|
||||
|
||||
if use tools; then
|
||||
emake -C "${S}"/nvidia-settings-${PV}/src/ \
|
||||
DESTDIR="${D}" \
|
||||
GTK3_AVAILABLE=$(usex gtk3 1 0) \
|
||||
LIBDIR="${D}/usr/$(get_libdir)" \
|
||||
NV_USE_BUNDLED_LIBJANSSON=0 \
|
||||
NV_VERBOSE=1 \
|
||||
PREFIX=/usr \
|
||||
DO_STRIP= \
|
||||
install
|
||||
|
||||
if use static-libs; then
|
||||
dolib.a "${S}"/nvidia-settings-${PV}/src/libXNVCtrl/libXNVCtrl.a
|
||||
|
||||
insinto /usr/include/NVCtrl
|
||||
doins "${S}"/nvidia-settings-${PV}/src/libXNVCtrl/*.h
|
||||
fi
|
||||
|
||||
insinto /usr/share/nvidia/
|
||||
doins nvidia-application-profiles-${PV}-key-documentation
|
||||
|
||||
insinto /etc/nvidia
|
||||
newins \
|
||||
nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
|
||||
|
||||
# There is no icon in the FreeBSD tarball.
|
||||
use kernel_FreeBSD || \
|
||||
doicon ${NV_OBJ}/nvidia-settings.png
|
||||
|
||||
domenu "${FILESDIR}"/nvidia-settings.desktop
|
||||
|
||||
exeinto /etc/X11/xinit/xinitrc.d
|
||||
newexe "${FILESDIR}"/95-nvidia-settings-r1 95-nvidia-settings
|
||||
|
||||
insinto /etc/vulkan/icd.d
|
||||
doins nvidia_icd.json
|
||||
fi
|
||||
|
||||
dobin ${NV_OBJ}/nvidia-bug-report.sh
|
||||
|
||||
if has_multilib_profile && use multilib; then
|
||||
local OABI=${ABI}
|
||||
for ABI in $(get_install_abis); do
|
||||
src_install-libs
|
||||
done
|
||||
ABI=${OABI}
|
||||
unset OABI
|
||||
else
|
||||
src_install-libs
|
||||
fi
|
||||
|
||||
is_final_abi || die "failed to iterate through all ABIs"
|
||||
|
||||
readme.gentoo_create_doc
|
||||
}
|
||||
|
||||
src_install-libs() {
|
||||
local inslibdir=$(get_libdir)
|
||||
local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
|
||||
local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
|
||||
local libdir=${NV_OBJ}
|
||||
|
||||
if use kernel_linux && has_multilib_profile && [[ ${ABI} == "x86" ]]; then
|
||||
libdir=${NV_OBJ}/32
|
||||
fi
|
||||
|
||||
if use X; then
|
||||
NV_GLX_LIBRARIES=(
|
||||
"libEGL.so.1 ${GL_ROOT}"
|
||||
"libEGL_nvidia.so.${NV_SOVER} ${GL_ROOT}"
|
||||
"libGL.so.$(usex compat ${NV_SOVER} 1.0.0) ${GL_ROOT}"
|
||||
"libGLESv1_CM.so.1 ${GL_ROOT}"
|
||||
"libGLESv1_CM_nvidia.so.${NV_SOVER} ${GL_ROOT}"
|
||||
"libGLESv2.so.2 ${GL_ROOT}"
|
||||
"libGLESv2_nvidia.so.${NV_SOVER} ${GL_ROOT}"
|
||||
"libGLX.so.0 ${GL_ROOT}"
|
||||
"libGLX_nvidia.so.${NV_SOVER} ${GL_ROOT}"
|
||||
"libGLdispatch.so.0 ${GL_ROOT}"
|
||||
"libOpenCL.so.1.0.0 ${CL_ROOT}"
|
||||
"libOpenGL.so.0 ${GL_ROOT}"
|
||||
"libcuda.so.${NV_SOVER}"
|
||||
"libnvcuvid.so.${NV_SOVER}"
|
||||
"libnvidia-compiler.so.${NV_SOVER}"
|
||||
"libnvidia-eglcore.so.${NV_SOVER}"
|
||||
"libnvidia-encode.so.${NV_SOVER}"
|
||||
"libnvidia-fatbinaryloader.so.${NV_SOVER}"
|
||||
"libnvidia-fbc.so.${NV_SOVER}"
|
||||
"libnvidia-glcore.so.${NV_SOVER}"
|
||||
"libnvidia-glsi.so.${NV_SOVER}"
|
||||
"libnvidia-ifr.so.${NV_SOVER}"
|
||||
"libnvidia-opencl.so.${NV_SOVER}"
|
||||
"libnvidia-ptxjitcompiler.so.${NV_SOVER}"
|
||||
"libvdpau_nvidia.so.${NV_SOVER}"
|
||||
)
|
||||
|
||||
if use wayland && has_multilib_profile && [[ ${ABI} == "amd64" ]];
|
||||
then
|
||||
NV_GLX_LIBRARIES+=(
|
||||
"libnvidia-egl-wayland.so.${NV_SOVER}"
|
||||
)
|
||||
fi
|
||||
|
||||
if use kernel_linux && has_multilib_profile && [[ ${ABI} == "amd64" ]];
|
||||
then
|
||||
NV_GLX_LIBRARIES+=(
|
||||
"libnvidia-wfb.so.${NV_SOVER}"
|
||||
)
|
||||
fi
|
||||
|
||||
if use kernel_FreeBSD; then
|
||||
NV_GLX_LIBRARIES+=(
|
||||
"libnvidia-tls.so.${NV_SOVER}"
|
||||
)
|
||||
fi
|
||||
|
||||
if use kernel_linux; then
|
||||
NV_GLX_LIBRARIES+=(
|
||||
"libnvidia-ml.so.${NV_SOVER}"
|
||||
"tls/libnvidia-tls.so.${NV_SOVER}"
|
||||
)
|
||||
fi
|
||||
|
||||
for NV_LIB in "${NV_GLX_LIBRARIES[@]}"; do
|
||||
donvidia ${libdir}/${NV_LIB}
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_preinst() {
|
||||
if use driver && use kernel_linux; then
|
||||
linux-mod_pkg_preinst
|
||||
|
||||
local 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"
|
||||
else
|
||||
sed -i \
|
||||
-e "s:PACKAGE:${PF}:g" \
|
||||
-e "s:VIDEOGID:${videogroup}:" \
|
||||
"${D}"/etc/modprobe.d/nvidia.conf || die
|
||||
fi
|
||||
fi
|
||||
|
||||
# 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() {
|
||||
use driver && use kernel_linux && linux-mod_pkg_postinst
|
||||
|
||||
# Switch to the nvidia implementation
|
||||
use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
|
||||
"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
|
||||
|
||||
readme.gentoo_print_elog
|
||||
|
||||
if ! use X; then
|
||||
elog "You have elected to not install the X.org driver. Along with"
|
||||
elog "this the OpenGL libraries and VDPAU libraries were not"
|
||||
elog "installed. Additionally, once the driver is loaded your card"
|
||||
elog "and fan will run at max speed which may not be desirable."
|
||||
elog "Use the 'nvidia-smi' init script to have your card and fan"
|
||||
elog "speed scale appropriately."
|
||||
elog
|
||||
fi
|
||||
if ! use tools; then
|
||||
elog "USE=tools controls whether the nvidia-settings application"
|
||||
elog "is installed. If you would like to use it, enable that"
|
||||
elog "flag and re-emerge this ebuild. Optionally you can install"
|
||||
elog "media-video/nvidia-settings"
|
||||
elog
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_prerm() {
|
||||
use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
|
||||
}
|
||||
|
||||
pkg_postrm() {
|
||||
use driver && use kernel_linux && linux-mod_pkg_postrm
|
||||
use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
|
||||
}
|
Loading…
Reference in New Issue
Block a user