强制 Xorg 使用 AMD GPU 而不是 Nvidia GPU

强制 Xorg 使用 AMD GPU 而不是 Nvidia GPU

因此,我的工作站中有一个 Nvidia GPU,我主要用它来执行计算任务 (CUDA)。然而,当 GPU 负载过重时,这会导致显示冻结。我的想法是使用辅助 GPU 来路由我的显示 (*)。由于我手头有一台旧的 HD6950,所以我能够运行一些初始测试。

  • 当没有其他显卡时,Nvidia/AMD 显卡都可以单独驱动我的显示器
  • 当系统中同时安装两种显卡时,出于某种原因,Nvidia 显卡优先于 AMD 显卡。虽然我可以在 BIOS 和 GRUB 中使用 AMD 显卡,但只要解密硬盘,系统就会自动切换到 Nvidia 显卡。

问题:

  1. 如何强制 Xorg 使用 AMD GPU 为显示器供电?**
  2. 仅安装“无头” Nvidia 驱动程序是否是一种解决方案?

笔记:

  • AMD 卡无需任何附加驱动程序即可工作,但是,我尝试安装amdgpu驱动程序,但这似乎没有任何改变。
  • 购买第二张 Nvidia 卡似乎不是最佳选择,因为(A)它们更贵(B)我找不到一张有超过 4 个数字输出的卡,而且如果我无论如何都要经历这个麻烦,我只能一路用下去。
  • 有关的?AMD 和 NVIDIA GPU 在 Ubuntu 20.04 上协同运行

更新好吧,有趣的是,在我删除xorg.conf引用 nvidia 驱动程序的文件后,amdgpu它就可以正常工作了。我尝试用 nvidia 驱动程序替换它,但没有用。在清除amdgpu并使用“默认”VGA 驱动程序后,它就可以正常工作了。它似乎按预期工作,但这肯定不是正确的设置方法。我尝试X -configure在恢复模式下创建一个新的配置,但生成的配置不起作用。


(*)我的目标设置如下:获得蓝宝石 GPRO 6200或与显示卡相当的显卡。然后,出于气流原因,我的想法是通过最后一个 PCIex16 插槽中的立管电缆垂直插入此卡。

答案1

  1. 检查是否/etc/X11/xorg.conf已经存在

    • 如果没有,请通过以下方式创建Xorg -Configure(不需要活动的 X 会话):
      • 转到 TTY 会话(例如ctrl+alt+F3
      • 停止 gnome 桌面管理器 service gdm stop
      • Xorg -configure
      • sudo cp /home/$USER/xorg.conf.new /etc/X11/xorg.conf
    • 如果是,请进行备份sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
  2. 取消注释中的 Nvidia-GPU 相关Decive部分xorg.conf

  3. 重启

如果计算机不再启动,请进入恢复模式并删除/etc/X11/xorg.conf或推出备份。

示例 `/etc/X11/xorg.conf`
Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1" RightOf "Screen0"
    Screen      2  "Screen2" RightOf "Screen1"
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
    ModulePath   "/usr/lib/xorg/modules"
    FontPath     "/usr/share/fonts/X11/misc"
    FontPath     "/usr/share/fonts/X11/cyrillic"
    FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"
    FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"
    FontPath     "/usr/share/fonts/X11/Type1"
    FontPath     "/usr/share/fonts/X11/100dpi"
    FontPath     "/usr/share/fonts/X11/75dpi"
    FontPath     "built-ins"
EndSection

Section "Module"
    Load  "glx"
EndSection

Section "InputDevice"
    Identifier  "Keyboard0"
    Driver      "kbd"
EndSection

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option      "Protocol" "auto"
    Option      "Device" "/dev/input/mice"
    Option      "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
    Identifier   "Monitor0"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
EndSection

Section "Monitor"
    Identifier   "Monitor1"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
EndSection

Section "Monitor"
    Identifier   "Monitor2"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "Accel"                 # [<bool>]
        #Option     "SWcursor"              # [<bool>]
        #Option     "EnablePageFlip"        # [<bool>]
        #Option     "SubPixelOrder"         # [<str>]
        #Option     "ZaphodHeads"           # <str>
        #Option     "AccelMethod"           # <str>
        #Option     "DRI3"                  # [<bool>]
        #Option     "DRI"                   # <i>
        #Option     "ShadowPrimary"         # [<bool>]
        #Option     "TearFree"              # [<bool>]
        #Option     "DeleteUnusedDP12Displays"  # [<bool>]
        #Option     "VariableRefresh"       # [<bool>]
        #Option     "AsyncFlipSecondaries"  # [<bool>]
    Identifier  "Card0"
    Driver      "amdgpu"
    BusID       "PCI:36:0:0"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "Accel"                 # [<bool>]
        #Option     "SWcursor"              # [<bool>]
        #Option     "EnablePageFlip"        # [<bool>]
        #Option     "SubPixelOrder"         # [<str>]
        #Option     "ZaphodHeads"           # <str>
        #Option     "AccelMethod"           # <str>
        #Option     "DRI3"                  # [<bool>]
        #Option     "DRI"                   # <i>
        #Option     "ShadowPrimary"         # [<bool>]
        #Option     "TearFree"              # [<bool>]
        #Option     "DeleteUnusedDP12Displays"  # [<bool>]
        #Option     "VariableRefresh"       # [<bool>]
        #Option     "AsyncFlipSecondaries"  # [<bool>]
    Identifier  "Card1"
    Driver      "amdgpu"
    BusID       "PCI:36:0:1"
EndSection

#Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "SWcursor"              # [<bool>]
        #Option     "HWcursor"              # [<bool>]
        #Option     "NoAccel"               # [<bool>]
        #Option     "ShadowFB"              # [<bool>]
        #Option     "VideoKey"              # <i>
        #Option     "WrappedFB"             # [<bool>]
        #Option     "GLXVBlank"             # [<bool>]
        #Option     "ZaphodHeads"           # <str>
        #Option     "PageFlip"              # [<bool>]
        #Option     "SwapLimit"             # <i>
        #Option     "AsyncUTSDFS"           # [<bool>]
        #Option     "AccelMethod"           # <str>
        #Option     "DRI"                   # <i>
#   Identifier  "Card2"
#   Driver      "nouveau"
#   BusID       "PCI:45:0:0"
#EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor    "Monitor0"
    SubSection "Display"
        Viewport   0 0
        Depth     1
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     4
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     8
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     15
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     16
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection

Section "Screen"
    Identifier "Screen1"
    Device     "Card1"
    Monitor    "Monitor1"
    SubSection "Display"
        Viewport   0 0
        Depth     1
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     4
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     8
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     15
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     16
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection

Section "Screen"
    Identifier "Screen2"
    Device     "Card2"
    Monitor    "Monitor2"
    SubSection "Display"
        Viewport   0 0
        Depth     1
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     4
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     8
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     15
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     16
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection

相关内容