From 1cbee485e768d8980b92184dd54c06ce6adfaf05 Mon Sep 17 00:00:00 2001 From: Jianxun Zhang Date: Mon, 22 Sep 2025 11:14:47 -0700 Subject: [PATCH] iris: Ensure type of bo's heap is consistent with modifier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: José Roberto de Souza Reviewed-by: Nanley Chery Part-of: --- src/gallium/drivers/iris/iris_bufmgr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c index ce4b2c2d72f..42f9b21a2c9 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.c +++ b/src/gallium/drivers/iris/iris_bufmgr.c @@ -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: