glx/dri: Add a driconf option to disable GLX_SGI_video_sync
authorThomas Hellstrom <thellstrom@vmware.com>
Mon, 26 Feb 2018 13:27:40 +0000 (14:27 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Thu, 8 Mar 2018 06:26:29 +0000 (07:26 +0100)
Drivers on virtual hardware don't want to expose this extension to
GLX compositors, similarly to GLX_OML_sync_control, since that significantly
increases latency.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
src/glx/dri2_glx.c
src/glx/dri3_glx.c
src/util/xmlpool/t_options.h

index 0f44635725d86161a3ca7f2e104a208c62960706..91afc3375058d9f7e67e5aa3f808d9878b95e60b 100644 (file)
@@ -1102,7 +1102,6 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv,
 
    extensions = psc->core->getExtensions(psc->driScreen);
 
-   __glXEnableDirectExtension(&psc->base, "GLX_SGI_video_sync");
    __glXEnableDirectExtension(&psc->base, "GLX_SGI_swap_control");
    __glXEnableDirectExtension(&psc->base, "GLX_MESA_swap_control");
    __glXEnableDirectExtension(&psc->base, "GLX_SGI_make_current_read");
@@ -1207,6 +1206,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
    char *driverName = NULL, *loader_driverName, *deviceName, *tmp;
    drm_magic_t magic;
    int i;
+   unsigned char disable;
 
    psc = calloc(1, sizeof *psc);
    if (psc == NULL)
@@ -1325,8 +1325,6 @@ 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;
@@ -1338,6 +1336,11 @@ dri2CreateScreen(int screen, struct glx_display * priv)
          __glXEnableDirectExtension(&psc->base, "GLX_OML_sync_control");
    }
 
+   if (psc->config->configQueryb(psc->driScreen,
+                                 "glx_disable_sgi_video_sync",
+                                 &disable) || !disable)
+      __glXEnableDirectExtension(&psc->base, "GLX_SGI_video_sync");
+
    /* DRI2 supports SubBuffer through DRI2CopyRegion, so it's always
     * available.*/
    psp->copySubBuffer = dri2CopySubBuffer;
index 016f91b1963ee4156c63aba977b1fa87e3146201..adfc34996884b79ed8b3ab7fa3b6eb3e955b38bd 100644 (file)
@@ -721,7 +721,6 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
 
    extensions = psc->core->getExtensions(psc->driScreen);
 
-   __glXEnableDirectExtension(&psc->base, "GLX_SGI_video_sync");
    __glXEnableDirectExtension(&psc->base, "GLX_SGI_swap_control");
    __glXEnableDirectExtension(&psc->base, "GLX_MESA_swap_control");
    __glXEnableDirectExtension(&psc->base, "GLX_SGI_make_current_read");
@@ -956,6 +955,11 @@ dri3_create_screen(int screen, struct glx_display * priv)
                                  &disable) || !disable)
       __glXEnableDirectExtension(&psc->base, "GLX_OML_sync_control");
 
+   if (psc->config->configQueryb(psc->driScreen,
+                                 "glx_disable_sgi_video_sync",
+                                 &disable) || !disable)
+      __glXEnableDirectExtension(&psc->base, "GLX_SGI_video_sync");
+
    psp->copySubBuffer = dri3_copy_sub_buffer;
    __glXEnableDirectExtension(&psc->base, "GLX_MESA_copy_sub_buffer");
 
index 5f377c9dcd5c504c5ebd263ba1dacdee969294a9..3ada813d639d7a842a3f21ce15fbeae30d37239b 100644 (file)
@@ -346,6 +346,11 @@ 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
 
+#define DRI_CONF_DISABLE_SGI_VIDEO_SYNC(def) \
+DRI_CONF_OPT_BEGIN_B(glx_disable_sgi_video_sync, def) \
+   DRI_CONF_DESC(en, gettext("Disable the GLX_SGI_video_sync extension")) \
+DRI_CONF_OPT_END
+
 
 /**
  * \brief Software-fallback options.  To allow using features (like