]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/drm/i915_mem.c
drm: convert drawable code to using idr
[linux-2.6-omap-h63xx.git] / drivers / char / drm / i915_mem.c
index ba87ff17ff64cfaf123afe895a4b0d6a5a0bc262..50b4bacef0e01654d4097ac91aaca88209395464 100644 (file)
  * block to allocate, and the ring is drained prior to allocations --
  * in other words allocation is expensive.
  */
-static void mark_block(drm_device_t * dev, struct mem_block *p, int in_use)
+static void mark_block(struct drm_device * dev, struct mem_block *p, int in_use)
 {
        drm_i915_private_t *dev_priv = dev->dev_private;
        drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv;
-       drm_tex_region_t *list;
+       struct drm_tex_region *list;
        unsigned shift, nr;
        unsigned start;
        unsigned end;
@@ -208,7 +208,7 @@ static int init_heap(struct mem_block **heap, int start, int size)
 
 /* Free all blocks associated with the releasing file.
  */
-void i915_mem_release(drm_device_t * dev, DRMFILE filp, struct mem_block *heap)
+void i915_mem_release(struct drm_device * dev, DRMFILE filp, struct mem_block *heap)
 {
        struct mem_block *p;
 
@@ -365,3 +365,34 @@ int i915_mem_init_heap(DRM_IOCTL_ARGS)
 
        return init_heap(heap, initheap.start, initheap.size);
 }
+
+int i915_mem_destroy_heap( DRM_IOCTL_ARGS )
+{
+       DRM_DEVICE;
+       drm_i915_private_t *dev_priv = dev->dev_private;
+       drm_i915_mem_destroy_heap_t destroyheap;
+       struct mem_block **heap;
+
+       if ( !dev_priv ) {
+               DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ );
+               return DRM_ERR(EINVAL);
+       }
+
+       DRM_COPY_FROM_USER_IOCTL( destroyheap, (drm_i915_mem_destroy_heap_t *)data,
+                                 sizeof(destroyheap) );
+
+       heap = get_heap( dev_priv, destroyheap.region );
+       if (!heap) {
+               DRM_ERROR("get_heap failed");
+               return DRM_ERR(EFAULT);
+       }
+       
+       if (!*heap) {
+               DRM_ERROR("heap not initialized?");
+               return DRM_ERR(EFAULT);
+       }
+
+       i915_mem_takedown( heap );
+       return 0;
+}
+