[PATCH 01/14] drm/cirrus: split out bo unpinning from cirrus_bo_push_sysram

Gabriel Krisman Bertazi krisman at collabora.co.uk
Mon Sep 4 10:41:21 UTC 2017


Varad Gautam <varadgautam at gmail.com> writes:


>  int cirrus_bo_push_sysram(struct cirrus_bo *bo)
>  {
>  	int i, ret;
> -	if (!bo->pin_count) {
> +
> +	ret = cirrus_bo_reserve(bo, false);
> +	if (ret)
> +		return ret;
> +
> +	if (bo->pin_count) {
>  		DRM_ERROR("unpin bad %p\n", bo);
> -		return 0;
> +		goto out;
>  	}
> -	bo->pin_count--;
> -	if (bo->pin_count)
> -		return 0;

Can you adjust this to also use your version of cirrus_bo_unpin()?

Also, If I'm not mistaken, this hunk unbalances pin_count, since you
no longer decrement it after unpinning.

>  
>  	if (bo->kmap.virtual)
>  		ttm_bo_kunmap(&bo->kmap);
> @@ -400,9 +432,12 @@ int cirrus_bo_push_sysram(struct cirrus_bo *bo)
>  	ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
>  	if (ret) {
>  		DRM_ERROR("pushing to VRAM failed\n");
> -		return ret;
> +		goto out;
>  	}
> -	return 0;
> +
> +out:
> +	cirrus_bo_unreserve(bo);
> +	return ret;
>  }
>  
>  int cirrus_mmap(struct file *filp, struct vm_area_struct *vma)

-- 
Gabriel Krisman Bertazi


More information about the dri-devel mailing list