summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-12-13 22:53:18 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-12-13 23:00:13 +0000
commit29afd0dc8e893cc4110ee0d70546775dae86ddb3 (patch)
tree44931edb38cbc2da2579067e66277d5bc848d879
parent4d2abe1e3daac74747535d88dff34b024b87bbe9 (diff)
downloadxf86-video-intel-29afd0dc8e893cc4110ee0d70546775dae86ddb3.tar.gz
xf86-video-intel-29afd0dc8e893cc4110ee0d70546775dae86ddb3.tar.bz2
xf86-video-intel-29afd0dc8e893cc4110ee0d70546775dae86ddb3.zip
sna/gen2: Assertions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/gen2_render.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index d0272bf21..afc71af8f 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -1050,6 +1050,7 @@ inline static int gen2_get_rectangles(struct sna *sna,
if ((sna->kgem.batch[sna->kgem.nbatch-1] & ~0xffff) ==
(PRIM3D_INLINE | PRIM3D_RECTLIST)) {
uint32_t *b = &sna->kgem.batch[sna->kgem.nbatch-1];
+ assert(*b & 0xffff);
sna->render.vertex_index = 1 + (*b & 0xffff);
*b = PRIM3D_INLINE | PRIM3D_RECTLIST;
state->vertex_offset = sna->kgem.nbatch - 1;
@@ -1885,7 +1886,7 @@ gen2_render_composite(struct sna *sna,
DBG(("%s: fallback -- unsupported CA blend (src_blend=%d)\n",
__FUNCTION__,
gen2_blend_op[op].src_blend));
- goto cleanup_dst;
+ goto cleanup_src;
}
tmp->need_magic_ca_pass = true;
@@ -1894,8 +1895,12 @@ gen2_render_composite(struct sna *sna,
}
/* convert solid to a texture (pure convenience) */
- if (tmp->mask.is_solid && tmp->src.is_solid)
+ if (tmp->mask.is_solid && tmp->src.is_solid) {
+ assert(tmp->mask.is_affine);
tmp->mask.bo = sna_render_get_solid(sna, tmp->mask.u.gen2.pixel);
+ if (!tmp->mask.bo)
+ goto cleanup_src;
+ }
}
tmp->floats_per_vertex = 2;
@@ -1908,18 +1913,25 @@ gen2_render_composite(struct sna *sna,
tmp->prim_emit = gen2_emit_composite_primitive;
if (tmp->mask.bo) {
if (tmp->mask.transform == NULL) {
- if (tmp->src.is_solid)
+ if (tmp->src.is_solid) {
+ assert(tmp->floats_per_rect == 12);
tmp->prim_emit = gen2_emit_composite_primitive_constant_identity_mask;
+ }
}
} else {
- if (tmp->src.is_solid)
+ if (tmp->src.is_solid) {
+ assert(tmp->floats_per_rect == 6);
tmp->prim_emit = gen2_emit_composite_primitive_constant;
- else if (tmp->src.is_linear)
+ } else if (tmp->src.is_linear) {
+ assert(tmp->floats_per_rect == 12);
tmp->prim_emit = gen2_emit_composite_primitive_linear;
- else if (tmp->src.transform == NULL)
+ } else if (tmp->src.transform == NULL) {
+ assert(tmp->floats_per_rect == 12);
tmp->prim_emit = gen2_emit_composite_primitive_identity;
- else if (tmp->src.is_affine)
+ } else if (tmp->src.is_affine) {
+ assert(tmp->floats_per_rect == 12);
tmp->prim_emit = gen2_emit_composite_primitive_affine;
+ }
}
tmp->blt = gen2_render_composite_blt;