c/direct_mode: Check if NVIDIA path found any displays.

This helps failing earlier with an NVIDIA Optimus setup, which currently
is not supported.
This commit is contained in:
Lubosz Sarnecki 2020-04-02 17:22:23 +02:00
parent 6158a23dd9
commit 7afb012544

View file

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