Hi Gabriel,
On Mon, Sep 4, 2017 at 4:11 PM, Gabriel Krisman Bertazi krisman@collabora.co.uk wrote:
Varad Gautam varadgautam@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.
Do you mean we also need to call bo_unpin() from push_sysram?
With this patch, we unpin immediately before calling push_sysram(), and only allow non-pinned bo-s to be moved to sysram (pin_count decrements in cirrus_bo_unpin preserving pinning state). With atomic handlers later (patch 10+), pin-unpin happens from prepare/cleanup_fb, and a later prepare_fb calls push_sysram() on the bo - so the pin_count maintains.
Thanks, Varad
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