From: Rob Clark Date: Sun, 17 May 2020 23:16:43 +0000 (-0700) Subject: freedreno/drm: handle ancient kernels X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a6184eae3123840b1ff3d78e24454610e3013013;p=mesa.git 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: c9e8df61dc8 ("freedreno: Initialize the bo's iova at creation time.") Signed-off-by: Rob Clark Tested-by: Ilia Mirkin Part-of: --- diff --git a/src/freedreno/drm/freedreno_bo.c b/src/freedreno/drm/freedreno_bo.c index a4218cd8ffb..b6d5cdd9bec 100644 --- a/src/freedreno/drm/freedreno_bo.c +++ b/src/freedreno/drm/freedreno_bo.c @@ -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; } diff --git a/src/freedreno/drm/msm_bo.c b/src/freedreno/drm/msm_bo.c index da2609903c1..7253a8cc7bd 100644 --- a/src/freedreno/drm/msm_bo.c +++ b/src/freedreno/drm/msm_bo.c @@ -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; }