Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
nvidia xorg without mesa
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
stefan11111
l33t
l33t


Joined: 29 Jan 2023
Posts: 922
Location: Romania

PostPosted: Fri Feb 16, 2024 8:36 pm    Post subject: nvidia xorg without mesa Reply with quote

There are multiple ways of using a nvidia gpu on linux.
There are the nouveau drivers and the proprietary drivers.
This guide is for users of the proprietary drivers.

I have tried using the open source drivers too, but I've had problems with hw accel, which is a deal-breaker for me.

The proprietary nvidia drivers already have their own implementations of everything in mesa.
You can see for yourself by running:
Code:

$ equery f nvidia-drivers | grep lib | grep so

If you don't use steam and such, the process of using xorg without mesa is quite simple:
Enable USE="minimal" on xorg-server.
Disable USE="dri" on mpv, if you use it.
Rebuild and emerge -cav.
And that should be it.

I use steam, which requires xorg built with glx, and for which the process is a bit more involved.
Enable USE="minimal" on xorg-server.
Disable USE="dri" on mpv, if you use it.
Create the text file /etc/portage/env/x11-base/xorg-server, if it doesn't exist.
Add:
Code:

MYMESONARGS="-Dglx=true"

to the file /etc/portage/env/x11-base/xorg-server.

After doing this, you will have to install this header:
https://github.com/stefan11111/dri_interface.h

I have an ebuild for it here, but you can install it any other way you like:
https://github.com/stefan11111/stefan_overlay/blob/main/x11-base/xorg-dri-interface/xorg-dri-interface-1.0.ebuild

After doing this, you will have to put this patch in /etc/portage/patches/x11-base/xorg-server/<whatever you want>.patch :
Code:

diff --git a/glx/meson.build b/glx/meson.build
index 2ec00ce..18d3f41 100644
--- a/glx/meson.build
+++ b/glx/meson.build
@@ -38,7 +38,6 @@ if build_glx
         dependencies: [
             common_dep,
             dl_dep,
-            dri_dep,
             dependency('glproto', version: '>= 1.4.17'),
             dependency('gl', version: '>= 1.2'),
         ],
diff --git a/hw/xfree86/dixmods/meson.build b/hw/xfree86/dixmods/meson.build
index a1afbe8..e4ac022 100644
--- a/hw/xfree86/dixmods/meson.build
+++ b/hw/xfree86/dixmods/meson.build
@@ -33,7 +33,7 @@ if build_glx

         include_directories: [ inc, xorg_inc, glx_inc ],
         c_args: [ xorg_c_args, glx_align64 ],
-        dependencies: [ common_dep, dl_dep, dri_dep ],
+        dependencies: [ common_dep, dl_dep ],
         link_whole: libxserver_glx,
         link_with: e,

diff --git a/include/meson.build b/include/meson.build
index 591bc25..eef9478 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -6,8 +6,6 @@ patch = version_split[2].to_int()
 # convert to the old-style 1.x.y version scheme used up to 1.20.x for backwards compatibility
 release = 1 * 10000000 + major * 100000 + minor * 1000 + patch

-dri_dep = dependency('dri', required: build_glx)
-
 conf_data = configuration_data()
 conf_data.set('_DIX_CONFIG_H_', '1')

@@ -209,9 +207,6 @@ conf_data.set('DGA', build_dga ? '1' : false)
 conf_data.set('DPMSExtension', build_dpms ? '1' : false)
 conf_data.set('DRI2', build_dri2 ? '1' : false)
 conf_data.set('DRI3', build_dri3 ? '1' : false)
-if build_glx
-    conf_data.set_quoted('DRI_DRIVER_PATH', dri_dep.get_pkgconfig_variable('dridriverdir'))
-endif
 conf_data.set('HAS_SHM', build_mitshm ? '1' : false)
 conf_data.set('MITSHM', build_mitshm ? '1' : false)
 conf_data.set('PANORAMIX', build_xinerama ? '1' : false)


Rebuild xorg-server and mpv(if you use it).

Steam depends on virtual/opengl-7.0-r2.

That virtual depends on mesa, but is not actually needed by steam.
To get rid of it, create the text file /etc/portage/profile/package.provided if it doesn't exist, and add:
Code:

virtual/opengl-7.0-r2

To it.

After doing this, emerge -cav should prompt you to uninstall mesa.
_________________
My overlay: https://github.com/stefan11111/stefan_overlay
INSTALL_MASK="/etc/systemd /lib/systemd /usr/lib/systemd /usr/lib/modules-load.d *udev* /usr/lib/tmpfiles.d *tmpfiles* /var/lib/dbus /usr/bin/gdbus /lib/udev"
Back to top
View user's profile Send private message
slaterson
Guru
Guru


Joined: 26 Feb 2003
Posts: 313

PostPosted: Wed Feb 28, 2024 9:01 pm    Post subject: Reply with quote

what advantage is gained by doing this?
Back to top
View user's profile Send private message
stefan11111
l33t
l33t


Joined: 29 Jan 2023
Posts: 922
Location: Romania

PostPosted: Sat Mar 09, 2024 1:04 pm    Post subject: Reply with quote

slaterson wrote:
what advantage is gained by doing this?

Not having to build mesa.
_________________
My overlay: https://github.com/stefan11111/stefan_overlay
INSTALL_MASK="/etc/systemd /lib/systemd /usr/lib/systemd /usr/lib/modules-load.d *udev* /usr/lib/tmpfiles.d *tmpfiles* /var/lib/dbus /usr/bin/gdbus /lib/udev"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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