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
This commit is contained in:
Philip Langdale 2021-06-12 09:50:51 -07:00
parent dbbf4a415d
commit 03b9f8e323
1 changed files with 6 additions and 1 deletions

View File

@ -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)