iris/bufmgr: Skip bucket allocation if not using writeback cache PAT index
authorJordan Justen <jordan.l.justen@intel.com>
Wed, 10 May 2023 16:56:58 +0000 (09:56 -0700)
committerMarge Bot <emma+marge@anholt.net>
Tue, 27 Jun 2023 22:06:19 +0000 (22:06 +0000)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22878>

src/gallium/drivers/iris/iris_bufmgr.c

index 490c07e..af33069 100644 (file)
@@ -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. */