diff options
-rw-r--r-- | linux-core/drm_gem.c | 1 | ||||
-rw-r--r-- | linux-core/i915_gem.c | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/linux-core/drm_gem.c b/linux-core/drm_gem.c index f6038d5c..ee3dbe47 100644 --- a/linux-core/drm_gem.c +++ b/linux-core/drm_gem.c @@ -80,6 +80,7 @@ drm_gem_object_alloc(struct drm_device *dev, size_t size) } obj->refcount = 1; + obj->size = size; if (dev->driver->gem_init_object != NULL && dev->driver->gem_init_object(dev, obj) != 0) { diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c index 09c94c3b..5ba48512 100644 --- a/linux-core/i915_gem.c +++ b/linux-core/i915_gem.c @@ -106,6 +106,9 @@ i915_gem_object_bind_to_gtt(struct drm_device *dev, struct drm_gem_object *obj) obj_priv->gtt_space = drm_memrange_get_block(free_space, obj->size, PAGE_SIZE); + obj_priv->gtt_offset = obj_priv->gtt_space->start; + + DRM_INFO("Binding object of size %d at 0x%08x\n", obj->size, obj_priv->gtt_offset); /* Get the list of pages out of our struct file. They'll be pinned * at this point until we release them. @@ -120,6 +123,8 @@ i915_gem_object_bind_to_gtt(struct drm_device *dev, struct drm_gem_object *obj) if (obj_priv->page_list[i] == NULL) { i915_gem_object_free_page_list(dev, obj); + drm_memrange_put_block(obj_priv->gtt_space); + obj_priv->gtt_space = NULL; return -ENOMEM; } } @@ -133,6 +138,8 @@ i915_gem_object_bind_to_gtt(struct drm_device *dev, struct drm_gem_object *obj) obj_priv->gtt_offset); if (obj_priv->agp_mem == NULL) { i915_gem_object_free_page_list(dev, obj); + drm_memrange_put_block(obj_priv->gtt_space); + obj_priv->gtt_space = NULL; return -ENOMEM; } |