summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-11 19:45:55 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-11 19:53:20 +0000
commit8136bc5e113ae06c30def3c91b1615e5fab8af44 (patch)
treeaeb7e7869b8b834373c3892d1bf7464ab3814c11
parent989615493608525fc252e4e94ac7259cba0741f5 (diff)
sna: Make the maximum BLT pitch assertions consistent
The maximum permissibly BLT pitch value is 32767, so make the assertions match... Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47206 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_blt.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index d70e30e0..eb8dbf87 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -118,6 +118,7 @@ static bool sna_blt_fill_init(struct sna *sna,
{
struct kgem *kgem = &sna->kgem;
+ assert(kgem_bo_can_blt (kgem, bo));
assert(bo->tiling != I915_TILING_Y);
blt->bo[0] = bo;
@@ -127,7 +128,7 @@ static bool sna_blt_fill_init(struct sna *sna,
blt->cmd |= BLT_DST_TILED;
blt->br13 >>= 2;
}
- assert(blt->br13 < MAXSHORT);
+ assert(blt->br13 <= MAXSHORT);
if (alu == GXclear)
pixel = 0;
@@ -258,6 +259,9 @@ static Bool sna_blt_copy_init(struct sna *sna,
{
struct kgem *kgem = &sna->kgem;
+ assert(kgem_bo_can_blt (kgem, src));
+ assert(kgem_bo_can_blt (kgem, dst));
+
blt->bo[0] = src;
blt->bo[1] = dst;
@@ -270,14 +274,14 @@ static Bool sna_blt_copy_init(struct sna *sna,
blt->cmd |= BLT_SRC_TILED;
blt->pitch[0] >>= 2;
}
- assert(blt->pitch[0] < MAXSHORT);
+ assert(blt->pitch[0] <= MAXSHORT);
blt->pitch[1] = dst->pitch;
if (kgem->gen >= 40 && dst->tiling) {
blt->cmd |= BLT_DST_TILED;
blt->pitch[1] >>= 2;
}
- assert(blt->pitch[1] < MAXSHORT);
+ assert(blt->pitch[1] <= MAXSHORT);
blt->overwrites = alu == GXcopy || alu == GXclear || alu == GXset;
blt->br13 = (copy_ROP[alu] << 16) | blt->pitch[1];
@@ -308,6 +312,9 @@ static Bool sna_blt_alpha_fixup_init(struct sna *sna,
{
struct kgem *kgem = &sna->kgem;
+ assert(kgem_bo_can_blt (kgem, src));
+ assert(kgem_bo_can_blt (kgem, dst));
+
blt->bo[0] = src;
blt->bo[1] = dst;
@@ -317,14 +324,14 @@ static Bool sna_blt_alpha_fixup_init(struct sna *sna,
blt->cmd |= BLT_SRC_TILED;
blt->pitch[0] >>= 2;
}
- assert(blt->pitch[0] < MAXSHORT);
+ assert(blt->pitch[0] <= MAXSHORT);
blt->pitch[1] = dst->pitch;
if (kgem->gen >= 40 && dst->tiling) {
blt->cmd |= BLT_DST_TILED;
blt->pitch[1] >>= 2;
}
- assert(blt->pitch[1] < MAXSHORT);
+ assert(blt->pitch[1] <= MAXSHORT);
blt->overwrites = 1;
blt->br13 = (0xfc << 16) | blt->pitch[1];
@@ -1829,6 +1836,8 @@ static bool sna_blt_fill_box(struct sna *sna, uint8_t alu,
uint32_t br13, cmd, *b;
bool overwrites;
+ assert(kgem_bo_can_blt (kgem, bo));
+
DBG(("%s: box=((%d, %d), (%d, %d))\n", __FUNCTION__,
box->x1, box->y1, box->x2, box->y2));
@@ -1841,7 +1850,7 @@ static bool sna_blt_fill_box(struct sna *sna, uint8_t alu,
cmd |= BLT_DST_TILED;
br13 >>= 2;
}
- assert(br13 < MAXSHORT);
+ assert(br13 <= MAXSHORT);
br13 |= fill_ROP[alu] << 16;
switch (bpp) {
@@ -1954,7 +1963,7 @@ Bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
cmd |= 1 << 11;
br13 >>= 2;
}
- assert(br13 < MAXSHORT);
+ assert(br13 <= MAXSHORT);
br13 |= 1<<31 | fill_ROP[alu] << 16;
switch (bpp) {
@@ -2105,7 +2114,7 @@ Bool sna_blt_copy_boxes(struct sna *sna, uint8_t alu,
cmd |= BLT_DST_TILED;
br13 >>= 2;
}
- assert(br13 < MAXSHORT);
+ assert(br13 <= MAXSHORT);
br13 |= copy_ROP[alu] << 16;
switch (bpp) {