我最近安装了 Ubuntu:(19.04),我立即注意到 Ubuntu 从未选择我的专用 AMD GPU。
我开始在线寻找解决方案,并发现了"DRI_PRIME=1"
在启动应用程序之前要设置的环境变量。
当我尝试使用它启动一些基于 OpenGL 的软件时,遇到了此错误消息:
radeon: Failed to allocate virtual address for buffer:
radeon: size : 65536 bytes
radeon: alignment : 4096 bytes
radeon: domains : 4
radeon: va : 0x0000000100000000
radeon: Failed to deallocate virtual address for buffer:
radeon: size : 65536 bytes
radeon: va : 0x100000000
radeon: Failed to allocate virtual address for buffer:
radeon: size : 65536 bytes
radeon: alignment : 4096 bytes
radeon: domains : 4
radeon: va : 0x0000000100000000
radeon: Failed to deallocate virtual address for buffer:
radeon: size : 65536 bytes
radeon: va : 0x100000000
radeonsi: Failed to create a context.
radeon: Failed to allocate virtual address for buffer:
radeon: size : 65536 bytes
radeon: alignment : 4096 bytes
radeon: domains : 4
radeon: va : 0x0000000100000000
radeon: Failed to deallocate virtual address for buffer:
radeon: size : 65536 bytes
radeon: va : 0x100000000
radeon: Failed to allocate virtual address for buffer:
radeon: size : 65536 bytes
radeon: alignment : 4096 bytes
radeon: domains : 4
radeon: va : 0x0000000100000000
radeon: Failed to deallocate virtual address for buffer:
radeon: size : 65536 bytes
radeon: va : 0x100000000
radeonsi: Failed to create a context.
X Error of failed request: GLXBadContext
Major opcode of failed request: 152 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 35
Current serial number in output stream: 34
我的所有程序都不会出现此错误。例如,即使我使用 DRI_PRIME=1,VSCode 也能顺利启动。
答案1
经过几个小时无用的尝试,我终于找到了解决方案!
解决我的问题的方法是添加radeon.runpm=0
到文件/etc/默认/grub在里面GRUB_CMDLINE_LINUX_DEFAULT部分,然后DRI_PRIME=1
在文件末尾添加/etc/环境。