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>
This commit is contained in:
Chris Wilson 2011-12-12 10:10:16 +00:00
parent 2682308c10
commit 4d20798c78
2 changed files with 16 additions and 21 deletions

View File

@ -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;

View File

@ -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;
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);
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);
}
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);