mirror of https://gitlab.freedesktop.org/mesa/mesa
intel/tools: Move ascii85_decode_char() to error_decode_lib
This was re-implemented in several places, so lets share it. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28720>
This commit is contained in:
parent
33bc079050
commit
9b58301766
|
@ -44,6 +44,7 @@
|
|||
#include "compiler/elk/elk_compiler.h"
|
||||
#include "decoder/intel_decoder.h"
|
||||
#include "dev/intel_debug.h"
|
||||
#include "error_decode_lib.h"
|
||||
#include "util/macros.h"
|
||||
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
|
|
@ -68,22 +68,3 @@ dump_shader_binary(void *user_data, const char *short_name,
|
|||
fwrite(data, data_length, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
const char *
|
||||
ascii85_decode_char(const char *in, uint32_t *v)
|
||||
{
|
||||
*v = 0;
|
||||
|
||||
if (*in == 'z') {
|
||||
in++;
|
||||
} else {
|
||||
*v += in[0] - 33; *v *= 85;
|
||||
*v += in[1] - 33; *v *= 85;
|
||||
*v += in[2] - 33; *v *= 85;
|
||||
*v += in[3] - 33; *v *= 85;
|
||||
*v += in[4] - 33;
|
||||
in += 5;
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
|
|
@ -13,5 +13,3 @@ void
|
|||
dump_shader_binary(void *user_data, const char *short_name,
|
||||
uint64_t address, const void *data,
|
||||
unsigned data_length);
|
||||
|
||||
const char *ascii85_decode_char(const char *in, uint32_t *v);
|
|
@ -10,6 +10,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "aubinator_error_decode_lib.h"
|
||||
#include "error_decode_lib.h"
|
||||
#include "error_decode_xe_lib.h"
|
||||
#include "intel/compiler/brw_isa_info.h"
|
||||
#include "intel/dev/intel_device_info.h"
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "util/list.h"
|
||||
|
||||
#include "aub_write.h"
|
||||
#include "error_decode_lib.h"
|
||||
#include "intel_aub.h"
|
||||
|
||||
#define fail_if(cond, ...) _fail_if(cond, NULL, __VA_ARGS__)
|
||||
|
@ -107,16 +108,7 @@ static int ascii85_decode(const char *in, uint32_t **out, bool inflate)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (*in == 'z') {
|
||||
in++;
|
||||
} else {
|
||||
v += in[0] - 33; v *= 85;
|
||||
v += in[1] - 33; v *= 85;
|
||||
v += in[2] - 33; v *= 85;
|
||||
v += in[3] - 33; v *= 85;
|
||||
v += in[4] - 33;
|
||||
in += 5;
|
||||
}
|
||||
in = ascii85_decode_char(in, &v);
|
||||
(*out)[len++] = v;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "common/intel_hang_dump.h"
|
||||
|
||||
#include "error_decode_lib.h"
|
||||
#include "intel/dev/intel_device_info.h"
|
||||
|
||||
static inline void
|
||||
|
@ -127,16 +128,7 @@ static int ascii85_decode(const char *in, uint32_t **out, bool inflate)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (*in == 'z') {
|
||||
in++;
|
||||
} else {
|
||||
v += in[0] - 33; v *= 85;
|
||||
v += in[1] - 33; v *= 85;
|
||||
v += in[2] - 33; v *= 85;
|
||||
v += in[3] - 33; v *= 85;
|
||||
v += in[4] - 33;
|
||||
in += 5;
|
||||
}
|
||||
in = ascii85_decode_char(in, &v);
|
||||
(*out)[len++] = v;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright 2024 Intel Corporation
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "error_decode_lib.h"
|
||||
|
||||
const char *
|
||||
ascii85_decode_char(const char *in, uint32_t *v)
|
||||
{
|
||||
*v = 0;
|
||||
|
||||
if (*in == 'z') {
|
||||
in++;
|
||||
} else {
|
||||
*v += in[0] - 33; *v *= 85;
|
||||
*v += in[1] - 33; *v *= 85;
|
||||
*v += in[2] - 33; *v *= 85;
|
||||
*v += in[3] - 33; *v *= 85;
|
||||
*v += in[4] - 33;
|
||||
in += 5;
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* Copyright 2024 Intel Corporation
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
const char *ascii85_decode_char(const char *in, uint32_t *v);
|
|
@ -49,6 +49,8 @@ aubinator_error_decode = executable(
|
|||
'aubinator_error_decode_lib.h',
|
||||
'aubinator_error_decode_xe.c',
|
||||
'aubinator_error_decode_xe.h',
|
||||
'error_decode_lib.c',
|
||||
'error_decode_lib.h',
|
||||
'error_decode_xe_lib.c',
|
||||
'error_decode_xe_lib.h'),
|
||||
dependencies : [idep_mesautil, dep_zlib, dep_thread, idep_intel_dev,
|
||||
|
@ -63,7 +65,11 @@ aubinator_error_decode = executable(
|
|||
|
||||
error2aub = executable(
|
||||
'intel_error2aub',
|
||||
files('aub_write.h', 'aub_write.c', 'error2aub.c'),
|
||||
files('aub_write.h',
|
||||
'aub_write.c',
|
||||
'error2aub.c',
|
||||
'error_decode_lib.c',
|
||||
'error_decode_lib.h'),
|
||||
dependencies : [dep_zlib, dep_dl, dep_thread, dep_m, idep_intel_dev],
|
||||
include_directories : [inc_include, inc_src, inc_intel],
|
||||
c_args : [no_override_init_args],
|
||||
|
@ -73,7 +79,9 @@ error2aub = executable(
|
|||
|
||||
error2hangdump = executable(
|
||||
'intel_error2hangdump',
|
||||
files('error2hangdump.c'),
|
||||
files('error2hangdump.c',
|
||||
'error_decode_lib.c',
|
||||
'error_decode_lib.h'),
|
||||
dependencies : [dep_zlib, dep_dl, dep_thread, dep_m, idep_intel_dev],
|
||||
include_directories : [inc_include, inc_src, inc_intel],
|
||||
c_args : [no_override_init_args],
|
||||
|
|
Loading…
Reference in New Issue