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

Failure to create swap chain since swappy additions (Linux Wayland). #98779

Open
tdaven opened this issue Nov 2, 2024 · 5 comments · May be fixed by #98852
Open

Failure to create swap chain since swappy additions (Linux Wayland). #98779

tdaven opened this issue Nov 2, 2024 · 5 comments · May be fixed by #98852

Comments

@tdaven
Copy link
Contributor

tdaven commented Nov 2, 2024

Tested versions

Introduced in:
748f407

Reproduced on current master:
1bffd6c (m

System information

Godot v4.4.dev (1bffd6c) - Fedora Linux 41 (Workstation Edition) on Wayland - Wayland display driver, Single-window, 2 monitors - Vulkan (Forward+) - dedicated AMD Radeon RX 6700 XT (RADV NAVI22) - 13th Gen Intel(R) Core(TM) i7-13700K (24 threads)

Issue description

Godot Engine v4.4.dev.custom_build.1bffd6c73 (2024-11-02 20:59:31 UTC) - https://godotengine.org
WARNING: Can't obtain the XDG decoration manager. Libdecor will be used for drawing CSDs, if available.
     at: init (platform/linuxbsd/wayland/wayland_thread.cpp:3731)
libdecor-gtk-WARNING: Failed to initialize GTK
Failed to load plugin 'libdecor-gtk.so': failed to init
Vulkan 1.3.289 - Forward+ - Using Device #0: AMD - AMD Radeon RX 6700 XT (RADV NAVI22)

ERROR: Condition "err != VK_SUCCESS" is true. Returning: ERR_CANT_CREATE
   at: swap_chain_resize (drivers/vulkan/rendering_device_driver_vulkan.cpp:3003)
ERROR: Condition "err != VK_SUCCESS" is true. Returning: ERR_CANT_CREATE
   at: swap_chain_resize (drivers/vulkan/rendering_device_driver_vulkan.cpp:3003)
ERROR: Condition "err != VK_SUCCESS" is true. Returning: ERR_CANT_CREATE
   at: swap_chain_resize (drivers/vulkan/rendering_device_driver_vulkan.cpp:3003)

It appears the wrong extent is used which in this case has invalid sizes. Will open PR.

Steps to reproduce

Just create a new project using Forward+ renderer.

Minimal reproduction project (MRP)

N/A

@akien-mga
Copy link
Member

akien-mga commented Nov 4, 2024

For the record, I can reproduce this on Linux, but only with the Wayland display driver.

In my case it even segfaults (started with godot --display-driver wayland -e --path ~/test-project):

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.4.dev.custom_build (1bffd6c73b44b85e5889f54e14b2193940cf5bb1)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib64/libc.so.6(+0x19dd0) [0x7f0872f26dd0] (??:0)
[2] /usr/lib64/libvulkan_radeon.so(+0x7d8c6) [0x7f0849a7d8c6] (??:0)
[3] /usr/lib64/libvulkan_radeon.so(+0x154a4c) [0x7f0849b54a4c] (??:0)
[4] /usr/lib64/libvulkan_radeon.so(+0x12655f) [0x7f0849b2655f] (??:0)
[5] /usr/lib64/libvulkan_radeon.so(+0x127131) [0x7f0849b27131] (??:0)
[6] /usr/lib64/libvulkan_radeon.so(+0x124932) [0x7f0849b24932] (??:0)
[7] /usr/lib64/libvulkan_radeon.so(+0x130c1b) [0x7f0849b30c1b] (??:0)
[8] /usr/lib64/libvulkan_radeon.so(+0x124d74) [0x7f0849b24d74] (??:0)
[9] /lib64/libvulkan.so.1(+0x342b4) [0x7f08615b82b4] (??:0)
[10] RenderingDeviceDriverVulkan::swap_chain_resize(RenderingDeviceDriver::CommandQueueID, RenderingDeviceDriver::SwapChainID, unsigned int) (/home/akien/Godot/godot/drivers/vulkan/rendering_device_driver_vulkan.cpp:3002 (discriminator 1))
[11] RenderingDevice::screen_prepare_for_drawing(int) (/home/akien/Godot/godot/./servers/rendering/rendering_device.cpp:3721 (discriminator 4))
[12] RendererCompositorRD::set_boot_image(Ref<Image> const&, Color const&, bool, bool) (/home/akien/Godot/godot/./servers/rendering/renderer_rd/renderer_compositor_rd.cpp:182 (discriminator 1))
[13] RenderingServerDefault::set_boot_image(Ref<Image> const&, Color const&, bool, bool) (/home/akien/Godot/godot/./servers/rendering/rendering_server_default.h:1078)
[14] Main::setup_boot_logo() (/home/akien/Godot/godot/main/main.cpp:3495)
[15] Main::setup2(bool) (/home/akien/Godot/godot/main/main.cpp:3194)
[16] Main::setup(char const*, int, char**, bool) (/home/akien/Godot/godot/main/main.cpp:2648)
[17] godot-git(main+0xff) [0x61b3a65] (/home/akien/Godot/godot/platform/linuxbsd/godot_linuxbsd.cpp:74)
[18] /lib64/libc.so.6(+0x3248) [0x7f0872f10248] (??:0)
[19] /lib64/libc.so.6(__libc_start_main+0x8b) [0x7f0872f1030b] (??:0)
[20] godot-git(_start+0x25) [0x61b38a5] (??:?)
-- END OF BACKTRACE --
================================================================

@akien-mga akien-mga added the crash label Nov 4, 2024
@akien-mga akien-mga changed the title Failure to create swap chain since swappy additions. Failure to create swap chain since swappy additions (Linux Wayland). Nov 4, 2024
@akien-mga
Copy link
Member

Following up on @DarioSamo's question in duplicate #98811 (comment):

Can you also do regression testing with aaa0e2f in particular?

I confirm that reverting this PR fixes the issue for me, as already pointed out by @tdaven and which Dario suggested might be the case in #96439 (comment).

CC @darksylinc and @Riteo as this only seems to affect the Wayland DisplayDriver.

I also tested #98780 and like @scgm0 confirm that this fixes the bug.

@Riteo
Copy link
Contributor

Riteo commented Nov 4, 2024

FTR, from a quick glance of the VK spec it looks like Wayland has indeed a special case:

On Wayland, currentExtent is the special value (0xFFFFFFFF, 0xFFFFFFFF), indicating that the
surface size will be determined by the extent of a swapchain targeting the surface.

So that explains why Wayland is the only one crashing I think.

darksylinc pushed a commit to darksylinc/godot that referenced this issue Nov 5, 2024
Wayland in particular sets surface_capabilities.currentExtent.width to
the special value 0xFFFFFFFF, which is valid per spec.
Fixes godotengine#98779

It may also fix misc issues when resizing on all platforms.

Superseedes PR godotengine#98780 , thanks to user tdaven for the original patch.
PR godotengine#98780 would break Android support as it did not account that width
and height might need to be swapped.

Replaced manual swap by Godot's SWAP(), which indicates intention much
easier.
darksylinc pushed a commit to darksylinc/godot that referenced this issue Nov 5, 2024
Wayland in particular sets surface_capabilities.currentExtent.width to
the special value 0xFFFFFFFF, which is valid per spec.
Fixes godotengine#98779

It may also fix misc issues when resizing on all platforms.

Superseedes PR godotengine#98780 , thanks to user tdaven for the original patch.
PR godotengine#98780 would break Android support as it did not account that width
and height might need to be swapped.

Replaced manual swap by Godot's SWAP(), which indicates intention much
easier.
@darksylinc
Copy link
Contributor

darksylinc commented Nov 5, 2024

I opened #98852 to fix this issue (as I can't write to PR #98780).

I'm on a laptop and couldn't test the code yet. I'll wait for CI to do the testings. When I get back to my PC I'll also test on Android. Please let me know if it works for you and fixes the Wayland issue.

@akien-mga
Copy link
Member

It seems to work well! Just update #98852 when you get to test on Android and it should be ready to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment