[FreeBSD] Add drm_drawable_free_all()

This commit is contained in:
Robert Noland 2008-08-22 21:45:41 -04:00
parent 0687c0a4ec
commit bfea578352
3 changed files with 24 additions and 0 deletions

View file

@ -1031,6 +1031,9 @@ int drm_update_draw(struct drm_device *dev, void *data,
struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev,
int handle);
/* Drawable support (drm_drawable.c) */
void drm_drawable_free_all(struct drm_device *dev);
/* Authentication IOCTL support (drm_auth.c) */
int drm_getmagic(struct drm_device *dev, void *data,
struct drm_file *file_priv);

View file

@ -151,3 +151,22 @@ int drm_update_draw(struct drm_device *dev, void *data,
return EINVAL;
}
}
void drm_drawable_free_all(struct drm_device *dev)
{
struct bsd_drm_drawable_info *info, *next;
DRM_SPINLOCK(&dev->drw_lock);
for (info = RB_MIN(drawable_tree, &dev->drw_head);
info != NULL ; info = next) {
next = RB_NEXT(drawable_tree, &dev->drw_head, info);
RB_REMOVE(drawable_tree, &dev->drw_head,
(struct bsd_drm_drawable_info *)info);
DRM_SPINUNLOCK(&dev->drw_lock);
free_unr(dev->drw_unrhdr, info->handle);
drm_free(info, sizeof(struct bsd_drm_drawable_info),
DRM_MEM_DRAWABLE);
DRM_SPINLOCK(&dev->drw_lock);
}
DRM_SPINUNLOCK(&dev->drw_lock);
}

View file

@ -460,6 +460,8 @@ static int drm_lastclose(struct drm_device *dev)
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
}
drm_drawable_free_all(dev);
/* Clear AGP information */
if ( dev->agp ) {
drm_agp_mem_t *entry;