[PATCH] GLX: More clearly document the GLX protocol version handling

Peter Hutterer peter.hutterer at who-t.net
Thu Oct 1 21:03:07 PDT 2009


On Thu, Oct 01, 2009 at 10:45:16AM -0700, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> ---
>  glx/glxcmds.c               |    1 -
>  glx/glxdri2.c               |    6 ++----
>  glx/glxscreens.c            |   12 ++++++++++--
>  glx/glxscreens.h            |    9 +++++++++
>  include/protocol-versions.h |    2 +-
>  5 files changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/glx/glxcmds.c b/glx/glxcmds.c
> index 30c25a9..ba4c123 100644
> --- a/glx/glxcmds.c
> +++ b/glx/glxcmds.c
> @@ -50,7 +50,6 @@
>  #include "indirect_dispatch.h"
>  #include "indirect_table.h"
>  #include "indirect_util.h"
> -#include "protocol-versions.h"
>  
>  static int
>  validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
> diff --git a/glx/glxdri2.c b/glx/glxdri2.c
> index 82568e6..ed7dc80 100644
> --- a/glx/glxdri2.c
> +++ b/glx/glxdri2.c
> @@ -685,10 +685,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
>  				       screen->base.GLXextensions);
>      }
>  
> -    /* We know that the X server supports the protocol for at least GLX 1.4.
> -     * When a new version of GLX is created, we'll have to revisit this.  We're
> -     * also going to assume (perhaps incorrectly?) that all DRI2-enabled
> -     * drivers support the required extension for GLX 1.3.  The extensions
> +    /* We're going to assume (perhaps incorrectly?) that all DRI2-enabled
> +     * drivers support the required extensions for GLX 1.4.  The extensions
>       * we're assuming are:
>       *
>       *    - GLX_SGI_make_current_read (1.3)
> diff --git a/glx/glxscreens.c b/glx/glxscreens.c
> index 6ce24b2..674e2c6 100644
> --- a/glx/glxscreens.c
> +++ b/glx/glxscreens.c
> @@ -42,6 +42,7 @@
>  #include "glxserver.h"
>  #include "glxutil.h"
>  #include "glxext.h"
> +#include "protocol-versions.h"
>  
>  static int glxScreenPrivateKeyIndex;
>  static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKeyIndex;
> @@ -162,8 +163,8 @@ static const char GLServerExtensions[] =
>  ** supported across all screens in a multi-screen system.
>  */
>  static char GLXServerVendorName[] = "SGI";
> -unsigned glxMajorVersion = 1;
> -unsigned glxMinorVersion = 4;
> +unsigned glxMajorVersion = SERVER_GLX_MAJOR_VERSION;
> +unsigned glxMinorVersion = SERVER_GLX_MINOR_VERSION;
>  static char GLXServerExtensions[] =
>  			"GLX_ARB_multisample "
>  			"GLX_EXT_visual_info "
> @@ -380,6 +381,13 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
>      pGlxScreen->GLextensions  = xstrdup(GLServerExtensions);
>      pGlxScreen->GLXvendor     = xstrdup(GLXServerVendorName);
>      pGlxScreen->GLXextensions = xstrdup(GLXServerExtensions);
> +
> +    /* All GLX providers must support all of the functionality required for at
> +     * least GLX 1.2.  If the provider supports a higher version, the GLXminor
> +     * version can be changed in the provider's screen-probe routine.  For
> +     * most providers, the screen-probe routine is the caller of this
> +     * function.
> +     */
>      pGlxScreen->GLXmajor      = 1;
>      pGlxScreen->GLXminor      = 2;
>  
> diff --git a/glx/glxscreens.h b/glx/glxscreens.h
> index 2d696d2..bff4363 100644
> --- a/glx/glxscreens.h
> +++ b/glx/glxscreens.h
> @@ -160,8 +160,17 @@ struct __GLXscreen {
>      char *GLXvendor;
>      char *GLXversion;
>      char *GLXextensions;
> +
> +    /**
> +     * \name GLX version supported by this screen.
> +     *
> +     * Since the GLX version advertised by the server is for the whole server,
> +     * the GLX protocol code uses the minimum version supported on all screens.
> +     */
> +    /*@{*/
>      unsigned GLXmajor;
>      unsigned GLXminor;
> +    /*@}*/
>  
>      Bool (*CloseScreen)(int index, ScreenPtr pScreen);
>      Bool (*DestroyWindow)(WindowPtr pWindow);
> diff --git a/include/protocol-versions.h b/include/protocol-versions.h
> index da9770c..d688c66 100644
> --- a/include/protocol-versions.h
> +++ b/include/protocol-versions.h
> @@ -61,7 +61,7 @@
>  
>  /* GLX */
>  #define SERVER_GLX_MAJOR_VERSION		1
> -#define SERVER_GLX_MINOR_VERSION		2
> +#define SERVER_GLX_MINOR_VERSION		4
>  
>  /* Xinerama */
>  #define SERVER_PANORAMIX_MAJOR_VERSION          1
> -- 
> 1.6.4.3
 
Acked-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
  Peter


More information about the xorg-devel mailing list