Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

nvidia xorg without mesa

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
4 posts • Page 1 of 1
Author
Message
stefan11111
Veteran
Veteran
Posts: 1024
Joined: Sun Jan 29, 2023 6:08 pm
Location: Romania
Contact:
Contact stefan11111
Website

nvidia xorg without mesa

  • Quote

Post by stefan11111 » Fri Feb 16, 2024 8:36 pm

UPDATE:
As of april 2025, what is presented here isn't completely true and hasn't been for at least a few months.
The proprietary nvidia drivers nowadays have drm support even for X11, and is it necessary for things like vaapi.
I have a full build of mesa on my system for things unrelated to the nvidia drivers, but one should at least
have libgbm from mesa when using the nvidia drivers on X11.
For anyone interested in reading more about this, you can look at this bug report and all the links in see also:
https://bugs.gentoo.org/940168

To build just libgbm from mesa, create the file /etc/portage/env/media-libs/mesa, if it doesn't already exist
and add this line to is:

Code: Select all

MYMESONARGS="-Dgbm=enabled -Dexpat=disabled -Dgallium-drivers= -Dvideo-codecs="
And disable all USE flags except USE="X" on media-libs/mesa

Here's an updated guide to get a minimal system with an nvidia gpu on X11,
without losing any of the newer features of the nvidia gpu driver:

1. Build mesa with just libgbm, using the setup mentioned above.

2. Install this header: https://github.com/stefan11111/dri_interface.h
I have an ebuild for this header in my overlay, that might be useful:
https://github.com/stefan11111/stefan_o ... 1.0.ebuild

3. emerge x11-base/xorg-server
Do *NOT* enable USE=minimal on it, like in the old guide

If you didn't enable drm support, and you want it, you will have to enable it.
It isn't enabled by default and it is needed for vaapi.

As a side note, the drm support is needed for the nvidia framebuffer, but it is experimental
and I found that is has worse performance that the regular efi framebuffer.

I will keep the old guide here, as it may be useful to those who are using older
drivers that do not have drm support and to those who do not need/want the drm support.

OLD GUIDE HERE:

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: Select all

$ 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: Select all

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_o ... 1.0.ebuild

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

Code: Select all

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: Select all

virtual/opengl-7.0-r2
To it.

After doing this, emerge -cav should prompt you to uninstall mesa.
Last edited by stefan11111 on Sat Apr 26, 2025 1:46 pm, edited 1 time in total.
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"
Top
slaterson
Guru
Guru
Posts: 313
Joined: Wed Feb 26, 2003 3:37 pm

  • Quote

Post by slaterson » Wed Feb 28, 2024 9:01 pm

what advantage is gained by doing this?
Top
stefan11111
Veteran
Veteran
Posts: 1024
Joined: Sun Jan 29, 2023 6:08 pm
Location: Romania
Contact:
Contact stefan11111
Website

  • Quote

Post by stefan11111 » Sat Mar 09, 2024 1:04 pm

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"
Top
stefan11111
Veteran
Veteran
Posts: 1024
Joined: Sun Jan 29, 2023 6:08 pm
Location: Romania
Contact:
Contact stefan11111
Website

  • Quote

Post by stefan11111 » Tue Sep 03, 2024 11:40 pm

I updated the repository with the header, so that patching xorg is no longer required.

https://github.com/stefan11111/dri_inte ... 6f9ca0196b
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"
Top
Post Reply

4 posts • Page 1 of 1

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic