sna: Assert that we do not create a proxy with existent GPU damage
References: http://bugs.freedesktop.org/show_bug.cgi?id=47597 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
9ab1d1f94e
commit
03fb9ded43
|
|
@ -660,6 +660,7 @@ bool sna_pixmap_attach_to_bo(PixmapPtr pixmap, struct kgem_bo *bo)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
priv->gpu_bo = kgem_bo_reference(bo);
|
priv->gpu_bo = kgem_bo_reference(bo);
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
sna_damage_all(&priv->gpu_damage,
|
sna_damage_all(&priv->gpu_damage,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
@ -1468,6 +1469,7 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
|
||||||
}
|
}
|
||||||
pixmap->devKind = priv->gpu_bo->pitch;
|
pixmap->devKind = priv->gpu_bo->pitch;
|
||||||
|
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
sna_damage_all(&priv->gpu_damage,
|
sna_damage_all(&priv->gpu_damage,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
@ -1523,6 +1525,7 @@ skip_inplace_map:
|
||||||
priv->mapped = true;
|
priv->mapped = true;
|
||||||
pixmap->devKind = priv->gpu_bo->pitch;
|
pixmap->devKind = priv->gpu_bo->pitch;
|
||||||
if (flags & MOVE_WRITE) {
|
if (flags & MOVE_WRITE) {
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
sna_damage_all(&priv->gpu_damage,
|
sna_damage_all(&priv->gpu_damage,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
@ -2555,6 +2558,7 @@ done:
|
||||||
box_inplace(pixmap, &r.extents)) {
|
box_inplace(pixmap, &r.extents)) {
|
||||||
DBG(("%s: large operation on undamaged, promoting to full GPU\n",
|
DBG(("%s: large operation on undamaged, promoting to full GPU\n",
|
||||||
__FUNCTION__));
|
__FUNCTION__));
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
sna_damage_all(&priv->gpu_damage,
|
sna_damage_all(&priv->gpu_damage,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
@ -3014,6 +3018,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
|
||||||
|
|
||||||
if (flags & MOVE_WRITE && priv->gpu_bo && priv->gpu_bo->proxy) {
|
if (flags & MOVE_WRITE && priv->gpu_bo && priv->gpu_bo->proxy) {
|
||||||
DBG(("%s: discarding cached upload buffer\n", __FUNCTION__));
|
DBG(("%s: discarding cached upload buffer\n", __FUNCTION__));
|
||||||
|
assert(priv->gpu_damage == NULL);
|
||||||
kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
|
kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
|
||||||
priv->gpu_bo = NULL;
|
priv->gpu_bo = NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -3066,6 +3071,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
|
||||||
* synchronisation that takes the most time. This is
|
* synchronisation that takes the most time. This is
|
||||||
* mitigated by avoiding fallbacks in the first place.
|
* mitigated by avoiding fallbacks in the first place.
|
||||||
*/
|
*/
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
sna_damage_all(&priv->gpu_damage,
|
sna_damage_all(&priv->gpu_damage,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
@ -3078,6 +3084,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
|
||||||
if (priv->gpu_bo->proxy) {
|
if (priv->gpu_bo->proxy) {
|
||||||
DBG(("%s: reusing cached upload\n", __FUNCTION__));
|
DBG(("%s: reusing cached upload\n", __FUNCTION__));
|
||||||
assert((flags & MOVE_WRITE) == 0);
|
assert((flags & MOVE_WRITE) == 0);
|
||||||
|
assert(priv->gpu_damage == NULL);
|
||||||
return priv;
|
return priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3144,6 +3151,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
|
||||||
|
|
||||||
/* For large bo, try to keep only a single copy around */
|
/* For large bo, try to keep only a single copy around */
|
||||||
if (priv->create & KGEM_CAN_CREATE_LARGE) {
|
if (priv->create & KGEM_CAN_CREATE_LARGE) {
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
sna_damage_all(&priv->gpu_damage,
|
sna_damage_all(&priv->gpu_damage,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
@ -3540,6 +3548,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
|
||||||
else
|
else
|
||||||
sna_damage_subtract(&priv->cpu_damage, region);
|
sna_damage_subtract(&priv->cpu_damage, region);
|
||||||
if (priv->cpu_damage == NULL) {
|
if (priv->cpu_damage == NULL) {
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
sna_damage_all(&priv->gpu_damage,
|
sna_damage_all(&priv->gpu_damage,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
@ -3599,6 +3608,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(priv->cpu_damage == NULL);
|
assert(priv->cpu_damage == NULL);
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
sna_damage_all(&priv->gpu_damage,
|
sna_damage_all(&priv->gpu_damage,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
@ -4644,8 +4654,10 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
|
||||||
|
|
||||||
if (n == 1 &&
|
if (n == 1 &&
|
||||||
tmp->drawable.width == src_pixmap->drawable.width &&
|
tmp->drawable.width == src_pixmap->drawable.width &&
|
||||||
tmp->drawable.height == src_pixmap->drawable.height)
|
tmp->drawable.height == src_pixmap->drawable.height) {
|
||||||
|
assert(src_priv->gpu_damage);
|
||||||
kgem_proxy_bo_attach(src_bo, &src_priv->gpu_bo);
|
kgem_proxy_bo_attach(src_bo, &src_priv->gpu_bo);
|
||||||
|
}
|
||||||
|
|
||||||
if (!sna->render.copy_boxes(sna, alu,
|
if (!sna->render.copy_boxes(sna, alu,
|
||||||
tmp, src_bo, dx, dy,
|
tmp, src_bo, dx, dy,
|
||||||
|
|
@ -4703,6 +4715,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
|
||||||
|
|
||||||
dst_priv->cpu = false;
|
dst_priv->cpu = false;
|
||||||
if (damage) {
|
if (damage) {
|
||||||
|
assert(dst_priv->gpu_bo->proxy == NULL);
|
||||||
if (replaces) {
|
if (replaces) {
|
||||||
sna_damage_destroy(&dst_priv->cpu_damage);
|
sna_damage_destroy(&dst_priv->cpu_damage);
|
||||||
sna_damage_all(&dst_priv->gpu_damage,
|
sna_damage_all(&dst_priv->gpu_damage,
|
||||||
|
|
@ -9484,6 +9497,7 @@ sna_poly_fill_rect_blt(DrawablePtr drawable,
|
||||||
r.y2 - r.y1 == pixmap->drawable.height) {
|
r.y2 - r.y1 == pixmap->drawable.height) {
|
||||||
struct sna_pixmap *priv = sna_pixmap(pixmap);
|
struct sna_pixmap *priv = sna_pixmap(pixmap);
|
||||||
if (bo == priv->gpu_bo) {
|
if (bo == priv->gpu_bo) {
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
sna_damage_all(&priv->gpu_damage,
|
sna_damage_all(&priv->gpu_damage,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
@ -11925,6 +11939,7 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect)
|
||||||
box_inplace(pixmap, ®ion.extents))) {
|
box_inplace(pixmap, ®ion.extents))) {
|
||||||
DBG(("%s: promoting to full GPU\n", __FUNCTION__));
|
DBG(("%s: promoting to full GPU\n", __FUNCTION__));
|
||||||
if (priv->gpu_bo) {
|
if (priv->gpu_bo) {
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
sna_damage_all(&priv->gpu_damage,
|
sna_damage_all(&priv->gpu_damage,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,7 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(priv->cpu_damage == NULL);
|
assert(priv->cpu_damage == NULL);
|
||||||
|
assert(priv->gpu_bo->proxy == NULL);
|
||||||
if (priv->flush++)
|
if (priv->flush++)
|
||||||
return priv->gpu_bo;
|
return priv->gpu_bo;
|
||||||
|
|
||||||
|
|
@ -460,6 +461,7 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
|
||||||
|
|
||||||
assert(pixmap->drawable.width * pixmap->drawable.bitsPerPixel <= 8*bo->pitch);
|
assert(pixmap->drawable.width * pixmap->drawable.bitsPerPixel <= 8*bo->pitch);
|
||||||
assert(pixmap->drawable.height * bo->pitch <= kgem_bo_size(bo));
|
assert(pixmap->drawable.height * bo->pitch <= kgem_bo_size(bo));
|
||||||
|
assert(bo->proxy == NULL);
|
||||||
|
|
||||||
/* Post damage on the new front buffer so that listeners, such
|
/* Post damage on the new front buffer so that listeners, such
|
||||||
* as DisplayLink know take a copy and shove it over the USB,
|
* as DisplayLink know take a copy and shove it over the USB,
|
||||||
|
|
|
||||||
|
|
@ -515,8 +515,10 @@ static struct kgem_bo *upload(struct sna *sna,
|
||||||
if (priv &&
|
if (priv &&
|
||||||
pixmap->usage_hint == 0 &&
|
pixmap->usage_hint == 0 &&
|
||||||
channel->width == pixmap->drawable.width &&
|
channel->width == pixmap->drawable.width &&
|
||||||
channel->height == pixmap->drawable.height)
|
channel->height == pixmap->drawable.height) {
|
||||||
|
assert(priv->gpu_damage == NULL);
|
||||||
kgem_proxy_bo_attach(bo, &priv->gpu_bo);
|
kgem_proxy_bo_attach(bo, &priv->gpu_bo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bo;
|
return bo;
|
||||||
|
|
@ -1147,8 +1149,10 @@ sna_render_picture_extract(struct sna *sna,
|
||||||
box.x2 - box.x1 == pixmap->drawable.width &&
|
box.x2 - box.x1 == pixmap->drawable.width &&
|
||||||
box.y2 - box.y1 == pixmap->drawable.height) {
|
box.y2 - box.y1 == pixmap->drawable.height) {
|
||||||
struct sna_pixmap *priv = sna_pixmap(pixmap);
|
struct sna_pixmap *priv = sna_pixmap(pixmap);
|
||||||
if (priv)
|
if (priv) {
|
||||||
|
assert(priv->gpu_damage == NULL);
|
||||||
kgem_proxy_bo_attach(bo, &priv->gpu_bo);
|
kgem_proxy_bo_attach(bo, &priv->gpu_bo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue