diff --git a/src/xrt/compositor/main/comp_window_direct_mode.c b/src/xrt/compositor/main/comp_window_direct_mode.c index 624b2ae01..443211dfc 100644 --- a/src/xrt/compositor/main/comp_window_direct_mode.c +++ b/src/xrt/compositor/main/comp_window_direct_mode.c @@ -325,8 +325,7 @@ comp_window_direct_init_nvidia(struct comp_window *w) struct vk_bundle comp_vk = w->c->vk; // find our display using nvidia whitelist, enumerate its modes, and - // pick the best one - // get a list of attached displays + // pick the best one get a list of attached displays uint32_t display_count; if (comp_vk.vkGetPhysicalDeviceDisplayPropertiesKHR( comp_vk.physical_device, &display_count, NULL) != VK_SUCCESS) { @@ -334,6 +333,11 @@ comp_window_direct_init_nvidia(struct comp_window *w) return false; } + if (display_count == 0) { + COMP_ERROR(w->c, "NVIDIA: No Vulkan displays found."); + return false; + } + struct VkDisplayPropertiesKHR *display_props = U_TYPED_ARRAY_CALLOC(VkDisplayPropertiesKHR, display_count);