xf86-video-intel: 3 commits - src/sna/sna_accel.c
Chris Wilson
ickle at kemper.freedesktop.org
Thu Jun 19 03:52:25 PDT 2014
src/sna/sna_accel.c | 118 ++++++++++++++++++++++++++++++++++------------------
1 file changed, 78 insertions(+), 40 deletions(-)
New commits:
commit edeb2ddd170a1817ced45abada53346c5cd8c30b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Jun 19 11:51:00 2014 +0100
sna: Use the right pattern origin for tiled 8x8 extraction
References: https://bugs.freedesktop.org/show_bug.cgi?id=80033
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 5312cae..9a485cf 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -12316,18 +12316,21 @@ sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
const DDXPointRec origin = gc->patOrg;
struct kgem_bo *upload;
uint8_t *src, *dst;
+ bool ret = false;
void *ptr;
- bool ret;
tx = 0, tw = tile->drawable.width;
if (!tile8(tw) && tw > extents->x2 - extents->x1) {
- tx = (extents->x1 - gc->patOrg.x) % tw;
+ tx = (extents->x1 - gc->patOrg.x - drawable->x) % tw;
if (tx < 0)
tx += tw;
tw = next8(extents->x2 - extents->x1, tw);
- if (tx + tw > tile->drawable.width)
- return false;
- gc->patOrg.x = extents->x1;
+ if (tx + tw > tile->drawable.width) {
+ DBG(("%s: tx=%d + tw=%d > width=%d\n",
+ __FUNCTION__, tx, tw, tile->drawable.width));
+ goto out_gc;
+ }
+ gc->patOrg.x = extents->x1 - drawable->x;
}
ty = 0, th = tile->drawable.height;
@@ -12336,9 +12339,12 @@ sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
if (ty < 0)
ty += th;
th = next8(extents->y2 - extents->y1, th);
- if (ty + th > tile->drawable.height)
- return false;
- gc->patOrg.y = extents->y1;
+ if (ty + th > tile->drawable.height) {
+ DBG(("%s: ty=%d + th=%d > height=%d\n",
+ __FUNCTION__, ty, th, tile->drawable.height));
+ goto out_gc;
+ }
+ gc->patOrg.y = extents->y1 - drawable->y;
}
DBG(("%s: %dx%d+%d+%d (full tile size %dx%d)\n", __FUNCTION__,
@@ -12349,7 +12355,7 @@ sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
assert(is_power_of_two(th));
if (!sna_pixmap_move_to_cpu(tile, MOVE_READ))
- return false;
+ goto out_gc;
assert(tile->devKind);
assert(has_coherent_ptr(sna, sna_pixmap(tile), MOVE_READ));
@@ -12372,11 +12378,10 @@ sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
upload = kgem_create_buffer(&sna->kgem, 8*bpp, KGEM_BUFFER_WRITE, &ptr);
if (upload == NULL)
- return false;
+ goto out_gc;
upload->pitch = bpp; /* for sanity checks */
- ret = false;
if (sigtrap_get() == 0) {
dst = ptr;
for (h = 0; h < th; h++) {
@@ -12405,6 +12410,7 @@ sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
}
kgem_bo_destroy(&sna->kgem, upload);
+out_gc:
gc->patOrg = origin;
return ret;
}
commit 1752e2d647cdb7cbff0ae7d0f0d0b761b5942965
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Jun 19 11:14:25 2014 +0100
sna: Fix up small extents for 8x8 tile construction
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 36f9531..5312cae 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -12274,6 +12274,34 @@ done:
return true;
}
+static bool tile8(int x)
+{
+ switch(x) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static int next8(int x, int max)
+{
+ switch(x) {
+ case 1: return MIN(1, max);
+ case 2: return MIN(2, max);
+ case 3:
+ case 4: return MIN(4, max);
+ case 5:
+ case 6:
+ case 7:
+ case 8: return MIN(8, max);
+ default: return x;
+ }
+}
+
static bool
sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
struct kgem_bo *bo,
@@ -12292,22 +12320,22 @@ sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
bool ret;
tx = 0, tw = tile->drawable.width;
- if (tw > extents->x2 - extents->x1) {
+ if (!tile8(tw) && tw > extents->x2 - extents->x1) {
tx = (extents->x1 - gc->patOrg.x) % tw;
if (tx < 0)
tx += tw;
- tw = extents->x2 - extents->x1;
+ tw = next8(extents->x2 - extents->x1, tw);
if (tx + tw > tile->drawable.width)
return false;
gc->patOrg.x = extents->x1;
}
ty = 0, th = tile->drawable.height;
- if (th > extents->y2 - extents->y1) {
+ if (!tile8(th) && th > extents->y2 - extents->y1) {
ty = (extents->y1 - gc->patOrg.y) % th;
if (ty < 0)
ty += th;
- th = extents->y2 - extents->y1;
+ th = next8(extents->y2 - extents->y1, th);
if (ty + th > tile->drawable.height)
return false;
gc->patOrg.y = extents->y1;
@@ -12316,7 +12344,9 @@ sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
DBG(("%s: %dx%d+%d+%d (full tile size %dx%d)\n", __FUNCTION__,
tw, th, tx, ty, tile->drawable.width, tile->drawable.height));
assert(tw && tw <= 8 && tw <= tile->drawable.width);
+ assert(is_power_of_two(tw));
assert(th && th <= 8 && th <= tile->drawable.height);
+ assert(is_power_of_two(th));
if (!sna_pixmap_move_to_cpu(tile, MOVE_READ))
return false;
@@ -12441,10 +12471,8 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
struct sna_pixmap *priv = sna_pixmap(tile);
if (priv == NULL || priv->gpu_damage == NULL) {
- if (w > extents->x2 - extents->x1)
- w = extents->x2 - extents->x1;
- if (h > extents->y2 - extents->y1)
- h = extents->y2 - extents->y1;
+ w = next8(extents->x2 - extents->x1, w);
+ h = next8(extents->y2 - extents->y1, h);
DBG(("%s: triming size for unattached tile: %dx%d\n",
__FUNCTION__, w, h));
}
commit f866a20c991d52fd2cf4ce63acc3cd44534ce5be
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Jun 19 10:49:09 2014 +0100
sna: Wrap pointer access for 8x8 tile construction
The kernel can quite happily send a SIGBUS whenever we read from an bo
(due to oom), so catch it and handle it.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 77d15df..36f9531 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -12315,8 +12315,8 @@ sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
DBG(("%s: %dx%d+%d+%d (full tile size %dx%d)\n", __FUNCTION__,
tw, th, tx, ty, tile->drawable.width, tile->drawable.height));
- assert(tw && tw <= 8);
- assert(th && th <= 8);
+ assert(tw && tw <= 8 && tw <= tile->drawable.width);
+ assert(th && th <= 8 && th <= tile->drawable.height);
if (!sna_pixmap_move_to_cpu(tile, MOVE_READ))
return false;
@@ -12346,29 +12346,33 @@ sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
upload->pitch = bpp; /* for sanity checks */
- dst = ptr;
- for (h = 0; h < th; h++) {
- w = tw*bpp/8;
- memcpy(dst, src, w);
- while (w < bpp) {
- memcpy(dst+w, dst, w);
- w *= 2;
+ ret = false;
+ if (sigtrap_get() == 0) {
+ dst = ptr;
+ for (h = 0; h < th; h++) {
+ w = tw*bpp/8;
+ memcpy(dst, src, w);
+ while (w < bpp) {
+ memcpy(dst+w, dst, w);
+ w *= 2;
+ }
+ assert(w == bpp);
+
+ src += tile->devKind;
+ dst += bpp;
}
- assert(w == bpp);
+ while (h < 8) {
+ memcpy(dst, ptr, bpp*h);
+ dst += bpp * h;
+ h *= 2;
+ }
+ assert(h == 8);
- src += tile->devKind;
- dst += bpp;
- }
- while (h < 8) {
- memcpy(dst, ptr, bpp*h);
- dst += bpp * h;
- h *= 2;
+ ret = sna_poly_fill_rect_tiled_8x8_blt(drawable, bo, damage,
+ upload, gc, n, rect,
+ extents, clipped);
+ sigtrap_put();
}
- assert(h == 8);
-
- ret = sna_poly_fill_rect_tiled_8x8_blt(drawable, bo, damage,
- upload, gc, n, rect,
- extents, clipped);
kgem_bo_destroy(&sna->kgem, upload);
gc->patOrg = origin;
More information about the xorg-commit
mailing list