[Mesa-dev] [PATCH RFC 2/4] dri: Optionally turn off a couple of GLX extensions based on driconf options
Thomas Hellstrom
thellstrom at vmware.com
Fri May 5 14:02:22 UTC 2017
With GLX_EXT_buffer_age turned on, gnome-shell will use full-screen damage
with GLX, which severely hurts performance with architectures that emulate
page-flips with copies. Like vmware. We would like to be able to turn off that
extension. Similarly, typically the GLX_OML_sync_control doesn't make much
sense on a virtual architecture since we don't really sync to the host's
vertical retrace. We'd like to be able to turn it off as well.
Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
---
src/glx/dri2_glx.c | 7 ++++++-
src/glx/dri3_glx.c | 11 +++++++++--
src/mesa/drivers/dri/common/xmlpool/t_options.h | 10 ++++++++++
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 145f44d..f17de01 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -1298,12 +1298,17 @@ dri2CreateScreen(int screen, struct glx_display * priv)
psp->getBufferAge = NULL;
if (pdp->driMinor >= 2) {
+ unsigned char disable;
+
psp->getDrawableMSC = dri2DrawableGetMSC;
psp->waitForMSC = dri2WaitForMSC;
psp->waitForSBC = dri2WaitForSBC;
psp->setSwapInterval = dri2SetSwapInterval;
psp->getSwapInterval = dri2GetSwapInterval;
- __glXEnableDirectExtension(&psc->base, "GLX_OML_sync_control");
+ if (psc->config->configQueryb(psc->driScreen,
+ "glx_disable_oml_sync_control",
+ &disable) || !disable)
+ __glXEnableDirectExtension(&psc->base, "GLX_OML_sync_control");
}
/* DRI2 supports SubBuffer through DRI2CopyRegion, so it's always
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index e1dc5aa..4264fd8 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -780,6 +780,7 @@ dri3_create_screen(int screen, struct glx_display * priv)
struct glx_config *configs = NULL, *visuals = NULL;
char *driverName, *deviceName, *tmp;
int i;
+ unsigned char disable;
psc = calloc(1, sizeof *psc);
if (psc == NULL)
@@ -918,13 +919,19 @@ dri3_create_screen(int screen, struct glx_display * priv)
psp->waitForSBC = dri3_wait_for_sbc;
psp->setSwapInterval = dri3_set_swap_interval;
psp->getSwapInterval = dri3_get_swap_interval;
- __glXEnableDirectExtension(&psc->base, "GLX_OML_sync_control");
+ if (psc->config->configQueryb(psc->driScreen,
+ "glx_disable_oml_sync_control",
+ &disable) || !disable)
+ __glXEnableDirectExtension(&psc->base, "GLX_OML_sync_control");
psp->copySubBuffer = dri3_copy_sub_buffer;
__glXEnableDirectExtension(&psc->base, "GLX_MESA_copy_sub_buffer");
psp->getBufferAge = dri3_get_buffer_age;
- __glXEnableDirectExtension(&psc->base, "GLX_EXT_buffer_age");
+ if (psc->config->configQueryb(psc->driScreen,
+ "glx_disable_ext_buffer_age",
+ &disable) || !disable)
+ __glXEnableDirectExtension(&psc->base, "GLX_EXT_buffer_age");
free(driverName);
free(deviceName);
diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index cd4f025..3a8618b 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -323,6 +323,16 @@ DRI_CONF_OPT_BEGIN_B(mesa_glthread, def) \
DRI_CONF_DESC(en,gettext("Enable offloading GL driver work to a separate thread")) \
DRI_CONF_OPT_END
+#define DRI_CONF_DISABLE_EXT_BUFFER_AGE(def) \
+DRI_CONF_OPT_BEGIN_B(glx_disable_ext_buffer_age, def) \
+ DRI_CONF_DESC(en, gettext("Disable the GLX_EXT_buffer_age extension")) \
+DRI_CONF_OPT_END
+
+#define DRI_CONF_DISABLE_OML_SYNC_CONTROL(def) \
+DRI_CONF_OPT_BEGIN_B(glx_disable_oml_sync_control, def) \
+ DRI_CONF_DESC(en, gettext("Disable the GLX_OML_sync_control extension")) \
+DRI_CONF_OPT_END
+
/**
* \brief Software-fallback options. To allow using features (like
--
2.7.4
More information about the mesa-dev
mailing list