radeon: fixup vram visible calculation to take a/c pinned objects for now

main
Dave Airlie 2008-11-10 15:13:08 +10:00
parent 7abb8416a7
commit 31b0c4cd20
2 changed files with 8 additions and 0 deletions

View 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;

View 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;