glx: Stop pretending the GLX major number isn't 1
Clarify the comments and logic accordingly. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10418>
This commit is contained in:
parent
96ec6b3d8f
commit
e716088c24
|
@ -96,7 +96,7 @@ __glX_send_client_info(struct glx_display *glx_dpy)
|
|||
/* There are three possible flavors of the client info structure that the
|
||||
* client could send to the server. The version sent depends on the
|
||||
* combination of GLX versions and extensions supported by the client and
|
||||
* the server.
|
||||
* the server. This client only supports GLX major version 1.
|
||||
*
|
||||
* Server supports Client sends
|
||||
* ----------------------------------------------------------------------
|
||||
|
@ -117,7 +117,7 @@ __glX_send_client_info(struct glx_display *glx_dpy)
|
|||
* requirement in this case does not seem like a limitation.
|
||||
*/
|
||||
|
||||
if (glx_dpy->majorVersion == 1 && glx_dpy->minorVersion == 0)
|
||||
if (glx_dpy->minorVersion == 0)
|
||||
return;
|
||||
|
||||
/* Determine whether any screen on the server supports either of the
|
||||
|
@ -170,7 +170,7 @@ __glX_send_client_info(struct glx_display *glx_dpy)
|
|||
* THE ORDER IS IMPORTANT. We want to send the most recent version of the
|
||||
* protocol that the server can support.
|
||||
*/
|
||||
if (glx_dpy->majorVersion == 1 && glx_dpy->minorVersion == 4
|
||||
if (glx_dpy->minorVersion == 4
|
||||
&& any_screen_has_ARB_create_context_profile) {
|
||||
xcb_glx_set_client_info_2arb(c,
|
||||
GLX_MAJOR_VERSION, GLX_MINOR_VERSION,
|
||||
|
@ -181,7 +181,7 @@ __glX_send_client_info(struct glx_display *glx_dpy)
|
|||
gl_versions_profiles,
|
||||
gl_extension_string,
|
||||
glx_extensions);
|
||||
} else if (glx_dpy->majorVersion == 1 && glx_dpy->minorVersion == 4
|
||||
} else if (glx_dpy->minorVersion == 4
|
||||
&& any_screen_has_ARB_create_context) {
|
||||
xcb_glx_set_client_info_arb(c,
|
||||
GLX_MAJOR_VERSION, GLX_MINOR_VERSION,
|
||||
|
|
|
@ -102,7 +102,7 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
|
||||
LockDisplay(dpy);
|
||||
|
||||
if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
|
||||
if (priv->minorVersion >= 3) {
|
||||
xGLXChangeDrawableAttributesReq *req;
|
||||
|
||||
GetReqExtra(GLXChangeDrawableAttributes, 8 * num_attribs, req);
|
||||
|
@ -272,7 +272,6 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
unsigned int length;
|
||||
unsigned int i;
|
||||
unsigned int num_attributes;
|
||||
GLboolean use_glx_1_3;
|
||||
int found = 0;
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
|
@ -296,11 +295,8 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
if (priv == NULL)
|
||||
return 0;
|
||||
|
||||
use_glx_1_3 = ((priv->majorVersion > 1) || (priv->minorVersion >= 3));
|
||||
|
||||
*value = 0;
|
||||
|
||||
|
||||
opcode = __glXSetupForCommand(dpy);
|
||||
if (!opcode)
|
||||
return 0;
|
||||
|
@ -351,7 +347,7 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
|
||||
LockDisplay(dpy);
|
||||
|
||||
if (use_glx_1_3) {
|
||||
if (priv->minorVersion >= 3) {
|
||||
xGLXGetDrawableAttributesReq *req;
|
||||
|
||||
GetReq(GLXGetDrawableAttributes, req);
|
||||
|
@ -381,7 +377,7 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
|
||||
length = reply.length;
|
||||
if (length) {
|
||||
num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
|
||||
num_attributes = (priv->minorVersion > 2) ? reply.numAttribs : length / 2;
|
||||
data = malloc(length * sizeof(CARD32));
|
||||
if (data == NULL) {
|
||||
/* Throw data on the floor */
|
||||
|
@ -569,7 +565,7 @@ CreatePbuffer(Display * dpy, struct glx_config *config,
|
|||
LockDisplay(dpy);
|
||||
id = XAllocID(dpy);
|
||||
|
||||
if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
|
||||
if (priv->minorVersion >= 3) {
|
||||
xGLXCreatePbufferReq *req;
|
||||
unsigned int extra = (size_in_attribs) ? 0 : 2;
|
||||
|
||||
|
@ -658,7 +654,7 @@ DestroyPbuffer(Display * dpy, GLXDrawable drawable)
|
|||
|
||||
LockDisplay(dpy);
|
||||
|
||||
if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
|
||||
if (priv->minorVersion >= 3) {
|
||||
xGLXDestroyPbufferReq *req;
|
||||
|
||||
GetReq(GLXDestroyPbuffer, req);
|
||||
|
|
|
@ -574,12 +574,13 @@ struct glx_display
|
|||
int majorOpcode;
|
||||
|
||||
/**
|
||||
* \name Server Version
|
||||
* \name Minor Version
|
||||
*
|
||||
* Major and minor version returned by the server during initialization.
|
||||
* Minor version returned by the server during initialization. The major
|
||||
* version is asserted to be 1 during extension setup.
|
||||
*/
|
||||
/*@{ */
|
||||
int majorVersion, minorVersion;
|
||||
int minorVersion;
|
||||
/*@} */
|
||||
|
||||
/**
|
||||
|
|
|
@ -531,7 +531,7 @@ glXQueryVersion(Display * dpy, int *major, int *minor)
|
|||
return False;
|
||||
|
||||
if (major)
|
||||
*major = priv->majorVersion;
|
||||
*major = GLX_MAJOR_VERSION;
|
||||
if (minor)
|
||||
*minor = priv->minorVersion;
|
||||
return True;
|
||||
|
@ -1461,7 +1461,7 @@ glXImportContextEXT(Display *dpy, GLXContextID contextID)
|
|||
/* Send the glXQueryContextInfoEXT request */
|
||||
LockDisplay(dpy);
|
||||
|
||||
if (priv->majorVersion > 1 || priv->minorVersion >= 3) {
|
||||
if (priv->minorVersion >= 3) {
|
||||
xGLXQueryContextReq *req;
|
||||
|
||||
GetReq(GLXQueryContext, req);
|
||||
|
|
|
@ -720,7 +720,7 @@ getVisualConfigs(struct glx_screen *psc,
|
|||
}
|
||||
|
||||
static GLboolean
|
||||
getFBConfigs(struct glx_screen *psc, struct glx_display *priv, int screen)
|
||||
getFBConfigs(struct glx_screen *psc, struct glx_display *priv, int screen)
|
||||
{
|
||||
xGLXGetFBConfigsReq *fb_req;
|
||||
xGLXGetFBConfigsSGIXReq *sgi_req;
|
||||
|
@ -738,8 +738,7 @@ static GLboolean
|
|||
LockDisplay(dpy);
|
||||
|
||||
psc->configs = NULL;
|
||||
if (priv->majorVersion > 1 ||
|
||||
(priv->majorVersion == 1 && priv->minorVersion >= 3)) {
|
||||
if (priv->minorVersion >= 3) {
|
||||
GetReq(GLXGetFBConfigs, fb_req);
|
||||
fb_req->reqType = priv->majorOpcode;
|
||||
fb_req->glxCode = X_GLXGetFBConfigs;
|
||||
|
@ -874,7 +873,7 @@ __glXInitialize(Display * dpy)
|
|||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
Bool glx_direct, glx_accel;
|
||||
#endif
|
||||
int i;
|
||||
int i, majorVersion = 0;
|
||||
|
||||
_XLockMutex(_Xglobal_lock);
|
||||
|
||||
|
@ -903,12 +902,13 @@ __glXInitialize(Display * dpy)
|
|||
dpyPriv->serverGLXvendor = 0x0;
|
||||
dpyPriv->serverGLXversion = 0x0;
|
||||
|
||||
/* See if the versions are compatible. This GLX implementation does not
|
||||
* work with servers that only support GLX 1.0.
|
||||
/* This GLX implementation requires X_GLXQueryExtensionsString
|
||||
* and X_GLXQueryServerString, which are new in GLX 1.1.
|
||||
*/
|
||||
if (!QueryVersion(dpy, dpyPriv->majorOpcode,
|
||||
&dpyPriv->majorVersion, &dpyPriv->minorVersion)
|
||||
|| (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion < 1)) {
|
||||
&majorVersion, &dpyPriv->minorVersion)
|
||||
|| (majorVersion != 1)
|
||||
|| (majorVersion == 1 && dpyPriv->minorVersion < 1)) {
|
||||
free(dpyPriv);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ SendMakeCurrentRequest(Display * dpy, GLXContextID gc_id,
|
|||
* not the SGI extension.
|
||||
*/
|
||||
|
||||
if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
|
||||
if (priv->minorVersion >= 3) {
|
||||
xGLXMakeContextCurrentReq *req;
|
||||
|
||||
GetReq(GLXMakeContextCurrent, req);
|
||||
|
|
|
@ -43,7 +43,6 @@ public:
|
|||
this->next = 0;
|
||||
this->dpy = dpy;
|
||||
this->majorOpcode = 0;
|
||||
this->majorVersion = major;
|
||||
this->minorVersion = minor;
|
||||
this->serverGLXvendor = 0;
|
||||
this->serverGLXversion = 0;
|
||||
|
|
Loading…
Reference in New Issue