xf86-video-intel: 4 commits - src/sna/kgem.c src/sna/sna_accel.c src/sna/sna_dri.c src/sna/sna.h
Chris Wilson
ickle at kemper.freedesktop.org
Mon Feb 11 03:18:44 PST 2013
src/sna/kgem.c | 5 ++++
src/sna/sna.h | 3 --
src/sna/sna_accel.c | 1
src/sna/sna_dri.c | 60 ++++++++++++++++++++++++++++++----------------------
4 files changed, 42 insertions(+), 27 deletions(-)
New commits:
commit 3540554e5a74ccd2ca746482700a9f5657954227
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Feb 11 11:14:17 2013 +0000
sna/dri: Couple up the flush pixmap after checking for allocation failures
Tidy up the error path not to leave the GPU bo pinned and marked for
flushing.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 85c2e33..7ad83fc 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -186,17 +186,6 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
if (priv->gpu_bo->tiling != tiling)
sna_pixmap_change_tiling(pixmap, tiling);
- /* We need to submit any modifications to and reads from this
- * buffer before we send any reply to the Client.
- *
- * As we don't track which Client, we flush for all.
- */
- priv->flush = true;
- sna_accel_watch_flush(sna, 1);
-
- /* Don't allow this named buffer to be replaced */
- priv->pinned |= PIN_DRI;
-
return priv->gpu_bo;
}
@@ -380,10 +369,29 @@ sna_dri_create_buffer(DrawablePtr draw,
goto err;
if (pixmap) {
+ struct sna_pixmap *priv;
+
assert(attachment == DRI2BufferFrontLeft);
+ assert(sna_pixmap_get_buffer(pixmap) == NULL);
+
sna_pixmap_set_buffer(pixmap, buffer);
assert(sna_pixmap_get_buffer(pixmap) == buffer);
pixmap->refcnt++;
+
+ priv = sna_pixmap(pixmap);
+ assert(priv->flush == false);
+ assert((priv->pinned & PIN_DRI) == 0);
+
+ /* Don't allow this named buffer to be replaced */
+ priv->pinned |= PIN_DRI;
+
+ /* We need to submit any modifications to and reads from this
+ * buffer before we send any reply to the Client.
+ *
+ * As we don't track which Client, we flush for all.
+ */
+ priv->flush = true;
+ sna_accel_watch_flush(sna, 1);
}
assert(bo->flush == true);
commit 58b61bcd02467d2b08b2dd194ab6884437b83fa6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Feb 11 11:05:02 2013 +0000
sna/dri: Tighten the assertions that we have one DRI2Buffer per Pixmap
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna.h b/src/sna/sna.h
index b470c48..a51e6a1 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -118,8 +118,6 @@ struct sna_pixmap {
uint32_t stride;
uint32_t clear_color;
- uint32_t flush;
-
#define SOURCE_BIAS 4
uint16_t source_count;
uint8_t pinned :3;
@@ -128,6 +126,7 @@ struct sna_pixmap {
#define PIN_PRIME 0x4
uint8_t create :4;
uint8_t mapped :1;
+ uint8_t flush :1;
uint8_t shm :1;
uint8_t clear :1;
uint8_t header :1;
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index cd02db3..85c2e33 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -175,13 +175,10 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
return NULL;
}
+ assert(priv->flush == false);
assert(priv->cpu_damage == NULL);
assert(priv->gpu_bo->proxy == NULL);
- if (priv->flush++) {
- assert(priv->gpu_bo->flush);
- assert(priv->pinned & PIN_DRI);
- return priv->gpu_bo;
- }
+ assert(priv->gpu_bo->flush == false);
tiling = color_tiling(sna, &pixmap->drawable);
if (tiling < 0)
@@ -194,6 +191,7 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
*
* As we don't track which Client, we flush for all.
*/
+ priv->flush = true;
sna_accel_watch_flush(sna, 1);
/* Don't allow this named buffer to be replaced */
@@ -414,19 +412,23 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer)
PixmapPtr pixmap = private->pixmap;
struct sna_pixmap *priv = sna_pixmap(pixmap);
+ assert(sna_pixmap_get_buffer(pixmap) == buffer);
assert(priv->gpu_bo == private->bo);
+ assert(priv->flush);
/* Undo the DRI markings on this pixmap */
- if (priv->flush && --priv->flush == 0) {
- DBG(("%s: releasing last DRI pixmap=%ld, scanout?=%d\n",
- __FUNCTION__,
- pixmap->drawable.serialNumber,
- pixmap == sna->front));
- list_del(&priv->list);
- priv->gpu_bo->flush = 0;
- priv->pinned &= ~PIN_DRI;
- sna_accel_watch_flush(sna, -1);
- }
+ DBG(("%s: releasing last DRI pixmap=%ld, scanout?=%d\n",
+ __FUNCTION__,
+ pixmap->drawable.serialNumber,
+ pixmap == sna->front));
+
+ list_del(&priv->list);
+
+ priv->gpu_bo->flush = false;
+ priv->pinned &= ~PIN_DRI;
+
+ priv->flush = false;
+ sna_accel_watch_flush(sna, -1);
sna_pixmap_set_buffer(pixmap, NULL);
pixmap->drawable.pScreen->DestroyPixmap(pixmap);
commit a13f806ae28459a5cf671ccbf9cc8725f541a4ba
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Feb 11 10:50:20 2013 +0000
sna: Assert that we do not destroy a GPU bo for an active DRI pixmap
This is an extra paranoid check that the bo is still pinned.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 827dcf4..d571b91 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -404,6 +404,7 @@ static void sna_pixmap_free_gpu(struct sna *sna, struct sna_pixmap *priv)
priv->clear = false;
if (priv->gpu_bo && !priv->pinned) {
+ assert(!priv->flush);
kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
priv->gpu_bo = NULL;
}
commit c2eb2db83280ae45b8df8a3b6e488b6a1404391a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Feb 11 10:47:13 2013 +0000
sna: Avoid stalling for changing cache levels on an active scanout
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 86a2dfc..622794c 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1596,6 +1596,8 @@ inline static void kgem_bo_remove_from_active(struct kgem *kgem,
static void kgem_bo_clear_scanout(struct kgem *kgem, struct kgem_bo *bo)
{
assert(bo->scanout);
+ assert(!bo->refcnt);
+ assert(bo->exec == NULL);
assert(bo->proxy == NULL);
DBG(("%s: handle=%d, fb=%d (reusable=%d)\n",
@@ -2781,6 +2783,9 @@ bool kgem_expire_cache(struct kgem *kgem)
while (!list_is_empty(&kgem->scanout)) {
bo = list_first_entry(&kgem->scanout, struct kgem_bo, list);
+ if (__kgem_busy(kgem, bo->handle))
+ break;
+
list_del(&bo->list);
kgem_bo_clear_scanout(kgem, bo);
__kgem_bo_destroy(kgem, bo);
More information about the xorg-commit
mailing list