On Fri, Oct 02, 2009 at 01:18:22PM +0200, Luc Verhaegen wrote: > On Thu, Oct 01, 2009 at 10:50:09AM -0700, Ian Romanick wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Dave Airlie wrote: > > > From: Dave Airlie <[email protected]> > > > > > > I think this is what the original author wanted. > > > > > > Signed-off-by: Dave Airlie <[email protected]> > > > > Acked-by: Ian Romanick <[email protected]> > > > > I can't believe this got by Jesse and Kristian when they reviewed the > > original patch. I need to go clean the egg off my face... > > > > > --- > > > glx/glxext.c | 4 ++-- > > > 1 files changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/glx/glxext.c b/glx/glxext.c > > > index 2de8b84..0737420 100644 > > > --- a/glx/glxext.c > > > +++ b/glx/glxext.c > > > @@ -364,14 +364,14 @@ void GlxExtensionInit(void) > > > > > > glxScreen = p->screenProbe(pScreen); > > > if (glxScreen != NULL) { > > > + if (glxScreen->GLXminor < glxMinorVersion) > > > + glxMinorVersion = glxScreen->GLXminor; > > > LogMessage(X_INFO, > > > "GLX: Initialized %s GL provider for screen %d\n", > > > p->name, i); > > > break; > > > } > > > > > > - if (glxScreen->GLXminor < glxMinorVersion) > > > - glxMinorVersion = glxScreen->GLXminor; > > > } > > > > > > if (!p) > > Why is this chunk there in the first place? It feels as if it has no > direct connection to the commit message of ad5c0d9efa, namely: > > GLX: Enable GLX 1.4 on DRI2 > > Return the minimum GLX version supported by all screens. Assume that > DRI2 screens have all the required features for GLX 1.4. Assume that > everyone else can only support GLX 1.2. > > or that it was not mentioned. > > glxMajor/MinorVersion are only set for DRI and are never altered or used > for DRI2. > > >From what i see in the original patch; for DRI, GLXscreen->GLX???or is > set to 1.2; for DRI2 it is set to 1.4, while glx???orVersion is set to > 1.2. With these current versions out there, this extra code seems to > have no result and the version string will always read 1.2. > > What is this trying to achieve or could it be that the < should be a > > so that the version string returns 1.4 for DRI2? > > Luc Verhaegen.
Ok, thinking about this a bit further, and noticing that i overlooked the imho gratuitous version bump, i came up with the attached patch. In order to have this evaluated ASAP, i haven't set up an up to date environment where i can build Xorg master yet, so this patch was not even build tested. Luc Verhaegen.
>From 5f57d8c68e175d414a3b0b67eada61b645ae2f8c Mon Sep 17 00:00:00 2001 From: Luc Verhaegen <[email protected]> Date: Fri, 2 Oct 2009 16:27:13 +0200 Subject: [PATCH] GLX: further improve GLX protocol version handling. * The SERVER_GLX_*_VERSION defines now set the initial GLXScreen->GLXMajor/Minor values directly. * The GLXScreen->GLXMajor/Minor versions of the different providers now are where glxMajor/MinorVersion get their values from. * Keep the SERVER_GLX_*_VERSION defines where they belong to keep natural segmentation intact. Warning: this patch was not even build tested. Signed-off-by: Luc Verhaegen <[email protected]> --- glx/glxext.c | 45 ++++++++++++++++++++++-------------------- glx/glxscreens.c | 7 +---- glx/glxserver.h | 9 ++++++++ include/protocol-versions.h | 4 --- 4 files changed, 35 insertions(+), 30 deletions(-) diff --git a/glx/glxext.c b/glx/glxext.c index 9f9c0ed..79de229 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -333,15 +333,19 @@ void GlxPushProvider(__GLXprovider *provider) } /* + * Track the lowest version of the GLX protocol that the different screens + * support so that it can be advertised in GLXQueryVersion. + */ +unsigned glxMajorVersion = 0; +unsigned glxMinorVersion = 0; + +/* ** Initialize the GLX extension. */ void GlxExtensionInit(void) { ExtensionEntry *extEntry; - ScreenPtr pScreen; int i; - __GLXprovider *p; - Bool glx_provided = False; __glXContextRes = CreateNewResourceType((DeleteType)ContextGone); __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); @@ -357,32 +361,31 @@ void GlxExtensionInit(void) return; for (i = 0; i < screenInfo.numScreens; i++) { - pScreen = screenInfo.screens[i]; - - for (p = __glXProviderStack; p != NULL; p = p->next) { - __GLXscreen *glxScreen; - - glxScreen = p->screenProbe(pScreen); - if (glxScreen != NULL) { - if (glxScreen->GLXminor < glxMinorVersion) - glxMinorVersion = glxScreen->GLXminor; - LogMessage(X_INFO, - "GLX: Initialized %s GL provider for screen %d\n", - p->name, i); + __GLXscreen *glxScreen = NULL; + __GLXprovider *p; + + for (p = __glXProviderStack; p != NULL; p = p->next) + if ((glxScreen = p->screenProbe(screenInfo.screens[i]))) break; - } - } + if (glxScreen) { + /* Warning: we are not handling different major versions here! */ + if (!glxMajorVersion && !glxMinorVersion) { + glxMajorVersion = glxScreen->GLXmajor; + glxMinorVersion = glxScreen->GLXminor; + } else if (glxScreen->GLXminor < glxMinorVersion) + glxMinorVersion = glxScreen->GLXminor; - if (!p) + LogMessage(X_INFO, + "GLX: Initialized %s GL provider for screen %d\n", + p->name, i); + } else LogMessage(X_INFO, "GLX: no usable GL providers found for screen %d\n", i); - else - glx_provided = True; } /* don't register extension if GL is not provided on any screen */ - if (!glx_provided) + if (!glxMajorVersion && !glxMinorVersion) return; /* diff --git a/glx/glxscreens.c b/glx/glxscreens.c index 674e2c6..7dad458 100644 --- a/glx/glxscreens.c +++ b/glx/glxscreens.c @@ -42,7 +42,6 @@ #include "glxserver.h" #include "glxutil.h" #include "glxext.h" -#include "protocol-versions.h" static int glxScreenPrivateKeyIndex; static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKeyIndex; @@ -163,8 +162,6 @@ static const char GLServerExtensions[] = ** supported across all screens in a multi-screen system. */ static char GLXServerVendorName[] = "SGI"; -unsigned glxMajorVersion = SERVER_GLX_MAJOR_VERSION; -unsigned glxMinorVersion = SERVER_GLX_MINOR_VERSION; static char GLXServerExtensions[] = "GLX_ARB_multisample " "GLX_EXT_visual_info " @@ -388,8 +385,8 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen) * most providers, the screen-probe routine is the caller of this * function. */ - pGlxScreen->GLXmajor = 1; - pGlxScreen->GLXminor = 2; + pGlxScreen->GLXmajor = SERVER_GLX_MAJOR_VERSION; + pGlxScreen->GLXminor = SERVER_GLX_MINOR_VERSION; pGlxScreen->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = glxCloseScreen; diff --git a/glx/glxserver.h b/glx/glxserver.h index 80f1b28..3df37f2 100644 --- a/glx/glxserver.h +++ b/glx/glxserver.h @@ -248,6 +248,15 @@ extern int __glXImageSize(GLenum format, GLenum type, GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows, GLint alignment); +/* 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. + */ +#define SERVER_GLX_MAJOR_VERSION 1 +#define SERVER_GLX_MINOR_VERSION 2 + extern unsigned glxMajorVersion; extern unsigned glxMinorVersion; diff --git a/include/protocol-versions.h b/include/protocol-versions.h index d688c66..e97a84c 100644 --- a/include/protocol-versions.h +++ b/include/protocol-versions.h @@ -59,10 +59,6 @@ #define SERVER_GE_MAJOR_VERSION 1 #define SERVER_GE_MINOR_VERSION 0 -/* GLX */ -#define SERVER_GLX_MAJOR_VERSION 1 -#define SERVER_GLX_MINOR_VERSION 4 - /* Xinerama */ #define SERVER_PANORAMIX_MAJOR_VERSION 1 #define SERVER_PANORAMIX_MINOR_VERSION 1 -- 1.6.0.2
_______________________________________________ xorg-devel mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-devel
