vulkan/wsi/x11: Set OUT_OF_DATE if wait_for_special_event fails
[mesa.git] / src / vulkan / wsi / wsi_common_x11.c
index 04ce810e5618dfd86a8fd69ba79dc0d2497b2dc4..15d291463e9012b637792d854971d4dc0088b153 100644 (file)
@@ -405,7 +405,6 @@ x11_surface_get_support(VkIcdSurfaceBase *icd_surface,
                         const VkAllocationCallbacks *alloc,
                         uint32_t queueFamilyIndex,
                         int local_fd,
-                        bool can_handle_different_gpu,
                         VkBool32* pSupported)
 {
    xcb_connection_t *conn = x11_surface_get_connection(icd_surface);
@@ -421,10 +420,6 @@ x11_surface_get_support(VkIcdSurfaceBase *icd_surface,
       return VK_SUCCESS;
    }
 
-   if (!can_handle_different_gpu)
-      if (!wsi_x11_check_dri3_compatible(conn, local_fd))
-         return false;
-
    unsigned visual_depth;
    if (!get_visualtype_for_window(conn, window, &visual_depth)) {
       *pSupported = false;
@@ -904,8 +899,10 @@ x11_manage_fifo_queues(void *state)
       while (chain->last_present_msc < target_msc) {
          xcb_generic_event_t *event =
             xcb_wait_for_special_event(chain->conn, chain->special_event);
-         if (!event)
+         if (!event) {
+            result = VK_ERROR_OUT_OF_DATE_KHR;
             goto fail;
+         }
 
          result = x11_handle_dri3_present_event(chain, (void *)event);
          free(event);
@@ -934,25 +931,29 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
    if (chain->base.use_prime_blit) {
       result = wsi_create_prime_image(&chain->base, pCreateInfo, &image->base);
    } else {
-      result = wsi_create_native_image(&chain->base, pCreateInfo, &image->base);
+      result = wsi_create_native_image(&chain->base, pCreateInfo,
+                                       0, NULL, NULL, &image->base);
    }
    if (result != VK_SUCCESS)
       return result;
 
    image->pixmap = xcb_generate_id(chain->conn);
 
+   /* Without passing modifiers, we can't have multi-plane RGB images. */
+   assert(image->base.num_planes == 1);
+
    cookie =
       xcb_dri3_pixmap_from_buffer_checked(chain->conn,
                                           image->pixmap,
                                           chain->window,
-                                          image->base.size,
+                                          image->base.sizes[0],
                                           pCreateInfo->imageExtent.width,
                                           pCreateInfo->imageExtent.height,
-                                          image->base.row_pitch,
+                                          image->base.row_pitches[0],
                                           chain->depth, bpp,
-                                          image->base.fd);
+                                          image->base.fds[0]);
    xcb_discard_reply(chain->conn, cookie.sequence);
-   image->base.fd = -1; /* XCB has now taken ownership of the FD */
+   image->base.fds[0] = -1; /* XCB has now taken ownership of the FD */
 
    int fence_fd = xshmfence_alloc_shm();
    if (fence_fd < 0)