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>
This commit is contained in:
Emma Anholt 2022-07-06 17:13:37 -07:00 committed by Marge Bot
parent ff18be0872
commit 679e9697a9
3 changed files with 12 additions and 1 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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;