[vlc-devel] [PATCH 09/17] vulkan: force swapchain resize on display size change

Romain Vimont rom1v at videolabs.io
Wed Apr 14 09:29:00 UTC 2021


On Mon, Apr 12, 2021 at 03:32:25PM +0200, Alexandre Janniaux wrote:
> On Windows the swapchain might not be re-created automatically, which
> result in glitches when using the vk output. This enforce the creation

typo: "which results"
typo: "This enforces"

> of the swapchain as soon as the display size is changed.
> 
> On Wayland, the size of the window is the size of the content so there
> is no automatic swapchain sizing and this call is mandatory.
> ---
>  modules/video_output/vulkan/display.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/modules/video_output/vulkan/display.c b/modules/video_output/vulkan/display.c
> index afeede820e..dc6cb2726c 100644
> --- a/modules/video_output/vulkan/display.c
> +++ b/modules/video_output/vulkan/display.c
> @@ -402,6 +402,26 @@ static int Control(vout_display_t *vd, int query)
>      case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
>      case VOUT_DISPLAY_CHANGE_ZOOM: {
>          vout_display_PlacePicture(&sys->place, vd->source, vd->cfg);
> +
> +        /* The following resize should be automatic on most platforms but can
> +         * trigger bugs on some platform with some drivers, that have been seen
> +         * on Windows in particular. Doing it right now enforce the correct

typo: "enforces"

> +         * behavior and prevent these bugs.

typo: "prevents"

> +         * In addition, platforms like Wayland need the call as the size of the
> +         * window is defined by the size of the content, and not the opposite.
> +         * The swapchain creation won't be done twice with this call. */
> +#if PL_API_VER >= 18
> +        if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
> +        {
> +            int width = (int) vd->cfg->display.width;
> +            int height = (int) vd->cfg->display.height;
> +            pl_swapchain_resize(sys->swapchain, &width, &height);
> +
> +            if (width != (int) vd->cfg->display.width
> +             || height != (int) vd->cfg->display.height)
> +                return VLC_EGENERIC;
> +        }
> +#endif
>          return VLC_SUCCESS;
>      }
>  
> -- 
> 2.31.1
> 
> _______________________________________________
> 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