Mesa (main): kopper: Respect the vblank_mode env var.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jul 12 22:23:27 UTC 2022
Module: Mesa
Branch: main
Commit: 679e9697a9bbfe950269fee8aade3bb412eb1075
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=679e9697a9bbfe950269fee8aade3bb412eb1075
Author: Emma Anholt <emma at anholt.net>
Date: Wed Jul 6 17:13:37 2022 -0700
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 at gmail.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17470>
---
src/gallium/frontends/dri/dri_drawable.h | 1 +
src/glx/drisw_glx.c | 11 ++++++++++-
src/glx/drisw_priv.h | 1 +
3 files changed, 12 insertions(+), 1 deletion(-)
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;
More information about the mesa-commit
mailing list