From: Matthijs van Duin matthijsvanduin@gmail.com
--- drivers/gpu/drm/omapdrm/omap_gem.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index fa118d3089a3..6cf190156dcf 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -820,7 +820,7 @@ static int _omap_gem_pin(struct drm_gem_object *obj) if (omap_obj->flags & OMAP_BO_TILED) { block = tiler_reserve_2d(fmt, omap_obj->width, - omap_obj->height, 0); + omap_obj->height, PAGE_SIZE); } else { block = tiler_reserve_1d(obj->size); } @@ -1106,6 +1106,9 @@ void omap_gem_free_object(struct drm_gem_object *obj)
WARN_ON(!mutex_is_locked(&dev->struct_mutex));
+ if (omap_obj->flags & OMAP_BO_TILED) + _omap_gem_unpin(obj); + spin_lock(&priv->list_lock); list_del(&omap_obj->mm_list); spin_unlock(&priv->list_lock); @@ -1229,6 +1232,12 @@ struct drm_gem_object *omap_gem_new(struct drm_device *dev, goto err_release; }
+ if (flags & OMAP_BO_TILED) { + ret = _omap_gem_pin(obj); + if (ret) + goto err_release; + } + spin_lock(&priv->list_lock); list_add(&omap_obj->mm_list, &priv->obj_list); spin_unlock(&priv->list_lock);