~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/drivers/iris/xe/iris_bufmgr.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
   return intel_ioctl(iris_bufmgr_get_fd(bufmgr), DRM_IOCTL_XE_VM_DESTROY,
50
50
                      &destroy) == 0;
51
51
}
 
52
 
 
53
/*
 
54
 * Xe kmd has fixed caching modes for each heap, only scanout bos can change
 
55
 * it.
 
56
 */
 
57
enum iris_mmap_mode
 
58
iris_xe_bo_flags_to_mmap_mode(struct iris_bufmgr *bufmgr, enum iris_heap heap,
 
59
                              unsigned flags)
 
60
{
 
61
   /* TODO: might be different for MTL/platforms without LLC */
 
62
   switch (heap) {
 
63
   case IRIS_HEAP_DEVICE_LOCAL_PREFERRED:
 
64
      /* TODO: Can vary on current placement?! */
 
65
      return IRIS_MMAP_WC;
 
66
   case IRIS_HEAP_DEVICE_LOCAL:
 
67
      return IRIS_MMAP_WC;
 
68
   case IRIS_HEAP_SYSTEM_MEMORY:
 
69
      if (flags & BO_ALLOC_SCANOUT)
 
70
         return IRIS_MMAP_WC;
 
71
      return IRIS_MMAP_WB;
 
72
   default:
 
73
      return IRIS_MMAP_NONE;
 
74
   }
 
75
}