From 3cbdfb54d1fcfed7745111e861e19b7bbac243cc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 9 Feb 2013 19:15:20 +0000 Subject: sna: Backport to squeeze - Xorg-1.6, pixman-0.16, libdrm-2.4.21 The principle change is to switch to the old Privates API and undo the Region renames. The downside is that this ignores the critical bugfixes made to the xserver since xorg-1.6 - but I assume that whoever wants to run the latest hardware on the old xservers is also backporting those stability fixes... Signed-off-by: Chris Wilson --- src/sna/fb/fb.h | 15 ++++++++++++--- src/sna/fb/fbbitmap.c | 41 +++++++++++++++++++++++++++++++++++------ src/sna/fb/fbblt.c | 4 ++-- src/sna/fb/fbpict.c | 12 +++++------- src/sna/fb/fbpoint.c | 4 ++-- src/sna/fb/fbseg.c | 3 ++- 6 files changed, 58 insertions(+), 21 deletions(-) (limited to 'src/sna/fb') diff --git a/src/sna/fb/fb.h b/src/sna/fb/fb.h index e58e0396..d99453da 100644 --- a/src/sna/fb/fb.h +++ b/src/sna/fb/fb.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,8 @@ #include "sfb.h" +#include "../../compat-api.h" + #define WRITE(ptr, val) (*(ptr) = (val)) #define READ(ptr) (*(ptr)) @@ -294,12 +297,12 @@ extern DevPrivateKeyRec sna_window_key; static inline FbGCPrivate *fb_gc(GCPtr gc) { - return dixGetPrivateAddr(&gc->devPrivates, &sna_gc_key); + return (FbGCPrivate *)__get_private(gc, sna_gc_key); } static inline PixmapPtr fbGetWindowPixmap(WindowPtr window) { - return *(PixmapPtr *)dixGetPrivateAddr(&window->devPrivates, &sna_window_key); + return *(PixmapPtr *)__get_private(window, sna_window_key); } #ifdef ROOTLESS @@ -360,8 +363,14 @@ static inline PixmapPtr fbGetWindowPixmap(WindowPtr window) * XFree86 empties the root BorderClip when the VT is inactive, * here's a macro which uses that to disable GetImage and GetSpans */ + +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,10,0,0,0) #define fbWindowEnabled(pWin) \ - RegionNotEmpty(&(pWin)->drawable.pScreen->root->borderClip) + RegionNotEmpty(&(pWin)->drawable.pScreen->root->borderClip) +#else +#define fbWindowEnabled(pWin) \ + RegionNotEmpty(&WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip) +#endif #define fbDrawableEnabled(drawable) \ ((drawable)->type == DRAWABLE_PIXMAP ? \ TRUE : fbWindowEnabled((WindowPtr) drawable)) diff --git a/src/sna/fb/fbbitmap.c b/src/sna/fb/fbbitmap.c index 7c037fe3..2ea92a99 100644 --- a/src/sna/fb/fbbitmap.c +++ b/src/sna/fb/fbbitmap.c @@ -25,21 +25,50 @@ #include "fb.h" +static Bool region_grow(RegionPtr region) +{ + RegDataPtr data; + int n; + + n = 16; + if (!region->data) { + region->data = malloc(RegionSizeof(n)); + if (!region->data) + return RegionBreak(region); + region->data->numRects = 1; + *RegionBoxptr(region) = region->extents; + } else if (!region->data->size) { + region->data = malloc(RegionSizeof(n)); + if (!region->data) + return RegionBreak(region); + region->data->numRects = 0; + } else { + n = 2 * region->data->numRects; + data = (RegDataPtr) realloc(region->data, RegionSizeof(n)); + if (!data) + return RegionBreak(region); + region->data = data; + } + region->data->size = n; + return TRUE; +} + static inline void add(RegionPtr region, int16_t x1, int16_t y1, int16_t x2, int16_t y2) { BoxPtr r; - if (region->data->numRects == region->data->size) - RegionRectAlloc(region, 1); + if (region->data->numRects == region->data->size && + !region_grow(region)) + return; r = RegionBoxptr(region) + region->data->numRects++; r->x1 = x1; r->y1 = y1; r->x2 = x2; r->y2 = y2; - DBG(("%s[%d/%d]: (%d, %d), (%d, %d)\n", + DBG(("%s[%ld/%ld]: (%d, %d), (%d, %d)\n", __FUNCTION__, - region->data->numRects, region->data->size, + (long)region->data->numRects, (long)region->data->size, x1, y1, x2, y2)); if (x1 < region->extents.x1) @@ -149,11 +178,11 @@ fbBitmapToRegion(PixmapPtr pixmap) } else region->extents.x1 = region->extents.x2 = 0; - DBG(("%s: region extents=(%d, %d), (%d, %d) x %d\n", + DBG(("%s: region extents=(%d, %d), (%d, %d) x %ld\n", __FUNCTION__, region->extents.x1, region->extents.y1, region->extents.x2, region->extents.y2, - RegionNumRects(region))); + (long)RegionNumRects(region))); return region; } diff --git a/src/sna/fb/fbblt.c b/src/sna/fb/fbblt.c index 287ea40f..5ad2e2e2 100644 --- a/src/sna/fb/fbblt.c +++ b/src/sna/fb/fbblt.c @@ -285,9 +285,9 @@ fbBlt(FbBits *srcLine, FbStride srcStride, int srcX, s += srcX >> 3; d += dstX >> 3; - DBG(("%s fast blt, src_stride=%d, dst_stride=%d, width=%d (offset=%d)\n", + DBG(("%s fast blt, src_stride=%d, dst_stride=%d, width=%d (offset=%ld)\n", __FUNCTION__, - srcStride, dstStride, width, s - d)); + srcStride, dstStride, width, (long)(s - d))); if (width == srcStride && width == dstStride) { width *= height; diff --git a/src/sna/fb/fbpict.c b/src/sna/fb/fbpict.c index a2038518..349ec538 100644 --- a/src/sna/fb/fbpict.c +++ b/src/sna/fb/fbpict.c @@ -27,24 +27,22 @@ #include "fb.h" +#include #include #include -#include "fbpict.h" +#include static void SourceValidateOnePicture(PicturePtr picture) { DrawablePtr drawable = picture->pDrawable; - ScreenPtr screen; if (!drawable) return; - screen = drawable->pScreen; - if (screen->SourceValidate) - screen->SourceValidate(drawable, - 0, 0, drawable->width, drawable->height, - picture->subWindowMode); + SourceValidate(drawable, + 0, 0, drawable->width, drawable->height, + picture->subWindowMode); } static void diff --git a/src/sna/fb/fbpoint.c b/src/sna/fb/fbpoint.c index 3df79a26..c5f0f876 100644 --- a/src/sna/fb/fbpoint.c +++ b/src/sna/fb/fbpoint.c @@ -93,10 +93,10 @@ fbPolyPoint(DrawablePtr drawable, GCPtr gc, int xoff, int yoff, FbBits and, FbBits xor); - DBG(("%s x %d, clip=[(%d, %d), (%d, %d)]x%d\n", __FUNCTION__, n, + DBG(("%s x %d, clip=[(%d, %d), (%d, %d)]x%ld\n", __FUNCTION__, n, gc->pCompositeClip->extents.x1, gc->pCompositeClip->extents.y1, gc->pCompositeClip->extents.x2, gc->pCompositeClip->extents.y2, - RegionNumRects(gc->pCompositeClip))); + (long)RegionNumRects(gc->pCompositeClip))); if (mode == CoordModePrevious) fbFixCoordModePrevious(n, pt); diff --git a/src/sna/fb/fbseg.c b/src/sna/fb/fbseg.c index 5b8173f0..67ad3895 100644 --- a/src/sna/fb/fbseg.c +++ b/src/sna/fb/fbseg.c @@ -353,7 +353,8 @@ fbSelectBres(DrawablePtr drawable, GCPtr gc) FbBres *bres; DBG(("%s: line=%d, fill=%d, and=%lx, bgand=%lx\n", - __FUNCTION__, gc->lineStyle, gc->fillStyle, pgc->and, pgc->bgand)); + __FUNCTION__, gc->lineStyle, gc->fillStyle, + (long)pgc->and, (long)pgc->bgand)); assert(gc->lineWidth == 0); if (gc->lineStyle == LineSolid) { -- cgit v1.2.3