radeon: fixup vram visible calculation to take a/c pinned objects for now
authorDave Airlie <airlied@redhat.com>
Mon, 10 Nov 2008 05:13:08 +0000 (15:13 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 10 Nov 2008 05:13:08 +0000 (15:13 +1000)
linux-core/radeon_fb.c
linux-core/radeon_gem.c

index d3722c3..9d30d1f 100644 (file)
@@ -707,6 +707,7 @@ int radeonfb_create(struct drm_device *dev, uint32_t fb_width, uint32_t fb_heigh
                   uint32_t surface_width, uint32_t surface_height,
                   struct radeon_framebuffer **radeon_fb_p)
 {
+       struct drm_radeon_private *dev_priv = dev->dev_private;
        struct fb_info *info;
        struct radeonfb_par *par;
        struct drm_framebuffer *fb;
@@ -743,6 +744,8 @@ int radeonfb_create(struct drm_device *dev, uint32_t fb_width, uint32_t fb_heigh
                goto out_unref;
        }
 
+       dev_priv->mm.vram_visible -= aligned_size;
+
        mutex_lock(&dev->struct_mutex);
        fb = radeon_framebuffer_create(dev, &mode_cmd, fbo);
        if (!fb) {
@@ -1136,6 +1139,7 @@ EXPORT_SYMBOL(radeonfb_probe);
 
 int radeonfb_remove(struct drm_device *dev, struct drm_framebuffer *fb)
 {
+       struct drm_radeon_private *dev_priv = dev->dev_private;
        struct fb_info *info;
        struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb);
 
@@ -1147,6 +1151,7 @@ int radeonfb_remove(struct drm_device *dev, struct drm_framebuffer *fb)
        if (info) {
                unregister_framebuffer(info);
                drm_bo_kunmap(&radeon_fb->kmap_obj);
+               dev_priv->mm.vram_visible += radeon_fb->obj->size;
                mutex_lock(&dev->struct_mutex);
                drm_gem_object_unreference(radeon_fb->obj);
                radeon_fb->obj = NULL;
index 2e20de3..8518523 100644 (file)
@@ -586,6 +586,9 @@ static int radeon_gart_init(struct drm_device *dev)
                if (ret)
                        return -EINVAL;
 
+               /* subtract from VRAM value reporting to userspace */
+               dev_priv->mm.vram_visible -= RADEON_PCIGART_TABLE_SIZE;
+
                dev_priv->mm.pcie_table_backup = kzalloc(RADEON_PCIGART_TABLE_SIZE, GFP_KERNEL);
                if (!dev_priv->mm.pcie_table_backup)
                        return -EINVAL;