From 6060b612de6b41f872d034c6130770c1d189d0a3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jun 2006 20:12:31 +0200 Subject: Provide option to report damage after operation is complete. --- miext/damage/damage.c | 150 +++++++++++++++++++++++++++++++++++------------ miext/damage/damage.h | 3 + miext/damage/damagestr.h | 3 + 3 files changed, 119 insertions(+), 37 deletions(-) diff --git a/miext/damage/damage.c b/miext/damage/damage.c index ef7bca455..5b9402898 100755 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -113,6 +113,52 @@ getDrawableDamageRef (DrawablePtr pDrawable) DamagePtr *pPrev = (DamagePtr *) \ &(pWindow->devPrivates[damageWinPrivateIndex].ptr) +static void +DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion) +{ + BoxRec tmpBox; + RegionRec tmpRegion; + Bool was_empty; + + switch (pDamage->damageLevel) { + case DamageReportRawRegion: + (*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure); + break; + case DamageReportDeltaRegion: + REGION_NULL (pScreen, &tmpRegion); + REGION_SUBTRACT (pScreen, &tmpRegion, pDamageRegion, &pDamage->damage); + if (REGION_NOTEMPTY (pScreen, &tmpRegion)) { + REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage, + pDamageRegion); + (*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure); + } + REGION_UNINIT(pScreen, &tmpRegion); + break; + case DamageReportBoundingBox: + tmpBox = *REGION_EXTENTS (pScreen, &pDamage->damage); + REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage, + pDamageRegion); + if (!BOX_SAME (&tmpBox, REGION_EXTENTS (pScreen, &pDamage->damage))) { + (*pDamage->damageReport) (pDamage, &pDamage->damage, + pDamage->closure); + } + break; + case DamageReportNonEmpty: + was_empty = !REGION_NOTEMPTY(pScreen, &pDamage->damage); + REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage, + pDamageRegion); + if (was_empty && REGION_NOTEMPTY(pScreen, &pDamage->damage)) { + (*pDamage->damageReport) (pDamage, &pDamage->damage, + pDamage->closure); + } + break; + case DamageReportNone: + REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage, + pDamageRegion); + break; + } +} + #if DAMAGE_DEBUG_ENABLE static void _damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, int subWindowMode, const char *where) @@ -130,9 +176,6 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, RegionRec clippedRec; RegionPtr pDamageRegion; RegionRec pixClip; - Bool was_empty; - RegionRec tmpRegion; - BoxRec tmpBox; int draw_x, draw_y; #ifdef COMPOSITE int screen_x = 0, screen_y = 0; @@ -256,41 +299,18 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, */ if (draw_x || draw_y) REGION_TRANSLATE (pScreen, pDamageRegion, -draw_x, -draw_y); - - switch (pDamage->damageLevel) { - case DamageReportRawRegion: - (*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure); - break; - case DamageReportDeltaRegion: - REGION_NULL (pScreen, &tmpRegion); - REGION_SUBTRACT (pScreen, &tmpRegion, pDamageRegion, &pDamage->damage); - if (REGION_NOTEMPTY (pScreen, &tmpRegion)) - { - REGION_UNION(pScreen, &pDamage->damage, - &pDamage->damage, pDamageRegion); - (*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure); - } - REGION_UNINIT(pScreen, &tmpRegion); - break; - case DamageReportBoundingBox: - tmpBox = *REGION_EXTENTS (pScreen, &pDamage->damage); - REGION_UNION(pScreen, &pDamage->damage, - &pDamage->damage, pDamageRegion); - if (!BOX_SAME (&tmpBox, REGION_EXTENTS (pScreen, &pDamage->damage))) - (*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure); - break; - case DamageReportNonEmpty: - was_empty = !REGION_NOTEMPTY(pScreen, &pDamage->damage); - REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage, - pDamageRegion); - if (was_empty && REGION_NOTEMPTY(pScreen, &pDamage->damage)) - (*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure); - break; - case DamageReportNone: - REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage, - pDamageRegion); - break; + + /* If the damage rec has been flagged to report damage after the op has + * completed, then union it into the delayed damage region, which will + * be used for reporting after calling down, and skip the reporting + */ + if (!pDamage->reportAfter) { + DamageReportDamage (pDamage, pDamageRegion); + } else { + REGION_UNION(pScreen, &pDamage->pendingDamage, + &pDamage->pendingDamage, pDamageRegion); } + /* * translate original region back */ @@ -305,6 +325,21 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, REGION_UNINIT (pScreen, &clippedRec); } +static void +damageReportPostOp (DrawablePtr pDrawable) +{ + drawableDamage(pDrawable); + + for (; pDamage != NULL; pDamage = pDamage->pNext) + { + if (pDamage->reportAfter) { + DamageReportDamage (pDamage, &pDamage->pendingDamage); + REGION_EMPTY (pScreen, &pDamage->pendingDamage); + } + } + +} + #if DAMAGE_DEBUG_ENABLE #define damageDamageBox(d,b,m) _damageDamageBox(d,b,m,__FUNCTION__) static void @@ -550,6 +585,7 @@ damageComposite (CARD8 op, yDst, width, height); + damageReportPostOp (pDst->pDrawable); wrap (pScrPriv, ps, Composite, damageComposite); } @@ -616,6 +652,7 @@ damageGlyphs (CARD8 op, } unwrap (pScrPriv, ps, Glyphs); (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); + damageReportPostOp (pDst->pDrawable); wrap (pScrPriv, ps, Glyphs, damageGlyphs); } #endif @@ -668,6 +705,7 @@ damageFillSpans(DrawablePtr pDrawable, (*pGC->ops->FillSpans)(pDrawable, pGC, npt, ppt, pwidth, fSorted); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -715,6 +753,7 @@ damageSetSpans(DrawablePtr pDrawable, damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->SetSpans)(pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -746,6 +785,7 @@ damagePutImage(DrawablePtr pDrawable, } (*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pImage); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -789,6 +829,7 @@ damageCopyArea(DrawablePtr pSrc, ret = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty); + damageReportPostOp (pDst); DAMAGE_GC_OP_EPILOGUE(pGC, pDst); return ret; } @@ -834,6 +875,7 @@ damageCopyPlane(DrawablePtr pSrc, ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); + damageReportPostOp (pDst); DAMAGE_GC_OP_EPILOGUE(pGC, pDst); return ret; } @@ -875,6 +917,7 @@ damagePolyPoint(DrawablePtr pDrawable, damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyPoint)(pDrawable, pGC, mode, npt, ppt); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -948,6 +991,7 @@ damagePolylines(DrawablePtr pDrawable, damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->Polylines)(pDrawable, pGC, mode, npt, ppt); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1026,6 +1070,7 @@ damagePolySegment(DrawablePtr pDrawable, damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolySegment)(pDrawable, pGC, nSeg, pSeg); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1087,6 +1132,7 @@ damagePolyRectangle(DrawablePtr pDrawable, } } (*pGC->ops->PolyRectangle)(pDrawable, pGC, nRects, pRects); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1139,6 +1185,7 @@ damagePolyArc(DrawablePtr pDrawable, damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyArc)(pDrawable, pGC, nArcs, pArcs); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1197,6 +1244,7 @@ damageFillPolygon(DrawablePtr pDrawable, } (*pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, npt, ppt); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1235,6 +1283,7 @@ damagePolyFillRect(DrawablePtr pDrawable, damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyFillRect)(pDrawable, pGC, nRects, pRects); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1276,6 +1325,7 @@ damagePolyFillArc(DrawablePtr pDrawable, damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyFillArc)(pDrawable, pGC, nArcs, pArcs); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1386,6 +1436,7 @@ damagePolyText8(DrawablePtr pDrawable, Linear8Bit, TT_POLY8); else x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; } @@ -1406,6 +1457,7 @@ damagePolyText16(DrawablePtr pDrawable, TT_POLY16); else x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; } @@ -1425,6 +1477,7 @@ damageImageText8(DrawablePtr pDrawable, Linear8Bit, TT_IMAGE8); else (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1444,6 +1497,7 @@ damageImageText16(DrawablePtr pDrawable, TT_IMAGE16); else (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1462,6 +1516,7 @@ damageImageGlyphBlt(DrawablePtr pDrawable, nglyph, ppci, TRUE, pGC->subWindowMode); (*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1479,6 +1534,7 @@ damagePolyGlyphBlt(DrawablePtr pDrawable, nglyph, ppci, FALSE, pGC->subWindowMode); (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1512,6 +1568,7 @@ damagePushPixels(GCPtr pGC, damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PushPixels)(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg); + damageReportPostOp (pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1591,10 +1648,12 @@ damagePaintWindow(WindowPtr pWindow, if(what == PW_BACKGROUND) { unwrap (pScrPriv, pScreen, PaintWindowBackground); (*pScreen->PaintWindowBackground) (pWindow, prgn, what); + damageReportPostOp (&pWindow->drawable); wrap (pScrPriv, pScreen, PaintWindowBackground, damagePaintWindow); } else { unwrap (pScrPriv, pScreen, PaintWindowBorder); (*pScreen->PaintWindowBorder) (pWindow, prgn, what); + damageReportPostOp (&pWindow->drawable); wrap (pScrPriv, pScreen, PaintWindowBorder, damagePaintWindow); } } @@ -1623,6 +1682,7 @@ damageCopyWindow(WindowPtr pWindow, } unwrap (pScrPriv, pScreen, CopyWindow); (*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc); + damageReportPostOp (&pWindow->drawable); wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow); } @@ -1654,6 +1714,7 @@ damageRestoreAreas (PixmapPtr pPixmap, unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas); (*pScreen->BackingStoreFuncs.RestoreAreas) (pPixmap, prgn, xorg, yorg, pWindow); + damageReportPostOp (&pWindow->drawable); wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas, damageRestoreAreas); } @@ -1822,12 +1883,14 @@ DamageCreate (DamageReportFunc damageReport, pDamage->pNext = 0; pDamage->pNextWin = 0; REGION_NULL(pScreen, &pDamage->damage); + REGION_NULL(pScreen, &pDamage->pendingDamage); pDamage->damageLevel = damageLevel; pDamage->isInternal = isInternal; pDamage->closure = closure; pDamage->isWindow = FALSE; pDamage->pDrawable = 0; + pDamage->reportAfter = FALSE; pDamage->damageReport = damageReport; pDamage->damageDestroy = damageDestroy; @@ -1911,6 +1974,7 @@ DamageDestroy (DamagePtr pDamage) if (pDamage->damageDestroy) (*pDamage->damageDestroy) (pDamage, pDamage->closure); REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->damage); + REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->pendingDamage); xfree (pDamage); } @@ -1964,4 +2028,16 @@ DamageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion) { damageDamageRegion (pDrawable, pRegion, FALSE, -1); + + /* Go back and report this damage for DamagePtrs with reportAfter set, since + * this call isn't part of an in-progress drawing op in the call chain and + * the DDX probably just wants to know about it right away. + */ + damageReportPostOp (pDrawable); +} + +void +DamageSetReportAfterOp (DamagePtr pDamage, Bool reportAfter) +{ + pDamage->reportAfter = reportAfter; } diff --git a/miext/damage/damage.h b/miext/damage/damage.h index c760f6bef..36a06545f 100755 --- a/miext/damage/damage.h +++ b/miext/damage/damage.h @@ -81,4 +81,7 @@ void DamageDamageRegion (DrawablePtr pDrawable, const RegionPtr pRegion); +void +DamageSetReportAfterOp (DamagePtr pDamage, Bool reportAfter); + #endif /* _DAMAGE_H_ */ diff --git a/miext/damage/damagestr.h b/miext/damage/damagestr.h index 0fe9e0ad7..93e213fd1 100755 --- a/miext/damage/damagestr.h +++ b/miext/damage/damagestr.h @@ -48,6 +48,9 @@ typedef struct _damage { DamageReportFunc damageReport; DamageDestroyFunc damageDestroy; + + Bool reportAfter; + RegionRec pendingDamage; } DamageRec; typedef struct _damageScrPriv { -- cgit v1.2.3 From f9f33b72e34eaeccea2a20f4a3dd68c2dbefc90e Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 12 Jun 2006 20:19:11 +0200 Subject: Track per-drawable damage to minimize UTS and DFS transfers. Based on work by Eric Anholt. --- exa/exa.c | 49 +++++++++--- exa/exa_accel.c | 111 ++++++++++++++++++++------ exa/exa_migration.c | 219 ++++++++++++++++++++++++++++++++++------------------ exa/exa_offscreen.c | 1 + exa/exa_priv.h | 23 +++--- exa/exa_render.c | 17 ++-- exa/exa_unaccel.c | 54 +++++++++++-- 7 files changed, 341 insertions(+), 133 deletions(-) diff --git a/exa/exa.c b/exa/exa.c index 75d5c0d69..b0c4d314e 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -122,13 +122,22 @@ exaGetDrawablePixmap(DrawablePtr pDrawable) * optimizations in pixmap migration when no changes have occurred. */ void -exaDrawableDirty (DrawablePtr pDrawable) +exaDrawableDirty (DrawablePtr pDrawable, int x1, int y1, int x2, int y2) { ExaPixmapPrivPtr pExaPixmap; + RegionPtr pDamageReg; + BoxRec box = { max(x1,0), max(y1,0), min(x2,pDrawable->width), min(y2,pDrawable->height) }; + RegionRec region; pExaPixmap = ExaGetPixmapPriv(exaGetDrawablePixmap (pDrawable)); - if (pExaPixmap != NULL) - pExaPixmap->dirty = TRUE; + if (!pExaPixmap || box.x1 >= box.x2 || box.y1 >= box.y2) + return; + + pDamageReg = DamageRegion(pExaPixmap->pDamage); + + REGION_INIT(pScreen, ®ion, &box, 1); + REGION_UNION(pScreen, pDamageReg, pDamageReg, ®ion); + REGION_UNINIT(pScreen, ®ion); } static Bool @@ -149,6 +158,7 @@ exaDestroyPixmap (PixmapPtr pPixmap) pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr; pPixmap->devKind = pExaPixmap->sys_pitch; } + REGION_UNINIT(pPixmap->drawable.pScreen, &pExaPixmap->validReg); } return fbDestroyPixmap (pPixmap); } @@ -216,7 +226,20 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth) return NULL; } - pExaPixmap->dirty = FALSE; + /* Set up damage tracking */ + pExaPixmap->pDamage = DamageCreate (NULL, NULL, DamageReportNone, TRUE, + pScreen, pPixmap); + + if (pExaPixmap->pDamage == NULL) { + fbDestroyPixmap (pPixmap); + return NULL; + } + + DamageRegister (&pPixmap->drawable, pExaPixmap->pDamage); + DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE); + + /* None of the pixmap bits are valid initially */ + REGION_NULL(pScreen, &pExaPixmap->validReg); return pPixmap; } @@ -334,8 +357,7 @@ exaPrepareAccess(DrawablePtr pDrawable, int index) /** * exaFinishAccess() is EXA's wrapper for the driver's FinishAccess() handler. * - * It deals with marking drawables as dirty, and calling the driver's - * FinishAccess() only if necessary. + * It deals with calling the driver's FinishAccess() only if necessary. */ void exaFinishAccess(DrawablePtr pDrawable, int index) @@ -345,9 +367,6 @@ exaFinishAccess(DrawablePtr pDrawable, int index) PixmapPtr pPixmap; ExaPixmapPrivPtr pExaPixmap; - if (index == EXA_PREPARE_DEST) - exaDrawableDirty (pDrawable); - pPixmap = exaGetDrawablePixmap (pDrawable); pExaPixmap = ExaGetPixmapPriv(pPixmap); @@ -373,7 +392,7 @@ exaFinishAccess(DrawablePtr pDrawable, int index) * accelerated or may sync the card and fall back to fb. */ static void -exaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) +exaValidateGC (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) { /* fbValidateGC will do direct access to pixmaps if the tiling has changed. * Preempt fbValidateGC by doing its work and masking the change out, so @@ -404,6 +423,7 @@ exaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) exaPrepareAccess(&pOldTile->drawable, EXA_PREPARE_SRC); pNewTile = fb24_32ReformatTile (pOldTile, pDrawable->bitsPerPixel); + exaDrawableDirty(&pNewTile->drawable, 0, 0, pNewTile->drawable.width, pNewTile->drawable.height); exaFinishAccess(&pOldTile->drawable, EXA_PREPARE_SRC); } if (pNewTile) @@ -419,9 +439,14 @@ exaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) if (!pGC->tileIsPixel && FbEvenTile (pGC->tile.pixmap->drawable.width * pDrawable->bitsPerPixel)) { - exaPrepareAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_SRC); + /* XXX This fixes corruption with tiled pixmaps, but may just be a + * workaround for broken drivers + */ + exaMoveOutPixmap(pGC->tile.pixmap); fbPadPixmap (pGC->tile.pixmap); - exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_SRC); + exaDrawableDirty(&pGC->tile.pixmap->drawable, 0, 0, + pGC->tile.pixmap->drawable.width, + pGC->tile.pixmap->drawable.height); } /* Mask out the GCTile change notification, now that we've done FB's * job for it. diff --git a/exa/exa_accel.c b/exa/exa_accel.c index bc77a4071..102973ac6 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -20,6 +20,11 @@ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: + * Eric Anholt + * Michel Dänzer + * */ #ifdef HAVE_DIX_CONFIG_H @@ -104,6 +109,9 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, (*pExaScr->info->Solid) (pPixmap, fullX1 + off_x, fullY1 + off_y, fullX2 + off_x, fullY1 + 1 + off_y); + exaDrawableDirty (pDrawable, + fullX1 + off_x, fullY1 + off_y, + fullX2 + off_x, fullY1 + 1 + off_y); } else { @@ -118,17 +126,20 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, partX2 = pbox->x2; if (partX2 > fullX2) partX2 = fullX2; - if (partX2 > partX1) + if (partX2 > partX1) { (*pExaScr->info->Solid) (pPixmap, partX1 + off_x, fullY1 + off_y, partX2 + off_x, fullY1 + 1 + off_y); + exaDrawableDirty (pDrawable, + partX1 + off_x, fullY1 + off_y, + partX2 + off_x, fullY1 + 1 + off_y); + } } pbox++; } } } (*pExaScr->info->DoneSolid) (pPixmap); - exaDrawableDirty (pDrawable); exaMarkSync(pScreen); } @@ -222,8 +233,8 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, exaFinishAccess(pDrawable, EXA_PREPARE_DEST); } + exaDrawableDirty(pDrawable, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff); } - exaDrawableDirty(pDrawable); return; @@ -351,11 +362,13 @@ exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, dst_off_y + pbox->y1 + i, pbox->x2 - pbox->x1, 1); } + exaDrawableDirty(pDstDrawable, + dst_off_x + pbox->x1, dst_off_y + pbox->y1, + dst_off_x + pbox->x2, dst_off_y + pbox->y2); } if (dirsetup != 0) pExaScr->info->DoneCopy(pDstPixmap); exaMarkSync(pDstDrawable->pScreen); - exaDrawableDirty(pDstDrawable); return TRUE; } @@ -423,11 +436,13 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); + exaDrawableDirty (pDstDrawable, + pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, + pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); pbox++; } (*pExaScr->info->DoneCopy) (pDstPixmap); exaMarkSync(pDstDrawable->pScreen); - exaDrawableDirty (pDstDrawable); return; } @@ -442,6 +457,13 @@ fallback: bitplane, closure); exaFinishAccess (pSrcDrawable, EXA_PREPARE_SRC); exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST); + while (nbox--) + { + exaDrawableDirty (pDstDrawable, + pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, + pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); + pbox++; + } } RegionPtr @@ -681,6 +703,9 @@ exaPolyFillRect(DrawablePtr pDrawable, (*pExaScr->info->Solid) (pPixmap, fullX1 + xoff, fullY1 + yoff, fullX2 + xoff, fullY2 + yoff); + exaDrawableDirty (pDrawable, + fullX1 + xoff, fullY1 + yoff, + fullX2 + xoff, fullY2 + yoff); } else { @@ -706,15 +731,18 @@ exaPolyFillRect(DrawablePtr pDrawable, pbox++; - if (partX1 < partX2 && partY1 < partY2) + if (partX1 < partX2 && partY1 < partY2) { (*pExaScr->info->Solid) (pPixmap, partX1 + xoff, partY1 + yoff, partX2 + xoff, partY2 + yoff); + exaDrawableDirty (pDrawable, + partX1 + xoff, partY1 + yoff, + partX2 + xoff, partY2 + yoff); + } } } } (*pExaScr->info->DoneSolid) (pPixmap); - exaDrawableDirty (pDrawable); exaMarkSync(pDrawable->pScreen); } @@ -735,11 +763,15 @@ exaSolidBoxClipped (DrawablePtr pDrawable, int xoff, yoff; int partX1, partX2, partY1, partY2; ExaMigrationRec pixmaps[1]; + Bool fallback = FALSE; pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = FALSE; pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); - + + /* We need to initialize x/yoff for tracking damage in the fallback case */ + pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); + if (pExaScr->swappedOut || pDrawable->width > pExaScr->info->maxX || pDrawable->height > pExaScr->info->maxY) @@ -750,19 +782,21 @@ exaSolidBoxClipped (DrawablePtr pDrawable, exaDoMigration (pixmaps, 1, TRUE); } - if (!(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || + pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); + + if (!pPixmap || !(*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg)) { fallback: EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable))); + fallback = TRUE; exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel); fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2, fbAnd (GXcopy, fg, pm), fbXor (GXcopy, fg, pm)); exaFinishAccess (pDrawable, EXA_PREPARE_DEST); - return; } for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); nbox--; @@ -790,12 +824,19 @@ fallback: if (partY2 <= partY1) continue; - (*pExaScr->info->Solid) (pPixmap, - partX1 + xoff, partY1 + yoff, - partX2 + xoff, partY2 + yoff); + if (!fallback) + (*pExaScr->info->Solid) (pPixmap, + partX1 + xoff, partY1 + yoff, + partX2 + xoff, partY2 + yoff); + exaDrawableDirty (pDrawable, + partX1 + xoff, partY1 + yoff, + partX2 + xoff, partY2 + yoff); } + + if (fallback) + return; + (*pExaScr->info->DoneSolid) (pPixmap); - exaDrawableDirty (pDrawable); exaMarkSync(pDrawable->pScreen); } @@ -928,6 +969,8 @@ exaImageGlyphBlt (DrawablePtr pDrawable, gStride, 0); } + exaDrawableDirty(pDrawable, gx + dstXoff, gy + dstYoff, + gx + dstXoff + gWidth, gy + dstYoff + gHeight); } x += pci->metrics.characterWidth; } @@ -994,6 +1037,8 @@ exaFillRegionSolid (DrawablePtr pDrawable, PixmapPtr pPixmap; int xoff, yoff; ExaMigrationRec pixmaps[1]; + int nbox = REGION_NUM_RECTS (pRegion); + BoxPtr pBox = REGION_RECTS (pRegion); pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = FALSE; @@ -1011,19 +1056,18 @@ exaFillRegionSolid (DrawablePtr pDrawable, if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && (*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) { - int nbox = REGION_NUM_RECTS (pRegion); - BoxPtr pBox = REGION_RECTS (pRegion); - while (nbox--) { (*pExaScr->info->Solid) (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff, pBox->x2 + xoff, pBox->y2 + yoff); + exaDrawableDirty (pDrawable, + pBox->x1 + xoff, pBox->y1 + yoff, + pBox->x2 + xoff, pBox->y2 + yoff); pBox++; } (*pExaScr->info->DoneSolid) (pPixmap); exaMarkSync(pDrawable->pScreen); - exaDrawableDirty (pDrawable); } else { @@ -1034,6 +1078,13 @@ fallback: fbFillRegionSolid (pDrawable, pRegion, 0, fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); exaFinishAccess (pDrawable, EXA_PREPARE_DEST); + while (nbox--) + { + exaDrawableDirty (pDrawable, + pBox->x1 + xoff, pBox->y1 + yoff, + pBox->x2 + xoff, pBox->y2 + yoff); + pBox++; + } } } @@ -1047,9 +1098,11 @@ exaFillRegionTiled (DrawablePtr pDrawable, { ExaScreenPriv(pDrawable->pScreen); PixmapPtr pPixmap; - int xoff, yoff; + int xoff, yoff, tileXoff, tileYoff; int tileWidth, tileHeight; ExaMigrationRec pixmaps[2]; + int nbox = REGION_NUM_RECTS (pRegion); + BoxPtr pBox = REGION_RECTS (pRegion); tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; @@ -1069,6 +1122,9 @@ exaFillRegionTiled (DrawablePtr pDrawable, pixmaps[1].as_src = TRUE; pixmaps[1].pPix = pTile; + /* We need to initialize x/yoff for tracking damage in the fallback case */ + pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); + if (pDrawable->width > pExaScr->info->maxX || pDrawable->height > pExaScr->info->maxY || tileWidth > pExaScr->info->maxX || @@ -1081,18 +1137,16 @@ exaFillRegionTiled (DrawablePtr pDrawable, } pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); + if (!pPixmap) goto fallback; if (!exaPixmapIsOffscreen(pTile)) goto fallback; - if ((*pExaScr->info->PrepareCopy) (pTile, pPixmap, 0, 0, GXcopy, + if ((*pExaScr->info->PrepareCopy) (exaGetOffscreenPixmap((DrawablePtr)pTile, &tileXoff, &tileYoff), pPixmap, 0, 0, GXcopy, FB_ALLONES)) { - int nbox = REGION_NUM_RECTS (pRegion); - BoxPtr pBox = REGION_RECTS (pRegion); - while (nbox--) { int height = pBox->y2 - pBox->y1; @@ -1118,7 +1172,7 @@ exaFillRegionTiled (DrawablePtr pDrawable, width -= w; (*pExaScr->info->Copy) (pPixmap, - tileX, tileY, + tileX + tileXoff, tileY + tileYoff, dstX + xoff, dstY + yoff, w, h); dstX += w; @@ -1127,11 +1181,12 @@ exaFillRegionTiled (DrawablePtr pDrawable, dstY += h; tileY = 0; } + exaDrawableDirty (pDrawable, pBox->x1 + xoff, pBox->y1 + yoff, + pBox->x2 + xoff, pBox->y2 + yoff); pBox++; } (*pExaScr->info->DoneCopy) (pPixmap); exaMarkSync(pDrawable->pScreen); - exaDrawableDirty (pDrawable); return; } @@ -1144,6 +1199,12 @@ fallback: fbFillRegionTiled (pDrawable, pRegion, pTile); exaFinishAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC); exaFinishAccess (pDrawable, EXA_PREPARE_DEST); + while (nbox--) + { + exaDrawableDirty (pDrawable, pBox->x1 + xoff, pBox->y1 + yoff, + pBox->x2 + xoff, pBox->y2 + yoff); + pBox++; + } } void diff --git a/exa/exa_migration.c b/exa/exa_migration.c index 57d651f80..d24a1bf98 100644 --- a/exa/exa_migration.c +++ b/exa/exa_migration.c @@ -22,6 +22,7 @@ * * Authors: * Eric Anholt + * Michel Dänzer * */ @@ -57,6 +58,27 @@ exaPixmapIsPinned (PixmapPtr pPix) return pExaPixmap == NULL || pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED; } +/** + * The fallback path for UTS/DFS failing is to just memcpy. exaCopyDirtyToSys + * and exaCopyDirtyToFb both needed to do this loop. + */ +static void +exaMemcpyBox (PixmapPtr pPixmap, BoxPtr pbox, CARD8 *src, int src_pitch, + CARD8 *dst, int dst_pitch) + { + int i, cpp = pPixmap->drawable.bitsPerPixel / 8; + int bytes = (pbox->x2 - pbox->x1) * cpp; + + src += pbox->y1 * src_pitch + pbox->x1 * cpp; + dst += pbox->y1 * dst_pitch + pbox->x1 * cpp; + + for (i = pbox->y2 - pbox->y1; i; i--) { + memcpy (dst, src, bytes); + src += src_pitch; + dst += dst_pitch; + } +} + /** * Returns TRUE if the pixmap is dirty (has been modified in its current * location compared to the other), or lacks a private for tracking @@ -67,7 +89,8 @@ exaPixmapIsDirty (PixmapPtr pPix) { ExaPixmapPriv (pPix); - return pExaPixmap == NULL || pExaPixmap->dirty == TRUE; + return pExaPixmap == NULL || + REGION_NOTEMPTY (pScreen, DamageRegion(pExaPixmap->pDamage)); } /** @@ -98,54 +121,62 @@ exaCopyDirtyToSys (PixmapPtr pPixmap) { ExaScreenPriv (pPixmap->drawable.pScreen); ExaPixmapPriv (pPixmap); + RegionPtr pRegion = DamageRegion (pExaPixmap->pDamage); CARD8 *save_ptr; int save_pitch; - - if (!pExaPixmap->dirty) - return; + BoxPtr pBox = REGION_RECTS(pRegion); + int nbox = REGION_NUM_RECTS(pRegion); + Bool do_sync = FALSE; save_ptr = pPixmap->devPrivate.ptr; save_pitch = pPixmap->devKind; pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr; pPixmap->devKind = pExaPixmap->fb_pitch; - if (pExaScr->info->DownloadFromScreen == NULL || - !pExaScr->info->DownloadFromScreen (pPixmap, - 0, - 0, - pPixmap->drawable.width, - pPixmap->drawable.height, - pExaPixmap->sys_ptr, - pExaPixmap->sys_pitch)) - { - char *src, *dst; - int src_pitch, dst_pitch, i, bytes; - - exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC); - - dst = pExaPixmap->sys_ptr; - dst_pitch = pExaPixmap->sys_pitch; - src = pExaPixmap->fb_ptr; - src_pitch = pExaPixmap->fb_pitch; - bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; - - for (i = 0; i < pPixmap->drawable.height; i++) { - memcpy (dst, src, bytes); - dst += dst_pitch; - src += src_pitch; + while (nbox--) { + pBox->x1 = max(pBox->x1, 0); + pBox->y1 = max(pBox->y1, 0); + pBox->x2 = min(pBox->x2, pPixmap->drawable.width); + pBox->y2 = min(pBox->y2, pPixmap->drawable.height); + + if (pBox->x1 >= pBox->x2 || pBox->y1 >= pBox->y2) + continue; + + if (pExaScr->info->DownloadFromScreen == NULL || + !pExaScr->info->DownloadFromScreen (pPixmap, + pBox->x1, pBox->y1, + pBox->x2 - pBox->x1, + pBox->y2 - pBox->y1, + pExaPixmap->sys_ptr + + pBox->y1 * pExaPixmap->sys_pitch + + pBox->x1 * pPixmap->drawable.bitsPerPixel / 8, + pExaPixmap->sys_pitch)) + { + exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC); + exaMemcpyBox (pPixmap, pBox, + pExaPixmap->fb_ptr, pExaPixmap->fb_pitch, + pExaPixmap->sys_ptr, pExaPixmap->sys_pitch); + exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC); } - exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC); + else + do_sync = TRUE; + + pBox++; } /* Make sure the bits have actually landed, since we don't necessarily sync * when accessing pixmaps in system memory. */ - exaWaitSync (pPixmap->drawable.pScreen); + if (do_sync) + exaWaitSync (pPixmap->drawable.pScreen); pPixmap->devPrivate.ptr = save_ptr; pPixmap->devKind = save_pitch; - pExaPixmap->dirty = FALSE; + /* The previously damaged bits are now no longer damaged but valid */ + REGION_UNION(pPixmap->drawable.pScreen, + &pExaPixmap->validReg, &pExaPixmap->validReg, pRegion); + DamageEmpty (pExaPixmap->pDamage); } /** @@ -158,49 +189,59 @@ exaCopyDirtyToFb (PixmapPtr pPixmap) { ExaScreenPriv (pPixmap->drawable.pScreen); ExaPixmapPriv (pPixmap); + RegionPtr pRegion = DamageRegion (pExaPixmap->pDamage); CARD8 *save_ptr; int save_pitch; - - if (!pExaPixmap->dirty) - return; + BoxPtr pBox = REGION_RECTS(pRegion); + int nbox = REGION_NUM_RECTS(pRegion); + Bool do_sync = FALSE; save_ptr = pPixmap->devPrivate.ptr; save_pitch = pPixmap->devKind; pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr; pPixmap->devKind = pExaPixmap->fb_pitch; - if (pExaScr->info->UploadToScreen == NULL || - !pExaScr->info->UploadToScreen (pPixmap, - 0, - 0, - pPixmap->drawable.width, - pPixmap->drawable.height, - pExaPixmap->sys_ptr, - pExaPixmap->sys_pitch)) - { - char *src, *dst; - int src_pitch, dst_pitch, i, bytes; - - exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_DEST); - - dst = pExaPixmap->fb_ptr; - dst_pitch = pExaPixmap->fb_pitch; - src = pExaPixmap->sys_ptr; - src_pitch = pExaPixmap->sys_pitch; - bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; - - for (i = 0; i < pPixmap->drawable.height; i++) { - memcpy (dst, src, bytes); - dst += dst_pitch; - src += src_pitch; + while (nbox--) { + pBox->x1 = max(pBox->x1, 0); + pBox->y1 = max(pBox->y1, 0); + pBox->x2 = min(pBox->x2, pPixmap->drawable.width); + pBox->y2 = min(pBox->y2, pPixmap->drawable.height); + + if (pBox->x1 >= pBox->x2 || pBox->y1 >= pBox->y2) + continue; + + if (pExaScr->info->UploadToScreen == NULL || + !pExaScr->info->UploadToScreen (pPixmap, + pBox->x1, pBox->y1, + pBox->x2 - pBox->x1, + pBox->y2 - pBox->y1, + pExaPixmap->sys_ptr + + pBox->y1 * pExaPixmap->sys_pitch + + pBox->x1 * pPixmap->drawable.bitsPerPixel / 8, + pExaPixmap->sys_pitch)) + { + exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_DEST); + exaMemcpyBox (pPixmap, pBox, + pExaPixmap->sys_ptr, pExaPixmap->sys_pitch, + pExaPixmap->fb_ptr, pExaPixmap->fb_pitch); + exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_DEST); } - exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_DEST); + else + do_sync = TRUE; + + pBox++; } + if (do_sync) + exaMarkSync (pPixmap->drawable.pScreen); + pPixmap->devPrivate.ptr = save_ptr; pPixmap->devKind = save_pitch; - pExaPixmap->dirty = FALSE; + /* The previously damaged bits are now no longer damaged but valid */ + REGION_UNION(pPixmap->drawable.pScreen, + &pExaPixmap->validReg, &pExaPixmap->validReg, pRegion); + DamageEmpty (pExaPixmap->pDamage); } /** @@ -213,6 +254,7 @@ exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area) { PixmapPtr pPixmap = area->privData; ExaPixmapPriv(pPixmap); + RegionPtr pDamageReg = DamageRegion(pExaPixmap->pDamage); DBG_MIGRATE (("Save %p (%p) (%dx%d) (%c)\n", pPixmap, (void*)(ExaGetPixmapPriv(pPixmap)->area ? @@ -231,10 +273,9 @@ exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area) pExaPixmap->fb_ptr = NULL; pExaPixmap->area = NULL; - /* Mark it dirty now, to say that there is important data in the - * system-memory copy. - */ - pExaPixmap->dirty = TRUE; + /* Mark all valid bits as damaged, so they'll get copied to FB next time */ + REGION_UNION(pPixmap->drawable.pScreen, pDamageReg, pDamageReg, + &pExaPixmap->validReg); } /** @@ -413,30 +454,57 @@ exaMigrateTowardSys (PixmapPtr pPixmap) * If the pixmap has both a framebuffer and system memory copy, this function * asserts that both of them are the same. */ -static void +static Bool exaAssertNotDirty (PixmapPtr pPixmap) { ExaPixmapPriv (pPixmap); CARD8 *dst, *src; - int dst_pitch, src_pitch, data_row_bytes, y; + RegionPtr pValidReg = &pExaPixmap->validReg; + int dst_pitch, src_pitch, cpp, y, nbox = REGION_NUM_RECTS(pValidReg); + BoxPtr pBox = REGION_RECTS(pValidReg); + Bool ret = TRUE; if (pExaPixmap == NULL || pExaPixmap->fb_ptr == NULL) - return; + return ret; dst = pExaPixmap->sys_ptr; dst_pitch = pExaPixmap->sys_pitch; src = pExaPixmap->fb_ptr; src_pitch = pExaPixmap->fb_pitch; - data_row_bytes = pPixmap->drawable.width * - pPixmap->drawable.bitsPerPixel / 8; + cpp = pPixmap->drawable.bitsPerPixel / 8; exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC); - for (y = 0; y < pPixmap->drawable.height; y++) { - if (memcmp(dst, src, data_row_bytes) != 0) { - abort(); - } + while (nbox--) { + int rowbytes; + + pBox->x1 = max(pBox->x1, 0); + pBox->y1 = max(pBox->y1, 0); + pBox->x2 = min(pBox->x2, pPixmap->drawable.width); + pBox->y2 = min(pBox->y2, pPixmap->drawable.height); + + if (pBox->x1 >= pBox->x2 || pBox->y1 >= pBox->y2) + continue; + + rowbytes = (pBox->x2 - pBox->x1) * cpp; + src += pBox->y1 * src_pitch + pBox->x1 * cpp; + dst += pBox->y1 * dst_pitch + pBox->x1 * cpp; + + for (y = pBox->y2 - pBox->y1; y; y--) { + if (memcmp(dst + pBox->y1 * dst_pitch + pBox->x1 * cpp, + src + pBox->y1 * src_pitch + pBox->x1 * cpp, + (pBox->x2 - pBox->x1) * cpp) != 0) { + ret = FALSE; + break; + } + src += src_pitch; + dst += dst_pitch; + } + src -= pBox->y1 * src_pitch + pBox->x1 * cpp; + dst -= pBox->y1 * dst_pitch + pBox->x1 * cpp; } exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC); + + return ret; } /** @@ -460,8 +528,9 @@ exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel) */ if (pExaScr->checkDirtyCorrectness) { for (i = 0; i < npixmaps; i++) { - if (!exaPixmapIsDirty (pixmaps[i].pPix)) - exaAssertNotDirty (pixmaps[i].pPix); + if (!exaPixmapIsDirty (pixmaps[i].pPix) && + !exaAssertNotDirty (pixmaps[i].pPix)) + ErrorF("%s: Pixmap %d dirty but not marked as such!\n", __func__, i); } } /* If anything is pinned in system memory, we won't be able to diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c index b55802e1e..d5864dc57 100644 --- a/exa/exa_offscreen.c +++ b/exa/exa_offscreen.c @@ -390,6 +390,7 @@ ExaOffscreenMarkUsed (PixmapPtr pPixmap) if (area->state == ExaOffscreenRemovable) area->score = (area->score * 7) / 8; } + iter = 0; } } diff --git a/exa/exa_priv.h b/exa/exa_priv.h index 90af55335..c725b4da0 100644 --- a/exa/exa_priv.h +++ b/exa/exa_priv.h @@ -51,6 +51,7 @@ #ifdef RENDER #include "fbpict.h" #endif +#include "damage.h" #define DEBUG_TRACE_FALL 0 #define DEBUG_MIGRATE 0 @@ -168,16 +169,16 @@ typedef struct { unsigned int fb_size; /**< size of pixmap in framebuffer memory */ /** - * If area is NULL, then dirty == TRUE means that the pixmap has been - * modified, so the contents are defined. Used to avoid uploads of - * undefined data. - * - * If area is non-NULL, then dirty == TRUE means that the pixmap data at - * pPixmap->devPrivate.ptr (either fb_ptr or sys_ptr) has been changed - * compared to the copy in the other location. This is used to avoid - * uploads/downloads of unmodified data. + * The damage record contains the areas of the pixmap's current location + * (framebuffer or system) that have been damaged compared to the other + * location. */ - Bool dirty; + DamagePtr pDamage; + /** + * The valid region marks the valid bits of a drawable (at least, as it's + * derived from damage, which may be overreported). + */ + RegionRec validReg; } ExaPixmapPrivRec, *ExaPixmapPrivPtr; typedef struct _ExaMigrationRec { @@ -323,7 +324,7 @@ ExaCheckComposite (CARD8 op, CARD16 height); #endif -/* exaoffscreen.c */ +/* exa_offscreen.c */ void ExaOffscreenMarkUsed (PixmapPtr pPixmap); @@ -347,7 +348,7 @@ void exaFinishAccess(DrawablePtr pDrawable, int index); void -exaDrawableDirty(DrawablePtr pDrawable); +exaDrawableDirty(DrawablePtr pDrawable, int x1, int y1, int x2, int y2); Bool exaDrawableIsOffscreen (DrawablePtr pDrawable); diff --git a/exa/exa_render.c b/exa/exa_render.c index 26b29ab04..790a359a3 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -298,12 +298,13 @@ exaTryDriverSolidFill(PicturePtr pSrc, (*pExaScr->info->Solid) (pDstPix, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); + exaDrawableDirty (pDst->pDrawable, + pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, + pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); pbox++; } - (*pExaScr->info->DoneSolid) (pDstPix); exaMarkSync(pDst->pDrawable->pScreen); - exaDrawableDirty (pDst->pDrawable); REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); return 1; @@ -437,12 +438,13 @@ exaTryDriverComposite(CARD8 op, pbox->y1 + dst_off_y, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); + exaDrawableDirty (pDst->pDrawable, + pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, + pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); pbox++; } - (*pExaScr->info->DoneComposite) (pDstPix); exaMarkSync(pDst->pDrawable->pScreen); - exaDrawableDirty (pDst->pDrawable); REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); return 1; @@ -648,6 +650,8 @@ exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap, exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST); fbRasterizeTrapezoid(pPicture, trap, x_off, y_off); + exaDrawableDirty(pPicture->pDrawable, 0, 0, + pPicture->pDrawable->width, pPicture->pDrawable->height); exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST); } @@ -669,6 +673,8 @@ exaAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri, exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST); fbAddTriangles(pPicture, x_off, y_off, ntri, tris); exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST); + exaDrawableDirty(pPicture->pDrawable, 0, 0, + pPicture->pDrawable->width, pPicture->pDrawable->height); } /** @@ -958,7 +964,8 @@ exaGlyphs (CARD8 op, exaCopyArea (&pScratchPixmap->drawable, &pPixmap->drawable, pGC, 0, 0, glyph->info.width, glyph->info.height, 0, 0); } else { - exaDrawableDirty (&pPixmap->drawable); + exaDrawableDirty (&pPixmap->drawable, 0, 0, + glyph->info.width, glyph->info.height); } if (maskFormat) diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c index f9df6adc4..a30911507 100644 --- a/exa/exa_unaccel.c +++ b/exa/exa_unaccel.c @@ -23,6 +23,26 @@ #include "exa_priv.h" +#define TRIM_BOX(box, pGC) if (pGC->pCompositeClip) { \ + BoxPtr extents = &pGC->pCompositeClip->extents;\ + if(box.x1 < extents->x1) box.x1 = extents->x1; \ + if(box.x2 > extents->x2) box.x2 = extents->x2; \ + if(box.y1 < extents->y1) box.y1 = extents->y1; \ + if(box.y2 > extents->y2) box.y2 = extents->y2; \ + } + +#define TRANSLATE_BOX(box, pDrawable) { \ + box.x1 += pDrawable->x; \ + box.x2 += pDrawable->x; \ + box.y1 += pDrawable->y; \ + box.y2 += pDrawable->y; \ + } + +#define TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC) { \ + TRANSLATE_BOX(box, pDrawable); \ + TRIM_BOX(box, pGC); \ + } + /* * These functions wrap the low-level fb rendering functions and * synchronize framebuffer/accelerated drawing by stalling until @@ -200,11 +220,35 @@ ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, int nrect, xRectangle *prect) { EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable))); - exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); - exaPrepareAccessGC (pGC); - fbPolyFillRect (pDrawable, pGC, nrect, prect); - exaFinishAccessGC (pGC); - exaFinishAccess (pDrawable, EXA_PREPARE_DEST); + + if (nrect) { + BoxRec box = { .x1 = max(prect->x,0), + .x2 = min(prect->x + prect->width,pDrawable->width), + .y1 = max(prect->y,0), + .y2 = min(prect->y + prect->height,pDrawable->height) }; + + exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); + exaPrepareAccessGC (pGC); + fbPolyFillRect (pDrawable, pGC, nrect, prect); + exaFinishAccessGC (pGC); + exaFinishAccess (pDrawable, EXA_PREPARE_DEST); + + /* Only track bounding box of damage, as this path can degenerate to + * zillions of damage boxes + */ + while (--nrect) + { + prect++; + box.x1 = min(box.x1, prect->x); + box.x2 = max(box.x2, prect->x + prect->width); + box.y1 = min(box.y1, prect->y); + box.y2 = max(box.y2, prect->y + prect->height); + } + + TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); + + exaDrawableDirty (pDrawable, box.x1, box.x2, box.y1, box.y2); + } } void -- cgit v1.2.3 From 7e4717683d6c08d1e490a60b7493a94bbc57bf8d Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sun, 15 Oct 2006 18:12:28 +0200 Subject: exaDrawableDirty: Fix initialization of BoxRec. This will hopefully fix the partial window corruption experienced by some people. --- exa/exa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exa/exa.c b/exa/exa.c index b0c4d314e..3e6ac76dc 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -126,7 +126,8 @@ exaDrawableDirty (DrawablePtr pDrawable, int x1, int y1, int x2, int y2) { ExaPixmapPrivPtr pExaPixmap; RegionPtr pDamageReg; - BoxRec box = { max(x1,0), max(y1,0), min(x2,pDrawable->width), min(y2,pDrawable->height) }; + BoxRec box = { .x1 = max(x1,0), .x2 = min(x2,pDrawable->width), + .y1 = max(y1,0), .y2 = min(y2,pDrawable->height) }; RegionRec region; pExaPixmap = ExaGetPixmapPriv(exaGetDrawablePixmap (pDrawable)); -- cgit v1.2.3 From fb8364bca30fe9268e807b0a9a3ebf875ee1fce2 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 10 Dec 2006 11:24:05 -0500 Subject: Accept EDID > 1.3 but < 2.0 if we find it, assume it's compatible. --- hw/xfree86/ddc/ddcProperty.c | 3 --- hw/xfree86/ddc/interpret_edid.c | 12 +++++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c index 11b5e26ed..13083dd50 100644 --- a/hw/xfree86/ddc/ddcProperty.c +++ b/hw/xfree86/ddc/ddcProperty.c @@ -32,9 +32,6 @@ #include "propertyst.h" #include "xf86DDC.h" - - - #define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA" #define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA" #define VDIF_ATOM_NAME "XFree86_DDC_VDIF_RAWDATA" diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c index c58bb2fe1..7b4b2b9ec 100644 --- a/hw/xfree86/ddc/interpret_edid.c +++ b/hw/xfree86/ddc/interpret_edid.c @@ -304,16 +304,18 @@ get_detailed_timing_section(Uchar *c, struct detailed_timings *r) r->misc = MISC; } +#define MAX_EDID_MINOR 3 static Bool validate_version(int scrnIndex, struct edid_version *r) { if (r->version != 1) return FALSE; - if (r->revision > 3) { - xf86DrvMsg(scrnIndex, X_ERROR,"EDID Version 1.%i not yet supported\n", - r->revision); - return FALSE; - } + + if (r->revision > MAX_EDID_MINOR) + xf86DrvMsg(scrnIndex, X_WARNING, + "Assuming version 1.%d is compatible with 1.%d\n", + r->revision, MAX_EDID_MINOR); + return TRUE; } -- cgit v1.2.3 From 27d4b84f268ac21601f7f52a7e257f70753396b3 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Mon, 11 Dec 2006 14:50:08 +0000 Subject: Fix Tooltip from minimized clients Bug #3678 (Colin Harrison) --- hw/xwin/winmultiwindowwindow.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index dc8e38bae..037c881b4 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -982,11 +982,10 @@ winAdjustXWindow (WindowPtr pWin, HWND hwnd) /* * If the Windows window is minimized, its WindowRect has * meaningless values so we don't adjust X window to it. - * Instead we put the X window to the bottom in Z order to - * be obscured by other windows. */ - vlist[0] = Below; - return ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin)); + vlist[0] = 0; + vlist[1] = 0; + return ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin)); } pDraw = &pWin->drawable; -- cgit v1.2.3 From 792e0f71c6a435b2e28f8a4cdcc790f3b982e62c Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Mon, 11 Dec 2006 14:54:49 +0000 Subject: Fix Xming fails to use xkb bug bug #5049 (Colin Harrison) --- hw/xwin/InitOutput.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index b64eee9c7..996498090 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -694,6 +694,7 @@ winFixupPaths (void) if (sizeof(xkbbasedir) > 0) xkbbasedir[sizeof(xkbbasedir)-1] = 0; XkbBaseDirectory = xkbbasedir; + XkbBinDirectory = xkbbasedir } #endif /* XKB */ #endif /* RELOCATE_PROJECTROOT */ -- cgit v1.2.3 From 81281cb298a5825bc7a2e692375a86199293bbbe Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Tue, 12 Dec 2006 11:28:24 +0000 Subject: Fix bad commit --- hw/xwin/InitOutput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 996498090..39a5eda7f 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -694,7 +694,7 @@ winFixupPaths (void) if (sizeof(xkbbasedir) > 0) xkbbasedir[sizeof(xkbbasedir)-1] = 0; XkbBaseDirectory = xkbbasedir; - XkbBinDirectory = xkbbasedir + XkbBinDirectory = basedir; } #endif /* XKB */ #endif /* RELOCATE_PROJECTROOT */ -- cgit v1.2.3 From b88ad820fac81d0dfd557a384bf0406e8893e7af Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Wed, 13 Dec 2006 12:13:11 +0000 Subject: Set Int10Current->Tag for the linux native int10 module Fixes bug #9296 (cherry picked from 731952c561a3972d09d1315f4fd31466e459ccb9 commit) --- hw/xfree86/int10/generic.c | 2 +- hw/xfree86/os-support/linux/int10/linux.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index 46a1179de..d86372780 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -98,7 +98,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS); pvp = xf86GetPciInfoForEntity(entityIndex); - if (pvp) pInt->Tag = ((pciConfigPtr)(pvp->thisCard))->tag; + if (pvp) pInt->Tag = pciTag(pvp->bus, pvp->device, pvp->func); /* * we need to map video RAM MMIO as some chipsets map mmio diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c index 6c8b230e7..dd1637a23 100644 --- a/hw/xfree86/os-support/linux/int10/linux.c +++ b/hw/xfree86/os-support/linux/int10/linux.c @@ -90,6 +90,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) legacyVGARec vga; xf86int10BiosLocation bios; Bool videoBiosMapped = FALSE; + pciVideoPtr pvp; if (int10Generation != serverGeneration) { counter = 0; @@ -151,6 +152,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec)); pInt->scrnIndex = screen; pInt->entityIndex = entityIndex; + pvp = xf86GetPciInfoForEntity(entityIndex); + if (pvp) pInt->Tag = pciTag(pvp->bus, pvp->device, pvp->func); if (!xf86Int10ExecSetup(pInt)) goto error0; pInt->mem = &linuxMem; -- cgit v1.2.3 From 6c46645cfc1afda8aeabfe0ed4d9342673b702f1 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 14 Dec 2006 14:45:42 -0500 Subject: Naming change: Security*Access -> Dix*Access --- Xext/appgroup.c | 4 +- Xext/cup.c | 2 +- Xext/panoramiXprocs.c | 172 ++++++++++++++++++++-------------------- Xext/saver.c | 10 +-- Xext/security.c | 12 +-- Xext/shape.c | 22 ++--- Xext/shm.c | 6 +- Xext/sync.c | 16 ++-- Xext/xf86bigfont.c | 4 +- Xext/xprint.c | 26 +++--- Xext/xvdisp.c | 30 +++---- damageext/damageext.c | 10 +-- dbe/dbe.c | 12 +-- dix/colormap.c | 4 +- dix/cursor.c | 4 +- dix/dispatch.c | 118 +++++++++++++-------------- dix/dixfonts.c | 8 +- dix/dixutils.c | 6 +- dix/events.c | 38 ++++----- dix/gc.c | 8 +- dix/property.c | 20 ++--- dix/resource.c | 4 +- dix/window.c | 10 +-- hw/darwin/quartz/applewm.c | 6 +- hw/darwin/quartz/xpr/appledri.c | 4 +- hw/dmx/dmx.c | 12 +-- hw/dmx/dmxpict.c | 24 +++--- hw/dmx/glxProxy/glxcmds.c | 24 +++--- hw/xfree86/dri/xf86dri.c | 6 +- hw/xwin/winclipboardwrappers.c | 2 +- hw/xwin/winwindowswm.c | 6 +- include/dix.h | 10 +-- include/resource.h | 9 ++- os/access.c | 2 +- randr/rrcrtc.c | 8 +- randr/rrdispatch.c | 4 +- randr/rroutput.c | 2 +- randr/rrproperty.c | 14 ++-- randr/rrscreen.c | 10 +-- render/picture.c | 4 +- render/render.c | 122 ++++++++++++++-------------- xfixes/cursor.c | 12 +-- xfixes/region.c | 46 +++++------ xfixes/saveset.c | 2 +- xfixes/select.c | 2 +- 45 files changed, 439 insertions(+), 438 deletions(-) diff --git a/Xext/appgroup.c b/Xext/appgroup.c index 650dc0ab8..4f3000569 100644 --- a/Xext/appgroup.c +++ b/Xext/appgroup.c @@ -432,7 +432,7 @@ int ProcXagDestroy( REQUEST_SIZE_MATCH (xXagDestroyReq); pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client, - (XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess); + (XID)stuff->app_group, RT_APPGROUP, DixReadAccess); if (!pAppGrp) return XagBadAppGroup; FreeResource ((XID)stuff->app_group, RT_NONE); if (--XagCallbackRefCount == 0) @@ -451,7 +451,7 @@ int ProcXagGetAttr( REQUEST_SIZE_MATCH (xXagGetAttrReq); pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client, - (XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess); + (XID)stuff->app_group, RT_APPGROUP, DixReadAccess); if (!pAppGrp) return XagBadAppGroup; rep.type = X_Reply; rep.length = 0; diff --git a/Xext/cup.c b/Xext/cup.c index 10d13bae0..6bfa27837 100644 --- a/Xext/cup.c +++ b/Xext/cup.c @@ -227,7 +227,7 @@ int ProcStoreColors( REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq); pcmp = (ColormapPtr) SecurityLookupIDByType (client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); + RT_COLORMAP, DixWriteAccess); if (pcmp) { int ncolors, n; diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 8bb4c593d..683308425 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -91,7 +91,7 @@ int PanoramiXCreateWindow(ClientPtr client) return BadLength; if (!(parent = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->parent, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->parent, XRT_WINDOW, DixWriteAccess))) return BadWindow; if(stuff->class == CopyFromParent) @@ -105,7 +105,7 @@ int PanoramiXCreateWindow(ClientPtr client) tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -114,7 +114,7 @@ int PanoramiXCreateWindow(ClientPtr client) tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -123,7 +123,7 @@ int PanoramiXCreateWindow(ClientPtr client) tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_COLORMAP, SecurityReadAccess))) + client, tmp, XRT_COLORMAP, DixReadAccess))) return BadColor; } } @@ -192,7 +192,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) return BadLength; if (!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->window, XRT_WINDOW, DixWriteAccess))) return BadWindow; if((win->u.win.class == InputOnly) && @@ -204,7 +204,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -213,7 +213,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -222,7 +222,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_COLORMAP, SecurityReadAccess))) + client, tmp, XRT_COLORMAP, DixReadAccess))) return BadColor; } } @@ -251,7 +251,7 @@ int PanoramiXDestroyWindow(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityDestroyAccess))) + client, stuff->id, XRT_WINDOW, DixDestroyAccess))) return BadWindow; FOR_NSCREENS_BACKWARD(j) { @@ -276,7 +276,7 @@ int PanoramiXDestroySubwindows(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityDestroyAccess))) + client, stuff->id, XRT_WINDOW, DixDestroyAccess))) return BadWindow; FOR_NSCREENS_BACKWARD(j) { @@ -301,7 +301,7 @@ int PanoramiXChangeSaveSet(ClientPtr client) REQUEST_SIZE_MATCH(xChangeSaveSetReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityReadAccess))) + client, stuff->window, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS_BACKWARD(j) { @@ -325,11 +325,11 @@ int PanoramiXReparentWindow(ClientPtr client) REQUEST_SIZE_MATCH(xReparentWindowReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->window, XRT_WINDOW, DixWriteAccess))) return BadWindow; if(!(parent = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->parent, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->parent, XRT_WINDOW, DixWriteAccess))) return BadWindow; x = stuff->x; @@ -360,7 +360,7 @@ int PanoramiXMapWindow(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityReadAccess))) + client, stuff->id, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS_FORWARD(j) { @@ -382,7 +382,7 @@ int PanoramiXMapSubwindows(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityReadAccess))) + client, stuff->id, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS_FORWARD(j) { @@ -404,7 +404,7 @@ int PanoramiXUnmapWindow(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityReadAccess))) + client, stuff->id, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS_FORWARD(j) { @@ -426,7 +426,7 @@ int PanoramiXUnmapSubwindows(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityReadAccess))) + client, stuff->id, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS_FORWARD(j) { @@ -457,11 +457,11 @@ int PanoramiXConfigureWindow(ClientPtr client) /* because we need the parent */ if (!(pWin = (WindowPtr)SecurityLookupIDByType( - client, stuff->window, RT_WINDOW, SecurityWriteAccess))) + client, stuff->window, RT_WINDOW, DixWriteAccess))) return BadWindow; if (!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->window, XRT_WINDOW, DixWriteAccess))) return BadWindow; if ((Mask)stuff->mask & CWSibling) { @@ -469,7 +469,7 @@ int PanoramiXConfigureWindow(ClientPtr client) sib_offset = Ones((Mask)stuff->mask & (CWSibling - 1)); if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) { if(!(sib = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_WINDOW, SecurityReadAccess))) + client, tmp, XRT_WINDOW, DixReadAccess))) return BadWindow; } } @@ -514,7 +514,7 @@ int PanoramiXCirculateWindow(ClientPtr client) REQUEST_SIZE_MATCH(xCirculateWindowReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->window, XRT_WINDOW, DixWriteAccess))) return BadWindow; FOR_NSCREENS_FORWARD(j) { @@ -579,11 +579,11 @@ int PanoramiXTranslateCoords(ClientPtr client) REQUEST_SIZE_MATCH(xTranslateCoordsReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, - SecurityReadAccess); + DixReadAccess); if (!pDst) return(BadWindow); rep.type = X_Reply; @@ -655,7 +655,7 @@ int PanoramiXCreatePixmap(ClientPtr client) client->errorValue = stuff->pid; if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixReadAccess))) return BadDrawable; if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) @@ -694,7 +694,7 @@ int PanoramiXFreePixmap(ClientPtr client) client->errorValue = stuff->id; if(!(pix = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_PIXMAP, SecurityDestroyAccess))) + client, stuff->id, XRT_PIXMAP, DixDestroyAccess))) return BadPixmap; FOR_NSCREENS_BACKWARD(j) { @@ -730,14 +730,14 @@ int PanoramiXCreateGC(ClientPtr client) return BadLength; if (!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixReadAccess))) return BadDrawable; if ((Mask)stuff->mask & GCTile) { tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) { if(!(tile = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -745,7 +745,7 @@ int PanoramiXCreateGC(ClientPtr client) stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1)); if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) { if(!(stip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -753,7 +753,7 @@ int PanoramiXCreateGC(ClientPtr client) clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1)); if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) { if(!(clip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -805,14 +805,14 @@ int PanoramiXChangeGC(ClientPtr client) return BadLength; if (!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if ((Mask)stuff->mask & GCTile) { tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) { if(!(tile = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -820,7 +820,7 @@ int PanoramiXChangeGC(ClientPtr client) stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1)); if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) { if(!(stip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -828,7 +828,7 @@ int PanoramiXChangeGC(ClientPtr client) clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1)); if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) { if(!(clip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -859,11 +859,11 @@ int PanoramiXCopyGC(ClientPtr client) REQUEST_SIZE_MATCH(xCopyGCReq); if(!(srcGC = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->srcGC, XRT_GC, SecurityReadAccess))) + client, stuff->srcGC, XRT_GC, DixReadAccess))) return BadGC; if(!(dstGC = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dstGC, XRT_GC, SecurityWriteAccess))) + client, stuff->dstGC, XRT_GC, DixWriteAccess))) return BadGC; FOR_NSCREENS(j) { @@ -886,7 +886,7 @@ int PanoramiXSetDashes(ClientPtr client) REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityWriteAccess))) + client, stuff->gc, XRT_GC, DixWriteAccess))) return BadGC; FOR_NSCREENS_BACKWARD(j) { @@ -908,7 +908,7 @@ int PanoramiXSetClipRectangles(ClientPtr client) REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityWriteAccess))) + client, stuff->gc, XRT_GC, DixWriteAccess))) return BadGC; FOR_NSCREENS_BACKWARD(j) { @@ -930,7 +930,7 @@ int PanoramiXFreeGC(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_GC, SecurityDestroyAccess))) + client, stuff->id, XRT_GC, DixDestroyAccess))) return BadGC; FOR_NSCREENS_BACKWARD(j) { @@ -956,7 +956,7 @@ int PanoramiXClearToBackground(ClientPtr client) REQUEST_SIZE_MATCH(xClearAreaReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->window, XRT_WINDOW, DixWriteAccess))) return BadWindow; x = stuff->x; @@ -998,13 +998,13 @@ int PanoramiXCopyArea(ClientPtr client) REQUEST_SIZE_MATCH(xCopyAreaReq); if(!(src = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess))) + client, stuff->srcDrawable, XRC_DRAWABLE, DixReadAccess))) return BadDrawable; srcShared = IS_SHARED_PIXMAP(src); if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->dstDrawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; dstShared = IS_SHARED_PIXMAP(dst); @@ -1013,7 +1013,7 @@ int PanoramiXCopyArea(ClientPtr client) return (* SavedProcVector[X_CopyArea])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if((dst->type == XRT_WINDOW) && dst->u.win.root) @@ -1082,7 +1082,7 @@ int PanoramiXCopyArea(ClientPtr client) VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client, - SecurityReadAccess); + DixReadAccess); if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) { client->errorValue = stuff->dstDrawable; @@ -1146,13 +1146,13 @@ int PanoramiXCopyPlane(ClientPtr client) REQUEST_SIZE_MATCH(xCopyPlaneReq); if(!(src = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess))) + client, stuff->srcDrawable, XRC_DRAWABLE, DixReadAccess))) return BadDrawable; srcShared = IS_SHARED_PIXMAP(src); if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->dstDrawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; dstShared = IS_SHARED_PIXMAP(dst); @@ -1161,7 +1161,7 @@ int PanoramiXCopyPlane(ClientPtr client) return (* SavedProcVector[X_CopyPlane])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if((dst->type == XRT_WINDOW) && dst->u.win.root) @@ -1188,7 +1188,7 @@ int PanoramiXCopyPlane(ClientPtr client) VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client, - SecurityReadAccess); + DixReadAccess); if (pdstDraw->pScreen != psrcDraw->pScreen) { client->errorValue = stuff->dstDrawable; return (BadMatch); @@ -1246,14 +1246,14 @@ int PanoramiXPolyPoint(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyPointReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyPoint])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1304,14 +1304,14 @@ int PanoramiXPolyLine(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyLineReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyLine])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1362,14 +1362,14 @@ int PanoramiXPolySegment(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolySegmentReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolySegment])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1424,14 +1424,14 @@ int PanoramiXPolyRectangle(ClientPtr client) if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyRectangle])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1484,14 +1484,14 @@ int PanoramiXPolyArc(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyArcReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyArc])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1542,14 +1542,14 @@ int PanoramiXFillPoly(ClientPtr client) REQUEST_AT_LEAST_SIZE(xFillPolyReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_FillPoly])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1601,14 +1601,14 @@ int PanoramiXPolyFillRectangle(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyFillRectangle])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1660,14 +1660,14 @@ int PanoramiXPolyFillArc(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyFillArc])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1718,14 +1718,14 @@ int PanoramiXPutImage(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPutImageReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PutImage])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1769,7 +1769,7 @@ int PanoramiXGetImage(ClientPtr client) } if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(draw->type == XRT_PIXMAP) @@ -1909,14 +1909,14 @@ PanoramiXPolyText8(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyTextReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyText8])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1948,14 +1948,14 @@ PanoramiXPolyText16(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyTextReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyText16])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1987,14 +1987,14 @@ int PanoramiXImageText8(ClientPtr client) REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_ImageText8])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2026,14 +2026,14 @@ int PanoramiXImageText16(ClientPtr client) REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_ImageText16])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2064,7 +2064,7 @@ int PanoramiXCreateColormap(ClientPtr client) REQUEST_SIZE_MATCH(xCreateColormapReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityReadAccess))) + client, stuff->window, XRT_WINDOW, DixReadAccess))) return BadWindow; if(!stuff->visual || (stuff->visual > 255)) @@ -2107,7 +2107,7 @@ int PanoramiXFreeColormap(ClientPtr client) client->errorValue = stuff->id; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_COLORMAP, SecurityDestroyAccess))) + client, stuff->id, XRT_COLORMAP, DixDestroyAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j) { @@ -2136,7 +2136,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client) if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->srcCmap, XRT_COLORMAP, - SecurityReadAccess | SecurityWriteAccess))) + DixReadAccess | DixWriteAccess))) return BadColor; if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) @@ -2174,7 +2174,7 @@ int PanoramiXInstallColormap(ClientPtr client) client->errorValue = stuff->id; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_COLORMAP, SecurityReadAccess))) + client, stuff->id, XRT_COLORMAP, DixReadAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2197,7 +2197,7 @@ int PanoramiXUninstallColormap(ClientPtr client) client->errorValue = stuff->id; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_COLORMAP, SecurityReadAccess))) + client, stuff->id, XRT_COLORMAP, DixReadAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j) { @@ -2220,7 +2220,7 @@ int PanoramiXAllocColor(ClientPtr client) client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) + client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2243,7 +2243,7 @@ int PanoramiXAllocNamedColor(ClientPtr client) client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) + client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2266,7 +2266,7 @@ int PanoramiXAllocColorCells(ClientPtr client) client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) + client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2289,7 +2289,7 @@ int PanoramiXAllocColorPlanes(ClientPtr client) client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) + client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2313,7 +2313,7 @@ int PanoramiXFreeColors(ClientPtr client) client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) + client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j) { @@ -2335,7 +2335,7 @@ int PanoramiXStoreColors(ClientPtr client) client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) + client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2358,7 +2358,7 @@ int PanoramiXStoreNamedColor(ClientPtr client) client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) + client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ diff --git a/Xext/saver.c b/Xext/saver.c index 1d223ae53..d6b537a78 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -1279,7 +1279,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2); @@ -1291,7 +1291,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -1301,7 +1301,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) + client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } @@ -1311,7 +1311,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_COLORMAP, SecurityReadAccess))) + client, tmp, XRT_COLORMAP, DixReadAccess))) return BadColor; } } @@ -1351,7 +1351,7 @@ ProcScreenSaverUnsetAttributes (ClientPtr client) int i; if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; for(i = PanoramiXNumScreens - 1; i > 0; i--) { diff --git a/Xext/security.c b/Xext/security.c index 572f81196..4fbf6f283 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -600,7 +600,7 @@ ProcSecurityRevokeAuthorization( REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client, - stuff->authId, SecurityAuthorizationResType, SecurityDestroyAccess); + stuff->authId, SecurityAuthorizationResType, DixDestroyAccess); if (!pAuth) return SecurityErrorBase + XSecurityBadAuthorization; @@ -966,7 +966,7 @@ CALLBACK(SecurityCheckResourceIDAccess) int cid, reqtype; if (TRUSTLEVEL(client) == XSecurityClientTrusted || - SecurityUnknownAccess == access_mode) + DixUnknownAccess == access_mode) return; /* for compatibility, we have to allow access */ cid = CLIENT_ID(id); @@ -1217,7 +1217,7 @@ CALLBACK(SecurityCheckHostlistAccess) if (TRUSTLEVEL(rec->client) != XSecurityClientTrusted) { rec->rval = FALSE; - if (rec->access_mode == SecurityWriteAccess) + if (rec->access_mode == DixWriteAccess) SecurityAudit("client %d attempted to change host access\n", rec->client->index); else @@ -1798,11 +1798,11 @@ CALLBACK(SecurityCheckPropertyAccess) * executed a continue, which will skip the follwing code. */ action = XaceAllowOperation; - if (access_mode & SecurityReadAccess) + if (access_mode & DixReadAccess) action = max(action, pacl->readAction); - if (access_mode & SecurityWriteAccess) + if (access_mode & DixWriteAccess) action = max(action, pacl->writeAction); - if (access_mode & SecurityDestroyAccess) + if (access_mode & DixDestroyAccess) action = max(action, pacl->destroyAction); break; } /* end for each pacl */ diff --git a/Xext/shape.c b/Xext/shape.c index 4d9d3fb5b..4a798da7c 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -390,7 +390,7 @@ ProcPanoramiXShapeRectangles( REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->dest, XRT_WINDOW, DixWriteAccess))) return BadWindow; FOR_NSCREENS(j) { @@ -422,7 +422,7 @@ ProcShapeMask (client) REQUEST_SIZE_MATCH (xShapeMaskReq); UpdateCurrentTime(); - pWin = SecurityLookupWindow (stuff->dest, client, SecurityWriteAccess); + pWin = SecurityLookupWindow (stuff->dest, client, DixWriteAccess); if (!pWin) return BadWindow; switch (stuff->destKind) { @@ -444,7 +444,7 @@ ProcShapeMask (client) srcRgn = 0; else { pPixmap = (PixmapPtr) SecurityLookupIDByType(client, stuff->src, - RT_PIXMAP, SecurityReadAccess); + RT_PIXMAP, DixReadAccess); if (!pPixmap) return BadPixmap; if (pPixmap->drawable.pScreen != pScreen || @@ -488,12 +488,12 @@ ProcPanoramiXShapeMask( REQUEST_SIZE_MATCH (xShapeMaskReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->dest, XRT_WINDOW, DixWriteAccess))) return BadWindow; if(stuff->src != None) { if(!(pmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->src, XRT_PIXMAP, SecurityReadAccess))) + client, stuff->src, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } else pmap = NULL; @@ -616,11 +616,11 @@ ProcPanoramiXShapeCombine( REQUEST_AT_LEAST_SIZE (xShapeCombineReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->dest, XRT_WINDOW, DixWriteAccess))) return BadWindow; if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->src, XRT_WINDOW, SecurityReadAccess))) + client, stuff->src, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS(j) { @@ -688,7 +688,7 @@ ProcPanoramiXShapeOffset( REQUEST_AT_LEAST_SIZE (xShapeOffsetReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, SecurityWriteAccess))) + client, stuff->dest, XRT_WINDOW, DixWriteAccess))) return BadWindow; FOR_NSCREENS(j) { @@ -822,11 +822,11 @@ ProcShapeSelectInput (client) XID clientResource; REQUEST_SIZE_MATCH (xShapeSelectInputReq); - pWin = SecurityLookupWindow (stuff->window, client, SecurityWriteAccess); + pWin = SecurityLookupWindow (stuff->window, client, DixWriteAccess); if (!pWin) return BadWindow; pHead = (ShapeEventPtr *)SecurityLookupIDByType(client, - pWin->drawable.id, EventType, SecurityWriteAccess); + pWin->drawable.id, EventType, DixWriteAccess); switch (stuff->enable) { case xTrue: if (pHead) { @@ -999,7 +999,7 @@ ProcShapeInputSelected (client) if (!pWin) return BadWindow; pHead = (ShapeEventPtr *) SecurityLookupIDByType(client, - pWin->drawable.id, EventType, SecurityReadAccess); + pWin->drawable.id, EventType, DixReadAccess); enabled = xFalse; if (pHead) { for (pShapeEvent = *pHead; diff --git a/Xext/shm.c b/Xext/shm.c index be79862cb..0c2299a61 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -571,11 +571,11 @@ ProcPanoramiXShmPutImage(register ClientPtr client) REQUEST_SIZE_MATCH(xShmPutImageReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -621,7 +621,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) } if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if (draw->type == XRT_PIXMAP) diff --git a/Xext/sync.c b/Xext/sync.c index 7def85b94..1d899348b 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -436,7 +436,7 @@ SyncInitTrigger(client, pTrigger, counter, changes) if (counter == None) pCounter = NULL; else if (!(pCounter = (SyncCounter *)SecurityLookupIDByType( - client, counter, RTCounter, SecurityReadAccess))) + client, counter, RTCounter, DixReadAccess))) { client->errorValue = counter; return SyncErrorBase + XSyncBadCounter; @@ -1550,7 +1550,7 @@ ProcSyncSetCounter(client) REQUEST_SIZE_MATCH(xSyncSetCounterReq); pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->cid, - RTCounter, SecurityWriteAccess); + RTCounter, DixWriteAccess); if (pCounter == NULL) { client->errorValue = stuff->cid; @@ -1583,7 +1583,7 @@ ProcSyncChangeCounter(client) REQUEST_SIZE_MATCH(xSyncChangeCounterReq); pCounter = (SyncCounter *) SecurityLookupIDByType(client, stuff->cid, - RTCounter, SecurityWriteAccess); + RTCounter, DixWriteAccess); if (pCounter == NULL) { client->errorValue = stuff->cid; @@ -1621,7 +1621,7 @@ ProcSyncDestroyCounter(client) REQUEST_SIZE_MATCH(xSyncDestroyCounterReq); pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter, - RTCounter, SecurityDestroyAccess); + RTCounter, DixDestroyAccess); if (pCounter == NULL) { client->errorValue = stuff->counter; @@ -1767,7 +1767,7 @@ ProcSyncQueryCounter(client) REQUEST_SIZE_MATCH(xSyncQueryCounterReq); pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter, - RTCounter, SecurityReadAccess); + RTCounter, DixReadAccess); if (pCounter == NULL) { client->errorValue = stuff->counter; @@ -1896,7 +1896,7 @@ ProcSyncChangeAlarm(client) REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq); if (!(pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, - RTAlarm, SecurityWriteAccess))) + RTAlarm, DixWriteAccess))) { client->errorValue = stuff->alarm; return SyncErrorBase + XSyncBadAlarm; @@ -1937,7 +1937,7 @@ ProcSyncQueryAlarm(client) REQUEST_SIZE_MATCH(xSyncQueryAlarmReq); pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, - RTAlarm, SecurityReadAccess); + RTAlarm, DixReadAccess); if (!pAlarm) { client->errorValue = stuff->alarm; @@ -1997,7 +1997,7 @@ ProcSyncDestroyAlarm(client) REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq); if (!((SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, - RTAlarm, SecurityDestroyAccess))) + RTAlarm, DixDestroyAccess))) { client->errorValue = stuff->alarm; return SyncErrorBase + XSyncBadAlarm; diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index bd250569e..44647060a 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -445,11 +445,11 @@ ProcXF86BigfontQueryFont( #endif client->errorValue = stuff->id; /* EITHER font or gc */ pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, - SecurityReadAccess); + DixReadAccess); if (!pFont) { /* can't use VERIFY_GC because it might return BadGC */ GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, - SecurityReadAccess); + DixReadAccess); if (!pGC) { client->errorValue = stuff->id; return BadFont; /* procotol spec says only error is BadFont */ diff --git a/Xext/xprint.c b/Xext/xprint.c index 29d3262f9..669ad277d 100644 --- a/Xext/xprint.c +++ b/Xext/xprint.c @@ -749,7 +749,7 @@ ProcXpGetPageDimensions(ClientPtr client) if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, - SecurityReadAccess)) + DixReadAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; @@ -811,7 +811,7 @@ ProcXpSetImageResolution(ClientPtr client) if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, - SecurityWriteAccess)) + DixWriteAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; @@ -859,7 +859,7 @@ ProcXpGetImageResolution(ClientPtr client) if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, - SecurityReadAccess)) + DixReadAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; @@ -1068,7 +1068,7 @@ ProcXpSetContext(ClientPtr client) if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, - SecurityWriteAccess)) + DixWriteAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; @@ -1141,7 +1141,7 @@ ProcXpDestroyContext(ClientPtr client) if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, - SecurityDestroyAccess)) + DixDestroyAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; @@ -1167,7 +1167,7 @@ ProcXpGetContextScreen(ClientPtr client) if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, - SecurityReadAccess)) + DixReadAccess)) == (XpContextPtr)NULL) return XpErrorBase+XPBadContext; @@ -1853,7 +1853,7 @@ ProcXpStartPage(ClientPtr client) return XpErrorBase+XPBadSequence; pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); + DixWriteAccess); if (!pWin || pWin->drawable.pScreen->myNum != pContext->screenNum) return BadWindow; @@ -1994,7 +1994,7 @@ ProcXpGetDocumentData(ClientPtr client) if((pContext = (XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, - SecurityWriteAccess)) + DixWriteAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; @@ -2077,7 +2077,7 @@ ProcXpGetAttributes(ClientPtr client) client, stuff->printContext, RTcontext, - SecurityReadAccess)) + DixReadAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; @@ -2149,7 +2149,7 @@ ProcXpSetAttributes(ClientPtr client) client, stuff->printContext, RTcontext, - SecurityWriteAccess)) + DixWriteAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; @@ -2229,7 +2229,7 @@ ProcXpGetOneAttribute(ClientPtr client) client, stuff->printContext, RTcontext, - SecurityReadAccess)) + DixReadAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; @@ -2300,7 +2300,7 @@ ProcXpSelectInput(ClientPtr client) if((pContext=(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, - SecurityWriteAccess)) + DixWriteAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; @@ -2336,7 +2336,7 @@ ProcXpInputSelected(ClientPtr client) if((pContext=(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, - SecurityReadAccess)) + DixReadAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index 0c7a38199..ec2b4f8d7 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -1877,11 +1877,11 @@ XineramaXvStopVideo(ClientPtr client) REQUEST_SIZE_MATCH(xvStopVideoReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, SecurityReadAccess))) + client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; FOR_NSCREENS_BACKWARD(i) { @@ -1905,7 +1905,7 @@ XineramaXvSetPortAttribute(ClientPtr client) REQUEST_SIZE_MATCH(xvSetPortAttributeReq); if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, SecurityReadAccess))) + client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; FOR_NSCREENS_BACKWARD(i) { @@ -1931,15 +1931,15 @@ XineramaXvShmPutImage(ClientPtr client) REQUEST_SIZE_MATCH(xvShmPutImageReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, SecurityReadAccess))) + client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1978,15 +1978,15 @@ XineramaXvPutImage(ClientPtr client) REQUEST_AT_LEAST_SIZE(xvPutImageReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, SecurityReadAccess))) + client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2023,15 +2023,15 @@ XineramaXvPutVideo(ClientPtr client) REQUEST_AT_LEAST_SIZE(xvPutVideoReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, SecurityReadAccess))) + client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2068,15 +2068,15 @@ XineramaXvPutStill(ClientPtr client) REQUEST_AT_LEAST_SIZE(xvPutImageReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) + client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, SecurityReadAccess))) + client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; diff --git a/damageext/damageext.c b/damageext/damageext.c index 225f9ecf0..c8f28e953 100755 --- a/damageext/damageext.c +++ b/damageext/damageext.c @@ -179,7 +179,7 @@ ProcDamageCreate (ClientPtr client) REQUEST_SIZE_MATCH(xDamageCreateReq); LEGAL_NEW_RESOURCE(stuff->damage, client); SECURITY_VERIFY_DRAWABLE (pDrawable, stuff->drawable, client, - SecurityReadAccess); + DixReadAccess); switch (stuff->level) { case XDamageReportRawRectangles: level = DamageReportRawRegion; @@ -237,7 +237,7 @@ ProcDamageDestroy (ClientPtr client) DamageExtPtr pDamageExt; REQUEST_SIZE_MATCH(xDamageDestroyReq); - VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, SecurityWriteAccess); + VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess); FreeResource (stuff->damage, RT_NONE); return (client->noClientException); } @@ -251,9 +251,9 @@ ProcDamageSubtract (ClientPtr client) RegionPtr pParts; REQUEST_SIZE_MATCH(xDamageSubtractReq); - VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, SecurityWriteAccess); - VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, SecurityWriteAccess); - VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, SecurityWriteAccess); + VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess); + VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess); + VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess); if (pDamageExt->level != DamageReportRawRegion) { diff --git a/dbe/dbe.c b/dbe/dbe.c index 5b43dd1bd..649143cf2 100644 --- a/dbe/dbe.c +++ b/dbe/dbe.c @@ -406,7 +406,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client) /* The window must be valid. */ if (!(pWin = SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess))) + DixWriteAccess))) { return(BadWindow); } @@ -633,9 +633,9 @@ ProcDbeDeallocateBackBufferName(ClientPtr client) /* Buffer name must be valid */ if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client, - stuff->buffer, dbeWindowPrivResType, SecurityDestroyAccess)) || + stuff->buffer, dbeWindowPrivResType, DixDestroyAccess)) || !(SecurityLookupIDByType(client, stuff->buffer, dbeDrawableResType, - SecurityDestroyAccess))) + DixDestroyAccess))) { client->errorValue = stuff->buffer; return(dbeErrorBase + DbeBadBuffer); @@ -730,7 +730,7 @@ ProcDbeSwapBuffers(ClientPtr client) /* Each window must be a valid window - BadWindow. */ if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client, - SecurityWriteAccess))) + DixWriteAccess))) { DEALLOCATE_LOCAL(swapInfo); return(BadWindow); @@ -890,7 +890,7 @@ ProcDbeGetVisualInfo(ClientPtr client) for (i = 0; i < stuff->n; i++) { if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable( - drawables[i], client, SecurityReadAccess))) + drawables[i], client, DixReadAccess))) { DEALLOCATE_LOCAL(pDrawables); return(BadDrawable); @@ -1047,7 +1047,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client) REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq); if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client, - stuff->buffer, dbeWindowPrivResType, SecurityReadAccess))) + stuff->buffer, dbeWindowPrivResType, DixReadAccess))) { rep.attributes = None; } diff --git a/dix/colormap.c b/dix/colormap.c index b8f2f4af6..a74cb390c 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -903,7 +903,7 @@ AllocColor (ColormapPtr pmap, { ColormapPtr prootmap = (ColormapPtr) SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, - RT_COLORMAP, SecurityReadAccess); + RT_COLORMAP, DixReadAccess); if (pmap->class == prootmap->class) FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb, @@ -920,7 +920,7 @@ AllocColor (ColormapPtr pmap, { ColormapPtr prootmap = (ColormapPtr) SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, - RT_COLORMAP, SecurityReadAccess); + RT_COLORMAP, DixReadAccess); if (pmap->class == prootmap->class) { diff --git a/dix/cursor.c b/dix/cursor.c index b9ede1f76..7071d8345 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -262,9 +262,9 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, GlyphSharePtr pShare; sourcefont = (FontPtr) SecurityLookupIDByType(client, source, RT_FONT, - SecurityReadAccess); + DixReadAccess); maskfont = (FontPtr) SecurityLookupIDByType(client, mask, RT_FONT, - SecurityReadAccess); + DixReadAccess); if (!sourcefont) { diff --git a/dix/dispatch.c b/dix/dispatch.c index 0a761eb6c..a3de07fed 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -563,7 +563,7 @@ ProcCreateWindow(ClientPtr client) LEGAL_NEW_RESOURCE(stuff->wid, client); if (!(pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, - SecurityWriteAccess))) + DixWriteAccess))) return BadWindow; len = client->req_len - (sizeof(xCreateWindowReq) >> 2); if (Ones(stuff->mask) != len) @@ -604,7 +604,7 @@ ProcChangeWindowAttributes(register ClientPtr client) REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); + DixWriteAccess); if (!pWin) return(BadWindow); len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); @@ -629,7 +629,7 @@ ProcGetWindowAttributes(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); GetWindowAttributes(pWin, client, &wa); @@ -645,7 +645,7 @@ ProcDestroyWindow(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityDestroyAccess); + DixDestroyAccess); if (!pWin) return(BadWindow); if (pWin->parent) @@ -661,7 +661,7 @@ ProcDestroySubwindows(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityDestroyAccess); + DixDestroyAccess); if (!pWin) return(BadWindow); DestroySubwindows(pWin, client); @@ -677,7 +677,7 @@ ProcChangeSaveSet(register ClientPtr client) REQUEST_SIZE_MATCH(xChangeSaveSetReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) @@ -706,11 +706,11 @@ ProcReparentWindow(register ClientPtr client) REQUEST_SIZE_MATCH(xReparentWindowReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); + DixWriteAccess); if (!pWin) return(BadWindow); pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, - SecurityWriteAccess); + DixWriteAccess); if (!pParent) return(BadWindow); if (SAME_SCREENS(pWin->drawable, pParent->drawable)) @@ -740,7 +740,7 @@ ProcMapWindow(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); MapWindow(pWin, client); @@ -756,7 +756,7 @@ ProcMapSubwindows(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); MapSubwindows(pWin, client); @@ -772,7 +772,7 @@ ProcUnmapWindow(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); UnmapWindow(pWin, FALSE); @@ -788,7 +788,7 @@ ProcUnmapSubwindows(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); UnmapSubwindows(pWin); @@ -805,7 +805,7 @@ ProcConfigureWindow(register ClientPtr client) REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client, - SecurityWriteAccess); + DixWriteAccess); if (!pWin) return(BadWindow); len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); @@ -833,7 +833,7 @@ ProcCirculateWindow(register ClientPtr client) return BadValue; } pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); + DixWriteAccess); if (!pWin) return(BadWindow); CirculateWindow(pWin, (int)stuff->direction, client); @@ -847,7 +847,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, SecurityReadAccess); + SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, DixReadAccess); rep->type = X_Reply; rep->length = 0; rep->sequenceNumber = client->sequence; @@ -906,7 +906,7 @@ ProcQueryTree(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); reply.type = X_Reply; @@ -1022,7 +1022,7 @@ ProcSetSelectionOwner(register ClientPtr client) if (stuff->window != None) { pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); } @@ -1141,7 +1141,7 @@ ProcConvertSelection(register ClientPtr client) REQUEST_SIZE_MATCH(xConvertSelectionReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); @@ -1159,7 +1159,7 @@ ProcConvertSelection(register ClientPtr client) (CurrentSelections[i].window != None) && XaceHook(XACE_RESOURCE_ACCESS, client, CurrentSelections[i].window, RT_WINDOW, - SecurityReadAccess, CurrentSelections[i].pWin)) + DixReadAccess, CurrentSelections[i].pWin)) { event.u.u.type = SelectionRequest; event.u.selectionRequest.time = stuff->time; @@ -1263,11 +1263,11 @@ ProcTranslateCoords(register ClientPtr client) REQUEST_SIZE_MATCH(xTranslateCoordsReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, - SecurityReadAccess); + DixReadAccess); if (!pDst) return(BadWindow); rep.type = X_Reply; @@ -1358,7 +1358,7 @@ ProcCloseFont(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, - SecurityDestroyAccess); + DixDestroyAccess); if ( pFont != (FontPtr)NULL) /* id was valid */ { FreeResource(stuff->id, RT_NONE); @@ -1382,12 +1382,12 @@ ProcQueryFont(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); client->errorValue = stuff->id; /* EITHER font or gc */ pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, - SecurityReadAccess); + DixReadAccess); if (!pFont) { /* can't use VERIFY_GC because it might return BadGC */ pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, - SecurityReadAccess); + DixReadAccess); if (!pGC) { client->errorValue = stuff->id; @@ -1443,11 +1443,11 @@ ProcQueryTextExtents(register ClientPtr client) REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq); pFont = (FontPtr)SecurityLookupIDByType(client, stuff->fid, RT_FONT, - SecurityReadAccess); + DixReadAccess); if (!pFont) { pGC = (GC *)SecurityLookupIDByType(client, stuff->fid, RT_GC, - SecurityReadAccess); + DixReadAccess); if (!pGC) { client->errorValue = stuff->fid; @@ -1526,7 +1526,7 @@ ProcCreatePixmap(register ClientPtr client) client->errorValue = stuff->pid; LEGAL_NEW_RESOURCE(stuff->pid, client); SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client, - SecurityReadAccess); + DixReadAccess); if (!stuff->width || !stuff->height) { client->errorValue = 0; @@ -1581,7 +1581,7 @@ ProcFreePixmap(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pMap = (PixmapPtr)SecurityLookupIDByType(client, stuff->id, RT_PIXMAP, - SecurityDestroyAccess); + DixDestroyAccess); if (pMap) { FreeResource(stuff->id, RT_NONE); @@ -1607,7 +1607,7 @@ ProcCreateGC(register ClientPtr client) client->errorValue = stuff->gc; LEGAL_NEW_RESOURCE(stuff->gc, client); SECURITY_VERIFY_DRAWABLE (pDraw, stuff->drawable, client, - SecurityReadAccess); + DixReadAccess); len = client->req_len - (sizeof(xCreateGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; @@ -1629,7 +1629,7 @@ ProcChangeGC(register ClientPtr client) unsigned len; REQUEST_AT_LEAST_SIZE(xChangeGCReq); - SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityWriteAccess); + SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixWriteAccess); len = client->req_len - (sizeof(xChangeGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; @@ -1653,8 +1653,8 @@ ProcCopyGC(register ClientPtr client) REQUEST(xCopyGCReq); REQUEST_SIZE_MATCH(xCopyGCReq); - SECURITY_VERIFY_GC( pGC, stuff->srcGC, client, SecurityReadAccess); - SECURITY_VERIFY_GC( dstGC, stuff->dstGC, client, SecurityWriteAccess); + SECURITY_VERIFY_GC( pGC, stuff->srcGC, client, DixReadAccess); + SECURITY_VERIFY_GC( dstGC, stuff->dstGC, client, DixWriteAccess); if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth)) return (BadMatch); result = CopyGC(pGC, dstGC, stuff->mask); @@ -1681,7 +1681,7 @@ ProcSetDashes(register ClientPtr client) return BadValue; } - SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess); + SECURITY_VERIFY_GC(pGC,stuff->gc, client, DixWriteAccess); result = SetDashes(pGC, stuff->dashOffset, stuff->nDashes, (unsigned char *)&stuff[1]); @@ -1709,7 +1709,7 @@ ProcSetClipRectangles(register ClientPtr client) client->errorValue = stuff->ordering; return BadValue; } - SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess); + SECURITY_VERIFY_GC(pGC,stuff->gc, client, DixWriteAccess); nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq); if (nr & 4) @@ -1730,7 +1730,7 @@ ProcFreeGC(register ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - SECURITY_VERIFY_GC(pGC, stuff->id, client, SecurityDestroyAccess); + SECURITY_VERIFY_GC(pGC, stuff->id, client, DixDestroyAccess); FreeResource(stuff->id, RT_NONE); return(client->noClientException); } @@ -1743,7 +1743,7 @@ ProcClearToBackground(register ClientPtr client) REQUEST_SIZE_MATCH(xClearAreaReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); + DixWriteAccess); if (!pWin) return(BadWindow); if (pWin->drawable.class == InputOnly) @@ -1777,7 +1777,7 @@ ProcCopyArea(register ClientPtr client) if (stuff->dstDrawable != stuff->srcDrawable) { SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client, - SecurityReadAccess); + DixReadAccess); if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) { client->errorValue = stuff->dstDrawable; @@ -1817,7 +1817,7 @@ ProcCopyPlane(register ClientPtr client) if (stuff->dstDrawable != stuff->srcDrawable) { SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client, - SecurityReadAccess); + DixReadAccess); if (pdstDraw->pScreen != psrcDraw->pScreen) { client->errorValue = stuff->dstDrawable; @@ -2156,7 +2156,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, client->errorValue = format; return(BadValue); } - SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess); + SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, DixReadAccess); if(pDraw->type == DRAWABLE_WINDOW) { if( /* check for being viewable */ @@ -2478,7 +2478,7 @@ ProcCreateColormap(register ClientPtr client) mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); @@ -2508,7 +2508,7 @@ ProcFreeColormap(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pmap = (ColormapPtr )SecurityLookupIDByType(client, stuff->id, RT_COLORMAP, - SecurityDestroyAccess); + DixDestroyAccess); if (pmap) { /* Freeing a default colormap is a no-op */ @@ -2536,7 +2536,7 @@ ProcCopyColormapAndFree(register ClientPtr client) mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); if( (pSrcMap = (ColormapPtr )SecurityLookupIDByType(client, stuff->srcCmap, - RT_COLORMAP, SecurityReadAccess|SecurityWriteAccess)) ) + RT_COLORMAP, DixReadAccess|DixWriteAccess)) ) { result = CopyColormapAndFree(mid, pSrcMap, client->index); if (client->noClientException != Success) @@ -2559,7 +2559,7 @@ ProcInstallColormap(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, - RT_COLORMAP, SecurityReadAccess); + RT_COLORMAP, DixReadAccess); if (pcmp) { (*(pcmp->pScreen->InstallColormap)) (pcmp); @@ -2580,7 +2580,7 @@ ProcUninstallColormap(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, - RT_COLORMAP, SecurityReadAccess); + RT_COLORMAP, DixReadAccess); if (pcmp) { if(pcmp->mid != pcmp->pScreen->defColormap) @@ -2604,7 +2604,7 @@ ProcListInstalledColormaps(register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); @@ -2639,7 +2639,7 @@ ProcAllocColor (register ClientPtr client) REQUEST_SIZE_MATCH(xAllocColorReq); pmap = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); + RT_COLORMAP, DixWriteAccess); if (pmap) { acr.type = X_Reply; @@ -2679,7 +2679,7 @@ ProcAllocNamedColor (register ClientPtr client) REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); + RT_COLORMAP, DixWriteAccess); if (pcmp) { int retval; @@ -2731,7 +2731,7 @@ ProcAllocColorCells (register ClientPtr client) REQUEST_SIZE_MATCH(xAllocColorCellsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); + RT_COLORMAP, DixWriteAccess); if (pcmp) { xAllocColorCellsReply accr; @@ -2797,7 +2797,7 @@ ProcAllocColorPlanes(register ClientPtr client) REQUEST_SIZE_MATCH(xAllocColorPlanesReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); + RT_COLORMAP, DixWriteAccess); if (pcmp) { xAllocColorPlanesReply acpr; @@ -2861,7 +2861,7 @@ ProcFreeColors(register ClientPtr client) REQUEST_AT_LEAST_SIZE(xFreeColorsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); + RT_COLORMAP, DixWriteAccess); if (pcmp) { int count; @@ -2896,7 +2896,7 @@ ProcStoreColors (ClientPtr client) REQUEST_AT_LEAST_SIZE(xStoreColorsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); + RT_COLORMAP, DixWriteAccess); if (pcmp) { int count; @@ -2930,7 +2930,7 @@ ProcStoreNamedColor (register ClientPtr client) REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); + RT_COLORMAP, DixWriteAccess); if (pcmp) { xColorItem def; @@ -2964,7 +2964,7 @@ ProcQueryColors(register ClientPtr client) REQUEST_AT_LEAST_SIZE(xQueryColorsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityReadAccess); + RT_COLORMAP, DixReadAccess); if (pcmp) { int count, retval; @@ -3015,7 +3015,7 @@ ProcLookupColor(register ClientPtr client) REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityReadAccess); + RT_COLORMAP, DixReadAccess); if (pcmp) { xLookupColorReply lcr; @@ -3065,9 +3065,9 @@ ProcCreateCursor (register ClientPtr client) LEGAL_NEW_RESOURCE(stuff->cid, client); src = (PixmapPtr)SecurityLookupIDByType(client, stuff->source, - RT_PIXMAP, SecurityReadAccess); + RT_PIXMAP, DixReadAccess); msk = (PixmapPtr)SecurityLookupIDByType(client, stuff->mask, - RT_PIXMAP, SecurityReadAccess); + RT_PIXMAP, DixReadAccess); if ( src == (PixmapPtr)NULL) { client->errorValue = stuff->source; @@ -3167,7 +3167,7 @@ ProcFreeCursor (register ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->id, - RT_CURSOR, SecurityDestroyAccess); + RT_CURSOR, DixDestroyAccess); if (pCursor) { FreeResource(stuff->id, RT_NONE); @@ -3197,7 +3197,7 @@ ProcQueryBestSize (register ClientPtr client) return(BadValue); } SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client, - SecurityReadAccess); + DixReadAccess); if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW) return (BadMatch); pScreen = pDraw->pScreen; @@ -3321,7 +3321,7 @@ ProcListHosts(register ClientPtr client) REQUEST_SIZE_MATCH(xListHostsReq); /* untrusted clients can't list hosts */ - if (!XaceHook(XACE_HOSTLIST_ACCESS, client, SecurityReadAccess)) + if (!XaceHook(XACE_HOSTLIST_ACCESS, client, DixReadAccess)) return BadAccess; result = GetHosts(&pdata, &nHosts, &len, &reply.enabled); diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 7e2ed5058..d5b42dcf6 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -1178,7 +1178,7 @@ doPolyText(ClientPtr client, register PTclosurePtr c) if (c->slept && c->pDraw && c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did, - RC_DRAWABLE, SecurityWriteAccess)) + RC_DRAWABLE, DixWriteAccess)) { /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client and avoid further @@ -1208,7 +1208,7 @@ doPolyText(ClientPtr client, register PTclosurePtr c) | ((Font)*(c->pElt+2)) << 16 | ((Font)*(c->pElt+1)) << 24; pFont = (FontPtr)SecurityLookupIDByType(client, fid, RT_FONT, - SecurityReadAccess); + DixReadAccess); if (!pFont) { client->errorValue = fid; @@ -1463,7 +1463,7 @@ doImageText(ClientPtr client, register ITclosurePtr c) if (c->slept && c->pDraw && c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did, - RC_DRAWABLE, SecurityWriteAccess)) + RC_DRAWABLE, DixWriteAccess)) { /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client. */ @@ -2016,7 +2016,7 @@ FontPtr find_old_font(XID id) { return (FontPtr) SecurityLookupIDByType(NullClient, id, RT_NONE, - SecurityUnknownAccess); + DixUnknownAccess); } Font diff --git a/dix/dixutils.c b/dix/dixutils.c index af7e1c8f1..fca55d99f 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -236,13 +236,13 @@ SecurityLookupDrawable(XID rid, ClientPtr client, Mask access_mode) _X_EXPORT WindowPtr LookupWindow(XID rid, ClientPtr client) { - return SecurityLookupWindow(rid, client, SecurityUnknownAccess); + return SecurityLookupWindow(rid, client, DixUnknownAccess); } _X_EXPORT pointer LookupDrawable(XID rid, ClientPtr client) { - return SecurityLookupDrawable(rid, client, SecurityUnknownAccess); + return SecurityLookupDrawable(rid, client, DixUnknownAccess); } #else /* not XACE */ @@ -293,7 +293,7 @@ _X_EXPORT ClientPtr LookupClient(XID rid, ClientPtr client) { pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY, - SecurityReadAccess); + DixReadAccess); int clientIndex = CLIENT_ID(rid); if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) diff --git a/dix/events.c b/dix/events.c index 0a39dcd9e..c7cf73e46 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2235,7 +2235,7 @@ XineramaWarpPointer(ClientPtr client) if (stuff->dstWid != None) { - dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess); + dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); if (!dest) return BadWindow; } @@ -2248,7 +2248,7 @@ XineramaWarpPointer(ClientPtr client) XID winID = stuff->srcWid; WindowPtr source; - source = SecurityLookupWindow(winID, client, SecurityReadAccess); + source = SecurityLookupWindow(winID, client, DixReadAccess); if (!source) return BadWindow; winX = source->drawable.x; @@ -2315,7 +2315,7 @@ ProcWarpPointer(ClientPtr client) if (stuff->dstWid != None) { - dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess); + dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); if (!dest) return BadWindow; } @@ -2328,7 +2328,7 @@ ProcWarpPointer(ClientPtr client) XID winID = stuff->srcWid; WindowPtr source; - source = SecurityLookupWindow(winID, client, SecurityReadAccess); + source = SecurityLookupWindow(winID, client, DixReadAccess); if (!source) return BadWindow; winX = source->drawable.x; @@ -3551,7 +3551,7 @@ SetInputFocus( else if ((focusID == FollowKeyboard) && followOK) focusWin = inputInfo.keyboard->focus->win; else if (!(focusWin = SecurityLookupWindow(focusID, client, - SecurityReadAccess))) + DixReadAccess))) return BadWindow; else { @@ -3671,7 +3671,7 @@ ProcGrabPointer(ClientPtr client) client->errorValue = stuff->eventMask; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); + pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; if (stuff->confineTo == None) @@ -3679,7 +3679,7 @@ ProcGrabPointer(ClientPtr client) else { confineTo = SecurityLookupWindow(stuff->confineTo, client, - SecurityReadAccess); + DixReadAccess); if (!confineTo) return BadWindow; } @@ -3688,7 +3688,7 @@ ProcGrabPointer(ClientPtr client) else { cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, SecurityReadAccess); + RT_CURSOR, DixReadAccess); if (!cursor) { client->errorValue = stuff->cursor; @@ -3762,7 +3762,7 @@ ProcChangeActivePointerGrab(ClientPtr client) else { newCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, SecurityReadAccess); + RT_CURSOR, DixReadAccess); if (!newCursor) { client->errorValue = stuff->cursor; @@ -3832,7 +3832,7 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, client->errorValue = ownerEvents; return BadValue; } - pWin = SecurityLookupWindow(grabWindow, client, SecurityReadAccess); + pWin = SecurityLookupWindow(grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; time = ClientTimeToServerTime(ctime); @@ -3920,7 +3920,7 @@ ProcQueryPointer(ClientPtr client) DeviceIntPtr mouse = inputInfo.pointer; REQUEST_SIZE_MATCH(xResourceReq); - pWin = SecurityLookupWindow(stuff->id, client, SecurityReadAccess); + pWin = SecurityLookupWindow(stuff->id, client, DixReadAccess); if (!pWin) return BadWindow; if (mouse->valuator->motionHintWindow) @@ -4087,7 +4087,7 @@ ProcSendEvent(ClientPtr client) } else pWin = SecurityLookupWindow(stuff->destination, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return BadWindow; if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) @@ -4125,7 +4125,7 @@ ProcUngrabKey(ClientPtr client) DeviceIntPtr keybd = inputInfo.keyboard; REQUEST_SIZE_MATCH(xUngrabKeyReq); - pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); + pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; @@ -4196,7 +4196,7 @@ ProcGrabKey(ClientPtr client) client->errorValue = stuff->modifiers; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); + pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; @@ -4248,14 +4248,14 @@ ProcGrabButton(ClientPtr client) client->errorValue = stuff->eventMask; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); + pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; if (stuff->confineTo == None) confineTo = NullWindow; else { confineTo = SecurityLookupWindow(stuff->confineTo, client, - SecurityReadAccess); + DixReadAccess); if (!confineTo) return BadWindow; } @@ -4264,7 +4264,7 @@ ProcGrabButton(ClientPtr client) else { cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, SecurityReadAccess); + RT_CURSOR, DixReadAccess); if (!cursor) { client->errorValue = stuff->cursor; @@ -4297,7 +4297,7 @@ ProcUngrabButton(ClientPtr client) client->errorValue = stuff->modifiers; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); + pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; tempGrab.resource = client->clientAsMask; @@ -4451,7 +4451,7 @@ ProcRecolorCursor(ClientPtr client) REQUEST_SIZE_MATCH(xRecolorCursorReq); pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, SecurityWriteAccess); + RT_CURSOR, DixWriteAccess); if ( !pCursor) { client->errorValue = stuff->cursor; diff --git a/dix/gc.c b/dix/gc.c index ed6bf26db..5106fcda2 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -271,7 +271,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC { NEXTVAL(XID, newpix); pPixmap = (PixmapPtr)SecurityLookupIDByType(client, - newpix, RT_PIXMAP, SecurityReadAccess); + newpix, RT_PIXMAP, DixReadAccess); } if (pPixmap) { @@ -307,7 +307,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC { NEXTVAL(XID, newstipple) pPixmap = (PixmapPtr)SecurityLookupIDByType(client, - newstipple, RT_PIXMAP, SecurityReadAccess); + newstipple, RT_PIXMAP, DixReadAccess); } if (pPixmap) { @@ -349,7 +349,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC { NEXTVAL(XID, newfont) pFont = (FontPtr)SecurityLookupIDByType(client, newfont, - RT_FONT, SecurityReadAccess); + RT_FONT, DixReadAccess); } if (pFont) { @@ -416,7 +416,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC } else pPixmap = (PixmapPtr)SecurityLookupIDByType(client, - pid, RT_PIXMAP, SecurityReadAccess); + pid, RT_PIXMAP, DixReadAccess); } if (pPixmap) diff --git a/dix/property.c b/dix/property.c index 00d485655..5c1e957a5 100644 --- a/dix/property.c +++ b/dix/property.c @@ -105,7 +105,7 @@ ProcRotateProperties(ClientPtr client) REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); UpdateCurrentTime(); pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); + DixWriteAccess); if (!pWin) return(BadWindow); if (!stuff->nAtoms) @@ -117,7 +117,7 @@ ProcRotateProperties(ClientPtr client) for (i = 0; i < stuff->nAtoms; i++) { char action = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, atoms[i], - SecurityReadAccess|SecurityWriteAccess); + DixReadAccess|DixWriteAccess); if (!ValidAtom(atoms[i]) || (XaceErrorOperation == action)) { DEALLOCATE_LOCAL(props); @@ -209,7 +209,7 @@ ProcChangeProperty(ClientPtr client) REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); + DixWriteAccess); if (!pWin) return(BadWindow); if (!ValidAtom(stuff->property)) @@ -224,7 +224,7 @@ ProcChangeProperty(ClientPtr client) } switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, - SecurityWriteAccess)) + DixWriteAccess)) { case XaceErrorOperation: client->errorValue = stuff->property; @@ -448,14 +448,14 @@ ProcGetProperty(ClientPtr client) unsigned long n, len, ind; WindowPtr pWin; xGetPropertyReply reply; - Mask access_mode = SecurityReadAccess; + Mask access_mode = DixReadAccess; REQUEST(xGetPropertyReq); REQUEST_SIZE_MATCH(xGetPropertyReq); if (stuff->delete) UpdateCurrentTime(); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return BadWindow; @@ -491,7 +491,7 @@ ProcGetProperty(ClientPtr client) return NullPropertyReply(client, None, 0, &reply); if (stuff->delete) - access_mode |= SecurityDestroyAccess; + access_mode |= DixDestroyAccess; switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, access_mode)) { @@ -592,7 +592,7 @@ ProcListProperties(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); @@ -637,7 +637,7 @@ ProcDeleteProperty(register ClientPtr client) REQUEST_SIZE_MATCH(xDeletePropertyReq); UpdateCurrentTime(); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); + DixWriteAccess); if (!pWin) return(BadWindow); if (!ValidAtom(stuff->property)) @@ -647,7 +647,7 @@ ProcDeleteProperty(register ClientPtr client) } switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, - SecurityDestroyAccess)) + DixDestroyAccess)) { case XaceErrorOperation: client->errorValue = stuff->property; diff --git a/dix/resource.c b/dix/resource.c index c2044601f..4468f4575 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -944,12 +944,12 @@ _X_EXPORT pointer LookupIDByType(XID id, RESTYPE rtype) { return SecurityLookupIDByType(NullClient, id, rtype, - SecurityUnknownAccess); + DixUnknownAccess); } _X_EXPORT pointer LookupIDByClass(XID id, RESTYPE classes) { return SecurityLookupIDByClass(NullClient, id, classes, - SecurityUnknownAccess); + DixUnknownAccess); } diff --git a/dix/window.c b/dix/window.c index fa6906f2a..e33140dd4 100644 --- a/dix/window.c +++ b/dix/window.c @@ -1062,7 +1062,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt else { pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, - RT_PIXMAP, SecurityReadAccess); + RT_PIXMAP, DixReadAccess); if (pPixmap != (PixmapPtr) NULL) { if ((pPixmap->drawable.depth != pWin->drawable.depth) || @@ -1123,7 +1123,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt else { pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, - RT_PIXMAP, SecurityReadAccess); + RT_PIXMAP, DixReadAccess); if (pPixmap) { if ((pPixmap->drawable.depth != pWin->drawable.depth) || @@ -1333,7 +1333,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt goto PatchUp; } pCmap = (ColormapPtr)SecurityLookupIDByType(client, cmap, - RT_COLORMAP, SecurityReadAccess); + RT_COLORMAP, DixReadAccess); if (!pCmap) { error = BadColor; @@ -1409,7 +1409,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt else { pCursor = (CursorPtr)SecurityLookupIDByType(client, cursorID, - RT_CURSOR, SecurityReadAccess); + RT_CURSOR, DixReadAccess); if (!pCursor) { error = BadCursor; @@ -2299,7 +2299,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP sibwid = (Window ) *pVlist; pVlist++; pSib = (WindowPtr )SecurityLookupIDByType(client, sibwid, - RT_WINDOW, SecurityReadAccess); + RT_WINDOW, DixReadAccess); if (!pSib) { client->errorValue = sibwid; diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c index 6db036f1b..a9d8b5659 100644 --- a/hw/darwin/quartz/applewm.c +++ b/hw/darwin/quartz/applewm.c @@ -268,7 +268,7 @@ ProcAppleWMSelectInput (client) REQUEST_SIZE_MATCH (xAppleWMSelectInputReq); pHead = (WMEventPtr *)SecurityLookupIDByType(client, - eventResource, EventType, SecurityWriteAccess); + eventResource, EventType, DixWriteAccess); if (stuff->mask != 0) { if (pHead) { /* check for existing entry. */ @@ -491,7 +491,7 @@ ProcAppleWMSetWindowLevel( REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq); if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, SecurityReadAccess))) + client, DixReadAccess))) { return BadValue; } @@ -603,7 +603,7 @@ ProcAppleWMFrameDraw( REQUEST_AT_LEAST_SIZE(xAppleWMFrameDrawReq); if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, SecurityReadAccess))) + client, DixReadAccess))) { return BadValue; } diff --git a/hw/darwin/quartz/xpr/appledri.c b/hw/darwin/quartz/xpr/appledri.c index 6d9bae10f..585d7e1be 100644 --- a/hw/darwin/quartz/xpr/appledri.c +++ b/hw/darwin/quartz/xpr/appledri.c @@ -223,7 +223,7 @@ ProcAppleDRICreateSurface( if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( (Drawable)stuff->drawable, client, - SecurityReadAccess))) { + DixReadAccess))) { return BadValue; } @@ -256,7 +256,7 @@ ProcAppleDRIDestroySurface( if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( (Drawable)stuff->drawable, client, - SecurityReadAccess))) { + DixReadAccess))) { return BadValue; } diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c index 75623e696..02e8b1e7c 100644 --- a/hw/dmx/dmx.c +++ b/hw/dmx/dmx.c @@ -282,12 +282,12 @@ static int ProcDMXForceWindowCreation(ClientPtr client) int i; if (!(win = SecurityLookupIDByType(client, stuff->window, XRT_WINDOW, - SecurityReadAccess))) + DixReadAccess))) return -1; /* BadWindow */ FOR_NSCREENS(i) { if (!(pWin = SecurityLookupWindow(win->info[i].id, client, - SecurityReadAccess))) + DixReadAccess))) return -1; /* BadWindow */ dmxForceWindowCreation(pWin); @@ -297,7 +297,7 @@ static int ProcDMXForceWindowCreation(ClientPtr client) #endif if (!(pWin = SecurityLookupWindow(stuff->window, client, - SecurityReadAccess))) + DixReadAccess))) return -1; /* BadWindow */ dmxForceWindowCreation(pWin); @@ -556,12 +556,12 @@ static int dmxPopulatePanoramiX(ClientPtr client, Window window, DMXWindowAttributesRec attr; if (!(win = SecurityLookupIDByType(client, window, XRT_WINDOW, - SecurityReadAccess))) + DixReadAccess))) return -1; /* BadWindow */ FOR_NSCREENS(i) { if (!(pWin = SecurityLookupWindow(win->info[i].id, client, - SecurityReadAccess))) + DixReadAccess))) return -1; /* BadWindow */ if (dmxGetWindowAttributes(pWin, &attr)) { screens[count] = attr.screen; @@ -587,7 +587,7 @@ static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens, pos, vis); #endif - if (!(pWin = SecurityLookupWindow(window, client, SecurityReadAccess))) + if (!(pWin = SecurityLookupWindow(window, client, DixReadAccess))) return -1; /* BadWindow */ dmxGetWindowAttributes(pWin, &attr); diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c index 9cdd123b9..339692538 100644 --- a/hw/dmx/dmxpict.c +++ b/hw/dmx/dmxpict.c @@ -247,7 +247,7 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client) /* Make sure we handle all errors here!! */ glyphSet = SecurityLookupIDByType(client, stuff->gsid, GlyphSetType, - SecurityDestroyAccess); + DixDestroyAccess); glyphPriv = xalloc(sizeof(dmxGlyphPrivRec)); if (!glyphPriv) return BadAlloc; glyphPriv->glyphSets = NULL; @@ -255,7 +255,7 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client) DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv); pFmt = SecurityLookupIDByType(client, stuff->format, PictFormatType, - SecurityReadAccess); + DixReadAccess); oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler); @@ -315,7 +315,7 @@ static int dmxProcRenderFreeGlyphSet(ClientPtr client) REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType, - SecurityDestroyAccess); + DixDestroyAccess); if (glyphSet && glyphSet->refcnt == 1) { dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); @@ -358,7 +358,7 @@ static int dmxProcRenderAddGlyphs(ClientPtr client) int nbytes; glyphSet = SecurityLookupIDByType(client, stuff->glyphset, - GlyphSetType, SecurityReadAccess); + GlyphSetType, DixReadAccess); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); nglyphs = stuff->nglyphs; @@ -401,7 +401,7 @@ static int dmxProcRenderFreeGlyphs(ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType, - SecurityWriteAccess); + DixWriteAccess); if (glyphSet) { dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); @@ -473,13 +473,13 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client) dmxGlyphPrivPtr glyphPriv; pSrc = SecurityLookupIDByType(client, stuff->src, PictureType, - SecurityReadAccess); + DixReadAccess); pSrcPriv = DMX_GET_PICT_PRIV(pSrc); if (!pSrcPriv->pict) return ret; pDst = SecurityLookupIDByType(client, stuff->dst, PictureType, - SecurityWriteAccess); + DixWriteAccess); pDstPriv = DMX_GET_PICT_PRIV(pDst); if (!pDstPriv->pict) return ret; @@ -496,7 +496,7 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client) if (stuff->maskFormat) pFmt = SecurityLookupIDByType(client, stuff->maskFormat, - PictFormatType, SecurityReadAccess); + PictFormatType, DixReadAccess); else pFmt = NULL; @@ -547,7 +547,7 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client) curElt = elts; glyphSet = SecurityLookupIDByType(client, stuff->glyphset, - GlyphSetType, SecurityReadAccess); + GlyphSetType, DixReadAccess); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); while (buffer + sizeof(xGlyphElt) < end) { @@ -558,7 +558,7 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client) glyphSet = SecurityLookupIDByType(client, *((CARD32 *)buffer), GlyphSetType, - SecurityReadAccess); + DixReadAccess); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); buffer += 4; } else { @@ -622,7 +622,7 @@ static int dmxProcRenderSetPictureTransform(ClientPtr client) REQUEST(xRenderSetPictureTransformReq); REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); - VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); /* For the following to work with PanoramiX, it assumes that Render @@ -663,7 +663,7 @@ static int dmxProcRenderSetPictureFilter(ClientPtr client) REQUEST(xRenderSetPictureFilterReq); REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); - VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); /* For the following to work with PanoramiX, it assumes that Render diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c index 78cb34eec..20a02a173 100644 --- a/hw/dmx/glxProxy/glxcmds.c +++ b/hw/dmx/glxProxy/glxcmds.c @@ -1105,13 +1105,13 @@ static int MakeCurrent(__GLXclientState *cl, if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) { pXinDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, SecurityReadAccess); + SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); } if (pReadDraw && pReadDraw != pDraw && new_reply.readType != GLX_PBUFFER_TYPE) { pXinReadDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pReadDraw->id, XRC_DRAWABLE, SecurityReadAccess); + SecurityLookupIDByClass(client, pReadDraw->id, XRC_DRAWABLE, DixReadAccess); } else { pXinReadDraw = pXinDraw; @@ -1139,7 +1139,7 @@ static int MakeCurrent(__GLXclientState *cl, else if (pXinDraw) { pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[s].id, client, - SecurityReadAccess); + DixReadAccess); } #endif else if (pGlxWindow) { @@ -1197,7 +1197,7 @@ static int MakeCurrent(__GLXclientState *cl, else if (pXinReadDraw) { pReadWin = (WindowPtr)SecurityLookupWindow(pXinReadDraw->info[s].id, client, - SecurityReadAccess); + DixReadAccess); } #endif else if (pGlxReadWindow) { @@ -1768,7 +1768,7 @@ static int CreateGLXPixmap(__GLXclientState *cl, to_screen = screenInfo.numScreens - 1; pXinDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, SecurityReadAccess); + SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); } #endif @@ -2014,7 +2014,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag) from_screen = 0; to_screen = screenInfo.numScreens - 1; pXinDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, SecurityReadAccess); + SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); } #endif @@ -2060,7 +2060,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag) else if (pXinDraw) { pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[s].id, client, - SecurityReadAccess); + DixReadAccess); } #endif else if (pGlxWindow) { @@ -3069,7 +3069,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) int nReplyBytes; req = (xGLXQueryContextInfoEXTReq *)pc; - ctx = (__GLXcontext *) SecurityLookupIDByType(client, req->context, __glXContextRes, SecurityReadAccess); + ctx = (__GLXcontext *) SecurityLookupIDByType(client, req->context, __glXContextRes, DixReadAccess); if (!ctx) { client->errorValue = req->context; return __glXBadContext; @@ -3353,7 +3353,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) #ifdef PANORAMIX if (!noPanoramiXExtension) { pXinDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, SecurityReadAccess); + SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); if (!pXinDraw) { client->errorValue = drawId; return __glXBadDrawable; @@ -3361,7 +3361,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[screen].id, client, - SecurityReadAccess); + DixReadAccess); } #endif @@ -3515,7 +3515,7 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) #ifdef PANORAMIX if (!noPanoramiXExtension) { pXinDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, SecurityReadAccess); + SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); if (!pXinDraw) { client->errorValue = drawId; return __glXBadDrawable; @@ -3523,7 +3523,7 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[screen].id, client, - SecurityReadAccess); + DixReadAccess); } #endif diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c index d14b3d800..03e6725ff 100644 --- a/hw/xfree86/dri/xf86dri.c +++ b/hw/xfree86/dri/xf86dri.c @@ -401,7 +401,7 @@ ProcXF86DRICreateDrawable( if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( (Drawable)stuff->drawable, client, - SecurityReadAccess))) { + DixReadAccess))) { return BadValue; } @@ -432,7 +432,7 @@ ProcXF86DRIDestroyDrawable( if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( (Drawable)stuff->drawable, client, - SecurityReadAccess))) { + DixReadAccess))) { return BadValue; } @@ -471,7 +471,7 @@ ProcXF86DRIGetDrawableInfo( if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( (Drawable)stuff->drawable, client, - SecurityReadAccess))) { + DixReadAccess))) { return BadValue; } diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c index 8801f6c42..e9bcea9a8 100755 --- a/hw/xwin/winclipboardwrappers.c +++ b/hw/xwin/winclipboardwrappers.c @@ -345,7 +345,7 @@ winProcSetSelectionOwner (ClientPtr client) { /* Grab the Window from the request */ pWindow = (WindowPtr) SecurityLookupWindow (stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWindow) { ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n"); diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c index 81a161041..ac92e26df 100755 --- a/hw/xwin/winwindowswm.c +++ b/hw/xwin/winwindowswm.c @@ -203,7 +203,7 @@ ProcWindowsWMSelectInput (register ClientPtr client) REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq); pHead = (WMEventPtr *)SecurityLookupIDByType(client, eventResource, - EventType, SecurityWriteAccess); + EventType, DixWriteAccess); if (stuff->mask != 0) { if (pHead) @@ -451,7 +451,7 @@ ProcWindowsWMFrameDraw (register ClientPtr client) ErrorF ("ProcWindowsWMFrameDraw\n"); #endif if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, SecurityReadAccess))) + client, DixReadAccess))) { return BadValue; } @@ -546,7 +546,7 @@ ProcWindowsWMFrameSetTitle( REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq); if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, SecurityReadAccess))) + client, DixReadAccess))) { return BadValue; } diff --git a/include/dix.h b/include/dix.h index a5a570a51..2c87a48c3 100644 --- a/include/dix.h +++ b/include/dix.h @@ -122,13 +122,13 @@ SOFTWARE. } #define VERIFY_DRAWABLE(pDraw, did, client)\ - SECURITY_VERIFY_DRAWABLE(pDraw, did, client, SecurityUnknownAccess) + SECURITY_VERIFY_DRAWABLE(pDraw, did, client, DixUnknownAccess) #define VERIFY_GEOMETRABLE(pDraw, did, client)\ - SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, SecurityUnknownAccess) + SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, DixUnknownAccess) #define VERIFY_GC(pGC, rid, client)\ - SECURITY_VERIFY_GC(pGC, rid, client, SecurityUnknownAccess) + SECURITY_VERIFY_GC(pGC, rid, client, DixUnknownAccess) #else /* not XACE */ @@ -239,8 +239,8 @@ SOFTWARE. if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\ (client->lastDrawableID != drawID))\ {\ - SECURITY_VERIFY_GEOMETRABLE(pDraw, drawID, client, SecurityWriteAccess);\ - SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityReadAccess);\ + SECURITY_VERIFY_GEOMETRABLE(pDraw, drawID, client, DixWriteAccess);\ + SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixReadAccess);\ if ((pGC->depth != pDraw->depth) ||\ (pGC->pScreen != pDraw->pScreen))\ return (BadMatch);\ diff --git a/include/resource.h b/include/resource.h index fd0caaeb5..3231e8cd9 100644 --- a/include/resource.h +++ b/include/resource.h @@ -220,10 +220,11 @@ extern pointer LookupClientResourceComplex( * simultaneously. */ -#define SecurityUnknownAccess 0 /* don't know intentions */ -#define SecurityReadAccess (1<<0) /* inspecting the object */ -#define SecurityWriteAccess (1<<1) /* changing the object */ -#define SecurityDestroyAccess (1<<2) /* destroying the object */ +#define DixUnknownAccess 0 /* don't know intentions */ +#define DixReadAccess (1<<0) /* inspecting the object */ +#define DixWriteAccess (1<<1) /* changing the object */ +#define DixReadWriteAccess (DixReadAccess|DixWriteAccess) +#define DixDestroyAccess (1<<2) /* destroying the object */ extern pointer SecurityLookupIDByType( ClientPtr /*client*/, diff --git a/os/access.c b/os/access.c index d61edeffc..db5ca3135 100644 --- a/os/access.c +++ b/os/access.c @@ -1528,7 +1528,7 @@ AuthorizedClient(ClientPtr client) return TRUE; /* untrusted clients can't change host access */ - if (!XaceHook(XACE_HOSTLIST_ACCESS, client, SecurityWriteAccess)) + if (!XaceHook(XACE_HOSTLIST_ACCESS, client, DixWriteAccess)) return FALSE; return LocalClient(client); diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index e8a7b79e1..d4c96f680 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -457,7 +457,7 @@ ProcRRGetCrtcInfo (ClientPtr client) int i, j, k, n; REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); - crtc = LookupCrtc(client, stuff->crtc, SecurityReadAccess); + crtc = LookupCrtc(client, stuff->crtc, DixReadAccess); if (!crtc) return RRErrorBase + BadRRCrtc; @@ -766,7 +766,7 @@ ProcRRGetCrtcGammaSize (ClientPtr client) int n; REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); - crtc = LookupCrtc (client, stuff->crtc, SecurityReadAccess); + crtc = LookupCrtc (client, stuff->crtc, DixReadAccess); if (!crtc) return RRErrorBase + BadRRCrtc; @@ -793,7 +793,7 @@ ProcRRGetCrtcGamma (ClientPtr client) unsigned long len; REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq); - crtc = LookupCrtc (client, stuff->crtc, SecurityReadAccess); + crtc = LookupCrtc (client, stuff->crtc, DixReadAccess); if (!crtc) return RRErrorBase + BadRRCrtc; @@ -826,7 +826,7 @@ ProcRRSetCrtcGamma (ClientPtr client) CARD16 *red, *green, *blue; REQUEST_SIZE_MATCH(xRRSetCrtcGammaReq); - crtc = LookupCrtc (client, stuff->crtc, SecurityWriteAccess); + crtc = LookupCrtc (client, stuff->crtc, DixWriteAccess); if (!crtc) return RRErrorBase + BadRRCrtc; diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index 6b61b9cd7..b1ec68b83 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -72,12 +72,12 @@ ProcRRSelectInput (ClientPtr client) XID clientResource; REQUEST_SIZE_MATCH(xRRSelectInputReq); - pWin = SecurityLookupWindow (stuff->window, client, SecurityWriteAccess); + pWin = SecurityLookupWindow (stuff->window, client, DixWriteAccess); if (!pWin) return BadWindow; pHead = (RREventPtr *)SecurityLookupIDByType(client, pWin->drawable.id, RREventType, - SecurityWriteAccess); + DixWriteAccess); if (stuff->enable & (RRScreenChangeNotifyMask| RRCrtcChangeNotifyMask| diff --git a/randr/rroutput.c b/randr/rroutput.c index 430f8bdaa..33c4ba534 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -378,7 +378,7 @@ ProcRRGetOutputInfo (ClientPtr client) int i, n; REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); - output = LookupOutput(client, stuff->output, SecurityReadAccess); + output = LookupOutput(client, stuff->output, DixReadAccess); if (!output) return RRErrorBase + BadRROutput; diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 13e848340..56bb39a85 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -313,7 +313,7 @@ ProcRRListOutputProperties (ClientPtr client) REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); - output = LookupOutput (client, stuff->output, SecurityReadAccess); + output = LookupOutput (client, stuff->output, DixReadAccess); if (!output) return RRErrorBase + BadRROutput; @@ -358,7 +358,7 @@ ProcRRQueryOutputProperty (ClientPtr client) REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); - output = LookupOutput (client, stuff->output, SecurityReadAccess); + output = LookupOutput (client, stuff->output, DixReadAccess); if (!output) return RRErrorBase + BadRROutput; @@ -398,7 +398,7 @@ ProcRRConfigureOutputProperty (ClientPtr client) REQUEST_SIZE_MATCH(xRRConfigureOutputPropertyReq); - output = LookupOutput (client, stuff->output, SecurityReadAccess); + output = LookupOutput (client, stuff->output, DixReadAccess); if (!output) return RRErrorBase + BadRROutput; @@ -443,7 +443,7 @@ ProcRRChangeOutputProperty (ClientPtr client) totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xRRChangeOutputPropertyReq, totalSize); - output = LookupOutput (client, stuff->output, SecurityWriteAccess); + output = LookupOutput (client, stuff->output, DixWriteAccess); if (!output) return RRErrorBase + BadRROutput; @@ -475,7 +475,7 @@ ProcRRDeleteOutputProperty (ClientPtr client) REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); UpdateCurrentTime(); - output = LookupOutput (client, stuff->output, SecurityWriteAccess); + output = LookupOutput (client, stuff->output, DixWriteAccess); if (!output) return RRErrorBase + BadRROutput; @@ -504,8 +504,8 @@ ProcRRGetOutputProperty (ClientPtr client) if (stuff->delete) UpdateCurrentTime(); output = LookupOutput (client, stuff->output, - stuff->delete ? SecurityWriteAccess : - SecurityReadAccess); + stuff->delete ? DixWriteAccess : + DixReadAccess); if (!output) return RRErrorBase + BadRROutput; diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 76c16b010..b4004a31f 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -220,7 +220,7 @@ ProcRRGetScreenSizeRange (ClientPtr client) REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return BadWindow; @@ -273,7 +273,7 @@ ProcRRSetScreenSize (ClientPtr client) REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return BadWindow; @@ -332,7 +332,7 @@ ProcRRGetScreenResources (ClientPtr client) REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return BadWindow; @@ -557,7 +557,7 @@ ProcRRGetScreenInfo (ClientPtr client) REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return BadWindow; @@ -731,7 +731,7 @@ ProcRRSetScreenConfig (ClientPtr client) } SECURITY_VERIFY_DRAWABLE(pDraw, stuff->drawable, client, - SecurityWriteAccess); + DixWriteAccess); pScreen = pDraw->pScreen; diff --git a/render/picture.c b/render/picture.c index a3443c20e..e7901e873 100644 --- a/render/picture.c +++ b/render/picture.c @@ -1209,7 +1209,7 @@ ChangePicture (PicturePtr pPicture, pAlpha = (PicturePtr) SecurityLookupIDByType(client, pid, PictureType, - SecurityWriteAccess|SecurityReadAccess); + DixWriteAccess|DixReadAccess); if (!pAlpha) { client->errorValue = pid; @@ -1271,7 +1271,7 @@ ChangePicture (PicturePtr pPicture, pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pid, RT_PIXMAP, - SecurityReadAccess); + DixReadAccess); if (!pPixmap) { client->errorValue = pid; diff --git a/render/render.c b/render/render.c index e4d8d6b32..51a3fa69a 100644 --- a/render/render.c +++ b/render/render.c @@ -554,7 +554,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { @@ -622,11 +622,11 @@ ProcRenderCreatePicture (ClientPtr client) LEGAL_NEW_RESOURCE(stuff->pid, client); SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, - SecurityWriteAccess); + DixWriteAccess); pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->format; @@ -660,7 +660,7 @@ ProcRenderChangePicture (ClientPtr client) int len; REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); len = client->req_len - (sizeof(xRenderChangePictureReq) >> 2); @@ -680,7 +680,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client) int result; REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pPicture->pDrawable) return BadDrawable; @@ -706,7 +706,7 @@ ProcRenderFreePicture (ClientPtr client) REQUEST_SIZE_MATCH(xRenderFreePictureReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityDestroyAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixDestroyAccess, RenderErrBase + BadPicture); FreeResource (stuff->picture, RT_NONE); return(client->noClientException); @@ -736,13 +736,13 @@ ProcRenderComposite (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_ALPHA (pMask, stuff->mask, client, SecurityReadAccess, + VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess, RenderErrBase + BadPicture); if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) || (pMask && pMask->pDrawable && pDst->pDrawable->pScreen != pMask->pDrawable->pScreen)) @@ -782,9 +782,9 @@ ProcRenderTrapezoids (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -795,7 +795,7 @@ ProcRenderTrapezoids (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -829,9 +829,9 @@ ProcRenderTriangles (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -842,7 +842,7 @@ ProcRenderTriangles (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -876,9 +876,9 @@ ProcRenderTriStrip (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -889,7 +889,7 @@ ProcRenderTriStrip (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -923,9 +923,9 @@ ProcRenderTriFan (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -936,7 +936,7 @@ ProcRenderTriFan (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -988,7 +988,7 @@ ProcRenderCreateGlyphSet (ClientPtr client) format = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!format) { client->errorValue = stuff->format; @@ -1036,7 +1036,7 @@ ProcRenderReferenceGlyphSet (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->existing, GlyphSetType, - SecurityWriteAccess); + DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->existing; @@ -1061,7 +1061,7 @@ ProcRenderFreeGlyphSet (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityDestroyAccess); + DixDestroyAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1095,7 +1095,7 @@ ProcRenderAddGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityWriteAccess); + DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1196,7 +1196,7 @@ ProcRenderFreeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityWriteAccess); + DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1251,9 +1251,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -1264,7 +1264,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -1277,7 +1277,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityReadAccess); + DixReadAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1339,7 +1339,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, gs, GlyphSetType, - SecurityReadAccess); + DixReadAccess); if (!glyphSet) { client->errorValue = gs; @@ -1420,7 +1420,7 @@ ProcRenderFillRectangles (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -1486,7 +1486,7 @@ ProcRenderCreateCursor (ClientPtr client) REQUEST_SIZE_MATCH (xRenderCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); if (!pSrc->pDrawable) return BadDrawable; @@ -1668,7 +1668,7 @@ ProcRenderSetPictureTransform (ClientPtr client) int result; REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform); if (client->noClientException != Success) @@ -1694,7 +1694,7 @@ ProcRenderQueryFilters (ClientPtr client) char *names; REQUEST_SIZE_MATCH(xRenderQueryFiltersReq); - SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, SecurityReadAccess); + SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, DixReadAccess); pScreen = pDrawable->pScreen; nbytesName = 0; @@ -1797,7 +1797,7 @@ ProcRenderSetPictureFilter (ClientPtr client) char *name; REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); name = (char *) (stuff + 1); params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3)); @@ -1831,7 +1831,7 @@ ProcRenderCreateAnimCursor (ClientPtr client) for (i = 0; i < ncursor; i++) { cursors[i] = (CursorPtr)SecurityLookupIDByType(client, elt->cursor, - RT_CURSOR, SecurityReadAccess); + RT_CURSOR, DixReadAccess); if (!cursors[i]) { xfree (cursors); @@ -1859,7 +1859,7 @@ ProcRenderAddTraps (ClientPtr client) REQUEST(xRenderAddTrapsReq); REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pPicture->pDrawable) return BadDrawable; @@ -2614,7 +2614,7 @@ PanoramiXRenderCreatePicture (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) return BadAlloc; @@ -2656,7 +2656,7 @@ PanoramiXRenderChangePicture (ClientPtr client) REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2677,7 +2677,7 @@ PanoramiXRenderSetPictureClipRectangles (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2698,7 +2698,7 @@ PanoramiXRenderSetPictureTransform (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2719,7 +2719,7 @@ PanoramiXRenderSetPictureFilter (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2742,7 +2742,7 @@ PanoramiXRenderFreePicture (ClientPtr client) client->errorValue = stuff->picture; - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityDestroyAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess, RenderErrBase + BadPicture); @@ -2768,11 +2768,11 @@ PanoramiXRenderComposite (ClientPtr client) REQUEST_SIZE_MATCH(xRenderCompositeReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_ALPHA (msk, stuff->mask, client, SecurityReadAccess, + VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); orig = *stuff; @@ -2816,9 +2816,9 @@ PanoramiXRenderCompositeGlyphs (ClientPtr client) INT16 xSrc, ySrc; REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (client->req_len << 2 >= (sizeof (xRenderCompositeGlyphsReq) + @@ -2859,7 +2859,7 @@ PanoramiXRenderFillRectangles (ClientPtr client) int extra_len; REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq); if (extra_len && @@ -2906,9 +2906,9 @@ PanoramiXRenderTrapezoids(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTrapezoidsReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq); @@ -2968,9 +2968,9 @@ PanoramiXRenderTriangles(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTrianglesReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq); @@ -3026,9 +3026,9 @@ PanoramiXRenderTriStrip(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTriStripReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq); @@ -3080,9 +3080,9 @@ PanoramiXRenderTriFan(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTriFanReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq); @@ -3136,7 +3136,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderColorTrapezoidsReq); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderColorTrapezoidsReq); @@ -3180,7 +3180,7 @@ PanoramiXRenderColorTriangles(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderColorTrianglesReq); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderColorTrianglesReq); @@ -3226,7 +3226,7 @@ PanoramiXRenderAddTraps (ClientPtr client) INT16 x_off, y_off; REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq); - VERIFY_XIN_PICTURE (picture, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq); if (extra_len && diff --git a/xfixes/cursor.c b/xfixes/cursor.c index c75e74442..21dbcc2cb 100755 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -242,7 +242,7 @@ ProcXFixesSelectCursorInput (ClientPtr client) REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); if (stuff->eventMask & ~CursorAllEvents) @@ -415,7 +415,7 @@ ProcXFixesSetCursorName (ClientPtr client) Atom atom; REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq); - VERIFY_CURSOR(pCursor, stuff->cursor, client, SecurityWriteAccess); + VERIFY_CURSOR(pCursor, stuff->cursor, client, DixWriteAccess); tchar = (char *) &stuff[1]; atom = MakeAtom (tchar, stuff->nbytes, TRUE); if (atom == BAD_RESOURCE) @@ -448,7 +448,7 @@ ProcXFixesGetCursorName (ClientPtr client) int len; REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq); - VERIFY_CURSOR(pCursor, stuff->cursor, client, SecurityReadAccess); + VERIFY_CURSOR(pCursor, stuff->cursor, client, DixReadAccess); if (pCursor->name) str = NameForAtom (pCursor->name); else @@ -679,8 +679,8 @@ ProcXFixesChangeCursor (ClientPtr client) REQUEST(xXFixesChangeCursorReq); REQUEST_SIZE_MATCH(xXFixesChangeCursorReq); - VERIFY_CURSOR (pSource, stuff->source, client, SecurityReadAccess); - VERIFY_CURSOR (pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_CURSOR (pSource, stuff->source, client, DixReadAccess); + VERIFY_CURSOR (pDestination, stuff->destination, client, DixWriteAccess); ReplaceCursor (pSource, TestForCursor, (pointer) pDestination); return (client->noClientException); @@ -714,7 +714,7 @@ ProcXFixesChangeCursorByName (ClientPtr client) REQUEST(xXFixesChangeCursorByNameReq); REQUEST_FIXED_SIZE(xXFixesChangeCursorByNameReq, stuff->nbytes); - VERIFY_CURSOR(pSource, stuff->source, client, SecurityReadAccess); + VERIFY_CURSOR(pSource, stuff->source, client, DixReadAccess); tchar = (char *) &stuff[1]; name = MakeAtom (tchar, stuff->nbytes, FALSE); if (name) diff --git a/xfixes/region.c b/xfixes/region.c index 68c701553..a004fc0ca 100755 --- a/xfixes/region.c +++ b/xfixes/region.c @@ -118,7 +118,7 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client) pPixmap = (PixmapPtr) SecurityLookupIDByType (client, stuff->bitmap, RT_PIXMAP, - SecurityReadAccess); + DixReadAccess); if (!pPixmap) { client->errorValue = stuff->bitmap; @@ -225,7 +225,7 @@ ProcXFixesCreateRegionFromGC (ClientPtr client) REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq); LEGAL_NEW_RESOURCE (stuff->region, client); - SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityReadAccess); + SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixReadAccess); switch (pGC->clientClipType) { case CT_PIXMAP: @@ -273,7 +273,7 @@ ProcXFixesCreateRegionFromPicture (ClientPtr client) REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq); LEGAL_NEW_RESOURCE (stuff->region, client); - VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityReadAccess, + VERIFY_PICTURE(pPicture, stuff->picture, client, DixReadAccess, RenderErrBase + BadPicture); switch (pPicture->clientClipType) { @@ -321,7 +321,7 @@ ProcXFixesDestroyRegion (ClientPtr client) RegionPtr pRegion; REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq); - VERIFY_REGION(pRegion, stuff->region, client, SecurityWriteAccess); + VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); FreeResource (stuff->region, RT_NONE); return(client->noClientException); } @@ -346,7 +346,7 @@ ProcXFixesSetRegion (ClientPtr client) REQUEST (xXFixesSetRegionReq); REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq); - VERIFY_REGION(pRegion, stuff->region, client, SecurityWriteAccess); + VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq); if (things & 4) @@ -384,8 +384,8 @@ ProcXFixesCopyRegion (ClientPtr client) RegionPtr pSource, pDestination; REQUEST (xXFixesCopyRegionReq); - VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); if (!REGION_COPY(pScreen, pDestination, pSource)) return BadAlloc; @@ -414,9 +414,9 @@ ProcXFixesCombineRegion (ClientPtr client) REQUEST (xXFixesCombineRegionReq); REQUEST_SIZE_MATCH (xXFixesCombineRegionReq); - VERIFY_REGION(pSource1, stuff->source1, client, SecurityReadAccess); - VERIFY_REGION(pSource2, stuff->source2, client, SecurityReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_REGION(pSource1, stuff->source1, client, DixReadAccess); + VERIFY_REGION(pSource2, stuff->source2, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); switch (stuff->xfixesReqType) { case X_XFixesUnionRegion: @@ -461,8 +461,8 @@ ProcXFixesInvertRegion (ClientPtr client) REQUEST(xXFixesInvertRegionReq); REQUEST_SIZE_MATCH(xXFixesInvertRegionReq); - VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); /* Compute bounds, limit to 16 bits */ bounds.x1 = stuff->x; @@ -509,7 +509,7 @@ ProcXFixesTranslateRegion (ClientPtr client) REQUEST(xXFixesTranslateRegionReq); REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq); - VERIFY_REGION(pRegion, stuff->region, client, SecurityWriteAccess); + VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); REGION_TRANSLATE(pScreen, pRegion, stuff->dx, stuff->dy); return (client->noClientException); @@ -536,8 +536,8 @@ ProcXFixesRegionExtents (ClientPtr client) REQUEST(xXFixesRegionExtentsReq); REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq); - VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); REGION_RESET (0, pDestination, REGION_EXTENTS (0, pSource)); @@ -569,7 +569,7 @@ ProcXFixesFetchRegion (ClientPtr client) REQUEST(xXFixesFetchRegionReq); REQUEST_SIZE_MATCH(xXFixesFetchRegionReq); - VERIFY_REGION(pRegion, stuff->region, client, SecurityReadAccess); + VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess); pExtent = REGION_EXTENTS (0, pRegion); pBox = REGION_RECTS (pRegion); @@ -633,8 +633,8 @@ ProcXFixesSetGCClipRegion (ClientPtr client) REQUEST(xXFixesSetGCClipRegionReq); REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq); - SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityWriteAccess); - VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, SecurityReadAccess); + SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixWriteAccess); + VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, DixReadAccess); if (pRegion) { @@ -685,7 +685,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client) client->errorValue = stuff->dest; return BadWindow; } - VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, SecurityWriteAccess); + VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess); pScreen = pWin->drawable.pScreen; switch (stuff->destKind) { case ShapeBounding: @@ -775,11 +775,11 @@ ProcXFixesSetPictureClipRegion (ClientPtr client) REQUEST(xXFixesSetPictureClipRegionReq); REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq); - VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); pScreen = pPicture->pDrawable->pScreen; ps = GetPictureScreen (pScreen); - VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, SecurityReadAccess); + VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess); return SetPictureClipRegion (pPicture, stuff->xOrigin, stuff->yOrigin, pRegion); @@ -815,8 +815,8 @@ ProcXFixesExpandRegion (ClientPtr client) int i; REQUEST_SIZE_MATCH (xXFixesExpandRegionReq); - VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); nBoxes = REGION_NUM_RECTS(pSource); pSrc = REGION_RECTS(pSource); diff --git a/xfixes/saveset.c b/xfixes/saveset.c index 9ebf24584..9ad2627c0 100755 --- a/xfixes/saveset.c +++ b/xfixes/saveset.c @@ -38,7 +38,7 @@ ProcXFixesChangeSaveSet(ClientPtr client) REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) diff --git a/xfixes/select.c b/xfixes/select.c index 4c7a49def..a718715a1 100755 --- a/xfixes/select.c +++ b/xfixes/select.c @@ -196,7 +196,7 @@ ProcXFixesSelectSelectionInput (ClientPtr client) REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); + DixReadAccess); if (!pWin) return(BadWindow); if (stuff->eventMask & ~SelectionAllEvents) -- cgit v1.2.3 From 60cdc592fe042c03ceb5d4c3344acfbbf5d8ae28 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 14 Dec 2006 14:46:03 -0500 Subject: Add new, combined dix lookup functions. --- dix/dixutils.c | 176 ++++++++++++++++++++++++--------------------- hw/xfree86/loader/dixsym.c | 12 ++-- include/dix.h | 73 +++++++++---------- include/pixmap.h | 10 +++ 4 files changed, 146 insertions(+), 125 deletions(-) diff --git a/dix/dixutils.c b/dix/dixutils.c index fca55d99f..f9980c5a8 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -194,115 +194,129 @@ CompareISOLatin1Lowered(unsigned char *s1, int s1len, return (int) c1 - (int) c2; } -#ifdef XACE - -/* SecurityLookupWindow and SecurityLookupDrawable: - * Look up the window/drawable taking into account the client doing - * the lookup and the type of access desired. Return the window/drawable - * if it exists and the client is allowed access, else return NULL. - * Most Proc* functions should be calling these instead of - * LookupWindow and LookupDrawable, which do no access checks. - * XACE note: need to see if client->lastDrawableID can still be used here. +/* + * dixLookupWindow and dixLookupDrawable: + * Look up the window/drawable taking into account the client doing the + * lookup, the type of drawable desired, and the type of access desired. + * Return Success with *pDraw set if the window/drawable exists and the client + * is allowed access, else return an error code with *pDraw set to NULL. The + * access mask values are defined in resource.h. The type mask values are + * defined in pixmap.h, with zero equivalent to M_DRAWABLE. */ +_X_EXPORT int +dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, + Mask type, Mask access) +{ + DrawablePtr pTmp; + RESTYPE rtype; + *pDraw = NULL; + client->errorValue = id; + + if (id == INVALID) + return BadDrawable; + + if (id == client->lastDrawableID) { + pTmp = client->lastDrawable; + + /* an access check is required for cached drawables */ + rtype = (pTmp->type | M_WINDOW) ? RT_WINDOW : RT_PIXMAP; + if (!XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, access, pTmp)) + return BadDrawable; + } else + pTmp = (DrawablePtr)SecurityLookupIDByClass(client, id, RC_DRAWABLE, + access); + if (!pTmp) + return BadDrawable; + if (!((1 << pTmp->type) | (type ? type : M_DRAWABLE))) + return BadMatch; + + if (pTmp->type | M_DRAWABLE) { + client->lastDrawable = pTmp; + client->lastDrawableID = id; + client->lastGCID = INVALID; + client->lastGC = (GCPtr)NULL; + } + *pDraw = pTmp; + return Success; +} -_X_EXPORT WindowPtr -SecurityLookupWindow(XID rid, ClientPtr client, Mask access_mode) +_X_EXPORT int +dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access) { - client->errorValue = rid; - if(rid == INVALID) - return NULL; - return (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode); + int rc; + rc = dixLookupDrawable((DrawablePtr*)pWin, id, client, M_WINDOW, access); + return (rc == BadDrawable) ? BadWindow : rc; } +_X_EXPORT int +dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access) +{ + GCPtr pTmp = (GCPtr)SecurityLookupIDByType(client, id, RT_GC, access); + if (pTmp) { + *pGC = pTmp; + return Success; + } + client->errorValue = id; + *pGC = NULL; + return BadGC; +} -_X_EXPORT pointer -SecurityLookupDrawable(XID rid, ClientPtr client, Mask access_mode) +_X_EXPORT int +dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client) { - register DrawablePtr pDraw; + pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY, + DixReadAccess); + int clientIndex = CLIENT_ID(rid); - if(rid == INVALID) - return (pointer) NULL; - pDraw = (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE, - access_mode); - if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW)) - return (pointer)pDraw; - return (pointer)NULL; + if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) { + *pClient = clients[clientIndex]; + return Success; + } + *pClient = NULL; + return BadValue; } -/* We can't replace the LookupWindow and LookupDrawable functions with - * macros because of compatibility with loadable servers. +/* + * These are deprecated compatibility functions and will be removed soon! + * Please use the new dixLookup*() functions above. */ - _X_EXPORT WindowPtr -LookupWindow(XID rid, ClientPtr client) +SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode) { - return SecurityLookupWindow(rid, client, DixUnknownAccess); + WindowPtr pWin; + int i = dixLookupWindow(&pWin, id, client, access_mode); + return (i == Success) ? pWin : NULL; } -_X_EXPORT pointer -LookupDrawable(XID rid, ClientPtr client) +_X_EXPORT WindowPtr +LookupWindow(XID id, ClientPtr client) { - return SecurityLookupDrawable(rid, client, DixUnknownAccess); + return SecurityLookupWindow(id, client, DixUnknownAccess); } -#else /* not XACE */ - -WindowPtr -LookupWindow(XID rid, ClientPtr client) +_X_EXPORT pointer +SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode) { - WindowPtr pWin; - - client->errorValue = rid; - if(rid == INVALID) - return NULL; - if (client->lastDrawableID == rid) - { - if (client->lastDrawable->type == DRAWABLE_WINDOW) - return ((WindowPtr) client->lastDrawable); - return (WindowPtr) NULL; - } - pWin = (WindowPtr)LookupIDByType(rid, RT_WINDOW); - if (pWin && pWin->drawable.type == DRAWABLE_WINDOW) { - client->lastDrawable = (DrawablePtr) pWin; - client->lastDrawableID = rid; - client->lastGCID = INVALID; - client->lastGC = (GCPtr)NULL; - } - return pWin; + DrawablePtr pDraw; + int i = dixLookupDrawable(&pDraw, id, client, access_mode, TRUE); + return (i == Success) ? pDraw : NULL; } - -pointer -LookupDrawable(XID rid, ClientPtr client) +_X_EXPORT pointer +LookupDrawable(XID id, ClientPtr client) { - register DrawablePtr pDraw; - - if(rid == INVALID) - return (pointer) NULL; - if (client->lastDrawableID == rid) - return ((pointer) client->lastDrawable); - pDraw = (DrawablePtr)LookupIDByClass(rid, RC_DRAWABLE); - if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW)) - return (pointer)pDraw; - return (pointer)NULL; + return SecurityLookupDrawable(id, client, DixUnknownAccess); } -#endif /* XACE */ - _X_EXPORT ClientPtr -LookupClient(XID rid, ClientPtr client) +LookupClient(XID id, ClientPtr client) { - pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY, - DixReadAccess); - int clientIndex = CLIENT_ID(rid); - - if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) - { - return clients[clientIndex]; - } - return (ClientPtr)NULL; + ClientPtr pClient; + int i = dixLookupClient(&pClient, id, client); + return (i == Success) ? pClient : NULL; } +/* end deprecated functions */ int AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode, diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c index 27a3093b1..32e0e4f68 100644 --- a/hw/xfree86/loader/dixsym.c +++ b/hw/xfree86/loader/dixsym.c @@ -155,17 +155,21 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(CompareTimeStamps) SYMFUNC(CopyISOLatin1Lowered) SYMFUNC(DeleteCallback) + SYMFUNC(dixLookupDrawable) + SYMFUNC(dixLookupWindow) + SYMFUNC(dixLookupClient) + SYMFUNC(dixLookupGC) + /* following are deprecated */ SYMFUNC(LookupClient) SYMFUNC(LookupDrawable) SYMFUNC(LookupWindow) + SYMFUNC(SecurityLookupDrawable) + SYMFUNC(SecurityLookupWindow) + /* end deprecated */ SYMFUNC(NoopDDA) SYMFUNC(QueueWorkProc) SYMFUNC(RegisterBlockAndWakeupHandlers) SYMFUNC(RemoveBlockAndWakeupHandlers) -#ifdef XACE - SYMFUNC(SecurityLookupDrawable) - SYMFUNC(SecurityLookupWindow) -#endif /* events.c */ SYMFUNC(CheckCursorConfinement) SYMFUNC(DeliverEvents) diff --git a/include/dix.h b/include/dix.h index 2c87a48c3..09d5fef95 100644 --- a/include/dix.h +++ b/include/dix.h @@ -375,47 +375,40 @@ extern int CompareISOLatin1Lowered( unsigned char * /*b*/, int blen); -#ifdef XACE - -extern WindowPtr SecurityLookupWindow( - XID /*rid*/, - ClientPtr /*client*/, - Mask /*access_mode*/); - -extern pointer SecurityLookupDrawable( - XID /*rid*/, - ClientPtr /*client*/, - Mask /*access_mode*/); - -extern WindowPtr LookupWindow( - XID /*rid*/, - ClientPtr /*client*/); - -extern pointer LookupDrawable( - XID /*rid*/, - ClientPtr /*client*/); - -#else - -extern WindowPtr LookupWindow( - XID /*rid*/, - ClientPtr /*client*/); - -extern pointer LookupDrawable( - XID /*rid*/, - ClientPtr /*client*/); - -#define SecurityLookupWindow(rid, client, access_mode) \ - LookupWindow(rid, client) - -#define SecurityLookupDrawable(rid, client, access_mode) \ - LookupDrawable(rid, client) - -#endif /* XACE */ +extern int dixLookupWindow( + WindowPtr *result, + XID id, + ClientPtr client, + Mask access_mode); + +extern int dixLookupDrawable( + DrawablePtr *result, + XID id, + ClientPtr client, + Mask type_mask, + Mask access_mode); + +extern int dixLookupGC( + GCPtr *result, + XID id, + ClientPtr client, + Mask access_mode); + +extern int dixLookupClient( + ClientPtr *result, + XID id, + ClientPtr client); -extern ClientPtr LookupClient( - XID /*rid*/, - ClientPtr /*client*/); +/* + * These are deprecated compatibility functions and will be removed soon! + * Please use the new dixLookup*() functions above. + */ +extern WindowPtr SecurityLookupWindow(XID, ClientPtr, Mask); +extern WindowPtr LookupWindow(XID, ClientPtr); +extern pointer SecurityLookupDrawable(XID, ClientPtr, Mask); +extern pointer LookupDrawable(XID, ClientPtr); +extern ClientPtr LookupClient(XID, ClientPtr); +/* end deprecated functions */ extern void NoopDDA(void); diff --git a/include/pixmap.h b/include/pixmap.h index 3276fadb6..19e682a50 100644 --- a/include/pixmap.h +++ b/include/pixmap.h @@ -58,6 +58,16 @@ SOFTWARE. #define UNDRAWABLE_WINDOW 2 #define DRAWABLE_BUFFER 3 +/* corresponding type masks for dixLookupDrawable() */ +#define M_DRAWABLE_WINDOW (1<<0) +#define M_DRAWABLE_PIXMAP (1<<1) +#define M_UNDRAWABLE_WINDOW (1<<2) +#define M_DRAWABLE_BUFFER (1<<3) +#define M_ANY (-1) +#define M_WINDOW (M_DRAWABLE_WINDOW|M_UNDRAWABLE_WINDOW) +#define M_DRAWABLE (M_DRAWABLE_WINDOW|M_DRAWABLE_PIXMAP|M_DRAWABLE_BUFFER) +#define M_UNDRAWABLE (M_UNDRAWABLE_WINDOW) + /* flags to PaintWindow() */ #define PW_BACKGROUND 0 #define PW_BORDER 1 -- cgit v1.2.3 From ab1886df73b73360fa3bd7ce8e01affc074cbc8d Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 14 Dec 2006 15:42:19 -0500 Subject: Add new, combined dix lookup functions (tweak). --- dix/dixutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/dixutils.c b/dix/dixutils.c index f9980c5a8..3479ddccf 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -298,7 +298,7 @@ _X_EXPORT pointer SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode) { DrawablePtr pDraw; - int i = dixLookupDrawable(&pDraw, id, client, access_mode, TRUE); + int i = dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode); return (i == Success) ? pDraw : NULL; } -- cgit v1.2.3 From 0cf75e74322e2b6a6efc7acf892e04365fde503b Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 14 Dec 2006 17:27:12 -0500 Subject: Remove instances of macros LOOKUP_DRAWABLE and VERIFY_DRAWABLE. --- Xext/panoramiXprocs.c | 25 ++++++++++++++++++------- Xext/shm.c | 24 +++++++++++++++++------- Xext/xvdisp.c | 23 ++++++++++------------- 3 files changed, 45 insertions(+), 27 deletions(-) diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 683308425..77a2384c4 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -1028,10 +1028,14 @@ int PanoramiXCopyArea(ClientPtr client) DrawablePtr pDst; GCPtr pGC; char *data; - int pitch; + int pitch, rc; - FOR_NSCREENS(j) - VERIFY_DRAWABLE(drawables[j], src->info[j].id, client); + FOR_NSCREENS(j) { + rc = dixLookupDrawable(drawables+j, src->info[j].id, client, 0, + DixUnknownAccess); + if (rc != Success) + return rc; + } pitch = PixmapBytePad(stuff->width, drawables[0]->depth); if(!(data = xcalloc(1, stuff->height * pitch))) @@ -1754,7 +1758,7 @@ int PanoramiXGetImage(ClientPtr client) xGetImageReply xgi; Bool isRoot; char *pBuf; - int i, x, y, w, h, format; + int i, x, y, w, h, format, rc; Mask plane = 0, planemask; int linesDone, nlines, linesPerBuf; long widthBytesLine, length; @@ -1775,7 +1779,10 @@ int PanoramiXGetImage(ClientPtr client) if(draw->type == XRT_PIXMAP) return (*SavedProcVector[X_GetImage])(client); - VERIFY_DRAWABLE(pDraw, stuff->drawable, client); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixUnknownAccess); + if (rc != Success) + return rc; if(!((WindowPtr)pDraw)->realized) return(BadMatch); @@ -1809,8 +1816,12 @@ int PanoramiXGetImage(ClientPtr client) } drawables[0] = pDraw; - for(i = 1; i < PanoramiXNumScreens; i++) - VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client); + for(i = 1; i < PanoramiXNumScreens; i++) { + rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0, + DixUnknownAccess); + if (rc != Success) + return rc; + } xgi.visual = wVisual (((WindowPtr) pDraw)); xgi.type = X_Reply; diff --git a/Xext/shm.c b/Xext/shm.c index 0c2299a61..049c746d6 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -606,7 +606,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) DrawablePtr pDraw; xShmGetImageReply xgi; ShmDescPtr shmdesc; - int i, x, y, w, h, format; + int i, x, y, w, h, format, rc; Mask plane = 0, planemask; long lenPer = 0, length, widthBytesLine; Bool isRoot; @@ -627,7 +627,10 @@ ProcPanoramiXShmGetImage(ClientPtr client) if (draw->type == XRT_PIXMAP) return ProcShmGetImage(client); - VERIFY_DRAWABLE(pDraw, stuff->drawable, client); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixUnknownAccess); + if (rc != Success) + return rc; VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); @@ -660,8 +663,12 @@ ProcPanoramiXShmGetImage(ClientPtr client) } drawables[0] = pDraw; - for(i = 1; i < PanoramiXNumScreens; i++) - VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client); + for(i = 1; i < PanoramiXNumScreens; i++) { + rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0, + DixUnknownAccess); + if (rc != Success) + return rc; + } xgi.visual = wVisual(((WindowPtr)pDraw)); xgi.type = X_Reply; @@ -909,12 +916,12 @@ static int ProcShmGetImage(client) register ClientPtr client; { - register DrawablePtr pDraw; + DrawablePtr pDraw; long lenPer = 0, length; Mask plane = 0; xShmGetImageReply xgi; ShmDescPtr shmdesc; - int n; + int n, rc; REQUEST(xShmGetImageReq); @@ -924,7 +931,10 @@ ProcShmGetImage(client) client->errorValue = stuff->format; return(BadValue); } - VERIFY_DRAWABLE(pDraw, stuff->drawable, client); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixUnknownAccess); + if (rc != Success) + return rc; VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); if (pDraw->type == DRAWABLE_WINDOW) { diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index ec2b4f8d7..d66604471 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -717,15 +717,14 @@ ProcXvGetStill(ClientPtr client) static int ProcXvSelectVideoNotify(ClientPtr client) { - register DrawablePtr pDraw; + DrawablePtr pDraw; + int rc; REQUEST(xvSelectVideoNotifyReq); REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq); - if(!(pDraw = (DrawablePtr)LOOKUP_DRAWABLE(stuff->drawable, client) )) - { - client->errorValue = stuff->drawable; - return (BadWindow); - } + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixUnknownAccess); + if (rc != Success) + return rc; return XVCALL(diSelectVideoNotify)(client, pDraw, stuff->onoff); @@ -822,8 +821,8 @@ ProcXvUngrabPort(ClientPtr client) static int ProcXvStopVideo(ClientPtr client) { - int status; - register DrawablePtr pDraw; + int status, rc; + DrawablePtr pDraw; XvPortPtr pPort; REQUEST(xvStopVideoReq); REQUEST_SIZE_MATCH(xvStopVideoReq); @@ -840,11 +839,9 @@ ProcXvStopVideo(ClientPtr client) return (status); } - if(!(pDraw = LOOKUP_DRAWABLE(stuff->drawable, client) )) - { - client->errorValue = stuff->drawable; - return (BadDrawable); - } + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixUnknownAccess); + if (rc != Success) + return rc; return XVCALL(diStopVideo)(client, pPort, pDraw); -- cgit v1.2.3 From 51b69ff499c05f59cb1e577c4e8abf6f7f283b3e Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 14 Dec 2006 17:53:43 -0500 Subject: Remove instances of macro SECURITY_VERIFY_DRAWABLE. --- Xext/panoramiXprocs.c | 17 ++++++++++++----- damageext/damageext.c | 8 ++++++-- dix/dispatch.c | 36 ++++++++++++++++++++++++------------ randr/rrscreen.c | 7 ++++--- render/render.c | 19 +++++++++++-------- 5 files changed, 57 insertions(+), 30 deletions(-) diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 77a2384c4..2bf94a998 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -1069,6 +1069,7 @@ int PanoramiXCopyArea(ClientPtr client) DrawablePtr pDst = NULL, pSrc = NULL; GCPtr pGC = NULL; RegionPtr pRgn[MAXSCREENS]; + int rc; FOR_NSCREENS_BACKWARD(j) { stuff->dstDrawable = dst->info[j].id; @@ -1085,8 +1086,11 @@ int PanoramiXCopyArea(ClientPtr client) VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { - SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client, - DixReadAccess); + rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; + if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) { client->errorValue = stuff->dstDrawable; @@ -1137,7 +1141,7 @@ int PanoramiXCopyArea(ClientPtr client) int PanoramiXCopyPlane(ClientPtr client) { - int j, srcx, srcy, dstx, dsty; + int j, srcx, srcy, dstx, dsty, rc; PanoramiXRes *gc, *src, *dst; Bool srcIsRoot = FALSE; Bool dstIsRoot = FALSE; @@ -1191,8 +1195,11 @@ int PanoramiXCopyPlane(ClientPtr client) VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { - SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client, - DixReadAccess); + rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; + if (pdstDraw->pScreen != psrcDraw->pScreen) { client->errorValue = stuff->dstDrawable; return (BadMatch); diff --git a/damageext/damageext.c b/damageext/damageext.c index c8f28e953..6083693a4 100755 --- a/damageext/damageext.c +++ b/damageext/damageext.c @@ -173,13 +173,17 @@ ProcDamageCreate (ClientPtr client) DamageExtPtr pDamageExt; DamageReportLevel level; RegionPtr pRegion; + int rc; REQUEST(xDamageCreateReq); REQUEST_SIZE_MATCH(xDamageCreateReq); LEGAL_NEW_RESOURCE(stuff->damage, client); - SECURITY_VERIFY_DRAWABLE (pDrawable, stuff->drawable, client, - DixReadAccess); + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; + switch (stuff->level) { case XDamageReportRawRectangles: level = DamageReportRawRegion; diff --git a/dix/dispatch.c b/dix/dispatch.c index a3de07fed..8134cd5a5 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1597,17 +1597,19 @@ ProcFreePixmap(register ClientPtr client) int ProcCreateGC(register ClientPtr client) { - int error; + int error, rc; GC *pGC; - register DrawablePtr pDraw; + DrawablePtr pDraw; unsigned len; REQUEST(xCreateGCReq); REQUEST_AT_LEAST_SIZE(xCreateGCReq); client->errorValue = stuff->gc; LEGAL_NEW_RESOURCE(stuff->gc, client); - SECURITY_VERIFY_DRAWABLE (pDraw, stuff->drawable, client, - DixReadAccess); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess); + if (rc != Success) + return rc; + len = client->req_len - (sizeof(xCreateGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; @@ -1766,18 +1768,21 @@ int ProcCopyArea(register ClientPtr client) { register DrawablePtr pDst; - register DrawablePtr pSrc; + DrawablePtr pSrc; register GC *pGC; REQUEST(xCopyAreaReq); RegionPtr pRgn; + int rc; REQUEST_SIZE_MATCH(xCopyAreaReq); VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { - SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client, + rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0, DixReadAccess); + if (rc != Success) + return rc; if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) { client->errorValue = stuff->dstDrawable; @@ -1806,18 +1811,22 @@ ProcCopyArea(register ClientPtr client) int ProcCopyPlane(register ClientPtr client) { - register DrawablePtr psrcDraw, pdstDraw; + DrawablePtr psrcDraw, pdstDraw; register GC *pGC; REQUEST(xCopyPlaneReq); RegionPtr pRgn; + int rc; REQUEST_SIZE_MATCH(xCopyPlaneReq); VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { - SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client, - DixReadAccess); + rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; + if (pdstDraw->pScreen != psrcDraw->pScreen) { client->errorValue = stuff->dstDrawable; @@ -2142,8 +2151,8 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, int x, int y, int width, int height, Mask planemask, xGetImageReply **im_return) { - register DrawablePtr pDraw; - int nlines, linesPerBuf; + DrawablePtr pDraw; + int nlines, linesPerBuf, rc; register int linesDone; long widthBytesLine, length; Mask plane = 0; @@ -2156,7 +2165,10 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, client->errorValue = format; return(BadValue); } - SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, DixReadAccess); + rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixReadAccess); + if (rc != Success) + return rc; + if(pDraw->type == DRAWABLE_WINDOW) { if( /* check for being viewable */ diff --git a/randr/rrscreen.c b/randr/rrscreen.c index b4004a31f..3b9263bc4 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -703,7 +703,7 @@ ProcRRSetScreenConfig (ClientPtr client) REQUEST(xRRSetScreenConfigReq); xRRSetScreenConfigReply rep; DrawablePtr pDraw; - int n; + int n, rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; TimeStamp configTime; @@ -730,8 +730,9 @@ ProcRRSetScreenConfig (ClientPtr client) has_rate = FALSE; } - SECURITY_VERIFY_DRAWABLE(pDraw, stuff->drawable, client, - DixWriteAccess); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess); + if (rc != Success) + return rc; pScreen = pDraw->pScreen; diff --git a/render/render.c b/render/render.c index 51a3fa69a..126d08daf 100644 --- a/render/render.c +++ b/render/render.c @@ -614,15 +614,17 @@ ProcRenderCreatePicture (ClientPtr client) PicturePtr pPicture; DrawablePtr pDrawable; PictFormatPtr pFormat; - int len; - int error; + int len, error, rc; REQUEST(xRenderCreatePictureReq); REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); LEGAL_NEW_RESOURCE(stuff->pid, client); - SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, - DixWriteAccess); + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixWriteAccess); + if (rc != Success) + return rc; + pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, @@ -1687,14 +1689,15 @@ ProcRenderQueryFilters (ClientPtr client) int nnames; ScreenPtr pScreen; PictureScreenPtr ps; - int i, j; - int len; - int total_bytes; + int i, j, len, total_bytes, rc; INT16 *aliases; char *names; REQUEST_SIZE_MATCH(xRenderQueryFiltersReq); - SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, DixReadAccess); + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; pScreen = pDrawable->pScreen; nbytesName = 0; -- cgit v1.2.3 From 5e334f06a1ef89891f9df2a371e4662340bec26b Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 14 Dec 2006 18:27:09 -0500 Subject: Remove instances of macros VERIFY_GEOMETRABLE and VERIFY_GC. --- Xext/panoramiXprocs.c | 6 +++++- Xext/shm.c | 18 +++++++++++++----- Xext/xf86bigfont.c | 1 - dix/dispatch.c | 1 - 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 2bf94a998..a193c4188 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -531,10 +531,14 @@ int PanoramiXGetGeometry(ClientPtr client) { xGetGeometryReply rep; DrawablePtr pDraw; + int rc; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - VERIFY_GEOMETRABLE (pDraw, stuff->id, client); + rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixUnknownAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; diff --git a/Xext/shm.c b/Xext/shm.c index 049c746d6..4e733197c 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -727,7 +727,7 @@ ProcPanoramiXShmCreatePixmap( PixmapPtr pMap = NULL; DrawablePtr pDraw; DepthPtr pDepth; - int i, j, result; + int i, j, result, rc; ShmDescPtr shmdesc; REQUEST(xShmCreatePixmapReq); PanoramiXRes *newPix; @@ -737,7 +737,11 @@ ProcPanoramiXShmCreatePixmap( if (!sharedPixmaps) return BadImplementation; LEGAL_NEW_RESOURCE(stuff->pid, client); - VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, + DixUnknownAccess); + if (rc != Success) + return rc; + VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); if (!stuff->width || !stuff->height) { @@ -1052,9 +1056,9 @@ ProcShmCreatePixmap(client) register ClientPtr client; { PixmapPtr pMap; - register DrawablePtr pDraw; + DrawablePtr pDraw; DepthPtr pDepth; - register int i; + register int i, rc; ShmDescPtr shmdesc; REQUEST(xShmCreatePixmapReq); @@ -1063,7 +1067,11 @@ ProcShmCreatePixmap(client) if (!sharedPixmaps) return BadImplementation; LEGAL_NEW_RESOURCE(stuff->pid, client); - VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, + DixUnknownAccess); + if (rc != Success) + return rc; + VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); if (!stuff->width || !stuff->height) { diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index 44647060a..f50481f78 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -447,7 +447,6 @@ ProcXF86BigfontQueryFont( pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, DixReadAccess); if (!pFont) { - /* can't use VERIFY_GC because it might return BadGC */ GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, DixReadAccess); if (!pGC) { diff --git a/dix/dispatch.c b/dix/dispatch.c index 8134cd5a5..a5a1d0374 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1385,7 +1385,6 @@ ProcQueryFont(register ClientPtr client) DixReadAccess); if (!pFont) { - /* can't use VERIFY_GC because it might return BadGC */ pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, DixReadAccess); if (!pGC) -- cgit v1.2.3 From 00f0705b3bb444ac934fc902cd23130f1777eab2 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 14 Dec 2006 19:15:21 -0500 Subject: Remove instances of macros SECURITY_VERIFY_GEOMETRABLE and SECURITY_VERIFY_GC. --- Xext/shm.c | 4 +- Xext/xvdisp.c | 16 +++---- dix/dispatch.c | 132 +++++++++++++++++++++++++++++++++----------------------- include/dix.h | 13 ++++-- xfixes/region.c | 13 ++++-- 5 files changed, 108 insertions(+), 70 deletions(-) diff --git a/Xext/shm.c b/Xext/shm.c index 4e733197c..7cfaa6808 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -816,8 +816,8 @@ static int ProcShmPutImage(client) register ClientPtr client; { - register GCPtr pGC; - register DrawablePtr pDraw; + GCPtr pGC; + DrawablePtr pDraw; long length; ShmDescPtr shmdesc; REQUEST(xShmPutImageReq); diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index d66604471..2afb7c687 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -531,9 +531,9 @@ ProcXvQueryEncodings(ClientPtr client) static int ProcXvPutVideo(ClientPtr client) { - register DrawablePtr pDraw; + DrawablePtr pDraw; XvPortPtr pPort; - register GCPtr pGC; + GCPtr pGC; int status; REQUEST(xvPutVideoReq); @@ -577,9 +577,9 @@ ProcXvPutVideo(ClientPtr client) static int ProcXvPutStill(ClientPtr client) { - register DrawablePtr pDraw; + DrawablePtr pDraw; XvPortPtr pPort; - register GCPtr pGC; + GCPtr pGC; int status; REQUEST(xvPutStillReq); @@ -624,9 +624,9 @@ ProcXvPutStill(ClientPtr client) static int ProcXvGetVideo(ClientPtr client) { - register DrawablePtr pDraw; + DrawablePtr pDraw; XvPortPtr pPort; - register GCPtr pGC; + GCPtr pGC; int status; REQUEST(xvGetVideoReq); @@ -671,9 +671,9 @@ ProcXvGetVideo(ClientPtr client) static int ProcXvGetStill(ClientPtr client) { - register DrawablePtr pDraw; + DrawablePtr pDraw; XvPortPtr pPort; - register GCPtr pGC; + GCPtr pGC; int status; REQUEST(xvGetStillReq); diff --git a/dix/dispatch.c b/dix/dispatch.c index a5a1d0374..0421886a0 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -843,11 +843,15 @@ ProcCirculateWindow(register ClientPtr client) int GetGeometry(register ClientPtr client, xGetGeometryReply *rep) { - register DrawablePtr pDraw; + DrawablePtr pDraw; + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, DixReadAccess); + + rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixReadAccess); + if (rc != Success) + return rc; + rep->type = X_Reply; rep->length = 0; rep->sequenceNumber = client->sequence; @@ -1516,16 +1520,20 @@ int ProcCreatePixmap(register ClientPtr client) { PixmapPtr pMap; - register DrawablePtr pDraw; + DrawablePtr pDraw; REQUEST(xCreatePixmapReq); DepthPtr pDepth; - register int i; + register int i, rc; REQUEST_SIZE_MATCH(xCreatePixmapReq); client->errorValue = stuff->pid; LEGAL_NEW_RESOURCE(stuff->pid, client); - SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client, - DixReadAccess); + + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, + DixReadAccess); + if (rc != Success) + return rc; + if (!stuff->width || !stuff->height) { client->errorValue = 0; @@ -1625,12 +1633,15 @@ int ProcChangeGC(register ClientPtr client) { GC *pGC; - REQUEST(xChangeGCReq); int result; unsigned len; - + REQUEST(xChangeGCReq); REQUEST_AT_LEAST_SIZE(xChangeGCReq); - SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixWriteAccess); + + result = dixLookupGC(&pGC, stuff->gc, client, DixWriteAccess); + if (result != Success) + return result; + len = client->req_len - (sizeof(xChangeGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; @@ -1648,14 +1659,18 @@ ProcChangeGC(register ClientPtr client) int ProcCopyGC(register ClientPtr client) { - register GC *dstGC; - register GC *pGC; + GC *dstGC; + GC *pGC; int result; REQUEST(xCopyGCReq); - REQUEST_SIZE_MATCH(xCopyGCReq); - SECURITY_VERIFY_GC( pGC, stuff->srcGC, client, DixReadAccess); - SECURITY_VERIFY_GC( dstGC, stuff->dstGC, client, DixWriteAccess); + + result = dixLookupGC(&pGC, stuff->srcGC, client, DixReadAccess); + if (result != Success) + return result; + result = dixLookupGC(&dstGC, stuff->dstGC, client, DixWriteAccess); + if (result != Success) + return result; if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth)) return (BadMatch); result = CopyGC(pGC, dstGC, stuff->mask); @@ -1671,7 +1686,7 @@ ProcCopyGC(register ClientPtr client) int ProcSetDashes(register ClientPtr client) { - register GC *pGC; + GC *pGC; int result; REQUEST(xSetDashesReq); @@ -1682,7 +1697,9 @@ ProcSetDashes(register ClientPtr client) return BadValue; } - SECURITY_VERIFY_GC(pGC,stuff->gc, client, DixWriteAccess); + result = dixLookupGC(&pGC,stuff->gc, client, DixWriteAccess); + if (result != Success) + return result; result = SetDashes(pGC, stuff->dashOffset, stuff->nDashes, (unsigned char *)&stuff[1]); @@ -1698,9 +1715,8 @@ ProcSetDashes(register ClientPtr client) int ProcSetClipRectangles(register ClientPtr client) { - int nr; - int result; - register GC *pGC; + int nr, result; + GC *pGC; REQUEST(xSetClipRectanglesReq); REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); @@ -1710,7 +1726,9 @@ ProcSetClipRectangles(register ClientPtr client) client->errorValue = stuff->ordering; return BadValue; } - SECURITY_VERIFY_GC(pGC,stuff->gc, client, DixWriteAccess); + result = dixLookupGC(&pGC,stuff->gc, client, DixWriteAccess); + if (result != Success) + return result; nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq); if (nr & 4) @@ -1727,11 +1745,15 @@ ProcSetClipRectangles(register ClientPtr client) int ProcFreeGC(register ClientPtr client) { - register GC *pGC; + GC *pGC; + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - SECURITY_VERIFY_GC(pGC, stuff->id, client, DixDestroyAccess); + + rc = dixLookupGC(&pGC, stuff->id, client, DixDestroyAccess); + if (rc != Success) + return rc; + FreeResource(stuff->id, RT_NONE); return(client->noClientException); } @@ -1766,9 +1788,9 @@ ProcClearToBackground(register ClientPtr client) int ProcCopyArea(register ClientPtr client) { - register DrawablePtr pDst; + DrawablePtr pDst; DrawablePtr pSrc; - register GC *pGC; + GC *pGC; REQUEST(xCopyAreaReq); RegionPtr pRgn; int rc; @@ -1811,7 +1833,7 @@ int ProcCopyPlane(register ClientPtr client) { DrawablePtr psrcDraw, pdstDraw; - register GC *pGC; + GC *pGC; REQUEST(xCopyPlaneReq); RegionPtr pRgn; int rc; @@ -1862,8 +1884,8 @@ int ProcPolyPoint(register ClientPtr client) { int npoint; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyPointReq); REQUEST_AT_LEAST_SIZE(xPolyPointReq); @@ -1885,8 +1907,8 @@ int ProcPolyLine(register ClientPtr client) { int npoint; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyLineReq); REQUEST_AT_LEAST_SIZE(xPolyLineReq); @@ -1908,8 +1930,8 @@ int ProcPolySegment(register ClientPtr client) { int nsegs; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolySegmentReq); REQUEST_AT_LEAST_SIZE(xPolySegmentReq); @@ -1927,8 +1949,8 @@ int ProcPolyRectangle (register ClientPtr client) { int nrects; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyRectangleReq); @@ -1947,8 +1969,8 @@ int ProcPolyArc(register ClientPtr client) { int narcs; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyArcReq); REQUEST_AT_LEAST_SIZE(xPolyArcReq); @@ -1966,8 +1988,8 @@ int ProcFillPoly(register ClientPtr client) { int things; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xFillPolyReq); REQUEST_AT_LEAST_SIZE(xFillPolyReq); @@ -1997,8 +2019,8 @@ int ProcPolyFillRectangle(register ClientPtr client) { int things; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyFillRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); @@ -2018,8 +2040,8 @@ int ProcPolyFillArc(register ClientPtr client) { int narcs; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyFillArcReq); REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); @@ -2090,8 +2112,8 @@ ReformatImage (char *base, int nbytes, int bpp, int order) int ProcPutImage(register ClientPtr client) { - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; long length; /* length of scanline server padded */ long lengthProto; /* length of scanline protocol padded */ char *tmpImage; @@ -2411,8 +2433,8 @@ int ProcImageText8(register ClientPtr client) { int err; - register DrawablePtr pDraw; - register GC *pGC; + DrawablePtr pDraw; + GC *pGC; REQUEST(xImageTextReq); @@ -2441,8 +2463,8 @@ int ProcImageText16(register ClientPtr client) { int err; - register DrawablePtr pDraw; - register GC *pGC; + DrawablePtr pDraw; + GC *pGC; REQUEST(xImageTextReq); @@ -3195,11 +3217,12 @@ int ProcQueryBestSize (register ClientPtr client) { xQueryBestSizeReply reply; - register DrawablePtr pDraw; + DrawablePtr pDraw; ScreenPtr pScreen; + int rc; REQUEST(xQueryBestSizeReq); - REQUEST_SIZE_MATCH(xQueryBestSizeReq); + if ((stuff->class != CursorShape) && (stuff->class != TileShape) && (stuff->class != StippleShape)) @@ -3207,8 +3230,11 @@ ProcQueryBestSize (register ClientPtr client) client->errorValue = stuff->class; return(BadValue); } - SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client, - DixReadAccess); + + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, + DixReadAccess); + if (rc != Success) + return rc; if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW) return (BadMatch); pScreen = pDraw->pScreen; diff --git a/include/dix.h b/include/dix.h index 09d5fef95..7dd321f22 100644 --- a/include/dix.h +++ b/include/dix.h @@ -239,10 +239,15 @@ SOFTWARE. if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\ (client->lastDrawableID != drawID))\ {\ - SECURITY_VERIFY_GEOMETRABLE(pDraw, drawID, client, DixWriteAccess);\ - SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixReadAccess);\ - if ((pGC->depth != pDraw->depth) ||\ - (pGC->pScreen != pDraw->pScreen))\ + int rc;\ + rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY,\ + DixWriteAccess);\ + if (rc != Success)\ + return rc;\ + rc = dixLookupGC(&(pGC), stuff->gc, client, DixReadAccess);\ + if (rc != Success)\ + return rc;\ + if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\ return (BadMatch);\ client->lastDrawable = pDraw;\ client->lastDrawableID = drawID;\ diff --git a/xfixes/region.c b/xfixes/region.c index a004fc0ca..91e9fc9c1 100755 --- a/xfixes/region.c +++ b/xfixes/region.c @@ -220,12 +220,15 @@ ProcXFixesCreateRegionFromGC (ClientPtr client) { RegionPtr pRegion, pClip; GCPtr pGC; + int rc; REQUEST (xXFixesCreateRegionFromGCReq); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq); LEGAL_NEW_RESOURCE (stuff->region, client); - SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixReadAccess); + rc = dixLookupGC(&pGC, stuff->gc, client, DixReadAccess); + if (rc != Success) + return rc; switch (pGC->clientClipType) { case CT_PIXMAP: @@ -630,10 +633,14 @@ ProcXFixesSetGCClipRegion (ClientPtr client) GCPtr pGC; RegionPtr pRegion; XID vals[2]; + int rc; REQUEST(xXFixesSetGCClipRegionReq); - REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq); - SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixWriteAccess); + + rc = dixLookupGC(&pGC, stuff->gc, client, DixWriteAccess); + if (rc != Success) + return rc; + VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, DixReadAccess); if (pRegion) -- cgit v1.2.3 From 9e32bf98bc9ab17a137664d01f59a8f426f7ff3b Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 14 Dec 2006 19:31:58 -0500 Subject: Remove now-unused macro definitions from dix.h. --- include/dix.h | 101 ---------------------------------------------------------- 1 file changed, 101 deletions(-) diff --git a/include/dix.h b/include/dix.h index 7dd321f22..baff43f54 100644 --- a/include/dix.h +++ b/include/dix.h @@ -81,107 +81,6 @@ SOFTWARE. return(BadIDChoice);\ } -/* XXX if you are using this macro, you are probably not generating Match - * errors where appropriate */ -#define LOOKUP_DRAWABLE(did, client)\ - ((client->lastDrawableID == did) ? \ - client->lastDrawable : (DrawablePtr)LookupDrawable(did, client)) - -#ifdef XACE - -#define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\ - {\ - pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \ - RC_DRAWABLE, mode);\ - if (!pDraw) \ - {\ - client->errorValue = did; \ - return BadDrawable;\ - }\ - if (pDraw->type == UNDRAWABLE_WINDOW)\ - return BadMatch;\ - } - -#define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\ - {\ - pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \ - RC_DRAWABLE, mode);\ - if (!pDraw) \ - {\ - client->errorValue = did; \ - return BadDrawable;\ - }\ - } - -#define SECURITY_VERIFY_GC(pGC, rid, client, mode)\ - pGC = (GC *) SecurityLookupIDByType(client, rid, RT_GC, mode);\ - if (!pGC)\ - {\ - client->errorValue = rid;\ - return (BadGC);\ - } - -#define VERIFY_DRAWABLE(pDraw, did, client)\ - SECURITY_VERIFY_DRAWABLE(pDraw, did, client, DixUnknownAccess) - -#define VERIFY_GEOMETRABLE(pDraw, did, client)\ - SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, DixUnknownAccess) - -#define VERIFY_GC(pGC, rid, client)\ - SECURITY_VERIFY_GC(pGC, rid, client, DixUnknownAccess) - -#else /* not XACE */ - -#define VERIFY_DRAWABLE(pDraw, did, client)\ - if (client->lastDrawableID == did)\ - pDraw = client->lastDrawable;\ - else \ - {\ - pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\ - if (!pDraw) \ - {\ - client->errorValue = did; \ - return BadDrawable;\ - }\ - if (pDraw->type == UNDRAWABLE_WINDOW)\ - return BadMatch;\ - } - -#define VERIFY_GEOMETRABLE(pDraw, did, client)\ - if (client->lastDrawableID == did)\ - pDraw = client->lastDrawable;\ - else \ - {\ - pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\ - if (!pDraw) \ - {\ - client->errorValue = did; \ - return BadDrawable;\ - }\ - } - -#define VERIFY_GC(pGC, rid, client)\ - if (client->lastGCID == rid)\ - pGC = client->lastGC;\ - else\ - pGC = (GC *)LookupIDByType(rid, RT_GC);\ - if (!pGC)\ - {\ - client->errorValue = rid;\ - return (BadGC);\ - } - -#define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\ - VERIFY_DRAWABLE(pDraw, did, client) - -#define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\ - VERIFY_GEOMETRABLE(pDraw, did, client) - -#define SECURITY_VERIFY_GC(pGC, rid, client, mode)\ - VERIFY_GC(pGC, rid, client) - -#endif /* XACE */ - /* * We think that most hardware implementations of DBE will want * LookupID*(dbe_back_buffer_id) to return the window structure that the -- cgit v1.2.3 From d742025f435f3eb7458cf8284d59300bc9a850aa Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 12 Dec 2006 20:16:49 -0800 Subject: RandR mode list needs both output and crtc modes. When an output no longer reports the current mode, it must still be included in the list advertised by the X server. Walk the crtcs to ensure it is included. (cherry picked from 78689d0d6630afcbcd3ce5394d12c2564a489f45 commit) --- randr/rrmode.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/randr/rrmode.c b/randr/rrmode.c index a0696e170..261e1b75f 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -108,12 +108,15 @@ RRModePtr * RRModesForScreen (ScreenPtr pScreen, int *num_ret) { rrScrPriv(pScreen); - int o; + int o, c; RRModePtr *screen_modes; int num_screen_modes = 0; screen_modes = xalloc ((num_modes ? num_modes : 1) * sizeof (RRModePtr)); + /* + * Add modes from all outputs + */ for (o = 0; o < pScrPriv->numOutputs; o++) { RROutputPtr output = pScrPriv->outputs[o]; @@ -129,6 +132,24 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret) screen_modes[num_screen_modes++] = mode; } } + /* + * Add modes from all crtcs. The goal is to + * make sure all available and active modes + * are visible to the client + */ + for (c = 0; c < pScrPriv->numCrtcs; c++) + { + RRCrtcPtr crtc = pScrPriv->crtcs[c]; + RRModePtr mode = crtc->mode; + int n; + + if (!mode) continue; + for (n = 0; n < num_screen_modes; n++) + if (screen_modes[n] == mode) + break; + if (n == num_screen_modes) + screen_modes[num_screen_modes++] = mode; + } *num_ret = num_screen_modes; return screen_modes; } -- cgit v1.2.3 From 628c7daeb12713d28e85e6b49fa037a7748dff83 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 12 Dec 2006 22:59:03 -0800 Subject: RandR: config time updates when hardware config changes. The config time in the RandR protocol reflects when the hardware state has changed. It was getting changed anytime the driver changed the usage of the hardware as well. (cherry picked from 98d18a6578130adb411ca4bcc776fcb7e07f189f commit) --- randr/randr.c | 6 +++++- randr/randrstr.h | 12 +++++++++--- randr/rrcrtc.c | 4 ++-- randr/rrinfo.c | 2 ++ randr/rroutput.c | 20 +++++++++++--------- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/randr/randr.c b/randr/randr.c index 147df8c2c..1470035ca 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -415,7 +415,11 @@ RRTellChanged (ScreenPtr pScreen) if (pScrPriv->changed) { UpdateCurrentTime (); - pScrPriv->lastConfigTime = currentTime; + if (pScrPriv->configChanged) + { + pScrPriv->lastConfigTime = currentTime; + pScrPriv->configChanged = FALSE; + } pScrPriv->changed = FALSE; WalkTree (pScreen, TellChanged, (pointer) pScreen); for (i = 0; i < pScrPriv->numOutputs; i++) diff --git a/randr/randrstr.h b/randr/randrstr.h index 27ede9226..88f7588ae 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -216,11 +216,14 @@ typedef struct _rrScrPriv { TimeStamp lastSetTime; /* last changed by client */ TimeStamp lastConfigTime; /* possible configs changed */ RRCloseScreenProcPtr CloseScreen; + Bool changed; /* some config changed */ + Bool configChanged; /* configuration changed */ + Bool layoutChanged; /* screen layout changed */ + CARD16 minWidth, minHeight; CARD16 maxWidth, maxHeight; CARD16 width, height; /* last known screen size */ - Bool layoutChanged; /* screen layout changed */ int numOutputs; RROutputPtr *outputs; @@ -619,10 +622,13 @@ ProcRRDeleteOutputMode (ClientPtr client); /* rroutput.c */ /* - * Notify the output of some change + * Notify the output of some change. configChanged indicates whether + * any external configuration (mode list, clones, connected status) + * has changed, or whether the change was strictly internal + * (which crtc is in use) */ void -RROutputChanged (RROutputPtr output); +RROutputChanged (RROutputPtr output, Bool configChanged); /* * Create an output diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index d4c96f680..05863a129 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -136,7 +136,7 @@ RRCrtcNotify (RRCrtcPtr crtc, break; if (j == crtc->numOutputs) { - RROutputChanged (outputs[i]); + RROutputChanged (outputs[i], FALSE); RRCrtcChanged (crtc, FALSE); } } @@ -151,7 +151,7 @@ RRCrtcNotify (RRCrtcPtr crtc, break; if (i == numOutputs) { - RROutputChanged (crtc->outputs[j]); + RROutputChanged (crtc->outputs[j], FALSE); RRCrtcChanged (crtc, FALSE); } } diff --git a/randr/rrinfo.c b/randr/rrinfo.c index 244b089f3..85426f654 100644 --- a/randr/rrinfo.c +++ b/randr/rrinfo.c @@ -69,6 +69,7 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh) output->modes = modes; output->changed = TRUE; pScrPriv->changed = TRUE; + pScrPriv->configChanged = TRUE; return mode; } @@ -205,6 +206,7 @@ RRGetInfo (ScreenPtr pScreen) rotations = 0; pScrPriv->changed = FALSE; + pScrPriv->configChanged = FALSE; if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations)) return FALSE; diff --git a/randr/rroutput.c b/randr/rroutput.c index 33c4ba534..a66433015 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -28,7 +28,7 @@ RESTYPE RROutputType; * Notify the output of some change */ void -RROutputChanged (RROutputPtr output) +RROutputChanged (RROutputPtr output, Bool configChanged) { ScreenPtr pScreen = output->pScreen; @@ -37,6 +37,8 @@ RROutputChanged (RROutputPtr output) { rrScrPriv (pScreen); pScrPriv->changed = TRUE; + if (configChanged) + pScrPriv->configChanged = TRUE; } } @@ -106,7 +108,7 @@ RROutputAttachScreen (RROutputPtr output, ScreenPtr pScreen) output->pScreen = pScreen; pScrPriv->outputs = outputs; pScrPriv->outputs[pScrPriv->numOutputs++] = output; - RROutputChanged (output); + RROutputChanged (output, FALSE); return TRUE; } @@ -142,7 +144,7 @@ RROutputSetClones (RROutputPtr output, memcpy (newClones, clones, numClones * sizeof (RROutputPtr)); output->clones = newClones; output->numClones = numClones; - RROutputChanged (output); + RROutputChanged (output, TRUE); return TRUE; } @@ -186,7 +188,7 @@ RROutputSetModes (RROutputPtr output, output->modes = newModes; output->numModes = numModes; output->numPreferred = numPreferred; - RROutputChanged (output); + RROutputChanged (output, TRUE); return TRUE; } @@ -219,7 +221,7 @@ RROutputSetCrtcs (RROutputPtr output, memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr)); output->crtcs = newCrtcs; output->numCrtcs = numCrtcs; - RROutputChanged (output); + RROutputChanged (output, TRUE); return TRUE; } @@ -229,7 +231,7 @@ RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc) if (output->crtc == crtc) return; output->crtc = crtc; - RROutputChanged (output); + RROutputChanged (output, FALSE); } Bool @@ -239,7 +241,7 @@ RROutputSetConnection (RROutputPtr output, if (output->connection == connection) return TRUE; output->connection = connection; - RROutputChanged (output); + RROutputChanged (output, TRUE); return TRUE; } @@ -251,7 +253,7 @@ RROutputSetSubpixelOrder (RROutputPtr output, return TRUE; output->subpixelOrder = subpixelOrder; - RROutputChanged (output); + RROutputChanged (output, FALSE); return TRUE; } @@ -264,7 +266,7 @@ RROutputSetPhysicalSize (RROutputPtr output, return TRUE; output->mmWidth = mmWidth; output->mmHeight = mmHeight; - RROutputChanged (output); + RROutputChanged (output, FALSE); return TRUE; } -- cgit v1.2.3 From 6c6901434ab469dd03b79fc98cd4a2b64d339305 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 13 Dec 2006 00:58:54 -0800 Subject: RandR 1.0 refresh rates unscrambled. SetScreenConfig uses RRCrtcSet right. RandR 1.0 refresh rates were scrambled when working with a 1.2 driver that returned sizes in a mixed order. SetScreenConfig was treating RRCrtcSet as returning an RandR status instead of a Bool. (cherry picked from 6dc711833d7387372012fdff1ce1df3aefa2d234 commit) --- randr/rrscreen.c | 113 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 44 deletions(-) diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 3b9263bc4..37b6a57d9 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -481,62 +481,81 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output) RR10DataPtr data; RRScreenSizePtr size; int nmode = output->numModes; - int i, j, k; + int o, os, l, r; RRScreenRatePtr refresh; CARD16 vRefresh; RRModePtr mode; + Bool *used; /* Make sure there is plenty of space for any combination */ data = malloc (sizeof (RR10DataRec) + sizeof (RRScreenSize) * nmode + - sizeof (RRScreenRate) * nmode); + sizeof (RRScreenRate) * nmode + + sizeof (Bool) * nmode); if (!data) return NULL; size = (RRScreenSizePtr) (data + 1); refresh = (RRScreenRatePtr) (size + nmode); + used = (Bool *) (refresh + nmode); + memset (used, '\0', sizeof (Bool) * nmode); data->sizes = size; data->nsize = 0; data->nrefresh = 0; data->size = 0; data->refresh = 0; - for (i = 0; i < output->numModes; i++) + + /* + * find modes not yet listed + */ + for (o = 0; o < output->numModes; o++) { - mode = output->modes[i]; - for (j = 0; j < data->nsize; j++) - if (mode->mode.width == size[j].width && - mode->mode.height == size[j].height) - break; - if (j == data->nsize) - { - size[j].id = j; - size[j].width = mode->mode.width; - size[j].height = mode->mode.height; - if (output->mmWidth && output->mmHeight) { - size[j].mmWidth = output->mmWidth; - size[j].mmHeight = output->mmHeight; - } else { - size[j].mmWidth = pScreen->mmWidth; - size[j].mmHeight = pScreen->mmHeight; - } - size[j].nRates = 0; - size[j].pRates = &refresh[data->nrefresh]; - data->nsize++; - } - vRefresh = RRVerticalRefresh (&mode->mode); - for (k = 0; k < size[j].nRates; k++) - if (vRefresh == size[j].pRates[k].rate) - break; - if (k == size[j].nRates) - { - size[j].pRates[k].rate = vRefresh; - size[j].pRates[k].mode = mode; - size[j].nRates++; - data->nrefresh++; + if (used[o]) continue; + + mode = output->modes[o]; + + l = data->nsize; + size[l].id = data->nsize; + size[l].width = mode->mode.width; + size[l].height = mode->mode.height; + if (output->mmWidth && output->mmHeight) { + size[l].mmWidth = output->mmWidth; + size[l].mmHeight = output->mmHeight; + } else { + size[l].mmWidth = pScreen->mmWidth; + size[l].mmHeight = pScreen->mmHeight; } - if (mode == output->crtc->mode) + size[l].nRates = 0; + size[l].pRates = &refresh[data->nrefresh]; + data->nsize++; + + /* + * Find all modes with matching size + */ + for (os = o; os < output->numModes; os++) { - data->size = j; - data->refresh = vRefresh; + mode = output->modes[os]; + if (mode->mode.width == size[l].width && + mode->mode.height == size[l].height) + { + vRefresh = RRVerticalRefresh (&mode->mode); + used[os] = TRUE; + + for (r = 0; r < size[l].nRates; r++) + if (vRefresh == size[l].pRates[r].rate) + break; + if (r == size[l].nRates) + { + size[l].pRates[r].rate = vRefresh; + size[l].pRates[r].mode = mode; + size[l].nRates++; + data->nrefresh++; + } + if (mode == output->crtc->mode) + { + data->size = l; + data->refresh = vRefresh; + } + } } } return data; @@ -865,22 +884,28 @@ ProcRRSetScreenConfig (ClientPtr client) for (c = 0; c < pScrPriv->numCrtcs; c++) { - rep.status = RRCrtcSet (pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0, - 0, NULL); - if (rep.status != Success) + if (!RRCrtcSet (pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0, + 0, NULL)) + { + rep.status = RRSetConfigFailed; + /* XXX recover from failure */ goto sendReply; + } } if (!RRScreenSizeSet (pScreen, mode->mode.width, mode->mode.height, pScreen->mmWidth, pScreen->mmHeight)) { rep.status = RRSetConfigFailed; + /* XXX recover from failure */ goto sendReply; } } - - rep.status = RRCrtcSet (output->crtc, mode, 0, 0, stuff->rotation, - 1, &output); - + + if (!RRCrtcSet (output->crtc, mode, 0, 0, stuff->rotation, 1, &output)) + rep.status = RRSetConfigFailed; + else + rep.status = RRSetConfigSuccess; + /* * XXX Configure other crtcs to mirror as much as possible */ -- cgit v1.2.3 From 670bbb87310503fcc17203cecfa6f4f2f5db51d2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 13 Dec 2006 01:21:32 -0800 Subject: RandR 1.2 rotation code must adjust width/height. Mode lines reflect the monitor mode, not the projected size into the frame buffer. Flip width/height around so that the dimensions are oriented correctly. (cherry picked from 612a8e61803da8db0e305cbb093696b8e4284572 commit) --- randr/rrcrtc.c | 12 ++++++++++-- randr/rrscreen.c | 25 +++++++++++++++++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 05863a129..076742077 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -698,7 +698,15 @@ ProcRRSetCrtcConfig (ClientPtr client) */ if (pScrPriv->rrScreenSetSize) { - if (stuff->x + mode->mode.width > pScreen->width) + int source_width = mode->mode.width; + int source_height = mode->mode.height; + + if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270) + { + source_width = mode->mode.height; + source_height = mode->mode.width; + } + if (stuff->x + source_width > pScreen->width) { client->errorValue = stuff->x; if (outputs) @@ -706,7 +714,7 @@ ProcRRSetCrtcConfig (ClientPtr client) return BadValue; } - if (stuff->y + mode->mode.height > pScreen->height) + if (stuff->y + source_height > pScreen->height) { client->errorValue = stuff->y; if (outputs) diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 37b6a57d9..f1d8fc5d9 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -268,7 +268,6 @@ ProcRRSetScreenSize (ClientPtr client) WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; - RRCrtcPtr crtc; int i; REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); @@ -291,12 +290,26 @@ ProcRRSetScreenSize (ClientPtr client) client->errorValue = stuff->height; return BadValue; } - for (i = 0; i < pScrPriv->numCrtcs; i++) { - crtc = pScrPriv->crtcs[i]; - if (crtc->mode && - (crtc->x + crtc->mode->mode.width > stuff->width || - crtc->y + crtc->mode->mode.height > stuff->height)) + for (i = 0; i < pScrPriv->numCrtcs; i++) + { + RRCrtcPtr crtc = pScrPriv->crtcs[i]; + RRModePtr mode = crtc->mode; + if (mode) + { + int source_width = mode->mode.width; + int source_height = mode->mode.height; + Rotation rotation = crtc->rotation; + + if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270) + { + source_width = mode->mode.height; + source_height = mode->mode.width; + } + + if (crtc->x + source_width > stuff->width || + crtc->y + source_height > stuff->height) return BadMatch; + } } if (stuff->widthInMillimeters == 0 || stuff->heightInMillimeters == 0) { -- cgit v1.2.3 From 04c721854fbf1bd6379c165a53fab2bdc09961c0 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 15 Dec 2006 14:11:40 -0500 Subject: Convert callers of LookupWindow() to dixLookupWindow(). --- Xext/appgroup.c | 8 ++++--- Xext/mbuf.c | 31 +++++++++++++------------ Xext/panoramiX.c | 27 ++++++++++++---------- Xext/shape.c | 52 ++++++++++++++++++++++-------------------- Xext/xtest.c | 19 ++++++++------- Xext/xvdisp.c | 12 ++++------ Xi/chgprop.c | 9 ++++---- Xi/exevents.c | 22 ++++++++++-------- Xi/getprop.c | 9 ++++---- Xi/getselev.c | 8 +++---- Xi/selectev.c | 8 +++---- Xi/ungrdevb.c | 7 +++--- Xi/ungrdevk.c | 7 +++--- composite/compwindow.c | 6 ++--- hw/darwin/quartz/pseudoramiX.c | 27 ++++++++++++---------- randr/rrxinerama.c | 21 +++++++++-------- 16 files changed, 141 insertions(+), 132 deletions(-) diff --git a/Xext/appgroup.c b/Xext/appgroup.c index 4f3000569..134b172f9 100644 --- a/Xext/appgroup.c +++ b/Xext/appgroup.c @@ -355,13 +355,15 @@ int AttrValidate( AppGroupPtr pAppGrp) { WindowPtr pWin; - int idepth, ivids, found; + int idepth, ivids, found, rc; ScreenPtr pScreen; DepthPtr pDepth; ColormapPtr pColormap; - pWin = LookupWindow (pAppGrp->default_root, client); - /* XXX check that pWin is not NULL */ + rc = dixLookupWindow(&pWin, pAppGrp->default_root, client, + DixUnknownAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root) return BadWindow; diff --git a/Xext/mbuf.c b/Xext/mbuf.c index e0361dda4..43e2cc107 100644 --- a/Xext/mbuf.c +++ b/Xext/mbuf.c @@ -448,16 +448,15 @@ ProcCreateImageBuffers (client) register int n; WindowPtr pWin; XID *ids; - int len, nbuf; - int i; - int err; + int len, nbuf, i, err, rc; REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq); len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2); if (len == 0) return BadLength; - if (!(pWin = LookupWindow (stuff->window, client))) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; if (pWin->drawable.class == InputOnly) return BadMatch; switch (stuff->updateAction) @@ -584,10 +583,12 @@ ProcDestroyImageBuffers (client) { REQUEST (xMbufDestroyImageBuffersReq); WindowPtr pWin; + int rc; REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq); - if (!(pWin = LookupWindow (stuff->window, client))) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; DestroyImageBuffers (pWin); return Success; } @@ -599,16 +600,16 @@ ProcSetMBufferAttributes (client) REQUEST (xMbufSetMBufferAttributesReq); WindowPtr pWin; MultibuffersPtr pMultibuffers; - int len; + int len, rc; Mask vmask; Mask index2; CARD32 updateHint; XID *vlist; REQUEST_AT_LEAST_SIZE (xMbufSetMBufferAttributesReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType); if (!pMultibuffers) return BadMatch; @@ -655,12 +656,12 @@ ProcGetMBufferAttributes (client) MultibuffersPtr pMultibuffers; XID *ids; xMbufGetMBufferAttributesReply rep; - int i, n; + int i, n, rc; REQUEST_SIZE_MATCH (xMbufGetMBufferAttributesReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType); if (!pMultibuffers) return BadAccess; diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index 6b8b5f2f7..85f591356 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -958,12 +958,13 @@ ProcPanoramiXGetState(ClientPtr client) REQUEST(xPanoramiXGetStateReq); WindowPtr pWin; xPanoramiXGetStateReply rep; - register int n; + register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -984,12 +985,13 @@ ProcPanoramiXGetScreenCount(ClientPtr client) REQUEST(xPanoramiXGetScreenCountReq); WindowPtr pWin; xPanoramiXGetScreenCountReply rep; - register int n; + register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -1009,12 +1011,13 @@ ProcPanoramiXGetScreenSize(ClientPtr client) REQUEST(xPanoramiXGetScreenSizeReq); WindowPtr pWin; xPanoramiXGetScreenSizeReply rep; - register int n; + register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; diff --git a/Xext/shape.c b/Xext/shape.c index 4a798da7c..58e3a69b3 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -316,16 +316,16 @@ ProcShapeRectangles (client) ScreenPtr pScreen; REQUEST(xShapeRectanglesReq); xRectangle *prects; - int nrects, ctype; + int nrects, ctype, rc; RegionPtr srcRgn; RegionPtr *destRgn; CreateDftPtr createDefault; REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); UpdateCurrentTime(); - pWin = LookupWindow (stuff->dest, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->dest, client, DixUnknownAccess); + if (rc != Success) + return rc; switch (stuff->destKind) { case ShapeBounding: createDefault = CreateBoundingShape; @@ -526,12 +526,13 @@ ProcShapeCombine (client) CreateDftPtr createDefault; CreateDftPtr createSrc; RegionPtr tmp; + int rc; REQUEST_SIZE_MATCH (xShapeCombineReq); UpdateCurrentTime(); - pDestWin = LookupWindow (stuff->dest, client); - if (!pDestWin) - return BadWindow; + rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixUnknownAccess); + if (rc != Success) + return rc; if (!pDestWin->optional) MakeWindowOptional (pDestWin); switch (stuff->destKind) { @@ -550,9 +551,9 @@ ProcShapeCombine (client) } pScreen = pDestWin->drawable.pScreen; - pSrcWin = LookupWindow (stuff->src, client); - if (!pSrcWin) - return BadWindow; + rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixUnknownAccess); + if (rc != Success) + return rc; switch (stuff->srcKind) { case ShapeBounding: srcRgn = wBoundingShape (pSrcWin); @@ -645,12 +646,13 @@ ProcShapeOffset (client) ScreenPtr pScreen; REQUEST(xShapeOffsetReq); RegionPtr srcRgn; + int rc; REQUEST_SIZE_MATCH (xShapeOffsetReq); UpdateCurrentTime(); - pWin = LookupWindow (stuff->dest, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->dest, client, DixUnknownAccess); + if (rc != Success) + return rc; switch (stuff->destKind) { case ShapeBounding: srcRgn = wBoundingShape (pWin); @@ -709,13 +711,13 @@ ProcShapeQueryExtents (client) WindowPtr pWin; xShapeQueryExtentsReply rep; BoxRec extents, *pExtents; - register int n; + register int n, rc; RegionPtr region; REQUEST_SIZE_MATCH (xShapeQueryExtentsReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -990,14 +992,14 @@ ProcShapeInputSelected (client) REQUEST(xShapeInputSelectedReq); WindowPtr pWin; ShapeEventPtr pShapeEvent, *pHead; - int enabled; + int enabled, rc; xShapeInputSelectedReply rep; register int n; REQUEST_SIZE_MATCH (xShapeInputSelectedReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; pHead = (ShapeEventPtr *) SecurityLookupIDByType(client, pWin->drawable.id, EventType, DixReadAccess); enabled = xFalse; @@ -1032,14 +1034,14 @@ ProcShapeGetRectangles (client) WindowPtr pWin; xShapeGetRectanglesReply rep; xRectangle *rects; - int nrects, i; + int nrects, i, rc; RegionPtr region; register int n; REQUEST_SIZE_MATCH(xShapeGetRectanglesReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; switch (stuff->kind) { case ShapeBounding: region = wBoundingShape(pWin); diff --git a/Xext/xtest.c b/Xext/xtest.c index 83f8b8cc6..c9b511e69 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -139,12 +139,12 @@ ProcXTestCompareCursor(client) xXTestCompareCursorReply rep; WindowPtr pWin; CursorPtr pCursor; - register int n; + register int n, rc; REQUEST_SIZE_MATCH(xXTestCompareCursorReq); - pWin = (WindowPtr)LookupWindow(stuff->window, client); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; if (stuff->cursor == None) pCursor = NullCursor; else if (stuff->cursor == XTestCurrentCursor) @@ -173,12 +173,10 @@ ProcXTestFakeInput(client) register ClientPtr client; { REQUEST(xXTestFakeInputReq); - int nev; - int n; + int nev, n, type, rc; xEvent *ev; DeviceIntPtr dev = NULL; WindowPtr root; - int type; #ifdef XINPUT Bool extension = FALSE; deviceValuator *dv = NULL; @@ -367,9 +365,10 @@ ProcXTestFakeInput(client) root = GetCurrentRootWindow(); else { - root = LookupWindow(ev->u.keyButtonPointer.root, client); - if (!root) - return BadWindow; + rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root, client, + DixUnknownAccess); + if (rc != Success) + return rc; if (root->parent) { client->errorValue = ev->u.keyButtonPointer.root; diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index 2afb7c687..21d00aa7f 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -373,10 +373,8 @@ ProcXvQueryAdaptors(ClientPtr client) xvFormat format; xvAdaptorInfo ainfo; xvQueryAdaptorsReply rep; - int totalSize; - int na; + int totalSize, na, nf, rc; XvAdaptorPtr pa; - int nf; XvFormatPtr pf; WindowPtr pWin; ScreenPtr pScreen; @@ -385,11 +383,9 @@ ProcXvQueryAdaptors(ClientPtr client) REQUEST(xvQueryAdaptorsReq); REQUEST_SIZE_MATCH(xvQueryAdaptorsReq); - if(!(pWin = (WindowPtr)LookupWindow(stuff->window, client) )) - { - client->errorValue = stuff->window; - return (BadWindow); - } + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; diff --git a/Xi/chgprop.c b/Xi/chgprop.c index 52c38838d..bab4597b8 100644 --- a/Xi/chgprop.c +++ b/Xi/chgprop.c @@ -106,7 +106,7 @@ SProcXChangeDeviceDontPropagateList(register ClientPtr client) int ProcXChangeDeviceDontPropagateList(register ClientPtr client) { - int i; + int i, rc; WindowPtr pWin; struct tmask tmp[EMASKSIZE]; OtherInputMasks *others; @@ -121,11 +121,10 @@ ProcXChangeDeviceDontPropagateList(register ClientPtr client) return Success; } - pWin = (WindowPtr) LookupWindow(stuff->window, client); - if (!pWin) { - client->errorValue = stuff->window; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) { SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, - BadWindow); + rc); return Success; } diff --git a/Xi/exevents.c b/Xi/exevents.c index 92a5f0599..b7645f443 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -505,6 +505,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, WindowPtr pWin, confineTo; CursorPtr cursor; GrabPtr grab; + int rc; if ((this_device_mode != GrabModeSync) && (this_device_mode != GrabModeAsync)) { @@ -524,15 +525,15 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, client->errorValue = ownerEvents; return BadValue; } - pWin = LookupWindow(grabWindow, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess); + if (rc != Success) + return rc; if (rconfineTo == None) confineTo = NullWindow; else { - confineTo = LookupWindow(rconfineTo, client); - if (!confineTo) - return BadWindow; + rc = dixLookupWindow(&confineTo, rconfineTo, client, DixUnknownAccess); + if (rc != Success) + return rc; } if (rcursor == None) cursor = NullCursor; @@ -562,6 +563,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, WindowPtr pWin; GrabPtr grab; KeyClassPtr k = dev->key; + int rc; if (k == NULL) return BadMatch; @@ -588,9 +590,9 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, client->errorValue = ownerEvents; return BadValue; } - pWin = LookupWindow(grabWindow, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess); + if (rc != Success) + return rc; grab = CreateGrab(client->index, dev, pWin, mask, ownerEvents, this_device_mode, other_devices_mode, @@ -810,7 +812,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, } else effectiveFocus = pWin = inputFocus; } else - pWin = LookupWindow(dest, client); + dixLookupWindow(&pWin, dest, client, DixUnknownAccess); if (!pWin) return BadWindow; if ((propagate != xFalse) && (propagate != xTrue)) { diff --git a/Xi/getprop.c b/Xi/getprop.c index 530841032..058c59514 100644 --- a/Xi/getprop.c +++ b/Xi/getprop.c @@ -100,7 +100,7 @@ int ProcXGetDeviceDontPropagateList(register ClientPtr client) { CARD16 count = 0; - int i; + int i, rc; XEventClass *buf = NULL, *tbuf; WindowPtr pWin; xGetDeviceDontPropagateListReply rep; @@ -115,11 +115,10 @@ ProcXGetDeviceDontPropagateList(register ClientPtr client) rep.length = 0; rep.count = 0; - pWin = (WindowPtr) LookupWindow(stuff->window, client); - if (!pWin) { - client->errorValue = stuff->window; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) { SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0, - BadWindow); + rc); return Success; } diff --git a/Xi/getselev.c b/Xi/getselev.c index a84c33d23..533c66cd7 100644 --- a/Xi/getselev.c +++ b/Xi/getselev.c @@ -98,8 +98,7 @@ SProcXGetSelectedExtensionEvents(register ClientPtr client) int ProcXGetSelectedExtensionEvents(register ClientPtr client) { - int i; - int total_length = 0; + int i, rc, total_length = 0; xGetSelectedExtensionEventsReply rep; WindowPtr pWin; XEventClass *buf = NULL; @@ -118,9 +117,10 @@ ProcXGetSelectedExtensionEvents(register ClientPtr client) rep.this_client_count = 0; rep.all_clients_count = 0; - if (!(pWin = LookupWindow(stuff->window, client))) { + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) { SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0, - BadWindow); + rc); return Success; } diff --git a/Xi/selectev.c b/Xi/selectev.c index 7d3ef9d48..8c893ca1e 100644 --- a/Xi/selectev.c +++ b/Xi/selectev.c @@ -170,11 +170,9 @@ ProcXSelectExtensionEvent(register ClientPtr client) return Success; } - pWin = (WindowPtr) LookupWindow(stuff->window, client); - if (!pWin) { - client->errorValue = stuff->window; - SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, - BadWindow); + ret = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (ret != Success) { + SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, ret); return Success; } diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c index 64bb213f5..8db9307ce 100644 --- a/Xi/ungrdevb.c +++ b/Xi/ungrdevb.c @@ -105,6 +105,7 @@ ProcXUngrabDeviceButton(ClientPtr client) DeviceIntPtr mdev; WindowPtr pWin; GrabRec temporaryGrab; + int rc; REQUEST(xUngrabDeviceButtonReq); REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq); @@ -134,9 +135,9 @@ ProcXUngrabDeviceButton(ClientPtr client) } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); - pWin = LookupWindow(stuff->grabWindow, client); - if (!pWin) { - SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadWindow); + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess); + if (rc != Success) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, rc); return Success; } diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c index 0a6b3b619..ebb83bce7 100644 --- a/Xi/ungrdevk.c +++ b/Xi/ungrdevk.c @@ -105,6 +105,7 @@ ProcXUngrabDeviceKey(ClientPtr client) DeviceIntPtr mdev; WindowPtr pWin; GrabRec temporaryGrab; + int rc; REQUEST(xUngrabDeviceKeyReq); REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq); @@ -133,9 +134,9 @@ ProcXUngrabDeviceKey(ClientPtr client) } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); - pWin = LookupWindow(stuff->grabWindow, client); - if (!pWin) { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadWindow); + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess); + if (rc != Success) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, rc); return Success; } if (((stuff->key > dev->key->curKeySyms.maxKeyCode) || diff --git a/composite/compwindow.c b/composite/compwindow.c index 2c86cdd95..fed642ec6 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -93,10 +93,10 @@ typedef struct _compPixmapVisit { static Bool compRepaintBorder (ClientPtr pClient, pointer closure) { - WindowPtr pWindow = LookupWindow ((XID) closure, pClient); + WindowPtr pWindow; + int rc = dixLookupWindow(&pWindow, (XID)closure, pClient,DixUnknownAccess); - if (pWindow) - { + if (rc == Success) { RegionRec exposed; REGION_NULL(pScreen, &exposed); diff --git a/hw/darwin/quartz/pseudoramiX.c b/hw/darwin/quartz/pseudoramiX.c index ab57827d3..a003daf43 100644 --- a/hw/darwin/quartz/pseudoramiX.c +++ b/hw/darwin/quartz/pseudoramiX.c @@ -170,12 +170,13 @@ static int ProcPseudoramiXGetState(ClientPtr client) REQUEST(xPanoramiXGetStateReq); WindowPtr pWin; xPanoramiXGetStateReply rep; - register int n; + register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -196,12 +197,13 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client) REQUEST(xPanoramiXGetScreenCountReq); WindowPtr pWin; xPanoramiXGetScreenCountReply rep; - register int n; + register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -222,12 +224,13 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client) REQUEST(xPanoramiXGetScreenSizeReq); WindowPtr pWin; xPanoramiXGetScreenSizeReply rep; - register int n; + register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c index 771ed0976..8b951455c 100644 --- a/randr/rrxinerama.c +++ b/randr/rrxinerama.c @@ -116,14 +116,15 @@ ProcRRXineramaGetState(ClientPtr client) REQUEST(xPanoramiXGetStateReq); WindowPtr pWin; xPanoramiXGetStateReply rep; - register int n; + register int n, rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; Bool active = FALSE; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - pWin = LookupWindow(stuff->window, client); - if(!pWin) return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if(rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); @@ -180,11 +181,12 @@ ProcRRXineramaGetScreenCount(ClientPtr client) REQUEST(xPanoramiXGetScreenCountReq); WindowPtr pWin; xPanoramiXGetScreenCountReply rep; - register int n; + register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - pWin = LookupWindow(stuff->window, client); - if(!pWin) return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; rep.type = X_Reply; rep.length = 0; @@ -206,11 +208,12 @@ ProcRRXineramaGetScreenSize(ClientPtr client) WindowPtr pWin, pRoot; ScreenPtr pScreen; xPanoramiXGetScreenSizeReply rep; - register int n; + register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - pWin = LookupWindow (stuff->window, client); - if(!pWin) return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pRoot = WindowTable[pScreen->myNum]; -- cgit v1.2.3 From 25d5e0a629f82d95bd71daf9a920a70e095b5188 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 15 Dec 2006 15:50:46 -0500 Subject: Convert callers of SecurityLookupWindow() to dixLookupWindow(). --- Xext/panoramiXprocs.c | 18 ++-- Xext/shape.c | 14 +-- Xext/xprint.c | 7 +- dbe/dbe.c | 16 ++- dix/devices.c | 8 +- dix/dispatch.c | 214 +++++++++++++++++++---------------------- dix/events.c | 117 +++++++++++----------- dix/property.c | 45 ++++----- hw/darwin/quartz/applewm.c | 12 +-- hw/dmx/dmx.c | 14 +-- hw/dmx/glxProxy/glxcmds.c | 23 ++--- hw/xwin/winclipboardwrappers.c | 8 +- hw/xwin/winwindowswm.c | 19 ++-- randr/rrdispatch.c | 7 +- randr/rrscreen.c | 40 +++----- xfixes/cursor.c | 8 +- xfixes/saveset.c | 7 +- xfixes/select.c | 8 +- 18 files changed, 273 insertions(+), 312 deletions(-) diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index a193c4188..1c53a1e1a 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -577,19 +577,17 @@ int PanoramiXTranslateCoords(ClientPtr client) { INT16 x, y; REQUEST(xTranslateCoordsReq); - - register WindowPtr pWin, pDst; + int rc; + WindowPtr pWin, pDst; xTranslateCoordsReply rep; REQUEST_SIZE_MATCH(xTranslateCoordsReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, - DixReadAccess); - if (!pWin) - return(BadWindow); - pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, - DixReadAccess); - if (!pDst) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess); + if (rc != Success) + return rc; + rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess); + if (rc != Success) + return rc; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; diff --git a/Xext/shape.c b/Xext/shape.c index 58e3a69b3..928eeee31 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -419,12 +419,13 @@ ProcShapeMask (client) RegionPtr *destRgn; PixmapPtr pPixmap; CreateDftPtr createDefault; + int rc; REQUEST_SIZE_MATCH (xShapeMaskReq); UpdateCurrentTime(); - pWin = SecurityLookupWindow (stuff->dest, client, DixWriteAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->dest, client, DixWriteAccess); + if (rc != Success) + return rc; switch (stuff->destKind) { case ShapeBounding: createDefault = CreateBoundingShape; @@ -822,11 +823,12 @@ ProcShapeSelectInput (client) WindowPtr pWin; ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead; XID clientResource; + int rc; REQUEST_SIZE_MATCH (xShapeSelectInputReq); - pWin = SecurityLookupWindow (stuff->window, client, DixWriteAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; pHead = (ShapeEventPtr *)SecurityLookupIDByType(client, pWin->drawable.id, EventType, DixWriteAccess); switch (stuff->enable) { diff --git a/Xext/xprint.c b/Xext/xprint.c index 669ad277d..d8fc51713 100644 --- a/Xext/xprint.c +++ b/Xext/xprint.c @@ -1852,9 +1852,10 @@ ProcXpStartPage(ClientPtr client) if(pContext->state & PAGE_STARTED) return XpErrorBase+XPBadSequence; - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin || pWin->drawable.pScreen->myNum != pContext->screenNum) + result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (result != Success) + return result; + if (pWin->drawable.pScreen->myNum != pContext->screenNum) return BadWindow; if((c = (XpStPagePtr)xalloc(sizeof(XpStPageRec))) == (XpStPagePtr)NULL) diff --git a/dbe/dbe.c b/dbe/dbe.c index 649143cf2..69ddf4f1c 100644 --- a/dbe/dbe.c +++ b/dbe/dbe.c @@ -405,11 +405,9 @@ ProcDbeAllocateBackBufferName(ClientPtr client) REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq); /* The window must be valid. */ - if (!(pWin = SecurityLookupWindow(stuff->window, client, - DixWriteAccess))) - { - return(BadWindow); - } + status = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (status != Success) + return status; /* The window must be InputOutput. */ if (pWin->drawable.class != InputOutput) @@ -729,11 +727,11 @@ ProcDbeSwapBuffers(ClientPtr client) /* Check all windows to swap. */ /* Each window must be a valid window - BadWindow. */ - if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client, - DixWriteAccess))) - { + error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client, + DixWriteAccess); + if (error != Success) { DEALLOCATE_LOCAL(swapInfo); - return(BadWindow); + return error; } /* Each window must be double-buffered - BadMatch. */ diff --git a/dix/devices.c b/dix/devices.c index e6a504954..9f4218414 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -1840,16 +1840,16 @@ ProcGetMotionEvents(ClientPtr client) WindowPtr pWin; xTimecoord * coords = (xTimecoord *) NULL; xGetMotionEventsReply rep; - int i, count, xmin, xmax, ymin, ymax; + int i, count, xmin, xmax, ymin, ymax, rc; unsigned long nEvents; DeviceIntPtr mouse = inputInfo.pointer; TimeStamp start, stop; REQUEST(xGetMotionEventsReq); REQUEST_SIZE_MATCH(xGetMotionEventsReq); - pWin = SecurityLookupWindow(stuff->window, client, TRUE); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; diff --git a/dix/dispatch.c b/dix/dispatch.c index 0421886a0..3060a4c39 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -554,17 +554,16 @@ ProcBadRequest(ClientPtr client) int ProcCreateWindow(ClientPtr client) { - register WindowPtr pParent, pWin; + WindowPtr pParent, pWin; REQUEST(xCreateWindowReq); - int result; - int len; + int result, len, rc; REQUEST_AT_LEAST_SIZE(xCreateWindowReq); LEGAL_NEW_RESOURCE(stuff->wid, client); - if (!(pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, - DixWriteAccess))) - return BadWindow; + rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess); + if (rc != Success) + return rc; len = client->req_len - (sizeof(xCreateWindowReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; @@ -597,16 +596,15 @@ ProcCreateWindow(ClientPtr client) int ProcChangeWindowAttributes(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xChangeWindowAttributesReq); register int result; - int len; + int len, rc; REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); if (len != Ones(stuff->valueMask)) return BadLength; @@ -623,15 +621,15 @@ ProcChangeWindowAttributes(register ClientPtr client) int ProcGetWindowAttributes(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); xGetWindowAttributesReply wa; + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; GetWindowAttributes(pWin, client, &wa); WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); return(client->noClientException); @@ -640,14 +638,14 @@ ProcGetWindowAttributes(register ClientPtr client) int ProcDestroyWindow(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixDestroyAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess); + if (rc != Success) + return rc; if (pWin->parent) FreeResource(stuff->id, RT_NONE); return(client->noClientException); @@ -656,14 +654,14 @@ ProcDestroyWindow(register ClientPtr client) int ProcDestroySubwindows(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixDestroyAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess); + if (rc != Success) + return rc; DestroySubwindows(pWin, client); return(client->noClientException); } @@ -671,15 +669,14 @@ ProcDestroySubwindows(register ClientPtr client) int ProcChangeSaveSet(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xChangeSaveSetReq); - register int result; + register int result, rc; REQUEST_SIZE_MATCH(xChangeSaveSetReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) return BadMatch; if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete)) @@ -700,19 +697,17 @@ ProcChangeSaveSet(register ClientPtr client) int ProcReparentWindow(register ClientPtr client) { - register WindowPtr pWin, pParent; + WindowPtr pWin, pParent; REQUEST(xReparentWindowReq); - register int result; + register int result, rc; REQUEST_SIZE_MATCH(xReparentWindowReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); - pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, - DixWriteAccess); - if (!pParent) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; + rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess); + if (rc != Success) + return rc; if (SAME_SCREENS(pWin->drawable, pParent->drawable)) { if ((pWin->backgroundState == ParentRelative) && @@ -735,14 +730,14 @@ ProcReparentWindow(register ClientPtr client) int ProcMapWindow(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; MapWindow(pWin, client); /* update cache to say it is mapped */ return(client->noClientException); @@ -751,14 +746,14 @@ ProcMapWindow(register ClientPtr client) int ProcMapSubwindows(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; MapSubwindows(pWin, client); /* update cache to say it is mapped */ return(client->noClientException); @@ -767,14 +762,14 @@ ProcMapSubwindows(register ClientPtr client) int ProcUnmapWindow(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; UnmapWindow(pWin, FALSE); /* update cache to say it is mapped */ return(client->noClientException); @@ -783,14 +778,14 @@ ProcUnmapWindow(register ClientPtr client) int ProcUnmapSubwindows(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; UnmapSubwindows(pWin); return(client->noClientException); } @@ -798,16 +793,15 @@ ProcUnmapSubwindows(register ClientPtr client) int ProcConfigureWindow(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xConfigureWindowReq); register int result; - int len; + int len, rc; REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); if (Ones((Mask)stuff->mask) != len) return BadLength; @@ -822,8 +816,9 @@ ProcConfigureWindow(register ClientPtr client) int ProcCirculateWindow(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xCirculateWindowReq); + int rc; REQUEST_SIZE_MATCH(xCirculateWindowReq); if ((stuff->direction != RaiseLowest) && @@ -832,10 +827,9 @@ ProcCirculateWindow(register ClientPtr client) client->errorValue = stuff->direction; return BadValue; } - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; CirculateWindow(pWin, (int)stuff->direction, client); return(client->noClientException); } @@ -903,16 +897,15 @@ int ProcQueryTree(register ClientPtr client) { xQueryTreeReply reply; - int numChildren = 0; - register WindowPtr pChild, pWin, pHead; + int rc, numChildren = 0; + WindowPtr pChild, pWin, pHead; Window *childIDs = (Window *)NULL; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; reply.type = X_Reply; reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.sequenceNumber = client->sequence; @@ -1025,10 +1018,9 @@ ProcSetSelectionOwner(register ClientPtr client) return Success; if (stuff->window != None) { - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + int rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; } else pWin = (WindowPtr)None; @@ -1142,12 +1134,12 @@ ProcConvertSelection(register ClientPtr client) xEvent event; WindowPtr pWin; REQUEST(xConvertSelectionReq); + int rc; REQUEST_SIZE_MATCH(xConvertSelectionReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->requestor, client, DixReadAccess); + if (rc != Success) + return rc; paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); if (stuff->property != None) @@ -1262,18 +1254,17 @@ ProcTranslateCoords(register ClientPtr client) { REQUEST(xTranslateCoordsReq); - register WindowPtr pWin, pDst; + WindowPtr pWin, pDst; xTranslateCoordsReply rep; + int rc; REQUEST_SIZE_MATCH(xTranslateCoordsReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, - DixReadAccess); - if (!pWin) - return(BadWindow); - pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, - DixReadAccess); - if (!pDst) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess); + if (rc != Success) + return rc; + rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess); + if (rc != Success) + return rc; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -1762,13 +1753,13 @@ int ProcClearToBackground(register ClientPtr client) { REQUEST(xClearAreaReq); - register WindowPtr pWin; + WindowPtr pWin; + int rc; REQUEST_SIZE_MATCH(xClearAreaReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; if (pWin->drawable.class == InputOnly) { client->errorValue = stuff->window; @@ -2496,7 +2487,7 @@ ProcCreateColormap(register ClientPtr client) VisualPtr pVisual; ColormapPtr pmap; Colormap mid; - register WindowPtr pWin; + WindowPtr pWin; ScreenPtr pScreen; REQUEST(xCreateColormapReq); int i, result; @@ -2510,10 +2501,9 @@ ProcCreateColormap(register ClientPtr client) } mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (result != Success) + return result; pScreen = pWin->drawable.pScreen; for (i = 0, pVisual = pScreen->visuals; @@ -2631,16 +2621,14 @@ int ProcListInstalledColormaps(register ClientPtr client) { xListInstalledColormapsReply *preply; - int nummaps; + int nummaps, rc; WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixReadAccess); - - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; preply = (xListInstalledColormapsReply *) ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) + diff --git a/dix/events.c b/dix/events.c index c7cf73e46..0053f42d4 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2228,16 +2228,15 @@ static int XineramaWarpPointer(ClientPtr client) { WindowPtr dest = NULL; - int x, y; + int x, y, rc; REQUEST(xWarpPointerReq); - if (stuff->dstWid != None) - { - dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); - if (!dest) - return BadWindow; + if (stuff->dstWid != None) { + rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess); + if (rc != Success) + return rc; } x = sprite.hotPhys.x; y = sprite.hotPhys.y; @@ -2248,8 +2247,9 @@ XineramaWarpPointer(ClientPtr client) XID winID = stuff->srcWid; WindowPtr source; - source = SecurityLookupWindow(winID, client, DixReadAccess); - if (!source) return BadWindow; + rc = dixLookupWindow(&source, winID, client, DixReadAccess); + if (rc != Success) + return rc; winX = source->drawable.x; winY = source->drawable.y; @@ -2301,7 +2301,7 @@ int ProcWarpPointer(ClientPtr client) { WindowPtr dest = NULL; - int x, y; + int x, y, rc; ScreenPtr newScreen; REQUEST(xWarpPointerReq); @@ -2313,11 +2313,10 @@ ProcWarpPointer(ClientPtr client) return XineramaWarpPointer(client); #endif - if (stuff->dstWid != None) - { - dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); - if (!dest) - return BadWindow; + if (stuff->dstWid != None) { + rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess); + if (rc != Success) + return rc; } x = sprite.hotPhys.x; y = sprite.hotPhys.y; @@ -2328,8 +2327,9 @@ ProcWarpPointer(ClientPtr client) XID winID = stuff->srcWid; WindowPtr source; - source = SecurityLookupWindow(winID, client, DixReadAccess); - if (!source) return BadWindow; + rc = dixLookupWindow(&source, winID, client, DixReadAccess); + if (rc != Success) + return rc; winX = source->drawable.x; winY = source->drawable.y; @@ -3532,8 +3532,8 @@ SetInputFocus( Bool followOK) { register FocusClassPtr focus; - register WindowPtr focusWin; - int mode; + WindowPtr focusWin; + int mode, rc; TimeStamp time; UpdateCurrentTime(); @@ -3550,14 +3550,12 @@ SetInputFocus( focusWin = (WindowPtr)(long)focusID; else if ((focusID == FollowKeyboard) && followOK) focusWin = inputInfo.keyboard->focus->win; - else if (!(focusWin = SecurityLookupWindow(focusID, client, - DixReadAccess))) - return BadWindow; - else - { + else { + rc = dixLookupWindow(&focusWin, focusID, client, DixReadAccess); + if (rc != Success) + return rc; /* It is a match error to try to set the input focus to an unviewable window. */ - if(!focusWin->realized) return(BadMatch); } @@ -3646,6 +3644,7 @@ ProcGrabPointer(ClientPtr client) CursorPtr cursor, oldCursor; REQUEST(xGrabPointerReq); TimeStamp time; + int rc; REQUEST_SIZE_MATCH(xGrabPointerReq); UpdateCurrentTime(); @@ -3671,17 +3670,17 @@ ProcGrabPointer(ClientPtr client) client->errorValue = stuff->eventMask; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; if (stuff->confineTo == None) confineTo = NullWindow; else { - confineTo = SecurityLookupWindow(stuff->confineTo, client, - DixReadAccess); - if (!confineTo) - return BadWindow; + rc = dixLookupWindow(&confineTo, stuff->confineTo, client, + DixReadAccess); + if (rc != Success) + return rc; } if (stuff->cursor == None) cursor = NullCursor; @@ -3812,9 +3811,10 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, unsigned this_mode, unsigned other_mode, Window grabWindow, unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status) { - register WindowPtr pWin; + WindowPtr pWin; register GrabPtr grab; TimeStamp time; + int rc; UpdateCurrentTime(); if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync)) @@ -3832,9 +3832,9 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, client->errorValue = ownerEvents; return BadValue; } - pWin = SecurityLookupWindow(grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; time = ClientTimeToServerTime(ctime); grab = dev->grab; if (grab && !SameClient(grab, client)) @@ -3918,11 +3918,12 @@ ProcQueryPointer(ClientPtr client) WindowPtr pWin, t; REQUEST(xResourceReq); DeviceIntPtr mouse = inputInfo.pointer; + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = SecurityLookupWindow(stuff->id, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; @@ -4086,8 +4087,8 @@ ProcSendEvent(ClientPtr client) effectiveFocus = pWin = inputFocus; } else - pWin = SecurityLookupWindow(stuff->destination, client, - DixReadAccess); + dixLookupWindow(&pWin, stuff->destination, client, DixReadAccess); + if (!pWin) return BadWindow; if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) @@ -4123,11 +4124,12 @@ ProcUngrabKey(ClientPtr client) WindowPtr pWin; GrabRec tempGrab; DeviceIntPtr keybd = inputInfo.keyboard; + int rc; REQUEST_SIZE_MATCH(xUngrabKeyReq); - pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) || (stuff->key < keybd->key->curKeySyms.minKeyCode)) @@ -4164,6 +4166,7 @@ ProcGrabKey(ClientPtr client) REQUEST(xGrabKeyReq); GrabPtr grab; DeviceIntPtr keybd = inputInfo.keyboard; + int rc; REQUEST_SIZE_MATCH(xGrabKeyReq); if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse)) @@ -4196,9 +4199,9 @@ ProcGrabKey(ClientPtr client) client->errorValue = stuff->modifiers; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; grab = CreateGrab(client->index, keybd, pWin, (Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents, @@ -4218,6 +4221,7 @@ ProcGrabButton(ClientPtr client) REQUEST(xGrabButtonReq); CursorPtr cursor; GrabPtr grab; + int rc; REQUEST_SIZE_MATCH(xGrabButtonReq); if ((stuff->pointerMode != GrabModeSync) && @@ -4248,16 +4252,16 @@ ProcGrabButton(ClientPtr client) client->errorValue = stuff->eventMask; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; if (stuff->confineTo == None) confineTo = NullWindow; else { - confineTo = SecurityLookupWindow(stuff->confineTo, client, - DixReadAccess); - if (!confineTo) - return BadWindow; + rc = dixLookupWindow(&confineTo, stuff->confineTo, client, + DixReadAccess); + if (rc != Success) + return rc; } if (stuff->cursor == None) cursor = NullCursor; @@ -4289,6 +4293,7 @@ ProcUngrabButton(ClientPtr client) REQUEST(xUngrabButtonReq); WindowPtr pWin; GrabRec tempGrab; + int rc; REQUEST_SIZE_MATCH(xUngrabButtonReq); if ((stuff->modifiers != AnyModifier) && @@ -4297,9 +4302,9 @@ ProcUngrabButton(ClientPtr client) client->errorValue = stuff->modifiers; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; tempGrab.resource = client->clientAsMask; tempGrab.device = inputInfo.pointer; tempGrab.window = pWin; diff --git a/dix/property.c b/dix/property.c index 5c1e957a5..d40284901 100644 --- a/dix/property.c +++ b/dix/property.c @@ -94,7 +94,7 @@ PrintPropertys(WindowPtr pWin) int ProcRotateProperties(ClientPtr client) { - int i, j, delta; + int i, j, delta, rc; REQUEST(xRotatePropertiesReq); WindowPtr pWin; register Atom * atoms; @@ -104,10 +104,9 @@ ProcRotateProperties(ClientPtr client) REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); UpdateCurrentTime(); - pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; if (!stuff->nAtoms) return(Success); atoms = (Atom *) & stuff[1]; @@ -181,9 +180,7 @@ ProcChangeProperty(ClientPtr client) WindowPtr pWin; char format, mode; unsigned long len; - int sizeInBytes; - int totalSize; - int err; + int sizeInBytes, totalSize, err; REQUEST(xChangePropertyReq); REQUEST_AT_LEAST_SIZE(xChangePropertyReq); @@ -208,10 +205,9 @@ ProcChangeProperty(ClientPtr client) totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + err = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (err != Success) + return err; if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; @@ -445,7 +441,7 @@ int ProcGetProperty(ClientPtr client) { PropertyPtr pProp, prevProp; - unsigned long n, len, ind; + unsigned long n, len, ind, rc; WindowPtr pWin; xGetPropertyReply reply; Mask access_mode = DixReadAccess; @@ -454,10 +450,9 @@ ProcGetProperty(ClientPtr client) REQUEST_SIZE_MATCH(xGetPropertyReq); if (stuff->delete) UpdateCurrentTime(); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; if (!ValidAtom(stuff->property)) { @@ -585,16 +580,15 @@ ProcListProperties(ClientPtr client) { Atom *pAtoms = NULL, *temppAtoms; xListPropertiesReply xlpr; - int numProps = 0; + int rc, numProps = 0; WindowPtr pWin; PropertyPtr pProp; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; pProp = wUserProps (pWin); while (pProp) @@ -636,10 +630,9 @@ ProcDeleteProperty(register ClientPtr client) REQUEST_SIZE_MATCH(xDeletePropertyReq); UpdateCurrentTime(); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (result != Success) + return result; if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c index a9d8b5659..224d6c5e0 100644 --- a/hw/darwin/quartz/applewm.c +++ b/hw/darwin/quartz/applewm.c @@ -490,11 +490,9 @@ ProcAppleWMSetWindowLevel( REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq); - if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, DixReadAccess))) - { + if (Success != dixLookupWindow(&pWin, stuff->window, client, + DixReadAccess)) return BadValue; - } if (stuff->level < 0 || stuff->level >= AppleWMNumWindowLevels) { return BadValue; @@ -602,11 +600,9 @@ ProcAppleWMFrameDraw( REQUEST_AT_LEAST_SIZE(xAppleWMFrameDrawReq); - if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, DixReadAccess))) - { + if (Success != dixLookupWindow(&pWin, stuff->window, client, + DixReadAccess)) return BadValue; - } ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih); or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh); diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c index 02e8b1e7c..b7c81ee57 100644 --- a/hw/dmx/dmx.c +++ b/hw/dmx/dmx.c @@ -286,8 +286,8 @@ static int ProcDMXForceWindowCreation(ClientPtr client) return -1; /* BadWindow */ FOR_NSCREENS(i) { - if (!(pWin = SecurityLookupWindow(win->info[i].id, client, - DixReadAccess))) + if (Success != dixLookupWindow(&pWin, win->info[i].id, client, + DixReadAccess)) return -1; /* BadWindow */ dmxForceWindowCreation(pWin); @@ -296,8 +296,8 @@ static int ProcDMXForceWindowCreation(ClientPtr client) } #endif - if (!(pWin = SecurityLookupWindow(stuff->window, client, - DixReadAccess))) + if (Success != dixLookupWindow(&pWin, stuff->window, client, + DixReadAccess)) return -1; /* BadWindow */ dmxForceWindowCreation(pWin); @@ -560,8 +560,8 @@ static int dmxPopulatePanoramiX(ClientPtr client, Window window, return -1; /* BadWindow */ FOR_NSCREENS(i) { - if (!(pWin = SecurityLookupWindow(win->info[i].id, client, - DixReadAccess))) + if (Success != dixLookupWindow(&pWin, win->info[i].id, client, + DixReadAccess)) return -1; /* BadWindow */ if (dmxGetWindowAttributes(pWin, &attr)) { screens[count] = attr.screen; @@ -587,7 +587,7 @@ static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens, pos, vis); #endif - if (!(pWin = SecurityLookupWindow(window, client, DixReadAccess))) + if (Success != dixLookupWindow(&pWin, window, client, DixReadAccess)) return -1; /* BadWindow */ dmxGetWindowAttributes(pWin, &attr); diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c index 20a02a173..aa9d8318c 100644 --- a/hw/dmx/glxProxy/glxcmds.c +++ b/hw/dmx/glxProxy/glxcmds.c @@ -1137,9 +1137,7 @@ static int MakeCurrent(__GLXclientState *cl, } #ifdef PANORAMIX else if (pXinDraw) { - pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[s].id, - client, - DixReadAccess); + dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess); } #endif else if (pGlxWindow) { @@ -1195,9 +1193,8 @@ static int MakeCurrent(__GLXclientState *cl, } #ifdef PANORAMIX else if (pXinReadDraw) { - pReadWin = (WindowPtr)SecurityLookupWindow(pXinReadDraw->info[s].id, - client, - DixReadAccess); + dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client, + DixReadAccess); } #endif else if (pGlxReadWindow) { @@ -2058,9 +2055,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag) } #ifdef PANORAMIX else if (pXinDraw) { - pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[s].id, - client, - DixReadAccess); + dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess); } #endif else if (pGlxWindow) { @@ -3359,9 +3354,8 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) return __glXBadDrawable; } - pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[screen].id, - client, - DixReadAccess); + dixLookupWindow(&pWin, pXinDraw->info[screen].id, client, + DixReadAccess); } #endif @@ -3521,9 +3515,8 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) return __glXBadDrawable; } - pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[screen].id, - client, - DixReadAccess); + dixLookupWindow(&pWin, pXinDraw->info[screen].id, client, + DixReadAccess); } #endif diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c index e9bcea9a8..825d3dc70 100755 --- a/hw/xwin/winclipboardwrappers.c +++ b/hw/xwin/winclipboardwrappers.c @@ -344,13 +344,11 @@ winProcSetSelectionOwner (ClientPtr client) if (None != stuff->window) { /* Grab the Window from the request */ - pWindow = (WindowPtr) SecurityLookupWindow (stuff->window, client, - DixReadAccess); - if (!pWindow) - { + int rc = dixLookupWindow(&pWindow, stuff->window, client, DixReadAccess); + if (rc != Success) { ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n"); goto winProcSetSelectionOwner_Done; - } + } } /* Now we either have a valid window or None */ diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c index ac92e26df..e1994de84 100755 --- a/hw/xwin/winwindowswm.c +++ b/hw/xwin/winwindowswm.c @@ -441,7 +441,7 @@ ProcWindowsWMFrameDraw (register ClientPtr client) WindowPtr pWin; win32RootlessWindowPtr pRLWinPriv; RECT rcNew; - int nCmdShow; + int nCmdShow, rc; RegionRec newShape; ScreenPtr pScreen; @@ -450,11 +450,9 @@ ProcWindowsWMFrameDraw (register ClientPtr client) #if CYGMULTIWINDOW_DEBUG ErrorF ("ProcWindowsWMFrameDraw\n"); #endif - if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, DixReadAccess))) - { - return BadValue; - } + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; #if CYGMULTIWINDOW_DEBUG ErrorF ("ProcWindowsWMFrameDraw - Window found\n"); #endif @@ -538,6 +536,7 @@ ProcWindowsWMFrameSetTitle( REQUEST(xWindowsWMFrameSetTitleReq); WindowPtr pWin; win32RootlessWindowPtr pRLWinPriv; + int rc; #if CYGMULTIWINDOW_DEBUG ErrorF ("ProcWindowsWMFrameSetTitle\n"); @@ -545,11 +544,9 @@ ProcWindowsWMFrameSetTitle( REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq); - if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, DixReadAccess))) - { - return BadValue; - } + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; #if CYGMULTIWINDOW_DEBUG ErrorF ("ProcWindowsWMFrameSetTitle - Window found\n"); #endif diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index b1ec68b83..7f98965a4 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -70,11 +70,12 @@ ProcRRSelectInput (ClientPtr client) WindowPtr pWin; RREventPtr pRREvent, *pHead; XID clientResource; + int rc; REQUEST_SIZE_MATCH(xRRSelectInputReq); - pWin = SecurityLookupWindow (stuff->window, client, DixWriteAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; pHead = (RREventPtr *)SecurityLookupIDByType(client, pWin->drawable.id, RREventType, DixWriteAccess); diff --git a/randr/rrscreen.c b/randr/rrscreen.c index f1d8fc5d9..6f7afaf7a 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -217,13 +217,12 @@ ProcRRGetScreenSizeRange (ClientPtr client) WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; + int rc; REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); @@ -268,14 +267,12 @@ ProcRRSetScreenSize (ClientPtr client) WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; - int i; + int i, rc; REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); @@ -336,19 +333,16 @@ ProcRRGetScreenResources (ClientPtr client) rrScrPrivPtr pScrPriv; CARD8 *extra; unsigned long extraLen; - int i; + int i, n, rc; RRCrtc *crtcs; RROutput *outputs; xRRModeInfo *modeinfos; CARD8 *names; - int n; REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); @@ -580,7 +574,7 @@ ProcRRGetScreenInfo (ClientPtr client) REQUEST(xRRGetScreenInfoReq); xRRGetScreenInfoReply rep; WindowPtr pWin; - int n; + int n, rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; CARD8 *extra; @@ -588,11 +582,9 @@ ProcRRGetScreenInfo (ClientPtr client) RROutputPtr output; REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 21dbcc2cb..86a512c25 100755 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -239,12 +239,12 @@ ProcXFixesSelectCursorInput (ClientPtr client) { REQUEST (xXFixesSelectCursorInputReq); WindowPtr pWin; + int rc; REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; if (stuff->eventMask & ~CursorAllEvents) { client->errorValue = stuff->eventMask; diff --git a/xfixes/saveset.c b/xfixes/saveset.c index 9ad2627c0..ab75619e8 100755 --- a/xfixes/saveset.c +++ b/xfixes/saveset.c @@ -37,10 +37,9 @@ ProcXFixesChangeSaveSet(ClientPtr client) REQUEST(xXFixesChangeSaveSetReq); REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (result != Success) + return result; if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) return BadMatch; if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete)) diff --git a/xfixes/select.c b/xfixes/select.c index a718715a1..d1c22c552 100755 --- a/xfixes/select.c +++ b/xfixes/select.c @@ -193,12 +193,12 @@ ProcXFixesSelectSelectionInput (ClientPtr client) { REQUEST (xXFixesSelectSelectionInputReq); WindowPtr pWin; + int rc; REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; if (stuff->eventMask & ~SelectionAllEvents) { client->errorValue = stuff->eventMask; -- cgit v1.2.3 From 10aabb729d1586db344f9c1abdf1cf45e7ddaa7a Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 15 Dec 2006 16:36:29 -0500 Subject: Convert callers of LookupDrawable() to dixLookupDrawable(). --- GL/glx/glxcmds.c | 18 +++++++----- XTrap/xtrapdi.c | 4 +-- Xext/mbuf.c | 10 +++---- Xext/saver.c | 36 +++++++++++++---------- Xext/xprint.c | 7 +++-- hw/dmx/glxProxy/glxcmds.c | 75 ++++++++++++++++++++++++----------------------- 6 files changed, 80 insertions(+), 70 deletions(-) diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index ccdf3fa00..6273edc56 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -441,6 +441,7 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, __GLcontextModes *modes; __GLXdrawable *pGlxDraw; __GLXpixmap *drawPixmap = NULL; + int rc; /* This is the GLX 1.3 case - the client passes in a GLXWindow and * we just return the __GLXdrawable. The first time a GLXPixmap @@ -466,8 +467,8 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, * GLXWindow with the same XID as an X Window, so we wont get any * resource ID clashes. Effectively, the X Window is now also a * GLXWindow. */ - pDraw = (DrawablePtr) LookupDrawable(drawId, client); - if (pDraw) { + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + if (rc == Success) { if (pDraw->type == DRAWABLE_WINDOW) { VisualID vid = wVisual((WindowPtr)pDraw); @@ -1199,12 +1200,12 @@ static int ValidateCreateDrawable(ClientPtr client, ScreenPtr pScreen; VisualPtr pVisual; __GLXscreen *pGlxScreen; - int i; + int i, rc; LEGAL_NEW_RESOURCE(glxDrawableId, client); - pDraw = (DrawablePtr) LookupDrawable(drawablId, client); - if (!pDraw || pDraw->type != type) { + rc = dixLookupDrawable(&pDraw, drawablId, client, 0, DixUnknownAccess); + if (rc != Success || pDraw->type != type) { client->errorValue = drawablId; return type == DRAWABLE_WINDOW ? BadWindow : BadPixmap; } @@ -2034,10 +2035,11 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc; XID drawable = req->drawable; int barrier = req->barrier; - DrawablePtr pDraw = (DrawablePtr) LookupDrawable(drawable, client); - int screen; + DrawablePtr pDraw; + int screen, rc; - if (pDraw && (pDraw->type == DRAWABLE_WINDOW)) { + rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixUnknownAccess); + if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) { screen = pDraw->pScreen->myNum; if (__glXSwapBarrierFuncs && __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc) { diff --git a/XTrap/xtrapdi.c b/XTrap/xtrapdi.c index c5d640d0b..23d3bde7f 100644 --- a/XTrap/xtrapdi.c +++ b/XTrap/xtrapdi.c @@ -1092,8 +1092,8 @@ int XETrapRequestVector(ClientPtr client) pdata->hdr.client = client->index; /* stuff client index in hdr */ if (BitIsTrue(penv->cur.data_config_flags_data,XETrapWinXY)) { - window_ptr = (WindowPtr) LookupDrawable(stuff->id, client); - if (window_ptr == 0L) + if (Success != dixLookupDrawable(&window_ptr, stuff->id, + client, 0, DixUnknownAccess)) { /* Failed...invalidate the X and Y coordinate data. */ pdata->hdr.win_x = -1L; pdata->hdr.win_y = -1L; diff --git a/Xext/mbuf.c b/Xext/mbuf.c index 43e2cc107..ed352e21b 100644 --- a/Xext/mbuf.c +++ b/Xext/mbuf.c @@ -786,15 +786,15 @@ ProcGetBufferInfo (client) DrawablePtr pDrawable; xMbufGetBufferInfoReply rep; ScreenPtr pScreen; - int i, j, k; - int n; + int i, j, k, n, rc; xMbufBufferInfo *pInfo; int nInfo; DepthPtr pDepth; - pDrawable = (DrawablePtr) LookupDrawable (stuff->drawable, client); - if (!pDrawable) - return BadDrawable; + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixUnknownAccess); + if (rc != Success) + return rc; pScreen = pDrawable->pScreen; nInfo = 0; for (i = 0; i < pScreen->numDepths; i++) diff --git a/Xext/saver.c b/Xext/saver.c index d6b537a78..7e3ebf408 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -780,16 +780,17 @@ ProcScreenSaverQueryInfo (client) { REQUEST(xScreenSaverQueryInfoReq); xScreenSaverQueryInfoReply rep; - register int n; + register int n, rc; ScreenSaverStuffPtr pSaver; DrawablePtr pDraw; CARD32 lastInput; ScreenSaverScreenPrivatePtr pPriv; REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq); - pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); - if (!pDraw) - return BadDrawable; + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixUnknownAccess); + if (rc != Success) + return rc; pSaver = &savedScreenInfo[pDraw->pScreen->myNum]; pPriv = GetScreenPrivate (pDraw->pScreen); @@ -852,11 +853,13 @@ ProcScreenSaverSelectInput (client) { REQUEST(xScreenSaverSelectInputReq); DrawablePtr pDraw; + int rc; REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq); - pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); - if (!pDraw) - return BadDrawable; + rc = dixLookupDrawable (&pDraw, stuff->drawable, client, 0, + DixUnknownAccess); + if (rc != Success) + return rc; if (!setEventMask (pDraw->pScreen, client, stuff->eventMask)) return BadAlloc; return Success; @@ -871,9 +874,7 @@ ScreenSaverSetAttributes (ClientPtr client) ScreenPtr pScreen; ScreenSaverScreenPrivatePtr pPriv = 0; ScreenSaverAttrPtr pAttr = 0; - int ret; - int len; - int class, bw, depth; + int ret, len, class, bw, depth; unsigned long visual; int idepth, ivisual; Bool fOK; @@ -891,9 +892,10 @@ ScreenSaverSetAttributes (ClientPtr client) ColormapPtr pCmap; REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq); - pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); - if (!pDraw) - return BadDrawable; + ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixUnknownAccess); + if (ret != Success) + return ret; pScreen = pDraw->pScreen; pParent = WindowTable[pScreen->myNum]; @@ -1246,11 +1248,13 @@ ScreenSaverUnsetAttributes (ClientPtr client) REQUEST(xScreenSaverSetAttributesReq); DrawablePtr pDraw; ScreenSaverScreenPrivatePtr pPriv; + int rc; REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq); - pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); - if (!pDraw) - return BadDrawable; + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixUnknownAccess); + if (rc != Success) + return rc; pPriv = GetScreenPrivate (pDraw->pScreen); if (pPriv && pPriv->attr && pPriv->attr->client == client) { diff --git a/Xext/xprint.c b/Xext/xprint.c index d8fc51713..4ac13e6d1 100644 --- a/Xext/xprint.c +++ b/Xext/xprint.c @@ -1944,8 +1944,11 @@ ProcXpPutDocumentData(ClientPtr client) if (stuff->drawable) { if (pContext->state & DOC_RAW_STARTED) return BadDrawable; - pDraw = (DrawablePtr)LookupDrawable(stuff->drawable, client); - if (!pDraw || pDraw->pScreen->myNum != pContext->screenNum) + result = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixUnknownAccess); + if (result != Success) + return result; + if (pDraw->pScreen->myNum != pContext->screenNum) return BadDrawable; } else { if (pContext->state & DOC_COOKED_STARTED) diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c index aa9d8318c..6771cf1de 100644 --- a/hw/dmx/glxProxy/glxcmds.c +++ b/hw/dmx/glxProxy/glxcmds.c @@ -430,9 +430,10 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) DrawablePtr pDraw; __GLXpixmap *pGlxPixmap = NULL; __glXWindow *pGlxWindow = NULL; + int rc; - pDraw = (DrawablePtr) LookupDrawable(req->drawable, client); - if (!pDraw) { + rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess); + if (rc != Success) { pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable, __glXPixmapRes); if (pGlxPixmap) pDraw = pGlxPixmap->pDraw; @@ -459,9 +460,10 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) DrawablePtr pDraw, pMember = NULL; __GLXpixmap *pGlxPixmap = NULL; __glXWindow *pGlxWindow = NULL; + int rc; - pDraw = (DrawablePtr) LookupDrawable(req->drawable, client); - if (!pDraw) { + rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess); + if (rc != Success) { pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable, __glXPixmapRes); if (pGlxPixmap) pDraw = pGlxPixmap->pDraw; @@ -479,8 +481,9 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) } if (req->member != None) { - pMember = (DrawablePtr) LookupDrawable(req->member, client); - if (!pMember) { + rc = dixLookupDrawable(&pMember, req->member, client, 0, + DixUnknownAccess); + if (rc != Success) { pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member, __glXPixmapRes); if (pGlxPixmap) pMember = pGlxPixmap->pDraw; @@ -734,7 +737,7 @@ static int MakeCurrent(__GLXclientState *cl, #endif int from_screen = 0; int to_screen = 0; - int s; + int s, rc; /* ** If one is None and the other isn't, it's a bad match. @@ -778,8 +781,8 @@ static int MakeCurrent(__GLXclientState *cl, } if (drawId != None) { - pDraw = (DrawablePtr) LookupDrawable(drawId, client); - if (pDraw) { + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + if (rc == Success) { if (pDraw->type == DRAWABLE_WINDOW) { /* ** Drawable is an X Window. @@ -885,8 +888,8 @@ static int MakeCurrent(__GLXclientState *cl, } if (readId != None && readId != drawId ) { - pReadDraw = (DrawablePtr) LookupDrawable(readId, client); - if (pReadDraw) { + rc = dixLookupDrawable(&pReadDraw, readId, client, 0,DixUnknownAccess); + if (rc == Success) { if (pReadDraw->type == DRAWABLE_WINDOW) { /* ** Drawable is an X Window. @@ -1636,18 +1639,16 @@ static int CreateGLXPixmap(__GLXclientState *cl, __GLXscreenInfo *pGlxScreen; __GLXvisualConfig *pGlxVisual; __GLXFBConfig *pFBConfig; - int i; - int s; + int i, s, rc; int from_screen, to_screen; #ifdef PANORAMIX PanoramiXRes *pXinDraw = NULL; #endif - pDraw = (DrawablePtr) LookupDrawable(pixmapId, client); - if (!pDraw || pDraw->type != DRAWABLE_PIXMAP) { - client->errorValue = pixmapId; - return BadPixmap; - } + rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP, + DixUnknownAccess); + if (rc != Success) + return rc; /* ** Check if screen of visual matches screen of pixmap. @@ -1778,7 +1779,8 @@ static int CreateGLXPixmap(__GLXclientState *cl, #ifdef PANORAMIX if (pXinDraw) { - pRealDraw = (DrawablePtr) LookupDrawable(pXinDraw->info[s].id,client); + dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0, + DixUnknownAccess); } #endif @@ -1944,14 +1946,13 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag) __glXWindow *pGlxWindow = NULL; int from_screen = 0; int to_screen = 0; - int s; + int s, rc; /* ** Check that the GLX drawable is valid. */ - pDraw = (DrawablePtr) LookupDrawable(drawId, client); - if (pDraw) { - + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + if (rc == Success) { from_screen = to_screen = pDraw->pScreen->myNum; if (pDraw->type == DRAWABLE_WINDOW) { @@ -2099,12 +2100,13 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) __GLXpixmap *pGlxPixmap = NULL; __GLXcontext *glxc = NULL; __glXWindow *pGlxWindow = NULL; + int rc; /* ** Check that the GLX drawable is valid. */ - pDraw = (DrawablePtr) LookupDrawable(drawId, client); - if (pDraw) { + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + if (rc == Success) { if (pDraw->type != DRAWABLE_WINDOW) { /* ** Drawable is an X pixmap, which is not allowed. @@ -2892,16 +2894,15 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc) __GLXFBConfig *pGlxFBConfig = NULL; VisualPtr pVisual; VisualID visId; - int i; + int i, rc; /* ** Check if windowId is valid */ - pDraw = (DrawablePtr) LookupDrawable(windowId, client); - if (!pDraw || pDraw->type != DRAWABLE_WINDOW) { - client->errorValue = windowId; - return BadWindow; - } + rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW, + DixUnknownAccess); + if (rc != Success) + return rc; /* ** Check if screen of window matches screen of fbconfig. @@ -3274,7 +3275,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) GLXDrawable be_drawable = 0; DrawablePtr pDraw = NULL; Display *dpy; - int screen; + int screen, rc; DMXScreenInfo *dmxScreen; CARD32 *attribs = NULL; int attribs_size; @@ -3283,8 +3284,8 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) #endif if (drawId != None) { - pDraw = (DrawablePtr) LookupDrawable(drawId, client); - if (pDraw) { + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + if (rc == Success) { if (pDraw->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr)pDraw; be_drawable = 0; @@ -3435,7 +3436,7 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) GLXDrawable be_drawable = 0; DrawablePtr pDraw = NULL; Display *dpy; - int screen; + int screen, rc; DMXScreenInfo *dmxScreen; char *attrbuf; #ifdef PANORAMIX @@ -3444,8 +3445,8 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) #endif if (drawId != None) { - pDraw = (DrawablePtr) LookupDrawable(drawId, client); - if (pDraw) { + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + if (rc == Success) { if (pDraw->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr)pDraw; be_drawable = 0; -- cgit v1.2.3 From f11dafaafc68f5cff1a1538d9566907786d8ab72 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 15 Dec 2006 16:51:58 -0500 Subject: Convert callers of SecurityLookupDrawable() to dixLookupDrawable(). --- dbe/dbe.c | 10 +++++----- hw/darwin/quartz/xpr/appledri.c | 22 ++++++++++------------ hw/xfree86/dri/xf86dri.c | 35 ++++++++++++++++------------------- 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/dbe/dbe.c b/dbe/dbe.c index 69ddf4f1c..38375f92a 100644 --- a/dbe/dbe.c +++ b/dbe/dbe.c @@ -865,7 +865,7 @@ ProcDbeGetVisualInfo(ClientPtr client) xDbeGetVisualInfoReply rep; Drawable *drawables; DrawablePtr *pDrawables = NULL; - register int i, j, n; + register int i, j, n, rc; register int count; /* number of visual infos in reply */ register int length; /* length of reply */ ScreenPtr pScreen; @@ -887,11 +887,11 @@ ProcDbeGetVisualInfo(ClientPtr client) for (i = 0; i < stuff->n; i++) { - if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable( - drawables[i], client, DixReadAccess))) - { + rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0, + DixReadAccess); + if (rc != Success) { DEALLOCATE_LOCAL(pDrawables); - return(BadDrawable); + return rc; } } } diff --git a/hw/darwin/quartz/xpr/appledri.c b/hw/darwin/quartz/xpr/appledri.c index 585d7e1be..dd688cae3 100644 --- a/hw/darwin/quartz/xpr/appledri.c +++ b/hw/darwin/quartz/xpr/appledri.c @@ -213,6 +213,7 @@ ProcAppleDRICreateSurface( DrawablePtr pDrawable; xp_surface_id sid; unsigned int key[2]; + int rc; REQUEST(xAppleDRICreateSurfaceReq); REQUEST_SIZE_MATCH(xAppleDRICreateSurfaceReq); @@ -220,12 +221,10 @@ ProcAppleDRICreateSurface( rep.length = 0; rep.sequenceNumber = client->sequence; - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - DixReadAccess))) { - return BadValue; - } + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; rep.key_0 = rep.key_1 = rep.uid = 0; @@ -252,13 +251,12 @@ ProcAppleDRIDestroySurface( REQUEST(xAppleDRIDestroySurfaceReq); DrawablePtr pDrawable; REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq); + int rc; - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - DixReadAccess))) { - return BadValue; - } + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; if (!DRIDestroySurface( screenInfo.screens[stuff->screen], (Drawable)stuff->drawable, diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c index 03e6725ff..933cd3e18 100644 --- a/hw/xfree86/dri/xf86dri.c +++ b/hw/xfree86/dri/xf86dri.c @@ -386,6 +386,7 @@ ProcXF86DRICreateDrawable( { xXF86DRICreateDrawableReply rep; DrawablePtr pDrawable; + int rc; REQUEST(xXF86DRICreateDrawableReq); REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq); @@ -398,12 +399,10 @@ ProcXF86DRICreateDrawable( rep.length = 0; rep.sequenceNumber = client->sequence; - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - DixReadAccess))) { - return BadValue; - } + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; if (!DRICreateDrawable( screenInfo.screens[stuff->screen], (Drawable)stuff->drawable, @@ -424,17 +423,17 @@ ProcXF86DRIDestroyDrawable( REQUEST(xXF86DRIDestroyDrawableReq); DrawablePtr pDrawable; REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq); + int rc; + if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - DixReadAccess))) { - return BadValue; - } + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; if (!DRIDestroyDrawable( screenInfo.screens[stuff->screen], (Drawable)stuff->drawable, @@ -455,7 +454,7 @@ ProcXF86DRIGetDrawableInfo( int X, Y, W, H; drm_clip_rect_t * pClipRects; drm_clip_rect_t * pBackClipRects; - int backX, backY; + int backX, backY, rc; REQUEST(xXF86DRIGetDrawableInfoReq); REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq); @@ -468,12 +467,10 @@ ProcXF86DRIGetDrawableInfo( rep.length = 0; rep.sequenceNumber = client->sequence; - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - DixReadAccess))) { - return BadValue; - } + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; if (!DRIGetDrawableInfo( screenInfo.screens[stuff->screen], pDrawable, -- cgit v1.2.3 From ab1d5b0c31a1cfce95ab6b1d06f209f2c44e19ac Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 15 Dec 2006 17:26:58 -0500 Subject: Convert callers of LookupClient() to dixLookupClient(). --- Xext/appgroup.c | 7 +++++-- Xext/sync.c | 20 ++++++++++++-------- dix/dispatch.c | 12 +++++------- dix/dixutils.c | 5 +++-- include/dix.h | 3 ++- 5 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Xext/appgroup.c b/Xext/appgroup.c index 134b172f9..bb7a73ce1 100644 --- a/Xext/appgroup.c +++ b/Xext/appgroup.c @@ -485,10 +485,13 @@ int ProcXagQuery( ClientPtr pClient; AppGroupPtr pAppGrp; REQUEST (xXagQueryReq); - int n; + int n, rc; REQUEST_SIZE_MATCH (xXagQueryReq); - pClient = LookupClient (stuff->resource, client); + rc = dixLookupClient(&pClient, stuff->resource, client, DixUnknownAccess); + if (rc != Success) + return rc; + for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next) for (n = 0; n < pAppGrp->nclients; n++) if (pAppGrp->clients[n] == pClient) { diff --git a/Xext/sync.c b/Xext/sync.c index 1d899348b..531b48cc1 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -1452,15 +1452,17 @@ ProcSyncSetPriority(client) { REQUEST(xSyncSetPriorityReq); ClientPtr priorityclient; + int rc; REQUEST_SIZE_MATCH(xSyncSetPriorityReq); if (stuff->id == None) priorityclient = client; - else if (!(priorityclient = LookupClient(stuff->id, client))) - { - client->errorValue = stuff->id; - return BadMatch; + else { + rc = dixLookupClient(&priorityclient, stuff->id, client, + DixUnknownAccess); + if (rc != Success) + return rc; } if (priorityclient->priority != stuff->priority) @@ -1487,15 +1489,17 @@ ProcSyncGetPriority(client) REQUEST(xSyncGetPriorityReq); xSyncGetPriorityReply rep; ClientPtr priorityclient; + int rc; REQUEST_SIZE_MATCH(xSyncGetPriorityReq); if (stuff->id == None) priorityclient = client; - else if (!(priorityclient = LookupClient(stuff->id, client))) - { - client->errorValue = stuff->id; - return BadMatch; + else { + rc = dixLookupClient(&priorityclient, stuff->id, client, + DixUnknownAccess); + if (rc != Success) + return rc; } rep.type = X_Reply; diff --git a/dix/dispatch.c b/dix/dispatch.c index 3060a4c39..51ad07da5 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3388,7 +3388,8 @@ int ProcKillClient(register ClientPtr client) { REQUEST(xResourceReq); - ClientPtr killclient; + ClientPtr killclient; + int rc; REQUEST_SIZE_MATCH(xResourceReq); if (stuff->id == AllTemporary) @@ -3397,8 +3398,8 @@ ProcKillClient(register ClientPtr client) return (client->noClientException); } - if ((killclient = LookupClient(stuff->id, client))) - { + rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess); + if (rc == Success) { CloseDownClient(killclient); /* if an LBX proxy gets killed, isItTimeToYield will be set */ if (isItTimeToYield || (client == killclient)) @@ -3412,10 +3413,7 @@ ProcKillClient(register ClientPtr client) return (client->noClientException); } else - { - client->errorValue = stuff->id; - return (BadValue); - } + return rc; } int diff --git a/dix/dixutils.c b/dix/dixutils.c index 3479ddccf..2859b96e9 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -262,11 +262,12 @@ dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access) } _X_EXPORT int -dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client) +dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access) { pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY, DixReadAccess); int clientIndex = CLIENT_ID(rid); + client->errorValue = rid; if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) { *pClient = clients[clientIndex]; @@ -312,7 +313,7 @@ _X_EXPORT ClientPtr LookupClient(XID id, ClientPtr client) { ClientPtr pClient; - int i = dixLookupClient(&pClient, id, client); + int i = dixLookupClient(&pClient, id, client, DixUnknownAccess); return (i == Success) ? pClient : NULL; } diff --git a/include/dix.h b/include/dix.h index baff43f54..5c2c5b862 100644 --- a/include/dix.h +++ b/include/dix.h @@ -301,7 +301,8 @@ extern int dixLookupGC( extern int dixLookupClient( ClientPtr *result, XID id, - ClientPtr client); + ClientPtr client, + Mask access_mode); /* * These are deprecated compatibility functions and will be removed soon! -- cgit v1.2.3 From 012807356883128fde58bb2d4f91dd356d6418fc Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 15 Dec 2006 18:27:16 -0500 Subject: Add loud warnings to deprecated lookup functions. Hopefully this will alert external driver maintainers. --- dix/dixutils.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/dix/dixutils.c b/dix/dixutils.c index 2859b96e9..084d2e4c5 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -281,39 +281,53 @@ dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access) * These are deprecated compatibility functions and will be removed soon! * Please use the new dixLookup*() functions above. */ -_X_EXPORT WindowPtr +_X_EXPORT _X_DEPRECATED WindowPtr SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode) { WindowPtr pWin; int i = dixLookupWindow(&pWin, id, client, access_mode); + static int warn = 1; + if (warn-- > 0) + ErrorF("Warning: LookupWindow()/SecurityLookupWindow() " + "are deprecated. Please convert your driver/module " + "to use dixLookupWindow().\n"); return (i == Success) ? pWin : NULL; } -_X_EXPORT WindowPtr +_X_EXPORT _X_DEPRECATED WindowPtr LookupWindow(XID id, ClientPtr client) { return SecurityLookupWindow(id, client, DixUnknownAccess); } -_X_EXPORT pointer +_X_EXPORT _X_DEPRECATED pointer SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode) { DrawablePtr pDraw; int i = dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode); + static int warn = 1; + if (warn-- > 0) + ErrorF("Warning: LookupDrawable()/SecurityLookupDrawable() " + "are deprecated. Please convert your driver/module " + "to use dixLookupDrawable().\n"); return (i == Success) ? pDraw : NULL; } -_X_EXPORT pointer +_X_EXPORT _X_DEPRECATED pointer LookupDrawable(XID id, ClientPtr client) { return SecurityLookupDrawable(id, client, DixUnknownAccess); } -_X_EXPORT ClientPtr +_X_EXPORT _X_DEPRECATED ClientPtr LookupClient(XID id, ClientPtr client) { ClientPtr pClient; int i = dixLookupClient(&pClient, id, client, DixUnknownAccess); + static int warn = 1; + if (warn-- > 0) + ErrorF("Warning: LookupClient() is deprecated. Please convert your " + "driver/module to use dixLookupClient().\n"); return (i == Success) ? pClient : NULL; } -- cgit v1.2.3 From c92f7bef54fa737766d65fe32c200f405f39228c Mon Sep 17 00:00:00 2001 From: Kevin E Martin Date: Sat, 16 Dec 2006 12:01:49 -0500 Subject: For Xvfb, Xnest and Xprt, compile fbcmap.c with -DXFree86Server --- hw/vfb/Makefile.am | 1 + hw/xnest/Makefile.am | 1 + hw/xprint/Makefile.am | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/vfb/Makefile.am b/hw/vfb/Makefile.am index 2a0151f57..4f711fde7 100644 --- a/hw/vfb/Makefile.am +++ b/hw/vfb/Makefile.am @@ -21,6 +21,7 @@ Xvfb_LDFLAGS = AM_CFLAGS = -DHAVE_DIX_CONFIG_H \ -DNO_HW_ONLY_EXTS \ -DNO_MODULE_EXTS \ + -DXFree86Server \ $(XVFBMODULES_CFLAGS) \ $(DIX_CFLAGS) diff --git a/hw/xnest/Makefile.am b/hw/xnest/Makefile.am index d40d122f4..cce1fef94 100644 --- a/hw/xnest/Makefile.am +++ b/hw/xnest/Makefile.am @@ -51,6 +51,7 @@ Xnest_LDFLAGS = AM_CFLAGS = -DHAVE_XNEST_CONFIG_H \ -DNO_HW_ONLY_EXTS \ + -DXFree86Server \ $(DIX_CFLAGS) \ $(XNESTMODULES_CFLAGS) diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am index 27a7e30d1..d4f22d261 100644 --- a/hw/xprint/Makefile.am +++ b/hw/xprint/Makefile.am @@ -5,7 +5,8 @@ bin_PROGRAMS = Xprt Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \ -DXPRINT -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \ -DXPRINTDIR=\"$(libdir)/X11/xserver\" \ - -DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX + -DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \ + -DXFree86Server Xprt_LDFLAGS = -L$(top_srcdir) Xprt_LDADD = @XPRINT_LIBS@ ps/libps.la raster/libraster.la \ -- cgit v1.2.3 From a5fcf1e5e7452c9be82f63b6c2be2a25c4109523 Mon Sep 17 00:00:00 2001 From: James Steven Supancic III Date: Sat, 16 Dec 2006 12:02:38 -0500 Subject: Fix RENDER issues (bug #7555) and implement RENDER add/remove screen support (bug #8485). --- configure.ac | 2 +- hw/dmx/dmxextension.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++++- hw/dmx/dmxinit.c | 2 +- hw/dmx/dmxpict.c | 85 +++++++++++++++++++------------- hw/dmx/dmxpict.h | 2 + 5 files changed, 188 insertions(+), 36 deletions(-) diff --git a/configure.ac b/configure.ac index 002be624c..491bdd511 100644 --- a/configure.ac +++ b/configure.ac @@ -1007,7 +1007,7 @@ dnl --------------------------------------------------------------------------- dnl DMX DDX AC_MSG_CHECKING([whether to build Xdmx DDX]) -PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no]) +PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfixes xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no]) if test "x$DMX" = xauto; then DMX="$have_dmx" fi diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c index efcaca457..c12973bd5 100644 --- a/hw/dmx/dmxextension.c +++ b/hw/dmx/dmxextension.c @@ -1056,6 +1056,116 @@ static Bool dmxCompareScreens(DMXScreenInfo *new, DMXScreenInfo *old) return TRUE; } +#ifdef RENDER +/** Restore Render's picture */ +static void dmxBERestoreRenderPict(pointer value, XID id, pointer n) +{ + PicturePtr pPicture = value; /* The picture */ + DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */ + int scrnNum = (int)n; + + if (pDraw->pScreen->myNum != scrnNum) { + /* Picture not on the screen we are restoring*/ + return; + } + + if (pDraw->type == DRAWABLE_PIXMAP) { + PixmapPtr pPixmap = (PixmapPtr)pDraw; + + /* Create and restore the pixmap drawable */ + dmxBECreatePixmap(pPixmap); + dmxBERestorePixmap(pPixmap); + } + + dmxBECreatePicture(pPicture); +} + +/** Restore Render's glyphs */ +static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n) +{ + GlyphSetPtr glyphSet = value; + int scrnNum = (int)n; + dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); + DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum]; + GlyphRefPtr table; + char *images; + Glyph *gids; + XGlyphInfo *glyphs; + char *pos; + int beret; + int len_images = 0; + int i; + int ctr; + + if (glyphPriv->glyphSets[scrnNum]) { + /* Only restore glyphs on the screen we are attaching */ + return; + } + + /* First we must create the glyph set on the backend. */ + if ((beret = dmxBECreateGlyphSet(scrnNum, glyphSet)) != Success) { + dmxLog(dmxWarning, + "\tdmxBERestoreRenderGlyph failed to create glyphset!\n"); + return; + } + + /* Now for the complex part, restore the glyph data */ + table = glyphSet->hash.table; + + /* We need to know how much memory to allocate for this part */ + for (i = 0; i < glyphSet->hash.hashSet->size; i++) { + GlyphRefPtr gr = &table[i]; + GlyphPtr gl = gr->glyph; + + if (!gl || gl == DeletedGlyph) continue; + len_images += gl->size - sizeof(gl->info); + } + + /* Now allocate the memory we need */ + images = ALLOCATE_LOCAL(len_images*sizeof(char)); + gids = ALLOCATE_LOCAL(glyphSet->hash.tableEntries*sizeof(Glyph)); + glyphs = ALLOCATE_LOCAL(glyphSet->hash.tableEntries*sizeof(XGlyphInfo)); + + memset(images, 0, len_images * sizeof(char)); + pos = images; + ctr = 0; + + /* Fill the allocated memory with the proper data */ + for (i = 0; i < glyphSet->hash.hashSet->size; i++) { + GlyphRefPtr gr = &table[i]; + GlyphPtr gl = gr->glyph; + + if (!gl || gl == DeletedGlyph) continue; + + /* First lets put the data into gids */ + gids[ctr] = gr->signature; + + /* Next do the glyphs data structures */ + glyphs[ctr].width = gl->info.width; + glyphs[ctr].height = gl->info.height; + glyphs[ctr].x = gl->info.x; + glyphs[ctr].y = gl->info.y; + glyphs[ctr].xOff = gl->info.xOff; + glyphs[ctr].yOff = gl->info.yOff; + + /* Copy the images from the DIX's data into the buffer */ + memcpy(pos, gl+1, gl->size - sizeof(gl->info)); + pos += gl->size - sizeof(gl->info); + ctr++; + } + + /* Now restore the glyph data */ + XRenderAddGlyphs(dmxScreen->beDisplay, glyphPriv->glyphSets[scrnNum], + gids,glyphs, glyphSet->hash.tableEntries, images, + len_images); + + /* Clean up */ + DEALLOCATE_LOCAL(len_images); + DEALLOCATE_LOCAL(gids); + DEALLOCATE_LOCAL(glyphs); +} +#endif + /** Reattach previously detached back-end screen. */ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) { @@ -1174,6 +1284,20 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) /* Create window hierarchy (top down) */ dmxBECreateWindowTree(idx); +#ifdef RENDER + /* Restore the picture state for RENDER */ + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindClientResourcesByType(clients[i],PictureType, + dmxBERestoreRenderPict,(pointer)idx); + + /* Restore the glyph state for RENDER */ + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindClientResourcesByType(clients[i],GlyphSetType, + dmxBERestoreRenderGlyph,(pointer)idx); +#endif + /* Refresh screen by generating exposure events for all windows */ dmxForceExposures(idx); @@ -1362,8 +1486,15 @@ static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type, #ifdef RENDER } else if ((type & TypeMask) == (PictureType & TypeMask)) { PicturePtr pPict = value; - if (pPict->pDrawable->pScreen->myNum == scrnNum) + if (pPict->pDrawable->pScreen->myNum == scrnNum) { + /* Free the pixmaps on the backend if needed */ + if (pPict->pDrawable->type == DRAWABLE_PIXMAP) { + PixmapPtr pPixmap = (PixmapPtr)(pPict->pDrawable); + dmxBESavePixmap(pPixmap); + dmxBEFreePixmap(pPixmap); + } dmxBEFreePicture((PicturePtr)value); + } } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) { dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value); #endif diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c index 9c5356ed5..1d3689c40 100644 --- a/hw/dmx/dmxinit.c +++ b/hw/dmx/dmxinit.c @@ -624,7 +624,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[]) } /* Make sure that the command-line arguments are sane. */ - if (dmxAddRemoveScreens && (!noRenderExtension || dmxGLXProxy)) { + if (dmxAddRemoveScreens && dmxGLXProxy) { /* Currently it is not possible to support GLX and Render * extensions with dynamic screen addition/removal due to the * state that each extension keeps, which cannot be restored. */ diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c index 339692538..0f1782e51 100644 --- a/hw/dmx/dmxpict.c +++ b/hw/dmx/dmxpict.c @@ -223,6 +223,36 @@ Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet) return FALSE; } +/** Create \a glyphSet on the backend screen number \a idx. */ +int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet) +{ + XRenderPictFormat *pFormat; + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); + PictFormatPtr pFmt = glyphSet->format; + int (*oldErrorHandler)(Display *, XErrorEvent *); + + pFormat = dmxFindFormat(dmxScreen, pFmt); + if (!pFormat) { + return BadMatch; + } + + dmxGlyphLastError = 0; + oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler); + + /* Catch when this fails */ + glyphPriv->glyphSets[idx] + = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat); + + XSetErrorHandler(oldErrorHandler); + + if (dmxGlyphLastError) { + return dmxGlyphLastError; + } + + return Success; +} + /** Create a Glyph Set on each screen. Save the glyphset ID from each * screen in the Glyph Set's private structure. Fail if the format * requested is not available or if the Glyph Set cannot be created on @@ -235,12 +265,9 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client) ret = dmxSaveRenderVector[stuff->renderReqType](client); if (ret == Success) { - int (*oldErrorHandler)(Display *, XErrorEvent *); GlyphSetPtr glyphSet; dmxGlyphPrivPtr glyphPriv; int i; - PictFormatPtr pFmt; - XRenderPictFormat *pFormat; /* Look up glyphSet that was just created ???? */ /* Store glyphsets from backends in glyphSet->devPrivate ????? */ @@ -254,21 +281,16 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client) MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc); DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv); - pFmt = SecurityLookupIDByType(client, stuff->format, PictFormatType, - DixReadAccess); - - oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler); - for (i = 0; i < dmxNumScreens; i++) { DMXScreenInfo *dmxScreen = &dmxScreens[i]; + int beret; if (!dmxScreen->beDisplay) { glyphPriv->glyphSets[i] = 0; continue; } - pFormat = dmxFindFormat(dmxScreen, pFmt); - if (!pFormat) { + if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) { int j; /* Free the glyph sets we've allocated thus far */ @@ -278,30 +300,9 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client) /* Free the resource created by render */ FreeResource(stuff->gsid, RT_NONE); - ret = BadMatch; - break; - } - - /* Catch when this fails */ - glyphPriv->glyphSets[i] - = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat); - - if (dmxGlyphLastError) { - int j; - - /* Free the glyph sets we've allocated thus far */ - for (j = 0; j < i; j++) - dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet); - - /* Free the resource created by render */ - FreeResource(stuff->gsid, RT_NONE); - - ret = dmxGlyphLastError; - break; + return beret; } } - - XSetErrorHandler(oldErrorHandler); } return ret; @@ -753,6 +754,20 @@ void dmxCreatePictureList(WindowPtr pWindow) } } +/** Create \a pPicture on the backend. */ +int dmxBECreatePicture(PicturePtr pPicture) +{ + dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); + + /* Create picutre on BE */ + pPictPriv->pict = dmxDoCreatePicture(pPicture); + + /* Flush changes to the backend server */ + dmxValidatePicture(pPicture, (1 << (CPLastBit+1)) - 1); + + return Success; +} + /** Create a picture. This function handles the CreatePicture * unwrapping/wrapping and calls dmxDoCreatePicture to actually create * the picture on the appropriate screen. */ @@ -853,7 +868,11 @@ int dmxChangePictureClip(PicturePtr pPicture, int clipType, /* The clip has already been changed into a region by the mi * routine called above. */ - if (pPicture->clientClip) { + if (clipType == CT_NONE) { + /* Disable clipping, show all */ + XFixesSetPictureClipRegion(dmxScreen->beDisplay, + pPictPriv->pict, 0, 0, None); + } else if (pPicture->clientClip) { RegionPtr pClip = pPicture->clientClip; BoxPtr pBox = REGION_RECTS(pClip); int nBox = REGION_NUM_RECTS(pClip); diff --git a/hw/dmx/dmxpict.h b/hw/dmx/dmxpict.h index 2ca04ed87..fe2a65959 100644 --- a/hw/dmx/dmxpict.h +++ b/hw/dmx/dmxpict.h @@ -112,7 +112,9 @@ extern void dmxTriFan(CARD8 op, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points); +extern int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet); extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet); +extern int dmxBECreatePicture(PicturePtr pPicture); extern Bool dmxBEFreePicture(PicturePtr pPicture); extern int dmxPictPrivateIndex; /**< Index for picture private data */ -- cgit v1.2.3 From 1b029fd896b76096905c516925ce0214fe14632c Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 18 Dec 2006 14:51:04 -0800 Subject: Xorg & Xserver man page updates for 1.2 release - Added -extension & +extension to Xserver man page - Changed Xorg synopsis from X11R6 to X11R7 - Clarified Xorg ancestry description - Moved Solaris to free/Open Source OS list - Removed references to MetroLink module loader & getconfig - Converted (1) to (__appmansuffix__) in a few more places - Replaced http://www.freedesktop.org/cvs/ with http://gitweb.freedesktop.org/ --- doc/Xserver.man.pre | 8 ++++++ hw/xfree86/doc/man/Xorg.man.pre | 60 +++++++++++++++++------------------------ 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/doc/Xserver.man.pre b/doc/Xserver.man.pre index d65acde6a..2457edf22 100644 --- a/doc/Xserver.man.pre +++ b/doc/Xserver.man.pre @@ -159,6 +159,14 @@ default state is platform and configuration specific. disables DPMS (display power management services). The default state is platform and configuration specific. .TP 8 +.BI \-extension extensionName +disables named extension. If an unknown extension name is specified, +a list of accepted extension names is printed. +.TP 8 +.BI \+extension extensionName +enables named extension. If an unknown extension name is specified, +a list of accepted extension names is printed. +.TP 8 .B \-f \fIvolume\fP sets feep (bell) volume (allowable range: 0-100). .TP 8 diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre index 43f0518d2..c950e326b 100644 --- a/hw/xfree86/doc/man/Xorg.man.pre +++ b/hw/xfree86/doc/man/Xorg.man.pre @@ -1,7 +1,7 @@ .\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/Xorg.man.pre,v 1.3 2005/07/04 18:41:01 ajax Exp $ .TH __xservername__ __appmansuffix__ __vendorversion__ .SH NAME -__xservername__ - X11R6 X server +__xservername__ - X11R7 X server .SH SYNOPSIS .B __xservername__ .RI [\fB:\fP display ] @@ -13,30 +13,26 @@ is a full featured X server that was originally designed for UNIX and UNIX-like operating systems running on Intel x86 hardware. It now runs on a wider range of hardware and OS platforms. .PP -This work was derived from +This work was derived by the X.Org Foundation from the XFree86 Project's .I "XFree86\ 4.4rc2" -by the X.Org Foundation. -The XFree86 4.4rc2 release was originally derived from +release. +The XFree86 release was originally derived from .I "X386\ 1.2" by Thomas Roell which was contributed to X11R5 by Snitily Graphics -Consulting Service. The -.B __xservername__ -server architecture includes -among many other things a loadable module system derived from code -donated by Metro Link, Inc. The current __xservername__ release is compatible -with X11R6.6. +Consulting Service. .SH PLATFORMS .PP .B __xservername__ operates under a wide range of operating systems and hardware platforms. The Intel x86 (IA32) architecture is the most widely supported hardware -platform. Other hardware platforms include Compaq Alpha, Intel IA64, +platform. Other hardware platforms include Compaq Alpha, Intel IA64, AMD64, SPARC and PowerPC. The most widely supported operating systems are the -free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD and -OpenBSD. Commercial UNIX operating systems such as Solaris (x86) and +free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD, +OpenBSD, and Solaris. Commercial UNIX operating systems such as UnixWare are also supported. Other supported operating systems include LynxOS, and GNU Hurd. Darwin and Mac OS X are supported with the -XDarwin(1) X server. Win32/Cygwin is supported with the XWin X server. +XDarwin(__appmansuffix__) X server. Win32/Cygwin is supported with the +XWin(__appmansuffix__) X server. .PP .SH "NETWORK CONNECTIONS" .B __xservername__ @@ -119,13 +115,14 @@ one way, the highest precedence mechanism is used. The list of mechanisms is ordered from highest precedence to lowest. Note that not all parameters can be supplied via all methods. The available command line options and environment variables (and some defaults) are described here and in -the Xserver(1) manual page. Most configuration file parameters, with -their defaults, are described in the __xconfigfile__(__filemansuffix__) manual -page. Driver and module specific configuration parameters are described -in the relevant driver or module manual page. +the Xserver(__appmansuffix__) manual page. Most configuration file +parameters, with their defaults, are described in the +__xconfigfile__(__filemansuffix__) manual page. Driver and module specific +configuration parameters are described in the relevant driver or module +manual page. .PP -In addition to the normal server options described in the Xserver(1) -manual page, +In addition to the normal server options described in the +Xserver(__appmansuffix__) manual page, .B __xservername__ accepts the following command line switches: .TP 8 @@ -385,7 +382,8 @@ options. When this option is specified, the .B __xservername__ server scans the PCI bus, and prints out some information about each -device that was detected. See also scanpci(1) and pcitweak(1). +device that was detected. See also scanpci(__appmansuffix__) +and pcitweak(__appmansuffix__). .TP 8 .BI \-screen " screen-name" Use the __xconfigfile__(__filemansuffix__) file @@ -508,13 +506,12 @@ for its initial setup. Refer to the __xconfigfile__(__filemansuffix__) manual page for information about the format of this file. .PP -Starting with version 4.4, .B __xservername__ has a mechanism for automatically generating a built-in configuration at run-time when no .B __xconfigfile__ file is present. The current version of this automatic configuration -mechanism works in three ways. +mechanism works in two ways. .PP The first is via enhancements that have made many components of the .B __xconfigfile__ @@ -523,14 +520,7 @@ reasonably deduced doesn't need to be specified explicitly, greatly reducing the amount of built-in configuration information that needs to be generated at run-time. .PP -The second is to use an external utility called getconfig(1), when -available, to use meta-configuration information to generate a suitable -configuration for the primary video device. The meta-configuration -information can be updated to allow an existing installation to get the -best out of new hardware or to work around bugs that are found -post-release. -.PP -The third is to have "safe" fallbacks for most configuration information. +The second is to have "safe" fallbacks for most configuration information. This maximises the likelihood that the .B __xservername__ server will start up in some usable configuration even when information @@ -644,7 +634,7 @@ __xservername__ was originally based on XFree86 4.4rc2. That was originally based on \fIX386 1.2\fP by Thomas Roell, which was contributed to the then X Consortium's X11R5 distribution by SGCS. .PP -__xservername__ is released by the X.org Foundation. +__xservername__ is released by the X.Org Foundation. .PP The project that became XFree86 was originally founded in 1992 by David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat. @@ -685,9 +675,9 @@ Orest Zborowski \fIorestz@eskimo.com\fP .RE .PP __xservername__ source is available from the FTP server -\fI\fP, and from the X.org -server \fI\fP. Documentation and other -information can be found from the X.org web site +\fI\fP, and from the X.Org +server \fI\fP. Documentation and other +information can be found from the X.Org web site \fI\fP. .SH LEGAL -- cgit v1.2.3 From 6b1e354dbb6e8ed9f2c654bbe7f8bbf241843d1c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 19 Dec 2006 15:24:19 +0100 Subject: EXA: Disable SHM pixmaps. See https://bugs.freedesktop.org/show_bug.cgi?id=6772 . --- exa/exa.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/exa/exa.c b/exa/exa.c index b49065303..bf9411469 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -32,6 +32,10 @@ #include #endif +#ifdef MITSHM +#include "shmint.h" +#endif + #include #include "exa_priv.h" @@ -610,6 +614,13 @@ exaDriverInit (ScreenPtr pScreen, miDisableCompositeWrapper(pScreen); #endif +#ifdef MITSHM + /* Re-register with the MI funcs, which don't allow shared pixmaps. + * Shared pixmaps are almost always a performance loss for us, but this + * still allows for SHM PutImage. + */ + ShmRegisterFuncs(pScreen, NULL); +#endif /* * Hookup offscreen pixmaps */ -- cgit v1.2.3 From 67c2a86e59e915d9a5681e9d233478cfea3e51ed Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 19 Dec 2006 15:44:18 +0100 Subject: EXA: Compare backing pixmaps instead of drawables against driver limits. The driver operations are always contained within the backing pixmaps, it doesn't matter if the drawables are bigger. --- exa/exa_accel.c | 42 +++++++++++++++++++++--------------------- exa/exa_render.c | 17 +++++++++++------ 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/exa/exa_accel.c b/exa/exa_accel.c index bc77a4071..efae6db67 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -49,12 +49,12 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = FALSE; - pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); + pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable); if (pExaScr->swappedOut || pGC->fillStyle != FillSolid || - pDrawable->width > pExaScr->info->maxX || - pDrawable->height > pExaScr->info->maxY) + pPixmap->drawable.width > pExaScr->info->maxX || + pPixmap->drawable.height > pExaScr->info->maxY) { exaDoMigration (pixmaps, 1, FALSE); ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); @@ -380,19 +380,19 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = FALSE; - pixmaps[0].pPix = exaGetDrawablePixmap (pDstDrawable); + pixmaps[0].pPix = pDstPixmap = exaGetDrawablePixmap (pDstDrawable); pixmaps[1].as_dst = FALSE; pixmaps[1].as_src = TRUE; - pixmaps[1].pPix = exaGetDrawablePixmap (pSrcDrawable); + pixmaps[1].pPix = pSrcPixmap = exaGetDrawablePixmap (pSrcDrawable); /* Respect maxX/maxY in a trivial way: don't set up drawing when we might * violate the limits. The proper solution would be a temporary pixmap * adjusted so that the drawing happened within limits. */ - if (pSrcDrawable->width > pExaScr->info->maxX || - pSrcDrawable->height > pExaScr->info->maxY || - pDstDrawable->width > pExaScr->info->maxX || - pDstDrawable->height > pExaScr->info->maxY) + if (pSrcPixmap->drawable.width > pExaScr->info->maxX || + pSrcPixmap->drawable.height > pExaScr->info->maxY || + pDstPixmap->drawable.width > pExaScr->info->maxX || + pDstPixmap->drawable.height > pExaScr->info->maxY) { exaDoMigration (pixmaps, 2, FALSE); goto fallback; @@ -621,12 +621,12 @@ exaPolyFillRect(DrawablePtr pDrawable, pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = FALSE; - pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); + pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable); if (pExaScr->swappedOut || pGC->fillStyle != FillSolid || - pDrawable->width > pExaScr->info->maxX || - pDrawable->height > pExaScr->info->maxY) + pPixmap->drawable.width > pExaScr->info->maxX || + pPixmap->drawable.height > pExaScr->info->maxY) { exaDoMigration (pixmaps, 1, FALSE); ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect); @@ -738,11 +738,11 @@ exaSolidBoxClipped (DrawablePtr pDrawable, pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = FALSE; - pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); + pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable); if (pExaScr->swappedOut || - pDrawable->width > pExaScr->info->maxX || - pDrawable->height > pExaScr->info->maxY) + pPixmap->drawable.width > pExaScr->info->maxX || + pPixmap->drawable.height > pExaScr->info->maxY) { exaDoMigration (pixmaps, 1, FALSE); goto fallback; @@ -997,10 +997,10 @@ exaFillRegionSolid (DrawablePtr pDrawable, pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = FALSE; - pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); + pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable); - if (pDrawable->width > pExaScr->info->maxX || - pDrawable->height > pExaScr->info->maxY) + if (pPixmap->drawable.width > pExaScr->info->maxX || + pPixmap->drawable.height > pExaScr->info->maxY) { exaDoMigration (pixmaps, 1, FALSE); goto fallback; @@ -1064,13 +1064,13 @@ exaFillRegionTiled (DrawablePtr pDrawable, pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = FALSE; - pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); + pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable); pixmaps[1].as_dst = FALSE; pixmaps[1].as_src = TRUE; pixmaps[1].pPix = pTile; - if (pDrawable->width > pExaScr->info->maxX || - pDrawable->height > pExaScr->info->maxY || + if (pPixmap->drawable.width > pExaScr->info->maxX || + pPixmap->drawable.height > pExaScr->info->maxY || tileWidth > pExaScr->info->maxX || tileHeight > pExaScr->info->maxY) { diff --git a/exa/exa_render.c b/exa/exa_render.c index 9affb9f11..fd3d87f3d 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -336,16 +336,21 @@ exaTryDriverComposite(CARD8 op, struct _Pixmap scratch; ExaMigrationRec pixmaps[3]; + pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable); + pDstPix = exaGetDrawablePixmap(pDst->pDrawable); + if (pMask) + pMaskPix = exaGetDrawablePixmap(pMask->pDrawable); + /* Bail if we might exceed coord limits by rendering from/to these. We * should really be making some scratch pixmaps with offsets and coords * adjusted to deal with this, but it hasn't been done yet. */ - if (pSrc->pDrawable->width > pExaScr->info->maxX || - pSrc->pDrawable->height > pExaScr->info->maxY || - pDst->pDrawable->width > pExaScr->info->maxX || - pDst->pDrawable->height > pExaScr->info->maxY || - (pMask && (pMask->pDrawable->width > pExaScr->info->maxX || - pMask->pDrawable->height > pExaScr->info->maxY))) + if (pSrcPix->drawable.width > pExaScr->info->maxX || + pSrcPix->drawable.height > pExaScr->info->maxY || + pDstPix->drawable.width > pExaScr->info->maxX || + pDstPix->drawable.height > pExaScr->info->maxY || + (pMask && (pMaskPix->drawable.width > pExaScr->info->maxX || + pMaskPix->drawable.height > pExaScr->info->maxY))) { return -1; } -- cgit v1.2.3 From fdcc22ca1704d3519156c66804528c21b04fea65 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 19 Dec 2006 16:11:17 +0100 Subject: exaCopyNtoN: Fix usage of 'dx' and 'dy' instead of 'reverse' and 'upsidedown'. --- exa/exa_accel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exa/exa_accel.c b/exa/exa_accel.c index efae6db67..098b27c19 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -401,7 +401,8 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, } /* Mixed directions must be handled specially if the card is lame */ - if (pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS && (dx*dy) < 0) { + if (pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS && + reverse != upsidedown) { if (!exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy)) goto fallback; @@ -411,7 +412,7 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, if ((pSrcPixmap = exaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) && (pDstPixmap = exaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) && (*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap, - dx, dy, + reverse ? -1 : 1, upsidedown ? -1 : 1, pGC ? pGC->alu : GXcopy, pGC ? pGC->planemask : FB_ALLONES)) { -- cgit v1.2.3 From 467c00cf450826e0bf06fe94470ec193af625d68 Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Tue, 19 Dec 2006 18:45:25 +0100 Subject: exaGlyphs: mark dirty for software path also. This affects drivers with no UploadToScreen or UploadToScreen failures. --- exa/exa_render.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exa/exa_render.c b/exa/exa_render.c index a73582000..be7c2403b 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -1034,11 +1034,11 @@ exaGlyphs (CARD8 op, exaCopyArea (&pScratchPixmap->drawable, &pPixmap->drawable, pGC, 0, 0, glyph->info.width, glyph->info.height, 0, 0); - } else { - exaDrawableDirty (&pPixmap->drawable, 0, 0, - glyph->info.width, glyph->info.height); } + exaDrawableDirty (&pPixmap->drawable, 0, 0, + glyph->info.width, glyph->info.height); + if (maskFormat) { exaComposite (PictOpAdd, pPicture, NULL, pMask, 0, 0, 0, 0, -- cgit v1.2.3 From 9563b2eea2f61246b6a9e14e00c701f693efa4e1 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 19 Dec 2006 18:57:22 +0100 Subject: EXA: Lots of damage tracking fixes. Mostly due to exaDrawableDirty() now calculating the backing pixmap coordinates internally, for cases where they aren't trivially known. There's a new exaPixmapDirty() function for the other cases. --- exa/exa.c | 96 ++++++++++++++++++++++++++++++++++++------------------- exa/exa_accel.c | 89 +++++++++++++++++++++++++-------------------------- exa/exa_priv.h | 3 ++ exa/exa_render.c | 36 ++++++++++----------- exa/exa_unaccel.c | 40 ++++++----------------- 5 files changed, 138 insertions(+), 126 deletions(-) diff --git a/exa/exa.c b/exa/exa.c index 195457cd5..e61bc69a8 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -122,22 +122,49 @@ exaGetDrawablePixmap(DrawablePtr pDrawable) } /** - * exaDrawableDirty() marks a pixmap backing a drawable as dirty, allowing for + * Sets the offsets to add to coordinates to make them address the same bits in + * the backing drawable. These coordinates are nonzero only for redirected + * windows. + */ +static void +exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap, + int *xp, int *yp) +{ +#ifdef COMPOSITE + if (pDrawable->type == DRAWABLE_WINDOW) { + *xp = -pPixmap->screen_x; + *yp = -pPixmap->screen_y; + return; + } +#endif + + *xp = 0; + *yp = 0; +} + +/** + * exaPixmapDirty() marks a pixmap as dirty, allowing for * optimizations in pixmap migration when no changes have occurred. */ void -exaDrawableDirty (DrawablePtr pDrawable, int x1, int y1, int x2, int y2) +exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2) { - ExaPixmapPrivPtr pExaPixmap; + ExaPixmapPriv(pPix); + BoxRec box; RegionPtr pDamageReg; - BoxRec box = { .x1 = max(x1,0), .x2 = min(x2,pDrawable->width), - .y1 = max(y1,0), .y2 = min(y2,pDrawable->height) }; RegionRec region; - pExaPixmap = ExaGetPixmapPriv(exaGetDrawablePixmap (pDrawable)); - if (!pExaPixmap || box.x1 >= box.x2 || box.y1 >= box.y2) + if (!pExaPixmap) return; + box.x1 = max(x1, 0); + box.y1 = max(y1, 0); + box.x2 = min(x2, pPix->drawable.width); + box.y2 = min(y2, pPix->drawable.height); + + if (box.x1 >= box.x2 || box.y1 >= box.y2) + return; + pDamageReg = DamageRegion(pExaPixmap->pDamage); REGION_INIT(pScreen, ®ion, &box, 1); @@ -145,6 +172,29 @@ exaDrawableDirty (DrawablePtr pDrawable, int x1, int y1, int x2, int y2) REGION_UNINIT(pScreen, ®ion); } +/** + * exaDrawableDirty() marks a pixmap backing a drawable as dirty, allowing for + * optimizations in pixmap migration when no changes have occurred. + */ +void +exaDrawableDirty (DrawablePtr pDrawable, int x1, int y1, int x2, int y2) +{ + PixmapPtr pPix = exaGetDrawablePixmap(pDrawable); + int xoff, yoff; + + x1 = max(x1, pDrawable->x); + y1 = max(y1, pDrawable->y); + x2 = min(x2, pDrawable->x + pDrawable->width); + y2 = min(y2, pDrawable->y + pDrawable->height); + + if (x1 >= x2 || y1 >= y2) + return; + + exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff); + + exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff); +} + static Bool exaDestroyPixmap (PixmapPtr pPixmap) { @@ -289,32 +339,14 @@ exaDrawableIsOffscreen (DrawablePtr pDrawable) /** * Returns the pixmap which backs a drawable, and the offsets to add to * coordinates to make them address the same bits in the backing drawable. - * These coordinates are nonzero only for redirected windows. */ PixmapPtr exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp) { - PixmapPtr pPixmap; - int x, y; + PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable); + + exaGetDrawableDeltas (pDrawable, pPixmap, xp, yp); - if (pDrawable->type == DRAWABLE_WINDOW) { - pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable); -#ifdef COMPOSITE - x = -pPixmap->screen_x; - y = -pPixmap->screen_y; -#else - x = 0; - y = 0; -#endif - } - else - { - pPixmap = (PixmapPtr) pDrawable; - x = 0; - y = 0; - } - *xp = x; - *yp = y; if (exaPixmapIsOffscreen (pPixmap)) return pPixmap; else @@ -428,7 +460,7 @@ exaValidateGC (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) exaPrepareAccess(&pOldTile->drawable, EXA_PREPARE_SRC); pNewTile = fb24_32ReformatTile (pOldTile, pDrawable->bitsPerPixel); - exaDrawableDirty(&pNewTile->drawable, 0, 0, pNewTile->drawable.width, pNewTile->drawable.height); + exaPixmapDirty(pNewTile, 0, 0, pNewTile->drawable.width, pNewTile->drawable.height); exaFinishAccess(&pOldTile->drawable, EXA_PREPARE_SRC); } if (pNewTile) @@ -449,9 +481,9 @@ exaValidateGC (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) */ exaMoveOutPixmap(pGC->tile.pixmap); fbPadPixmap (pGC->tile.pixmap); - exaDrawableDirty(&pGC->tile.pixmap->drawable, 0, 0, - pGC->tile.pixmap->drawable.width, - pGC->tile.pixmap->drawable.height); + exaPixmapDirty(pGC->tile.pixmap, 0, 0, + pGC->tile.pixmap->drawable.width, + pGC->tile.pixmap->drawable.height); } /* Mask out the GCTile change notification, now that we've done FB's * job for it. diff --git a/exa/exa_accel.c b/exa/exa_accel.c index d2fe2e034..6fa481ad0 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -109,9 +109,8 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, (*pExaScr->info->Solid) (pPixmap, fullX1 + off_x, fullY1 + off_y, fullX2 + off_x, fullY1 + 1 + off_y); - exaDrawableDirty (pDrawable, - fullX1 + off_x, fullY1 + off_y, - fullX2 + off_x, fullY1 + 1 + off_y); + exaPixmapDirty (pPixmap, fullX1 + off_x, fullY1 + off_y, + fullX2 + off_x, fullY1 + 1 + off_y); } else { @@ -130,9 +129,8 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, (*pExaScr->info->Solid) (pPixmap, partX1 + off_x, fullY1 + off_y, partX2 + off_x, fullY1 + 1 + off_y); - exaDrawableDirty (pDrawable, - partX1 + off_x, fullY1 + off_y, - partX2 + off_x, fullY1 + 1 + off_y); + exaPixmapDirty (pPixmap, partX1 + off_x, fullY1 + off_y, + partX2 + off_x, fullY1 + 1 + off_y); } } pbox++; @@ -233,7 +231,7 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, exaFinishAccess(pDrawable, EXA_PREPARE_DEST); } - exaDrawableDirty(pDrawable, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff); + exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff); } return; @@ -362,9 +360,8 @@ exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, dst_off_y + pbox->y1 + i, pbox->x2 - pbox->x1, 1); } - exaDrawableDirty(pDstDrawable, - dst_off_x + pbox->x1, dst_off_y + pbox->y1, - dst_off_x + pbox->x2, dst_off_y + pbox->y2); + exaPixmapDirty(pDstPixmap, dst_off_x + pbox->x1, dst_off_y + pbox->y1, + dst_off_x + pbox->x2, dst_off_y + pbox->y2); } if (dirsetup != 0) pExaScr->info->DoneCopy(pDstPixmap); @@ -437,9 +434,9 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); - exaDrawableDirty (pDstDrawable, - pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, - pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); + exaPixmapDirty (pDstPixmap, + pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, + pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); pbox++; } (*pExaScr->info->DoneCopy) (pDstPixmap); @@ -460,9 +457,7 @@ fallback: exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST); while (nbox--) { - exaDrawableDirty (pDstDrawable, - pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, - pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); + exaDrawableDirty (pDstDrawable, pbox->x1, pbox->y1, pbox->x2, pbox->y2); pbox++; } } @@ -704,9 +699,8 @@ exaPolyFillRect(DrawablePtr pDrawable, (*pExaScr->info->Solid) (pPixmap, fullX1 + xoff, fullY1 + yoff, fullX2 + xoff, fullY2 + yoff); - exaDrawableDirty (pDrawable, - fullX1 + xoff, fullY1 + yoff, - fullX2 + xoff, fullY2 + yoff); + exaPixmapDirty (pPixmap, fullX1 + xoff, fullY1 + yoff, + fullX2 + xoff, fullY2 + yoff); } else { @@ -736,9 +730,8 @@ exaPolyFillRect(DrawablePtr pDrawable, (*pExaScr->info->Solid) (pPixmap, partX1 + xoff, partY1 + yoff, partX2 + xoff, partY2 + yoff); - exaDrawableDirty (pDrawable, - partX1 + xoff, partY1 + yoff, - partX2 + xoff, partY2 + yoff); + exaPixmapDirty (pPixmap, partX1 + xoff, partY1 + yoff, + partX2 + xoff, partY2 + yoff); } } } @@ -770,9 +763,6 @@ exaSolidBoxClipped (DrawablePtr pDrawable, pixmaps[0].as_src = FALSE; pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable); - /* We need to initialize x/yoff for tracking damage in the fallback case */ - pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); - if (pExaScr->swappedOut || pPixmap->drawable.width > pExaScr->info->maxX || pPixmap->drawable.height > pExaScr->info->maxY) @@ -825,13 +815,14 @@ fallback: if (partY2 <= partY1) continue; - if (!fallback) + if (!fallback) { (*pExaScr->info->Solid) (pPixmap, partX1 + xoff, partY1 + yoff, partX2 + xoff, partY2 + yoff); - exaDrawableDirty (pDrawable, - partX1 + xoff, partY1 + yoff, - partX2 + xoff, partY2 + yoff); + exaPixmapDirty (pPixmap, partX1 + xoff, partY1 + yoff, + partX2 + xoff, partY2 + yoff); + } else + exaDrawableDirty (pDrawable, partX1, partY1, partX2, partY2); } if (fallback) @@ -950,12 +941,17 @@ exaImageGlyphBlt (DrawablePtr pDrawable, pPriv->fg, gx + dstXoff, gHeight); + exaDrawableDirty (pDrawable, gx, gy, gx + gWidth, gy + gHeight); } else { + RegionPtr pClip = fbGetCompositeClip(pGC); + int nbox; + BoxPtr pbox; + gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip); fbPutXYImage (pDrawable, - fbGetCompositeClip(pGC), + pClip, pPriv->fg, pPriv->bg, pPriv->pm, @@ -969,9 +965,19 @@ exaImageGlyphBlt (DrawablePtr pDrawable, (FbStip *) pglyph, gStride, 0); + + for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); + nbox--; pbox++) { + int x1 = max(gx, pbox->x1), x2 = min(gx + gWidth, pbox->x2); + int y1 = max(gy, pbox->y1), y2 = min(gy + gHeight, pbox->y2); + + if (x1 >= x2 || y1 >= y2) + continue; + + exaDrawableDirty (pDrawable, gx, gy, gx + gWidth, + gy + gHeight); + } } - exaDrawableDirty(pDrawable, gx + dstXoff, gy + dstYoff, - gx + dstXoff + gWidth, gy + dstYoff + gHeight); } x += pci->metrics.characterWidth; } @@ -1062,9 +1068,8 @@ exaFillRegionSolid (DrawablePtr pDrawable, (*pExaScr->info->Solid) (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff, pBox->x2 + xoff, pBox->y2 + yoff); - exaDrawableDirty (pDrawable, - pBox->x1 + xoff, pBox->y1 + yoff, - pBox->x2 + xoff, pBox->y2 + yoff); + exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff, + pBox->x2 + xoff, pBox->y2 + yoff); pBox++; } (*pExaScr->info->DoneSolid) (pPixmap); @@ -1081,9 +1086,7 @@ fallback: exaFinishAccess (pDrawable, EXA_PREPARE_DEST); while (nbox--) { - exaDrawableDirty (pDrawable, - pBox->x1 + xoff, pBox->y1 + yoff, - pBox->x2 + xoff, pBox->y2 + yoff); + exaDrawableDirty (pDrawable, pBox->x1, pBox->y1, pBox->x2, pBox->y2); pBox++; } } @@ -1123,9 +1126,6 @@ exaFillRegionTiled (DrawablePtr pDrawable, pixmaps[1].as_src = TRUE; pixmaps[1].pPix = pTile; - /* We need to initialize x/yoff for tracking damage in the fallback case */ - pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); - if (pPixmap->drawable.width > pExaScr->info->maxX || pPixmap->drawable.height > pExaScr->info->maxY || tileWidth > pExaScr->info->maxX || @@ -1182,8 +1182,8 @@ exaFillRegionTiled (DrawablePtr pDrawable, dstY += h; tileY = 0; } - exaDrawableDirty (pDrawable, pBox->x1 + xoff, pBox->y1 + yoff, - pBox->x2 + xoff, pBox->y2 + yoff); + exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff, + pBox->x2 + xoff, pBox->y2 + yoff); pBox++; } (*pExaScr->info->DoneCopy) (pPixmap); @@ -1202,8 +1202,7 @@ fallback: exaFinishAccess (pDrawable, EXA_PREPARE_DEST); while (nbox--) { - exaDrawableDirty (pDrawable, pBox->x1 + xoff, pBox->y1 + yoff, - pBox->x2 + xoff, pBox->y2 + yoff); + exaDrawableDirty (pDrawable, pBox->x1, pBox->y1, pBox->x2, pBox->y2); pBox++; } } diff --git a/exa/exa_priv.h b/exa/exa_priv.h index 80cf60903..926e02a1f 100644 --- a/exa/exa_priv.h +++ b/exa/exa_priv.h @@ -339,6 +339,9 @@ exaPrepareAccess(DrawablePtr pDrawable, int index); void exaFinishAccess(DrawablePtr pDrawable, int index); +void +exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2); + void exaDrawableDirty(DrawablePtr pDrawable, int x1, int y1, int x2, int y2); diff --git a/exa/exa_render.c b/exa/exa_render.c index be7c2403b..75108a75c 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -302,9 +302,8 @@ exaTryDriverSolidFill(PicturePtr pSrc, (*pExaScr->info->Solid) (pDstPix, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); - exaDrawableDirty (pDst->pDrawable, - pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, - pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); + exaPixmapDirty (pDstPix, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, + pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); pbox++; } (*pExaScr->info->DoneSolid) (pDstPix); @@ -447,9 +446,8 @@ exaTryDriverComposite(CARD8 op, pbox->y1 + dst_off_y, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); - exaDrawableDirty (pDst->pDrawable, - pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, - pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); + exaPixmapDirty (pDstPix, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, + pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); pbox++; } (*pExaScr->info->DoneComposite) (pDstPix); @@ -712,18 +710,19 @@ void exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap, int x_off, int y_off) { + DrawablePtr pDraw = pPicture->pDrawable; ExaMigrationRec pixmaps[1]; pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = TRUE; - pixmaps[0].pPix = exaGetDrawablePixmap (pPicture->pDrawable); + pixmaps[0].pPix = exaGetDrawablePixmap (pDraw); exaDoMigration(pixmaps, 1, FALSE); - exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST); + exaPrepareAccess(pDraw, EXA_PREPARE_DEST); fbRasterizeTrapezoid(pPicture, trap, x_off, y_off); - exaDrawableDirty(pPicture->pDrawable, 0, 0, - pPicture->pDrawable->width, pPicture->pDrawable->height); - exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST); + exaDrawableDirty(pDraw, pDraw->x, pDraw->y, + pDraw->x + pDraw->width, pDraw->y + pDraw->height); + exaFinishAccess(pDraw, EXA_PREPARE_DEST); } /** @@ -734,18 +733,19 @@ void exaAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri, xTriangle *tris) { + DrawablePtr pDraw = pPicture->pDrawable; ExaMigrationRec pixmaps[1]; pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = TRUE; - pixmaps[0].pPix = exaGetDrawablePixmap (pPicture->pDrawable); + pixmaps[0].pPix = exaGetDrawablePixmap (pDraw); exaDoMigration(pixmaps, 1, FALSE); - exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST); + exaPrepareAccess(pDraw, EXA_PREPARE_DEST); fbAddTriangles(pPicture, x_off, y_off, ntri, tris); - exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST); - exaDrawableDirty(pPicture->pDrawable, 0, 0, - pPicture->pDrawable->width, pPicture->pDrawable->height); + exaDrawableDirty(pDraw, pDraw->x, pDraw->y, + pDraw->x + pDraw->width, pDraw->y + pDraw->height); + exaFinishAccess(pDraw, EXA_PREPARE_DEST); } /** @@ -1036,8 +1036,8 @@ exaGlyphs (CARD8 op, 0, 0, glyph->info.width, glyph->info.height, 0, 0); } - exaDrawableDirty (&pPixmap->drawable, 0, 0, - glyph->info.width, glyph->info.height); + exaPixmapDirty (pPixmap, 0, 0, + glyph->info.width, glyph->info.height); if (maskFormat) { diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c index a30911507..7713a08c9 100644 --- a/exa/exa_unaccel.c +++ b/exa/exa_unaccel.c @@ -23,26 +23,6 @@ #include "exa_priv.h" -#define TRIM_BOX(box, pGC) if (pGC->pCompositeClip) { \ - BoxPtr extents = &pGC->pCompositeClip->extents;\ - if(box.x1 < extents->x1) box.x1 = extents->x1; \ - if(box.x2 > extents->x2) box.x2 = extents->x2; \ - if(box.y1 < extents->y1) box.y1 = extents->y1; \ - if(box.y2 > extents->y2) box.y2 = extents->y2; \ - } - -#define TRANSLATE_BOX(box, pDrawable) { \ - box.x1 += pDrawable->x; \ - box.x2 += pDrawable->x; \ - box.y1 += pDrawable->y; \ - box.y2 += pDrawable->y; \ - } - -#define TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC) { \ - TRANSLATE_BOX(box, pDrawable); \ - TRIM_BOX(box, pGC); \ - } - /* * These functions wrap the low-level fb rendering functions and * synchronize framebuffer/accelerated drawing by stalling until @@ -222,10 +202,9 @@ ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable))); if (nrect) { - BoxRec box = { .x1 = max(prect->x,0), - .x2 = min(prect->x + prect->width,pDrawable->width), - .y1 = max(prect->y,0), - .y2 = min(prect->y + prect->height,pDrawable->height) }; + int x1 = max(prect->x, 0), y1 = max(prect->y, 0); + int x2 = min(prect->x + prect->width, pDrawable->width); + int y2 = min(prect->y + prect->height, pDrawable->height); exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); exaPrepareAccessGC (pGC); @@ -239,15 +218,14 @@ ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, while (--nrect) { prect++; - box.x1 = min(box.x1, prect->x); - box.x2 = max(box.x2, prect->x + prect->width); - box.y1 = min(box.y1, prect->y); - box.y2 = max(box.y2, prect->y + prect->height); + x1 = min(x1, prect->x); + x2 = max(x2, prect->x + prect->width); + y1 = min(y1, prect->y); + y2 = max(y2, prect->y + prect->height); } - TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); - - exaDrawableDirty (pDrawable, box.x1, box.x2, box.y1, box.y2); + exaDrawableDirty (pDrawable, pDrawable->x + x1, pDrawable->y + y1, + pDrawable->x + x2, pDrawable->y + y2); } } -- cgit v1.2.3 From 228b9f77696190e47d4c96d6e0809bf645751557 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 8 Dec 2006 13:32:22 -0800 Subject: Include sys/select.h to get FD_ISSET. --- config/config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/config/config.c b/config/config.c index 523327d04..76191abd4 100644 --- a/config/config.c +++ b/config/config.c @@ -29,6 +29,7 @@ #define DBUS_API_SUBJECT_TO_CHANGE #include #include +#include #include -- cgit v1.2.3 From d442998e39611be6805ea261f2286a2fd00f49b1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 8 Dec 2006 13:35:36 -0800 Subject: Only do the _POSIX_C_SOURCE hackery on linux where it's required. On other OSes, the nasty hack was resulting in prototypes being hidden, so just don't do it. --- os/utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/os/utils.c b/os/utils.c index 9824501e7..82ec70458 100644 --- a/os/utils.c +++ b/os/utils.c @@ -53,12 +53,11 @@ OR PERFORMANCE OF THIS SOFTWARE. #include #endif +#ifndef __linux__ +#include +#else /* The world's most shocking hack, to ensure we get clock_gettime() and * CLOCK_MONOTONIC. */ -#ifdef sun /* Needed to tell Solaris headers not to restrict to */ -#define __EXTENSIONS__ /* only the functions defined in POSIX 199309. */ -#endif - #ifdef _POSIX_C_SOURCE #define _SAVED_POSIX_C_SOURCE _POSIX_C_SOURCE #undef _POSIX_C_SOURCE @@ -69,6 +68,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #ifdef _SAVED_POSIX_C_SOURCE #define _POSIX_C_SOURCE _SAVED_POSIX_C_SOURCE #endif +#endif /* __linux__ */ #ifdef __CYGWIN__ #include -- cgit v1.2.3 From e437f357b6850a6c87ca6696870b3abd40e5b8ed Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 19 Dec 2006 16:38:34 -0800 Subject: xorg.conf man page should say "XFree86-DGA", not "Xorg-DGA" --- hw/xfree86/doc/man/xorg.conf.man.pre | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 8d52b2bcf..bbba21112 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -649,7 +649,7 @@ being that are passed to the module when it is loaded. .PP Example: the extmod module (which contains a miscellaneous group of -server extensions) can be loaded, with the __xservername__-DGA extension +server extensions) can be loaded, with the XFree86-DGA extension disabled by using the following entry: .PP .RS 4 -- cgit v1.2.3 From d9e079d2a385203fdd18d958cfc19d759cab4ba8 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 22 Dec 2006 13:07:09 -0500 Subject: Zero out client devPrivates on allocation. --- dix/dispatch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dix/dispatch.c b/dix/dispatch.c index 51ad07da5..d44687ec3 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3752,6 +3752,8 @@ InitClientPrivates(ClientPtr client) client->devPrivates = ppriv; sizes = clientPrivateSizes; ptr = (char *)(ppriv + clientPrivateLen); + if (ppriv) + bzero(ppriv, totalClientSize - sizeof(ClientRec)); for (i = clientPrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) -- cgit v1.2.3 From 329f6417275bb1201ba66c29b202028eeab3a355 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Sat, 9 Dec 2006 22:51:59 +0200 Subject: XkbCopyKeymap: make sure sym_interpret is always valid Make sure we're not copying sym_interpret across from an empty source. --- xkb/xkbUtils.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index c9c5ed018..400306a22 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -1497,30 +1497,33 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) return FALSE; } - if (src->compat->sym_interpret) { - if (src->compat->size_si != dst->compat->size_si) { + if (src->compat->sym_interpret && src->compat->num_si) { + if (src->compat->num_si != dst->compat->size_si) { if (dst->compat->sym_interpret) tmp = xrealloc(dst->compat->sym_interpret, - src->compat->size_si * + src->compat->num_si * sizeof(XkbSymInterpretRec)); else - tmp = xalloc(src->compat->size_si * + tmp = xalloc(src->compat->num_si * sizeof(XkbSymInterpretRec)); if (!tmp) return FALSE; dst->compat->sym_interpret = tmp; } memcpy(dst->compat->sym_interpret, src->compat->sym_interpret, - src->compat->size_si * sizeof(XkbSymInterpretRec)); + src->compat->num_si * sizeof(XkbSymInterpretRec)); + + dst->compat->num_si = src->compat->num_si; + dst->compat->size_si = src->compat->num_si; } else { - if (dst->compat->sym_interpret) { + if (dst->compat->sym_interpret && dst->compat->size_si) xfree(dst->compat->sym_interpret); - dst->compat->sym_interpret = NULL; - } + + dst->compat->sym_interpret = NULL; + dst->compat->num_si = 0; + dst->compat->size_si = 0; } - dst->compat->num_si = src->compat->num_si; - dst->compat->size_si = src->compat->size_si; memcpy(dst->compat->groups, src->compat->groups, XkbNumKbdGroups * sizeof(XkbModsRec)); -- cgit v1.2.3 From 83080809f9a1c1d24b0318e54632f25f5940da25 Mon Sep 17 00:00:00 2001 From: Marc Aurele La France Date: Sun, 24 Dec 2006 06:28:21 +0200 Subject: xfree86: deal with pitch that isn't a multiple of the granularity When the pitch isn't a multiple of the granularity, allocate more space to compensate. --- hw/xfree86/common/xf86fbman.c | 60 ++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/hw/xfree86/common/xf86fbman.c b/hw/xfree86/common/xf86fbman.c index 8141a8373..d64cfaee4 100644 --- a/hw/xfree86/common/xf86fbman.c +++ b/hw/xfree86/common/xf86fbman.c @@ -368,10 +368,8 @@ AllocateArea( /* look through the free boxes */ for(i = 0; i < num; i++, boxp++) { x = boxp->x1; - if(granularity) { - int tmp = x % granularity; - if(tmp) x += (granularity - tmp); - } + if (granularity > 1) + x = ((x + granularity - 1) / granularity) * granularity; if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) continue; @@ -398,10 +396,8 @@ AllocateArea( boxp = &(link->area.box); x = boxp->x1; - if(granularity) { - int tmp = x % granularity; - if(tmp) x += (granularity - tmp); - } + if (granularity > 1) + x = ((x + granularity - 1) / granularity) * granularity; if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) { link = link->next; @@ -685,10 +681,8 @@ localQueryLargestOffscreenArea( while(nbox--) { x = pbox->x1; - if(granularity) { - int tmp = x % granularity; - if(tmp) x += (granularity - tmp); - } + if (granularity > 1) + x = ((x + granularity - 1) / granularity) * granularity; w = pbox->x2 - x; h = pbox->y2 - pbox->y1; @@ -845,7 +839,9 @@ AllocateLinear( while (linear) { /* Make sure we get a free area that's not an XY fallback case */ if (!linear->area && linear->free) { - offset = (linear->linear.offset + granularity) & ~granularity; + offset = linear->linear.offset; + if (granularity > 1) + offset = ((offset + granularity - 1) / granularity) * granularity; end = offset+size; if (end <= (linear->linear.offset + linear->linear.size)) break; @@ -935,17 +931,20 @@ localAllocateOffscreenLinear( extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); pitch = extents->x2 - extents->x1; - if (gran && gran > pitch) { - /* we can't match the specified alignment with XY allocations */ - xfree(link); - return NULL; - } - if (gran && (pitch % gran)) { - /* pitch and granularity aren't a perfect match, let's allocate - * a bit more so we can align later on - */ - length += gran - 1; - } + if (gran > 1) { + if (gran > pitch) { + /* we can't match the specified alignment with XY allocations */ + xfree(link); + return NULL; + } + + if (pitch % gran) { + /* pitch and granularity aren't a perfect match, let's allocate + * a bit more so we can align later on + */ + length += gran - 1; + } + } if(length < pitch) { /* special case */ w = length; @@ -968,8 +967,8 @@ localAllocateOffscreenLinear( linear->pScreen = pScreen; linear->size = h * w; linear->offset = (pitch * area->box.y1) + area->box.x1; - if (gran && linear->offset % gran) - linear->offset += gran - (linear->offset % gran); + if (gran > 1) + linear->offset += ((linear->offset + gran - 1) / gran) * gran; linear->granularity = gran; linear->MoveLinearCallback = moveCB; linear->RemoveLinearCallback = removeCB; @@ -1435,9 +1434,12 @@ xf86AllocateLinearOffscreenArea ( extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); w = extents->x2 - extents->x1; - if(gran && ((gran > w) || (w % gran))) { - /* we can't match the specified alignment with XY allocations */ - return NULL; + if (gran > 1) { + if (gran > w) + return NULL; + + if (w % gran) + length += gran - 1; } if(length <= w) { /* special case */ -- cgit v1.2.3 From c1674660a7115ebf993dcde78f4e45f756e4c951 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Sun, 24 Dec 2006 06:28:44 +0200 Subject: os: test for userland, not kernel It doesn't matter which kernel we're running on, the relevant part when dealing with includes is what our userland is. --- os/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/utils.c b/os/utils.c index 82ec70458..b98c9c1fd 100644 --- a/os/utils.c +++ b/os/utils.c @@ -53,7 +53,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #include #endif -#ifndef __linux__ +#ifndef __GLIBC__ #include #else /* The world's most shocking hack, to ensure we get clock_gettime() and -- cgit v1.2.3 From 05f915050cad72d4fb39cbb886be57beeac18749 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 27 Dec 2006 16:38:06 +0000 Subject: dix/events: take screen number, not pointer, in PostSyntheticMotion Since we were using PostSyntheticMotion incorrectly anyway, update the declared API to match. --- dix/getevents.c | 6 +++--- include/dixevents.h | 2 +- include/input.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dix/getevents.c b/dix/getevents.c index 0150d6658..8b2a44d70 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -761,7 +761,7 @@ SwitchCorePointer(DeviceIntPtr pDev) * to shift the pointer to get it inside the new bounds. */ void -PostSyntheticMotion(int x, int y, ScreenPtr pScreen, unsigned long time) +PostSyntheticMotion(int x, int y, int screen, unsigned long time) { xEvent xE; @@ -770,8 +770,8 @@ PostSyntheticMotion(int x, int y, ScreenPtr pScreen, unsigned long time) will translate from sprite screen to screen 0 upon reentry to the DIX layer. */ if (!noPanoramiXExtension) { - x += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x; - y += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y; + x += panoramiXdataPtr[0].x - panoramiXdataPtr[screen].x; + y += panoramiXdataPtr[0].y - panoramiXdataPtr[screen].y; } #endif diff --git a/include/dixevents.h b/include/dixevents.h index c78fb0e85..62c867277 100644 --- a/include/dixevents.h +++ b/include/dixevents.h @@ -103,7 +103,7 @@ extern int ProcUngrabButton(ClientPtr /* client */); extern int ProcRecolorCursor(ClientPtr /* client */); #ifdef PANORAMIX -extern void PostSyntheticMotion(int x, int y, ScreenPtr pScreen, unsigned long time); +extern void PostSyntheticMotion(int x, int y, int screen, unsigned long time); #endif #endif /* DIXEVENTS_H */ diff --git a/include/input.h b/include/input.h index ebb0915c4..fc607d35b 100644 --- a/include/input.h +++ b/include/input.h @@ -421,7 +421,7 @@ extern int GetProximityEvents( extern void PostSyntheticMotion( int x, int y, - ScreenPtr pScreen, + int screen, unsigned long time); extern int GetMotionHistorySize( -- cgit v1.2.3 From cfbc7379f0232bb336461f6d2a8496d3d0763e7e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 28 Dec 2006 13:15:11 -0800 Subject: Export exaMove{In,Out}Pixmap(). --- exa/exa.h | 6 ++++++ exa/exa_priv.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/exa/exa.h b/exa/exa.h index 96465a775..b043c122c 100644 --- a/exa/exa.h +++ b/exa/exa.h @@ -716,6 +716,12 @@ exaGetPixmapSize(PixmapPtr pPix); void exaEnableDisableFBAccess (int index, Bool enable); +void +exaMoveInPixmap (PixmapPtr pPixmap); + +void +exaMoveOutPixmap (PixmapPtr pPixmap); + /** * Returns TRUE if the given planemask covers all the significant bits in the * pixel values for pDrawable. diff --git a/exa/exa_priv.h b/exa/exa_priv.h index 926e02a1f..403d4b6a4 100644 --- a/exa/exa_priv.h +++ b/exa/exa_priv.h @@ -412,10 +412,4 @@ exaGlyphs (CARD8 op, void exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel); -void -exaMoveInPixmap (PixmapPtr pPixmap); - -void -exaMoveOutPixmap (PixmapPtr pPixmap); - #endif /* EXAPRIV_H */ -- cgit v1.2.3 From 083b790515faaf134a78abc4b0a7ef0d6ea5db75 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 28 Dec 2006 13:21:25 -0800 Subject: Switch the default migration heuristic for EXA to "always". This has been what has been used the most successfully post-damagetrack. The current thinking is that: 1) We should be able to accelerate basically everything. So we don't need to try to migrate trees of pixmaps permanently out of framebuffer to speed CPU drawing up. 2) Migration is cheaper in the thrashing case, so we don't want to go to a lot of effort to try (and fail badly) to find a working set. --- exa/exa.c | 2 +- hw/xfree86/exa/exa.man.pre | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exa/exa.c b/exa/exa.c index e61bc69a8..e9f42df45 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -622,7 +622,7 @@ exaDriverInit (ScreenPtr pScreen, pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr; - pExaScr->migration = ExaMigrationSmart; + pExaScr->migration = ExaMigrationAlways; exaDDXDriverInit(pScreen); diff --git a/hw/xfree86/exa/exa.man.pre b/hw/xfree86/exa/exa.man.pre index ea41b90e4..b0eecd5cc 100644 --- a/hw/xfree86/exa/exa.man.pre +++ b/hw/xfree86/exa/exa.man.pre @@ -35,6 +35,6 @@ Default: No. Chooses an alternate pixmap migration heuristic, for debugging purposes. The default is intended to be the best performing one for general use, though others may help with specific use cases. Available options include \*qalways\*q, -\*qgreedy\*q, and \*qsmart\*q. Default: smart. +\*qgreedy\*q, and \*qsmart\*q. Default: always. .SH AUTHORS Authors include: Keith Packard, Eric Anholt, Zack Rusin, and Michel Dänzer -- cgit v1.2.3 From f6815cb68b0f6698497348fc6e4214dacef33b95 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sat, 30 Dec 2006 10:18:28 +0100 Subject: fbdevhw: Consolidate modeset ioctl calling, report failure if it modifies mode. The fbdev API allows the driver to 'accept' modes it doesn't really support by modifying it to the nearest supported mode. Without this check, e.g. vesafb would appear to accept all modes, even though it actually can't set any modes other than the bootup mode at all. --- hw/xfree86/fbdevhw/fbdevhw.c | 129 +++++++++++++++++++++++++++---------------- 1 file changed, 82 insertions(+), 47 deletions(-) diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index 70bed620b..303ad14de 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -227,6 +227,26 @@ xfree2fbdev_timing(DisplayModePtr mode, struct fb_var_screeninfo *var) var->vmode = FB_VMODE_NONINTERLACED; } +static Bool +fbdev_modes_equal(struct fb_var_screeninfo *one, struct fb_var_screeninfo *two) +{ + return (one->xres_virtual == two->xres_virtual && + one->yres_virtual == two->yres_virtual && + one->bits_per_pixel == two->bits_per_pixel && + one->red.length == two->red.length && + one->green.length == two->green.length && + one->blue.length == two->blue.length && + one->xres == two->xres && one->yres == two->yres && + one->pixclock == two->pixclock && + one->right_margin == two->right_margin && + one->hsync_len == two->hsync_len && + one->left_margin == two->left_margin && + one->lower_margin == two->lower_margin && + one->vsync_len == two->vsync_len && + one->upper_margin == two->upper_margin && + one->sync == two->sync && one->vmode == two->vmode); +} + static void fbdev2xfree_timing(struct fb_var_screeninfo *var, DisplayModePtr mode) { @@ -470,13 +490,52 @@ fbdevHWGetVidmem(ScrnInfoPtr pScrn) return fPtr->fix.smem_len; } +static Bool +fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check) +{ + fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); + struct fb_var_screeninfo req_var = fPtr->var, set_var; + + TRACE_ENTER("ModeInit"); + + xfree2fbdev_fblayout(pScrn, &req_var); + xfree2fbdev_timing(mode, &req_var); + +#if DEBUG + print_xfree_mode("init", mode); + print_fbdev_mode("init", &req_var); +#endif + + set_var = req_var; + + if (check) + set_var.activate = FB_ACTIVATE_TEST; + + if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void*)(&set_var))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); + return FALSE; + } + + if (!fbdev_modes_equal(&set_var, &req_var)) { + if (!check) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOPUT_VSCREENINFO succeeded but modified " + "mode\n"); +#if DEBUG + print_fbdev_mode("returned", &set_var); +#endif + return FALSE; + } + + fPtr->var = set_var; + + return TRUE; +} + void fbdevHWSetVideoModes(ScrnInfoPtr pScrn) { - fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - int virtX = pScrn->display->virtualX; - int virtY = pScrn->display->virtualY; - struct fb_var_screeninfo var; char **modename; DisplayModePtr mode,this,last = pScrn->modes; @@ -484,6 +543,9 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn) if (NULL == pScrn->display->modes) return; + pScrn->virtualX = pScrn->display->virtualX; + pScrn->virtualY = pScrn->display->virtualY; + for (modename = pScrn->display->modes; *modename != NULL; modename++) { for (mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next) if (0 == strcmp(mode->name,*modename)) @@ -493,27 +555,20 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn) "\tmode \"%s\" not found\n", *modename); continue; } - memset(&var,0,sizeof(var)); - xfree2fbdev_timing(mode,&var); - var.xres_virtual = virtX; - var.yres_virtual = virtY; - var.bits_per_pixel = pScrn->bitsPerPixel; - var.red.length = pScrn->weight.red; - var.green.length = pScrn->weight.green; - var.blue.length = pScrn->weight.blue; - - var.activate = FB_ACTIVATE_TEST; - if (var.xres_virtual < var.xres) var.xres_virtual = var.xres; - if (var.yres_virtual < var.yres) var.yres_virtual = var.yres; - if (-1 == ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&var))) { + + if (!fbdevHWSetMode(pScrn, mode, TRUE)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" test failed\n", *modename); continue; } xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" ok\n", *modename); - if (virtX < var.xres) virtX = var.xres; - if (virtY < var.yres) virtY = var.yres; + + if (pScrn->virtualX < mode->HDisplay) + pScrn->virtualX = mode->HDisplay; + if (pScrn->virtualY < mode->VDisplay) + pScrn->virtualY = mode->VDisplay; + if (NULL == pScrn->modes) { pScrn->modes = xnfalloc(sizeof(DisplayModeRec)); this = pScrn->modes; @@ -530,8 +585,6 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn) } last = this; } - pScrn->virtualX = virtX; - pScrn->virtualY = virtY; } DisplayModePtr @@ -673,21 +726,12 @@ fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - TRACE_ENTER("ModeInit"); - xfree2fbdev_fblayout(pScrn, &fPtr->var); - xfree2fbdev_timing(mode, &fPtr->var); -#if DEBUG - print_xfree_mode("init",mode); - print_fbdev_mode("init",&fPtr->var); -#endif pScrn->vtSema = TRUE; /* set */ - if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); + if (!fbdevHWSetMode(pScrn, mode, FALSE)) return FALSE; - } + /* read back */ if (0 != ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -767,18 +811,12 @@ ModeStatus fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - struct fb_var_screeninfo var; TRACE_ENTER("ValidMode"); - memcpy(&var,&fPtr->var,sizeof(var)); - xfree2fbdev_timing(mode, &var); - var.activate = FB_ACTIVATE_TEST; - if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) { - xf86DrvMsg(scrnIndex, X_ERROR, - "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); + + if (!fbdevHWSetMode(pScrn, mode, TRUE)) return MODE_BAD; - } + return MODE_OK; } @@ -786,15 +824,12 @@ Bool fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); TRACE_ENTER("SwitchMode"); - xfree2fbdev_timing(mode, &fPtr->var); - if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) { - xf86DrvMsg(scrnIndex, X_ERROR, - "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); + + if (!fbdevHWSetMode(pScrn, mode, FALSE)) return FALSE; - } + return TRUE; } -- cgit v1.2.3 From c385bcf0bde38dd869f7065f859dd4b4126f5690 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sat, 30 Dec 2006 16:44:31 +0100 Subject: fbdevhw: Fix some issues with the previous commit. Fix a TRACE_ENTER typo and only update the internal fbdev mode state cache after actually setting a mode. --- hw/xfree86/fbdevhw/fbdevhw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index 303ad14de..83b0dc156 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -496,7 +496,7 @@ fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check) fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); struct fb_var_screeninfo req_var = fPtr->var, set_var; - TRACE_ENTER("ModeInit"); + TRACE_ENTER("SetMode"); xfree2fbdev_fblayout(pScrn, &req_var); xfree2fbdev_timing(mode, &req_var); @@ -528,7 +528,8 @@ fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check) return FALSE; } - fPtr->var = set_var; + if (!check) + fPtr->var = set_var; return TRUE; } -- cgit v1.2.3 From d077c0da470ab7291e8d838eaace57b066477d6f Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sun, 31 Dec 2006 17:23:31 +0100 Subject: fbdevhw: Use displayWidth for fbdev virtual width when appropriate. The fbdev API doesn't allow setting the pitch explicitly, so we have to set the virtual width to the pitch we're using for drawing. This fixes corruption after changing the virtual width with RandR. --- hw/xfree86/fbdevhw/fbdevhw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index 83b0dc156..a9288a753 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -183,7 +183,8 @@ print_xfree_mode(char *txt, DisplayModePtr mode) static void xfree2fbdev_fblayout(ScrnInfoPtr pScrn, struct fb_var_screeninfo *var) { - var->xres_virtual = pScrn->virtualX; + var->xres_virtual = pScrn->displayWidth ? pScrn->displayWidth : + pScrn->virtualX; var->yres_virtual = pScrn->virtualY; var->bits_per_pixel = pScrn->bitsPerPixel; var->red.length = pScrn->weight.red; -- cgit v1.2.3 From dc5eb4523298f966bd5fd9ae6672160034b5e82c Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sun, 31 Dec 2006 17:59:44 +0100 Subject: fbdevhw: Override RGB offsets and masks after setting initial mode. This is a hack, but it should be a NOP for all the setups that worked before and actually seems to fix some others... Based on a patch by Peter Teichmann from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=338241 . --- hw/xfree86/fbdevhw/fbdevhw.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index a9288a753..8f78b85af 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -745,6 +745,17 @@ fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) "FBIOGET_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } + + /* XXX: This is a hack, but it should be a NOP for all the setups that + * worked before and actually seems to fix some others... + */ + pScrn->offset.red = fPtr->var.red.offset; + pScrn->offset.green = fPtr->var.green.offset; + pScrn->offset.blue = fPtr->var.blue.offset; + pScrn->mask.red = ((1 << fPtr->var.red.length) - 1) << fPtr->var.red.offset; + pScrn->mask.green = ((1 << fPtr->var.green.length) - 1) << fPtr->var.green.offset; + pScrn->mask.blue = ((1 << fPtr->var.blue.length) - 1) << fPtr->var.blue.offset; + return TRUE; } -- cgit v1.2.3 From e79602fca2f2cced66136729cdda4d356b0bdda0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 30 Dec 2006 21:52:22 -0800 Subject: Use RRScreenSetSizeRange in 1.0 compat. Check RRGetInfo for error. The RRScreenSizeSetRange function is used externally for 1.2 API drivers, but can also be used in the 1.0 compatibility code. This also ensures that the right changed bits are set so that clients are correctly notified when the range changes. RRGetInfo can return an error, use that to return BadAlloc to clients instead of blindly going on with various requests. (cherry picked from f05dd384d38c76dd9662933a03625dfef5b1c81f commit) --- randr/rrinfo.c | 23 +++++++++-------------- randr/rrscreen.c | 9 ++++++--- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/randr/rrinfo.c b/randr/rrinfo.c index 85426f654..797cdb1b4 100644 --- a/randr/rrinfo.c +++ b/randr/rrinfo.c @@ -169,18 +169,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations) if (height > maxHeight) maxHeight = height; } - if (minWidth != pScrPriv->minWidth) { - pScrPriv->minWidth = minWidth; pScrPriv->changed = TRUE; - } - if (maxWidth != pScrPriv->maxWidth) { - pScrPriv->maxWidth = maxWidth; pScrPriv->changed = TRUE; - } - if (minHeight != pScrPriv->minHeight) { - pScrPriv->minHeight = minHeight; pScrPriv->changed = TRUE; - } - if (maxHeight != pScrPriv->maxHeight) { - pScrPriv->maxHeight = maxHeight; pScrPriv->changed = TRUE; - } + RRScreenSetSizeRange (pScreen, minWidth, minHeight, maxWidth, maxHeight); /* notice current mode */ if (newMode) @@ -219,7 +208,6 @@ RRGetInfo (ScreenPtr pScreen) return TRUE; } -#if RANDR_12_INTERFACE /* * Register the range of sizes for the screen */ @@ -234,12 +222,19 @@ RRScreenSetSizeRange (ScreenPtr pScreen, if (!pScrPriv) return; + if (pScrPriv->minWidth == minWidth && pScrPriv->minHeight == minHeight && + pScrPriv->maxWidth == maxWidth && pScrPriv->maxHeight == maxHeight) + { + return; + } + pScrPriv->minWidth = minWidth; pScrPriv->minHeight = minHeight; pScrPriv->maxWidth = maxWidth; pScrPriv->maxHeight = maxHeight; + pScrPriv->changed = TRUE; + pScrPriv->configChanged = TRUE; } -#endif #ifdef RANDR_10_INTERFACE static Bool diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 6f7afaf7a..7947f80eb 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -234,7 +234,8 @@ ProcRRGetScreenSizeRange (ClientPtr client) if (pScrPriv) { - RRGetInfo (pScreen); + if (!RRGetInfo (pScreen)) + return BadAlloc; rep.minWidth = pScrPriv->minWidth; rep.minHeight = pScrPriv->minHeight; rep.maxWidth = pScrPriv->maxWidth; @@ -349,7 +350,8 @@ ProcRRGetScreenResources (ClientPtr client) rep.pad = 0; if (pScrPriv) - RRGetInfo (pScreen); + if (!RRGetInfo (pScreen)) + return BadAlloc; if (!pScrPriv) { @@ -591,7 +593,8 @@ ProcRRGetScreenInfo (ClientPtr client) rep.pad = 0; if (pScrPriv) - RRGetInfo (pScreen); + if (!RRGetInfo (pScreen)) + return BadAlloc; output = RRFirstOutput (pScreen); -- cgit v1.2.3 From 953a9ef949b4c57d28daeec57031fe1ce368c27c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 21 Dec 2006 23:50:39 -0800 Subject: Track physical screen size and send out updates when that changes. Events and internal data structures need to be updated whenever the physical or pixel size of the screen changes. The code was ignoring the physical size, so changing only that would not be registered anywhere. (cherry picked from f42e3cea236fa0091ed398a818fc8e17b0e1b3df commit) --- randr/randr.c | 4 ++++ randr/randrstr.h | 1 + randr/rrscreen.c | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/randr/randr.c b/randr/randr.c index 1470035ca..5fa9baf84 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -243,6 +243,10 @@ Bool RRScreenInit(ScreenPtr pScreen) pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width; pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height; + pScrPriv->width = pScreen->width; + pScrPriv->height = pScreen->height; + pScrPriv->mmWidth = pScreen->mmWidth; + pScrPriv->mmHeight = pScreen->mmHeight; #if RANDR_12_INTERFACE pScrPriv->rrScreenSetSize = NULL; pScrPriv->rrCrtcSet = NULL; diff --git a/randr/randrstr.h b/randr/randrstr.h index 88f7588ae..136a47e43 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -224,6 +224,7 @@ typedef struct _rrScrPriv { CARD16 minWidth, minHeight; CARD16 maxWidth, maxHeight; CARD16 width, height; /* last known screen size */ + CARD16 mmWidth, mmHeight; /* last known screen size */ int numOutputs; RROutputPtr *outputs; diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 7947f80eb..e10aa0362 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -158,11 +158,15 @@ RRScreenSizeNotify (ScreenPtr pScreen) * pixel size */ if (pScrPriv->width == pScreen->width && - pScrPriv->height == pScreen->height) + pScrPriv->height == pScreen->height && + pScrPriv->mmWidth == pScreen->mmWidth && + pScrPriv->mmHeight == pScreen->mmHeight) return; pScrPriv->width = pScreen->width; pScrPriv->height = pScreen->height; + pScrPriv->mmWidth = pScreen->mmWidth; + pScrPriv->mmHeight = pScreen->mmHeight; pScrPriv->changed = TRUE; /* pScrPriv->sizeChanged = TRUE; */ -- cgit v1.2.3 From 3b5b7ef5c2ab1d196806f6359e0972fd78d204dd Mon Sep 17 00:00:00 2001 From: Fredrik Höglund Date: Wed, 3 Jan 2007 21:05:35 +0100 Subject: Move the code for resetting the DPMS mode in response to input events, from WaitForSomething to mieqProcessInputEvents. mieqProcessInputEvents already handles resetting the screen saver. --- mi/mieq.c | 13 +++++++++++++ os/WaitFor.c | 5 +---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mi/mieq.c b/mi/mieq.c index 80915fd73..507cdd337 100644 --- a/mi/mieq.c +++ b/mi/mieq.c @@ -52,6 +52,12 @@ in this Software without prior written authorization from The Open Group. # include "extinit.h" # include "exglobals.h" +#ifdef DPMSExtension +# include "dpmsproc.h" +# define DPMS_SERVER +# include +#endif + #define QUEUE_SIZE 256 typedef struct _Event { @@ -183,6 +189,13 @@ mieqProcessInputEvents() while (miEventQueue.head != miEventQueue.tail) { if (screenIsSaved == SCREEN_SAVER_ON) SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); +#ifdef DPMSExtension + else if (DPMSPowerLevel != DPMSModeOn) + SetScreenSaverTimer(); + + if (DPMSPowerLevel != DPMSModeOn) + DPMSSet(DPMSModeOn); +#endif e = &miEventQueue.events[miEventQueue.head]; /* Assumption - screen switching can only occur on motion events. */ diff --git a/os/WaitFor.c b/os/WaitFor.c index ba227a3b6..d39964f30 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -337,10 +337,7 @@ WaitForSomething(int *pClientsReady) if (XFD_ANYSET(&tmp_set)) QueueWorkProc(EstablishNewConnections, NULL, (pointer)&LastSelectMask); -#ifdef DPMSExtension - if (XFD_ANYSET (&devicesReadable) && (DPMSPowerLevel != DPMSModeOn)) - DPMSSet(DPMSModeOn); -#endif + if (XFD_ANYSET (&devicesReadable) || XFD_ANYSET (&clientsReadable)) break; #ifdef WIN32 -- cgit v1.2.3 From 66fa87292ef26bd0f464481287f3af992cd5741c Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Wed, 3 Jan 2007 10:27:07 -0800 Subject: Fix BSF and BSR instructions in the x86 emulator. Patch courtesy of Michael Yaroslavtsev. --- hw/xfree86/x86emu/ops2.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/hw/xfree86/x86emu/ops2.c b/hw/xfree86/x86emu/ops2.c index 4bf95c182..7b0156aaa 100644 --- a/hw/xfree86/x86emu/ops2.c +++ b/hw/xfree86/x86emu/ops2.c @@ -2129,7 +2129,7 @@ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2)) uint srcoffset; START_OF_INSTR(); - DECODE_PRINTF("BSF\n"); + DECODE_PRINTF("BSF\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch(mod) { case 0: @@ -2209,25 +2209,25 @@ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2)) break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 *srcreg, *dstreg; + u32 srcval, *dstreg; - srcreg = DECODE_RM_LONG_REGISTER(rl); + srcval = *DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); - CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for(*dstreg = 0; *dstreg < 32; (*dstreg)++) - if ((*srcreg >> *dstreg) & 1) break; + if ((srcval >> *dstreg) & 1) break; } else { - u16 *srcreg, *dstreg; + u16 srcval, *dstreg; - srcreg = DECODE_RM_WORD_REGISTER(rl); + srcval = *DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); - CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for(*dstreg = 0; *dstreg < 16; (*dstreg)++) - if ((*srcreg >> *dstreg) & 1) break; + if ((srcval >> *dstreg) & 1) break; } break; } @@ -2245,7 +2245,7 @@ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2)) uint srcoffset; START_OF_INSTR(); - DECODE_PRINTF("BSF\n"); + DECODE_PRINTF("BSR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch(mod) { case 0: @@ -2325,25 +2325,25 @@ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2)) break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 *srcreg, *dstreg; + u32 srcval, *dstreg; - srcreg = DECODE_RM_LONG_REGISTER(rl); + srcval = *DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); - CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for(*dstreg = 31; *dstreg > 0; (*dstreg)--) - if ((*srcreg >> *dstreg) & 1) break; + if ((srcval >> *dstreg) & 1) break; } else { - u16 *srcreg, *dstreg; + u16 srcval, *dstreg; - srcreg = DECODE_RM_WORD_REGISTER(rl); + srcval = *DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); - CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for(*dstreg = 15; *dstreg > 0; (*dstreg)--) - if ((*srcreg >> *dstreg) & 1) break; + if ((srcval >> *dstreg) & 1) break; } break; } -- cgit v1.2.3 From 2fd4626fa6969b84d8e2f9db16d6e2d44c4bc499 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 3 Jan 2007 15:44:55 -0800 Subject: Make GLX byteswap macros more portable - Use autoconf tests instead of platform-specific #ifdef's to decide which macros to use. - Provide fallbacks for platforms like Solaris that don't provide any of the existing known forms. --- GL/glx/indirect_dispatch_swap.c | 26 ++++++++++------ GL/glx/indirect_program.c | 22 +++++++------ GL/glx/indirect_texture_compression.c | 22 +++++++------ GL/glx/indirect_util.c | 26 ++++++++++------ GL/glx/swap_interval.c | 22 +++++++------ configure.ac | 58 +++++++++++++++++++++++++++++++++++ include/dix-config.h.in | 15 +++++++++ 7 files changed, 146 insertions(+), 45 deletions(-) diff --git a/GL/glx/indirect_dispatch_swap.c b/GL/glx/indirect_dispatch_swap.c index 136f0d010..4fee8eed6 100644 --- a/GL/glx/indirect_dispatch_swap.c +++ b/GL/glx/indirect_dispatch_swap.c @@ -25,21 +25,29 @@ * SOFTWARE. */ +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + #include #include #include -#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) +#if defined(HAVE_BYTESWAP_H) #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 #else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#define bswap_32(value) \ + (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ + (uint32_t)bswap_16((uint16_t)((value) >> 16))) + +#define bswap_64(value) \ + (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ + << 32) | \ + (uint64_t)bswap_32((uint32_t)((value) >> 32))) #endif #include #include "indirect_size.h" diff --git a/GL/glx/indirect_program.c b/GL/glx/indirect_program.c index 8d5f0e60f..8372191f7 100644 --- a/GL/glx/indirect_program.c +++ b/GL/glx/indirect_program.c @@ -46,18 +46,22 @@ #include "dispatch.h" #include "glapioffsets.h" -#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__) +#if defined(HAVE_BYTESWAP_H) #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 #else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#define bswap_32(value) \ + (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ + (uint32_t)bswap_16((uint16_t)((value) >> 16))) + +#define bswap_64(value) \ + (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ + << 32) | \ + (uint64_t)bswap_32((uint32_t)((value) >> 32))) #endif static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc, diff --git a/GL/glx/indirect_texture_compression.c b/GL/glx/indirect_texture_compression.c index 35af1d235..801579d18 100644 --- a/GL/glx/indirect_texture_compression.c +++ b/GL/glx/indirect_texture_compression.c @@ -39,18 +39,22 @@ #include "glthread.h" #include "dispatch.h" -#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__) +#if defined(HAVE_BYTESWAP_H) #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 #else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#define bswap_32(value) \ + (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ + (uint32_t)bswap_16((uint16_t)((value) >> 16))) + +#define bswap_64(value) \ + (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ + << 32) | \ + (uint64_t)bswap_32((uint32_t)((value) >> 32))) #endif int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *pc) diff --git a/GL/glx/indirect_util.c b/GL/glx/indirect_util.c index 09b7ab87c..d72e40744 100644 --- a/GL/glx/indirect_util.c +++ b/GL/glx/indirect_util.c @@ -23,23 +23,31 @@ * SOFTWARE. */ +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + #include #include #include #include -#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) +#if defined(HAVE_BYTESWAP_H) #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 #else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#define bswap_32(value) \ + (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ + (uint32_t)bswap_16((uint16_t)((value) >> 16))) + +#define bswap_64(value) \ + (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ + << 32) | \ + (uint64_t)bswap_32((uint32_t)((value) >> 32))) #endif #include #include "indirect_size.h" diff --git a/GL/glx/swap_interval.c b/GL/glx/swap_interval.c index c4137c1aa..e5b48a6ef 100644 --- a/GL/glx/swap_interval.c +++ b/GL/glx/swap_interval.c @@ -40,18 +40,22 @@ #include "dispatch.h" #include "glapioffsets.h" -#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__) +#if defined(HAVE_BYTESWAP_H) #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 #else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#define bswap_32(value) \ + (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ + (uint32_t)bswap_16((uint16_t)((value) >> 16))) + +#define bswap_64(value) \ + (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ + << 32) | \ + (uint64_t)bswap_32((uint32_t)((value) >> 32))) #endif static int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap); diff --git a/configure.ac b/configure.ac index 491bdd511..278502be9 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,64 @@ fi AC_TYPE_PID_T +# Checks for headers/macros for byte swapping +# Known variants: +# bswap_16, bswap_32, bswap_64 (glibc) +# __swap16, __swap32, __swap64 (OpenBSD) +# bswap16, bswap32, bswap64 (other BSD's) +# and a fallback to local macros if none of the above are found + +# if is found, assume it's the correct version +AC_CHECK_HEADERS([byteswap.h]) + +# if is found, have to check which version +AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"]) + +if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then + AC_MSG_CHECKING([for __swap16 variant of byteswapping macros]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([ +#include + ], [ +int a = 1, b; +b = __swap16(a); + ]) +], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no']) + AC_MSG_RESULT([$SYS_ENDIAN__SWAP]) + + AC_MSG_CHECKING([for bswap_16 variant of byteswapping macros]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([ +#include + ], [ +int a = 1, b; +b = bswap_16(a); + ]) +], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no']) + AC_MSG_RESULT([$SYS_ENDIAN_BSWAP]) + + if test "$SYS_ENDIAN_BSWAP" = "yes" ; then + USE_SYS_ENDIAN_H=yes + BSWAP=bswap_ + else + if test "$SYS_ENDIAN__SWAP" = "yes" ; then + USE_SYS_ENDIAN_H=yes + BSWAP=__swap + else + USE_SYS_ENDIAN_H=no + fi + fi + + if test "$USE_SYS_ENDIAN_H" = "yes" ; then + AC_DEFINE([USE_SYS_ENDIAN_H], 1, + [Define to use byteswap macros from ]) + AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, + [Define to 16-bit byteswap macro]) + AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, + [Define to 32-bit byteswap macro]) + AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, + [Define to 64-bit byteswap macro]) + fi +fi + dnl Checks for library functions. AC_FUNC_VPRINTF AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \ diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 7aabae2ec..6bf27865c 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -93,6 +93,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ASM_MTRR_H +/* Define to 1 if you have the header file. */ +#undef HAVE_BYTESWAP_H + /* Define to 1 if you have the header file. */ #undef HAVE_DBM_H @@ -311,6 +314,9 @@ /* Use rgb.txt directly */ #undef USE_RGB_TXT +/* Define to use byteswap macros from */ +#undef USE_SYS_ENDIAN_H + /* unaligned word accesses behave as expected */ #undef WORKING_UNALIGNED_INT @@ -469,4 +475,13 @@ /* Path to XErrorDB file */ #undef XERRORDB_PATH +/* Define to 16-bit byteswap macro */ +#undef bswap_16 + +/* Define to 32-bit byteswap macro */ +#undef bswap_32 + +/* Define to 64-bit byteswap macro */ +#undef bswap_64 + #endif /* _DIX_CONFIG_H_ */ -- cgit v1.2.3 From aab2ca204279b638c7e5bb6b8427c58be9704c57 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 21 Dec 2006 09:16:19 -0800 Subject: Try dlsym(RTLD_DEFAULT) first when finding symbols. The previous mechanism failed when finding drm symbols now that libdrm has moved to being linked by libdri instead of being linked into the server. --- hw/xfree86/loader/dlloader.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xfree86/loader/dlloader.c b/hw/xfree86/loader/dlloader.c index a0e867056..2afdef789 100644 --- a/hw/xfree86/loader/dlloader.c +++ b/hw/xfree86/loader/dlloader.c @@ -113,6 +113,10 @@ DLFindSymbol(const char *name) DLModuleList *l; void *p; + p = dlsym(RTLD_DEFAULT, name); + if (p != NULL) + return p; + for (l = dlModuleList; l != NULL; l = l->next) { p = DLFindSymbolLocal(l->module, name); if (p) -- cgit v1.2.3 From 7d2ec92170ebbdfa10a05734cb7cfaac97d19d65 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Jan 2007 12:24:48 -0800 Subject: Keep track of how many visuals we set up for GLcore, to avoid an invalid free. The proper fix would involve actually setting up the ARGB visual for GLcore, but I just want the server to not crash at exit. --- GL/mesa/X/xf86glx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GL/mesa/X/xf86glx.c b/GL/mesa/X/xf86glx.c index 94959d628..47c87f6d9 100644 --- a/GL/mesa/X/xf86glx.c +++ b/GL/mesa/X/xf86glx.c @@ -78,6 +78,7 @@ typedef struct __GLXMESAdrawable __GLXMESAdrawable; struct __GLXMESAscreen { __GLXscreen base; int index; + int num_vis; XMesaVisual *xm_vis; }; @@ -280,7 +281,7 @@ __glXMesaScreenDestroy(__GLXscreen *screen) __GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen; int i; - for (i = 0; i < screen->numVisuals; i++) { + for (i = 0; i < mesaScreen->num_vis; i++) { if (mesaScreen->xm_vis[i]) XMesaDestroyVisual(mesaScreen->xm_vis[i]); } @@ -389,6 +390,7 @@ static void init_screen_visuals(__GLXMESAscreen *screen) xfree(used); + screen->num_vis = pScreen->numVisuals; screen->xm_vis = pXMesaVisual; } -- cgit v1.2.3 From 6d603bb47ff9d238637adbf30c6e9697e6e7e6fa Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 4 Jan 2007 14:49:26 -0800 Subject: Add new header file containing byte-order wrappers. Move the byte-order related wrappers out of the individual source files into a dedicated header file. Modify the single hand-coded source file that uses the byte-order wrappers to use the new header file. --- GL/glx/glxbyteorder.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ GL/glx/swap_interval.c | 14 +------------- 2 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 GL/glx/glxbyteorder.h diff --git a/GL/glx/glxbyteorder.h b/GL/glx/glxbyteorder.h new file mode 100644 index 000000000..3c094d702 --- /dev/null +++ b/GL/glx/glxbyteorder.h @@ -0,0 +1,48 @@ +/* + * (C) Copyright IBM Corporation 2006, 2007 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, THE AUTHORS, AND/OR THEIR SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file glxbyteorder.h + * Platform glue for handling byte-ordering issues in GLX protocol. + * + * \author Ian Romanick + */ +#if !defined(__GLXBYTEORDER_H__) +#define __GLXBYTEORDER_H__ + +#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) +#include +#elif defined(__OpenBSD__) +#include +#define bswap_16 __swap16 +#define bswap_32 __swap32 +#define bswap_64 __swap64 +#else +#include +#define bswap_16 bswap16 +#define bswap_32 bswap32 +#define bswap_64 bswap64 +#endif + +#endif /* !defined(__GLXBYTEORDER_H__) */ diff --git a/GL/glx/swap_interval.c b/GL/glx/swap_interval.c index c4137c1aa..6aa92a35b 100644 --- a/GL/glx/swap_interval.c +++ b/GL/glx/swap_interval.c @@ -40,19 +40,7 @@ #include "dispatch.h" #include "glapioffsets.h" -#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__) -#include -#elif defined(__OpenBSD__) -#include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 -#else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 -#endif +#include "glxbyteorder.h" static int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap); -- cgit v1.2.3 From 45aa26ccb4f61c2919ce2475d0907c6e1b177da2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 4 Jan 2007 14:55:51 -0800 Subject: Regenerate from Mesa scripts. Regenerate source files from Mesa scripts. This causes the generated files to use glxbyteorder.h. --- GL/glx/indirect_dispatch.c | 1 + GL/glx/indirect_dispatch_swap.c | 14 +- GL/glx/indirect_reqsize.c | 700 ++++++++++++++++++++-------------------- GL/glx/indirect_reqsize.h | 18 +- 4 files changed, 358 insertions(+), 375 deletions(-) diff --git a/GL/glx/indirect_dispatch.c b/GL/glx/indirect_dispatch.c index d86dedfd5..00a9f9659 100644 --- a/GL/glx/indirect_dispatch.c +++ b/GL/glx/indirect_dispatch.c @@ -33,6 +33,7 @@ #include "indirect_size_get.h" #include "indirect_dispatch.h" #include "glxserver.h" +#include "glxbyteorder.h" #include "indirect_util.h" #include "singlesize.h" #include "glapitable.h" diff --git a/GL/glx/indirect_dispatch_swap.c b/GL/glx/indirect_dispatch_swap.c index 136f0d010..c0bb71cc4 100644 --- a/GL/glx/indirect_dispatch_swap.c +++ b/GL/glx/indirect_dispatch_swap.c @@ -28,24 +28,12 @@ #include #include #include -#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) -#include -#elif defined(__OpenBSD__) -#include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 -#else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 -#endif #include #include "indirect_size.h" #include "indirect_size_get.h" #include "indirect_dispatch.h" #include "glxserver.h" +#include "glxbyteorder.h" #include "indirect_util.h" #include "singlesize.h" #include "glapitable.h" diff --git a/GL/glx/indirect_reqsize.c b/GL/glx/indirect_reqsize.c index d3e2bc516..954eecd97 100644 --- a/GL/glx/indirect_reqsize.c +++ b/GL/glx/indirect_reqsize.c @@ -28,16 +28,10 @@ #include #include "glxserver.h" +#include "glxbyteorder.h" #include "indirect_size.h" #include "indirect_reqsize.h" -#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) -# include -# define SWAP_32(v) do { (v) = bswap_32(v); } while(0) -#else -# define SWAP_32(v) do { char tmp; swapl(&v, tmp); } while(0) -#endif - #define __GLX_PAD(x) (((x) + 3) & ~3) #if defined(__CYGWIN__) || defined(__MINGW32__) @@ -56,15 +50,15 @@ int -__glXCallListsReqSize( const GLbyte * pc, Bool swap ) +__glXCallListsReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 0); - GLenum type = * (GLenum *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 0); + GLenum type = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( n ); - SWAP_32( type ); + n = bswap_32(n); + type = bswap_32(type); } compsize = __glCallLists_size(type); @@ -72,22 +66,22 @@ __glXCallListsReqSize( const GLbyte * pc, Bool swap ) } int -__glXBitmapReqSize( const GLbyte * pc, Bool swap ) +__glXBitmapReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLsizei width = *(GLsizei *)(pc + 20); - GLsizei height = *(GLsizei *)(pc + 24); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLsizei width = *(GLsizei *) (pc + 20); + GLsizei height = *(GLsizei *) (pc + 24); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( width ); - SWAP_32( height ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + width = bswap_32(width); + height = bswap_32(height); } return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, width, height, 1, @@ -96,13 +90,13 @@ __glXBitmapReqSize( const GLbyte * pc, Bool swap ) } int -__glXFogfvReqSize( const GLbyte * pc, Bool swap ) +__glXFogfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 0); + GLenum pname = *(GLenum *) (pc + 0); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glFogfv_size(pname); @@ -110,13 +104,13 @@ __glXFogfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXLightfvReqSize( const GLbyte * pc, Bool swap ) +__glXLightfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glLightfv_size(pname); @@ -124,13 +118,13 @@ __glXLightfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXLightModelfvReqSize( const GLbyte * pc, Bool swap ) +__glXLightModelfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 0); + GLenum pname = *(GLenum *) (pc + 0); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glLightModelfv_size(pname); @@ -138,13 +132,13 @@ __glXLightModelfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXMaterialfvReqSize( const GLbyte * pc, Bool swap ) +__glXMaterialfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glMaterialfv_size(pname); @@ -152,18 +146,18 @@ __glXMaterialfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXPolygonStippleReqSize( const GLbyte * pc, Bool swap ) +__glXPolygonStippleReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); } return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, 32, 32, 1, @@ -172,13 +166,13 @@ __glXPolygonStippleReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexParameterfvReqSize( const GLbyte * pc, Bool swap ) +__glXTexParameterfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glTexParameterfv_size(pname); @@ -186,26 +180,26 @@ __glXTexParameterfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexImage1DReqSize( const GLbyte * pc, Bool swap ) +__glXTexImage1DReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 32); - GLenum format = * (GLenum *)(pc + 44); - GLenum type = * (GLenum *)(pc + 48); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 32); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, @@ -214,28 +208,28 @@ __glXTexImage1DReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexImage2DReqSize( const GLbyte * pc, Bool swap ) +__glXTexImage2DReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 32); - GLsizei height = *(GLsizei *)(pc + 36); - GLenum format = * (GLenum *)(pc + 44); - GLenum type = * (GLenum *)(pc + 48); - - if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( format ); - SWAP_32( type ); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 32); + GLsizei height = *(GLsizei *) (pc + 36); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, 1, @@ -244,13 +238,13 @@ __glXTexImage2DReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexEnvfvReqSize( const GLbyte * pc, Bool swap ) +__glXTexEnvfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glTexEnvfv_size(pname); @@ -258,13 +252,13 @@ __glXTexEnvfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexGendvReqSize( const GLbyte * pc, Bool swap ) +__glXTexGendvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glTexGendv_size(pname); @@ -272,13 +266,13 @@ __glXTexGendvReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexGenfvReqSize( const GLbyte * pc, Bool swap ) +__glXTexGenfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glTexGenfv_size(pname); @@ -286,50 +280,50 @@ __glXTexGenfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXPixelMapfvReqSize( const GLbyte * pc, Bool swap ) +__glXPixelMapfvReqSize(const GLbyte *pc, Bool swap) { - GLsizei mapsize = *(GLsizei *)(pc + 4); + GLsizei mapsize = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( mapsize ); + mapsize = bswap_32(mapsize); } return __GLX_PAD((mapsize * 4)); } int -__glXPixelMapusvReqSize( const GLbyte * pc, Bool swap ) +__glXPixelMapusvReqSize(const GLbyte *pc, Bool swap) { - GLsizei mapsize = *(GLsizei *)(pc + 4); + GLsizei mapsize = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( mapsize ); + mapsize = bswap_32(mapsize); } return __GLX_PAD((mapsize * 2)); } int -__glXDrawPixelsReqSize( const GLbyte * pc, Bool swap ) +__glXDrawPixelsReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLsizei width = *(GLsizei *)(pc + 20); - GLsizei height = *(GLsizei *)(pc + 24); - GLenum format = * (GLenum *)(pc + 28); - GLenum type = * (GLenum *)(pc + 32); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLsizei width = *(GLsizei *) (pc + 20); + GLsizei height = *(GLsizei *) (pc + 24); + GLenum format = *(GLenum *) (pc + 28); + GLenum type = *(GLenum *) (pc + 32); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, 0, width, height, 1, @@ -338,38 +332,38 @@ __glXDrawPixelsReqSize( const GLbyte * pc, Bool swap ) } int -__glXPrioritizeTexturesReqSize( const GLbyte * pc, Bool swap ) +__glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 0); + GLsizei n = *(GLsizei *) (pc + 0); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 4) + (n * 4)); } int -__glXTexSubImage1DReqSize( const GLbyte * pc, Bool swap ) +__glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 36); - GLenum format = * (GLenum *)(pc + 44); - GLenum type = * (GLenum *)(pc + 48); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 36); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, @@ -378,28 +372,28 @@ __glXTexSubImage1DReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexSubImage2DReqSize( const GLbyte * pc, Bool swap ) +__glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 36); - GLsizei height = *(GLsizei *)(pc + 40); - GLenum format = * (GLenum *)(pc + 44); - GLenum type = * (GLenum *)(pc + 48); - - if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( format ); - SWAP_32( type ); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 36); + GLsizei height = *(GLsizei *) (pc + 40); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, 1, @@ -408,26 +402,26 @@ __glXTexSubImage2DReqSize( const GLbyte * pc, Bool swap ) } int -__glXColorTableReqSize( const GLbyte * pc, Bool swap ) +__glXColorTableReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 28); - GLenum format = * (GLenum *)(pc + 32); - GLenum type = * (GLenum *)(pc + 36); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 28); + GLenum format = *(GLenum *) (pc + 32); + GLenum type = *(GLenum *) (pc + 36); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, @@ -436,13 +430,13 @@ __glXColorTableReqSize( const GLbyte * pc, Bool swap ) } int -__glXColorTableParameterfvReqSize( const GLbyte * pc, Bool swap ) +__glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glColorTableParameterfv_size(pname); @@ -450,26 +444,26 @@ __glXColorTableParameterfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXColorSubTableReqSize( const GLbyte * pc, Bool swap ) +__glXColorSubTableReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei count = *(GLsizei *)(pc + 28); - GLenum format = * (GLenum *)(pc + 32); - GLenum type = * (GLenum *)(pc + 36); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei count = *(GLsizei *) (pc + 28); + GLenum format = *(GLenum *) (pc + 32); + GLenum type = *(GLenum *) (pc + 36); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( count ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + count = bswap_32(count); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, count, 1, 1, @@ -478,26 +472,26 @@ __glXColorSubTableReqSize( const GLbyte * pc, Bool swap ) } int -__glXConvolutionFilter1DReqSize( const GLbyte * pc, Bool swap ) +__glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 28); - GLenum format = * (GLenum *)(pc + 36); - GLenum type = * (GLenum *)(pc + 40); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 28); + GLenum format = *(GLenum *) (pc + 36); + GLenum type = *(GLenum *) (pc + 40); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, @@ -506,28 +500,28 @@ __glXConvolutionFilter1DReqSize( const GLbyte * pc, Bool swap ) } int -__glXConvolutionFilter2DReqSize( const GLbyte * pc, Bool swap ) +__glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 28); - GLsizei height = *(GLsizei *)(pc + 32); - GLenum format = * (GLenum *)(pc + 36); - GLenum type = * (GLenum *)(pc + 40); - - if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( format ); - SWAP_32( type ); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 28); + GLsizei height = *(GLsizei *) (pc + 32); + GLenum format = *(GLenum *) (pc + 36); + GLenum type = *(GLenum *) (pc + 40); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, 1, @@ -536,13 +530,13 @@ __glXConvolutionFilter2DReqSize( const GLbyte * pc, Bool swap ) } int -__glXConvolutionParameterfvReqSize( const GLbyte * pc, Bool swap ) +__glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glConvolutionParameterfv_size(pname); @@ -550,32 +544,32 @@ __glXConvolutionParameterfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexImage3DReqSize( const GLbyte * pc, Bool swap ) +__glXTexImage3DReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); - GLint image_height = * (GLint *)(pc + 8); - GLint skip_rows = * (GLint *)(pc + 16); - GLint skip_images = * (GLint *)(pc + 20); - GLint alignment = * (GLint *)(pc + 32); - GLenum target = * (GLenum *)(pc + 36); - GLsizei width = *(GLsizei *)(pc + 48); - GLsizei height = *(GLsizei *)(pc + 52); - GLsizei depth = *(GLsizei *)(pc + 56); - GLenum format = * (GLenum *)(pc + 68); - GLenum type = * (GLenum *)(pc + 72); + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = *(GLint *) (pc + 8); + GLint skip_rows = *(GLint *) (pc + 16); + GLint skip_images = *(GLint *) (pc + 20); + GLint alignment = *(GLint *) (pc + 32); + GLenum target = *(GLenum *) (pc + 36); + GLsizei width = *(GLsizei *) (pc + 48); + GLsizei height = *(GLsizei *) (pc + 52); + GLsizei depth = *(GLsizei *) (pc + 56); + GLenum format = *(GLenum *) (pc + 68); + GLenum type = *(GLenum *) (pc + 72); if (swap) { - SWAP_32( row_length ); - SWAP_32( image_height ); - SWAP_32( skip_rows ); - SWAP_32( skip_images ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( depth ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + image_height = bswap_32(image_height); + skip_rows = bswap_32(skip_rows); + skip_images = bswap_32(skip_images); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + depth = bswap_32(depth); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, depth, @@ -584,32 +578,32 @@ __glXTexImage3DReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexSubImage3DReqSize( const GLbyte * pc, Bool swap ) +__glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); - GLint image_height = * (GLint *)(pc + 8); - GLint skip_rows = * (GLint *)(pc + 16); - GLint skip_images = * (GLint *)(pc + 20); - GLint alignment = * (GLint *)(pc + 32); - GLenum target = * (GLenum *)(pc + 36); - GLsizei width = *(GLsizei *)(pc + 60); - GLsizei height = *(GLsizei *)(pc + 64); - GLsizei depth = *(GLsizei *)(pc + 68); - GLenum format = * (GLenum *)(pc + 76); - GLenum type = * (GLenum *)(pc + 80); + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = *(GLint *) (pc + 8); + GLint skip_rows = *(GLint *) (pc + 16); + GLint skip_images = *(GLint *) (pc + 20); + GLint alignment = *(GLint *) (pc + 32); + GLenum target = *(GLenum *) (pc + 36); + GLsizei width = *(GLsizei *) (pc + 60); + GLsizei height = *(GLsizei *) (pc + 64); + GLsizei depth = *(GLsizei *) (pc + 68); + GLenum format = *(GLenum *) (pc + 76); + GLenum type = *(GLenum *) (pc + 80); if (swap) { - SWAP_32( row_length ); - SWAP_32( image_height ); - SWAP_32( skip_rows ); - SWAP_32( skip_images ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( depth ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + image_height = bswap_32(image_height); + skip_rows = bswap_32(skip_rows); + skip_images = bswap_32(skip_images); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + depth = bswap_32(depth); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, depth, @@ -618,221 +612,221 @@ __glXTexSubImage3DReqSize( const GLbyte * pc, Bool swap ) } int -__glXDrawBuffersARBReqSize( const GLbyte * pc, Bool swap ) +__glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 0); + GLsizei imageSize = *(GLsizei *) (pc + 20); if (swap) { - SWAP_32( n ); + imageSize = bswap_32(imageSize); } - return __GLX_PAD((n * 4)); + return __GLX_PAD(imageSize); } int -__glXPointParameterfvEXTReqSize( const GLbyte * pc, Bool swap ) +__glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 0); - GLsizei compsize; + GLsizei imageSize = *(GLsizei *) (pc + 24); if (swap) { - SWAP_32( pname ); + imageSize = bswap_32(imageSize); } - compsize = __glPointParameterfvEXT_size(pname); - return __GLX_PAD((compsize * 4)); + return __GLX_PAD(imageSize); } int -__glXCompressedTexImage3DARBReqSize( const GLbyte * pc, Bool swap ) +__glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap) { - GLsizei imageSize = *(GLsizei *)(pc + 28); + GLsizei imageSize = *(GLsizei *) (pc + 28); if (swap) { - SWAP_32( imageSize ); + imageSize = bswap_32(imageSize); } return __GLX_PAD(imageSize); } int -__glXCompressedTexImage2DARBReqSize( const GLbyte * pc, Bool swap ) +__glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap) { - GLsizei imageSize = *(GLsizei *)(pc + 24); + GLsizei imageSize = *(GLsizei *) (pc + 36); if (swap) { - SWAP_32( imageSize ); + imageSize = bswap_32(imageSize); } return __GLX_PAD(imageSize); } int -__glXCompressedTexImage1DARBReqSize( const GLbyte * pc, Bool swap ) +__glXProgramStringARBReqSize(const GLbyte *pc, Bool swap) { - GLsizei imageSize = *(GLsizei *)(pc + 20); + GLsizei len = *(GLsizei *) (pc + 8); if (swap) { - SWAP_32( imageSize ); + len = bswap_32(len); } - return __GLX_PAD(imageSize); + return __GLX_PAD(len); } int -__glXCompressedTexSubImage3DARBReqSize( const GLbyte * pc, Bool swap ) +__glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap) { - GLsizei imageSize = *(GLsizei *)(pc + 36); + GLsizei n = *(GLsizei *) (pc + 0); if (swap) { - SWAP_32( imageSize ); + n = bswap_32(n); } - return __GLX_PAD(imageSize); + return __GLX_PAD((n * 4)); } int -__glXLoadProgramNVReqSize( const GLbyte * pc, Bool swap ) +__glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap) { - GLsizei len = *(GLsizei *)(pc + 8); + GLenum pname = *(GLenum *) (pc + 0); + GLsizei compsize; if (swap) { - SWAP_32( len ); + pname = bswap_32(pname); } - return __GLX_PAD(len); + compsize = __glPointParameterfvEXT_size(pname); + return __GLX_PAD((compsize * 4)); } int -__glXProgramParameters4dvNVReqSize( const GLbyte * pc, Bool swap ) +__glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap) { - GLuint num = * (GLuint *)(pc + 8); + GLuint num = *(GLuint *) (pc + 8); if (swap) { - SWAP_32( num ); + num = bswap_32(num); } return __GLX_PAD((num * 32)); } int -__glXProgramParameters4fvNVReqSize( const GLbyte * pc, Bool swap ) +__glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap) { - GLuint num = * (GLuint *)(pc + 8); + GLuint num = *(GLuint *) (pc + 8); if (swap) { - SWAP_32( num ); + num = bswap_32(num); } return __GLX_PAD((num * 16)); } int -__glXVertexAttribs1dvNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 8)); } int -__glXVertexAttribs2dvNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 16)); } int -__glXVertexAttribs3dvNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 24)); } int -__glXVertexAttribs3fvNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 12)); } int -__glXVertexAttribs3svNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 6)); } int -__glXVertexAttribs4dvNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 32)); } int -__glXProgramNamedParameter4fvNVReqSize( const GLbyte * pc, Bool swap ) +__glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei len = *(GLsizei *)(pc + 4); + GLsizei len = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( len ); + len = bswap_32(len); } return __GLX_PAD(len); } -ALIAS( Fogiv, Fogfv ) -ALIAS( Lightiv, Lightfv ) -ALIAS( LightModeliv, LightModelfv ) -ALIAS( Materialiv, Materialfv ) -ALIAS( TexParameteriv, TexParameterfv ) -ALIAS( TexEnviv, TexEnvfv ) -ALIAS( TexGeniv, TexGenfv ) -ALIAS( PixelMapuiv, PixelMapfv ) -ALIAS( ColorTableParameteriv, ColorTableParameterfv ) -ALIAS( ConvolutionParameteriv, ConvolutionParameterfv ) -ALIAS( CompressedTexSubImage2DARB, CompressedTexImage3DARB ) -ALIAS( CompressedTexSubImage1DARB, CompressedTexImage1DARB ) -ALIAS( RequestResidentProgramsNV, DrawBuffersARB ) -ALIAS( VertexAttribs1fvNV, PixelMapfv ) -ALIAS( VertexAttribs1svNV, PixelMapusv ) -ALIAS( VertexAttribs2fvNV, VertexAttribs1dvNV ) -ALIAS( VertexAttribs2svNV, PixelMapfv ) -ALIAS( VertexAttribs4fvNV, VertexAttribs2dvNV ) -ALIAS( VertexAttribs4svNV, VertexAttribs1dvNV ) -ALIAS( VertexAttribs4ubvNV, PixelMapfv ) -ALIAS( PointParameterivNV, PointParameterfvEXT ) -ALIAS( ProgramStringARB, LoadProgramNV ) -ALIAS( ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB ) -ALIAS( DeleteRenderbuffersEXT, DrawBuffersARB ) -ALIAS( DeleteFramebuffersEXT, DrawBuffersARB ) +ALIAS(Fogiv, Fogfv) + ALIAS(Lightiv, Lightfv) + ALIAS(LightModeliv, LightModelfv) + ALIAS(Materialiv, Materialfv) + ALIAS(TexParameteriv, TexParameterfv) + ALIAS(TexEnviv, TexEnvfv) + ALIAS(TexGeniv, TexGenfv) + ALIAS(PixelMapuiv, PixelMapfv) + ALIAS(ColorTableParameteriv, ColorTableParameterfv) + ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) + ALIAS(CompressedTexSubImage1DARB, CompressedTexImage1DARB) + ALIAS(CompressedTexSubImage2DARB, CompressedTexImage3DARB) + ALIAS(LoadProgramNV, ProgramStringARB) + ALIAS(RequestResidentProgramsNV, DrawBuffersARB) + ALIAS(VertexAttribs1fvNV, PixelMapfv) + ALIAS(VertexAttribs1svNV, PixelMapusv) + ALIAS(VertexAttribs2fvNV, VertexAttribs1dvNV) + ALIAS(VertexAttribs2svNV, PixelMapfv) + ALIAS(VertexAttribs4fvNV, VertexAttribs2dvNV) + ALIAS(VertexAttribs4svNV, VertexAttribs1dvNV) + ALIAS(VertexAttribs4ubvNV, PixelMapfv) + ALIAS(PointParameterivNV, PointParameterfvEXT) + ALIAS(ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB) + ALIAS(DeleteFramebuffersEXT, DrawBuffersARB) + ALIAS(DeleteRenderbuffersEXT, DrawBuffersARB) diff --git a/GL/glx/indirect_reqsize.h b/GL/glx/indirect_reqsize.h index 23bc41c78..26211ee5c 100644 --- a/GL/glx/indirect_reqsize.h +++ b/GL/glx/indirect_reqsize.h @@ -83,14 +83,15 @@ extern PURE HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte *pc, Bool extern PURE HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap); @@ -109,11 +110,10 @@ extern PURE HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte *pc, Bool swa extern PURE HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap); # undef HIDDEN # undef PURE -- cgit v1.2.3 From b7ca5d14ce7ba410b0dab5c2289f6d7b75e763df Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 4 Jan 2007 15:37:33 -0800 Subject: Incorporate new byte-order related configure changes. --- GL/glx/glxbyteorder.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/GL/glx/glxbyteorder.h b/GL/glx/glxbyteorder.h index 3c094d702..0bcb91fb7 100644 --- a/GL/glx/glxbyteorder.h +++ b/GL/glx/glxbyteorder.h @@ -31,18 +31,25 @@ #if !defined(__GLXBYTEORDER_H__) #define __GLXBYTEORDER_H__ -#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#if HAVE_BYTESWAP_H #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 -#else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#define bswap_32(value) \ + (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ + (uint32_t)bswap_16((uint16_t)((value) >> 16))) + +#define bswap_64(value) \ + (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ + << 32) | \ + (uint64_t)bswap_32((uint32_t)((value) >> 32))) #endif #endif /* !defined(__GLXBYTEORDER_H__) */ -- cgit v1.2.3 From f90c3e226b105bf77beb94723fc08bdff14834be Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 4 Jan 2007 15:38:16 -0800 Subject: Re-regenerate from Mesa scripts. DO NOT HAND EDIT THESE FILES! For cryin' out loud, there's even a comment to that effect in the file's header... --- GL/glx/indirect_dispatch_swap.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/GL/glx/indirect_dispatch_swap.c b/GL/glx/indirect_dispatch_swap.c index db651543c..c0bb71cc4 100644 --- a/GL/glx/indirect_dispatch_swap.c +++ b/GL/glx/indirect_dispatch_swap.c @@ -25,10 +25,6 @@ * SOFTWARE. */ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - #include #include #include -- cgit v1.2.3 From dfb2c10413e22afd8d486a982870f874326d5ef4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 5 Jan 2007 10:15:09 -0800 Subject: Add missing #else from previous commits. --- GL/glx/glxbyteorder.h | 1 + 1 file changed, 1 insertion(+) diff --git a/GL/glx/glxbyteorder.h b/GL/glx/glxbyteorder.h index 0bcb91fb7..b9d738dba 100644 --- a/GL/glx/glxbyteorder.h +++ b/GL/glx/glxbyteorder.h @@ -39,6 +39,7 @@ #include #elif defined(USE_SYS_ENDIAN_H) #include +#else #define bswap_16(value) \ ((((value) & 0xff) << 8) | ((value) >> 8)) -- cgit v1.2.3 From 0b73a7eb17fd848c6bdc6a65ba835aa2cbfc3cfd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 5 Jan 2007 18:12:04 -0800 Subject: Add support for the DamagePost (XDamage 1.1) request. This makes damageproto >= 1.1 a requirement to build. --- configure.ac | 2 +- damageext/damageext.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 278502be9..c4aafaa11 100644 --- a/configure.ac +++ b/configure.ac @@ -603,7 +603,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la' XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la' dnl Core modules for most extensions, et al. -REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4] [kbproto >= 1.0.3]" +REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4] [kbproto >= 1.0.3]" REQUIRED_LIBS="xfont xau fontenc" if test "x$DBUS" = xauto; then diff --git a/damageext/damageext.c b/damageext/damageext.c index 6083693a4..a90dfb823 100755 --- a/damageext/damageext.c +++ b/damageext/damageext.c @@ -279,10 +279,35 @@ ProcDamageSubtract (ClientPtr client) return (client->noClientException); } +static int +ProcDamagePost (ClientPtr client) +{ + REQUEST(xDamagePostReq); + DrawablePtr pDrawable; + RegionPtr pRegion; + int rc; + + REQUEST_SIZE_MATCH(xDamagePostReq); + VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; + + /* The region is relative to the drawable origin, so translate it out to + * screen coordinates like damage expects. + */ + REGION_TRANSLATE(pScreen, pRegion, pDrawable->x, pDrawable->y); + DamageDamageRegion(pDrawable, pRegion); + REGION_TRANSLATE(pScreen, pRegion, -pDrawable->x, -pDrawable->y); + + return (client->noClientException); +} + /* Major version controls available requests */ static const int version_requests[] = { X_DamageQueryVersion, /* before client sends QueryVersion */ - X_DamageSubtract, /* Version 1 */ + X_DamagePost, /* Version 1 */ }; #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) @@ -293,6 +318,8 @@ int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = { ProcDamageCreate, ProcDamageDestroy, ProcDamageSubtract, +/*************** Version 1.1 ****************/ + ProcDamagePost, }; @@ -361,12 +388,27 @@ SProcDamageSubtract (ClientPtr client) return (*ProcDamageVector[stuff->damageReqType]) (client); } +static int +SProcDamagePost (ClientPtr client) +{ + register int n; + REQUEST(xDamagePostReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH(xDamageSubtractReq); + swapl (&stuff->drawable, n); + swapl (&stuff->region, n); + return (*ProcDamageVector[stuff->damageReqType]) (client); +} + int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ SProcDamageQueryVersion, SProcDamageCreate, SProcDamageDestroy, SProcDamageSubtract, +/*************** Version 1.1 ****************/ + SProcDamagePost, }; static int -- cgit v1.2.3 From 282a4dcaabc5f0cd6f7d3819aa648333b93b265e Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 8 Jan 2007 19:22:41 +0100 Subject: Attempt to fix drawable type checks in dixLookupDrawable(). Not sure this is 100% correct either, but it fixes at least one reproducible crasher where it returned a pixmap to dixLookupWindow(). --- dix/dixutils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dix/dixutils.c b/dix/dixutils.c index 084d2e4c5..e530360fe 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -219,7 +219,7 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, pTmp = client->lastDrawable; /* an access check is required for cached drawables */ - rtype = (pTmp->type | M_WINDOW) ? RT_WINDOW : RT_PIXMAP; + rtype = (type & M_WINDOW) ? RT_WINDOW : RT_PIXMAP; if (!XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, access, pTmp)) return BadDrawable; } else @@ -227,10 +227,10 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, access); if (!pTmp) return BadDrawable; - if (!((1 << pTmp->type) | (type ? type : M_DRAWABLE))) + if (!((1 << pTmp->type) & (type ? type : M_DRAWABLE))) return BadMatch; - if (pTmp->type | M_DRAWABLE) { + if (type & M_DRAWABLE) { client->lastDrawable = pTmp; client->lastDrawableID = id; client->lastGCID = INVALID; -- cgit v1.2.3 From 88740c4855babedbea420b5e1b35ae105d1f1026 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 8 Jan 2007 17:36:07 -0800 Subject: Use PKG_CHECK_EXISTS(libdrm) to determine if DRI should be enabled on Solaris --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index c4aafaa11..3b97e0478 100644 --- a/configure.ac +++ b/configure.ac @@ -353,6 +353,9 @@ case $host_os in DRI=yes KDRIVE_HW=yes ;; + *solaris*) + PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no) + ;; esac AM_CONDITIONAL(KDRIVE_HW, test "x$KDRIVE_HW" = xyes) @@ -363,6 +366,8 @@ if test "x$use_x86_asm" = xyes && test "x$GCC" = xyes ; then #error Not supported #endif ], mmx_capable=yes, mmx_capable=no) +else + mmx_capable=no fi AC_MSG_RESULT([$mmx_capable]) AM_CONDITIONAL(MMX_CAPABLE, [test "x$mmx_capable" = xyes]) -- cgit v1.2.3 From 359d20532bdcef6a540a551578d000afbb609c2d Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 9 Jan 2007 09:53:45 +0100 Subject: Require glproto >= 1.4.8 for GLX. It builds against 1.4.7 as well, but it hardcodes the GLX_EXT_tfp tokens that were finalized in 1.4.8, so GLX_EXT_tfp breaks if the client side was built against an older glproto. This will hopefully alert people to rebuild other components (in particular Mesa) against the new glproto as well. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3b97e0478..3f5e5d8c1 100644 --- a/configure.ac +++ b/configure.ac @@ -679,7 +679,7 @@ fi if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then PKG_CHECK_MODULES([XLIB], [x11]) - PKG_CHECK_MODULES([GL], [glproto >= 1.4.7]) + PKG_CHECK_MODULES([GL], [glproto >= 1.4.8]) AC_SUBST(XLIB_CFLAGS) AC_DEFINE(GLXEXT, 1, [Build GLX extension]) GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la' -- cgit v1.2.3 From e3aa6ad201eb20862c11c000e76206e317a96dc9 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Tue, 9 Jan 2007 14:14:19 +0100 Subject: Multiple integer overflows in dbe and render extensions CVE IDs: CVE-2006-6101 CVE-2006-6102 CVE-2006-6103 --- dbe/dbe.c | 34 ++++++++++++++++++++++------------ render/render.c | 15 ++++++++++++--- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/dbe/dbe.c b/dbe/dbe.c index 38375f92a..862393b53 100644 --- a/dbe/dbe.c +++ b/dbe/dbe.c @@ -39,6 +39,11 @@ #endif #include +#if HAVE_STDINT_H +#include +#elif !defined(UINT32_MAX) +#define UINT32_MAX 0xffffffffU +#endif #include #include @@ -711,11 +716,14 @@ ProcDbeSwapBuffers(ClientPtr client) return(Success); } + if (nStuff > UINT32_MAX / sizeof(DbeSwapInfoRec)) + return BadAlloc; + /* Get to the swap info appended to the end of the request. */ dbeSwapInfo = (xDbeSwapInfo *)&stuff[1]; /* Allocate array to record swap information. */ - swapInfo = (DbeSwapInfoPtr)ALLOCATE_LOCAL(nStuff * sizeof(DbeSwapInfoRec)); + swapInfo = (DbeSwapInfoPtr)Xalloc(nStuff * sizeof(DbeSwapInfoRec)); if (swapInfo == NULL) { return(BadAlloc); @@ -730,14 +738,14 @@ ProcDbeSwapBuffers(ClientPtr client) error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client, DixWriteAccess); if (error != Success) { - DEALLOCATE_LOCAL(swapInfo); + Xfree(swapInfo); return error; } /* Each window must be double-buffered - BadMatch. */ if (DBE_WINDOW_PRIV(pWin) == NULL) { - DEALLOCATE_LOCAL(swapInfo); + Xfree(swapInfo); return(BadMatch); } @@ -746,7 +754,7 @@ ProcDbeSwapBuffers(ClientPtr client) { if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) { - DEALLOCATE_LOCAL(swapInfo); + Xfree(swapInfo); return(BadMatch); } } @@ -757,7 +765,7 @@ ProcDbeSwapBuffers(ClientPtr client) (dbeSwapInfo[i].swapAction != XdbeUntouched ) && (dbeSwapInfo[i].swapAction != XdbeCopied )) { - DEALLOCATE_LOCAL(swapInfo); + Xfree(swapInfo); return(BadValue); } @@ -787,12 +795,12 @@ ProcDbeSwapBuffers(ClientPtr client) error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo); if (error != Success) { - DEALLOCATE_LOCAL(swapInfo); + Xfree(swapInfo); return(error); } } - DEALLOCATE_LOCAL(swapInfo); + Xfree(swapInfo); return(Success); } /* ProcDbeSwapBuffers() */ @@ -874,10 +882,12 @@ ProcDbeGetVisualInfo(ClientPtr client) REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq); + if (stuff->n > UINT32_MAX / sizeof(DrawablePtr)) + return BadAlloc; /* Make sure any specified drawables are valid. */ if (stuff->n != 0) { - if (!(pDrawables = (DrawablePtr *)ALLOCATE_LOCAL(stuff->n * + if (!(pDrawables = (DrawablePtr *)Xalloc(stuff->n * sizeof(DrawablePtr)))) { return(BadAlloc); @@ -890,7 +900,7 @@ ProcDbeGetVisualInfo(ClientPtr client) rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0, DixReadAccess); if (rc != Success) { - DEALLOCATE_LOCAL(pDrawables); + Xfree(pDrawables); return rc; } } @@ -902,7 +912,7 @@ ProcDbeGetVisualInfo(ClientPtr client) { if (pDrawables) { - DEALLOCATE_LOCAL(pDrawables); + Xfree(pDrawables); } return(BadAlloc); @@ -929,7 +939,7 @@ ProcDbeGetVisualInfo(ClientPtr client) /* Free pDrawables if we needed to allocate it above. */ if (pDrawables) { - DEALLOCATE_LOCAL(pDrawables); + Xfree(pDrawables); } return(BadAlloc); @@ -1010,7 +1020,7 @@ ProcDbeGetVisualInfo(ClientPtr client) if (pDrawables) { - DEALLOCATE_LOCAL(pDrawables); + Xfree(pDrawables); } return(client->noClientException); diff --git a/render/render.c b/render/render.c index 126d08daf..348d4c611 100644 --- a/render/render.c +++ b/render/render.c @@ -47,6 +47,12 @@ #include #include "cursorstr.h" +#if HAVE_STDINT_H +#include +#elif !defined(UINT32_MAX) +#define UINT32_MAX 0xffffffffU +#endif + static int ProcRenderQueryVersion (ClientPtr pClient); static int ProcRenderQueryPictFormats (ClientPtr pClient); static int ProcRenderQueryPictIndexValues (ClientPtr pClient); @@ -1105,11 +1111,14 @@ ProcRenderAddGlyphs (ClientPtr client) } nglyphs = stuff->nglyphs; + if (nglyphs > UINT32_MAX / sizeof(GlyphNewRec)) + return BadAlloc; + if (nglyphs <= NLOCALGLYPH) glyphsBase = glyphsLocal; else { - glyphsBase = (GlyphNewPtr) ALLOCATE_LOCAL (nglyphs * sizeof (GlyphNewRec)); + glyphsBase = (GlyphNewPtr) Xalloc (nglyphs * sizeof (GlyphNewRec)); if (!glyphsBase) return BadAlloc; } @@ -1166,7 +1175,7 @@ ProcRenderAddGlyphs (ClientPtr client) } if (glyphsBase != glyphsLocal) - DEALLOCATE_LOCAL (glyphsBase); + Xfree (glyphsBase); return client->noClientException; bail: while (glyphs != glyphsBase) @@ -1175,7 +1184,7 @@ bail: xfree (glyphs->glyph); } if (glyphsBase != glyphsLocal) - DEALLOCATE_LOCAL (glyphsBase); + Xfree (glyphsBase); return err; } -- cgit v1.2.3