[Mesa-dev] [PATCH v2 32/32] disk_cache: Add support for MESA_GLSL_CACHE_TIMESTAMP in debug builds
Jason Ekstrand
jason at jlekstrand.net
Fri Oct 20 23:24:54 UTC 2017
On Thu, Oct 19, 2017 at 3:25 PM, Timothy Arceri <tarceri at itsqueeze.com>
wrote:
> Maybe add to docs?
>
I'm not sure how I feel about that. I'm scared to death of options like
this becoming something some random user on the internet decides they
should use because it keeps the pre-populated shader cache they downloaded
work. To be honest, I'd probably feel more comfortable about it being
hidden behind an "if (0) {" so that you can't get to it without hacking up
the driver. I think I'm ok with it as-is though.
--Jason
> On 19/10/17 16:32, Jordan Justen wrote:
>
>> The MESA_GLSL_CACHE_TIMESTAMP environment variable can be set to
>> override the driver timestamp. Usually the driver will specify a hash
>> of their driver build so the cache items become invalid with each
>> driver build.
>>
>> We don't guarantee a stable serialized shader cache format, so
>> changing the timestamp for each build is required for safety.
>>
>> Nevertheless, during debug, making small changes to the driver may be
>> known to be safe. The driver developer can use this variable to keep
>> the timestamp consistent. When debugging issues on an application for
>> which the shader cache greatly lowers the startup time, this can save
>> the developer significant time.
>>
>> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
>> ---
>> src/util/disk_cache.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
>> index fde6e2e097..54f48a8ba5 100644
>> --- a/src/util/disk_cache.c
>> +++ b/src/util/disk_cache.c
>> @@ -208,6 +208,18 @@ disk_cache_create(const char *gpu_name, const char
>> *timestamp,
>> if (env_var_as_boolean("MESA_GLSL_CACHE_DISABLE", false))
>> goto fail;
>> +#ifdef DEBUG
>> + /* For debug builds, MESA_GLSL_CACHE_TIMESTAMP can be set to override
>> the
>> + * driver specified timestamp. This will allow small changes to be
>> made to
>> + * the driver without invalidating the cache. Given that this is
>> normally
>> + * unsafe, it is only allowed for debug builds.
>> + */
>> + const char *timestamp_override = getenv("MESA_GLSL_CACHE_TIMESTAMP");
>> + if (timestamp_override) {
>> + timestamp = timestamp_override;
>> + }
>> +#endif
>> +
>> /* Determine path for cache based on the first defined name as
>> follows:
>> *
>> * $MESA_GLSL_CACHE_DIR
>>
>> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171020/0210cffd/attachment-0001.html>
More information about the mesa-dev
mailing list