summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-09-22 12:18:26 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-09-22 12:28:57 +0100
commit12070b8eb1e98cb158802fff3e59f906b1547877 (patch)
treef67fbb1bb00dcf5db572767e6914fbe9248b4996
parent902a0234191d77816259affe331339caaa9131d6 (diff)
sna/dri: Play with marking bo reusable
Since we have no recycling of wc pages in the kernel, we try hard to recycle buffers in userspace to avoid GTT thrashing. This requires co-operation between DRI clients and X, which is sadly lacking and so we need to discard any buffer given out to a client after it is finished. We cheat slightly for page-flips and access to the scanout. A further compromise. References: https://bugs.freedesktop.org/show_bug.cgi?id=38732 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_dri.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index e9054477..5bb10448 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -154,6 +154,7 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
/* The bo is outside of our control, so presume it is written to */
priv->gpu_bo->needs_flush = 1;
+ priv->gpu_bo->reusable = false;
/* We need to submit any modifications to and reads from this
* buffer before we send any reply to the Client.
@@ -202,6 +203,7 @@ sna_dri_create_buffer(DrawablePtr drawable,
pixmap = get_drawable_pixmap(drawable);
pixmap->refcnt++;
bo = sna_pixmap_set_dri(sna, pixmap);
+ bo->reusable = true;
bpp = pixmap->drawable.bitsPerPixel;
DBG(("%s: attaching to front buffer %dx%d [%p:%d]\n",
__FUNCTION__,
@@ -942,6 +944,7 @@ static void set_pixmap(struct sna *sna, DRI2BufferPtr buffer, PixmapPtr pixmap)
priv->pixmap->refcnt--;
priv->pixmap = pixmap;
priv->bo = sna_pixmap_set_dri(sna, pixmap);
+ priv->bo->reusable = true;
buffer->name = kgem_bo_flink(&sna->kgem, priv->bo);
buffer->pitch = priv->bo->pitch;
}