summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-11-08 13:17:20 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-11-08 18:12:04 +0000
commit32bbeefb8563ae2ab3a105d0b1c9b55d9587b788 (patch)
tree350374e07333893405c1f663b452203bf86a1fb1 /src
parent3620cd2d157f3d81ccb76bce2ab813bd1e058878 (diff)
sna: Pack clipped stippled uploads
This are even more likely to fit inside the immediate payload. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_accel.c268
1 files changed, 134 insertions, 134 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 7294e3fb..38e2f2a4 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -6192,7 +6192,7 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
PixmapPtr stipple = gc->stipple;
const DDXPointRec *origin = &gc->patOrg;
int16_t dx, dy;
- uint8_t rop = copy_ROP[gc->alu];
+ uint32_t br00, br13;
DBG(("%s: upload (%d, %d), (%d, %d), origin (%d, %d)\n", __FUNCTION__,
extents->x1, extents->y1,
@@ -6202,6 +6202,17 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
get_drawable_deltas(drawable, pixmap, &dx, &dy);
kgem_set_mode(&sna->kgem, KGEM_BLT);
+ br00 = 3 << 20;
+ br13 = priv->gpu_bo->pitch;
+ if (sna->kgem.gen >= 40) {
+ if (priv->gpu_bo->tiling)
+ br00 |= BLT_DST_TILED;
+ br13 >>= 2;
+ }
+ br13 |= (gc->fillStyle == FillStippled) << 29;
+ br13 |= blt_depth(drawable->depth) << 24;
+ br13 |= copy_ROP[gc->alu] << 16;
+
if (!clipped) {
dx += drawable->x;
dy += drawable->y;
@@ -6233,19 +6244,9 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
}
b = sna->kgem.batch + sna->kgem.nbatch;
- b[0] = XY_MONO_SRC_COPY_IMM | (5 + src_stride);
- if (drawable->bitsPerPixel == 32)
- b[0] |= 3 << 20;
+ b[0] = XY_MONO_SRC_COPY_IMM | (5 + src_stride) | br00;
b[0] |= ((r->x - origin->x) & 7) << 17;
- b[1] = priv->gpu_bo->pitch;
- if (sna->kgem.gen >= 40) {
- if (priv->gpu_bo->tiling)
- b[0] |= BLT_DST_TILED;
- b[1] >>= 2;
- }
- b[1] |= (gc->fillStyle == FillStippled) << 29;
- b[1] |= blt_depth(drawable->depth) << 24;
- b[1] |= rop << 16;
+ b[1] = br13;
b[2] = (r->y + dy) << 16 | (r->x + dx);
b[3] = (r->y + r->height + dy) << 16 | (r->x + r->width + dx);
b[4] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 4,
@@ -6260,18 +6261,17 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
sna->kgem.nbatch += 7 + src_stride;
dst = (uint8_t *)&b[7];
- bstride -= bw;
-
src_stride = stipple->devKind;
- src = (uint8_t*)stipple->devPrivate.ptr;
+ src = stipple->devPrivate.ptr;
src += (r->y - origin->y) * src_stride + bx1/8;
- src_stride -= bw;
+ src_stride -= bstride;
do {
- int i = bw;
+ int i = bstride;
do {
*dst++ = byte_reverse(*src++);
- } while (--i);
- dst += bstride;
+ *dst++ = byte_reverse(*src++);
+ i -= 2;
+ } while (i);
src += src_stride;
} while (--bh);
} else {
@@ -6293,34 +6293,23 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
break;
dst = ptr;
- bstride -= bw;
-
src_stride = stipple->devKind;
- src = (uint8_t*)stipple->devPrivate.ptr;
+ src = stipple->devPrivate.ptr;
src += (r->y - origin->y) * src_stride + bx1/8;
- src_stride -= bw;
+ src_stride -= bstride;
do {
- int i = bw;
+ int i = bstride;
do {
*dst++ = byte_reverse(*src++);
- } while (--i);
- dst += bstride;
+ *dst++ = byte_reverse(*src++);
+ i -= 2;
+ } while (i);
src += src_stride;
} while (--bh);
b = sna->kgem.batch + sna->kgem.nbatch;
- b[0] = XY_MONO_SRC_COPY;
- if (drawable->bitsPerPixel == 32)
- b[0] |= 3 << 20;
+ b[0] = XY_MONO_SRC_COPY | br00;
b[0] |= ((r->x - origin->x) & 7) << 17;
- b[1] = priv->gpu_bo->pitch;
- if (sna->kgem.gen >= 40) {
- if (priv->gpu_bo->tiling)
- b[0] |= BLT_DST_TILED;
- b[1] >>= 2;
- }
- b[1] |= (gc->fillStyle == FillStippled) << 29;
- b[1] |= blt_depth(drawable->depth) << 24;
- b[1] |= rop << 16;
+ b[1] = br13;
b[2] = (r->y + dy) << 16 | (r->x + dx);
b[3] = (r->y + r->height + dy) << 16 | (r->x + r->width + dx);
b[4] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 4,
@@ -6378,7 +6367,7 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
bx2 = (box.x2 - pat.x + 7) & ~7;
bw = (bx2 - bx1)/8;
bh = box.y2 - box.y1;
- bstride = ALIGN(bw, 8);
+ bstride = ALIGN(bw, 2);
DBG(("%s: rect (%d, %d)x(%d, %d), box (%d,%d),(%d,%d) stipple [%d,%d], pitch=%d, stride=%d\n",
__FUNCTION__,
@@ -6397,18 +6386,9 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
}
b = sna->kgem.batch + sna->kgem.nbatch;
- b[0] = XY_MONO_SRC_COPY_IMM | (5 + src_stride);
- if (drawable->bitsPerPixel == 32)
- b[0] |= 3 << 20;
+ b[0] = XY_MONO_SRC_COPY_IMM | (5 + src_stride) | br00;
b[0] |= ((box.x1 - pat.x) & 7) << 17;
- b[1] = priv->gpu_bo->pitch;
- if (sna->kgem.gen >= 40) {
- if (priv->gpu_bo->tiling)
- b[0] |= BLT_DST_TILED;
- b[1] >>= 2;
- }
- b[1] |= blt_depth(drawable->depth) << 24;
- b[1] |= rop << 16;
+ b[1] = br13;
b[2] = (box.y1 + dy) << 16 | (box.x1 + dx);
b[3] = (box.y2 + dy) << 16 | (box.x2 + dx);
b[4] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 4,
@@ -6423,18 +6403,17 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
sna->kgem.nbatch += 7 + src_stride;
dst = (uint8_t *)&b[7];
- bstride -= bw;
-
src_stride = stipple->devKind;
- src = (uint8_t*)stipple->devPrivate.ptr;
+ src = stipple->devPrivate.ptr;
src += (box.y1 - pat.y) * src_stride + bx1/8;
- src_stride -= bw;
+ src_stride -= bstride;
do {
- int i = bw;
+ int i = bstride;
do {
*dst++ = byte_reverse(*src++);
- } while (--i);
- dst += bstride;
+ *dst++ = byte_reverse(*src++);
+ i -= 2;
+ } while (i);
src += src_stride;
} while (--bh);
} else {
@@ -6453,35 +6432,24 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
break;
dst = ptr;
- bstride -= bw;
-
src_stride = stipple->devKind;
- src = (uint8_t*)stipple->devPrivate.ptr;
+ src = stipple->devPrivate.ptr;
src += (box.y1 - pat.y) * src_stride + bx1/8;
- src_stride -= bw;
+ src_stride -= bstride;
do {
- int i = bw;
+ int i = bstride;
do {
*dst++ = byte_reverse(*src++);
- } while (--i);
- dst += bstride;
+ *dst++ = byte_reverse(*src++);
+ i -= 2;
+ } while (i);
src += src_stride;
} while (--bh);
b = sna->kgem.batch + sna->kgem.nbatch;
- b[0] = XY_MONO_SRC_COPY;
- if (drawable->bitsPerPixel == 32)
- b[0] |= 3 << 20;
+ b[0] = XY_MONO_SRC_COPY | br00;
b[0] |= ((box.x1 - pat.x) & 7) << 17;
- b[1] = priv->gpu_bo->pitch;
- if (sna->kgem.gen >= 40) {
- if (priv->gpu_bo->tiling)
- b[0] |= BLT_DST_TILED;
- b[1] >>= 2;
- }
- b[1] |= (gc->fillStyle == FillStippled) << 29;
- b[1] |= blt_depth(drawable->depth) << 24;
- b[1] |= rop << 16;
+ b[1] = br13;
b[2] = (box.y1 + dy) << 16 | (box.x1 + dx);
b[3] = (box.y2 + dy) << 16 | (box.x2 + dx);
b[4] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 4,
@@ -6539,7 +6507,7 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
bx2 = (box.x2 - pat.x + 7) & ~7;
bw = (bx2 - bx1)/8;
bh = box.y2 - box.y1;
- bstride = ALIGN(bw, 8);
+ bstride = ALIGN(bw, 2);
DBG(("%s: rect (%d, %d)x(%d, %d), box (%d,%d),(%d,%d) stipple [%d,%d]\n",
__FUNCTION__,
@@ -6547,68 +6515,100 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
box.x1, box.y1, box.x2, box.y2,
bx1, bx2));
- if (!kgem_check_batch(&sna->kgem, 8) ||
- !kgem_check_bo_fenced(&sna->kgem, priv->gpu_bo, NULL) ||
- !kgem_check_reloc(&sna->kgem, 2)) {
- _kgem_submit(&sna->kgem);
- _kgem_set_mode(&sna->kgem, KGEM_BLT);
- }
+ src_stride = bstride*bh;
+ if (src_stride <= 128) {
+ src_stride = ALIGN(src_stride, 8) / 4;
+ if (!kgem_check_batch(&sna->kgem, 7+src_stride) ||
+ !kgem_check_bo_fenced(&sna->kgem, priv->gpu_bo, NULL) ||
+ !kgem_check_reloc(&sna->kgem, 1)) {
+ _kgem_submit(&sna->kgem);
+ _kgem_set_mode(&sna->kgem, KGEM_BLT);
+ }
- upload = kgem_create_buffer(&sna->kgem,
- bstride*bh,
- KGEM_BUFFER_WRITE,
- &ptr);
- if (!upload)
- break;
+ b = sna->kgem.batch + sna->kgem.nbatch;
+ b[0] = XY_MONO_SRC_COPY_IMM | (5 + src_stride) | br00;
+ b[0] |= ((box.x1 - pat.x) & 7) << 17;
+ b[1] = br13;
+ b[2] = (box.y1 + dy) << 16 | (box.x1 + dx);
+ b[3] = (box.y2 + dy) << 16 | (box.x2 + dx);
+ b[4] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 4,
+ priv->gpu_bo,
+ I915_GEM_DOMAIN_RENDER << 16 |
+ I915_GEM_DOMAIN_RENDER |
+ KGEM_RELOC_FENCED,
+ 0);
+ b[5] = gc->bgPixel;
+ b[6] = gc->fgPixel;
- dst = ptr;
- bstride -= bw;
+ sna->kgem.nbatch += 7 + src_stride;
- src_stride = stipple->devKind;
- src = (uint8_t*)stipple->devPrivate.ptr;
- src += (box.y1 - pat.y) * src_stride + bx1/8;
- src_stride -= bw;
- do {
- int i = bw;
+ dst = (uint8_t *)&b[7];
+ src_stride = stipple->devKind;
+ src = stipple->devPrivate.ptr;
+ src += (box.y1 - pat.y) * src_stride + bx1/8;
+ src_stride -= bstride;
do {
- *dst++ = byte_reverse(*src++);
- } while (--i);
- dst += bstride;
- src += src_stride;
- } while (--bh);
+ int i = bstride;
+ do {
+ *dst++ = byte_reverse(*src++);
+ *dst++ = byte_reverse(*src++);
+ i -= 2;
+ } while (i);
+ src += src_stride;
+ } while (--bh);
+ } else {
+ if (!kgem_check_batch(&sna->kgem, 8) ||
+ !kgem_check_bo_fenced(&sna->kgem, priv->gpu_bo, NULL) ||
+ !kgem_check_reloc(&sna->kgem, 2)) {
+ _kgem_submit(&sna->kgem);
+ _kgem_set_mode(&sna->kgem, KGEM_BLT);
+ }
- b = sna->kgem.batch + sna->kgem.nbatch;
- b[0] = XY_MONO_SRC_COPY;
- if (drawable->bitsPerPixel == 32)
- b[0] |= 3 << 20;
- b[0] |= ((box.x1 - pat.x) & 7) << 17;
- b[1] = priv->gpu_bo->pitch;
- if (sna->kgem.gen >= 40) {
- if (priv->gpu_bo->tiling)
- b[0] |= BLT_DST_TILED;
- b[1] >>= 2;
- }
- b[1] |= (gc->fillStyle == FillStippled) << 29;
- b[1] |= blt_depth(drawable->depth) << 24;
- b[1] |= rop << 16;
- b[2] = (box.y1 + dy) << 16 | (box.x1 + dx);
- b[3] = (box.y2 + dy) << 16 | (box.x2 + dx);
- b[4] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 4,
- priv->gpu_bo,
- I915_GEM_DOMAIN_RENDER << 16 |
- I915_GEM_DOMAIN_RENDER |
- KGEM_RELOC_FENCED,
- 0);
- b[5] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 5,
- upload,
- I915_GEM_DOMAIN_RENDER << 16 |
- KGEM_RELOC_FENCED,
- 0);
- b[6] = gc->bgPixel;
- b[7] = gc->fgPixel;
+ upload = kgem_create_buffer(&sna->kgem,
+ bstride*bh,
+ KGEM_BUFFER_WRITE,
+ &ptr);
+ if (!upload)
+ break;
- sna->kgem.nbatch += 8;
- kgem_bo_destroy(&sna->kgem, upload);
+ dst = ptr;
+ src_stride = stipple->devKind;
+ src = stipple->devPrivate.ptr;
+ src += (box.y1 - pat.y) * src_stride + bx1/8;
+ src_stride -= bstride;
+ do {
+ int i = bstride;
+ do {
+ *dst++ = byte_reverse(*src++);
+ *dst++ = byte_reverse(*src++);
+ i -= 2;
+ } while (i);
+ src += src_stride;
+ } while (--bh);
+
+ b = sna->kgem.batch + sna->kgem.nbatch;
+ b[0] = XY_MONO_SRC_COPY | br00;
+ b[0] |= ((box.x1 - pat.x) & 7) << 17;
+ b[1] = br13;
+ b[2] = (box.y1 + dy) << 16 | (box.x1 + dx);
+ b[3] = (box.y2 + dy) << 16 | (box.x2 + dx);
+ b[4] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 4,
+ priv->gpu_bo,
+ I915_GEM_DOMAIN_RENDER << 16 |
+ I915_GEM_DOMAIN_RENDER |
+ KGEM_RELOC_FENCED,
+ 0);
+ b[5] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 5,
+ upload,
+ I915_GEM_DOMAIN_RENDER << 16 |
+ KGEM_RELOC_FENCED,
+ 0);
+ b[6] = gc->bgPixel;
+ b[7] = gc->fgPixel;
+
+ sna->kgem.nbatch += 8;
+ kgem_bo_destroy(&sna->kgem, upload);
+ }
}
} while (--n);