Bug 275360 - graphics/mesa-dri: enable Vulkan Video support after Mesa >= 23 update
Summary: graphics/mesa-dri: enable Vulkan Video support after Mesa >= 23 update
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-x11 (Nobody)
URL:
Keywords:
Depends on: 273703
Blocks:
  Show dependency treegraph
 
Reported: 2023-11-26 19:23 UTC by Jan Beich
Modified: 2023-11-27 10:05 UTC (History)
1 user (show)

See Also:
manu: maintainer-feedback+


Attachments
v1 (unsure about style) (1.28 KB, patch)
2023-11-26 19:23 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2023-11-26 19:23:21 UTC
Created attachment 246591 [details]
v1 (unsure about style)

Similar to ports aada4209a3b0. Vulkan Video extensions are part of Vulkan drivers (mesa-dri). It's an alternative API to VA-API (mesa-gallium-va, libva-*driver), VDPAU (mesa-gallium-vdpau, nvidia-driver), NVDEC (nv-sglrun + nvidia-driver), QSV (intel-media-sdk, onevpl), AMF (unported).

Upstream support enabled by https://gitlab.freedesktop.org/mesa/mesa/-/commit/c90e5ddc710a (removal of beta ifdefs) but runtime is still gated by environment variables probably due to insufficient QA (validation on all supported hardware). There're also too few open source consumers, and many video players are OpenGL-only.

$ pkg install mpv mesa-dri # if built by poudriere
$ export ANV_VIDEO_DECODE=1 RADV_PERFTEST=video_decode
$ mpv --vo=gpu-next --gpu-api=vulkan --hwdec=vulkan /path/to/file.mp4
[...]
Using hardware decoding (vulkan).
VO: [gpu-next] 1920x1080 vulkan[nv12]
[...]

Tested under X11 (Xwayland) and Wayland (Sway) on Intel Skylake GT2 (0x1912) inside 12.4/13.2 amd64 jail with drm-515-kmod (5.15-lts-focal per bug 274770 to avoid recent DMABUF regressions) on -CURRENT kernel and X11/Wayland sockets passed through.
Comment 1 Jan Beich freebsd_committer freebsd_triage 2023-11-26 20:02:09 UTC
To be accurate, Vulkan Video is already supported but none of the codecs are due to patents (QUEUE_VIDEO_DECODE_BIT_KHR vs. VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR). It gets even weirder after https://gitlab.freedesktop.org/mesa/mesa/-/commit/7b22dd8bfdc3 which disables even non-patented codecs by default.
Comment 2 Emmanuel Vadot freebsd_committer freebsd_triage 2023-11-27 09:07:07 UTC
Tested again on a clean env and indeed this works on both my intel machine.
On my amd machine it says that h264 isn't supported, haven't looked further but I'm good with the patch.
Comment 3 Emmanuel Vadot freebsd_committer freebsd_triage 2023-11-27 09:10:34 UTC
Meh, monday morning strikes again, it works fine on my amd.
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-11-27 10:03:00 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=98949a34f45e194aa83752ebf4bca6fa3fa38478

commit 98949a34f45e194aa83752ebf4bca6fa3fa38478
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-11-25 12:54:22 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-11-27 10:01:12 +0000

    graphics/mesa-dri: enable codecs for Vulkan Video after 29d855b6f775

    Mesa 23 enabled Vulkan Video itself but all codecs are disabled by
    default due to patents. Copy -Dvideo-codecs from mesa-gallium-va to
    avoid the following error:

    [ffmpeg/video] h264: Device does not support decoding h264!

    $ vulkaninfo | fgrep decode
    <empty>
    $ export ANV_VIDEO_DECODE=1 RADV_PERFTEST=video_decode
    $ vulkaninfo | fgrep decode
            VK_KHR_video_decode_queue                   : extension revision 7
    $ pkg upgrade mesa-dri
    $ vulkaninfo | fgrep decode
            VK_KHR_video_decode_h264                    : extension revision 8
            VK_KHR_video_decode_queue                   : extension revision 7

    PR:             275360
    Approved by:    manu

 graphics/mesa-dri/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)