ilo: add ILO_DEBUG=draw

It can print out pipe_draw_info and the dirty bits set, useful for debugging.
This commit is contained in:
Chia-I Wu 2013-07-29 13:51:56 +08:00
parent ff3cb378ad
commit 216a576e11
5 changed files with 83 additions and 2 deletions

View file

@ -25,6 +25,7 @@
* Chia-I Wu <olv@lunarg.com>
*/
#include "util/u_prim.h"
#include "intel_winsys.h"
#include "ilo_3d_pipeline.h"
@ -701,6 +702,21 @@ ilo_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
struct ilo_3d *hw3d = ilo->hw3d;
int prim_generated, prim_emitted;
if (ilo_debug & ILO_DEBUG_DRAW) {
if (info->indexed) {
ilo_printf("indexed draw %s: "
"index start %d, count %d, vertex range [%d, %d]\n",
u_prim_name(info->mode), info->start, info->count,
info->min_index, info->max_index);
}
else {
ilo_printf("draw %s: vertex start %d, count %d\n",
u_prim_name(info->mode), info->start, info->count);
}
ilo_dump_dirty_flags(ilo->dirty);
}
if (!ilo_3d_pass_render_condition(ilo))
return;

View file

@ -43,15 +43,24 @@
#define ILO_GEN(gen) ((int) (gen * 100))
#define ILO_GEN_GET_MAJOR(gen) (gen / 100)
/* enable debug flags affecting hot pathes only with debug builds */
#ifdef DEBUG
#define ILO_DEBUG_HOT 1
#else
#define ILO_DEBUG_HOT 0
#endif
enum ilo_debug {
ILO_DEBUG_3D = 1 << 0,
ILO_DEBUG_VS = 1 << 1,
ILO_DEBUG_GS = 1 << 2,
ILO_DEBUG_FS = 1 << 3,
ILO_DEBUG_CS = 1 << 4,
ILO_DEBUG_DRAW = ILO_DEBUG_HOT << 5,
ILO_DEBUG_NOHW = 1 << 8,
ILO_DEBUG_NOCACHE = 1 << 9,
/* flags that affect the behaviors of the driver */
ILO_DEBUG_NOHW = 1 << 20,
ILO_DEBUG_NOCACHE = 1 << 21,
};
struct ilo_dev_info {

View file

@ -46,6 +46,7 @@ static const struct debug_named_value ilo_debug_flags[] = {
{ "gs", ILO_DEBUG_GS, "Dump geometry shaders" },
{ "fs", ILO_DEBUG_FS, "Dump fragment shaders" },
{ "cs", ILO_DEBUG_CS, "Dump compute shaders" },
{ "draw", ILO_DEBUG_DRAW, "Show draw information" },
{ "nohw", ILO_DEBUG_NOHW, "Do not send commands to HW" },
{ "nocache", ILO_DEBUG_NOCACHE, "Always invalidate HW caches" },
DEBUG_NAMED_VALUE_END

View file

@ -1452,3 +1452,55 @@ ilo_mark_states_with_resource_dirty(struct ilo_context *ilo,
ilo->dirty |= states;
}
void
ilo_dump_dirty_flags(uint32_t dirty)
{
static const char *state_names[ILO_STATE_COUNT] = {
[ILO_STATE_VB] = "VB",
[ILO_STATE_VE] = "VE",
[ILO_STATE_IB] = "IB",
[ILO_STATE_VS] = "VS",
[ILO_STATE_GS] = "GS",
[ILO_STATE_SO] = "SO",
[ILO_STATE_CLIP] = "CLIP",
[ILO_STATE_VIEWPORT] = "VIEWPORT",
[ILO_STATE_SCISSOR] = "SCISSOR",
[ILO_STATE_RASTERIZER] = "RASTERIZER",
[ILO_STATE_POLY_STIPPLE] = "POLY_STIPPLE",
[ILO_STATE_SAMPLE_MASK] = "SAMPLE_MASK",
[ILO_STATE_FS] = "FS",
[ILO_STATE_DSA] = "DSA",
[ILO_STATE_STENCIL_REF] = "STENCIL_REF",
[ILO_STATE_BLEND] = "BLEND",
[ILO_STATE_BLEND_COLOR] = "BLEND_COLOR",
[ILO_STATE_FB] = "FB",
[ILO_STATE_SAMPLER_VS] = "SAMPLER_VS",
[ILO_STATE_SAMPLER_GS] = "SAMPLER_GS",
[ILO_STATE_SAMPLER_FS] = "SAMPLER_FS",
[ILO_STATE_SAMPLER_CS] = "SAMPLER_CS",
[ILO_STATE_VIEW_VS] = "VIEW_VS",
[ILO_STATE_VIEW_GS] = "VIEW_GS",
[ILO_STATE_VIEW_FS] = "VIEW_FS",
[ILO_STATE_VIEW_CS] = "VIEW_CS",
[ILO_STATE_CBUF] = "CBUF",
[ILO_STATE_RESOURCE] = "RESOURCE",
[ILO_STATE_CS] = "CS",
[ILO_STATE_CS_RESOURCE] = "CS_RESOURCE",
[ILO_STATE_GLOBAL_BINDING] = "GLOBAL_BINDING",
};
if (!dirty) {
ilo_printf("no state is dirty\n");
return;
}
dirty &= (1U << ILO_STATE_COUNT) - 1;
ilo_printf("%2d states are dirty:", util_bitcount(dirty));
while (dirty) {
const enum ilo_state state = u_bit_scan(&dirty);
ilo_printf(" %s", state_names[state]);
}
ilo_printf("\n");
}

View file

@ -136,4 +136,7 @@ void
ilo_mark_states_with_resource_dirty(struct ilo_context *ilo,
const struct pipe_resource *res);
void
ilo_dump_dirty_flags(uint32_t dirty);
#endif /* ILO_STATE_H */