[PATCH] glx: Require at least one True/DirectColor visual

Ian Romanick idr at freedesktop.org
Fri Sep 28 11:10:03 PDT 2012


On 09/27/2012 02:44 PM, Adam Jackson wrote:
> Mesa no longer supports rendering to anything less.  GLX 1.2 requires
> that the server advertise at least one GLX visual.  GLX 1.3 and 1.4 are
> more subtle: they require at least one fbconfig capable of window
> rendering, and _also_ require that window-capable fbconfigs have a
> non-zero value for the GLX_VISUAL_ID.  In either case we should refuse
> to init GLX if there's not at least one GL-capable visual on at least
> one screen.
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>   glx/glxext.c |   21 +++++++++++++++++++++
>   1 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/glx/glxext.c b/glx/glxext.c
> index bc7fe82..078a4f7 100644
> --- a/glx/glxext.c
> +++ b/glx/glxext.c
> @@ -315,6 +315,23 @@ GlxPushProvider(__GLXprovider * provider)
>       __glXProviderStack = provider;
>   }
>
> +static Bool
> +checkScreenVisuals(void)
> +{
> +    int i, j;
> +
> +    for (i = 0; i < screenInfo.numScreens; i++) {
> +        ScreenPtr screen = screenInfo.screens[i];
> +        for (j = 0; j < screen->numVisuals; j++) {
> +            if (screen->visuals[j].class == TrueColor ||
> +                screen->visuals[j].class == DirectColor)
> +                return True;
> +        }
> +    }
> +
> +    return False;
> +}
> +
>   /*
>   ** Initialize the GLX extension.
>   */
> @@ -333,6 +350,10 @@ GlxExtensionInit(void)
>           *stack = &__glXDRISWRastProvider;
>       }
>
> +    /* Mesa requires at least one True/DirectColor visual */
> +    if (!checkScreenVisuals())
> +        return;
> +

Should this log some sort of message to indicate the reason for failure?

>       __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
>                                               "GLXContext");
>       __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,
>



More information about the xorg-devel mailing list