aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/glx')
-rw-r--r--xorg-server/glx/glxcmds.c103
-rw-r--r--xorg-server/glx/glxcontext.h1
-rw-r--r--xorg-server/glx/glxdri2.c3
-rw-r--r--xorg-server/glx/glxext.c4
-rw-r--r--xorg-server/glx/glxscreens.c17
-rw-r--r--xorg-server/glx/glxscreens.h5
6 files changed, 73 insertions, 60 deletions
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index 5b7a628cc..73e76ca9f 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -50,6 +50,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)
@@ -513,6 +515,10 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
pDraw, drawId,
GLX_DRAWABLE_WINDOW,
drawId, glxc->config);
+ if (!pGlxDraw) {
+ *error = BadAlloc;
+ return NULL;
+ }
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
@@ -1026,7 +1032,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
@@ -1111,13 +1117,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);
@@ -1414,6 +1430,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
@@ -1455,7 +1473,6 @@ __glXDisp_CreatePbuffer(__GLXclientState * cl, GLbyte * pc)
height = attrs[i * 2 + 1];
break;
case GLX_LARGEST_PBUFFER:
- case GLX_PRESERVED_CONTENTS:
/* FIXME: huh... */
break;
}
@@ -1473,6 +1490,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);
}
@@ -1680,15 +1701,14 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
ClientPtr client = cl->client;
__GLXcontext *ctx;
xGLXQueryContextInfoEXTReply reply;
- int nProps;
- int *sendBuf, *pSendBuf;
+ int nProps = 3;
+ int sendBuf[nProps * 2];
int nReplyBytes;
int err;
if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
return err;
- nProps = 3;
reply = (xGLXQueryContextInfoEXTReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
@@ -1697,17 +1717,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);
@@ -1716,7 +1731,6 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
WriteToClient(client, nReplyBytes, sendBuf);
}
- free((char *) sendBuf);
return Success;
}
@@ -1890,28 +1904,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 = (xGLXGetDrawableAttributesReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = numAttribs << 1,
- .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 = (xGLXGetDrawableAttributesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = numAttribs << 1,
+ .numAttribs = numAttribs
+ };
if (client->swapped) {
__glXSwapGetDrawableAttributesReply(client, &reply, attributes);
@@ -2160,15 +2190,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);
@@ -2384,7 +2411,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 bc7fe8217..2c3f5edf0 100644
--- a/xorg-server/glx/glxext.c
+++ b/xorg-server/glx/glxext.c
@@ -286,10 +286,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 61d590cc8..78769f401 100644
--- a/xorg-server/glx/glxscreens.c
+++ b/xorg-server/glx/glxscreens.c
@@ -128,7 +128,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 "
@@ -139,9 +138,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 "
@@ -154,13 +150,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[] =
@@ -169,12 +166,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)
@@ -330,7 +329,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
@@ -420,7 +418,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;
/**