[Mesa-dev] [PATCH 2/2] i965: Simplify l3 way size computations

Francisco Jerez currojerez at riseup.net
Thu Jun 1 22:36:04 UTC 2017


Anuj Phogat <anuj.phogat at gmail.com> writes:

> By making use of l3_banks field in gen_device_info struct
> l3_way_size for gen7+ = 2 * l3_banks.
>
> Suggested-by: Francisco Jerez <currojerez at riseup.net>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> Cc: Francisco Jerez <currojerez at riseup.net>
> ---
>  src/intel/common/gen_l3_config.c | 21 ++-------------------
>  1 file changed, 2 insertions(+), 19 deletions(-)
>
> diff --git a/src/intel/common/gen_l3_config.c b/src/intel/common/gen_l3_config.c
> index 0783217..f0da0f4 100644
> --- a/src/intel/common/gen_l3_config.c
> +++ b/src/intel/common/gen_l3_config.c
> @@ -249,24 +249,6 @@ gen_get_l3_config(const struct gen_device_info *devinfo,
>  }
>  
>  /**
> - * Return the size of an L3 way in KB.
> - */
> -static unsigned
> -get_l3_way_size(const struct gen_device_info *devinfo)
> -{

ISTR there were some scattered references to this function from
comments.  Because it's nice to be able to point people at this function
when somebody asks the question what units the xxx_l3_configs tables are
in, I wouldn't mind you leaving the function around even if you cut it
down to a single line of code (the return statement).  Other than
that, looks good to me.

> -   if (devinfo->is_baytrail)
> -      return 2;
> -
> -   else if (devinfo->gt == 1 ||
> -            devinfo->is_cherryview ||
> -            devinfo->is_broxton)
> -      return 4;
> -
> -   else
> -      return 8 * devinfo->num_slices;
> -}
> -
> -/**
>   * Return the unit brw_context::urb::size is expressed in, in KB.  \sa
>   * gen_device_info::urb::size.
>   */
> @@ -288,8 +270,9 @@ gen_get_l3_config_urb_size(const struct gen_device_info *devinfo,
>      * allocation of the L3 data array to provide 3*384KB=1152KB for URB, but
>      * only 1008KB of this will be used."
>      */
> +   const unsigned l3_way_size = 2 * devinfo->l3_banks; /* KB */
>     const unsigned max = (devinfo->gen == 9 ? 1008 : ~0);
> -   return MIN2(max, cfg->n[GEN_L3P_URB] * get_l3_way_size(devinfo)) /
> +   return MIN2(max, cfg->n[GEN_L3P_URB] * l3_way_size) /
>            get_urb_size_scale(devinfo);
>  }
>  
> -- 
> 2.9.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170601/278384ce/attachment.sig>


More information about the mesa-dev mailing list