From 4d20798c7871ffe8581e2cf509b6aa2e40b3ae5f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 12 Dec 2011 10:10:16 +0000 Subject: 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 --- src/sna/sna.h | 1 - src/sna/sna_accel.c | 34 +++++++++++++++------------------- 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); -- cgit v1.2.3