summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-07-19 19:51:46 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-07-20 07:28:43 +0100
commitb83011909aaf185f05fc2df743882c2410eff46d (patch)
treea05491c3009f301c3351b63b14b40a100529dde6
parent88bee3caeaacbbb1b4d789ea3db9a3802a62b59d (diff)
sna: Replace 'sync' flag with equivalent 'flush'
The only difference is in semantics. Currently 'sync' was only used on CPU buffers for shared memory segments with 2D clients, and 'flush' on GPU buffers shared with DRI clients. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c24
-rw-r--r--src/sna/kgem.h2
-rw-r--r--src/sna/sna_accel.c39
3 files changed, 25 insertions, 40 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index f80690da..eeb67740 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1104,9 +1104,6 @@ void _kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo)
/* XXX is it worth working around gcc here? */
kgem->flush |= bo->flush;
-
- if (bo->sync)
- kgem->sync = kgem->next_request;
}
static uint32_t kgem_end_batch(struct kgem *kgem)
@@ -1650,9 +1647,6 @@ static bool kgem_retire__requests(struct kgem *kgem)
}
}
- if (kgem->sync == rq)
- kgem->sync = NULL;
-
_list_del(&rq->list);
free(rq);
}
@@ -3853,31 +3847,23 @@ void kgem_bo_sync__gtt(struct kgem *kgem, struct kgem_bo *bo)
void kgem_bo_set_sync(struct kgem *kgem, struct kgem_bo *bo)
{
+ assert(bo->vmap);
assert(!bo->reusable);
assert(list_is_empty(&bo->list));
list_add(&bo->list, &kgem->sync_list);
- bo->sync = true;
+ bo->flush = true;
}
void kgem_sync(struct kgem *kgem)
{
- struct kgem_request *rq;
struct kgem_bo *bo;
DBG(("%s\n", __FUNCTION__));
- rq = kgem->sync;
- if (rq == NULL)
- return;
-
- if (rq == kgem->next_request)
- _kgem_submit(kgem);
-
- kgem_bo_sync__gtt(kgem, rq->bo);
- list_for_each_entry(bo, &kgem->sync_list, list)
+ list_for_each_entry(bo, &kgem->sync_list, list) {
+ kgem_bo_submit(kgem, bo);
kgem_bo_sync__cpu(kgem, bo);
-
- assert(kgem->sync == NULL);
+ }
}
void kgem_clear_dirty(struct kgem *kgem)
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 0117dcdb..bd1219ab 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -86,7 +86,6 @@ struct kgem_bo {
uint32_t io : 1;
uint32_t flush : 1;
uint32_t scanout : 1;
- uint32_t sync : 1;
uint32_t purged : 1;
};
#define DOMAIN_NONE 0
@@ -130,7 +129,6 @@ struct kgem {
struct list requests;
struct list sync_list;
struct kgem_request *next_request;
- struct kgem_request *sync;
struct {
struct list inactive[NUM_CACHE_BUCKETS];
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index f52c848d..6ec982eb 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -468,7 +468,7 @@ static void sna_pixmap_free_cpu(struct sna *sna, struct sna_pixmap *priv)
sna->debug_memory.cpu_bo_allocs--;
sna->debug_memory.cpu_bo_bytes -= kgem_bo_size(priv->cpu_bo);
#endif
- if (priv->cpu_bo->sync) {
+ if (priv->cpu_bo->flush) {
kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo);
sna_accel_watch_flush(sna, -1);
}
@@ -1190,7 +1190,7 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
priv->cpu = false;
list_del(&priv->list);
if (priv->cpu_bo) {
- assert(!priv->cpu_bo->sync);
+ assert(!priv->cpu_bo->flush);
sna_pixmap_free_cpu(sna, priv);
}
@@ -1200,7 +1200,7 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
skip_inplace_map:
sna_damage_destroy(&priv->gpu_damage);
- if (priv->cpu_bo && !priv->cpu_bo->sync && kgem_bo_is_busy(priv->cpu_bo)) {
+ if (priv->cpu_bo && !priv->cpu_bo->flush && kgem_bo_is_busy(priv->cpu_bo)) {
if (priv->cpu_bo->exec == NULL)
kgem_retire(&sna->kgem);
@@ -1262,7 +1262,7 @@ skip_inplace_map:
}
if (priv->clear) {
- if (priv->cpu_bo && !priv->cpu_bo->sync && kgem_bo_is_busy(priv->cpu_bo))
+ if (priv->cpu_bo && !priv->cpu_bo->flush && kgem_bo_is_busy(priv->cpu_bo))
sna_pixmap_free_cpu(sna, priv);
sna_damage_destroy(&priv->gpu_damage);
}
@@ -1333,8 +1333,10 @@ skip_inplace_map:
sna_pixmap_free_gpu(sna, priv);
priv->undamaged = false;
- if (priv->flush)
+ if (priv->flush) {
list_move(&priv->list, &sna->dirty_pixmaps);
+ sna->kgem.flush |= 1;
+ }
}
done:
@@ -1609,7 +1611,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
}
}
- if (priv->cpu_bo && !priv->cpu_bo->sync) {
+ if (priv->cpu_bo && !priv->cpu_bo->flush) {
if (sync_will_stall(priv->cpu_bo) && priv->cpu_bo->exec == NULL)
kgem_retire(&sna->kgem);
if (sync_will_stall(priv->cpu_bo)) {
@@ -1971,8 +1973,10 @@ done:
}
priv->undamaged = false;
}
- if (priv->flush)
+ if (priv->flush) {
list_move(&priv->list, &sna->dirty_pixmaps);
+ sna->kgem.flush |= 1;
+ }
}
if (dx | dy)
@@ -2762,7 +2766,7 @@ done:
if (DAMAGE_IS_ALL(priv->gpu_damage)) {
priv->undamaged = false;
if (priv->ptr) {
- assert(priv->cpu_bo == NULL || !priv->cpu_bo->sync);
+ assert(priv->cpu_bo == NULL || !priv->cpu_bo->flush);
sna_pixmap_free_cpu(sna, priv);
}
}
@@ -3177,7 +3181,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
if (sync_will_stall(priv->cpu_bo) && priv->cpu_bo->exec == NULL)
kgem_retire(&sna->kgem);
if (sync_will_stall(priv->cpu_bo)) {
- if (priv->cpu_bo->sync) {
+ if (priv->cpu_bo->flush) {
if (sna_put_image_upload_blt(drawable, gc, region,
x, y, w, h, bits, stride)) {
if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
@@ -3221,7 +3225,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
list_del(&priv->list);
priv->undamaged = false;
}
- assert(!priv->cpu_bo->sync);
+ assert(!priv->cpu_bo->flush);
sna_pixmap_free_cpu(sna, priv);
}
}
@@ -3291,8 +3295,10 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
priv->undamaged = false;
}
}
- if (priv->flush)
+ if (priv->flush) {
list_move(&priv->list, &sna->dirty_pixmaps);
+ sna->kgem.flush |= 1;
+ }
}
priv->cpu = true;
@@ -12428,13 +12434,8 @@ sna_accel_flush_callback(CallbackListPtr *list,
* by checking for outgoing damage events or sync replies. Tricky,
* and doesn't appear to mitigate the performance loss.
*/
- if (!(sna->kgem.flush ||
- sna->kgem.sync ||
- !list_is_empty(&sna->dirty_pixmaps)))
- return;
-
- DBG(("%s: need_sync=%d, need_flush=%d, dirty? %d\n", __FUNCTION__,
- sna->kgem.sync!=NULL, sna->kgem.flush, !list_is_empty(&sna->dirty_pixmaps)));
+ if (!sna->kgem.flush)
+ return;
/* flush any pending damage from shadow copies to tfp clients */
list_init(&preserve);
@@ -12766,7 +12767,7 @@ static void sna_accel_inactive(struct sna *sna)
sna_damage_destroy(&priv->cpu_damage);
list_del(&priv->list);
- assert(priv->cpu_bo == NULL || !priv->cpu_bo->sync);
+ assert(priv->cpu_bo == NULL || !priv->cpu_bo->flush);
sna_pixmap_free_cpu(sna, priv);
priv->undamaged = false;
priv->cpu = false;