iris: Ensure type of bo's heap is consistent with modifier

This helps us to catch a compressed bo is picked up for
an uncompressed modifiers when importing dmabuf, and vise
versa.

Signed-off-by: Jianxun Zhang <jianxun.zhang@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37098>
This commit is contained in:
Jianxun Zhang
2025-09-22 11:14:47 -07:00
parent 5aa4dc7f77
commit 1cbee485e7

View File

@@ -2071,6 +2071,14 @@ iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd,
out:
simple_mtx_unlock(&bufmgr->lock);
/* Type of an existing BO's heap should be consistent with the modifier in
* terms of compression state when importing it. Compressed heaps are only
* present on Xe2+.
*/
assert(!bo || (iris_heap_is_compressed(bo->real.heap) ==
(isl_drm_modifier_has_aux(modifier) &&
bufmgr->devinfo.ver >= 20)));
return bo;
err_vm_alloc: