Unverified Commit 0e2b7479 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/simplify_nxrender' into 3.6.x

parents 60e0566d 3bc01d1b
...@@ -124,7 +124,9 @@ extern void nxagentRenderCreateConicalGradient(PicturePtr pPicture, ...@@ -124,7 +124,9 @@ extern void nxagentRenderCreateConicalGradient(PicturePtr pPicture,
xFixed *stops, xFixed *stops,
xRenderColor *colors); xRenderColor *colors);
#ifdef NXAGENT_SERVER
extern int nxagentAlphaEnabled; extern int nxagentAlphaEnabled;
#endif
/* /*
* The void pointer is actually a XGlyphElt8. * The void pointer is actually a XGlyphElt8.
...@@ -141,8 +143,13 @@ ProcRenderQueryVersion (ClientPtr client) ...@@ -141,8 +143,13 @@ ProcRenderQueryVersion (ClientPtr client)
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0, .length = 0,
#ifdef NXAGENT_SERVER
.majorVersion = nxagentRenderVersionMajor, .majorVersion = nxagentRenderVersionMajor,
.minorVersion = nxagentRenderVersionMinor .minorVersion = nxagentRenderVersionMinor
#else
.majorVersion = SERVER_RENDER_MAJOR_VERSION,
.minorVersion = SERVER_RENDER_MINOR_VERSION
#endif
}; };
REQUEST(xRenderQueryVersionReq); REQUEST(xRenderQueryVersionReq);
...@@ -229,9 +236,11 @@ ProcRenderQueryPictFormats (ClientPtr client) ...@@ -229,9 +236,11 @@ ProcRenderQueryPictFormats (ClientPtr client)
ndepth * sizeof (xPictDepth) + ndepth * sizeof (xPictDepth) +
nvisual * sizeof (xPictVisual) + nvisual * sizeof (xPictVisual) +
numSubpixel * sizeof (CARD32)); numSubpixel * sizeof (CARD32));
reply = (xRenderQueryPictFormatsReply *) calloc (1, rlength); reply = (xRenderQueryPictFormatsReply *) malloc (rlength);
if (!reply) if (!reply)
return BadAlloc; return BadAlloc;
memset(reply, 0, rlength);
reply->type = X_Reply; reply->type = X_Reply;
reply->sequenceNumber = client->sequence; reply->sequenceNumber = client->sequence;
reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->length = (rlength - sizeof(xGenericReply)) >> 2;
...@@ -262,7 +271,11 @@ ProcRenderQueryPictFormats (ClientPtr client) ...@@ -262,7 +271,11 @@ ProcRenderQueryPictFormats (ClientPtr client)
pictForm->direct.greenMask = pFormat->direct.greenMask; pictForm->direct.greenMask = pFormat->direct.greenMask;
pictForm->direct.blue = pFormat->direct.blue; pictForm->direct.blue = pFormat->direct.blue;
pictForm->direct.blueMask = pFormat->direct.blueMask; pictForm->direct.blueMask = pFormat->direct.blueMask;
#ifdef NXAGENT_SERVER
pictForm->direct.alpha = nxagentAlphaEnabled ? pFormat->direct.alpha : 0; pictForm->direct.alpha = nxagentAlphaEnabled ? pFormat->direct.alpha : 0;
#else
pictForm->direct.alpha = pFormat->direct.alpha;
#endif
pictForm->direct.alphaMask = pFormat->direct.alphaMask; pictForm->direct.alphaMask = pFormat->direct.alphaMask;
if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap) if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap)
pictForm->colormap = pFormat->index.pColormap->mid; pictForm->colormap = pFormat->index.pColormap->mid;
...@@ -409,7 +422,10 @@ ProcRenderCreatePicture (ClientPtr client) ...@@ -409,7 +422,10 @@ ProcRenderCreatePicture (ClientPtr client)
&error); &error);
if (!pPicture) if (!pPicture)
return error; return error;
#ifdef NXAGENT_SERVER
/* FIXME: shouldn't this be integrated into CreatePicture? */
nxagentCreatePicture(pPicture, stuff -> mask); nxagentCreatePicture(pPicture, stuff -> mask);
#endif
if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) if (!AddResource (stuff->pid, PictureType, (void *)pPicture))
return BadAlloc; return BadAlloc;
...@@ -422,7 +438,6 @@ ProcRenderChangePicture (ClientPtr client) ...@@ -422,7 +438,6 @@ ProcRenderChangePicture (ClientPtr client)
PicturePtr pPicture; PicturePtr pPicture;
REQUEST(xRenderChangePictureReq); REQUEST(xRenderChangePictureReq);
int len; int len;
int error;
REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess,
...@@ -432,12 +447,19 @@ ProcRenderChangePicture (ClientPtr client) ...@@ -432,12 +447,19 @@ ProcRenderChangePicture (ClientPtr client)
if (Ones(stuff->mask) != len) if (Ones(stuff->mask) != len)
return BadLength; return BadLength;
error = ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1), #ifdef NXAGENT_SERVER
(DevUnion *) 0, client); {
int error = ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1),
(DevUnion *) 0, client);
nxagentChangePicture(pPicture, stuff->mask); nxagentChangePicture(pPicture, stuff->mask);
return error; return error;
}
#else
return ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1),
(DevUnion *) 0, client);
#endif
} }
static int static int
...@@ -454,6 +476,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client) ...@@ -454,6 +476,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client)
if (!pPicture->pDrawable) if (!pPicture->pDrawable)
return BadDrawable; return BadDrawable;
#ifdef NXAGENT_SERVER
/* /*
* The original code used sizeof(xRenderChangePictureReq). * The original code used sizeof(xRenderChangePictureReq).
* This was harmless, as both structures have the same size. * This was harmless, as both structures have the same size.
...@@ -461,18 +484,23 @@ ProcRenderSetPictureClipRectangles (ClientPtr client) ...@@ -461,18 +484,23 @@ ProcRenderSetPictureClipRectangles (ClientPtr client)
* nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq); * nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq);
*/ */
nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq); nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq);
#else
nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq);
#endif
if (nr & 4) if (nr & 4)
return BadLength; return BadLength;
nr >>= 3; nr >>= 3;
result = SetPictureClipRects (pPicture, result = SetPictureClipRects (pPicture,
stuff->xOrigin, stuff->yOrigin, stuff->xOrigin, stuff->yOrigin,
nr, (xRectangle *) &stuff[1]); nr, (xRectangle *) &stuff[1]);
#ifdef NXAGENT_SERVER
nxagentChangePictureClip (pPicture, nxagentChangePictureClip (pPicture,
CT_NONE, CT_NONE,
nr, nr,
(xRectangle *) &stuff[1], (xRectangle *) &stuff[1],
(int)stuff -> xOrigin, (int)stuff -> xOrigin,
(int)stuff -> yOrigin); (int)stuff -> yOrigin);
#endif
if (client->noClientException != Success) if (client->noClientException != Success)
return(client->noClientException); return(client->noClientException);
...@@ -713,6 +741,7 @@ ProcRenderTrapezoids (ClientPtr client) ...@@ -713,6 +741,7 @@ ProcRenderTrapezoids (ClientPtr client)
return BadLength; return BadLength;
ntraps /= sizeof (xTrapezoid); ntraps /= sizeof (xTrapezoid);
if (ntraps) if (ntraps)
#ifdef NXAGENT_SERVER
{ {
if (pFormat != NULL) if (pFormat != NULL)
{ {
...@@ -742,6 +771,11 @@ ProcRenderTrapezoids (ClientPtr client) ...@@ -742,6 +771,11 @@ ProcRenderTrapezoids (ClientPtr client)
nxagentTrapezoidExtents = NullBox; nxagentTrapezoidExtents = NullBox;
} }
} }
#else
CompositeTrapezoids (stuff->op, pSrc, pDst, pFormat,
stuff->xSrc, stuff->ySrc,
ntraps, (xTrapezoid *) &stuff[1]);
#endif
return client->noClientException; return client->noClientException;
} }
...@@ -793,7 +827,9 @@ ProcRenderCreateGlyphSet (ClientPtr client) ...@@ -793,7 +827,9 @@ ProcRenderCreateGlyphSet (ClientPtr client)
if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet)) if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet))
return BadAlloc; return BadAlloc;
#ifdef NXAGENT_SERVER
nxagentCreateGlyphSet(glyphSet); nxagentCreateGlyphSet(glyphSet);
#endif
return Success; return Success;
} }
...@@ -819,7 +855,9 @@ ProcRenderReferenceGlyphSet (ClientPtr client) ...@@ -819,7 +855,9 @@ ProcRenderReferenceGlyphSet (ClientPtr client)
} }
glyphSet->refcnt++; glyphSet->refcnt++;
#ifdef NXAGENT_SERVER
nxagentReferenceGlyphSet(glyphSet); nxagentReferenceGlyphSet(glyphSet);
#endif
if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet)) if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet))
return BadAlloc; return BadAlloc;
...@@ -843,7 +881,9 @@ ProcRenderFreeGlyphSet (ClientPtr client) ...@@ -843,7 +881,9 @@ ProcRenderFreeGlyphSet (ClientPtr client)
return RenderErrBase + BadGlyphSet; return RenderErrBase + BadGlyphSet;
} }
#ifdef NXAGENT_SERVER
nxagentFreeGlyphSet(glyphSet); nxagentFreeGlyphSet(glyphSet);
#endif
FreeResource (stuff->glyphset, RT_NONE); FreeResource (stuff->glyphset, RT_NONE);
return client->noClientException; return client->noClientException;
...@@ -871,7 +911,9 @@ ProcRenderFreeGlyphs (ClientPtr client) ...@@ -871,7 +911,9 @@ ProcRenderFreeGlyphs (ClientPtr client)
nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2; nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2;
gids = (CARD32 *) (stuff + 1); gids = (CARD32 *) (stuff + 1);
#ifdef NXAGENT_SERVER
nxagentFreeGlyphs(glyphSet, gids, nglyph); nxagentFreeGlyphs(glyphSet, gids, nglyph);
#endif
while (nglyph-- > 0) while (nglyph-- > 0)
{ {
...@@ -913,7 +955,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -913,7 +955,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
int size; int size;
int n; int n;
#ifdef NXAGENT_SERVER
XGlyphElt8 *elements, *elementsBase; XGlyphElt8 *elements, *elementsBase;
#endif
REQUEST(xRenderCompositeGlyphsReq); REQUEST(xRenderCompositeGlyphsReq);
...@@ -1001,23 +1045,28 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1001,23 +1045,28 @@ ProcRenderCompositeGlyphs (ClientPtr client)
listsBase = (GlyphListPtr) malloc (nlist * sizeof (GlyphListRec)); listsBase = (GlyphListPtr) malloc (nlist * sizeof (GlyphListRec));
if (!listsBase) if (!listsBase)
{ {
free(glyphsBase); if (glyphsBase != glyphsLocal)
free(glyphsBase);
return BadAlloc; return BadAlloc;
} }
} }
#ifdef NXAGENT_SERVER
elementsBase = malloc(nlist * sizeof(XGlyphElt8)); elementsBase = malloc(nlist * sizeof(XGlyphElt8));
if (!elementsBase) if (!elementsBase)
{ {
free(glyphsBase); if (glyphsBase != glyphsLocal)
free(listsBase); free(glyphsBase);
return BadAlloc; if (listsBase != listsLocal)
free(listsBase);
return BadAlloc;
} }
elements = elementsBase;
#endif
buffer = (CARD8 *) (stuff + 1); buffer = (CARD8 *) (stuff + 1);
glyphs = glyphsBase; glyphs = glyphsBase;
lists = listsBase; lists = listsBase;
elements = elementsBase;
while (buffer + sizeof (xGlyphElt) < end) while (buffer + sizeof (xGlyphElt) < end)
{ {
elt = (xGlyphElt *) buffer; elt = (xGlyphElt *) buffer;
...@@ -1025,10 +1074,12 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1025,10 +1074,12 @@ ProcRenderCompositeGlyphs (ClientPtr client)
if (elt->len == 0xff) if (elt->len == 0xff)
{ {
#ifdef NXAGENT_SERVER
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "ProcRenderCompositeGlyphs: Glyphset change with base size [%d].\n", fprintf(stderr, "ProcRenderCompositeGlyphs: Glyphset change with base size [%d].\n",
size); size);
#endif #endif
#endif
if (buffer + sizeof (GlyphSet) < end) if (buffer + sizeof (GlyphSet) < end)
{ {
...@@ -1044,6 +1095,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1044,6 +1095,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
free (glyphsBase); free (glyphsBase);
if (listsBase != listsLocal) if (listsBase != listsLocal)
free (listsBase); free (listsBase);
#ifdef NXAGENT_SERVER
free(elementsBase);
#endif
return RenderErrBase + BadGlyphSet; return RenderErrBase + BadGlyphSet;
} }
} }
...@@ -1056,6 +1110,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1056,6 +1110,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
lists->format = glyphSet->format; lists->format = glyphSet->format;
lists->len = 0; lists->len = 0;
#ifdef NXAGENT_SERVER
if (glyphSet -> remoteID == 0) if (glyphSet -> remoteID == 0)
{ {
#ifdef TEST #ifdef TEST
...@@ -1071,6 +1126,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1071,6 +1126,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
elements -> nchars = elt->len; elements -> nchars = elt->len;
elements -> xOff = elt->deltax; elements -> xOff = elt->deltax;
elements -> yOff = elt->deltay; elements -> yOff = elt->deltay;
#endif
n = elt->len; n = elt->len;
while (n--) while (n--)
{ {
...@@ -1097,12 +1153,24 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1097,12 +1153,24 @@ ProcRenderCompositeGlyphs (ClientPtr client)
if (space & 3) if (space & 3)
buffer += 4 - (space & 3); buffer += 4 - (space & 3);
lists++; lists++;
#ifdef NXAGENT_SERVER
elements++; elements++;
#endif
} }
} }
if (buffer > end) if (buffer > end)
{
if (glyphsBase != glyphsLocal)
free(glyphsBase);
if (listsBase != listsLocal)
free(listsBase);
#ifdef NXAGENT_SERVER
free(elementsBase);
#endif
return BadLength; return BadLength;
}
#ifdef NXAGENT_SERVER
/* /*
* We need to know the glyphs extents to synchronize * We need to know the glyphs extents to synchronize
* the drawables involved in the composite text ope- * the drawables involved in the composite text ope-
...@@ -1145,17 +1213,28 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1145,17 +1213,28 @@ ProcRenderCompositeGlyphs (ClientPtr client)
listsBase, listsBase,
glyphsBase); glyphsBase);
} }
free(nxagentGlyphsExtents); free(nxagentGlyphsExtents);
nxagentGlyphsExtents = NullBox; nxagentGlyphsExtents = NullBox;
free(elementsBase);
#else
CompositeGlyphs (stuff->op,
pSrc,
pDst,
pFormat,
stuff->xSrc,
stuff->ySrc,
nlist,
listsBase,
glyphsBase);
#endif
if (glyphsBase != glyphsLocal) if (glyphsBase != glyphsLocal)
free (glyphsBase); free (glyphsBase);
if (listsBase != listsLocal) if (listsBase != listsLocal)
free (listsBase); free (listsBase);
free(elementsBase);
return client->noClientException; return client->noClientException;
} }
...@@ -1188,12 +1267,14 @@ ProcRenderFillRectangles (ClientPtr client) ...@@ -1188,12 +1267,14 @@ ProcRenderFillRectangles (ClientPtr client)
things, things,
(xRectangle *) &stuff[1]); (xRectangle *) &stuff[1]);
#ifdef NXAGENT_SERVER
ValidatePicture (pDst); ValidatePicture (pDst);
nxagentCompositeRects(stuff -> op, nxagentCompositeRects(stuff -> op,
pDst, pDst,
&stuff -> color, &stuff -> color,
things, things,
(xRectangle *) &stuff[1]); (xRectangle *) &stuff[1]);
#endif
return client->noClientException; return client->noClientException;
} }
...@@ -1216,8 +1297,6 @@ ProcRenderCreateCursor (ClientPtr client) ...@@ -1216,8 +1297,6 @@ ProcRenderCreateCursor (ClientPtr client)
CARD32 twocolor[3]; CARD32 twocolor[3];
int ncolor; int ncolor;
RealizeCursorProcPtr saveRealizeCursor;
REQUEST_SIZE_MATCH (xRenderCreateCursorReq); REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
LEGAL_NEW_RESOURCE(stuff->cid, client); LEGAL_NEW_RESOURCE(stuff->cid, client);
...@@ -1277,7 +1356,7 @@ ProcRenderCreateCursor (ClientPtr client) ...@@ -1277,7 +1356,7 @@ ProcRenderCreateCursor (ClientPtr client)
return (BadImplementation); return (BadImplementation);
} }
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32, pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32,
CREATE_PIXMAP_USAGE_SCRATCH); CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap) if (!pPixmap)
{ {
free (argbbits); free (argbbits);
...@@ -1387,6 +1466,7 @@ ProcRenderCreateCursor (ClientPtr client) ...@@ -1387,6 +1466,7 @@ ProcRenderCreateCursor (ClientPtr client)
cm.xhot = stuff->x; cm.xhot = stuff->x;
cm.yhot = stuff->y; cm.yhot = stuff->y;
#ifdef NXAGENT_SERVER
/* /*
* This cursor uses RENDER, so we make sure * This cursor uses RENDER, so we make sure
* that it is allocated in a way that allows * that it is allocated in a way that allows
...@@ -1396,10 +1476,10 @@ ProcRenderCreateCursor (ClientPtr client) ...@@ -1396,10 +1476,10 @@ ProcRenderCreateCursor (ClientPtr client)
* client. * client.
*/ */
saveRealizeCursor = pScreen -> RealizeCursor; RealizeCursorProcPtr saveRealizeCursor = pScreen -> RealizeCursor;
pScreen -> RealizeCursor = nxagentCursorSaveRenderInfo; pScreen -> RealizeCursor = nxagentCursorSaveRenderInfo;
#endif
pCursor = AllocCursorARGB (srcbits, mskbits, argbbits, &cm, pCursor = AllocCursorARGB (srcbits, mskbits, argbbits, &cm,
GetColor(twocolor[0], 16), GetColor(twocolor[0], 16),
GetColor(twocolor[0], 8), GetColor(twocolor[0], 8),
...@@ -1408,6 +1488,7 @@ ProcRenderCreateCursor (ClientPtr client) ...@@ -1408,6 +1488,7 @@ ProcRenderCreateCursor (ClientPtr client)
GetColor(twocolor[1], 8), GetColor(twocolor[1], 8),
GetColor(twocolor[1], 0)); GetColor(twocolor[1], 0));
#ifdef NXAGENT_SERVER
pScreen -> RealizeCursor = saveRealizeCursor; pScreen -> RealizeCursor = saveRealizeCursor;
/* /*
...@@ -1426,8 +1507,8 @@ ProcRenderCreateCursor (ClientPtr client) ...@@ -1426,8 +1507,8 @@ ProcRenderCreateCursor (ClientPtr client)
nxagentCursorPostSaveRenderInfo(pCursor, pScreen, pSrc, stuff -> x, stuff -> y); nxagentCursorPostSaveRenderInfo(pCursor, pScreen, pSrc, stuff -> x, stuff -> y);
nxagentRenderRealizeCursor(pScreen, pCursor); nxagentRenderRealizeCursor(pScreen, pCursor);
#endif
if (AddResource(stuff->cid, RT_CURSOR, (void *)pCursor)) if (pCursor && AddResource(stuff->cid, RT_CURSOR, (void *)pCursor))
return (client->noClientException); return (client->noClientException);
return BadAlloc; return BadAlloc;
} }
...@@ -1444,8 +1525,10 @@ ProcRenderSetPictureTransform (ClientPtr client) ...@@ -1444,8 +1525,10 @@ ProcRenderSetPictureTransform (ClientPtr client)
RenderErrBase + BadPicture); RenderErrBase + BadPicture);
result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform); result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform);
#ifdef NXAGENT_SERVER
nxagentSetPictureTransform(pPicture, &stuff->transform); nxagentSetPictureTransform(pPicture, &stuff->transform);
#endif
if (client->noClientException != Success) if (client->noClientException != Success)
return(client->noClientException); return(client->noClientException);
else else
...@@ -1470,7 +1553,9 @@ ProcRenderSetPictureFilter (ClientPtr client) ...@@ -1470,7 +1553,9 @@ ProcRenderSetPictureFilter (ClientPtr client)
nparams = ((xFixed *) stuff + client->req_len) - params; nparams = ((xFixed *) stuff + client->req_len) - params;
result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams); result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams);
#ifdef NXAGENT_SERVER
nxagentSetPictureFilter(pPicture, name, stuff->nbytes, params, nparams); nxagentSetPictureFilter(pPicture, name, stuff->nbytes, params, nparams);
#endif
return result; return result;
} }
...@@ -1515,12 +1600,14 @@ ProcRenderCreateAnimCursor (ClientPtr client) ...@@ -1515,12 +1600,14 @@ ProcRenderCreateAnimCursor (ClientPtr client)
if (ret != Success) if (ret != Success)
return ret; return ret;
#ifdef NXAGENT_SERVER
nxagentAnimCursorBits = pCursor -> bits; nxagentAnimCursorBits = pCursor -> bits;
for (i = 0; i < MAXSCREENS; i++) for (i = 0; i < MAXSCREENS; i++)
{ {
pCursor -> devPriv[i] = NULL; pCursor -> devPriv[i] = NULL;
} }
#endif
if (AddResource (stuff->cid, RT_CURSOR, (void *)pCursor)) if (AddResource (stuff->cid, RT_CURSOR, (void *)pCursor))
return client->noClientException; return client->noClientException;
...@@ -1540,11 +1627,11 @@ static int ProcRenderCreateSolidFill(ClientPtr client) ...@@ -1540,11 +1627,11 @@ static int ProcRenderCreateSolidFill(ClientPtr client)
pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error); pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error);
if (!pPicture) if (!pPicture)
return error; return error;
/* AGENT SERVER */
#ifdef NXAGENT_SERVER
nxagentRenderCreateSolidFill(pPicture, &stuff -> color); nxagentRenderCreateSolidFill(pPicture, &stuff -> color);
#endif
/* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) if (!AddResource (stuff->pid, PictureType, (void *)pPicture))
return BadAlloc; return BadAlloc;
return Success; return Success;
...@@ -1576,12 +1663,12 @@ static int ProcRenderCreateLinearGradient (ClientPtr client) ...@@ -1576,12 +1663,12 @@ static int ProcRenderCreateLinearGradient (ClientPtr client)
stuff->nStops, stops, colors, &error); stuff->nStops, stops, colors, &error);
if (!pPicture) if (!pPicture)
return error; return error;
/* AGENT SERVER */
#ifdef NXAGENT_SERVER
nxagentRenderCreateLinearGradient(pPicture, &stuff->p1, &stuff->p2, nxagentRenderCreateLinearGradient(pPicture, &stuff->p1, &stuff->p2,
stuff->nStops, stops, colors); stuff->nStops, stops, colors);
#endif
/* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) if (!AddResource (stuff->pid, PictureType, (void *)pPicture))
return BadAlloc; return BadAlloc;
return Success; return Success;
...@@ -1612,14 +1699,15 @@ static int ProcRenderCreateRadialGradient (ClientPtr client) ...@@ -1612,14 +1699,15 @@ static int ProcRenderCreateRadialGradient (ClientPtr client)
stuff->nStops, stops, colors, &error); stuff->nStops, stops, colors, &error);
if (!pPicture) if (!pPicture)
return error; return error;
/* AGENT SERVER */
#ifdef NXAGENT_SERVER
nxagentRenderCreateRadialGradient(pPicture, &stuff->inner, &stuff->outer, nxagentRenderCreateRadialGradient(pPicture, &stuff->inner, &stuff->outer,
stuff->inner_radius, stuff->inner_radius,
stuff->outer_radius, stuff->outer_radius,
stuff->nStops, stops, colors); stuff->nStops, stops, colors);
/* AGENT SERVER */ #endif
if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) if (!AddResource (stuff->pid, PictureType, (void *)pPicture))
return BadAlloc; return BadAlloc;
return Success; return Success;
...@@ -1649,13 +1737,13 @@ static int ProcRenderCreateConicalGradient (ClientPtr client) ...@@ -1649,13 +1737,13 @@ static int ProcRenderCreateConicalGradient (ClientPtr client)
stuff->nStops, stops, colors, &error); stuff->nStops, stops, colors, &error);
if (!pPicture) if (!pPicture)
return error; return error;
/* AGENT SERVER */
#ifdef NXAGENT_SERVER
nxagentRenderCreateConicalGradient(pPicture, &stuff->center, nxagentRenderCreateConicalGradient(pPicture, &stuff->center,
stuff->angle, stuff->nStops, stops, stuff->angle, stuff->nStops, stops,
colors); colors);
#endif
/* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) if (!AddResource (stuff->pid, PictureType, (void *)pPicture))
return BadAlloc; return BadAlloc;
return Success; return Success;
...@@ -1665,58 +1753,53 @@ static int ProcRenderCreateConicalGradient (ClientPtr client) ...@@ -1665,58 +1753,53 @@ static int ProcRenderCreateConicalGradient (ClientPtr client)
static int static int
ProcRenderDispatch (ClientPtr client) ProcRenderDispatch (ClientPtr client)
{ {
int result; #ifdef TEST
REQUEST(xReq); REQUEST(xReq);
if (stuff->data < RenderNumberRequests) if (stuff->data < RenderNumberRequests)
{ {
#ifdef TEST fprintf(stderr, "%s: Request [%s] OPCODE#%d.\n", __func__,
fprintf(stderr, "ProcRenderDispatch: Request [%s] OPCODE#%d.\n",
nxagentRenderRequestLiteral[stuff->data], stuff->data); nxagentRenderRequestLiteral[stuff->data], stuff->data);
#endif }
#endif
/* /*
* Set the nxagentGCTrap flag while * Set the nxagentGCTrap flag while dispatching a render
* dispatching a render operation to * operation to avoid reentrancy in GCOps.c.
* avoid reentrancy in GCOps.c. */
*/
nxagentGCTrap = 1; nxagentGCTrap = 1;
result = (*ProcRenderVector[stuff->data]) (client); int result = xorg_ProcRenderDispatch(client);
nxagentGCTrap = 0; nxagentGCTrap = 0;
return result; return result;
}
else
return BadRequest;
} }
static int static int
SProcRenderDispatch (ClientPtr client) SProcRenderDispatch (ClientPtr client)
{ {
int result; #ifdef TEST
REQUEST(xReq); REQUEST(xReq);
if (stuff->data < RenderNumberRequests) if (stuff->data < RenderNumberRequests)
{ {
/* fprintf(stderr, "%s: Request [%s] OPCODE#%d.\n", __func__,
* Set the nxagentGCTrap flag while nxagentRenderRequestLiteral[stuff->data], stuff->data);
* dispatching a render operation to }
* avoid reentrancy in GCOps.c. #endif
*/
/*
* Set the nxagentGCTrap flag while dispatching a render
* operation to avoid reentrancy in GCOps.c.
*/
nxagentGCTrap = 1; nxagentGCTrap = 1;
result = (*SProcRenderVector[stuff->data]) (client); int result = xorg_SProcRenderDispatch(client);
nxagentGCTrap = 0; nxagentGCTrap = 0;
return result; return result;
}
else
return BadRequest;
} }
...@@ -126,6 +126,11 @@ static int SProcRenderCreateConicalGradient (ClientPtr pClient); ...@@ -126,6 +126,11 @@ static int SProcRenderCreateConicalGradient (ClientPtr pClient);
static int SProcRenderDispatch (ClientPtr pClient); static int SProcRenderDispatch (ClientPtr pClient);
#ifdef NXAGENT_SERVER
static int xorg_ProcRenderDispatch (ClientPtr pClient);
static int xorg_SProcRenderDispatch (ClientPtr pClient);
#endif
int (*ProcRenderVector[RenderNumberRequests])(ClientPtr) = { int (*ProcRenderVector[RenderNumberRequests])(ClientPtr) = {
ProcRenderQueryVersion, ProcRenderQueryVersion,
ProcRenderQueryPictFormats, ProcRenderQueryPictFormats,
...@@ -1347,9 +1352,8 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1347,9 +1352,8 @@ ProcRenderCompositeGlyphs (ClientPtr client)
listsBase = (GlyphListPtr) malloc (nlist * sizeof (GlyphListRec)); listsBase = (GlyphListPtr) malloc (nlist * sizeof (GlyphListRec));
if (!listsBase) if (!listsBase)
{ {
free(glyphsBase); if (glyphsBase != glyphsLocal)
free(listsBase); free(glyphsBase);
return BadAlloc; return BadAlloc;
} }
} }
...@@ -1417,8 +1421,13 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1417,8 +1421,13 @@ ProcRenderCompositeGlyphs (ClientPtr client)
} }
} }
if (buffer > end) if (buffer > end)
{
if (glyphsBase != glyphsLocal)
free(glyphsBase);
if (listsBase != listsLocal)
free(listsBase);
return BadLength; return BadLength;
}
CompositeGlyphs (stuff->op, CompositeGlyphs (stuff->op,
pSrc, pSrc,
pDst, pDst,
...@@ -2018,10 +2027,15 @@ static int ProcRenderCreateConicalGradient (ClientPtr client) ...@@ -2018,10 +2027,15 @@ static int ProcRenderCreateConicalGradient (ClientPtr client)
return BadAlloc; return BadAlloc;
return Success; return Success;
} }
#endif /* NXAGENT_SERVER */
static int static int
#ifdef NXAGENT_SERVER
xorg_ProcRenderDispatch (ClientPtr client)
#else
ProcRenderDispatch (ClientPtr client) ProcRenderDispatch (ClientPtr client)
#endif
{ {
REQUEST(xReq); REQUEST(xReq);
...@@ -2030,7 +2044,6 @@ ProcRenderDispatch (ClientPtr client) ...@@ -2030,7 +2044,6 @@ ProcRenderDispatch (ClientPtr client)
else else
return BadRequest; return BadRequest;
} }
#endif /* NXAGENT_SERVER */
static int static int
SProcRenderQueryVersion (ClientPtr client) SProcRenderQueryVersion (ClientPtr client)
...@@ -2602,9 +2615,12 @@ SProcRenderCreateConicalGradient (ClientPtr client) ...@@ -2602,9 +2615,12 @@ SProcRenderCreateConicalGradient (ClientPtr client)
return (*ProcRenderVector[stuff->renderReqType]) (client); return (*ProcRenderVector[stuff->renderReqType]) (client);
} }
#ifndef NXAGENT_SERVER #ifdef NXAGENT_SERVER
static int static int
xorg_SProcRenderDispatch (ClientPtr client)
#else
SProcRenderDispatch (ClientPtr client) SProcRenderDispatch (ClientPtr client)
#endif
{ {
REQUEST(xReq); REQUEST(xReq);
...@@ -2613,7 +2629,6 @@ SProcRenderDispatch (ClientPtr client) ...@@ -2613,7 +2629,6 @@ SProcRenderDispatch (ClientPtr client)
else else
return BadRequest; return BadRequest;
} }
#endif /* NXAGENT_SERVER */
#ifdef PANORAMIX #ifdef PANORAMIX
#include "panoramiX.h" #include "panoramiX.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment