GPUOpen-Drivers / AMDVLK

AMD Open Source Driver For Vulkan
MIT License
1.76k stars 162 forks source link

wayland: use linux-dmabuf instead of wl_drm #351

Open emersion opened 10 months ago

emersion commented 10 months ago

amdvlk relies on the wl_drm Wayland protocol to find the DRM device used by the compositor. However, wl_drm is a Mesa-private, legacy protocol, and compositors are starting to drop support. amdvlk should use the standard linux-dmabuf protocol from wayland-protocols instead.

Flakebi commented 10 months ago

Thanks for the heads-up. This is tracked in https://github.com/GPUOpen-Drivers/pal/issues/96.

CNR0706 commented 10 months ago

Would implementing linux-dmabuf also allow Tearing on Wayland? Or is this unrelated?

Not super experienced with this. Sorry if that's a dumb question.

jinjianrong commented 6 months ago

Done in 2024.Q4.1 release

mikezackles commented 5 months ago

In case anyone else comes across this and does a double-take, it's in the 2024.Q2.1 release notes, so I'm guessing Q4 was a typo. Anyway, thanks!

jinjianrong commented 5 months ago

Sorry, this is a typo. The work is done in 2024.Q2.1 release

HurricanePootis commented 4 months ago

I am running AMDVLK 2024.Q2.3 and I am still getting the following error whenever I try to run a wayland application using AMDVLK:

wl_drm#44: error 0: wl_drm.create_prime_buffer is not implemented
jinjianrong commented 4 months ago

Thanks for reporting the issue. We will check it further.

lukelmy commented 4 months ago

Hi @HurricanePootis, thanks for your report. Could you please provide your wayland application or where I can download it?

HurricanePootis commented 4 months ago

@lukelmy

I am running vkcube-wayland, which is apart of the Vulkan-Tools repository.

Also, for more information, I am running the amdvlk driver with the following build process:

  cmake -H. -Bbuilds/Release64 \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_WAYLAND_SUPPORT=On \
    -G Ninja

And, according to the default.xml file in the tar soure code, it is built with PAL commit https://github.com/GPUOpen-Drivers/pal/commit/695337aa8131913d883ff15787cd75f6fcb11229.

Edit: Here is vulkaninfo for my system with the AMDVLK driver

HurricanePootis commented 3 months ago

Any update on this? Kind of inconvenient for amdvlk not to work with modern wayland apps.

jinjianrong commented 3 months ago

@HurricanePootis we can't reproduce the issue locally. But we do notice an issue that may be related with yours. A fix is under implementation

HurricanePootis commented 3 months ago

@jinjianrong Good to know. If you are curious, I installed amdvlk through archlinux and here is the PKBUILD build script they use to build amdvlk for arch.

HurricanePootis commented 3 months ago

I am looking at the files pulled by the archlinux amdvlk package during its build process of 2024.Q2.3, and at pal/src/core/os/amdgpu/wayland/waylandWindowSystem.h, zwp_linux_dmbauf does show up and pal/src/core/os/wayland/mesa/ does exist.

So then, I don't know why even though these files are present at build time, the ensuing amdvlk driver is trying to use wl_drm.

olm52 commented 2 months ago

Same problem here with up to date Archlinux using

ENABLE_HDR_WSI=1 mpv --vo=gpu-next --target-colorspace-hint --gpu-api=vulkan --gpu-context=waylandvk '/home/audiolinux/Downloads/Temp/Life Untouched 4K Demo.mp4'

[audiolinux@archlinux ~]$ ENABLE_HDR_WSI=1 mpv --vo=gpu-next --target-colorspace-hint --gpu-api=vulkan --gpu-context=waylandvk '/home/audiolinux/Downloads/Temp/Life Untouched 4K Demo.mp4' (+) Video --vid=1 (*) (hevc 3840x2160 59.940fps) (+) Audio --aid=1 (*) (aac 2ch 48000Hz) [HDR Layer] Created HDR surface AO: [pipewire] 48000Hz stereo 2ch floatp VO: [gpu-next] 3840x2160 yuv420p10 [HDR Layer] Creating swapchain for id: 5 - format: VK_FORMAT_B8G8R8A8_UNORM - colorspace: VK_COLOR_SPACE_SRGB_NONLINEAR_KHR wl_drm#56: error 0: wl_drm.create_prime_buffer is not implemented [vo/gpu-next/wayland] Error occurred on the display fd Exiting... (Quit)

HurricanePootis commented 2 months ago

Sounds like an Arch Issue? I will make a gitlab issue on their tracker.

olm52 commented 2 months ago

Ok, fine

lf- commented 1 month ago

https://gitlab.archlinux.org/archlinux/packaging/packages/amdvlk/-/issues/1 arch bug filed

HurricanePootis commented 1 month ago

awesome

HurricanePootis commented 2 days ago

After a while, I still think this is an amdvlk issue. Looks like both NixOS and Arch Linux could not get amdvlk to work under wayland rn

jinjianrong commented 2 days ago

@HurricanePootis we had a fix in pal dev branch: https://github.com/GPUOpen-Drivers/pal/commit/758683bc4c64d56287a1beb8384d19d94251200f https://github.com/GPUOpen-Drivers/pal/commit/7b182c9310b3ed8eb98f2239c36a008ffb3eea3c

Could you help check if this fixes the issue?

HurricanePootis commented 1 day ago

@jinjianrong I just tested out vkcube-wayland and an SDL2 game, and was able to run them with Wayland with AMDVLK 2024.Q4.1 with these two patches applied, thank you so much!