[vlc-devel] [PATCH 3/3] vulkan: add wayland platform

Alexandre Janniaux ajanni at videolabs.io
Tue Apr 7 11:07:18 CEST 2020


Hi,

Thanks for review,

Probably because of this?
https://github.com/mpv-player/mpv/issues/7325

Regards,
--
Alexandre Janniaux
Videolabs

On Mon, Apr 06, 2020 at 07:16:40PM +0200, Niklas Haas wrote:
> How well does this work in practice when using different swapchain
> modes? In mpv land, we force the swapchain into MAILBOX mode (instead of
> the default, FIFO), for wayland, for reasons I don't quite remember the
> specifics of.
>
> It's possible we may need to somehow have the platform influence this
> choice of swap mode as well.
>
> Otherwise LGTM
>
> On Mon,  6 Apr 2020 19:01:52 +0200, Alexandre Janniaux <ajanni at videolabs.io> wrote:
> > ---
> >  modules/video_output/vulkan/Makefile.am       | 12 ++++
> >  .../video_output/vulkan/platform_wayland.c    | 57 +++++++++++++++++++
> >  2 files changed, 69 insertions(+)
> >  create mode 100644 modules/video_output/vulkan/platform_wayland.c
> >
> > diff --git a/modules/video_output/vulkan/Makefile.am b/modules/video_output/vulkan/Makefile.am
> > index e769232575..6bedc3f23e 100644
> > --- a/modules/video_output/vulkan/Makefile.am
> > +++ b/modules/video_output/vulkan/Makefile.am
> > @@ -37,6 +37,14 @@ libvk_x11_plugin_la_CFLAGS = $(AM_CFLAGS) \
> >  	-DVK_USE_PLATFORM_XCB_KHR -DPLATFORM_NAME=X11
> >  libvk_x11_plugin_la_LIBADD = $(VULKAN_COMMONLIBS) $(XCB_LIBS)
> >
> > +libvk_wl_plugin_la_SOURCES = $(VULKAN_COMMONSOURCES) \
> > +	video_output/vulkan/surface.c \
> > +	video_output/vulkan/platform_wayland.c
> > +libvk_wl_plugin_la_CFLAGS = $(AM_CFLAGS) \
> > +	$(WAYLAND_CFLAGS) $(VULKAN_COMMONCFLAGS) \
> > +	-DVK_USE_PLATFORM_WAYLAND_KHR -DPLATFORM_NAME=Wayland
> > +libvk_wl_plugin_la_LIBADD = $(VULKAN_COMMONLIBS) $(WAYLAND_LIBS)
> > +
> >  if HAVE_VULKAN
> >  vout_LTLIBRARIES += libvk_plugin.la
> >
> > @@ -51,4 +59,8 @@ endif
> >  if HAVE_ANDROID
> >  vout_LTLIBRARIES += libvk_android_plugin.la
> >  endif
> > +
> > +if HAVE_WAYLAND
> > +vout_LTLIBRARIES += libvk_wl_plugin.la
> > +endif
> >  endif
> > diff --git a/modules/video_output/vulkan/platform_wayland.c b/modules/video_output/vulkan/platform_wayland.c
> > new file mode 100644
> > index 0000000000..2e96c00dde
> > --- /dev/null
> > +++ b/modules/video_output/vulkan/platform_wayland.c
> > @@ -0,0 +1,57 @@
> > +/**
> > + * @file platform_wayland.c
> > + * @brief Vulkan platform-specific code for Wayland
> > + */
> > +/*****************************************************************************
> > + * Copyright © 2020 VideoLabs
> > + *
> > + * This program is free software; you can redistribute it and/or modify it
> > + * under the terms of the GNU Lesser General Public License as published by
> > + * the Free Software Foundation; either version 2.1 of the License, or
> > + * (at your option) any later version.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > + * GNU Lesser General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU Lesser General Public License
> > + * along with this program; if not, write to the Free Software Foundation,
> > + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
> > + *****************************************************************************/
> > +
> > +#include "platform.h"
> > +
> > +int vlc_vk_InitPlatform(vlc_vk_t *vk)
> > +{
> > +    if (vk->window->type != VOUT_WINDOW_TYPE_WAYLAND)
> > +        return VLC_EGENERIC;
> > +
> > +    return VLC_SUCCESS;
> > +}
> > +
> > +void vlc_vk_ClosePlatform(vlc_vk_t *vk)
> > +{
> > +    VLC_UNUSED(vk);
> > +}
> > +
> > +const char * const vlc_vk_PlatformExt = VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME;
> > +
> > +int vlc_vk_CreateSurface(vlc_vk_t *vk)
> > +{
> > +    VkInstance vkinst = vk->instance->instance;
> > +
> > +    VkWaylandSurfaceCreateInfoKHR surface_info = {
> > +        .sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR,
> > +        .display = vk->window->display.wl,
> > +        .surface = vk->window->handle.wl,
> > +    };
> > +
> > +    VkResult res = vkCreateWaylandSurfaceKHR(vkinst, &surface_info, NULL, &vk->surface);
> > +    if (res != VK_SUCCESS) {
> > +        msg_Err(vk, "Failed creating Wayland surface");
> > +        return VLC_EGENERIC;
> > +    }
> > +
> > +    return VLC_SUCCESS;
> > +}
> > --
> > 2.26.0
> >
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list