[Mesa-dev] [PATCH 2/2] radv: use different builtin shader cache for 32bit
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Mon Aug 20 22:07:12 UTC 2018
On Mon, Aug 20, 2018 at 11:32 PM, Grazvydas Ignotas <notasas at gmail.com> wrote:
> Currently if 64bit and 32bit programs are used interchangeably, radv
> will keep overwriting the cache. Use separate cache files to avoid
> that.
I probably should also split this out per GPU for people who have
different GPUs ...
For now, this series is
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> ---
> src/amd/vulkan/radv_meta.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
> index b8d0a7cfc70..1ec8896afa2 100644
> --- a/src/amd/vulkan/radv_meta.c
> +++ b/src/amd/vulkan/radv_meta.c
> @@ -232,31 +232,29 @@ radv_builtin_cache_path(char *path)
> char *xdg_cache_home = getenv("XDG_CACHE_HOME");
> const char *suffix = "/radv_builtin_shaders";
> const char *suffix2 = "/.cache/radv_builtin_shaders";
> struct passwd pwd, *result;
> char path2[PATH_MAX + 1]; /* PATH_MAX is not a real max,but suffices here. */
> + int ret;
>
> if (xdg_cache_home) {
> -
> - if (strlen(xdg_cache_home) + strlen(suffix) > PATH_MAX)
> - return false;
> -
> - strcpy(path, xdg_cache_home);
> - strcat(path, suffix);
> - return true;
> + ret = snprintf(path, PATH_MAX + 1, "%s%s%zd",
> + xdg_cache_home, suffix, sizeof(void *) * 8);
> + return ret > 0 && ret < PATH_MAX + 1;
> }
>
> getpwuid_r(getuid(), &pwd, path2, PATH_MAX - strlen(suffix2), &result);
> if (!result)
> return false;
>
> strcpy(path, pwd.pw_dir);
> strcat(path, "/.cache");
> mkdir(path, 0755);
>
> - strcat(path, suffix);
> - return true;
> + ret = snprintf(path, PATH_MAX + 1, "%s%s%zd",
> + pwd.pw_dir, suffix2, sizeof(void *) * 8);
> + return ret > 0 && ret < PATH_MAX + 1;
> }
>
> static bool
> radv_load_meta_pipeline(struct radv_device *device)
> {
> --
> 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