[kwin] [Bug 435978] [Wayland][Vulkan] Deadlock after destroying xdg_toplevel

2021-04-25 Thread Ethan Lee
https://bugs.kde.org/show_bug.cgi?id=435978

--- Comment #4 from Ethan Lee  ---
This was investigated further and it turns out that both SDL and KWin are doing
the correct thing - my OpenGL test had an issue where we were using a
yet-to-be-shipped EGL_EXT_swap_control_tear implementation, so it was
unintentionally skipping vsync. What this bug turned out to be was HideWindow
getting caught in Wayland's ability to block programs that wait on vsync when
they're obscured, which hidden windows of course will be.

This is actually a huge issue for us but it's not unique to KWin. See the
following bug for more info:

https://github.com/libsdl-org/SDL/issues/4335

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 435978] [Wayland][Vulkan] Deadlock after destroying xdg_toplevel

2021-04-23 Thread Ethan Lee
https://bugs.kde.org/show_bug.cgi?id=435978

--- Comment #3 from Ethan Lee  ---
>Note that not a lot compositors properly support surface re-mapping, it might 
>be a better idea just to re-create the xdg_toplevel surface instead.

This got discovered pretty quickly, so that's what we're doing now.

HideWindow:
https://github.com/libsdl-org/SDL/blob/f1ad942a1175105e4ab7d1cd98b842f84b3bcb2b/src/video/wayland/SDL_waylandwindow.c#L720-L754

ShowWindow:
https://github.com/libsdl-org/SDL/blob/f1ad942a1175105e4ab7d1cd98b842f84b3bcb2b/src/video/wayland/SDL_waylandwindow.c#L646-L718

The test case uses FNA (see wltest.cs, which can be compiled with 'csc
wltest.cs -r:FNA.dll', and https://github.com/FNA-XNA/FNA/ ), but the Wayland
portion is entirely within SDL itself. To compile SDL you can grab the
dependencies for your system (i.e. dnf builddep SDL2), then do a plain
'./configure && make' with the latest Git revision.

How this test works is that it starts with a visible window, which is then not
touched in any way other than with either eglSwapBuffers or vkQueuePresentKHR.
When pressing space, it calls HideWindow and keeps a timestamp, then after
three seconds have passed it calls ShowWindow. No other interactions with the
window are being made.

Where this bug might be troublesome is for Vulkan contexts - if I'm
understanding correctly, what we're doing with surfaces is correct (though I am
aware of wl_surface, xdg_surface, and VkSurfaceKHR, so I randomly chose
xdg_surface here), but what we're doing with buffers is not (of which we do not
reference that type at all, but based on the log I am guessing these are the
Vulkan swapchain images). The big problem is that the Vulkan swapchain is
totally separate from the SDL Wayland window, and if I'm understanding this
correctly it sounds like destroying the xdg objects also destroy/invalidate the
buffers, in which case I would expect vkAcquireNextImageKHR to return something
like VK_ERROR_OUT_OF_DATE_KHR, so that we can recreate the swapchain with new
buffers that are valid for the unmapped/remapped surface. The Vulkan context
has no other way of knowing that the window surface has changed in a way that
swapchain recreation is necessary.

And as a reminder: OpenGL/EGL are okay with this, and if I just use mailbox or
immediate presentation instead, the program runs as expected (which also seems
to point to there being a gap in how swapchains are treated when this happens).

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 435978] [Wayland][Vulkan] Deadlock after destroying xdg_toplevel

2021-04-23 Thread Vlad Zahorodnii
https://bugs.kde.org/show_bug.cgi?id=435978

Vlad Zahorodnii  changed:

   What|Removed |Added

 Resolution|--- |NOT A BUG
 Status|REPORTED|RESOLVED

--- Comment #2 from Vlad Zahorodnii  ---
Thanks for the test program, but it's not clear how to build it.

---

Based on the provided wayland log, it looks like the test app incorrectly maps
itself back. If you want to re-map a surface, you need to

* set the initial properties
* commit the surface without a buffer attached

* wait for the compositor to respond with a configure event
* render the window contents, attach the buffer to the surface, ack the
configure event and commit the surface

Note that not a lot compositors properly support surface re-mapping, it might
be a better idea just to re-create the xdg_toplevel surface instead.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 435978] [Wayland][Vulkan] Deadlock after destroying xdg_toplevel

2021-04-21 Thread Nate Graham
https://bugs.kde.org/show_bug.cgi?id=435978

Nate Graham  changed:

   What|Removed |Added

 CC||n...@kde.org

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 435978] [Wayland][Vulkan] Deadlock after destroying xdg_toplevel

2021-04-21 Thread bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=435978

darkt...@gmail.com changed:

   What|Removed |Added

 CC||darkt...@gmail.com

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 435978] [Wayland][Vulkan] Deadlock after destroying xdg_toplevel

2021-04-20 Thread Ethan Lee
https://bugs.kde.org/show_bug.cgi?id=435978

--- Comment #1 from Ethan Lee  ---
Created attachment 137742
  --> https://bugs.kde.org/attachment.cgi?id=137742=edit
WAYLAND_DEBUG log

Looks like the test was too big to attach, can be found here instead:

http://flibitijibibo.com/wltest.tar.bz2

Also see WAYLAND_DEBUG log attached.

-- 
You are receiving this mail because:
You are watching all bug changes.