Module: Mesa Branch: main Commit: f36027f389bfe089c2024ce9f8dfbb84e6157831 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f36027f389bfe089c2024ce9f8dfbb84e6157831
Author: Francisco Jerez <curroje...@riseup.net> Date: Fri Sep 29 01:07:34 2023 -0700 intel/l3: Define helper for obtaining the size of an L3 partition in KB. Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25493> --- src/intel/common/intel_l3_config.c | 13 ++++++++++++- src/intel/common/intel_l3_config.h | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/intel/common/intel_l3_config.c b/src/intel/common/intel_l3_config.c index 5b42339288d..4f9da3eca3c 100644 --- a/src/intel/common/intel_l3_config.c +++ b/src/intel/common/intel_l3_config.c @@ -368,10 +368,21 @@ intel_get_l3_config_urb_size(const struct intel_device_info *devinfo, * only 1008KB of this will be used." */ const unsigned max = (devinfo->ver == 9 ? 1008 : ~0); - return MIN2(max, cfg->n[INTEL_L3P_URB] * get_l3_way_size(devinfo)) / + return MIN2(max, intel_get_l3_partition_size(devinfo, cfg, INTEL_L3P_URB)) / get_urb_size_scale(devinfo); } +/** + * Return the size of the specified L3 partition in KB. + */ +unsigned +intel_get_l3_partition_size(const struct intel_device_info *devinfo, + const struct intel_l3_config *cfg, + enum intel_l3_partition i) +{ + return cfg->n[i] * get_l3_way_size(devinfo); +} + /** * Print out the specified L3 configuration. */ diff --git a/src/intel/common/intel_l3_config.h b/src/intel/common/intel_l3_config.h index 3f478cb51ee..8ed6c86acad 100644 --- a/src/intel/common/intel_l3_config.h +++ b/src/intel/common/intel_l3_config.h @@ -92,6 +92,11 @@ unsigned intel_get_l3_config_urb_size(const struct intel_device_info *devinfo, const struct intel_l3_config *cfg); +unsigned +intel_get_l3_partition_size(const struct intel_device_info *devinfo, + const struct intel_l3_config *cfg, + enum intel_l3_partition i); + void intel_dump_l3_config(const struct intel_l3_config *cfg, FILE *fp); enum intel_urb_deref_block_size {