[vlc-devel] [PATCH 3/5] vout: add new vulkan/libplacebo vout

Niklas Haas vlc at haasn.xyz
Sat Oct 13 10:02:40 CEST 2018


On Sat, 13 Oct 2018 10:38:07 +0300, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le keskiviikkona 10. lokakuuta 2018, 4.46.35 EEST Niklas Haas a écrit :
> > - How to create the vulkan surface will depend on the platform (much
> >   like in opengl), so we move context, surface and device creation into
> >   a single module (`vulkan/surface.c`) which will be conditionally
> >   compiled depending on the platform in order to provide support for
> >   multiple surfaces side-by-side (e.g. x11 and wayland). This does mean
> >   that the context/device-related options end up being separate per
> >   platform, but OTOH this is not that bad since different platforms
> >   might want different e.g. swapchain modes (an example being wayland,
> >   which can make better use of mailbox rather than fifo).
> 
> While this makes sense at a high level, it seems unlikely that the low-level 
> design will be proper if you test it only with old-style windowing protocols 
> (X11, Win32) and not with race-free protocols such as Wayland.

For wayland support, you can have a look at how `mpv` does it: the only
major difference in the vulkan swapchain code for wayland is that it
forces MAILBOX instead of FIFO, because this guarantees the swapchain
won't block on image acquisition if the window is not visible.

Whether or not that would even pose a problem depends on the design of
VLC - in mpv it blocks the entire play loop. Depending on whether or not
VLC blocks if the vout is not rendering images, it's possible we might
not even need mailbox. This would also allow us to avoid paying the
extra GPU cost of video rendering when the image is not visible.

Testing would definitely be helpful. In terms of the code, wayland
support should be relatively straightforward to implement using the
xcb/win32 code as a reference.

If you want to give it a try, the relevant surface creation call is
vkCreateWaylandSurfaceKHR, and the info struct looks like this:

typedef struct VkWaylandSurfaceCreateInfoKHR {
    VkStructureType                   sType;
    const void*                       pNext;
    VkWaylandSurfaceCreateFlagsKHR    flags;
    struct wl_display*                display;
    struct wl_surface*                surface;
} VkWaylandSurfaceCreateInfoKHR;

(where flags is 0, pNext is NULL, sType is
VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR)

The surface extension name is VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, and
the needed compile flag is -DVK_USE_PLATFORM_WAYLAND_KHR. Everything
else should be vlc/wayland-specific code.


More information about the vlc-devel mailing list