diff options
author | Robert Noland <rnoland@2hip.net> | 2008-08-22 21:45:41 -0400 |
---|---|---|
committer | Robert Noland <rnoland@2hip.net> | 2008-08-24 15:25:20 -0400 |
commit | bfea578352aaaed08555e86c9951b3932f39d122 (patch) | |
tree | 495d237b5ebcde71dcde76c4083c789d84392eed /bsd-core | |
parent | 0687c0a4ec78730f752cee04a5b0862f47dbf026 (diff) |
[FreeBSD] Add drm_drawable_free_all()
Diffstat (limited to 'bsd-core')
-rw-r--r-- | bsd-core/drmP.h | 3 | ||||
-rw-r--r-- | bsd-core/drm_drawable.c | 19 | ||||
-rw-r--r-- | bsd-core/drm_drv.c | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h index 473427f3..74487e55 100644 --- a/bsd-core/drmP.h +++ b/bsd-core/drmP.h @@ -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); diff --git a/bsd-core/drm_drawable.c b/bsd-core/drm_drawable.c index 268b956c..1d85cb45 100644 --- a/bsd-core/drm_drawable.c +++ b/bsd-core/drm_drawable.c @@ -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); +} diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index d369af4c..32b284e1 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -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; |