summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-16 13:06:58 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-16 13:37:45 +0000
commita11b22d172898ebfc657339a9ca56102ae92592f (patch)
treec5478914f1d95aca2841e8711dcbac81cd4d56a1 /src
parent2f09363a6e2c77fb23bf0e4c12c4507521fa631b (diff)
sna/gen[23]: Remark the destination bo as dirty after flushing
One of the side-effects of emitting the composite state is that it tags the destination surface as dirty as a result of the *forthcoming* operation. So emitting the flush after emitting the composite state clears that tag, so we need to restore it for future coherency. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/gen2_render.c13
-rw-r--r--src/sna/gen3_render.c13
-rw-r--r--src/sna/gen6_render.c2
-rw-r--r--src/sna/kgem.c3
4 files changed, 24 insertions, 7 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index e5e5884a..0775b76c 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -1657,6 +1657,8 @@ gen2_render_composite(struct sna *sna,
int16_t width, int16_t height,
struct sna_composite_op *tmp)
{
+ bool need_flush;
+
DBG(("%s()\n", __FUNCTION__));
if (op >= ARRAY_SIZE(gen2_blend_op)) {
@@ -1808,8 +1810,10 @@ gen2_render_composite(struct sna *sna,
NULL))
kgem_submit(&sna->kgem);
+ need_flush =
+ kgem_bo_is_dirty(tmp->src.bo) || kgem_bo_is_dirty(tmp->mask.bo);
gen2_emit_composite_state(sna, tmp);
- if (kgem_bo_is_dirty(tmp->src.bo) || kgem_bo_is_dirty(tmp->mask.bo)) {
+ if (need_flush) {
if (tmp->src.bo == tmp->dst.bo || tmp->mask.bo == tmp->dst.bo) {
kgem_emit_flush(&sna->kgem);
} else {
@@ -1819,6 +1823,7 @@ gen2_render_composite(struct sna *sna,
kgem_clear_dirty(&sna->kgem);
}
assert(sna->kgem.mode == KGEM_RENDER);
+ kgem_bo_mark_dirty(tmp->dst.bo);
}
return TRUE;
@@ -2154,6 +2159,8 @@ gen2_render_composite_spans(struct sna *sna,
unsigned flags,
struct sna_composite_spans_op *tmp)
{
+ bool need_flush;
+
DBG(("%s(src=(%d, %d), dst=(%d, %d), size=(%d, %d))\n", __FUNCTION__,
src_x, src_y, dst_x, dst_y, width, height));
@@ -2229,8 +2236,9 @@ gen2_render_composite_spans(struct sna *sna,
NULL))
kgem_submit(&sna->kgem);
+ need_flush = tmp->base.src.bo;
gen2_emit_composite_spans_state(sna, tmp);
- if (kgem_bo_is_dirty(tmp->base.src.bo)) {
+ if (need_flush) {
if (tmp->base.src.bo == tmp->base.dst.bo) {
kgem_emit_flush(&sna->kgem);
} else {
@@ -2240,6 +2248,7 @@ gen2_render_composite_spans(struct sna *sna,
kgem_clear_dirty(&sna->kgem);
}
assert(sna->kgem.mode == KGEM_RENDER);
+ kgem_bo_mark_dirty(tmp->base.dst.bo);
}
return TRUE;
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index b131b891..ffcfff69 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -2560,6 +2560,8 @@ gen3_render_composite(struct sna *sna,
int16_t width, int16_t height,
struct sna_composite_op *tmp)
{
+ bool need_flush;
+
DBG(("%s()\n", __FUNCTION__));
if (op >= ARRAY_SIZE(gen3_blend_op)) {
@@ -2800,8 +2802,10 @@ gen3_render_composite(struct sna *sna,
NULL))
kgem_submit(&sna->kgem);
+ need_flush =
+ kgem_bo_is_dirty(tmp->src.bo) || kgem_bo_is_dirty(tmp->mask.bo);
gen3_emit_composite_state(sna, tmp);
- if (kgem_bo_is_dirty(tmp->src.bo) || kgem_bo_is_dirty(tmp->mask.bo)) {
+ if (need_flush) {
if (tmp->src.bo == tmp->dst.bo || tmp->mask.bo == tmp->dst.bo) {
kgem_emit_flush(&sna->kgem);
} else {
@@ -2811,6 +2815,7 @@ gen3_render_composite(struct sna *sna,
kgem_clear_dirty(&sna->kgem);
}
assert(sna->kgem.mode == KGEM_RENDER);
+ kgem_bo_mark_dirty(tmp->dst.bo);
}
gen3_align_vertex(sna, tmp);
@@ -3136,7 +3141,7 @@ gen3_render_composite_spans(struct sna *sna,
unsigned flags,
struct sna_composite_spans_op *tmp)
{
- bool no_offset;
+ bool no_offset, need_flush;
DBG(("%s(src=(%d, %d), dst=(%d, %d), size=(%d, %d))\n", __FUNCTION__,
src_x, src_y, dst_x, dst_y, width, height));
@@ -3241,8 +3246,9 @@ gen3_render_composite_spans(struct sna *sna,
NULL))
kgem_submit(&sna->kgem);
+ need_flush = kgem_bo_is_dirty(tmp->base.src.bo);
gen3_emit_composite_state(sna, &tmp->base);
- if (kgem_bo_is_dirty(tmp->base.src.bo)) {
+ if (need_flush) {
if (tmp->base.src.bo == tmp->base.dst.bo) {
kgem_emit_flush(&sna->kgem);
} else {
@@ -3252,6 +3258,7 @@ gen3_render_composite_spans(struct sna *sna,
kgem_clear_dirty(&sna->kgem);
}
assert(sna->kgem.mode == KGEM_RENDER);
+ kgem_bo_mark_dirty(tmp->base.dst.bo);
}
gen3_align_vertex(sna, &tmp->base);
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 39e036b8..dd880133 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1663,7 +1663,7 @@ static void gen6_emit_composite_state(struct sna *sna,
FALSE);
}
- if (sna->kgem.surface == offset&&
+ if (sna->kgem.surface == offset &&
*(uint64_t *)(sna->kgem.batch + sna->render_state.gen6.surface_table) == *(uint64_t*)binding_table &&
(op->mask.bo == NULL ||
sna->kgem.batch[sna->render_state.gen6.surface_table+2] == binding_table[2])) {
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index d119ae36..9169dd74 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2884,9 +2884,10 @@ struct kgem_bo *kgem_create_proxy(struct kgem_bo *target,
{
struct kgem_bo *bo;
- assert(target->proxy == NULL);
DBG(("%s: target handle=%d, offset=%d, length=%d, io=%d\n",
__FUNCTION__, target->handle, offset, length, target->io));
+ assert(target->proxy == NULL);
+ assert(target->tiling == I915_TILING_NONE);
bo = __kgem_bo_alloc(target->handle, length);
if (bo == NULL)