diff options
Diffstat (limited to 'xorg-server/Xext/shm.c')
-rw-r--r-- | xorg-server/Xext/shm.c | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/xorg-server/Xext/shm.c b/xorg-server/Xext/shm.c index 885fd61ef..9bc39b4c6 100644 --- a/xorg-server/Xext/shm.c +++ b/xorg-server/Xext/shm.c @@ -141,10 +141,10 @@ int BadShmSegCode; RESTYPE ShmSegType;
static ShmDescPtr Shmsegs;
static Bool sharedPixmaps;
-static int shmScrPrivateKeyIndex;
-static DevPrivateKey shmScrPrivateKey = &shmScrPrivateKeyIndex;
-static int shmPixmapPrivateIndex;
-static DevPrivateKey shmPixmapPrivate = &shmPixmapPrivateIndex;
+static DevPrivateKeyRec shmScrPrivateKeyRec;
+#define shmScrPrivateKey (&shmScrPrivateKeyRec)
+static DevPrivateKeyRec shmPixmapPrivateKeyRec;
+#define shmPixmapPrivateKey (&shmPixmapPrivateKeyRec)
static ShmFuncs miFuncs = {NULL, NULL};
static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL};
@@ -213,7 +213,7 @@ static Bool CheckForShmSyscall(void) badSysCall = TRUE;
}
signal(SIGSYS, oldHandler);
- return(!badSysCall);
+ return !badSysCall;
}
#define MUST_CHECK_FOR_SHM_SYSCALL
@@ -244,6 +244,16 @@ ShmInitScreenPriv(ScreenPtr pScreen) return screen_priv;
}
+static Bool
+ShmRegisterPrivates(void)
+{
+ if (!dixRegisterPrivateKey(&shmScrPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&shmPixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
+ return FALSE;
+ return TRUE;
+}
+
void
ShmExtensionInit(INITARGS)
{
@@ -258,6 +268,9 @@ ShmExtensionInit(INITARGS) }
#endif
+ if (!ShmRegisterPrivates())
+ return;
+
sharedPixmaps = xFalse;
{
sharedPixmaps = xTrue;
@@ -303,6 +316,8 @@ ShmResetProc(ExtensionEntry *extEntry) void
ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
{
+ if (!ShmRegisterPrivates())
+ return;
ShmInitScreenPriv(pScreen)->shmFuncs = funcs;
}
@@ -316,7 +331,7 @@ ShmDestroyPixmap (PixmapPtr pPixmap) {
ShmDescPtr shmdesc;
shmdesc = (ShmDescPtr)dixLookupPrivate(&pPixmap->devPrivates,
- shmPixmapPrivate);
+ shmPixmapPrivateKey);
if (shmdesc)
ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
}
@@ -441,7 +456,7 @@ ProcShmAttach(ClientPtr client) if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse))
{
client->errorValue = stuff->readOnly;
- return(BadValue);
+ return BadValue;
}
for (shmdesc = Shmsegs;
shmdesc && (shmdesc->shmid != stuff->shmid);
@@ -598,13 +613,13 @@ ProcPanoramiXShmPutImage(ClientPtr client) stuff->drawable = draw->info[j].id;
stuff->gc = gc->info[j].id;
if (isRoot) {
- stuff->dstX = orig_x - panoramiXdataPtr[j].x;
- stuff->dstY = orig_y - panoramiXdataPtr[j].y;
+ stuff->dstX = orig_x - screenInfo.screens[j]->x;
+ stuff->dstY = orig_y - screenInfo.screens[j]->y;
}
result = ProcShmPutImage(client);
if(result != Success) break;
}
- return(result);
+ return result;
}
static int
@@ -626,7 +641,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
client->errorValue = stuff->format;
- return(BadValue);
+ return BadValue;
}
rc = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
@@ -657,24 +672,24 @@ ProcPanoramiXShmGetImage(ClientPtr client) if( /* check for being onscreen */
x < 0 || x + w > PanoramiXPixWidth ||
y < 0 || y + h > PanoramiXPixHeight )
- return(BadMatch);
+ return BadMatch;
} else {
if( /* check for being onscreen */
- panoramiXdataPtr[0].x + pDraw->x + x < 0 ||
- panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth ||
- panoramiXdataPtr[0].y + pDraw->y + y < 0 ||
- panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight ||
+ screenInfo.screens[0]->x + pDraw->x + x < 0 ||
+ screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
+ screenInfo.screens[0]->y + pDraw->y + y < 0 ||
+ screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight ||
/* check for being inside of border */
x < - wBorderWidth((WindowPtr)pDraw) ||
x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
y < -wBorderWidth((WindowPtr)pDraw) ||
y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height)
- return(BadMatch);
+ return BadMatch;
}
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
if(!drawables)
- return(BadAlloc);
+ return BadAlloc;
drawables[0] = pDraw;
for(i = 1; i < PanoramiXNumScreens; i++) {
@@ -817,7 +832,7 @@ CreatePmap: shmdesc->addr + stuff->offset);
if (pMap) {
- dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc);
+ dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = newPix->info[j].id;
@@ -972,7 +987,7 @@ ProcShmGetImage(ClientPtr client) if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap))
{
client->errorValue = stuff->format;
- return(BadValue);
+ return BadValue;
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixReadAccess);
@@ -996,7 +1011,7 @@ ProcShmGetImage(ClientPtr client) stuff->y + (int)stuff->height >
wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height
)
- return(BadMatch);
+ return BadMatch;
xgi.visual = wVisual(((WindowPtr)pDraw));
}
else
@@ -1006,7 +1021,7 @@ ProcShmGetImage(ClientPtr client) stuff->y < 0 ||
stuff->y+(int)stuff->height > pDraw->height
)
- return(BadMatch);
+ return BadMatch;
xgi.visual = None;
}
xgi.type = X_Reply;
@@ -1156,7 +1171,7 @@ CreatePmap: pDraw->pScreen->DestroyPixmap(pMap);
return rc;
}
- dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc);
+ dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid;
@@ -1166,7 +1181,7 @@ CreatePmap: }
pDraw->pScreen->DestroyPixmap(pMap);
}
- return (BadAlloc);
+ return BadAlloc;
}
static int
|