diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-05-20 11:08:51 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-05-21 09:31:55 +0100 |
commit | ef9dc6fae585d5616446eedc1e6e91173f4064c1 (patch) | |
tree | d581f39596ee855a7a41bc07278efb05257fb014 | |
parent | d6c30d1d4df6bcdfa075bd29da7c8aabee20774c (diff) |
sna: Undo a few more overwritten operations upon a bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 1 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 30 | ||||
-rw-r--r-- | src/sna/sna_composite.c | 7 |
3 files changed, 24 insertions, 14 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index aed3e08b..ee3f821d 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h | |||
@@ -507,6 +507,7 @@ struct kgem_bo *sna_pixmap_change_tiling(PixmapPtr pixmap, uint32_t tiling); | |||
507 | #define FORCE_GPU 0x2 | 507 | #define FORCE_GPU 0x2 |
508 | #define RENDER_GPU 0x4 | 508 | #define RENDER_GPU 0x4 |
509 | #define IGNORE_CPU 0x8 | 509 | #define IGNORE_CPU 0x8 |
510 | #define REPLACES 0x10 | ||
510 | struct kgem_bo * | 511 | struct kgem_bo * |
511 | sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box, | 512 | sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box, |
512 | struct sna_damage ***damage); | 513 | struct sna_damage ***damage); |
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 2c785704..6ed9e770 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c | |||
@@ -2946,6 +2946,8 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box, | |||
2946 | box->x1, box->y1, box->x2, box->y2, | 2946 | box->x1, box->y1, box->x2, box->y2, |
2947 | flags)); | 2947 | flags)); |
2948 | 2948 | ||
2949 | assert((hint & REPLACES) == 0 || (hint & IGNORE_CPU)); | ||
2950 | |||
2949 | assert(box->x2 > box->x1 && box->y2 > box->y1); | 2951 | assert(box->x2 > box->x1 && box->y2 > box->y1); |
2950 | assert(pixmap->refcnt); | 2952 | assert(pixmap->refcnt); |
2951 | assert_pixmap_damage(pixmap); | 2953 | assert_pixmap_damage(pixmap); |
@@ -3001,7 +3003,7 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box, | |||
3001 | __FUNCTION__, priv->flush, priv->shm, priv->cpu, flags)); | 3003 | __FUNCTION__, priv->flush, priv->shm, priv->cpu, flags)); |
3002 | 3004 | ||
3003 | if ((flags & PREFER_GPU) == 0 && | 3005 | if ((flags & PREFER_GPU) == 0 && |
3004 | (!priv->gpu_damage || !kgem_bo_is_busy(priv->gpu_bo))) { | 3006 | (flags & REPLACES || !priv->gpu_damage || !kgem_bo_is_busy(priv->gpu_bo))) { |
3005 | DBG(("%s: try cpu as GPU bo is idle\n", __FUNCTION__)); | 3007 | DBG(("%s: try cpu as GPU bo is idle\n", __FUNCTION__)); |
3006 | goto use_cpu_bo; | 3008 | goto use_cpu_bo; |
3007 | } | 3009 | } |
@@ -12179,18 +12181,20 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect) | |||
12179 | } | 12181 | } |
12180 | hint |= IGNORE_CPU; | 12182 | hint |= IGNORE_CPU; |
12181 | } | 12183 | } |
12182 | if (priv->cpu_damage == NULL && | 12184 | if (region_subsumes_drawable(®ion, &pixmap->drawable)) |
12183 | (region_subsumes_drawable(®ion, &pixmap->drawable) || | 12185 | hint |= REPLACES; |
12184 | box_inplace(pixmap, ®ion.extents))) { | ||
12185 | DBG(("%s: promoting to full GPU\n", __FUNCTION__)); | ||
12186 | if (priv->gpu_bo) { | ||
12187 | assert(priv->gpu_bo->proxy == NULL); | ||
12188 | sna_damage_all(&priv->gpu_damage, | ||
12189 | pixmap->drawable.width, | ||
12190 | pixmap->drawable.height); | ||
12191 | } | ||
12192 | } | ||
12193 | if (priv->cpu_damage == NULL) { | 12186 | if (priv->cpu_damage == NULL) { |
12187 | if (hint & REPLACES && | ||
12188 | box_inplace(pixmap, ®ion.extents)) { | ||
12189 | DBG(("%s: promoting to full GPU\n", | ||
12190 | __FUNCTION__)); | ||
12191 | if (priv->gpu_bo) { | ||
12192 | assert(priv->gpu_bo->proxy == NULL); | ||
12193 | sna_damage_all(&priv->gpu_damage, | ||
12194 | pixmap->drawable.width, | ||
12195 | pixmap->drawable.height); | ||
12196 | } | ||
12197 | } | ||
12194 | DBG(("%s: dropping last-cpu hint\n", __FUNCTION__)); | 12198 | DBG(("%s: dropping last-cpu hint\n", __FUNCTION__)); |
12195 | priv->cpu = false; | 12199 | priv->cpu = false; |
12196 | } | 12200 | } |
@@ -12209,6 +12213,8 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect) | |||
12209 | DBG(("%s: not using GPU, hint=%x\n", __FUNCTION__, hint)); | 12213 | DBG(("%s: not using GPU, hint=%x\n", __FUNCTION__, hint)); |
12210 | goto fallback; | 12214 | goto fallback; |
12211 | } | 12215 | } |
12216 | if (hint & REPLACES) | ||
12217 | kgem_bo_undo(&sna->kgem, bo); | ||
12212 | 12218 | ||
12213 | if (gc_is_solid(gc, &color)) { | 12219 | if (gc_is_solid(gc, &color)) { |
12214 | DBG(("%s: solid fill [%08x], testing for blt\n", | 12220 | DBG(("%s: solid fill [%08x], testing for blt\n", |
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c index ae63e683..17cc68c1 100644 --- a/src/sna/sna_composite.c +++ b/src/sna/sna_composite.c | |||
@@ -933,8 +933,9 @@ sna_composite_rectangles(CARD8 op, | |||
933 | sna_damage_destroy(&priv->cpu_damage); | 933 | sna_damage_destroy(&priv->cpu_damage); |
934 | list_del(&priv->flush_list); | 934 | list_del(&priv->flush_list); |
935 | } | 935 | } |
936 | if (region_subsumes_drawable(®ion, &pixmap->drawable) || | 936 | if (region_subsumes_drawable(®ion, &pixmap->drawable)) |
937 | box_inplace(pixmap, ®ion.extents)) { | 937 | hint |= REPLACES; |
938 | if (hint & REPLACES || box_inplace(pixmap, ®ion.extents)) { | ||
938 | DBG(("%s: promoting to full GPU\n", __FUNCTION__)); | 939 | DBG(("%s: promoting to full GPU\n", __FUNCTION__)); |
939 | if (priv->gpu_bo && priv->cpu_damage == NULL) { | 940 | if (priv->gpu_bo && priv->cpu_damage == NULL) { |
940 | assert(priv->gpu_bo->proxy == NULL); | 941 | assert(priv->gpu_bo->proxy == NULL); |
@@ -958,6 +959,8 @@ sna_composite_rectangles(CARD8 op, | |||
958 | DBG(("%s: fallback due to no GPU bo\n", __FUNCTION__)); | 959 | DBG(("%s: fallback due to no GPU bo\n", __FUNCTION__)); |
959 | goto fallback; | 960 | goto fallback; |
960 | } | 961 | } |
962 | if (hint & REPLACES) | ||
963 | kgem_bo_undo(&sna->kgem, bo); | ||
961 | 964 | ||
962 | if (!sna->render.fill_boxes(sna, op, dst->format, color, | 965 | if (!sna->render.fill_boxes(sna, op, dst->format, color, |
963 | pixmap, bo, boxes, num_boxes)) { | 966 | pixmap, bo, boxes, num_boxes)) { |