8

How can I turn off Hardware Acceleration in Linux, also known as Direct Rendering. I wish to turn this off, as it messes with some applications like OBS Studio which can't handle capturing of hardware acceleration on other applications since it's enabled for the entire system. Certain apps can turn it on and off, but can't do this for desktop and other apps.

When adding a source to capture from in OBS it just shows a blank capture image, for example if I wanted to record my desktop, it'll just show it as a blank capture input. Doesn't work if I want to capture web browser like Google Chrome, unless it's a single window with no tabs, and hardware acceleration is turned off in it's settings.

Graphics:  Card-1: Intel 3rd Gen Core processor Graphics Controller bus-ID: 00:02.0
       Card-2: NVIDIA GF108M [GeForce GT 630M] bus-ID: 01:00.0
       Display Server: X.Org 1.15.1 driver: nvidia Resolution: 1366x768@60.0hz
       GLX Renderer: GeForce GT 630M/PCIe/SSE2 GLX Version: 4.5.0 NVIDIA 384.90 Direct Rendering: Yes
Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
  • Try asking about a specific scenario, not something general like this. Like broadcasting a chrome window through X and OBS on some distribution with some video card and some module. Also refer to where you've set which setting off exactly. This helps people understand your setup. – Zip Dec 03 '17 at 18:10
  • @Zip Maybe you didn't read the question before properly and understand it. Check and try again, I have asked about a specific scenario, and that is to disable Hardware Acceleration for the whole system not just parts of it just for few applications. –  Dec 03 '17 at 18:57
  • Well, I did not explain myself appropriately. Applications will individually access hardware resources directly through the modules or through libs generally. I don't think there is a system wide simple switch for that. Anyway you don't mention your distro nor which drivers you're using, which may influence the answer. You seem to have issues with a very particular obs setup that may have an easier solution than what you asked, with the bonus that you may keep acceleration on for other stuff. Just ignore this from me if you disagree though, to keep comments clean... – Zip Dec 03 '17 at 19:21

2 Answers2

11

You can configure Xorg to disable OpenGL / GLX.

For a first try, you can run a second X session: switch to tty2, log in and type:

startx -- :2 vt2 -extension GLX

To permanently disable hardware acceleration, create a file:

/etc/X11/xorg.conf.d/disable-gpu.conf

with the the content:

Section "Extensions"
    Option "GLX" "Disable"
EndSection

Note that Xwayland in Wayland compositors like Gnome3-Wayland will ignore settings in xorg.conf.d.

fra-san
  • 10,205
  • 2
  • 22
  • 43
mviereck
  • 2,467
  • That approach not working unfortunately on xubuntu 18, do you know how to do the same on modern xorg? – Ivan Talalaev Oct 11 '18 at 06:00
  • @IvanTalalaev Try to also disable extensions DRI2 and DRI3. – mviereck Oct 11 '18 at 09:21
  • thanks, but that doesn't work either. Let me clarify: in my system I have xorg.conf.d in /usr/share/X11/ I placed there disable-gpu.conf file with required disable lines as depicted on image https://i.imgur.com/QKHzz6l.png that is right? – Ivan Talalaev Oct 11 '18 at 09:42
  • @IvanTalalaev The file looks correct. Change its name to 90-disable-gpu.conf to make sure it is applied as the last one. Maybe another config overwrites it. – mviereck Oct 11 '18 at 09:52
  • 2
    @IvanTalalaev Output of xdpyinfo | head -n 60 shows you enabled X extensions. – mviereck Oct 11 '18 at 10:10
  • many thanks for your reply! Definitely xdpyinfo shows that GLX, DRI2 and DRI3 still loaded, that means 90-disable-gpu.conf not loaded or probably not working. I dig over documentation and realized that Disable should be replaced with off, and all should be probably placed in ServerLayout section but that doesn't work either. Mind if I drop you a line outside stackexchange? – Ivan Talalaev Oct 11 '18 at 10:38
  • I have a few questions about x11docker as well actually) – Ivan Talalaev Oct 11 '18 at 10:39
  • @IvanTalalaev you put the file in the incorrect directory. It needs to be in /etc/X11/xorg.conf.d/. /usr/share is not for local system configuration files. – Mio Rin Oct 11 '18 at 13:51
  • @Mioriin thanks, but in my system xorg.conf.d located in the denoted place it's not mistake. Anyway I tried again -- doesn't work. – Ivan Talalaev Oct 13 '18 at 06:14
  • Please read man xorg.conf to see why changes to /usr/share/X11/xorg.conf.d/ do not work. – Mio Rin Oct 13 '18 at 19:30
  • 1
    @Mioriin could you give more meaningful comment rather than "read smth to understand why it doesn't work" – Ivan Talalaev Oct 16 '18 at 07:35
  • @Mioriin from man xorg.conf https://i.imgur.com/UYOfSys.png – Ivan Talalaev Oct 16 '18 at 08:51
  • /usr/share is reserved for package defaults and files in there should not be tampered with, in order to maintain at least one version of a default configuration to fallback to when tinkering. If you need a file from there, copy (or recreate) it to one of the other locations. – Mio Rin Oct 16 '18 at 10:39
  • 1
    I have the same issue as @IvanTalalaev and there is no /etc/X11/xorg.conf.d directory on my ubuntu 16 installation. – latj Nov 01 '18 at 21:03
  • @latj You can create directory /etc/X11/xorg.conf.d yourself. Xorg will regard it. – mviereck Nov 02 '18 at 18:23
1

The solution above didn't work for me. It caused an error on boot to the effect of unw_get_proc_name failed. I don't know if this happened for anyone else, but I found a different solution.

I modified /usr/share/X11/xorg.conf.d/10-nvidia.conf. For me, the file contained the following pre-edit:

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "Accel" "off"
    ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection

I added a line below Option "AllowEmptyInitialConfiguration": Option "Accel" "off". Using this modification instead of the solution above, my system booted and nvidia-smi didn't show Xorg anymore.

Hope this helps somebody.

  • This solution also removed from GPU memory sddm process and some other minor, freeing 600MB memory. On modern CPU user interface is as fast as on acceleration, thanks! – PeterM May 05 '23 at 03:56