From 03b9f8e32362b4ca8fcf4b14e0008ca3b13e06ce Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sat, 12 Jun 2021 09:50:51 -0700 Subject: [PATCH] vo_gpu: vulkan: displayvk: Fix handling of unconnected planes If a plane is not connected to any displays, we won't set an entry in the mapping of planes to displays. So ensure these unset entries are null and skip them. Fixes #8913 --- video/out/vulkan/context_display.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/video/out/vulkan/context_display.c b/video/out/vulkan/context_display.c index 706c952604..5545b3378d 100644 --- a/video/out/vulkan/context_display.c +++ b/video/out/vulkan/context_display.c @@ -93,8 +93,9 @@ static bool walk_display_properties(struct mp_log *log, goto done; } + // Allocate zeroed arrays so that planes with no displays have a null entry. VkDisplayKHR **planes_to_displays = - talloc_array(tmp, VkDisplayKHR *, num_planes); + talloc_zero_array(tmp, VkDisplayKHR *, num_planes); for (int j = 0; j < num_planes; j++) { int num_displays_for_plane = 0; vkGetDisplayPlaneSupportedDisplaysKHR(device, j, @@ -177,6 +178,10 @@ static bool walk_display_properties(struct mp_log *log, mp_msg(log, msgl_info, " Planes:\n"); for (int k = 0; k < num_planes; k++) { VkDisplayKHR *displays = planes_to_displays[k]; + if (!displays) { + // This plane is not connected to any displays. + continue; + } for (int d = 0; displays[d]; d++) { if (displays[d] == display) { if (selector && selector->plane_idx != k)