summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmma Anholt <emma@anholt.net>2022-07-06 17:13:37 -0700
committerMarge Bot <emma+marge@anholt.net>2022-07-12 21:57:23 +0000
commit679e9697a9bbfe950269fee8aade3bb412eb1075 (patch)
treeba025084c221018ad98561fa3788a50ad8a48d6a
parentff18be0872ad98bf842ba6dab02493a58985495e (diff)
kopper: Respect the vblank_mode env var.
We were defaulting to a swap interval of 1, but we can follow dri2/dri3's lead and respect the driconf var. Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17470>
-rw-r--r--src/gallium/frontends/dri/dri_drawable.h1
-rw-r--r--src/glx/drisw_glx.c11
-rw-r--r--src/glx/drisw_priv.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/src/gallium/frontends/dri/dri_drawable.h b/src/gallium/frontends/dri/dri_drawable.h
index 2226d8a8c62..f0453094fec 100644
--- a/src/gallium/frontends/dri/dri_drawable.h
+++ b/src/gallium/frontends/dri/dri_drawable.h
@@ -59,6 +59,7 @@ struct dri_drawable
struct pipe_resource *textures[ST_ATTACHMENT_COUNT];
struct pipe_resource *msaa_textures[ST_ATTACHMENT_COUNT];
unsigned int texture_mask, texture_stamp;
+ int swap_interval;
struct pipe_fence_handle *throttle_fence;
bool flushing; /* prevents recursion in dri_flush */
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 4bd7d8cdb84..cdbcb31289d 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -35,6 +35,7 @@
#include <assert.h>
#include "util/debug.h"
#include "kopper_interface.h"
+#include "loader_dri_helper.h"
static int xshm_error = 0;
static int xshm_opcode = -1;
@@ -706,7 +707,9 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable,
if (kopper) {
pdp->driDrawable =
(*kopper->createNewDrawable) (psc->driScreen, config->driConfig, pdp, !(type & GLX_WINDOW_BIT));
- pdp->swapInterval = 1;
+
+ pdp->swapInterval = dri_get_initial_swap_interval(psc->driScreen, psc->config);
+ psc->kopper->setSwapInterval(pdp->driDrawable, pdp->swapInterval);
}
else
pdp->driDrawable =
@@ -845,6 +848,9 @@ driswBindExtensions(struct drisw_screen *psc, const __DRIextension **extensions)
}
if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0)
psc->f = (__DRI2flushExtension *) extensions[i];
+ if ((strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0))
+ psc->config = (__DRI2configQueryExtension *) extensions[i];
+
}
if (psc->kopper) {
@@ -894,6 +900,9 @@ kopperSetSwapInterval(__GLXDRIdrawable *pdraw, int interval)
struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw;
struct drisw_screen *psc = (struct drisw_screen *) pdp->base.psc;
+ if (!dri_valid_swap_interval(psc->driScreen, psc->config, interval))
+ return GLX_BAD_VALUE;
+
psc->kopper->setSwapInterval(pdp->driDrawable, interval);
pdp->swapInterval = interval;
diff --git a/src/glx/drisw_priv.h b/src/glx/drisw_priv.h
index 3843942ca1c..008953c8dd6 100644
--- a/src/glx/drisw_priv.h
+++ b/src/glx/drisw_priv.h
@@ -52,6 +52,7 @@ struct drisw_screen
const __DRIswrastExtension *swrast;
const __DRIkopperExtension *kopper;
const __DRI2flushExtension *f;
+ const __DRI2configQueryExtension *config;
const __DRItexBufferExtension *texBuffer;
const __DRIcopySubBufferExtension *copySubBuffer;
const __DRI2rendererQueryExtension *rendererQuery;