Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan/Godot does not start on Ubuntu 20.04 using X11 (works with Wayland) #42348

Closed
Timothy-Pulliam opened this issue Sep 26, 2020 · 21 comments
Closed

Comments

@Timothy-Pulliam
Copy link

Godot version:
Godot Engine v4.0.dev.custom_build.fea72f2a7

OS/device including version:

timothy@Orion ~> cat /etc/*release
...
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
...
timothy@Orion ~> uname -a
Linux Orion 5.4.0-48-generic #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

GPU info
image

Issue description:
Starting Godot from a terminal I get the following error:

timothy@Orion:~/Desktop/Godot 4/godot/bin$ ./godot.linuxbsd.tools.64 
Godot Engine v4.0.dev.custom_build.fea72f2a7 - https://godotengine.org
INTEL-MESA: warning: Haswell Vulkan support is incomplete
X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request:  149 ()
  Minor opcode of failed request:  4
  Resource id in failed request:  0x6e00008
  Serial number of failed request:  105
  Current serial number in output stream:  111

Steps to reproduce:

  1. Clone and build the latest master branch
git clone [email protected]:godotengine/godot.git
cd godot
scons -j4 target=linuxbsd
  1. Install Ubuntu 20.04 Nvidia drivers
    sudo apt-get install nvidia-driver-450
timothy@Orion ~> apt show nvidia-driver-450
Package: nvidia-driver-450
Version: 450.66-0ubuntu0.20.04.1
Priority: optional
Section: restricted/libs
Source: nvidia-graphics-drivers-450
Origin: Ubuntu
...
Description: NVIDIA driver metapackage
 This metapackage depends on the NVIDIA binary driver and on all of its libraries,
 to provide hardware acceleration for OpenGL/GLX/EGL/GLES/Vulkan
 applications on either X11 or on Wayland.

Verify using X11 and then try to start Godot.

timothy@Orion ~> echo $XDG_SESSION_TYPE
x11

Solution
I was able to get Vulkan/Godot to work by instead installing and using Wayland instead.
https://askubuntu.com/a/1258280

  1. Install Wayland sudo apt install gnome-session-wayland
  2. Open /etc/gdm3/custom.conf and ensure WaylandEnable=false is commented.
  3. Open /usr/lib/udev/rules.d/61-gdm.rules and comment all lines.
  4. Execute sudo systemctl restart gdm3 (may need to reboot entirely)
  5. Click on the cogwheel and select GNOME or Ubuntu on Wayland.
  6. Execute echo $XDG_SESSION_TYPE in order to confirm you are running Wayland (output should be wayland).

From what I understand, this is an issue with X11? Although I'm not really an expert.

@Calinou
Copy link
Member

Calinou commented Sep 26, 2020

You need to force Godot to run on the dedicated GPU as your integrated GPU doesn't fully support Vulkan. (Intel IGPs only fully support Vulkan from Broadwell onwards.)

We should make Godot display an alert dialog when attempting to use Vulkan on an Intel Haswell IGP, since it claims to support Vulkan but is unusable in practice.

@trommlbomml
Copy link

It would also be a great addition to detect when mandatory validation layers are not available and that they should be donwloaded, that blocked me from using vulkan some time.

@bruvzg
Copy link
Member

bruvzg commented Sep 26, 2020

It would also be a great addition to detect when mandatory validation layers

Non of validation layers are mandatory, it will print errors (probably should be changed to warnings or even print_verbose), but it should work fine without any.

@Timothy-Pulliam
Copy link
Author

Sorry for my ignorance, but would you be able to give me general directions for how to force Godot to use my dedicated gpu? Is there a flag I need to pass when starting it?

@Calinou
Copy link
Member

Calinou commented Sep 26, 2020

@chon-panic You can change the PRIME GPU in the NVIDIA Control Panel, but this requires you to log out and back in to make the change effective. Once you do this, the dedicated GPU will be used for everything, which decreases battery life significantly.

Unfortunately, NVIDIA Optimus on Linux has never been as seamless as it is on Windows (where it's still far from ideal).

@Timothy-Pulliam
Copy link
Author

@Calinou I was just looking at PRIME settings on Arch wiki. I think that is what I will have to do. Fortunately I am on a Desktop, so battery life is not a concern. Thank you for helping me.

@Calinou
Copy link
Member

Calinou commented Sep 26, 2020

@chon-panic If you're on a desktop system, you're not using Optimus 🙂

If you have several displays and some of them are connected to the motherboard's video outputs, they will use the IGP instead of the dedicated graphics card.

@Timothy-Pulliam
Copy link
Author

Timothy-Pulliam commented Sep 26, 2020

@Calinou I must be using IGP only then. I have one monitor plugged into my GPU via HDMI, and one monitor plugged into the motherboard via VGA.

@Calinou
Copy link
Member

Calinou commented Sep 26, 2020

@chon-panic If you start Godot while the currently focused window is on the monitor connected to the dedicated GPU, it should use the dedicated GPU. At least, in theory…

@bruvzg
Copy link
Member

bruvzg commented Sep 26, 2020

I have one monitor plugged into my GPU via HDMI, and one monitor plugged into the motherboard via VGA.

Is there any reason for this strange setup? Using IGP on desktop doesn't make much sense.

@Calinou
Copy link
Member

Calinou commented Sep 26, 2020

@bruvzg It can be useful if you need to use more monitors than your dedicated GPU supports. That said, any modern graphics card supports 3 monitors (if not 4 or 5) already.

@bruvzg
Copy link
Member

bruvzg commented Sep 26, 2020

It can be useful if you need to use more monitors than your dedicated GPU supports.

Typical GTX-970 should have at least 4 ports, including DVI-I which can be converted to VGA with the passive adapter/cable.

@Timothy-Pulliam
Copy link
Author

Timothy-Pulliam commented Sep 26, 2020

@bruvzg I have an old hand me down monitor and not VGA to DVI converters.

I tried unplugging my secondary VGA monitor entirely, rebooting and starting Godot that way, but I still see the same issue. Granted, my CPU is a bit older.

Model name: Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz

It's not a super big deal, I get that my set up is not ideal. I'm not sure what sort of set up the core developers use but I take it it's not what I am using. :)

@Timothy-Pulliam
Copy link
Author

I have found a temporary work around. I enabled Wayland, however since Wayland doesn't work with nvidia GPUs I just plugged both of my monitors into my motherboard and use onboard graphics. I know this is dumb, but I plan on upgrading my CPU/GPU at some point anyways. I will try an AMD GPU in the future and see if that helps.

For what it's worth, my desktop is Windows 10/Ubuntu dual boot, and I did not run into these issues compiling and running Godot 4 for Windows 10 with my specs.

@trommlbomml
Copy link

trommlbomml commented Sep 27, 2020

It would also be a great addition to detect when mandatory validation layers

Non of validation layers are mandatory, it will print errors (probably should be changed to warnings or even print_verbose), but it should work fine without any.

It did not work, without the validation layers I had black screens. When I have installed them it worked very well. I tested even before running a vulcan game and it works properly, godot not. Only after adding the validation layers it worked.

If that cannot be really a case then this would mean I have missed some graphics driver update between my tests, but I doubt there were any. Maybe also some changes on the nightly build has triggered that it works now?

@akien-mga
Copy link
Member

@trommlbomml Most likely whatever process you used to install the validation layers also installed Vulkan drivers. Validation layers have no impact on whether Vulkan works or not, they're debugging tools.

@bfloch
Copy link
Contributor

bfloch commented Feb 15, 2021

Sorry, I think I have the same issue with an NVIDIA optimus setup on a laptop while the integrated GPU is being used and crashes.

Despite the intuition on this thread in my case the problem is really that the current state of the vulkan implementation has a hard-coded physical device:
https://github.com/godotengine/godot/blob/master/drivers/vulkan/vulkan_context.cpp#L383

This should be selectable in the command line, or via an envvar but for the time being this PR unblocks me and might do the same for other devs:

#46070

bfloch added a commit to StateOff/godot that referenced this issue Feb 17, 2021
This unblocks launching on Linux laptops that default to the integrated
GPU which can not handle Vulkan in many instances.
Ideally a manual device selection, or an option for the optimal selection
strategy should be provided via CLI or config, but for the time being
this will unblock the Linux devs.

Partially addresses godotengine#42348 and godotengine#43714
akien-mga pushed a commit to akien-mga/godot that referenced this issue Jun 11, 2021
This unblocks launching on Linux laptops that default to the integrated
GPU which can not handle Vulkan in many instances.
Ideally a manual device selection, or an option for the optimal selection
strategy should be provided via CLI or config, but for the time being
this will unblock the Linux devs.

Partially addresses godotengine#42348 and godotengine#43714
@Snub0
Copy link

Snub0 commented Jul 26, 2021

I am having a similar issue on Linux laptop, but strangely, it ONLY runs on my AMD 7 5800H, or 'AMD Renoir'. It completely refuses to run on my gtx 1650 since it's vulkan drivers are apparently not supported(on X11 and Wayland). I am running Pop-OS 21.04 if it helps.

@LinuxUserGD
Copy link
Contributor

LinuxUserGD commented Jul 28, 2022

I can reproduce the issue with Gentoo Linux amd64 (clang toolchain / musl libc) and kde plasma x11

user@user ~ $ glxinfo | egrep -i 'device|memory'
    Device: Mesa Intel(R) HD Graphics 620 (KBL GT2) (0x5916)
    Video memory: 7827MB
    Unified memory: yes
    GL_AMD_performance_monitor, GL_AMD_pinned_memory, 
    GL_EXT_framebuffer_object, GL_EXT_framebuffer_sRGB, GL_EXT_memory_object, 
    GL_EXT_memory_object_fd, GL_EXT_packed_depth_stencil, GL_EXT_packed_float, 
    GL_AMD_pinned_memory, GL_AMD_query_buffer_object, 
    GL_EXT_gpu_shader4, GL_EXT_memory_object, GL_EXT_memory_object_fd, 
    GL_EXT_memory_object, GL_EXT_memory_object_fd, GL_EXT_multi_draw_arrays, 
user@user ~ $

kde plasma x11 session

user@user ~ $ godot
Godot Engine v4.0.alpha.custom_build.950750fb9 - https://godotengine.org
WARNING: Error setting locale modifiers
     at: DisplayServerX11 (platform/linuxbsd/display_server_x11.cpp:4636)
WARNING: XOpenIM failed
     at: DisplayServerX11 (platform/linuxbsd/display_server_x11.cpp:4682)
WARNING: XCreateIC couldn't create wd.xic
     at: _create_window (platform/linuxbsd/display_server_x11.cpp:4517)
Vulkan API 1.2.0 - Using Vulkan Device #0: Intel - Intel(R) HD Graphics 620 (KBL GT2)
X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request:  148 ()
  Minor opcode of failed request:  4
  Resource id in failed request:  0x4000006
  Serial number of failed request:  83
  Current serial number in output stream:  89
ERROR: BUG: Unreferenced static string to 0: interface_added
   at: unref (core/string/string_name.cpp:131)
user@user ~ $

works fine with kde plasma wayland session

user@user ~ $ godot
Godot Engine v4.0.alpha.custom_build.950750fb9 - https://godotengine.org
WARNING: Error setting locale modifiers
     at: DisplayServerX11 (platform/linuxbsd/display_server_x11.cpp:4636)
WARNING: XOpenIM failed
     at: DisplayServerX11 (platform/linuxbsd/display_server_x11.cpp:4682)
WARNING: XCreateIC couldn't create wd.xic
     at: _create_window (platform/linuxbsd/display_server_x11.cpp:4517)
Vulkan API 1.2.0 - Using Vulkan Device #0: Intel - Intel(R) HD Graphics 620 (KBL GT2)
ERROR: vmaCreateImage failed with error -2.
   at: texture_create (drivers/vulkan/rendering_device_vulkan.cpp:1871)
 

@akien-mga
Copy link
Member

Is this still reproducible in 4.0 RC 3 or later?

@akien-mga akien-mga modified the milestones: 4.0, 4.x Feb 22, 2023
@Calinou
Copy link
Member

Calinou commented Mar 13, 2023

Closing due to lack of response. Please comment if you can still reproduce this bug on the latest Godot version.

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2023
@Calinou Calinou removed this from the 4.x milestone Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants