Module: Mesa Branch: main Commit: 37fc25aa74263e02f0d1e09ddd7f13dd13071442 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=37fc25aa74263e02f0d1e09ddd7f13dd13071442
Author: Jordan Justen <[email protected]> Date: Wed May 10 09:56:58 2023 -0700 iris/bufmgr: Skip bucket allocation if not using writeback cache PAT index Signed-off-by: Jordan Justen <[email protected]> Suggested-by: Kenneth Graunke <[email protected]> Reviewed-by: José Roberto de Souza <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22878> --- src/gallium/drivers/iris/iris_bufmgr.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c index 490c07e4eef..af33069757b 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.c +++ b/src/gallium/drivers/iris/iris_bufmgr.c @@ -314,14 +314,16 @@ static struct bo_cache_bucket * bucket_for_size(struct iris_bufmgr *bufmgr, uint64_t size, enum iris_heap heap, unsigned flags) { + if (flags & BO_ALLOC_PROTECTED) + return NULL; - /* Protected bo needs special handling during allocation. - * Exported and scanout bos also need special handling during allocation - * in Xe KMD. - */ - if ((flags & BO_ALLOC_PROTECTED) || - ((flags & (BO_ALLOC_SHARED | BO_ALLOC_SCANOUT)) && - bufmgr->devinfo.kmd_type == INTEL_KMD_TYPE_XE)) + const struct intel_device_info *devinfo = &bufmgr->devinfo; + if (devinfo->has_set_pat_uapi && + iris_pat_index_for_bo_flags(devinfo, flags) != devinfo->pat.writeback) + return NULL; + + if (devinfo->kmd_type == INTEL_KMD_TYPE_XE && + (flags & (BO_ALLOC_SHARED | BO_ALLOC_SCANOUT))) return NULL; /* Calculating the pages and rounding up to the page size. */
