On Thu, Mar 2, 2017 at 8:36 AM, Timothy Arceri <tarc...@itsqueeze.com> wrote:
>
>
> On 02/03/17 17:17, Ilia Mirkin wrote:
>>
>> On Thu, Mar 2, 2017 at 1:08 AM, Timothy Arceri <tarc...@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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to