summaryrefslogtreecommitdiff
path: root/src/sna/sna_accel.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-10-30 18:42:06 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-10-30 18:52:14 +0000
commit426efd5f4bb311eeec86de40815b6bc2c6914e94 (patch)
tree0c876c8491664c57ee919d8682459c3c1dac3adf /src/sna/sna_accel.c
parented282456240cc0a7ae9a235ea8aea14a8b8a54ef (diff)
Revert "sna: Detect and handle mi recursion"
This reverts commit c6b0e3fe0c299488932ba0392847f1faf298d079.
Diffstat (limited to 'src/sna/sna_accel.c')
-rw-r--r--src/sna/sna_accel.c158
1 files changed, 9 insertions, 149 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 06753ec1..f75bfe0d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -333,8 +333,6 @@ static void assert_pixmap_damage(PixmapPtr p)
struct sna_pixmap *priv;
RegionRec reg, cpu, gpu;
- sigtrap_assert();
-
priv = sna_pixmap(p);
if (priv == NULL)
return;
@@ -1882,7 +1880,6 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
assert(flags & (MOVE_READ | MOVE_WRITE));
assert_pixmap_damage(pixmap);
- sigtrap_assert();
priv = sna_pixmap(pixmap);
if (priv == NULL) {
@@ -2189,7 +2186,6 @@ done:
assert(pixmap->devKind);
assert_pixmap_damage(pixmap);
assert(has_coherent_ptr(sna, sna_pixmap(pixmap), flags));
- sigtrap_assert();
return true;
}
@@ -2319,7 +2315,6 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
assert_drawable_contains_box(drawable, &region->extents);
}
assert(flags & (MOVE_WRITE | MOVE_READ));
- sigtrap_assert();
if (box_empty(&region->extents))
return true;
@@ -2832,7 +2827,6 @@ out:
assert(pixmap->devKind);
assert_pixmap_damage(pixmap);
assert(has_coherent_ptr(sna, sna_pixmap(pixmap), flags));
- sigtrap_assert();
return true;
}
@@ -2855,8 +2849,6 @@ sna_drawable_move_to_cpu(DrawablePtr drawable, unsigned flags)
drawable->width, drawable->height,
dx, dy, flags));
- sigtrap_assert();
-
region.extents.x1 = drawable->x + dx;
region.extents.y1 = drawable->y + dy;
region.extents.x2 = region.extents.x1 + drawable->width;
@@ -2932,7 +2924,6 @@ static inline struct sna_pixmap *
sna_pixmap_mark_active(struct sna *sna, struct sna_pixmap *priv)
{
assert(priv->gpu_bo);
- sigtrap_assert();
DBG(("%s: pixmap=%ld, handle=%u\n", __FUNCTION__,
priv->pixmap->drawable.serialNumber,
priv->gpu_bo->handle));
@@ -2981,8 +2972,6 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
__FUNCTION__, pixmap->drawable.serialNumber,
box->x1, box->y1, box->x2, box->y2, flags));
- sigtrap_assert();
-
priv = __sna_pixmap_for_gpu(sna, pixmap, flags);
if (priv == NULL)
return NULL;
@@ -3709,8 +3698,6 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
pixmap->usage_hint,
flags));
- sigtrap_assert();
-
priv = __sna_pixmap_for_gpu(sna, pixmap, flags);
if (priv == NULL)
return NULL;
@@ -3936,8 +3923,6 @@ static bool must_check sna_gc_move_to_cpu(GCPtr gc,
DBG(("%s, changes=%lx\n", __FUNCTION__, changes));
- sigtrap_assert();
-
assert(gc->ops == (GCOps *)&sna_gc_ops);
gc->ops = (GCOps *)&sna_gc_ops__cpu;
@@ -4207,7 +4192,6 @@ try_upload_blt(PixmapPtr pixmap, RegionRec *region,
__FUNCTION__, x, y, w, h,
RegionNumRects(region)));
- sigtrap_assert();
if (sigtrap_get() == 0) {
ok = sna->render.copy_boxes(sna, GXcopy,
pixmap, src_bo, -x, -y,
@@ -4322,7 +4306,6 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
DBG(("%s: upload(%d, %d, %d, %d) x %d\n", __FUNCTION__, x, y, w, h, n));
- sigtrap_assert();
if (sigtrap_get())
return false;
@@ -4415,7 +4398,6 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
region, MOVE_WRITE))
return false;
- sigtrap_assert();
if (sigtrap_get())
return false;
@@ -4544,7 +4526,6 @@ sna_put_xybitmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
break;
- sigtrap_assert();
if (sigtrap_get() == 0) {
int src_stride = BitmapBytePad(w);
uint8_t *dst = ptr;
@@ -4681,7 +4662,6 @@ sna_put_xypixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
if (!upload)
break;
- sigtrap_assert();
if (sigtrap_get() == 0) {
int src_stride = BitmapBytePad(w);
uint8_t *src = (uint8_t*)bits + (box->y1 - y) * src_stride + bx1/8;
@@ -4842,11 +4822,9 @@ fallback:
drawable_gc_flags(drawable, gc, false)))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fbPutImage(%d, %d, %d, %d)\n",
__FUNCTION__, x, y, w, h));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbPutImage(drawable, gc, depth, x, y, w, h, left, format, bits);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -5089,7 +5067,6 @@ fallback:
goto free_boxes;
if (alu == GXcopy && pixmap->drawable.bitsPerPixel >= 8) {
- sigtrap_assert();
if (sigtrap_get() == 0) {
FbBits *dst_bits, *src_bits;
int stride = pixmap->devKind;
@@ -5113,7 +5090,6 @@ fallback:
if (gc && !sna_gc_move_to_cpu(gc, dst, region))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
get_drawable_deltas(src, pixmap, &tx, &ty);
miCopyRegion(src, dst, gc,
@@ -6064,10 +6040,8 @@ fallback:
RegionTranslate(region, -dst_dx, -dst_dy);
- sigtrap_assert();
if (sna_gc_move_to_cpu(gc, dst, region) &&
sigtrap_get() == 0) {
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
miCopyRegion(src, dst, gc,
region, dx, dy,
fbCopyNtoN, 0, NULL);
@@ -6243,9 +6217,7 @@ sna_fallback_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
goto out;
}
- sigtrap_assert();
if (sigtrap_get() == 0) {
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
miCopyRegion(src, dst, gc,
region, dx, dy,
fbCopyNtoN, 0, NULL);
@@ -7281,10 +7253,8 @@ fallback:
drawable_gc_flags(drawable, gc, n > 1)))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fbFillSpans\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbFillSpans(drawable, gc, n, pt, width, sorted);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -7324,10 +7294,8 @@ fallback:
drawable_gc_flags(drawable, gc, n > 1)))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fbSetSpans\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbSetSpans(drawable, gc, src, pt, width, n, sorted);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -7462,7 +7430,6 @@ sna_copy_bitmap_blt(DrawablePtr _bitmap, DrawablePtr drawable, GCPtr gc,
if (!upload)
break;
- sigtrap_assert();
if (sigtrap_get() == 0) {
assert(sna->kgem.mode == KGEM_BLT);
b = sna->kgem.batch + sna->kgem.nbatch;
@@ -7591,7 +7558,6 @@ sna_copy_plane_blt(DrawablePtr source, DrawablePtr drawable, GCPtr gc,
if (!upload)
break;
- sigtrap_assert();
if (sigtrap_get() == 0) {
uint32_t *b;
@@ -7843,30 +7809,15 @@ fallback:
drawable_gc_flags(dst, gc, false)))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
- bool expose = gc->fExpose;
-
DBG(("%s: fbCopyPlane(%d, %d, %d, %d, %d,%d) %x\n",
__FUNCTION__, src_x, src_y, w, h, dst_x, dst_y, (unsigned)bit));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
-
- expose = gc->fExpose;
- gc->fExpose = 0;
-
- miDoCopy(src, dst, gc,
- src_x, src_y, w, h, dst_x, dst_y,
- src->bitsPerPixel > 1 ? fbCopyNto1 : fbCopy1toN,
- bit, 0);
-
+ ret = miDoCopy(src, dst, gc,
+ src_x, src_y, w, h, dst_x, dst_y,
+ src->bitsPerPixel > 1 ? fbCopyNto1 : fbCopy1toN,
+ bit, 0);
FALLBACK_FLUSH(dst);
sigtrap_put();
-
- gc->fExpose = expose;
- ret = miHandleExposures(src, dst, gc,
- src_x, src_y,
- w, h,
- dst_x, dst_y, bit);
}
out:
sna_gc_move_to_gpu(gc);
@@ -8070,10 +8021,8 @@ fallback:
MOVE_READ | MOVE_WRITE))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fbPolyPoint\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbPolyPoint(drawable, gc, mode, n, pt, flags);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -9113,10 +9062,8 @@ fallback:
!(data.flags & 4 && n == 2))))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fbPolyLine\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbPolyLine(drawable, gc, mode, n, pt);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -9963,10 +9910,8 @@ fallback:
!(data.flags & 4 && n == 1))))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fbPolySegment\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbPolySegment(drawable, gc, n, seg);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -10573,10 +10518,8 @@ fallback:
drawable_gc_flags(drawable, gc, true)))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: miPolyRectangle\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
miPolyRectangle(drawable, gc, n, r);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -10774,10 +10717,8 @@ fallback:
drawable_gc_flags(drawable, gc, true)))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s -- fbPolyArc\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbPolyArc(drawable, gc, n, arc);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -11129,11 +11070,9 @@ fallback:
drawable_gc_flags(draw, gc, true)))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fallback -- miFillPolygon -> sna_fill_spans__cpu\n",
__FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
miFillPolygon(draw, gc, shape, mode, n, pt);
sigtrap_put();
}
@@ -11161,7 +11100,6 @@ sna_pixmap_get_source_bo(PixmapPtr pixmap)
if (upload == NULL)
return NULL;
- sigtrap_assert();
if (sigtrap_get()) {
kgem_bo_destroy(&sna->kgem, upload);
return NULL;
@@ -11175,6 +11113,7 @@ sna_pixmap_get_source_bo(PixmapPtr pixmap)
0, 0,
pixmap->drawable.width,
pixmap->drawable.height);
+
sigtrap_put();
return upload;
@@ -12272,7 +12211,6 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
if (!upload)
break;
- sigtrap_assert();
if (sigtrap_get() == 0) {
dst = ptr;
src_stride = stipple->devKind;
@@ -12422,7 +12360,6 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
if (!upload)
break;
- sigtrap_assert();
if (sigtrap_get() == 0) {
dst = ptr;
src_stride = stipple->devKind;
@@ -12573,7 +12510,6 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
if (!upload)
break;
- sigtrap_assert();
if (sigtrap_get() == 0) {
dst = ptr;
src_stride = stipple->devKind;
@@ -13450,10 +13386,8 @@ fallback:
drawable_gc_flags(draw, gc, n > 1)))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fallback - fbPolyFillRect\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbPolyFillRect(draw, gc, n, rect);
FALLBACK_FLUSH(draw);
sigtrap_put();
@@ -13622,11 +13556,9 @@ fallback:
drawable_gc_flags(draw, gc, true)))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fallback -- miPolyFillArc -> sna_fill_spans__cpu\n",
__FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
miPolyFillArc(draw, gc, n, arc);
sigtrap_put();
}
@@ -14121,10 +14053,8 @@ fallback:
MOVE_READ | MOVE_WRITE))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fallback -- fbPolyGlyphBlt\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbPolyGlyphBlt(drawable, gc, x, y, n,
info, FONTGLYPHS(gc->font));
FALLBACK_FLUSH(drawable);
@@ -14199,10 +14129,8 @@ fallback:
MOVE_READ | MOVE_WRITE))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fallback -- fbPolyGlyphBlt\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbPolyGlyphBlt(drawable, gc, x, y, n,
info, FONTGLYPHS(gc->font));
FALLBACK_FLUSH(drawable);
@@ -14284,10 +14212,8 @@ fallback:
if (!sna_drawable_move_region_to_cpu(drawable, &region, MOVE_WRITE))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fallback -- fbImageGlyphBlt\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbImageGlyphBlt(drawable, gc, x, y, n,
info, FONTGLYPHS(gc->font));
FALLBACK_FLUSH(drawable);
@@ -14369,10 +14295,8 @@ fallback:
if (!sna_drawable_move_region_to_cpu(drawable, &region, MOVE_WRITE))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fallback -- fbImageGlyphBlt\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbImageGlyphBlt(drawable, gc, x, y, n,
info, FONTGLYPHS(gc->font));
FALLBACK_FLUSH(drawable);
@@ -14705,10 +14629,8 @@ fallback:
if (!sna_drawable_move_region_to_cpu(drawable, &region, MOVE_WRITE))
goto out_gc;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fallback -- fbImageGlyphBlt\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbImageGlyphBlt(drawable, gc, x, y, n, info, base);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -14788,10 +14710,8 @@ fallback:
MOVE_READ | MOVE_WRITE))
goto out_gc;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fallback -- fbPolyGlyphBlt\n", __FUNCTION__));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbPolyGlyphBlt(drawable, gc, x, y, n, info, base);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -14874,7 +14794,6 @@ sna_push_pixels_solid_blt(GCPtr gc,
if (!upload)
break;
- sigtrap_assert();
if (sigtrap_get() == 0) {
uint8_t *dst = ptr;
@@ -14981,11 +14900,9 @@ sna_push_pixels(GCPtr gc, PixmapPtr bitmap, DrawablePtr drawable,
drawable_gc_flags(drawable, gc, false)))
goto out;
- sigtrap_assert();
if (sigtrap_get() == 0) {
DBG(("%s: fallback, fbPushPixels(%d, %d, %d %d)\n",
__FUNCTION__, w, h, x, y));
- assert(gc->ops == (GCOps *)&sna_gc_ops__cpu);
fbPushPixels(gc, bitmap, drawable, w, h, x, y);
FALLBACK_FLUSH(drawable);
sigtrap_put();
@@ -15018,43 +14935,12 @@ static const GCOps sna_gc_ops = {
sna_push_pixels,
};
-static RegionPtr
-sna_copy_plane__cpu(DrawablePtr src, DrawablePtr dst, GCPtr gc,
- int src_x, int src_y,
- int w, int h,
- int dst_x, int dst_y,
- unsigned long bit)
-{
- DBG(("%s: src=(%d, %d), dst=(%d, %d), size=%dx%d\n", __FUNCTION__,
- src_x, src_y, dst_x, dst_y, w, h));
-
- if (gc->planemask == 0)
- goto empty;
-
- if (src->bitsPerPixel == 1 && (bit&1) == 0)
- goto empty;
-
- if (!sna_drawable_move_to_cpu(src, MOVE_READ))
- goto empty;
-
- return miDoCopy(src, dst, gc,
- src_x, src_y, w, h, dst_x, dst_y,
- src->bitsPerPixel > 1 ? fbCopyNto1 : fbCopy1toN,
- bit, 0);
-
-empty:
- return miHandleExposures(src, dst, gc,
- src_x, src_y,
- w, h,
- dst_x, dst_y, bit);
-}
-
static const GCOps sna_gc_ops__cpu = {
fbFillSpans,
fbSetSpans,
fbPutImage,
fbCopyArea,
- sna_copy_plane__cpu,
+ fbCopyPlane,
sna_poly_point__cpu,
fbPolyLine,
fbPolySegment,
@@ -15108,25 +14994,6 @@ sna_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
sna_gc(gc)->changes |= changes;
}
-static void
-sna_validate_gc__cpu(GCPtr gc, unsigned long changes, DrawablePtr drawable)
-{
- struct sna_gc *sgc;
-
- DBG(("%s changes=%lx\n", __FUNCTION__, changes));
-
- if (changes & (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode) ||
- drawable->serialNumber != (gc->serialNumber & DRAWABLE_SERIAL_BITS))
- miComputeCompositeClip(gc, drawable);
-
- fbValidateGC(gc, changes, drawable);
- gc->serialNumber = drawable->serialNumber;
-
- sgc = sna_gc(gc);
- sgc->serial = drawable->serialNumber;
- sgc->changes = 0;
-}
-
static const GCFuncs sna_gc_funcs = {
sna_validate_gc,
miChangeGC,
@@ -15138,7 +15005,7 @@ static const GCFuncs sna_gc_funcs = {
};
static const GCFuncs sna_gc_funcs__cpu = {
- sna_validate_gc__cpu,
+ fbValidateGC,
miChangeGC,
miCopyGC,
miDestroyGC,
@@ -15158,13 +15025,8 @@ static int sna_create_gc(GCPtr gc)
fb_gc(gc)->bpp = bits_per_pixel(gc->depth);
- if (gc->depth < 8) {
- gc->funcs = (GCFuncs *)&sna_gc_funcs__cpu;
- gc->ops = (GCOps *)&sna_gc_ops__cpu;
- } else {
- gc->funcs = (GCFuncs *)&sna_gc_funcs;
- gc->ops = (GCOps *)&sna_gc_ops;
- }
+ gc->funcs = (GCFuncs *)&sna_gc_funcs;
+ gc->ops = (GCOps *)&sna_gc_ops;
return true;
}
@@ -15461,7 +15323,6 @@ sna_copy_window(WindowPtr win, DDXPointRec origin, RegionPtr src)
if (!sna_pixmap_move_to_cpu(pixmap, MOVE_READ | MOVE_WRITE))
return;
- sigtrap_assert();
if (sigtrap_get() == 0) {
miCopyRegion(&pixmap->drawable, &pixmap->drawable,
0, &dst, dx, dy, fbCopyNtoN, 0, NULL);
@@ -15784,7 +15645,6 @@ fallback:
if (!sna_pixmap_move_to_cpu(dst, MOVE_READ | MOVE_WRITE | MOVE_INPLACE_HINT))
goto skip;
- sigtrap_assert();
if (sigtrap_get() == 0) {
assert(src->drawable.bitsPerPixel == dst->drawable.bitsPerPixel);
do {