mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
gallium/u_dump: add and use util_dump_transfer_usage
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
9b8033a4a7
commit
8491fcafab
4 changed files with 61 additions and 16 deletions
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_dump.h"
|
||||
#include "pipe/p_format.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "util/u_inlines.h"
|
||||
|
|
@ -484,21 +485,9 @@ debug_funclog_enter_exit(const char* f, const int line, const char* file)
|
|||
void
|
||||
debug_print_transfer_flags(const char *msg, unsigned usage)
|
||||
{
|
||||
static const struct debug_named_value names[] = {
|
||||
DEBUG_NAMED_VALUE(PIPE_TRANSFER_READ),
|
||||
DEBUG_NAMED_VALUE(PIPE_TRANSFER_WRITE),
|
||||
DEBUG_NAMED_VALUE(PIPE_TRANSFER_MAP_DIRECTLY),
|
||||
DEBUG_NAMED_VALUE(PIPE_TRANSFER_DISCARD_RANGE),
|
||||
DEBUG_NAMED_VALUE(PIPE_TRANSFER_DONTBLOCK),
|
||||
DEBUG_NAMED_VALUE(PIPE_TRANSFER_UNSYNCHRONIZED),
|
||||
DEBUG_NAMED_VALUE(PIPE_TRANSFER_FLUSH_EXPLICIT),
|
||||
DEBUG_NAMED_VALUE(PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE),
|
||||
DEBUG_NAMED_VALUE(PIPE_TRANSFER_PERSISTENT),
|
||||
DEBUG_NAMED_VALUE(PIPE_TRANSFER_COHERENT),
|
||||
DEBUG_NAMED_VALUE_END
|
||||
};
|
||||
|
||||
debug_printf("%s: %s\n", msg, debug_dump_flags(names, usage));
|
||||
debug_printf("%s: ", msg);
|
||||
util_dump_transfer_usage(stdout, usage);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,9 @@ util_dump_query_type(FILE *stream, unsigned value);
|
|||
void
|
||||
util_dump_query_value_type(FILE *stream, unsigned value);
|
||||
|
||||
void
|
||||
util_dump_transfer_usage(FILE *stream, unsigned value);
|
||||
|
||||
/*
|
||||
* p_state.h, through a FILE
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_dump.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
|
||||
#if 0
|
||||
|
|
@ -89,6 +90,41 @@ util_dump_enum_continuous(unsigned value,
|
|||
return util_dump_enum_continuous(value, ARRAY_SIZE(util_##_name##_names), util_##_name##_names); \
|
||||
}
|
||||
|
||||
static void
|
||||
util_dump_flags_continuous(FILE *stream, unsigned value, unsigned num_names,
|
||||
const char * const *names)
|
||||
{
|
||||
unsigned unknown = 0;
|
||||
bool first = true;
|
||||
|
||||
while (value) {
|
||||
int i = u_bit_scan(&value);
|
||||
if (i >= num_names || !names[i])
|
||||
unknown |= 1u << i;
|
||||
if (!first)
|
||||
fputs("|", stream);
|
||||
fputs(names[i], stream);
|
||||
first = false;
|
||||
}
|
||||
|
||||
if (unknown) {
|
||||
if (!first)
|
||||
fputs("|", stream);
|
||||
fprintf(stream, "%x", unknown);
|
||||
first = false;
|
||||
}
|
||||
|
||||
if (first)
|
||||
fputs("0", stream);
|
||||
}
|
||||
|
||||
#define DEFINE_UTIL_DUMP_FLAGS_CONTINUOUS(_name) \
|
||||
void \
|
||||
util_dump_##_name(FILE *stream, unsigned value) \
|
||||
{ \
|
||||
util_dump_flags_continuous(stream, value, ARRAY_SIZE(util_##_name##_names), \
|
||||
util_##_name##_names); \
|
||||
}
|
||||
|
||||
static const char *
|
||||
util_blend_factor_names[] = {
|
||||
|
|
@ -470,3 +506,20 @@ util_dump_query_value_type(FILE *stream, unsigned value)
|
|||
{
|
||||
fprintf(stream, "%s", util_str_query_value_type(value, false));
|
||||
}
|
||||
|
||||
|
||||
static const char * const
|
||||
util_transfer_usage_names[] = {
|
||||
"PIPE_TRANSFER_READ",
|
||||
"PIPE_TRANSFER_WRITE",
|
||||
"PIPE_TRANSFER_MAP_DIRECTLY",
|
||||
"PIPE_TRANSFER_DISCARD_RANGE",
|
||||
"PIPE_TRANSFER_DONTBLOCK",
|
||||
"PIPE_TRANSFER_UNSYNCHRONIZED",
|
||||
"PIPE_TRANSFER_FLUSH_EXPLICIT",
|
||||
"PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE",
|
||||
"PIPE_TRANSFER_PERSISTENT",
|
||||
"PIPE_TRANSFER_COHERENT",
|
||||
};
|
||||
|
||||
DEFINE_UTIL_DUMP_FLAGS_CONTINUOUS(transfer_usage)
|
||||
|
|
|
|||
|
|
@ -812,7 +812,7 @@ util_dump_transfer(FILE *stream, const struct pipe_transfer *state)
|
|||
|
||||
util_dump_member(stream, ptr, state, resource);
|
||||
util_dump_member(stream, uint, state, level);
|
||||
util_dump_member(stream, uint, state, usage);
|
||||
util_dump_member(stream, transfer_usage, state, usage);
|
||||
util_dump_member_begin(stream, "box");
|
||||
util_dump_box(stream, &state->box);
|
||||
util_dump_member_end(stream);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue