DRI_CONF_OPT_B(vk_x11_ensure_min_image_count, def, \
"Force the X11 WSI to create at least the number of image specified by the driver in VkSurfaceCapabilitiesKHR::minImageCount")
+#define DRI_CONF_VK_XWAYLAND_WAIT_READY(def) \
+ DRI_CONF_OPT_B(vk_xwayland_wait_ready, def, \
+ "Wait for fences before submitting buffers to Xwayland")
+
#define DRI_CONF_MESA_GLTHREAD(def) \
DRI_CONF_OPT_B(mesa_glthread, def, \
"Enable offloading GL driver work to a separate thread")
#include <xf86drm.h>
#include "drm-uapi/drm_fourcc.h"
#include "util/hash_table.h"
+#include "util/u_debug.h"
#include "util/u_thread.h"
#include "util/xmlconfig.h"
}
}
+static bool
+x11_needs_wait_for_fences(const struct wsi_device *wsi_device,
+ struct wsi_x11_connection *wsi_conn,
+ VkPresentModeKHR present_mode)
+{
+ if (wsi_conn->is_xwayland && !wsi_device->x11.xwaylandWaitReady) {
+ return false;
+ }
+
+ switch (present_mode) {
+ case VK_PRESENT_MODE_MAILBOX_KHR:
+ return true;
+ case VK_PRESENT_MODE_IMMEDIATE_KHR:
+ return wsi_conn->is_xwayland;
+ default:
+ return false;
+ }
+}
+
static void *
x11_manage_fifo_queues(void *state)
{
return NULL;
}
- if (chain->base.present_mode == VK_PRESENT_MODE_MAILBOX_KHR ||
- (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR &&
- wsi_conn->is_xwayland)) {
+ if (x11_needs_wait_for_fences(chain->base.wsi, wsi_conn,
+ chain->base.present_mode)) {
result = chain->base.wsi->WaitForFences(chain->base.device, 1,
&chain->base.fences[image_index],
true, UINT64_MAX);
unsigned num_images = pCreateInfo->minImageCount;
if (wsi_device->x11.strict_imageCount)
num_images = pCreateInfo->minImageCount;
- else if (present_mode == VK_PRESENT_MODE_MAILBOX_KHR ||
- (present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR &&
- wsi_conn->is_xwayland))
+ else if (x11_needs_wait_for_fences(wsi_device, wsi_conn, present_mode))
num_images = MAX2(num_images, 5);
else if (wsi_device->x11.ensure_minImageCount)
num_images = MAX2(num_images, x11_get_min_image_count(wsi_device));
}
if ((chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR ||
- chain->base.present_mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR ||
- chain->base.present_mode == VK_PRESENT_MODE_MAILBOX_KHR ||
- (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR &&
- wsi_conn->is_xwayland)) && !chain->base.wsi->sw) {
+ chain->base.present_mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR ||
+ x11_needs_wait_for_fences(wsi_device, wsi_conn,
+ chain->base.present_mode)) &&
+ !chain->base.wsi->sw) {
chain->has_present_queue = true;
/* Initialize our queues. We make them base.image_count + 1 because we will
wsi_device->x11.ensure_minImageCount =
driQueryOptionb(dri_options, "vk_x11_ensure_min_image_count");
}
-
+ wsi_device->x11.xwaylandWaitReady = true;
+ if (driCheckOption(dri_options, "vk_xwayland_wait_ready", DRI_BOOL)) {
+ wsi_device->x11.xwaylandWaitReady =
+ driQueryOptionb(dri_options, "vk_xwayland_wait_ready");
+ }
}
wsi->base.get_support = x11_surface_get_support;