drm: Use the driver's gem_object_free function from CMA helpers.
diff mbox

Message ID 1450139186-21537-1-git-send-email-eric@anholt.net
State New
Headers show

Commit Message

Eric Anholt Dec. 15, 2015, 12:26 a.m. UTC
VC4 wraps the CMA objects in its own structures, so it needs to do its
own teardown (waiting for GPU to finish, updating bo_stats tracking).
The other CMA drivers are using drm_gem_cma_free_object as their
gem_free_object, so this should be a no-op for them.

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/drm_fb_cma_helper.c  | 6 +++---
 drivers/gpu/drm/drm_gem_cma_helper.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Daniel Vetter Dec. 15, 2015, 9:22 a.m. UTC | #1
On Mon, Dec 14, 2015 at 04:26:26PM -0800, Eric Anholt wrote:
> VC4 wraps the CMA objects in its own structures, so it needs to do its
> own teardown (waiting for GPU to finish, updating bo_stats tracking).
> The other CMA drivers are using drm_gem_cma_free_object as their
> gem_free_object, so this should be a no-op for them.
> 
> Signed-off-by: Eric Anholt <eric@anholt.net>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Since vc4 landed already I'll pull this into drm-misc.
-Daniel

> ---
>  drivers/gpu/drm/drm_fb_cma_helper.c  | 6 +++---
>  drivers/gpu/drm/drm_gem_cma_helper.c | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 5c1aca4..99b5673 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -279,7 +279,7 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper,
>  	if (!fbi) {
>  		dev_err(dev->dev, "Failed to allocate framebuffer info.\n");
>  		ret = -ENOMEM;
> -		goto err_drm_gem_cma_free_object;
> +		goto err_gem_free_object;
>  	}
>  
>  	fbdev_cma->fb = drm_fb_cma_alloc(dev, &mode_cmd, &obj, 1);
> @@ -322,8 +322,8 @@ err_drm_fb_cma_destroy:
>  	drm_fb_cma_destroy(fb);
>  err_framebuffer_release:
>  	framebuffer_release(fbi);
> -err_drm_gem_cma_free_object:
> -	drm_gem_cma_free_object(&obj->base);
> +err_gem_free_object:
> +	dev->driver->gem_free_object(&obj->base);
>  	return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
> index 7dcb43f..b409123 100644
> --- a/drivers/gpu/drm/drm_gem_cma_helper.c
> +++ b/drivers/gpu/drm/drm_gem_cma_helper.c
> @@ -121,7 +121,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
>  	return cma_obj;
>  
>  error:
> -	drm_gem_cma_free_object(&cma_obj->base);
> +	drm->driver->gem_free_object(&cma_obj->base);
>  	return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(drm_gem_cma_create);
> @@ -171,7 +171,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,
>  	return cma_obj;
>  
>  err_handle_create:
> -	drm_gem_cma_free_object(gem_obj);
> +	drm->driver->gem_free_object(gem_obj);
>  
>  	return ERR_PTR(ret);
>  }
> -- 
> 2.6.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Eric Anholt Dec. 15, 2015, 6:22 p.m. UTC | #2
Daniel Vetter <daniel@ffwll.ch> writes:

> On Mon, Dec 14, 2015 at 04:26:26PM -0800, Eric Anholt wrote:
>> VC4 wraps the CMA objects in its own structures, so it needs to do its
>> own teardown (waiting for GPU to finish, updating bo_stats tracking).
>> The other CMA drivers are using drm_gem_cma_free_object as their
>> gem_free_object, so this should be a no-op for them.
>> 
>> Signed-off-by: Eric Anholt <eric@anholt.net>
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> Since vc4 landed already I'll pull this into drm-misc.

Sounds good to me.  Thanks!

Patch
diff mbox

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 5c1aca4..99b5673 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -279,7 +279,7 @@  static int drm_fbdev_cma_create(struct drm_fb_helper *helper,
 	if (!fbi) {
 		dev_err(dev->dev, "Failed to allocate framebuffer info.\n");
 		ret = -ENOMEM;
-		goto err_drm_gem_cma_free_object;
+		goto err_gem_free_object;
 	}
 
 	fbdev_cma->fb = drm_fb_cma_alloc(dev, &mode_cmd, &obj, 1);
@@ -322,8 +322,8 @@  err_drm_fb_cma_destroy:
 	drm_fb_cma_destroy(fb);
 err_framebuffer_release:
 	framebuffer_release(fbi);
-err_drm_gem_cma_free_object:
-	drm_gem_cma_free_object(&obj->base);
+err_gem_free_object:
+	dev->driver->gem_free_object(&obj->base);
 	return ret;
 }
 
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
index 7dcb43f..b409123 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -121,7 +121,7 @@  struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
 	return cma_obj;
 
 error:
-	drm_gem_cma_free_object(&cma_obj->base);
+	drm->driver->gem_free_object(&cma_obj->base);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(drm_gem_cma_create);
@@ -171,7 +171,7 @@  drm_gem_cma_create_with_handle(struct drm_file *file_priv,
 	return cma_obj;
 
 err_handle_create:
-	drm_gem_cma_free_object(gem_obj);
+	drm->driver->gem_free_object(gem_obj);
 
 	return ERR_PTR(ret);
 }