[Mesa-dev] [PATCH 6/6] util: disable cache if we have no build-id and timestamp is zero

Timothy Arceri tarceri at itsqueeze.com
Wed Sep 19 12:55:44 UTC 2018



On 19/9/18 9:32 pm, Bas Nieuwenhuizen wrote:
> On Wed, Sep 19, 2018 at 4:14 AM Timothy Arceri <tarceri at itsqueeze.com> wrote:
>>
>> Timestamp can be zero for example when Flatpack is used. In this
>> case just disable the cache rather then segfaulting when
>> incompatible cache items are loaded.
>> ---
>>   src/amd/vulkan/radv_device.c | 4 ----
>>   src/util/disk_cache.h        | 6 ++++++
>>   2 files changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
>> index f9169d9d012..7d915c68aaa 100644
>> --- a/src/amd/vulkan/radv_device.c
>> +++ b/src/amd/vulkan/radv_device.c
>> @@ -61,10 +61,6 @@ radv_get_build_id(void *ptr, struct mesa_sha1 *ctx)
>>          } else
>>   #endif
>>          if (disk_cache_get_function_timestamp(ptr, &timestamp)) {
>> -               if (!timestamp) {
>> -                       fprintf(stderr, "radv: The provided filesystem timestamp for the cache is bogus!\n");
>> -               }
>> -
>>                  _mesa_sha1_update(ctx, &timestamp, sizeof(timestamp));
>>          } else
>>                  return false;
>> diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h
>> index 962a26ffc8c..c37acd75830 100644
>> --- a/src/util/disk_cache.h
>> +++ b/src/util/disk_cache.h
>> @@ -102,6 +102,12 @@ disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
>>         return false;
>>      }
>>      *timestamp = st.st_mtime;
>> +
>> +   if (!timestamp) {
>> +      fprintf(stderr, "Mesa: The provided filesystem timestamp for the cache "
>> +              "is bogus! Disabling On-disk cache.\n");
> 
> Wouldn't this need a "return false;" ?

Yeah and it also should be if (!st.st_mtime) rather than null checking 
the timestamp pointer.

Sorry I made a mess of this patch.

>> +   }
>> +
>>      return true;
>>   }
>>
>> --
>> 2.17.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list