Unverified Commit d6872d4e authored by Mike Gabriel's avatar Mike Gabriel

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

parents 7afe9553 6fd0ffc9
...@@ -490,9 +490,12 @@ ProcShmDetach(client) ...@@ -490,9 +490,12 @@ ProcShmDetach(client)
return(client->noClientException); return(client->noClientException);
} }
#ifndef NXAGENT_SERVER
static void static void
#ifdef NXAGENT_SERVER
xorg_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
#else
miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
#endif
DrawablePtr dst; DrawablePtr dst;
GCPtr pGC; GCPtr pGC;
int depth, w, h, sx, sy, sw, sh, dx, dy; int depth, w, h, sx, sy, sw, sh, dx, dy;
...@@ -525,6 +528,7 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) ...@@ -525,6 +528,7 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
(*pmap->drawable.pScreen->DestroyPixmap)(pmap); (*pmap->drawable.pScreen->DestroyPixmap)(pmap);
} }
#ifndef NXAGENT_SERVER
static void static void
fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
DrawablePtr dst; DrawablePtr dst;
...@@ -1138,9 +1142,12 @@ CreatePmap: ...@@ -1138,9 +1142,12 @@ CreatePmap:
return (BadAlloc); return (BadAlloc);
} }
#ifndef NXAGENT_SERVER
static int static int
#ifdef NXAGENT_SERVER
xorg_ProcShmDispatch (client)
#else
ProcShmDispatch (client) ProcShmDispatch (client)
#endif
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xReq); REQUEST(xReq);
...@@ -1174,7 +1181,6 @@ ProcShmDispatch (client) ...@@ -1174,7 +1181,6 @@ ProcShmDispatch (client)
return BadRequest; return BadRequest;
} }
} }
#endif /* NXAGENT_SERVER */
static void static void
SShmCompletionEvent(from, to) SShmCompletionEvent(from, to)
...@@ -1278,9 +1284,12 @@ SProcShmCreatePixmap(client) ...@@ -1278,9 +1284,12 @@ SProcShmCreatePixmap(client)
return ProcShmCreatePixmap(client); return ProcShmCreatePixmap(client);
} }
#ifndef NXAGENT_SERVER
static int static int
#ifdef NXAGENT_SERVER
xorg_SProcShmDispatch (client)
#else
SProcShmDispatch (client) SProcShmDispatch (client)
#endif
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xReq); REQUEST(xReq);
...@@ -1302,4 +1311,3 @@ SProcShmDispatch (client) ...@@ -1302,4 +1311,3 @@ SProcShmDispatch (client)
return BadRequest; return BadRequest;
} }
} }
#endif /* NXAGENT_SERVER */
...@@ -164,42 +164,6 @@ ShmExtensionInit(void) ...@@ -164,42 +164,6 @@ ShmExtensionInit(void)
} }
static void static void
nxagent_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
DrawablePtr dst;
GCPtr pGC;
int depth, w, h, sx, sy, sw, sh, dx, dy;
unsigned int format;
char *data;
{
PixmapPtr pmap;
GCPtr putGC;
putGC = GetScratchGC(depth, dst->pScreen);
if (!putGC)
{
return;
}
pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pmap)
{
FreeScratchGC(putGC);
return;
}
ValidateGC((DrawablePtr)pmap, putGC);
(*putGC->ops->PutImage)((DrawablePtr)pmap, putGC, depth, -sx, -sy, w, h, 0,
(format == XYPixmap) ? XYPixmap : ZPixmap, data);
FreeScratchGC(putGC);
if (format == XYBitmap)
(void)(*pGC->ops->CopyPlane)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh,
dx, dy, 1L);
else
(void)(*pGC->ops->CopyArea)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh,
dx, dy);
(*pmap->drawable.pScreen->DestroyPixmap)(pmap);
}
static void
miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
DrawablePtr dst; DrawablePtr dst;
GCPtr pGC; GCPtr pGC;
...@@ -211,7 +175,7 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) ...@@ -211,7 +175,7 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
nxagentShmTrap = 0; nxagentShmTrap = 0;
nxagent_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data); xorg_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data);
nxagentShmTrap = 1; nxagentShmTrap = 1;
...@@ -486,77 +450,26 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr) ...@@ -486,77 +450,26 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
return result; return result;
} }
/* A wrapper that handles the trap. This construct is used
to keep the derived code closer to the original
*/
static int static int
nxagent_ProcShmDispatch (client) ProcShmDispatch (register ClientPtr client)
register ClientPtr client;
{ {
REQUEST(xReq); int result;
#ifdef NXAGENT_SERVER
#ifdef TEST #ifdef TEST
fprintf(stderr, "ProcShmDispatch: Going to execute operation [%d] for client [%d].\n", REQUEST(xReq);
stuff -> data, client -> index);
if (stuff->data <= X_ShmCreatePixmap) if (stuff->data <= X_ShmCreatePixmap)
{ {
fprintf(stderr, "ProcShmDispatch: Request [%s] OPCODE#%d.\n", fprintf(stderr, "ProcShmDispatch: Request [%s] OPCODE [%d] for client [%d].\n",
nxagentShmRequestLiteral[stuff->data], stuff->data); nxagentShmRequestLiteral[stuff->data], stuff->data, client->index);
} }
#endif #endif
#endif
switch (stuff->data)
{
case X_ShmQueryVersion:
return ProcShmQueryVersion(client);
case X_ShmAttach:
return ProcShmAttach(client);
case X_ShmDetach:
return ProcShmDetach(client);
case X_ShmPutImage:
{
#ifdef NXAGENT_SERVER
#ifdef TEST
fprintf(stderr, "ProcShmDispatch: Going to execute ProcShmPutImage() for client [%d].\n",
client -> index);
#endif
#endif
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShmPutImage(client);
#endif
return ProcShmPutImage(client);
}
case X_ShmGetImage:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShmGetImage(client);
#endif
return ProcShmGetImage(client);
case X_ShmCreatePixmap:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShmCreatePixmap(client);
#endif
return ProcShmCreatePixmap(client);
default:
return BadRequest;
}
}
/* A wrapper that handles the trap. This construct is used
to keep the derived code closer to the original
*/
static int
ProcShmDispatch (register ClientPtr client)
{
int result;
nxagentShmTrap = 1; nxagentShmTrap = 1;
result = nxagent_ProcShmDispatch(client); result = xorg_ProcShmDispatch(client);
nxagentShmTrap = 0; nxagentShmTrap = 0;
...@@ -564,55 +477,24 @@ ProcShmDispatch (register ClientPtr client) ...@@ -564,55 +477,24 @@ ProcShmDispatch (register ClientPtr client)
} }
static int static int
SProcShmDispatch (client) SProcShmDispatch (register ClientPtr client)
register ClientPtr client;
{ {
REQUEST(xReq); int result;
#ifdef TEST #ifdef TEST
fprintf(stderr, "SProcShmDispatch: Going to execute operation [%d] for client [%d].\n", REQUEST(xReq);
stuff -> data, client -> index); if (stuff->data <= X_ShmCreatePixmap)
#endif
switch (stuff->data)
{ {
case X_ShmQueryVersion: fprintf(stderr, "SProcShmDispatch: Request [%s] OPCODE [%d] for client [%d].\n",
return SProcShmQueryVersion(client); nxagentShmRequestLiteral[stuff->data], stuff->data, client->index);
case X_ShmAttach: }
return SProcShmAttach(client); #endif
case X_ShmDetach:
return SProcShmDetach(client);
case X_ShmPutImage:
{
int result;
#ifdef TEST
fprintf(stderr, "SProcShmDispatch: Going to execute SProcShmPutImage() for client [%d].\n",
client -> index);
#endif
#ifdef NXAGENT_SERVER
nxagentShmTrap = 1;
#endif
result = SProcShmPutImage(client); nxagentShmTrap = 1;
#ifdef NXAGENT_SERVER result = xorg_SProcShmDispatch(client);
nxagentShmTrap = 0;
#endif
#ifdef TEST nxagentShmTrap = 0;
fprintf(stderr, "SProcShmDispatch: Returning from SProcShmPutImage() for client [%d].\n",
client -> index);
#endif
return result; return result;
}
case X_ShmGetImage:
return SProcShmGetImage(client);
case X_ShmCreatePixmap:
return SProcShmCreatePixmap(client);
default:
return BadRequest;
}
} }
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