[Mesa-dev] [PATCH v2 32/32] disk_cache: Add support for MESA_GLSL_CACHE_TIMESTAMP in debug builds
Jordan Justen
jordan.l.justen at intel.com
Sat Oct 21 02:13:21 UTC 2017
On 2017-10-20 16:24:54, Jason Ekstrand wrote:
> 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.
It should only work in DEBUG builds, so I don't think I'm as worried
about the random user issue. I share your concern about documenting
it, but if it clearly said "in DEBUG builds", then I guess it'd
probably be okay.
> 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.
I guess at that point you could just add this to disk_cache.c:
timestamp = "now";
Why don't I just drop this patch for now. (But, I did make use of it
quite a bit.)
-Jordan
>
> > 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
> >
More information about the mesa-dev
mailing list