[Mesa-dev] [PATCH 2/2] i965: Add way_size_per_bank variable in get_l3_way_size()

Anuj Phogat anuj.phogat at gmail.com
Mon Jun 12 19:53:35 UTC 2017


On Mon, Jun 12, 2017 at 11:12 AM, Francisco Jerez <currojerez at riseup.net> wrote:
> Anuj Phogat <anuj.phogat at gmail.com> writes:
>
>> Adding this variable better explains the computation for L3 way
>> size in the function.
>>
>> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
>> Cc: Francisco Jerez <currojerez at riseup.net>
>> ---
>>  src/intel/common/gen_l3_config.c | 11 ++++++++---
>>  1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/intel/common/gen_l3_config.c b/src/intel/common/gen_l3_config.c
>> index e17994b..76d2eb9 100644
>> --- a/src/intel/common/gen_l3_config.c
>> +++ b/src/intel/common/gen_l3_config.c
>> @@ -274,12 +274,17 @@ gen_get_l3_config(const struct gen_device_info *devinfo,
>>  static unsigned
>>  get_l3_way_size(const struct gen_device_info *devinfo)
>>  {
>> +   unsigned way_size_per_bank;
>> +
>
> I'd rather declare the constant as const (which implies initializing it
> using an initializer expression).
>
I'll make the variable a const.
>>     assert(devinfo->l3_banks);
>>
>> -   if (devinfo->is_broxton)
>> -      return 4;
>> +   if (devinfo->is_broxton_2x6) {
>> +      way_size_per_bank = 4;
>> +   } else {
>> +      way_size_per_bank = 2;
>> +   }
>>
>> -   return 2 * devinfo->l3_banks;
>> +   return way_size_per_bank * devinfo->l3_banks;
>>  }
>>
>>  /**
>> --
>> 2.9.3


More information about the mesa-dev mailing list