diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-09 19:15:20 +0000 |
---|---|---|
committer | root <root@ivybridge.(none)> | 2013-02-10 10:24:12 +0000 |
commit | 3cbdfb54d1fcfed7745111e861e19b7bbac243cc (patch) | |
tree | c355f97cca41d34d66f1097b586198cc492a43c2 /src | |
parent | 42a6b25817985e22e7d462be87fbd97973d96a29 (diff) |
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 <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/compat-api.h | 52 | ||||
-rw-r--r-- | src/sna/fb/fb.h | 15 | ||||
-rw-r--r-- | src/sna/fb/fbbitmap.c | 41 | ||||
-rw-r--r-- | src/sna/fb/fbblt.c | 4 | ||||
-rw-r--r-- | src/sna/fb/fbpict.c | 12 | ||||
-rw-r--r-- | src/sna/fb/fbpoint.c | 4 | ||||
-rw-r--r-- | src/sna/fb/fbseg.c | 3 | ||||
-rw-r--r-- | src/sna/kgem.c | 9 | ||||
-rw-r--r-- | src/sna/sna.h | 15 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 114 | ||||
-rw-r--r-- | src/sna/sna_composite.c | 36 | ||||
-rw-r--r-- | src/sna/sna_damage.h | 1 | ||||
-rw-r--r-- | src/sna/sna_display.c | 8 | ||||
-rw-r--r-- | src/sna/sna_dri.c | 8 | ||||
-rw-r--r-- | src/sna/sna_driver.c | 18 | ||||
-rw-r--r-- | src/sna/sna_glyphs.c | 3 | ||||
-rw-r--r-- | src/sna/sna_trapezoids.c | 2 |
17 files changed, 242 insertions, 103 deletions
diff --git a/src/compat-api.h b/src/compat-api.h index 6b765724..2a912e5d 100644 --- a/src/compat-api.h +++ b/src/compat-api.h @@ -28,6 +28,8 @@ #ifndef COMPAT_API_H #define COMPAT_API_H +#include <xorgVersion.h> + #ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR #define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum] #define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p @@ -103,4 +105,54 @@ #endif +#ifndef INCLUDE_LEGACY_REGION_DEFINES +#define RegionCreate(r, s) REGION_CREATE(NULL, r, s) +#define RegionBreak(r) REGION_BREAK(NULL, r) +#define RegionSizeof REGION_SZOF +#define RegionBoxptr REGION_BOXPTR +#define RegionEnd REGION_END +#define RegionExtents(r) REGION_EXTENTS(NULL, r) +#define RegionRects REGION_RECTS +#define RegionNumRects REGION_NUM_RECTS +#define RegionContainsRect(r, b) RECT_IN_REGION(NULL, r, b) +#define RegionContainsPoint(r, x, y, b) POINT_IN_REGION(NULL, r, x, y, b) +#define RegionCopy(res, r) REGION_COPY(NULL, res, r) +#define RegionIntersect(res, r1, r2) REGION_INTERSECT(NULL, res, r1, r2) +#define RegionUnion(res, r1, r2) REGION_UNION(NULL, res, r1, r2) +#define RegionTranslate(r, x, y) REGION_TRANSLATE(NULL, r, x, y) +#define RegionUninit(r) REGION_UNINIT(NULL, r) +#define region_from_bitmap BITMAP_TO_REGION +#define RegionNil REGION_NIL +#define RegionNull(r) REGION_NULL(NULL, r) +#define RegionNotEmpty(r) REGION_NOTEMPTY(NULL, r) +#define RegionEmpty(r) REGION_EMPTY(NULL, r) +#define RegionDestroy(r) REGION_DESTROY(NULL, r) +#else +#define region_from_bitmap BitmapToRegion +#endif + +#ifndef _X_UNUSED +#define _X_UNUSED +#endif + +#if HAS_DEVPRIVATEKEYREC +#define __get_private(p, key) dixGetPrivateAddr(&(p)->devPrivates, &(key)) +#else +#define __get_private(p, key) dixLookupPrivate(&(p)->devPrivates, &(key)) +typedef int DevPrivateKeyRec; +static inline void FreePixmap(PixmapPtr pixmap) +{ + dixFreePrivates(pixmap->devPrivates); + free(pixmap); +} +#endif + +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,9,99,902,0) +#define SourceValidate(d, x, y, w, h, mode) \ + if ((d)->pScreen->SourceValidate) (d)->pScreen->SourceValidate(d, x, y, w, h, mode) +#else +#define SourceValidate(d, x, y, w, h, mode) \ + if ((d)->pScreen->SourceValidate) (d)->pScreen->SourceValidate(d, x, y, w, h) +#endif + #endif 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 <gcstruct.h> #include <colormap.h> #include <windowstr.h> +#include <regionstr.h> #include <stdbool.h> #include <pixman.h> @@ -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 <xorgVersion.h> #include <picturestr.h> #include <mipict.h> -#include "fbpict.h" +#include <fbpict.h> 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) { diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 2801efc0..86a2dfcd 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -111,6 +111,9 @@ search_snoop_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags); #define MAKE_REQUEST(rq, ring) ((struct kgem_request *)((uintptr_t)(rq) | (ring))) +#define LOCAL_I915_PARAM_HAS_BLT 11 +#define LOCAL_I915_PARAM_HAS_RELAXED_FENCING 12 +#define LOCAL_I915_PARAM_HAS_RELAXED_DELTA 15 #define LOCAL_I915_PARAM_HAS_SEMAPHORES 20 #define LOCAL_I915_PARAM_HAS_SECURE_BATCHES 23 #define LOCAL_I915_PARAM_HAS_PINNED_BATCHES 24 @@ -782,7 +785,7 @@ static bool test_has_relaxed_fencing(struct kgem *kgem) if (DBG_NO_RELAXED_FENCING) return false; - return gem_param(kgem, I915_PARAM_HAS_RELAXED_FENCING) > 0; + return gem_param(kgem, LOCAL_I915_PARAM_HAS_RELAXED_FENCING) > 0; } else return true; } @@ -982,12 +985,12 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, unsigned gen) kgem->vma[MAP_GTT].count = -MAX_GTT_VMA_CACHE; kgem->vma[MAP_CPU].count = -MAX_CPU_VMA_CACHE; - kgem->has_blt = gem_param(kgem, I915_PARAM_HAS_BLT) > 0; + kgem->has_blt = gem_param(kgem, LOCAL_I915_PARAM_HAS_BLT) > 0; DBG(("%s: has BLT ring? %d\n", __FUNCTION__, kgem->has_blt)); kgem->has_relaxed_delta = - gem_param(kgem, I915_PARAM_HAS_RELAXED_DELTA) > 0; + gem_param(kgem, LOCAL_I915_PARAM_HAS_RELAXED_DELTA) > 0; DBG(("%s: has relaxed delta? %d\n", __FUNCTION__, kgem->has_relaxed_delta)); diff --git a/src/sna/sna.h b/src/sna/sna.h index 5a57a6e2..b470c48a 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -141,6 +141,15 @@ struct sna_glyph { uint16_t size, pos; }; +static inline WindowPtr root(ScreenPtr screen) +{ +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,10,0,0,0) + return screen->root; +#else + return WindowTable[screen->myNum]; +#endif +} + static inline PixmapPtr get_window_pixmap(WindowPtr window) { return fbGetWindowPixmap(window); @@ -158,7 +167,7 @@ extern DevPrivateKeyRec sna_pixmap_key; constant static inline struct sna_pixmap *sna_pixmap(PixmapPtr pixmap) { - return ((void **)dixGetPrivateAddr(&pixmap->devPrivates, &sna_pixmap_key))[1]; + return ((void **)__get_private(pixmap, sna_pixmap_key))[1]; } static inline struct sna_pixmap *sna_pixmap_from_drawable(DrawablePtr drawable) @@ -176,7 +185,7 @@ struct sna_gc { static inline struct sna_gc *sna_gc(GCPtr gc) { - return dixGetPrivateAddr(&gc->devPrivates, &sna_gc_key); + return (struct sna_gc *)__get_private(gc, sna_gc_key); } enum { @@ -314,7 +323,7 @@ to_sna_from_screen(ScreenPtr screen) constant static inline struct sna * to_sna_from_pixmap(PixmapPtr pixmap) { - return ((void **)dixGetPrivateAddr(&pixmap->devPrivates, &sna_pixmap_key))[0]; + return ((void **)__get_private(pixmap, sna_pixmap_key))[0]; } constant static inline struct sna * diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 8ddee463..827dcf4a 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -627,7 +627,7 @@ struct kgem_bo *sna_pixmap_change_tiling(PixmapPtr pixmap, uint32_t tiling) static inline void sna_set_pixmap(PixmapPtr pixmap, struct sna_pixmap *sna) { - ((void **)dixGetPrivateAddr(&pixmap->devPrivates, &sna_pixmap_key))[1] = sna; + ((void **)__get_private(pixmap, sna_pixmap_key))[1] = sna; assert(sna_pixmap(pixmap) == sna); } @@ -727,11 +727,13 @@ create_pixmap(struct sna *sna, ScreenPtr screen, datasize += adjust; } + DBG(("%s: allocating pixmap %dx%d, depth=%d, size=%ld\n", + __FUNCTION__, width, height, depth, (long)datasize)); pixmap = AllocatePixmap(screen, datasize); if (!pixmap) return NullPixmap; - ((void **)dixGetPrivateAddr(&pixmap->devPrivates, &sna_pixmap_key))[0] = sna; + ((void **)__get_private(pixmap, sna_pixmap_key))[0] = sna; assert(to_sna_from_pixmap(pixmap) == sna); pixmap->drawable.type = DRAWABLE_PIXMAP; @@ -2015,8 +2017,8 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, assert(priv->gpu_bo->proxy == NULL); if (priv->clear) { - int n = REGION_NUM_RECTS(region); - BoxPtr box = REGION_RECTS(region); + int n = RegionNumRects(region); + BoxPtr box = RegionRects(region); DBG(("%s: pending clear, doing partial fill\n", __FUNCTION__)); if (priv->cpu_bo) { @@ -2132,9 +2134,9 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, * reads. */ if (flags & MOVE_WRITE) { - int n = REGION_NUM_RECTS(region), i; - BoxPtr boxes = REGION_RECTS(region); - BoxPtr blocks = malloc(sizeof(BoxRec) * REGION_NUM_RECTS(region)); + int n = RegionNumRects(region), i; + BoxPtr boxes = RegionRects(region); + BoxPtr blocks = malloc(sizeof(BoxRec) * RegionNumRects(region)); if (blocks) { for (i = 0; i < n; i++) { blocks[i].x1 = boxes[i].x1 & ~31; @@ -2190,8 +2192,8 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, } else if (DAMAGE_IS_ALL(priv->gpu_damage) || sna_damage_contains_box__no_reduce(priv->gpu_damage, &r->extents)) { - BoxPtr box = REGION_RECTS(r); - int n = REGION_NUM_RECTS(r); + BoxPtr box = RegionRects(r); + int n = RegionNumRects(r); bool ok = false; DBG(("%s: region wholly inside damage\n", @@ -2216,8 +2218,8 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, pixman_region_init(&need); if (sna_damage_intersect(priv->gpu_damage, r, &need)) { - BoxPtr box = REGION_RECTS(&need); - int n = REGION_NUM_RECTS(&need); + BoxPtr box = RegionRects(&need); + int n = RegionNumRects(&need); bool ok = false; DBG(("%s: region intersects damage\n", @@ -2535,10 +2537,10 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl sna_damage_subtract(&priv->cpu_damage, &r); } else if (sna_damage_intersect(priv->cpu_damage, &r, &i)) { - int n = REGION_NUM_RECTS(&i); + int n = RegionNumRects(&i); bool ok; - box = REGION_RECTS(&i); + box = RegionRects(&i); ok = false; if (use_cpu_bo_for_upload(sna, priv, 0)) { DBG(("%s: using CPU bo for upload to GPU, %d boxes\n", __FUNCTION__, n)); @@ -3249,7 +3251,7 @@ static bool must_check sna_gc_move_to_cpu(GCPtr gc, if (gc->clientClipType == CT_PIXMAP) { PixmapPtr clip = gc->clientClip; - gc->clientClip = BitmapToRegion(gc->pScreen, clip); + gc->clientClip = region_from_bitmap(gc->pScreen, clip); gc->pScreen->DestroyPixmap(clip); gc->clientClipType = gc->clientClip ? CT_REGION : CT_NONE; changes |= GCClipMask; @@ -3443,8 +3445,8 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, DBG(("%s: upload(%d, %d, %d, %d)\n", __FUNCTION__, x, y, w, h)); /* Region is pre-clipped and translated into pixmap space */ - box = REGION_RECTS(region); - n = REGION_NUM_RECTS(region); + box = RegionRects(region); + n = RegionNumRects(region); do { DBG(("%s: copy box (%d, %d)->(%d, %d)x(%d, %d)\n", __FUNCTION__, @@ -3536,8 +3538,8 @@ sna_put_xybitmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, kgem_set_mode(&sna->kgem, KGEM_BLT, bo); /* Region is pre-clipped and translated into pixmap space */ - box = REGION_RECTS(region); - n = REGION_NUM_RECTS(region); + box = RegionRects(region); + n = RegionNumRects(region); do { int bx1 = (box->x1 - x) & ~7; int bx2 = (box->x2 - x + 7) & ~7; @@ -3661,8 +3663,8 @@ sna_put_xypixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, skip = h * BitmapBytePad(w + left); for (i = 1 << (gc->depth-1); i; i >>= 1, bits += skip) { - const BoxRec *box = REGION_RECTS(region); - int n = REGION_NUM_RECTS(region); + const BoxRec *box = RegionRects(region); + int n = RegionNumRects(region); if ((gc->planemask & i) == 0) continue; @@ -4690,10 +4692,7 @@ sna_do_copy(DrawablePtr src, DrawablePtr dst, GCPtr gc, return NULL; } - if (src->pScreen->SourceValidate) - src->pScreen->SourceValidate(src, sx, sy, - width, height, - gc->subWindowMode); + SourceValidate(src, sx, sy, width, height, gc->subWindowMode); sx += src->x; sy += src->y; @@ -4772,17 +4771,17 @@ sna_do_copy(DrawablePtr src, DrawablePtr dst, GCPtr gc, if (free_clip) RegionDestroy(free_clip); } - DBG(("%s: src extents (%d, %d), (%d, %d) x %d\n", __FUNCTION__, + DBG(("%s: src extents (%d, %d), (%d, %d) x %ld\n", __FUNCTION__, region.extents.x1, region.extents.y1, region.extents.x2, region.extents.y2, - RegionNumRects(®ion))); + (long)RegionNumRects(®ion))); RegionTranslate(®ion, dx-sx, dy-sy); if (gc->pCompositeClip->data) RegionIntersect(®ion, ®ion, gc->pCompositeClip); - DBG(("%s: copy region (%d, %d), (%d, %d) x %d\n", __FUNCTION__, + DBG(("%s: copy region (%d, %d), (%d, %d) x %ld\n", __FUNCTION__, region.extents.x1, region.extents.y1, region.extents.x2, region.extents.y2, - RegionNumRects(®ion))); + (long)RegionNumRects(®ion))); if (RegionNotEmpty(®ion)) copy(src, dst, gc, ®ion, sx-dx, sy-dy, bitPlane, closure); @@ -4804,8 +4803,8 @@ sna_fallback_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc, RegionPtr region, int dx, int dy, Pixel bitplane, void *closure) { - DBG(("%s (boxes=%dx[(%d, %d), (%d, %d)...], src=+(%d, %d), alu=%d\n", - __FUNCTION__, RegionNumRects(region), + DBG(("%s (boxes=%ldx[(%d, %d), (%d, %d)...], src=+(%d, %d), alu=%d\n", + __FUNCTION__, (long)RegionNumRects(region), region->extents.x1, region->extents.y1, region->extents.x2, region->extents.y2, dx, dy, gc->alu)); @@ -5408,9 +5407,9 @@ no_damage_clipped: assert(dx + clip.extents.x2 <= pixmap->drawable.width); assert(dy + clip.extents.y2 <= pixmap->drawable.height); - DBG(("%s: clip %d x [(%d, %d), (%d, %d)] x %d [(%d, %d)...]\n", + DBG(("%s: clip %ld x [(%d, %d), (%d, %d)] x %d [(%d, %d)...]\n", __FUNCTION__, - REGION_NUM_RECTS(&clip), + (long)RegionNumRects(&clip), clip.extents.x1, clip.extents.y1, clip.extents.x2, clip.extents.y2, n, pt->x, pt->y)); @@ -5509,9 +5508,9 @@ damage_clipped: assert(dx + clip.extents.x2 <= pixmap->drawable.width); assert(dy + clip.extents.y2 <= pixmap->drawable.height); - DBG(("%s: clip %d x [(%d, %d), (%d, %d)] x %d [(%d, %d)...]\n", + DBG(("%s: clip %ld x [(%d, %d), (%d, %d)] x %d [(%d, %d)...]\n", __FUNCTION__, - REGION_NUM_RECTS(&clip), + RegionNumRects(&clip), clip.extents.x1, clip.extents.y1, clip.extents.x2, clip.extents.y2, n, pt->x, pt->y)); @@ -5899,10 +5898,11 @@ sna_copy_bitmap_blt(DrawablePtr _bitmap, DrawablePtr drawable, GCPtr gc, BoxPtr box; int n; - DBG(("%s: plane=%x (%d,%d),(%d,%d)x%d\n", - __FUNCTION__, (unsigned)bitplane, RegionNumRects(region), + DBG(("%s: plane=%x (%d,%d),(%d,%d)x%ld\n", + __FUNCTION__, (unsigned)bitplane, region->extents.x1, region->extents.y1, - region->extents.x2, region->extents.y2)); + region->extents.x2, region->extents.y2, + (long)RegionNumRects(region))); box = RegionRects(region); n = RegionNumRects(region); @@ -6634,8 +6634,8 @@ sna_poly_zero_line_blt(DrawablePtr drawable, clip.extents.x2, clip.extents.y2, dx, dy, damage)); - extents = REGION_RECTS(&clip); - last_extents = extents + REGION_NUM_RECTS(&clip); + extents = RegionRects(&clip); + last_extents = extents + RegionNumRects(&clip); b = box; do { @@ -7847,8 +7847,8 @@ sna_poly_zero_segment_blt(DrawablePtr drawable, jump = _jump[(damage != NULL) | !!(dx|dy) << 1]; b = box; - extents = REGION_RECTS(&clip); - last_extents = extents + REGION_NUM_RECTS(&clip); + extents = RegionRects(&clip); + last_extents = extents + RegionNumRects(&clip); do { int n = _n; const xSegment *s = _s; @@ -10217,8 +10217,8 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable, region.data = NULL; RegionIntersect(®ion, ®ion, &clip); - nbox = REGION_NUM_RECTS(®ion); - box = REGION_RECTS(®ion); + nbox = RegionNumRects(®ion); + box = RegionRects(®ion); while (nbox--) { int height = box->y2 - box->y1; int dst_y = box->y1; @@ -12098,13 +12098,13 @@ sna_glyph_blt(DrawablePtr drawable, GCPtr gc, _y += drawable->y + dy; RegionTranslate(clip, dx, dy); - extents = REGION_RECTS(clip); - last_extents = extents + REGION_NUM_RECTS(clip); + extents = RegionRects(clip); + last_extents = extents + RegionNumRects(clip); if (!transparent) /* emulate miImageGlyphBlt */ sna_blt_fill_boxes(sna, GXcopy, bo, drawable->bitsPerPixel, - bg, extents, REGION_NUM_RECTS(clip)); + bg, extents, RegionNumRects(clip)); kgem_set_mode(&sna->kgem, KGEM_BLT, bo); if (!kgem_check_batch(&sna->kgem, 16) || @@ -12745,13 +12745,13 @@ sna_reversed_glyph_blt(DrawablePtr drawable, GCPtr gc, _y += drawable->y + dy; RegionTranslate(clip, dx, dy); - extents = REGION_RECTS(clip); - last_extents = extents + REGION_NUM_RECTS(clip); + extents = RegionRects(clip); + last_extents = extents + RegionNumRects(clip); if (!transparent) /* emulate miImageGlyphBlt */ sna_blt_fill_boxes(sna, GXcopy, bo, drawable->bitsPerPixel, - bg, extents, REGION_NUM_RECTS(clip)); + bg, extents, RegionNumRects(clip)); kgem_set_mode(&sna->kgem, KGEM_BLT, bo); if (!kgem_check_batch(&sna->kgem, 16) || @@ -13138,8 +13138,8 @@ sna_push_pixels_solid_blt(GCPtr gc, kgem_set_mode(&sna->kgem, KGEM_BLT, bo); /* Region is pre-clipped and translated into pixmap space */ - box = REGION_RECTS(region); - n = REGION_NUM_RECTS(region); + box = RegionRects(region); + n = RegionNumRects(region); do { int bx1 = (box->x1 - region->extents.x1) & ~7; int bx2 = (box->x2 - region->extents.x1 + 7) & ~7; @@ -13385,6 +13385,10 @@ static int sna_create_gc(GCPtr gc) gc->miTranslate = 1; gc->fExpose = 1; + gc->freeCompClip = 0; + gc->pCompositeClip = 0; + gc->pRotatedPixmap = 0; + fb_gc(gc)->bpp = bits_per_pixel(gc->depth); gc->funcs = (GCFuncs *)&sna_gc_funcs; @@ -13863,8 +13867,8 @@ static void sna_accel_post_damage(struct sna *sna) region.extents.x2, region.extents.y2, RegionNumRects(®ion.extents))); - box = REGION_RECTS(®ion); - n = REGION_NUM_RECTS(®ion); + box = RegionRects(®ion); + n = RegionNumRects(®ion); if (wedged(sna)) { fallback: if (!sna_pixmap_move_to_cpu(src, MOVE_READ)) @@ -14019,7 +14023,7 @@ sna_get_window_pixmap(WindowPtr window) static void sna_set_window_pixmap(WindowPtr window, PixmapPtr pixmap) { - *(PixmapPtr *)dixGetPrivateAddr(&window->devPrivates, &sna_window_key) = pixmap; + *(PixmapPtr *)__get_private(window, sna_window_key) = pixmap; } static Bool @@ -14107,11 +14111,13 @@ static bool sna_picture_init(ScreenPtr screen) ps->UnrealizeGlyph = sna_glyph_unrealize; ps->AddTraps = sna_add_traps; ps->Trapezoids = sna_composite_trapezoids; +#if HAS_PIXMAN_TRIANGLES ps->Triangles = sna_composite_triangles; #if PICTURE_SCREEN_VERSION >= 2 ps->TriStrip = sna_composite_tristrip; ps->TriFan = sna_composite_trifan; #endif +#endif return true; } diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c index c329fb8b..a4b85fe5 100644 --- a/src/sna/sna_composite.c +++ b/src/sna/sna_composite.c @@ -399,8 +399,8 @@ static void _assert_pixmap_contains_box(PixmapPtr pixmap, BoxPtr box, const char static void apply_damage(struct sna_composite_op *op, RegionPtr region) { - DBG(("%s: damage=%p, region=%d [(%d, %d), (%d, %d) + (%d, %d)]\n", - __FUNCTION__, op->damage, REGION_NUM_RECTS(region), + DBG(("%s: damage=%p, region=%ld [(%d, %d), (%d, %d) + (%d, %d)]\n", + __FUNCTION__, op->damage, RegionNumRects(region), region->extents.x1, region->extents.y1, region->extents.x2, region->extents.y2, op->dst.x, op->dst.y)); @@ -438,6 +438,18 @@ static inline bool use_cpu(PixmapPtr pixmap, struct sna_pixmap *priv, return (priv->create & KGEM_CAN_CREATE_GPU) == 0; } +static void validate_source(PicturePtr picture) +{ +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,10,99,901,0) + miCompositeSourceValidate(picture); +#else + miCompositeSourceValidate(picture, + 0, 0, + picture->pDrawable ? picture->pDrawable->width : 0, + picture->pDrawable ? picture->pDrawable->height : 0); +#endif +} + void sna_composite_fb(CARD8 op, PicturePtr src, @@ -492,9 +504,9 @@ sna_composite_fb(CARD8 op, DBG(("%s: fallback -- fbComposite\n", __FUNCTION__)); - miCompositeSourceValidate(src); + validate_source(src); if (mask) - miCompositeSourceValidate(mask); + validate_source(mask); src_image = image_from_pict(src, FALSE, &src_xoff, &src_yoff); mask_image = image_from_pict(mask, FALSE, &msk_xoff, &msk_yoff); @@ -635,8 +647,8 @@ sna_composite(CARD8 op, tmp.box(sna, &tmp, ®ion.extents); else tmp.boxes(sna, &tmp, - REGION_BOXPTR(®ion), - REGION_NUM_RECTS(®ion)); + RegionBoxptr(®ion), + RegionNumRects(®ion)); apply_damage(&tmp, ®ion); tmp.done(sna, &tmp); @@ -844,11 +856,11 @@ sna_composite_rectangles(CARD8 op, return; } - DBG(("%s: drawable extents (%d, %d),(%d, %d) x %d\n", + DBG(("%s: drawable extents (%d, %d),(%d, %d) x %ld\n", __FUNCTION__, RegionExtents(®ion)->x1, RegionExtents(®ion)->y1, RegionExtents(®ion)->x2, RegionExtents(®ion)->y2, - RegionNumRects(®ion))); + (long)RegionNumRects(®ion))); if (dst->pCompositeClip->data && (!pixman_region_intersect(®ion, ®ion, dst->pCompositeClip) || @@ -859,11 +871,11 @@ sna_composite_rectangles(CARD8 op, return; } - DBG(("%s: clipped extents (%d, %d),(%d, %d) x %d\n", + DBG(("%s: clipped extents (%d, %d),(%d, %d) x %ld\n", __FUNCTION__, RegionExtents(®ion)->x1, RegionExtents(®ion)->y1, RegionExtents(®ion)->x2, RegionExtents(®ion)->y2, - RegionNumRects(®ion))); + (long)RegionNumRects(®ion))); pixmap = get_drawable_pixmap(dst->pDrawable); get_drawable_deltas(dst->pDrawable, pixmap, &dst_x, &dst_y); @@ -999,8 +1011,8 @@ fallback: assert(pixmap->devPrivate.ptr); if (op <= PictOpSrc) { - int nbox = REGION_NUM_RECTS(®ion); - BoxPtr box = REGION_RECTS(®ion); + int nbox = RegionNumRects(®ion); + BoxPtr box = RegionRects(®ion); uint32_t pixel; if (op == PictOpClear) diff --git a/src/sna/sna_damage.h b/src/sna/sna_damage.h index 76718eb7..03a54a3d 100644 --- a/src/sna/sna_damage.h +++ b/src/sna/sna_damage.h @@ -2,7 +2,6 @@ #define SNA_DAMAGE_H #include <regionstr.h> -#include <list.h> #include "compiler.h" diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index b24bad54..558d7062 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -965,7 +965,9 @@ void sna_copy_fbcon(struct sna *sna) kgem_bo_destroy(&sna->kgem, bo); +#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(10, 0) sna->scrn->pScreen->canDoBGNoneRoot = ok; +#endif cleanup_scratch: FreeScratchPixmapHeader(scratch); @@ -2479,13 +2481,13 @@ sna_crtc_resize(ScrnInfoPtr scrn, int width, int height) sna_crtc_disable(crtc); } - if (screen->root) { + if (root(screen)) { struct sna_visit_set_pixmap_window visit; visit.old = old_front; visit.new = sna->front; - TraverseTree(screen->root, sna_visit_set_window_pixmap, &visit); - assert(screen->GetWindowPixmap(screen->root) == sna->front); + TraverseTree(root(screen), sna_visit_set_window_pixmap, &visit); + assert(screen->GetWindowPixmap(root(screen)) == sna->front); } screen->SetScreenPixmap(sna->front); assert(screen->GetScreenPixmap(screen) == sna->front); diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index f951d13d..f04f1afe 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -202,13 +202,13 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna, constant static inline void *sna_pixmap_get_buffer(PixmapPtr pixmap) { assert(pixmap->refcnt); - return ((void **)dixGetPrivateAddr(&pixmap->devPrivates, &sna_pixmap_key))[2]; + return ((void **)__get_private(pixmap, sna_pixmap_key))[2]; } static inline void sna_pixmap_set_buffer(PixmapPtr pixmap, void *ptr) { assert(pixmap->refcnt); - ((void **)dixGetPrivateAddr(&pixmap->devPrivates, &sna_pixmap_key))[2] = ptr; + ((void **)__get_private(pixmap, sna_pixmap_key))[2] = ptr; } void @@ -963,7 +963,7 @@ sna_dri_get_pipe(DrawablePtr pDraw) static struct sna_dri_frame_event * sna_dri_window_get_chain(WindowPtr win) { - return ((void **)dixGetPrivateAddr(&win->devPrivates, &sna_window_key))[1]; + return ((void **)__get_private(win, sna_window_key))[1]; } static void @@ -972,7 +972,7 @@ sna_dri_window_set_chain(WindowPtr win, { DBG(("%s: head now %p\n", __FUNCTION__, chain)); assert(win->drawable.type == DRAWABLE_WINDOW); - ((void **)dixGetPrivateAddr(&win->devPrivates, &sna_window_key))[1] = chain; + ((void **)__get_private(win, sna_window_key))[1] = chain; } static void diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 8420aebe..ffeaead5 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -186,7 +186,7 @@ sna_set_fallback_mode(ScrnInfoPtr scrn) xf86DisableUnusedFunctions(scrn); #ifdef RANDR_12_INTERFACE - if (scrn->pScreen->root) + if (root(scrn->pScreen)) xf86RandR12TellChanged(scrn->pScreen); #endif } @@ -855,6 +855,7 @@ static void sna_mode_set(ScrnInfoPtr scrn) static Bool sna_register_all_privates(void) { +#if HAS_DIXREGISTERPRIVATEKEY if (!dixRegisterPrivateKey(&sna_pixmap_key, PRIVATE_PIXMAP, 3*sizeof(void *))) return FALSE; @@ -870,6 +871,19 @@ sna_register_all_privates(void) if (!dixRegisterPrivateKey(&sna_window_key, PRIVATE_WINDOW, 2*sizeof(void *))) return FALSE; +#else + if (!dixRequestPrivate(&sna_pixmap_key, 3*sizeof(void *))) + return FALSE; + + if (!dixRequestPrivate(&sna_gc_key, sizeof(FbGCPrivate))) + return FALSE; + + if (!dixRequestPrivate(&sna_glyph_key, sizeof(struct sna_glyph))) + return FALSE; + + if (!dixRequestPrivate(&sna_window_key, 2*sizeof(void *))) + return FALSE; +#endif return TRUE; } @@ -1168,7 +1182,9 @@ Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num) scrn->ValidMode = sna_valid_mode; scrn->PMEvent = sna_pm_event; +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,9,99,901,0) scrn->ModeSet = sna_mode_set; +#endif xf86SetEntitySharable(entity_num); xf86SetEntityInstanceForScreen(scrn, entity_num, diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c index ad050df6..5fed8b41 100644 --- a/src/sna/sna_glyphs.c +++ b/src/sna/sna_glyphs.c @@ -110,7 +110,7 @@ extern DevPrivateKeyRec sna_glyph_key; static inline struct sna_glyph *sna_glyph(GlyphPtr glyph) { - return dixGetPrivateAddr(&glyph->devPrivates, &sna_glyph_key); + return __get_private(glyph, sna_glyph_key); } #define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0) @@ -246,6 +246,7 @@ bool sna_glyphs_create(struct sna *sna) goto bail; ValidatePicture(picture); + assert(picture->pDrawable == &pixmap->drawable); cache->count = cache->evict = 0; cache->picture = picture; diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c index 406a6b31..c547fb5a 100644 --- a/src/sna/sna_trapezoids.c +++ b/src/sna/sna_trapezoids.c @@ -7046,6 +7046,7 @@ project_point_onto_grid(const xPointFixed *in, out->y = dy + pixman_fixed_to_grid(in->y); } +#if HAS_PIXMAN_TRIANGLES static inline bool xTriangleValid(const xTriangle *t) { @@ -7988,3 +7989,4 @@ sna_composite_trifan(CARD8 op, { trifan_fallback(op, src, dst, maskFormat, xSrc, ySrc, n, points); } +#endif |