diff mbox

DRI2: don't advertise GLX_INTEL_swap_event if it can't

Message ID 1363131866-12573-1-git-send-email-robdclark@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rob Clark March 12, 2013, 11:44 p.m. UTC
If ddx does not support swap, don't advertise it.  We might also be
able to get rid of the vmwgfx check (I'm not quite sure the purpose of
that check vs. just checking dri2Minor.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 src/glx/dri2_glx.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Paul Menzel March 13, 2013, 12:25 p.m. UTC | #1
Dear Rob,


Am Dienstag, den 12.03.2013, 19:44 -0400 schrieb Rob Clark:

»it« sounds  strange in commit summary.

> If ddx does not support swap, don't advertise it.

So how is `dri2BindExtensions` changed. Some things passed beforehand
are already available in `struct dri2_screen *psc`?

Are bugs fixed by this or did you find this reading through the code?

> We might also be able to get rid of the vmwgfx check (I'm not quite
> sure the purpose of that check vs. just checking dri2Minor.

Missing »)«.

> Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
>  src/glx/dri2_glx.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
> index c4f6996..b2d712c 100644
> --- a/src/glx/dri2_glx.c
> +++ b/src/glx/dri2_glx.c
> @@ -1051,11 +1051,16 @@ static const struct glx_context_vtable dri2_context_vtable = {
>  };
>  
>  static void
> -dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions,
> +dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv,

No space after the * in `* priv`?

>                     const char *driverName)
>  {
> +   const struct dri2_display *const pdp = (struct dri2_display *)
> +      priv->dri2Display;
> +   const __DRIextension **extensions;
>     int i;
>  
> +   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");
> @@ -1069,7 +1074,7 @@ dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions,
>      * of disabling it uncondtionally, just disable it for drivers
>      * which are known to not support it.
>      */
> -   if (strcmp(driverName, "vmwgfx") != 0) {
> +   if (pdp->swapAvailable && strcmp(driverName, "vmwgfx") != 0) {
>        __glXEnableDirectExtension(&psc->base, "GLX_INTEL_swap_event");
>     }
>  
> @@ -1212,8 +1217,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
>        goto handle_error;
>     }
>  
> -   extensions = psc->core->getExtensions(psc->driScreen);
> -   dri2BindExtensions(psc, extensions, driverName);
> +   dri2BindExtensions(psc, priv, driverName);
>  
>     configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs);
>     visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs);


Thanks,

Paul
diff mbox

Patch

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index c4f6996..b2d712c 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -1051,11 +1051,16 @@  static const struct glx_context_vtable dri2_context_vtable = {
 };
 
 static void
-dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions,
+dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv,
                    const char *driverName)
 {
+   const struct dri2_display *const pdp = (struct dri2_display *)
+      priv->dri2Display;
+   const __DRIextension **extensions;
    int i;
 
+   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");
@@ -1069,7 +1074,7 @@  dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions,
     * of disabling it uncondtionally, just disable it for drivers
     * which are known to not support it.
     */
-   if (strcmp(driverName, "vmwgfx") != 0) {
+   if (pdp->swapAvailable && strcmp(driverName, "vmwgfx") != 0) {
       __glXEnableDirectExtension(&psc->base, "GLX_INTEL_swap_event");
    }
 
@@ -1212,8 +1217,7 @@  dri2CreateScreen(int screen, struct glx_display * priv)
       goto handle_error;
    }
 
-   extensions = psc->core->getExtensions(psc->driScreen);
-   dri2BindExtensions(psc, extensions, driverName);
+   dri2BindExtensions(psc, priv, driverName);
 
    configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs);
    visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs);