[Mesa-dev] [PATCH 2/3] glsl: disable cache if MESA_EXTENSION_OVERRIDE is set

Nicolai Hähnle nhaehnle at gmail.com
Tue Apr 11 09:22:12 UTC 2017


On 06.04.2017 12:35, Timothy Arceri wrote:
> On 05/04/17 19:58, Nicolai Hähnle wrote:
>> On 05.04.2017 05:56, Timothy Arceri wrote:
>>> In the following patch we will stop pre-processing shaders before
>>> hashing them, so we just disable the cache if MESA_EXTENSION_OVERRIDE
>>> is set.
>>
>> Why can't you add the value of MESA_EXTENSION_OVERRIDE to the hash of
>> shaders?
>
> I could but env vars are normally temporary or experimental things, I
> wasn't sure we would really want these added to the cache, if you prefer
> I can change it.

At least that particular environment setting is pretty permanent I think.

Cheers,
Nicolai


>
>
>>
>> Cheers,
>> Nicolai
>>
>>>
>>> Tested-by: Grazvydas Ignotas <notasas at gmail.com>
>>> ---
>>>  src/util/disk_cache.c | 9 +++++++++
>>>  1 file changed, 9 insertions(+)
>>>
>>> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
>>> index d9de8ef..dc883a3 100644
>>> --- a/src/util/disk_cache.c
>>> +++ b/src/util/disk_cache.c
>>> @@ -167,20 +167,29 @@ disk_cache_create(const char *gpu_name, const
>>> char *timestamp)
>>>  {
>>>     void *local;
>>>     struct disk_cache *cache = NULL;
>>>     char *path, *max_size_str;
>>>     uint64_t max_size;
>>>     int fd = -1;
>>>     struct stat sb;
>>>     struct statvfs vfs = { 0 };
>>>     size_t size;
>>>
>>> +   /* We no longer pre-process shaders before hashing them so disable
>>> the
>>> +    * cache if extensions are overridden.
>>> +    *
>>> +    * Note: Versions are part of the linked programs hash so we don't
>>> need
>>> +    * to worry about those here.
>>> +    */
>>> +   if (getenv("MESA_EXTENSION_OVERRIDE"))
>>> +      return NULL;
>>> +
>>>     /* If running as a users other than the real user disable cache */
>>>     if (geteuid() != getuid())
>>>        return NULL;
>>>
>>>     /* A ralloc context for transient data during this invocation. */
>>>     local = ralloc_context(NULL);
>>>     if (local == NULL)
>>>        goto fail;
>>>
>>>     /* At user request, disable shader cache entirely. */
>>>
>>
>>


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list