diff options
Diffstat (limited to 'xorg-server/glx')
-rwxr-xr-x[-rw-r--r--] | xorg-server/glx/glxcmds.c | 99 | ||||
-rw-r--r-- | xorg-server/glx/glxcontext.h | 1 | ||||
-rw-r--r-- | xorg-server/glx/glxdri2.c | 3 | ||||
-rw-r--r-- | xorg-server/glx/glxext.c | 4 | ||||
-rw-r--r-- | xorg-server/glx/glxscreens.c | 17 | ||||
-rw-r--r-- | xorg-server/glx/glxscreens.h | 5 |
6 files changed, 69 insertions, 60 deletions
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c index d5d14b7a6..f2e3fede0 100644..100755 --- a/xorg-server/glx/glxcmds.c +++ b/xorg-server/glx/glxcmds.c @@ -51,6 +51,8 @@ #include "indirect_table.h" #include "indirect_util.h" +static char GLXServerVendorName[] = "SGI"; + _X_HIDDEN int validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen, int *err) @@ -1039,7 +1041,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc) return Success; } -#define __GLX_TOTAL_FBCONFIG_ATTRIBS (37) +#define __GLX_TOTAL_FBCONFIG_ATTRIBS (44) #define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2) /** * Send the set of GLXFBConfigs to the client. There is not currently @@ -1124,13 +1126,23 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen) WRITE_PAIR(GLX_SWAP_METHOD_OML, modes->swapMethod); WRITE_PAIR(GLX_SAMPLES_SGIS, modes->samples); WRITE_PAIR(GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers); - /* GLX_VISUAL_SELECT_GROUP_SGIX ? */ + WRITE_PAIR(GLX_VISUAL_SELECT_GROUP_SGIX, modes->visualSelectGroup); WRITE_PAIR(GLX_DRAWABLE_TYPE, modes->drawableType); WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb); WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba); WRITE_PAIR(GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture); WRITE_PAIR(GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets); + WRITE_PAIR(GLX_Y_INVERTED_EXT, modes->yInverted); + if (modes->drawableType & GLX_PBUFFER_BIT) { + WRITE_PAIR(GLX_MAX_PBUFFER_WIDTH, modes->maxPbufferWidth); + WRITE_PAIR(GLX_MAX_PBUFFER_HEIGHT, modes->maxPbufferHeight); + WRITE_PAIR(GLX_MAX_PBUFFER_PIXELS, modes->maxPbufferPixels); + WRITE_PAIR(GLX_OPTIMAL_PBUFFER_WIDTH_SGIX, + modes->optimalPbufferWidth); + WRITE_PAIR(GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX, + modes->optimalPbufferHeight); + } /* Add attribute only if its value is not default. */ if (modes->sRGBCapable != GL_FALSE) { WRITE_PAIR(GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, modes->sRGBCapable); @@ -1427,6 +1439,8 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, width, height, config->rgbBits, 0); __glXleaveServer(GL_FALSE); + if (!pPixmap) + return BadAlloc; /* Assign the pixmap the same id as the pbuffer and add it as a * resource so it and the DRI2 drawable will be reclaimed when the @@ -1468,7 +1482,6 @@ __glXDisp_CreatePbuffer(__GLXclientState * cl, GLbyte * pc) height = attrs[i * 2 + 1]; break; case GLX_LARGEST_PBUFFER: - case GLX_PRESERVED_CONTENTS: /* FIXME: huh... */ break; } @@ -1486,6 +1499,10 @@ __glXDisp_CreateGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc) REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq); + /* + * We should really handle attributes correctly, but this extension + * is so rare I have difficulty caring. + */ return DoCreatePbuffer(cl->client, req->screen, req->fbconfig, req->width, req->height, req->pbuffer); } @@ -1693,15 +1710,14 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId) ClientPtr client = cl->client; __GLXcontext *ctx; xGLXQueryContextInfoEXTReply reply; - int nProps; - int *sendBuf, *pSendBuf; + #define nProps 3 + int sendBuf[nProps * 2]; int nReplyBytes; int err; if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err)) return err; - nProps = 3; reply.type = X_Reply; reply.sequenceNumber = client->sequence; @@ -1710,17 +1726,12 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId) nReplyBytes = reply.length << 2; - sendBuf = (int *) malloc((size_t) nReplyBytes); - if (sendBuf == NULL) { - return __glXError(GLXBadContext); /* XXX: Is this correct? */ - } - pSendBuf = sendBuf; - *pSendBuf++ = GLX_SHARE_CONTEXT_EXT; - *pSendBuf++ = (int) (ctx->share_id); - *pSendBuf++ = GLX_VISUAL_ID_EXT; - *pSendBuf++ = (int) (ctx->config->visualID); - *pSendBuf++ = GLX_SCREEN_EXT; - *pSendBuf++ = (int) (ctx->pGlxScreen->pScreen->myNum); + sendBuf[0] = GLX_SHARE_CONTEXT_EXT; + sendBuf[1] = (int) (ctx->share_id); + sendBuf[2] = GLX_VISUAL_ID_EXT; + sendBuf[3] = (int) (ctx->config->visualID); + sendBuf[4] = GLX_SCREEN_EXT; + sendBuf[5] = (int) (ctx->pGlxScreen->pScreen->myNum); if (client->swapped) { __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf); @@ -1729,7 +1740,6 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId) WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply); WriteToClient(client, nReplyBytes, sendBuf); } - free((char *) sendBuf); return Success; } @@ -1903,28 +1913,44 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId) ClientPtr client = cl->client; xGLXGetDrawableAttributesReply reply; __GLXdrawable *pGlxDraw; - CARD32 attributes[6]; - int numAttribs, error; + CARD32 attributes[14]; + int numAttribs = 0, error; if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY, DixGetAttrAccess, &pGlxDraw, &error)) return error; - numAttribs = 3; - - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; - reply.length = numAttribs << 1; - reply.numAttribs = numAttribs; - - attributes[0] = GLX_TEXTURE_TARGET_EXT; attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT : GLX_TEXTURE_RECTANGLE_EXT; + numAttribs++; attributes[2] = GLX_Y_INVERTED_EXT; attributes[3] = GL_FALSE; + numAttribs++; attributes[4] = GLX_EVENT_MASK; attributes[5] = pGlxDraw->eventMask; + numAttribs++; + attributes[6] = GLX_WIDTH; + attributes[7] = pGlxDraw->pDraw->width; + numAttribs++; + attributes[8] = GLX_HEIGHT; + attributes[9] = pGlxDraw->pDraw->height; + numAttribs++; + attributes[10] = GLX_FBCONFIG_ID; + attributes[11] = pGlxDraw->config->fbconfigID; + numAttribs++; + if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) { + attributes[12] = GLX_PRESERVED_CONTENTS; + attributes[13] = GL_TRUE; + numAttribs++; + } + + + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = numAttribs << 1; + reply.numAttribs = numAttribs; + if (client->swapped) { __glXSwapGetDrawableAttributesReply(client, &reply, attributes); @@ -2173,15 +2199,12 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc) ** Make enough space in the buffer, then copy the entire request. */ if (cl->largeCmdBufSize < cmdlen) { - if (!cl->largeCmdBuf) { - cl->largeCmdBuf = (GLbyte *) malloc(cmdlen); - } - else { - cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen); - } - if (!cl->largeCmdBuf) { - return BadAlloc; - } + GLbyte *newbuf = cl->largeCmdBuf; + + if (!(newbuf = realloc(newbuf, cmdlen))) + return BadAlloc; + + cl->largeCmdBuf = newbuf; cl->largeCmdBufSize = cmdlen; } memcpy(cl->largeCmdBuf, pc, dataBytes); @@ -2397,7 +2420,7 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc) switch (req->name) { case GLX_VENDOR: - ptr = pGlxScreen->GLXvendor; + ptr = GLXServerVendorName; break; case GLX_VERSION: /* Return to the server version rather than the screen version diff --git a/xorg-server/glx/glxcontext.h b/xorg-server/glx/glxcontext.h index 4764e56f5..3d08c9929 100644 --- a/xorg-server/glx/glxcontext.h +++ b/xorg-server/glx/glxcontext.h @@ -55,7 +55,6 @@ struct __GLXcontext { /* ** list of context structs */ - __GLXcontext *last; __GLXcontext *next; /* diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c index 8a1fa4159..f662b2188 100644 --- a/xorg-server/glx/glxdri2.c +++ b/xorg-server/glx/glxdri2.c @@ -941,8 +941,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) if (screen == NULL) return NULL; - if (!xf86LoaderCheckSymbol("DRI2Connect") || - !DRI2Connect(serverClient, pScreen, DRI2DriverDRI, + if (!DRI2Connect(serverClient, pScreen, DRI2DriverDRI, &screen->fd, &driverName, &deviceName)) { LogMessage(X_INFO, "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum); diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c index 01597849e..e690044a4 100644 --- a/xorg-server/glx/glxext.c +++ b/xorg-server/glx/glxext.c @@ -295,10 +295,6 @@ glxClientCallback(CallbackListPtr *list, pointer closure, pointer data) switch (pClient->clientState) { case ClientStateRunning: - /* - ** By default, assume that the client supports - ** GLX major version 1 minor version 0 protocol. - */ cl->client = pClient; break; diff --git a/xorg-server/glx/glxscreens.c b/xorg-server/glx/glxscreens.c index 2d9178121..4ab84ef09 100644 --- a/xorg-server/glx/glxscreens.c +++ b/xorg-server/glx/glxscreens.c @@ -132,7 +132,6 @@ static const char GLServerExtensions[] = "GL_NV_blend_square " "GL_NV_depth_clamp " "GL_NV_fog_distance " - "GL_NV_fragment_program " "GL_NV_fragment_program_option " "GL_NV_fragment_program2 " "GL_NV_light_max_exponent " @@ -143,9 +142,6 @@ static const char GLServerExtensions[] = "GL_NV_texture_env_combine4 " "GL_NV_texture_expand_normal " "GL_NV_texture_rectangle " - "GL_NV_vertex_program " - "GL_NV_vertex_program1_1 " - "GL_NV_vertex_program2 " "GL_NV_vertex_program2_option " "GL_NV_vertex_program3 " "GL_OES_compressed_paletted_texture " @@ -158,13 +154,14 @@ static const char GLServerExtensions[] = "GL_SGIS_texture_edge_clamp " "GL_SGIS_texture_lod " "GL_SGIX_depth_texture " - "GL_SGIX_shadow " "GL_SGIX_shadow_ambient " "GL_SUN_slice_accum "; + "GL_SGIX_shadow " + "GL_SGIX_shadow_ambient " + "GL_SUN_slice_accum "; /* ** We have made the simplifying assuption that the same extensions are ** 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[] = @@ -173,12 +170,14 @@ static char GLXServerExtensions[] = "GLX_EXT_visual_rating " "GLX_EXT_import_context " "GLX_EXT_texture_from_pixmap " - "GLX_OML_swap_method " "GLX_SGI_make_current_read " + "GLX_OML_swap_method " + "GLX_SGI_make_current_read " #ifndef __APPLE__ "GLX_SGIS_multisample " #endif "GLX_SGIX_fbconfig " - "GLX_SGIX_pbuffer " "GLX_MESA_copy_sub_buffer "; + "GLX_SGIX_pbuffer " + "GLX_MESA_copy_sub_buffer "; static Bool glxCloseScreen(ScreenPtr pScreen) @@ -334,7 +333,6 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen) pGlxScreen->pScreen = pScreen; pGlxScreen->GLextensions = strdup(GLServerExtensions); - pGlxScreen->GLXvendor = strdup(GLXServerVendorName); pGlxScreen->GLXextensions = strdup(GLXServerExtensions); /* All GLX providers must support all of the functionality required for at @@ -424,7 +422,6 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen) void __glXScreenDestroy(__GLXscreen * screen) { - free(screen->GLXvendor); free(screen->GLXextensions); free(screen->GLextensions); free(screen->visuals); diff --git a/xorg-server/glx/glxscreens.h b/xorg-server/glx/glxscreens.h index 0a7b6043e..c8119fd21 100644 --- a/xorg-server/glx/glxscreens.h +++ b/xorg-server/glx/glxscreens.h @@ -54,8 +54,6 @@ struct __GLXconfig { GLint level; - GLint pixmapMode; - /* GLX */ GLint visualID; GLint visualType; /**< One of the GLX X visual types. (i.e., @@ -94,8 +92,6 @@ struct __GLXconfig { /* OML_swap_method */ GLint swapMethod; - GLint screen; - /* EXT_texture_from_pixmap */ GLint bindToTextureRgb; GLint bindToTextureRgba; @@ -145,7 +141,6 @@ struct __GLXscreen { char *GLextensions; - char *GLXvendor; char *GLXextensions; /** |