Module: Mesa Branch: main Commit: 5e697abc588329c7423de73f8ac184bdf519fbfa URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e697abc588329c7423de73f8ac184bdf519fbfa
Author: Jordan Justen <[email protected]> Date: Wed May 10 09:50:54 2023 -0700 iris/bufmgr: Add iris_pat_index_for_bo_flags() 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.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gallium/drivers/iris/iris_bufmgr.h b/src/gallium/drivers/iris/iris_bufmgr.h index d130441cd00..18d17595fdc 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.h +++ b/src/gallium/drivers/iris/iris_bufmgr.h @@ -539,6 +539,22 @@ iris_bo_bump_seqno(struct iris_bo *bo, uint64_t seqno, prev_seqno = tmp; } +/** + * Return the pat index based on the bo allocation flags. + */ +static inline uint32_t +iris_pat_index_for_bo_flags(const struct intel_device_info *devinfo, + unsigned alloc_flags) +{ + if (alloc_flags & BO_ALLOC_COHERENT) + return devinfo->pat.coherent; + + if (alloc_flags & (BO_ALLOC_SHARED | BO_ALLOC_SCANOUT)) + return devinfo->pat.scanout; + + return devinfo->pat.writeback; +} + enum iris_memory_zone iris_memzone_for_address(uint64_t address); int iris_bufmgr_create_screen_id(struct iris_bufmgr *bufmgr);
