intel: Add extra zeros at the end of debug identifiers

Add at least a full aligned uint64_t of zero padding at the end
to make the identifiers easier to spot.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21479>
This commit is contained in:
Caio Oliveira 2023-02-22 19:07:52 -08:00 committed by Marge Bot
parent 387d131f96
commit ea0ec8c562

View file

@ -37,6 +37,7 @@
#include "git_sha1.h"
#include "util/macros.h"
#include "util/u_debug.h"
#include "util/u_math.h"
#include "c11/threads.h"
uint64_t intel_debug = 0;
@ -286,6 +287,16 @@ intel_debug_write_identifiers(void *_output,
assert(output < output_end);
/* Add at least a full aligned uint64_t of zero padding at the end
* to make the identifiers easier to spot.
*/
const unsigned unpadded_len = output - _output;
const unsigned padding = ALIGN(unpadded_len + 8, 8) - unpadded_len;
memset(output, 0, padding);
output += padding;
assert(output < output_end);
/* Return the how many bytes where written, so that the rest of the buffer
* can be used for other things.
*/