summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2022-12-19 12:00:42 -0500
committerMarge Bot <emma+marge@anholt.net>2023-01-13 19:59:26 +0000
commit81f77f999b5a4de9115c0f22c36c1953b57aeea7 (patch)
tree05eefaac0439fa93da4c672925ca970150b40de8 /src/glx
parent862bf420a96c8dace856fa8c7a50ef7db4f0ec5e (diff)
downloadmesa-81f77f999b5a4de9115c0f22c36c1953b57aeea7.tar.gz
glx/dri3: Simplify protocol version tracking
This is really just a single elaborate capability check, so stash a boolean in the display state for it. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20549>
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/dri3_glx.c21
-rw-r--r--src/glx/dri3_priv.h10
2 files changed, 13 insertions, 18 deletions
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 949ef0c40da..f957a431dc7 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -356,10 +356,7 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
pdraw->base.psc = &psc->base;
#ifdef HAVE_DRI3_MODIFIERS
- if ((psc->image && psc->image->base.version >= 15) &&
- (pdp->dri3Major > 1 || (pdp->dri3Major == 1 && pdp->dri3Minor >= 2)) &&
- (pdp->presentMajor > 1 ||
- (pdp->presentMajor == 1 && pdp->presentMinor >= 2)))
+ if (pdp->has_multibuffer && psc->image && psc->image->base.version >= 15)
has_multibuffer = true;
#endif
@@ -1095,7 +1092,7 @@ dri3_create_display(Display * dpy)
PRESENT_SUPPORTED_MAJOR,
PRESENT_SUPPORTED_MINOR);
- pdp = malloc(sizeof *pdp);
+ pdp = calloc(1, sizeof *pdp);
if (pdp == NULL)
return NULL;
@@ -1105,8 +1102,8 @@ dri3_create_display(Display * dpy)
goto no_extension;
}
- pdp->dri3Major = dri3_reply->major_version;
- pdp->dri3Minor = dri3_reply->minor_version;
+ int dri3Major = dri3_reply->major_version;
+ int dri3Minor = dri3_reply->minor_version;
free(dri3_reply);
present_reply = xcb_present_query_version_reply(c, present_cookie, &error);
@@ -1114,10 +1111,16 @@ dri3_create_display(Display * dpy)
free(error);
goto no_extension;
}
- pdp->presentMajor = present_reply->major_version;
- pdp->presentMinor = present_reply->minor_version;
+ int presentMajor = present_reply->major_version;
+ int presentMinor = present_reply->minor_version;
free(present_reply);
+#ifdef HAVE_DRI3_MODIFIERS
+ if ((dri3Major > 1 || (dri3Major == 1 && dri3Minor >= 2)) &&
+ (presentMajor > 1 || (presentMajor == 1 && presentMinor >= 2)))
+ pdp->has_multibuffer = true;
+#endif
+
pdp->base.destroyDisplay = dri3_destroy_display;
pdp->base.createScreen = dri3_create_screen;
diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
index c7ef8dff19c..862ce32baba 100644
--- a/src/glx/dri3_priv.h
+++ b/src/glx/dri3_priv.h
@@ -67,15 +67,7 @@ struct dri3_display
__GLXDRIdisplay base;
const __DRIextension **loader_extensions;
-
- /* DRI3 bits */
- int dri3Major;
- int dri3Minor;
-
- /* Present bits */
- int hasPresent;
- int presentMajor;
- int presentMinor;
+ int has_multibuffer;
};
struct dri3_screen {