Skip to contentSkip to conversation

intel: Handle GET_TILING errors on unsupported platforms

RFC PATCH New Brian Welty 1 participant 1 message Nov 12, 2019

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 intel: Handle GET_TILING errors on unsupported platforms

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

---
 intel/intel_bufmgr_gem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
intel/intel_bufmgr_gem.c +5 -2
index a0cecc96..5160aef1 100644
@@ -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;
Signature · 6 lines
2.21.0

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