diff options
author | Russell King <rmk@armlinux.org.uk> | 2017-02-12 19:32:24 +0000 |
---|---|---|
committer | Russell King <rmk@armlinux.org.uk> | 2017-02-12 23:22:38 +0000 |
commit | eceb5ce594f619115d48b0d34c0e6ac116e5695c (patch) | |
tree | 82a38fb14ce19a562298cf336890f40aa10b986f | |
parent | a7fbdc5e1a841781863738426f611dfa45ada168 (diff) |
etnaviv: remove busy_free_list
Rather than using the busy_free_list, use the refcounting on the
etnaviv pixmap to control their lifetime. This means that we will
automatically free them when they are retired from the batch without
having to place them on lists.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r-- | etnaviv/etnaviv.c | 63 | ||||
-rw-r--r-- | etnaviv/etnaviv_accel.c | 3 | ||||
-rw-r--r-- | etnaviv/etnaviv_accel.h | 3 |
3 files changed, 11 insertions, 58 deletions
diff --git a/etnaviv/etnaviv.c b/etnaviv/etnaviv.c index 1c96a1e..1809269 100644 --- a/etnaviv/etnaviv.c +++ b/etnaviv/etnaviv.c @@ -83,18 +83,6 @@ static void etnaviv_put_vpix(struct etnaviv *etnaviv, etnaviv_free_vpix(etnaviv, vPix); } -void etnaviv_free_busy_vpix(struct etnaviv *etnaviv) -{ - struct etnaviv_pixmap *i, *n; - - xorg_list_for_each_entry_safe(i, n, &etnaviv->busy_free_list, busy_node) { - if (i->batch_state == B_NONE) { - xorg_list_del(&i->busy_node); - etnaviv_put_vpix(etnaviv, i); - } - } -} - void etnaviv_retire_vpix(struct etnaviv *etnaviv, struct etnaviv_pixmap *vpix) { xorg_list_del(&vpix->batch_node); @@ -159,35 +147,12 @@ static void etnaviv_free_pixmap(PixmapPtr pixmap) etnaviv = etnaviv_get_screen_priv(pixmap->drawable.pScreen); - switch (vPix->batch_state) { - case B_NONE: - /* - * The pixmap may be only on the CPU, or it may be on - * the GPU but we have already seen a commit+stall. - * We can just free this pixmap. - */ - etnaviv_put_vpix(etnaviv, vPix); - break; - - case B_FENCED: - /* - * The pixmap is part of a batch of submitted GPU - * operations. Check whether it has completed. - */ - if (VIV_FENCE_BEFORE_EQ(vPix->fence, etnaviv->last_fence)) { - etnaviv_retire_vpix(etnaviv, vPix); - etnaviv_put_vpix(etnaviv, vPix); - break; - } - - case B_PENDING: - /* - * The pixmap is part of a batch of unsubmitted GPU - * operations. Place it on the busy_free_list. - */ - xorg_list_append(&vPix->busy_node, &etnaviv->busy_free_list); - break; - } + /* + * Put the pixmap - if it's on one of the batch or fence + * lists, they will hold a refcount, which will be dropped + * once the GPU operation is complete. + */ + etnaviv_put_vpix(etnaviv, vPix); } } @@ -843,18 +808,13 @@ static void etnaviv_BlockHandler(BLOCKHANDLER_ARGS_DECL) /* * Check for any completed fences. If the fence numberspace * wraps, it can allow an idle pixmap to become "active" again. - * This prevents that occuring. + * This prevents that occuring. Periodically check for completed + * fences. */ - if (!xorg_list_is_empty(&etnaviv->fence_head)) - etnaviv_finish_fences(etnaviv, etnaviv->last_fence); - - /* - * And now try to expire any remaining busy-free pixmaps - */ - if (!xorg_list_is_empty(&etnaviv->busy_free_list)) { + if (!xorg_list_is_empty(&etnaviv->fence_head)) { UpdateCurrentTimeIf(); - etnaviv_free_busy_vpix(etnaviv); - if (!xorg_list_is_empty(&etnaviv->busy_free_list)) { + etnaviv_finish_fences(etnaviv, etnaviv->last_fence); + if (!xorg_list_is_empty(&etnaviv->fence_head)) { etnaviv->cache_timer = TimerSet(etnaviv->cache_timer, 0, 500, etnaviv_cache_expire, @@ -929,7 +889,6 @@ static Bool etnaviv_ScreenInit(ScreenPtr pScreen, struct drm_armada_bufmgr *mgr) xorg_list_init(&etnaviv->batch_head); xorg_list_init(&etnaviv->fence_head); - xorg_list_init(&etnaviv->busy_free_list); xorg_list_init(&etnaviv->usermem_free_list); etnaviv_set_screen_priv(pScreen, etnaviv); diff --git a/etnaviv/etnaviv_accel.c b/etnaviv/etnaviv_accel.c index 3508cc7..a08db0e 100644 --- a/etnaviv/etnaviv_accel.c +++ b/etnaviv/etnaviv_accel.c @@ -227,7 +227,6 @@ void etnaviv_commit(struct etnaviv *etnaviv, Bool stall, uint32_t *fence) */ etnaviv->last_fence = *fence; etnaviv_finish_fences(etnaviv, *fence); - etnaviv_free_busy_vpix(etnaviv); } else if (fence) { uint32_t fence_val = *fence; @@ -1075,8 +1074,6 @@ void etnaviv_accel_shutdown(struct etnaviv *etnaviv) batch_node) etnaviv_retire_vpix(etnaviv, i); - etnaviv_free_busy_vpix(etnaviv); - if (etnaviv->gc320_etna_bo) etna_bo_del(etnaviv->conn, etnaviv->gc320_etna_bo, NULL); diff --git a/etnaviv/etnaviv_accel.h b/etnaviv/etnaviv_accel.h index 6928361..8f54177 100644 --- a/etnaviv/etnaviv_accel.h +++ b/etnaviv/etnaviv_accel.h @@ -82,7 +82,6 @@ struct etnaviv { struct xorg_list batch_head; /* pixmaps committed with fence id, ordered by id */ struct xorg_list fence_head; - struct xorg_list busy_free_list; struct xorg_list usermem_free_list; OsTimerPtr cache_timer; uint32_t last_fence; @@ -147,7 +146,6 @@ struct etnaviv_pixmap { struct etnaviv_format format; struct etnaviv_format pict_format; struct xorg_list batch_node; - struct xorg_list busy_node; uint32_t fence; viv_usermem_t info; @@ -228,7 +226,6 @@ Bool etnaviv_accel_PolyFillRectTiled(DrawablePtr pDrawable, GCPtr pGC, int n, void etnaviv_commit(struct etnaviv *etnaviv, Bool stall, uint32_t *fence); void etnaviv_finish_fences(struct etnaviv *etnaviv, uint32_t fence); -void etnaviv_free_busy_vpix(struct etnaviv *etnaviv); void etnaviv_batch_wait_commit(struct etnaviv *etnaviv, struct etnaviv_pixmap *vPix); void etnaviv_batch_start(struct etnaviv *etnaviv, |