sna: Undo the clone when replacing the DRI pixmap

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-05-17 11:30:03 +01:00
parent 8d31fe771b
commit ee166ca856
3 changed files with 9 additions and 3 deletions

View File

@ -451,6 +451,9 @@ PixmapPtr sna_pixmap_create_unattached(ScreenPtr screen,
int width, int height, int depth);
void sna_pixmap_destroy(PixmapPtr pixmap);
bool
sna_pixmap_undo_cow(struct sna *sna, struct sna_pixmap *priv, unsigned flags);
#define MOVE_WRITE 0x1
#define MOVE_READ 0x2
#define MOVE_INPLACE_HINT 0x4

View File

@ -1538,7 +1538,7 @@ static inline bool use_cpu_bo_for_upload(struct sna *sna,
return kgem_bo_is_busy(priv->gpu_bo) || kgem_bo_is_busy(priv->cpu_bo);
}
static bool
bool
sna_pixmap_undo_cow(struct sna *sna, struct sna_pixmap *priv, unsigned flags)
{
struct sna_cow *cow = COW(priv->cow);

View File

@ -505,11 +505,13 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
assert(pixmap->drawable.height * bo->pitch <= kgem_bo_size(bo));
assert(bo->proxy == NULL);
assert(bo->flush);
assert(priv->cow == NULL);
assert(priv->pinned & PIN_DRI);
assert((priv->pinned & PIN_PRIME) == 0);
assert(priv->flush);
if (priv->cow)
sna_pixmap_undo_cow(sna, priv, 0);
/* Post damage on the new front buffer so that listeners, such
* as DisplayLink know take a copy and shove it over the USB,
* also for software cursors and the like.
@ -529,7 +531,8 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
assert(bo->refcnt);
if (priv->gpu_bo != bo) {
kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
if (priv->gpu_bo)
kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
priv->gpu_bo = ref(bo);
if (priv->mapped) {
assert(!priv->shm && priv->stride);