summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-20 00:29:52 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-20 11:15:01 +0100
commit3526d83e460ce6410f23f59d1315793ff9607253 (patch)
tree48c9f4543f2afdfa3c1c2de33bac35f87072b409
parent50b980f12e02401cdd4bc21b970d92e7bd1e6459 (diff)
sna/dri: Perform a little dance to restore the gpu status on release of the bo
As the bo is outside of our control whilst it is under the influence of an external renderer, we try to maintain it on the gpu so as to avoid unnecessary ping-pong. But once it is wholly back under our control, we want to stop paying the penalty for sharing it. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c1
-rw-r--r--src/sna/sna_dri.c13
2 files changed, 12 insertions, 2 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index ed0e12ff..d5084f87 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -105,7 +105,6 @@ static void kgem_sna_flush(struct kgem *kgem)
sna_render_flush_solid(sna);
}
-
static int gem_set_tiling(int fd, uint32_t handle, int tiling, int stride)
{
struct drm_i915_gem_set_tiling set_tiling;
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index ae4f1fa8..65fec47a 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -153,8 +153,9 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
list_add(&priv->list, &sna->dirty_pixmaps);
/* The bo is outside of our control, so presume it is written to */
- priv->gpu_bo->needs_flush = 1;
+ priv->gpu_bo->needs_flush = true;
priv->gpu_bo->reusable = false;
+ priv->gpu_bo->gpu = true;
/* We need to submit any modifications to and reads from this
* buffer before we send any reply to the Client.
@@ -317,8 +318,18 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer)
struct sna_dri_private *private = buffer->driverPrivate;
if (--private->refcnt == 0) {
+ private->bo->gpu = private->bo->needs_flush || private->bo->rq != NULL;
+ private->bo->flush = 0;
+
if (private->pixmap) {
ScreenPtr screen = private->pixmap->drawable.pScreen;
+ struct sna_pixmap *priv = sna_pixmap(private->pixmap);
+
+ /* Undo the DRI markings on this pixmap */
+ list_del(&priv->list);
+ priv->pinned = private->pixmap == sna->front;
+ priv->flush = 0;
+
screen->DestroyPixmap(private->pixmap);
} else
kgem_bo_destroy(&sna->kgem, private->bo);