summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2021-06-12 09:50:51 -0700
committerPhilip Langdale <philipl@overt.org>2021-06-12 09:52:37 -0700
commit03b9f8e32362b4ca8fcf4b14e0008ca3b13e06ce (patch)
treed945e3c36bac8e7da6220888551f388b96ebf120
parentdbbf4a415de7866c6fe2dce10142d8a185eb0660 (diff)
downloadmpv-03b9f8e32362b4ca8fcf4b14e0008ca3b13e06ce.tar.bz2
mpv-03b9f8e32362b4ca8fcf4b14e0008ca3b13e06ce.tar.xz
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
-rw-r--r--video/out/vulkan/context_display.c7
1 files changed, 6 insertions, 1 deletions
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)