Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] nvidia-drivers without mesa installed
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Marcih
Apprentice
Apprentice


Joined: 19 Feb 2018
Posts: 213

PostPosted: Tue Oct 06, 2020 1:39 pm    Post subject: [SOLVED] nvidia-drivers without mesa installed Reply with quote

Not wanting to hijack a pre-existing thread and posting this one in the Unsupported Software forum, knowing full well the old adage "if it breaks, you get to keep the pieces".
I'm trying to get out of compiling media-libs/mesa since its usage is very limited in my proprietary Nvidia driver setup (and also because nothing has broken in my Gentoo install in a good while ;)). I've done as the linked thread suggested: put mesa in package.provided, made sure I have libglvnd emerged and manually copied /usr/include/GL/internal/dri_interface.h from mesa before depcleaning. I have three packages in @preserved-rebuild:
Code:
!!! existing preserved libs:
>>> package: media-libs/mesa-20.1.8
 *  - /usr/lib64/libgbm.so.1
 *  - /usr/lib64/libgbm.so.1.0.0
 *      used by /usr/bin/qemu-system-arm (app-emulation/qemu-5.1.0-r1)
 *      used by /usr/bin/qemu-system-i386 (app-emulation/qemu-5.1.0-r1)
 *      used by /usr/bin/qemu-system-x86_64 (app-emulation/qemu-5.1.0-r1)
 *      used by 2 other files
 *  - /usr/lib/libgbm.so.1
 *  - /usr/lib/libgbm.so.1.0.0
 *      used by /usr/lib/libgstgl-1.0.so.0.1602.0 (media-libs/gst-plugins-base-1.16.2)
Use emerge @preserved-rebuild to rebuild packages using these libraries

# emerge -av @preserved-rebuild

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] media-libs/gst-plugins-base-1.16.2:1.0::gentoo  USE="X alsa egl introspection nls ogg opengl orc pango theora vorbis -gbm -gles2 -ivorbis -wayland" ABI_X86="32 (64) (-x32)" 0 KiB
[ebuild   R    ] x11-base/xorg-server-1.20.8-r1:0/1.20.8::gentoo  USE="elogind (libglvnd) udev xorg -debug -dmx -doc -ipv6 -kdrive -libressl -minimal (-selinux) -static-libs -suid -systemd -unwind -wayland -xcsecurity -xephyr -xnest -xvfb" 0 KiB
[ebuild   R    ] app-emulation/qemu-5.1.0-r1::gentoo  USE="aio alsa bzip2 caps curl fdt filecaps gtk jpeg ncurses nls opengl oss pin-upstream-blobs png pulseaudio sdl seccomp slirp usb vhost-net vnc xattr xkb -accessibility (-capstone) -debug -doc -glusterfs -gnutls -infiniband -io-uring -iscsi -jack -jemalloc -lzo -multipath -nfs -numa -plugins -python -rbd -sasl -sdl-image (-selinux) -smartcard -snappy -spice -ssh -static -static-user -systemtap -tci -test -usbredir -vde -vhost-user-fs -virgl -virtfs -vte -xen -xfs -zstd" PYTHON_TARGETS="python3_7 -python3_6 -python3_8" QEMU_SOFTMMU_TARGETS="arm i386 x86_64 -aarch64 -alpha -avr -cris -hppa -lm32 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -moxie -nios2 -or1k -ppc -ppc64 -riscv32 -riscv64 -rx -s390x -sh4 -sh4eb -sparc -sparc64 -tricore -unicore32 -xtensa -xtensaeb" QEMU_USER_TARGETS="-aarch64 -aarch64_be -alpha -arm -armeb -cris -hppa -i386 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -mipsn32 -mipsn32el -nios2 -or1k -ppc -ppc64 -ppc64abi32 -ppc64le -riscv32 -riscv64 -s390x -sh4 -sh4eb -sparc -sparc32plus -sparc64 -tilegx -x86_64 -xtensa -xtensaeb" 0 KiB

Total: 3 packages (3 reinstalls), Size of downloads: 0 KiB

gst-plugins-base rebuilds fine, Xorg and QEMU complain about missing package 'dri' and "opengl (mesa) devel pkgs: epoxy gbm" respectively. Any way I could proceed?
_________________
Bones McCracker wrote:
It wouldn't be so bad, if it didn't suck.

NeddySeagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.


Last edited by Marcih on Tue Oct 06, 2020 4:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2727

PostPosted: Tue Oct 06, 2020 3:42 pm    Post subject: Reply with quote

mesa's libgbm can't be used by nvidia-drivers as-is either way, so any USE that require it may as well be turned off.

qemu+virgl also can't be used with nvidia-drivers (even with mesa installed, it builds but won't be usable last I know of), so I just USE=-opengl on qemu and use gpu passthrough if need hardware acceleration (I much prefer this either way).

my no-mesa xorg-server only has USE="minimal udev xorg xvfb" (everything else disabled), and EXTRA_ECONF="--enable-glx" from package.env (minimal disable all the dri stuff nvidia doesn't need but unfortunately also disables glx which is needed)

Update: this is an old post and I don't really recommend any of this -- also nowadays nvidia /can/ use gbm and needs mesa for it -- also xorg ebuilds use meson now, so EXTRA_ECONF needs updating


Last edited by Ionen on Tue May 24, 2022 10:09 pm; edited 2 times in total
Back to top
View user's profile Send private message
Marcih
Apprentice
Apprentice


Joined: 19 Feb 2018
Posts: 213

PostPosted: Tue Oct 06, 2020 4:12 pm    Post subject: Reply with quote

Ionen wrote:
mesa's libgbm can't be used by nvidia-drivers either way, so any USE that require it may as well be turned off.

qemu+virgl notably can't be used with nvidia-drivers (even with mesa installed, it builds but won't be usable last I know of), so I just USE=-opengl on qemu and use gpu passthrough as needed
I was wondering whether I could turn off the flags, thanks for confirming that. I don't need OpenGL for QEMU (I think?) since I don't use it for anything graphics-intensive and I didn't even notice it was on, I didn't explicitly enable it, I only have USE="opengl" in my make.conf so I forgot about it.
Ionen wrote:
my no-mesa xorg-server only has USE="minimal udev xorg xvfb" (everything else disabled), and EXTRA_ECONF="--enable-glx" from package.env (minimal disable all the dri stuff nvidia doesn't need but unfortunately also disables glx which is needed)
Again, thanks for the tip. I added USE="minimal xvfb" to x11-base/xorg-server and added the line to compile with GLX to my package.env, everything compiles and works as expected (so far). I no longer have mesa installed nor do I need to compile it - not that I would be shaving off much time since it takes about 3 minutes to compile while I have Rust, Clang, LLVM, Firefox, Thunderbird and LibreOffice all sitting there menacingly, waiting for another revbump to ruin my update day. :D
_________________
Bones McCracker wrote:
It wouldn't be so bad, if it didn't suck.

NeddySeagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2727

PostPosted: Tue Oct 06, 2020 4:19 pm    Post subject: Reply with quote

Nice to hear it works.

Someday maybe gentoo will support this layout with a virtual/glvendor or something to replace mesa, but it affects just so many things (around ~1000 packages that depend on mesa and/or virtual/opengl) that I don't imagine it has any chances to happen in a foreseeable future.

For others: don't try this at home, as OP mentioned, keep the pieces when it breaks :)
Back to top
View user's profile Send private message
Marcih
Apprentice
Apprentice


Joined: 19 Feb 2018
Posts: 213

PostPosted: Wed Oct 07, 2020 11:25 am    Post subject: Reply with quote

Ionen wrote:
Someday maybe gentoo will support this layout with a virtual/glvendor or something to replace mesa, but it affects just so many things (around ~1000 packages that depend on mesa and/or virtual/opengl) that I don't imagine it has any chances to happen in a foreseeable future.
Doubt it. Any mention of deviation from upstream or anything resembling that and you'll summon astrum and his passive-aggressive whining. ;)

Either way, I'm wondering whether I could automate the copying of the missing header from mesa without copy the ebuild to a local overlay and editing it - after all, I expect the header to change at some point... Would it be possible to write a user patch in /etc/portage/patches/x11-drivers/nvidia-drivers to do this? Or maybe a cron job checking if nvidia-drivers is installed (as to not interfere in case I re-install mesa and forget about the script), fetching mesa source, extracting into /tmp and copying the file? I'll have to try that one of these days...
_________________
Bones McCracker wrote:
It wouldn't be so bad, if it didn't suck.

NeddySeagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2727

PostPosted: Wed Oct 07, 2020 11:34 am    Post subject: Reply with quote

Considering DRI doesn't get used, the header being up-to-date is likely unimportant as long as xorg doesn't fail to build.

Personally I have a lazy /etc/portage/patches/x11-base/xorg-server patch to add the header inside xorg's source rather than install it, e.g.
Code:
--- a/include/GL/internal/dri_interface.h       1969-12-31 19:00:00.000000000 -0500
+++ b/include/GL/internal/dri_interface.h       2020-03-07 18:50:48.214528935 -0500
[...]
The more adequate fix would be to fix xorg to not require it (pretty sure that can work if using nvidia-only), but I haven't looked into it much.

Edit: Before libglvnd was in gentoo to provide (most) headers, I used to wish mesa would have USE=headers-only. Even back then no mesa was possible at run time but then you had no headers to build things.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum