summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-05-17 11:30:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-05-17 11:30:46 +0100
commitee166ca856ac02ca8900b9ff44ed3899add2c72a (patch)
tree10646f951a7ce170f9fa3a51ffd0e1e61aa1aa29 /src
parent8d31fe771b423a3768cbd05db994d49e941369e1 (diff)
sna: Undo the clone when replacing the DRI pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna.h3
-rw-r--r--src/sna/sna_accel.c2
-rw-r--r--src/sna/sna_dri.c7
3 files changed, 9 insertions, 3 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index c8a954dc..aed3e08b 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -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
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index b3dca97a..7e3c0bb6 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -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);
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 99f9d125..06d1f214 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -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);