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

vo_gpu: vulkan: open DRM render fd when using VK_KHR_display #9440

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

philipl
Copy link
Member

@philipl philipl commented Nov 11, 2021

While the basic Vulkan Display context can theoretically drive the
display without the involvement of any non-Vulkan code, that prevents
us from using VAAPI acceleration. When initialising VAAPI without a
window system, we need to provide it with an opened DRM render fd
corresponding to the device to use.

In the context of using VK_KHR_display, that means we need to identify
which DRM device matches the selected Vulkan device, and then open its
render fd and set the necessary state that VAAPI expects to find.

With that done, the normal VAAPI<->Vulkan interop can kick in and we
get working acceleration

Copy link
Member

@Dudemanguy Dudemanguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On AMD it picked vaapi-copy for me with hwdec=auto. That's the same thing the vulkan backend does on wayland for me so it works here at least.

[   0.124][v][vd] Requesting pixfmt 'vaapi_vld' from decoder.
[   0.125][d][ffmpeg/video] h264: Reinit context to 640x368, pix_fmt: vaapi_vld
[   0.158][i][vd] Using hardware decoding (vaapi-copy).

@philipl
Copy link
Member Author

philipl commented Nov 11, 2021

vaapi-copy always works. You need the open fd to be able to use the dmabuf passing.

video/out/vulkan/context_display.c Outdated Show resolved Hide resolved
video/out/vulkan/context_display.c Show resolved Hide resolved
While the basic Vulkan Display context can theoretically drive the
display without the involvement of any non-Vulkan code, that prevents
us from using VAAPI acceleration. When initialising VAAPI without a
window system, we need to provide it with an opened DRM render fd
corresponding to the device to use.

In the context of using VK_KHR_display, that means we need to identify
which DRM device matches the selected Vulkan device, and then open its
render fd and set the necessary state that VAAPI expects to find.

With that done, the normal VAAPI<->Vulkan interop can kick in and we
get working acceleration
@philipl
Copy link
Member Author

philipl commented Nov 14, 2021

@evelikov Thanks for the comments! Updated.

@sfan5 sfan5 removed their request for review November 14, 2021 14:05
@evelikov
Copy link
Contributor

Looking great, thanks o/

@philipl philipl merged commit b030cfe into mpv-player:master Nov 16, 2021
@philipl philipl deleted the vulkan-display-vaapi branch November 16, 2021 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants