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