summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-22 22:23:41 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-22 23:36:33 +0000
commit281f620573917faef52d9226b12737ce1e2dffdc (patch)
treed3780266353d7f9bff1ef69187372192fa1b745f
parentf8575b8bd150ae11147fbf6b59171cbbb072dfec (diff)
sna: Age active wholly damaged GPU buffers more slowly
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index b1d11979..910d32ee 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -9096,7 +9096,7 @@ sna_pixmap_free_gpu(struct sna *sna, struct sna_pixmap *priv)
static void sna_accel_inactive(struct sna *sna)
{
- struct sna_pixmap *priv, *next;
+ struct sna_pixmap *priv;
struct list preserve;
DBG(("%s (time=%ld)\n", __FUNCTION__, (long)GetTimeInMillis()));
@@ -9128,18 +9128,8 @@ static void sna_accel_inactive(struct sna *sna)
}
#endif
- list_init(&preserve);
- list_for_each_entry_safe(priv, next, &sna->active_pixmaps, inactive) {
- if (priv->ptr &&
- sna_damage_is_all(&priv->gpu_damage,
- priv->pixmap->drawable.width,
- priv->pixmap->drawable.height)) {
- sna_pixmap_free_cpu(sna, priv);
- list_move(&priv->inactive, &preserve);
- }
- }
-
/* clear out the oldest inactive pixmaps */
+ list_init(&preserve);
while (!list_is_empty(&sna->inactive_clock[1])) {
priv = list_first_entry(&sna->inactive_clock[1],
struct sna_pixmap,
@@ -9149,7 +9139,18 @@ static void sna_accel_inactive(struct sna *sna)
* reap its storage only under memory pressure.
*/
list_del(&priv->inactive);
- if (!priv->pinned) {
+ if (priv->pinned)
+ continue;
+
+ if (priv->ptr &&
+ sna_damage_is_all(&priv->gpu_damage,
+ priv->pixmap->drawable.width,
+ priv->pixmap->drawable.height)) {
+ DBG(("%s: discarding inactive CPU shadow\n",
+ __FUNCTION__));
+ sna_pixmap_free_cpu(sna, priv);
+ list_add(&priv->inactive, &preserve);
+ } else {
DBG(("%s: discarding inactive GPU bo handle=%d\n",
__FUNCTION__, priv->gpu_bo->handle));
if (!sna_pixmap_free_gpu(sna, priv))