sna: More missing move-to-cpu allocation checks

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-12-15 00:00:56 +00:00
parent 12448b5606
commit 1cc43dc97b
4 changed files with 40 additions and 23 deletions

View File

@ -1023,13 +1023,17 @@ glyphs_fallback(CARD8 op,
if (!RegionNotEmpty(&region))
return;
sna_drawable_move_region_to_cpu(dst->pDrawable, &region, true);
if (dst->alphaMap)
sna_drawable_move_to_cpu(dst->alphaMap->pDrawable, true);
if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region, true))
return;
if (dst->alphaMap &&
!sna_drawable_move_to_cpu(dst->alphaMap->pDrawable, true))
return;
if (src->pDrawable) {
sna_drawable_move_to_cpu(src->pDrawable, false);
if (src->alphaMap)
sna_drawable_move_to_cpu(src->alphaMap->pDrawable, false);
if (!sna_drawable_move_to_cpu(src->pDrawable, false))
return;
if (src->alphaMap &&
!sna_drawable_move_to_cpu(src->alphaMap->pDrawable, false))
return;
}
RegionTranslate(&region, -dst->pDrawable->x, -dst->pDrawable->y);

View File

@ -954,8 +954,9 @@ sna_render_picture_fixup(struct sna *sna,
__FUNCTION__, channel->pict_format, pitch, picture->format));
}
if (picture->pDrawable)
sna_drawable_move_to_cpu(picture->pDrawable, false);
if (picture->pDrawable &&
!sna_drawable_move_to_cpu(picture->pDrawable, false))
return 0;
channel->bo = kgem_create_buffer(&sna->kgem,
pitch*h, KGEM_BUFFER_WRITE,
@ -1098,7 +1099,8 @@ sna_render_picture_convert(struct sna *sna,
return 0;
}
sna_pixmap_move_to_cpu(pixmap, false);
if (!sna_pixmap_move_to_cpu(pixmap, false))
return 0;
src = pixman_image_create_bits(picture->format,
pixmap->drawable.width,

View File

@ -201,11 +201,16 @@ sna_tiling_composite_done(struct sna *sna,
} else {
DBG(("%s -- falback\n", __FUNCTION__));
sna_drawable_move_to_cpu(tile->dst->pDrawable, true);
if (tile->src->pDrawable)
sna_drawable_move_to_cpu(tile->src->pDrawable, false);
if (tile->mask && tile->mask->pDrawable)
sna_drawable_move_to_cpu(tile->mask->pDrawable, false);
if (!sna_drawable_move_to_cpu(tile->dst->pDrawable, true))
goto done;
if (tile->src->pDrawable &&
!sna_drawable_move_to_cpu(tile->src->pDrawable, false))
goto done;
if (tile->mask && tile->mask->pDrawable &&
!sna_drawable_move_to_cpu(tile->mask->pDrawable, false))
goto done;
fbComposite(tile->op,
tile->src, tile->mask, tile->dst,

View File

@ -3176,7 +3176,8 @@ trapezoid_span_inplace(CARD8 op, PicturePtr src, PicturePtr dst,
}
region.data = NULL;
sna_drawable_move_region_to_cpu(dst->pDrawable, &region, true);
if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region, true))
return true;
pixmap = get_drawable_pixmap(dst->pDrawable);
get_drawable_deltas(dst->pDrawable, pixmap, &dst_x, &dst_y);
@ -3312,13 +3313,17 @@ trapezoid_span_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
region.extents.y2 = dst_y + extents.y2;
region.data = NULL;
sna_drawable_move_region_to_cpu(dst->pDrawable, &region, true);
if (dst->alphaMap)
sna_drawable_move_to_cpu(dst->alphaMap->pDrawable, true);
if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region, true))
goto done;
if (dst->alphaMap &&
!sna_drawable_move_to_cpu(dst->alphaMap->pDrawable, true))
goto done;
if (src->pDrawable) {
sna_drawable_move_to_cpu(src->pDrawable, false);
if (src->alphaMap)
sna_drawable_move_to_cpu(src->alphaMap->pDrawable, false);
if (!sna_drawable_move_to_cpu(src->pDrawable, false))
goto done;
if (src->alphaMap &&
!sna_drawable_move_to_cpu(src->alphaMap->pDrawable, false))
goto done;
}
fbComposite(op, src, mask, dst,
@ -3327,6 +3332,7 @@ trapezoid_span_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
0, 0,
dst_x, dst_y,
extents.x2, extents.y2);
done:
FreePicture(mask, 0);
}
tor_fini(&tor);
@ -3881,8 +3887,8 @@ sna_add_traps(PicturePtr picture, INT16 x, INT16 y, int n, xTrap *t)
}
DBG(("%s -- fallback\n", __FUNCTION__));
sna_drawable_move_to_cpu(picture->pDrawable, true);
fbAddTraps(picture, x, y, n, t);
if (sna_drawable_move_to_cpu(picture->pDrawable, true))
fbAddTraps(picture, x, y, n, t);
}
static inline void