Module: Mesa
Branch: main
Commit: 9aea879342b31a521a51b2f903aa9aed7e133cfa
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9aea879342b31a521a51b2f903aa9aed7e133cfa

Author: José Roberto de Souza <[email protected]>
Date:   Fri Dec  1 08:32:53 2023 -0800

anv: Promote bos to host_cached+host_coherent in platforms with LLC

In platforms with LLC we can promote all bos to cached+coherent
without any performance penality.
On the up side CPU reads can hit cache this way.

Signed-off-by: José Roberto de Souza <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26457>

---

 src/intel/vulkan/anv_allocator.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 281b604cb93..8134455837d 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1473,6 +1473,13 @@ anv_device_alloc_bo(struct anv_device *device,
    if ((alloc_flags & ANV_BO_ALLOC_MAPPED) == 0)
       alloc_flags |= ANV_BO_ALLOC_HOST_COHERENT;
 
+   /* In platforms with LLC we can promote all bos to cached+coherent for free 
*/
+   const enum anv_bo_alloc_flags not_allowed_promotion = ANV_BO_ALLOC_SCANOUT |
+                                                         ANV_BO_ALLOC_EXTERNAL 
|
+                                                         
ANV_BO_ALLOC_PROTECTED;
+   if (device->info->has_llc && ((alloc_flags & not_allowed_promotion) == 0))
+      alloc_flags |= ANV_BO_ALLOC_HOST_COHERENT;
+
    const uint32_t bo_flags =
          device->kmd_backend->bo_alloc_flags_to_bo_flags(device, alloc_flags);
 

Reply via email to