summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-12 10:10:16 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-12 10:13:20 +0000
commit4d20798c7871ffe8581e2cf509b6aa2e40b3ae5f (patch)
tree7472b8158555756516e3e96d06d714071a1e1e75
parent2682308c10c9622247409dee9c6bb6a862b73c3f (diff)
sna: We need to remap the gpu_only mmap prior to every use
Since the VMA may be reaped at any time whilst the mapping is idle. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna.h1
-rw-r--r--src/sna/sna_accel.c34
2 files changed, 15 insertions, 20 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 3c5d56b3..ad8a0838 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -139,7 +139,6 @@ struct sna_pixmap {
#define SOURCE_BIAS 4
uint16_t source_count;
- uint8_t mapped :1;
uint8_t pinned :1;
uint8_t gpu_only :1;
uint8_t flush :1;
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index a71d5e1e..f6ac635e 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -204,7 +204,6 @@ static Bool sna_destroy_private(PixmapPtr pixmap, struct sna_pixmap *priv)
sna->freed_pixmap = pixmap;
priv->gpu_bo = NULL;
priv->cpu_bo = NULL;
- priv->mapped = 0;
return false;
}
@@ -486,27 +485,25 @@ static void sna_pixmap_map_to_cpu(struct sna *sna,
PixmapPtr pixmap,
struct sna_pixmap *priv)
{
+ ScreenPtr screen = pixmap->drawable.pScreen;
+ void *ptr;
+
DBG(("%s: AWOOGA, AWOOGA!\n", __FUNCTION__));
- if (priv->mapped == 0) {
- ScreenPtr screen = pixmap->drawable.pScreen;
- void *ptr;
+ kgem_bo_submit(&sna->kgem, priv->gpu_bo);
- ptr = kgem_bo_map(&sna->kgem,
- priv->gpu_bo,
- PROT_READ | PROT_WRITE);
- assert(ptr != NULL);
+ ptr = kgem_bo_map(&sna->kgem,
+ priv->gpu_bo,
+ PROT_READ | PROT_WRITE);
+ assert(ptr != NULL);
- screen->ModifyPixmapHeader(pixmap,
- pixmap->drawable.width,
- pixmap->drawable.height,
- pixmap->drawable.depth,
- pixmap->drawable.bitsPerPixel,
- priv->gpu_bo->pitch,
- ptr);
- priv->mapped = 1;
- }
- kgem_bo_submit(&sna->kgem, priv->gpu_bo);
+ screen->ModifyPixmapHeader(pixmap,
+ pixmap->drawable.width,
+ pixmap->drawable.height,
+ pixmap->drawable.depth,
+ pixmap->drawable.bitsPerPixel,
+ priv->gpu_bo->pitch,
+ ptr);
}
static inline void list_move(struct list *list, struct list *head)
@@ -995,7 +992,6 @@ sna_pixmap_create_upload(ScreenPtr screen,
priv->cpu_damage = priv->gpu_damage = NULL;
priv->gpu_only = 0;
priv->pinned = 0;
- priv->mapped = 0;
list_init(&priv->list);
list_init(&priv->inactive);