Module: Mesa
Branch: master
Commit: a6184eae3123840b1ff3d78e24454610e3013013
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6184eae3123840b1ff3d78e24454610e3013013

Author: Rob Clark <[email protected]>
Date:   Sun May 17 16:16:43 2020 -0700

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 <[email protected]>
Tested-by: Ilia Mirkin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5081>

---

 src/freedreno/drm/freedreno_bo.c | 2 ++
 src/freedreno/drm/msm_bo.c       | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

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;
 }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to