[vlc-commits] vulkan: force swapchain resize on display size change
Alexandre Janniaux
git at videolan.org
Sat Apr 11 09:13:25 CEST 2020
vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Sat Aug 10 18:58:16 2019 +0200| [2c33d96e490bf50f8fc0160554af6d9a6c16d216] | committer: Alexandre Janniaux
vulkan: force swapchain resize on display size change
On Windows the swapchain might not be re-created automatically, which
result in glitches when using the vk output. This enforce the creation
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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c33d96e490bf50f8fc0160554af6d9a6c16d216
---
modules/video_output/vulkan/display.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/modules/video_output/vulkan/display.c b/modules/video_output/vulkan/display.c
index 174627d67d..283bd864bc 100644
--- a/modules/video_output/vulkan/display.c
+++ b/modules/video_output/vulkan/display.c
@@ -351,6 +351,24 @@ static int Control(vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_ZOOM: {
vout_display_cfg_t cfg = *va_arg (ap, const vout_display_cfg_t *);
vout_display_PlacePicture(&sys->place, &vd->source, &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
+ * behavior and prevent these bugs.
+ * 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 (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
+ {
+ int width = (int) cfg.display.width;
+ int height = (int) cfg.display.height;
+ pl_swapchain_resize(sys->vk->swapchain, &width, &height);
+
+ if (width != (int) cfg.display.width
+ || height != (int) cfg.display.height)
+ return VLC_EGENERIC;
+ }
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list