summaryrefslogtreecommitdiffstats
path: root/src/vulkan
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-03-14 06:06:00 +1000
committerMarek Olšák <[email protected]>2018-03-16 13:19:45 -0400
commit7aeef2d4efdc809a698e9b983c8be8e4ccb27134 (patch)
tree600be5aa6efe62480995686d8c740ec6f58bbba7 /src/vulkan
parentf099c3aef1635f05f295969d296375fe9983a53a (diff)
dri3: allow building against older xcb (v3)
I'm not sure everyone wants to be updating their dri3 in a forced march setting, this allows a nicer approach, esp when you want to build on distro that aren't brand new. I'm sure there are plenty of ways this patch could be cleaner, and I've also not built it against an updated dri3. For meson I've just left it alone, since if you are using meson you probably don't mind xcb updates, and if you are using meson you can fix this better than me. v3: just don't put a version in for dri3/present without modifiers, should allow building with 1.11 as well (feel free to supply meson followups) Signed-off-by: Dave Airlie <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/wsi/wsi_common_x11.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 0667aa1dbc9..71d62cb4cb7 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -759,9 +759,11 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
/* The winsys is now trying to flip directly and cannot due to our
* configuration. Request the user reallocate.
*/
+#ifdef HAVE_DRI3_MODIFIERS
if (complete->mode == XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY &&
chain->last_present_mode != XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY)
result = VK_SUBOPTIMAL_KHR;
+#endif
/* When we go from flipping to copying, the odds are very likely that
* we could reallocate in a more optimal way if we didn't have to care
@@ -908,8 +910,10 @@ x11_present_to_x11(struct x11_swapchain *chain, uint32_t image_index,
if (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR)
options |= XCB_PRESENT_OPTION_ASYNC;
+#ifdef HAVE_DRI3_MODIFIERS
if (chain->has_dri3_modifiers)
options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
+#endif
xshmfence_reset(image->shm_fence);
@@ -1046,6 +1050,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
image->pixmap = xcb_generate_id(chain->conn);
+#ifdef HAVE_DRI3_MODIFIERS
if (image->base.drm_modifier != DRM_FORMAT_MOD_INVALID) {
/* If the image has a modifier, we must have DRI3 v1.2. */
assert(chain->has_dri3_modifiers);
@@ -1068,7 +1073,9 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
chain->depth, bpp,
image->base.drm_modifier,
image->base.fds);
- } else {
+ } else
+#endif
+ {
/* Without passing modifiers, we can't have multi-plane RGB images. */
assert(image->base.num_planes == 1);
@@ -1151,6 +1158,7 @@ wsi_x11_get_dri3_modifiers(struct wsi_x11_connection *wsi_conn,
if (!wsi_conn->has_dri3_modifiers)
goto out;
+#ifdef HAVE_DRI3_MODIFIERS
xcb_generic_error_t *error = NULL;
xcb_dri3_get_supported_modifiers_cookie_t mod_cookie =
xcb_dri3_get_supported_modifiers(conn, window, depth, bpp);
@@ -1210,7 +1218,7 @@ wsi_x11_get_dri3_modifiers(struct wsi_x11_connection *wsi_conn,
free(mod_reply);
return;
-
+#endif
out:
*num_tranches_in = 0;
}