Module: Mesa Branch: main Commit: ea0ec8c56284b1821711e5666571927489513b3e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea0ec8c56284b1821711e5666571927489513b3e
Author: Caio Oliveira <[email protected]> Date: Wed Feb 22 19:07:52 2023 -0800 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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21479> --- src/intel/dev/intel_debug.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/intel/dev/intel_debug.c b/src/intel/dev/intel_debug.c index 7650a62956d..0c46c55d05c 100644 --- a/src/intel/dev/intel_debug.c +++ b/src/intel/dev/intel_debug.c @@ -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. */
