Unbreak Viewperf by reverting "util: use crc32_z instead of crc32 and bump zlib dep to 1.2.9"
It breaks apps shipping their own copy of zlib, such as Viewperf.
If we use crc32_z, Viewperf is unable to start because it's an undefined
symbol.
This reverts commit 010272b62e
.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28233>
This commit is contained in:
@@ -1541,7 +1541,8 @@ else
|
|||||||
dep_clock = cc.find_library('rt')
|
dep_clock = cc.find_library('rt')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dep_zlib = dependency('zlib', version : '>= 1.2.9',
|
# IMPORTANT: We can't upgrade Zlib beyond 1.2.5 because it would break Viewperf.
|
||||||
|
dep_zlib = dependency('zlib', version : '>= 1.2.3',
|
||||||
allow_fallback: true,
|
allow_fallback: true,
|
||||||
required : get_option('zlib'))
|
required : get_option('zlib'))
|
||||||
if dep_zlib.found()
|
if dep_zlib.found()
|
||||||
|
@@ -33,15 +33,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "crc32.h"
|
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
uint32_t
|
#endif
|
||||||
util_hash_crc32(const void *data, size_t size)
|
#include "crc32.h"
|
||||||
{
|
|
||||||
return ~crc32_z(0, data, size);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
|
|
||||||
static const uint32_t
|
static const uint32_t
|
||||||
@@ -122,9 +117,18 @@ util_hash_crc32(const void *data, size_t size)
|
|||||||
const uint8_t *p = data;
|
const uint8_t *p = data;
|
||||||
uint32_t crc = 0xffffffff;
|
uint32_t crc = 0xffffffff;
|
||||||
|
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
|
/* Prefer zlib's implementation for better performance.
|
||||||
|
* zlib's uInt is always "unsigned int" while size_t can be 64bit.
|
||||||
|
* Since 1.2.9 there's crc32_z that takes size_t, but use the more
|
||||||
|
* available function to avoid build system complications.
|
||||||
|
*/
|
||||||
|
if ((uInt)size == size)
|
||||||
|
return ~crc32(0, data, size);
|
||||||
|
#endif
|
||||||
|
|
||||||
while (size--)
|
while (size--)
|
||||||
crc = util_crc32_table[(crc ^ *p++) & 0xff] ^ (crc >> 8);
|
crc = util_crc32_table[(crc ^ *p++) & 0xff] ^ (crc >> 8);
|
||||||
|
|
||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
Reference in New Issue
Block a user