freedreno/drm: handle ancient kernels

Older kernels did not support `MSM_INFO_GET_IOVA`.  But this is only
required for (a) clover (ie. `fd_set_global_binding()`) and drm paths
that are limited to newer kernels.  So move the location of the assert
to fix new userspace on old kernels.

Fixes: c9e8df61dc ("freedreno: Initialize the bo's iova at creation time.")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5081>
This commit is contained in:
Rob Clark 2020-05-17 16:16:43 -07:00 committed by Marge Bot
parent 106c2a65db
commit a6184eae31
2 changed files with 4 additions and 1 deletions

View file

@ -236,6 +236,8 @@ fd_bo_mark_for_dump(struct fd_bo *bo)
uint64_t fd_bo_get_iova(struct fd_bo *bo)
{
/* ancient kernels did not support this */
assert(bo->iova != 0);
return bo->iova;
}

View file

@ -112,7 +112,8 @@ static uint64_t msm_bo_iova(struct fd_bo *bo)
int ret;
ret = drmCommandWriteRead(bo->dev->fd, DRM_MSM_GEM_INFO, &req, sizeof(req));
debug_assert(ret == 0);
if (ret)
return 0;
return req.value;
}