Varad Gautam <varadgau...@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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to