summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-11-10 15:13:08 +1000
committerDave Airlie <airlied@redhat.com>2008-11-10 15:13:08 +1000
commit31b0c4cd20d0eb843268a6307b7c32dbc07e42a0 (patch)
tree70b82ef63127eee660d24d87bf306b081b643836
parent7abb8416a7fd8d69f1f2317cdac2baa8e640671e (diff)
radeon: fixup vram visible calculation to take a/c pinned objects for now
-rw-r--r--linux-core/radeon_fb.c5
-rw-r--r--linux-core/radeon_gem.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/linux-core/radeon_fb.c b/linux-core/radeon_fb.c
index d3722c37..9d30d1f7 100644
--- a/linux-core/radeon_fb.c
+++ b/linux-core/radeon_fb.c
@@ -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;
diff --git a/linux-core/radeon_gem.c b/linux-core/radeon_gem.c
index 2e20de3c..85185232 100644
--- a/linux-core/radeon_gem.c
+++ b/linux-core/radeon_gem.c
@@ -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;