[Mesa-dev] [PATCH 1/2] util/disk_cache: support caches for multiple architectures

Mike Lothian mike at fireburn.co.uk
Thu Mar 2 14:03:50 UTC 2017


Is this because the 32bit and 64bit versions have slightly different time
stamps used in the cache directory name? I was under the impression that
the cache itself could be shared between 32bit & 64bit?

I guess this only matters for the few games that offer both a 32bit and
64bit binary, producing duplicate entries in both caches potentially

On Thu, 2 Mar 2017 at 13:16 Grazvydas Ignotas <notasas at gmail.com> wrote:

> On Thu, Mar 2, 2017 at 8:36 AM, Timothy Arceri <tarceri at itsqueeze.com>
> wrote:
> >
> >
> > On 02/03/17 17:17, Ilia Mirkin wrote:
> >>
> >> On Thu, Mar 2, 2017 at 1:08 AM, Timothy Arceri <tarceri at itsqueeze.com>
> >> wrote:
> >>>
> >>> Previously we were deleting the entire cache if a user switched
> >>> between 32 and 64 bit applications.
> >>> ---
> >>>  src/util/disk_cache.c | 21 +++++++++++++++++++++
> >>>  1 file changed, 21 insertions(+)
> >>>
> >>> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> >>> index 3abdec4..1a91c69 100644
> >>> --- a/src/util/disk_cache.c
> >>> +++ b/src/util/disk_cache.c
> >>> @@ -40,20 +40,32 @@
> >>>  #include "zlib.h"
> >>>
> >>>  #include "util/crc32.h"
> >>>  #include "util/u_atomic.h"
> >>>  #include "util/mesa-sha1.h"
> >>>  #include "util/ralloc.h"
> >>>  #include "main/errors.h"
> >>>
> >>>  #include "disk_cache.h"
> >>>
> >>> +#if defined(__x86_64__)
> >>> +#if defined(__ILP32__)
> >>> +#define CACHE_ARCH "x32"
> >>> +#else
> >>> +#define CACHE_ARCH "x86_64"
> >>> +#endif
> >>> +#elif defined(__i386__)
> >>> +#define CACHE_ARCH "i386"
> >>> +#else
> >>> +#define CACHE_ARCH "unknown_arch"
> >>> +#endif
> >>
> >>
> >> This seems incomplete.
> >
> >
> > It's complete enough for what we currently support. Maybe could add
> powerpc
> > but wouldn't be hard to add if someone was worried about that.
>
> ARM is also a potential user with vc4, so the above ifdef tree can
> become quite nasty quick.
>
> You could use (char *)getauxval(AT_PLATFORM) I think, it's Linux
> specific and requires recent enough glibc version (4 years old or so),
> but that should cover majority of cache users IMO.
>
> I'd suggest something like:
> const char *arch = NULL;
> #ifdef HAVE_GETAUXVAL
>    arch = (const char *)getauxval(AT_PLATFORM);
> #endif
> if (!arch)
>    arch = (sizeof(void *) == 8) ? "64" : "32";
>
> This misses x32 but I don't think we should care, mesa was crashing on
> x32 for years until recently (and still is crashing in some
> configurations according to a recent report).
>
> GraÅžvydas
> _______________________________________________
> 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/20170302/d508b6e2/attachment-0001.html>


More information about the mesa-dev mailing list