[PATCH xserver 07/13] glx: Use __glXInitExtensionEnableBits in all backends

Emil Velikov emil.l.velikov at gmail.com
Wed Mar 30 11:48:16 UTC 2016


On 23 March 2016 at 22:46, Adam Jackson <ajax at redhat.com> wrote:
> On xquartz this enables SGI_make_current_read, which is a mostly
> harmless lie as CGL doesn't implement it, as well as SGIX_pbuffer, which
> is fine because no pbuffer-enabled configs are created.
>
> On xwin this enables SGIX_pbuffer and ARB_multisample in all cases.
> Again this is harmless if the backend doesn't support the features,
> since no fbconfigs will be created to expose them.
>
> It also adds SGIX_visual_select_group to both xquartz and xwin.
> Amusingly, both were filling in the appropriate field in the fbconfig
> already.
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  hw/xquartz/GL/indirect.c | 12 +-----------
>  hw/xwin/glx/indirect.c   | 23 +++--------------------
>  2 files changed, 4 insertions(+), 31 deletions(-)
>
> diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
> index 544cb78..398cdf1 100644
> --- a/hw/xquartz/GL/indirect.c
> +++ b/hw/xquartz/GL/indirect.c
> @@ -545,22 +545,12 @@ __glXAquaScreenProbe(ScreenPtr pScreen)
>      screen->base.fbconfigs = __glXAquaCreateVisualConfigs(
>          &screen->base.numFBConfigs, pScreen->myNum);
>
> +    __glXInitExtensionEnableBits(screen->glx_enable_bits);
>      __glXScreenInit(&screen->base, pScreen);
>
>      screen->base.GLXmajor = 1;
>      screen->base.GLXminor = 4;
>
> -    memset(screen->glx_enable_bits, 0, __GLX_EXT_BYTES);
> -
> -    __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_info");
> -    __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_rating");
> -    __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context");
> -    __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method");
> -    __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig");
> -
> -    __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIS_multisample");
> -    __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_multisample");
> -
>      //__glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context");
>      //__glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context_profile");
>
> diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
> index 7828b6c..cf51c9b 100644
> --- a/hw/xwin/glx/indirect.c
> +++ b/hw/xwin/glx/indirect.c
> @@ -642,14 +642,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
>          // Based on the WGL extensions available, enable various GLX extensions
>          // XXX: make this table-driven ?
>          //
> -        memset(screen->glx_enable_bits, 0, __GLX_EXT_BYTES);
> -
> -        __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_info");
> -        __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_rating");
> -        __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context");
> -        __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method");
> -        __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig");
> -        __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_make_current_read");
> +        __glXInitExtensionEnableBits(screen->glx_enable_bits);
>
>          if (strstr(wgl_extensions, "WGL_ARB_make_current_read"))
>              screen->has_WGL_ARB_make_current_read = TRUE;
> @@ -674,21 +667,11 @@ glxWinScreenProbe(ScreenPtr pScreen)
>  /*           screen->has_WGL_ARB_render_texture = TRUE; */
>  /*         } */
>
> -        if (strstr(wgl_extensions, "WGL_ARB_pbuffer")) {
> -            __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_pbuffer");
> -            LogMessage(X_INFO, "AIGLX: enabled GLX_SGIX_pbuffer\n");
> +        if (strstr(wgl_extensions, "WGL_ARB_pbuffer"))
>              screen->has_WGL_ARB_pbuffer = TRUE;
> -        }
>
> -        if (strstr(wgl_extensions, "WGL_ARB_multisample")) {
> -            __glXEnableExtension(screen->glx_enable_bits,
> -                                 "GLX_ARB_multisample");
> -            __glXEnableExtension(screen->glx_enable_bits,
> -                                 "GLX_SGIS_multisample");
> -            LogMessage(X_INFO,
> -                       "AIGLX: enabled GLX_ARB_multisample and GLX_SGIS_multisample\n");
> +        if (strstr(wgl_extensions, "WGL_ARB_multisample"))
>              screen->has_WGL_ARB_multisample = TRUE;
> -        }
Similar to patch 5 - we assume that things will be fine if the base
implementation lacks the WGL extensions. As this can cause the
occasional wtf moment - wouldn't it be better to have a big fat
warning for each of these (three so far) missing extensions alongside
the proposed behaviour ?

Jon, any ideas how (un)common it is for WGL_ARB_make_current_read,
WGL_ARB_pbuffer and/or WGL_ARB_multisample to be missing ?

-Emil


More information about the xorg-devel mailing list