diff options
authorChris Wilson <>2011-09-22 12:18:26 +0100
committerChris Wilson <>2011-09-22 12:28:57 +0100
commit12070b8eb1e98cb158802fff3e59f906b1547877 (patch)
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: Signed-off-by: Chris Wilson <>
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);
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",
@@ -942,6 +944,7 @@ static void set_pixmap(struct sna *sna, DRI2BufferPtr buffer, PixmapPtr pixmap)
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;