drm-intel: Assert that the bo is unmapped upon release.

Check through error paths to catch a few more places where the mapped bo
may have been leaked, and add an assert to abort in case we do leak a
mapping.
This commit is contained in:
Chris Wilson 2010-01-27 23:17:44 +00:00
parent 6848c7c850
commit 44734b9d3b
4 changed files with 15 additions and 1 deletions

View file

@ -612,6 +612,9 @@ i915_spans_fini (i915_spans_t *spans)
{
i915_shader_fini (&spans->shader);
if (spans->tail->bo->virtual)
intel_bo_unmap (spans->tail->bo);
if (spans->head.bo != NULL) {
struct vbo *vbo, *next;

View file

@ -448,6 +448,10 @@ i965_surface_glyphs (void *abstract_surface,
cairo_device_release (surface->intel.drm.base.device);
CLEANUP_GLYPHS:
i965_shader_fini (&glyphs.shader);
if (glyphs.tail->bo->virtual)
intel_bo_unmap (glyphs.tail->bo);
if (glyphs.head.bo != NULL) {
struct i965_vbo *vbo, *next;

View file

@ -344,6 +344,9 @@ i965_spans_fini (i965_spans_t *spans)
{
i965_shader_fini (&spans->shader);
if (spans->tail->bo->virtual)
intel_bo_unmap (spans->tail->bo);
if (spans->head.bo != NULL) {
struct i965_vbo *vbo, *next;

View file

@ -491,6 +491,8 @@ intel_bo_release (void *_dev, void *_bo)
intel_bo_t *bo = _bo;
int bucket;
assert (bo->virtual == NULL);
bucket = INTEL_BO_CACHE_BUCKETS;
if (bo->base.size & -bo->base.size)
bucket = ffs (bo->base.size / 4096) - 1;
@ -982,8 +984,10 @@ intel_glyph_cache_add_glyph (intel_device_t *device,
if (width > (int) sizeof (buf)) {
a8 = malloc (width);
if (unlikely (a8 == NULL))
if (unlikely (a8 == NULL)) {
intel_bo_unmap (cache->buffer.bo);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
}
dst += node->x;