aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index edc805afde05..6e4c6dd50659 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -85,20 +85,14 @@ int
85i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, 85i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
86 struct drm_file *file_priv) 86 struct drm_file *file_priv)
87{ 87{
88 drm_i915_private_t *dev_priv = dev->dev_private;
89 struct drm_i915_gem_get_aperture *args = data; 88 struct drm_i915_gem_get_aperture *args = data;
90 struct drm_i915_gem_object *obj_priv;
91 89
92 if (!(dev->driver->driver_features & DRIVER_GEM)) 90 if (!(dev->driver->driver_features & DRIVER_GEM))
93 return -ENODEV; 91 return -ENODEV;
94 92
95 args->aper_size = dev->gtt_total; 93 args->aper_size = dev->gtt_total;
96 args->aper_available_size = args->aper_size; 94 args->aper_available_size = (args->aper_size -
97 95 atomic_read(&dev->pin_memory));
98 list_for_each_entry(obj_priv, &dev_priv->mm.active_list, list) {
99 if (obj_priv->pin_count > 0)
100 args->aper_available_size -= obj_priv->obj->size;
101 }
102 96
103 return 0; 97 return 0;
104} 98}