For gen12+ architectures, i915 no longer supports use of GET_TILING
ioctl [1].  This breaks the usage of two libdrm functions on those
platforms:
  drm_intel_bo_gem_create_from_name() and
  drm_intel_bo_gem_create_from_prime().
We also have IGTs which test drm_intel_gem_bo_flink() followed by
drm_intel_bo_gem_create_from_name(), which now fail on these
platforms.

As I don't know best fix, this patch is mainly to show the problem and
get feedback on what is preferred solution.
The proposed solution here is to simply have libdrm ignore EOPNOTSUPP
errors and leave the tiling mode set to 0 upon receiving that error.

[1] https://lists.freedesktop.org/archives/intel-gfx/2019-August/210960.html

Signed-off-by: Brian Welty <brian.we...@intel.com>
---
 intel/intel_bufmgr_gem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index a0cecc96..5160aef1 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1152,7 +1152,8 @@ drm_intel_bo_gem_create_from_name(drm_intel_bufmgr 
*bufmgr,
        ret = drmIoctl(bufmgr_gem->fd,
                       DRM_IOCTL_I915_GEM_GET_TILING,
                       &get_tiling);
-       if (ret != 0)
+       /* for EOPNOTSUPP, just use tiling_mode of 0 */
+       if (ret != 0 && errno != EOPNOTSUPP)
                goto err_unref;
 
        bo_gem->tiling_mode = get_tiling.tiling_mode;
@@ -2753,7 +2754,9 @@ drm_intel_bo_gem_create_from_prime(drm_intel_bufmgr 
*bufmgr, int prime_fd, int s
        if (drmIoctl(bufmgr_gem->fd,
                     DRM_IOCTL_I915_GEM_GET_TILING,
                     &get_tiling))
-               goto err;
+               /* for EOPNOTSUPP, just use tiling_mode of 0 */
+               if (errno != EOPNOTSUPP)
+                       goto err;
 
        bo_gem->tiling_mode = get_tiling.tiling_mode;
        bo_gem->swizzle_mode = get_tiling.swizzle_mode;
-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to