mpv-player / mpv-player/mpv

vaapi doesn't work and Garbled output in vaapi-copy , waylandvk and vulkan (radv driver)

Open
#9,657 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

down-upstream:mesa os:linux
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Important Information
  • mpv version : mpv 0.34.0
  • Linux Distribution and Version : Void Linux 5.15.12_1
  • Source of the mpv binary : distro
  • If known which version of mpv introduced the problem : No
  • Window Manager and version : sway 1.6.1
  • GPU driver and version:
    mesa 21.3.2
    mesa-vulkan-radeon-21.3.2_1
    amdvlk-2021.Q3.7_1
Context

I use ThinkPad E14 with i7-10510u processor which comes with AMD radeon rx 640 GPU discrete GPU . I run sway (v1.6.1) wayland compositor on it . I use mpv in sway.

Also , I can assure you that same problem persists in both voidlinux and archlinux ( I have tried mesa-git and mpv-git too).

With Intel GPU in sway , hardware acceleration works properly.

vaapi, wayland ,opengl-> works
vaapi, waylandvk , vulkan -> works
vaapi-copy , waylandvk , vulkan -> works
vaapi-copy , wayland , opengl -> works

And this issue is about problems all regarding amd radeon rx640 .

With amdgpu in sway though, I have two choices for vulkan driver (which works with mesa amdgpu driver) => RADV and amdvlk .

Here are the results of hardware acceleration with amdgpu + radv drivers .

amd radeon rx 640(radeon):
amdgpu + RADV: 

vaapi, wayland ,opengl-> doesn't work(fallbacks to no hwaccel; radeonsi_drv_video.so init failed)
vaapi, waylandvk , vulkan -> doesn't work(garbled output and no vaapi)

vaapi-copy , waylandvk , vulkan -> works but garbled output
vaapi-copy , wayland , opengl -> works


----
vaapi , drm , opengl -> doesn't work; fallback to no hwaccel
vaapi, displayvk, vulkan -> doesn't work ; fallback to no hwaccel
vaapi-copy, drm , opengl -> works
vaapi-copy, displayvk , vulkan -> works

----
vaapi,x11egl, opengl -> works
vaapi, x11vk, vulkan -> doesn't work ; fallback to no hwaccel
vaapi-copy, x11egl, opengl -> works
vaapi-copy , x11vk , vulkan -> works

With amdgpu + amdvlk , things are little different ,

amdgpu + amdvlk:  

vaapi, wayland ,opengl-> doesn't work(fallbacks to no hwaccel ; error message: radeonsi_drv_video.so init failed)
vaapi, waylandvk , vulkan -> doesn't work( no vaapi)

vaapi-copy , waylandvk , vulkan -> works
vaapi-copy , wayland , opengl -> works


----
vaapi , drm , opengl -> doesn't work; fallback to no hwaccel
vaapi, displayvk, vulkan -> doesn't work ; fallback to no hwaccel
vaapi-copy, drm , opengl -> works
vaapi-copy, displayvk , vulkan -> works

----
vaapi,x11egl, opengl -> works
vaapi, x11vk, vulkan -> doesn't work ; fallback to no hwaccel
vaapi-copy, x11egl, opengl -> works
vaapi-copy , x11vk , vulkan -> works

Briefly,

  1. vaapi in amdgpu in both drivers radv/amdvlk in both opengl/vulkan doesn't work in wayland sway (but vaapi-copy works in few cases that i mentioned above). Is it because my amd radeon rx640 is dedicated GPU ? But , vaapi,x11egl, opengl works though ( why?)
  2. vaapi-copy , wayland , opengl works in amdgpu (mesa driver) in sway . It has nothing to do with vulkan. So, this point(2) is not a issue .
  3. This point might be bug with RADV or with waylandvk gpu context in mpv.

vaapi-copy , waylandvk , vulkan in amdgpu+radv shows that vaapi is working . But, it produces garbled output.

Screenshot of vaapi-copy,waylandvk, vulkan , amdgpu+radv :
ps_20211230145032

But, if we use amdvlk instead of radv here , it produces correct output.

Screenshot of vaapi-copy,waylandvk, vulkan , amdgpu+amdvlk :
ps_20211230145103

  1. I thought it was bug of vulkan implementation in radv. But, if we use
    vaapi-copy, displayvk , wayland it uses wayland vaapi vulkan and displays properly under both radv and amdvlk. So, it might be more related to waylandvk with radv driver. Why displayvk works and why not waylandvk ?

  2. vaapi, x11vk, vulkan doesn't work . It fallbacks to sw rendering. Why doesn't it work(it must display through XWayland)?

  3. However vaapi,x11egl, opengl , vaapi-copy, x11egl, opengl and vaapi-copy , x11vk , vulkan work in Xwayland in sway using amdgpu in both vulkan drivers.

How I have run?

VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.x86_64.json DRI_PRIME=1 LIBVA_DRIVER_NAME=radeonsi mpv --no-config --hwdec=vaapi --gpu-context=waylandvk --gpu-api=vulkan --vaapi-device=/dev/dri/renderD129 filename
I have changed VK_ICD_FILENAMES to /usr/share/vulkan/icd.d/amd_icd64.json if i need to use amdvlk driver( i used to delete this driver when i needed to try radv ) and changed other parameters corresponding to situation.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report provides a reproduction command using mpv with vaapi, waylandvk, Vulkan, RADV, and amdvlk, but names no source file or test. Start by reproducing the listed combinations with the supplied command and compare the RADV and amdvlk results; done means identifying and fixing the cause of the RADV garbled output or documenting that it belongs to an external driver.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
cli, computer-graphics, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.