Skip to content

Commit

Permalink
vo: add new vaapi-wayland driver
Browse files Browse the repository at this point in the history
This driver makes use of dmabuffer and viewporter interfaces
to enable efficient display of vaapi surfaces, avoiding
any unnecessary colour space conversion, and avoiding scaling
or colour conversion using GPU shader resources.
  • Loading branch information
boxerab authored and Dudemanguy committed May 24, 2022
1 parent 9022b1b commit defb02d
Show file tree
Hide file tree
Showing 12 changed files with 992 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DOCS/man/options.rst
Expand Up @@ -1249,7 +1249,7 @@ Video
:videotoolbox: requires ``--vo=gpu`` (macOS 10.8 and up),
or ``--vo=libmpv`` (iOS 9.0 and up)
:videotoolbox-copy: copies video back into system RAM (macOS 10.8 or iOS 9.0 and up)
:vaapi: requires ``--vo=gpu`` or ``--vo=vaapi`` (Linux only)
:vaapi: requires ``--vo=gpu``, ``--vo=vaapi`` or ``--vo=vaapi-wayland`` (Linux only)
:vaapi-copy: copies video back into system RAM (Linux with some GPUs only)
:nvdec: requires ``--vo=gpu`` (Any platform CUDA is available)
:nvdec-copy: copies video back to system RAM (Any platform CUDA is available)
Expand Down
8 changes: 8 additions & 0 deletions DOCS/man/vo.rst
Expand Up @@ -286,6 +286,14 @@ Available video output drivers are:
``--sdl-switch-mode``
Instruct SDL to switch the monitor video mode when going fullscreen.

``vaapi-wayland``
Experimental Wayland output driver designed for use with VA API hardware decoding.
The driver is designed to avoid any GPU to CPU copies, and to perform scaling and
color space conversion using fixed-function hardware, if available,
rather than GPU shaders. This frees up GPU resources for other tasks.
Currently this driver is experimental and only works with the ``--hwdec=vaapi`` driver;
OSD is also not supported. Supported compositors : Weston and Sway.

``vaapi``
Intel VA API video output driver with support for hardware decoding. Note
that there is absolutely no reason to use this, other than compatibility.
Expand Down
6 changes: 4 additions & 2 deletions generated/wayland/meson.build
@@ -1,7 +1,9 @@
wl_protocol_dir = wayland['deps'][2].get_variable(pkgconfig: 'pkgdatadir')
protocols = [[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
[wl_protocol_dir, 'stable/presentation-time/presentation-time.xml'],
protocols = [[wl_protocol_dir, 'stable/presentation-time/presentation-time.xml'],
[wl_protocol_dir, 'stable/viewporter/viewporter.xml'],
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
[wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml']]
wl_protocols_source = []
wl_protocols_headers = []
Expand Down
6 changes: 6 additions & 0 deletions meson.build
Expand Up @@ -1432,10 +1432,16 @@ vaapi_wayland = {
'deps': dependency('libva-wayland', version: '>= 1.1.0', required: get_option('vaapi-wayland')),
}
vaapi_wayland += {'use': vaapi['use'] and egl_wayland['use'] and vaapi_wayland['deps'].found()}

if vaapi_wayland['use']
features += vaapi_wayland['name']
endif

if vaapi_wayland['use'] and memfd_create
features += 'vaapi-wayland-memfd'
sources += files('video/out/vo_vaapi_wayland.c')
endif

vaapi_x11 = {
'name': 'vaapi-x11',
'deps': dependency('libva-x11', version: '>= 1.1.0', required: get_option('vaapi-x11')),
Expand Down

3 comments on commit defb02d

@laichiaheng
Copy link

Choose a reason for hiding this comment

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

Hi, doesn't it work with Mutter yet?

@Dudemanguy
Copy link
Member

Choose a reason for hiding this comment

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

This is an experimental VO that shouldn't normally be used. It's mainly for efficiency not quality (think: laptops on battery or such). Anyways, it depends heavily on a compositor supporting formats so it doesn't work on mutter right now.

@avih
Copy link
Member

@avih avih commented on defb02d May 29, 2022

Choose a reason for hiding this comment

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

This causes build failure on some systems - mpv-player/mpv-build#184

../video/out/drm_common.c:1267:10: error: 'DRM_FORMAT_XRGB16161616' undeclared (first use in this function);

Please sign in to comment.