[igt-dev] [PATCH i-g-t] tests/kms: Return false in gem_has_lmem for platforms not having LMEM support
Vidya Srinivas
vidya.srinivas at intel.com
Fri Jul 23 09:35:48 UTC 2021
Starting commit (tests/kms: Create buffer object from LMEM for discrete) it checks
for LMEM. But this is breaking older kernels like 5.4 without
DRM_I915_QUERY_MEMORY_REGIONS support. This causes
item.length filled from IOCTL to be < 0 and gives segmentation
fault. Another way to fix is check for NULL query in
gem_get_lmem_region_count and return false.
Patch returns false from gem_has_lmem for obvious platforms
which dont have LMEM support and also adds the check
for NULL query in gem_get_lmem_region_count.
Signed-off-by: Lin Charlton <charlton.lin at intel.com>
Signed-off-by: Vidya Srinivas <vidya.srinivas at intel.com>
---
lib/i915/intel_memory_region.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/i915/intel_memory_region.c b/lib/i915/intel_memory_region.c
index 144ae12ca7a0..635c21ab3765 100644
--- a/lib/i915/intel_memory_region.c
+++ b/lib/i915/intel_memory_region.c
@@ -143,6 +143,10 @@ uint8_t gem_get_lmem_region_count(int fd)
uint8_t lmem_regions = 0;
query_info = gem_get_query_memory_regions(fd);
+
+ if (!query_info)
+ return 0;
+
num_regions = query_info->num_regions;
for (int i = 0; i < num_regions; i++) {
@@ -164,6 +168,9 @@ uint8_t gem_get_lmem_region_count(int fd)
*/
bool gem_has_lmem(int fd)
{
+ if (intel_display_ver(intel_get_drm_devid(fd) < 12) ||
+ IS_ALDERLAKE_P(intel_get_drm_devid(fd)) || IS_TIGERLAKE(intel_get_drm_devid(fd)))
+ return false;
return gem_get_lmem_region_count(fd) > 0;
}
--
2.32.0
More information about the igt-dev
mailing list