svga: use the debug callback to report issues to the state tracker

Use the new debug callback hook to report conformance, performance
and fallbacks to the state tracker.  The state tracker, in turn can
report this issues to the user via the GL_ARB_debug_output extension.

More issues can be reported in the future; this is just a start.

v2: remove conditionals around pipe_debug_message() calls since the
check is now done in the macro itself.
v3: remove unneeded dummy %s substitutions

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>,
Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
Brian Paul
2015-12-04 12:26:35 -07:00
parent 5effc3ae74
commit 32a6e081c3
6 changed files with 62 additions and 0 deletions
+3
View File
@@ -392,6 +392,9 @@ struct svga_context
boolean no_line_width;
boolean force_hw_line_stipple;
/** To report perf/conformance/etc issues to the state tracker */
struct pipe_debug_callback callback;
} debug;
struct {
@@ -26,6 +26,7 @@
#include "svga_cmd.h"
#include "util/u_inlines.h"
#include "util/u_prim.h"
#include "indices/u_indices.h"
#include "svga_hw_reg.h"
@@ -277,6 +278,10 @@ svga_hwtnl_draw_arrays(struct svga_hwtnl *hwtnl,
if (ret != PIPE_OK)
goto done;
pipe_debug_message(&svga->debug.callback, PERF_INFO,
"generating temporary index buffer for drawing %s",
u_prim_name(prim));
ret = svga_hwtnl_simple_draw_range_elements(hwtnl,
gen_buf,
gen_size,
@@ -243,6 +243,15 @@ svga_create_blend_state(struct pipe_context *pipe,
blend->rt[i].srcblend_alpha = blend->rt[i].srcblend;
blend->rt[i].dstblend_alpha = blend->rt[i].dstblend;
blend->rt[i].blendeq_alpha = blend->rt[i].blendeq;
if (templ->logicop_func == PIPE_LOGICOP_XOR) {
pipe_debug_message(&svga->debug.callback, CONFORMANCE,
"XOR logicop mode has limited support");
}
else if (templ->logicop_func != PIPE_LOGICOP_COPY) {
pipe_debug_message(&svga->debug.callback, CONFORMANCE,
"general logicops are not supported");
}
}
else {
/* Note: the vgpu10 device does not yet support independent
+17
View File
@@ -244,6 +244,22 @@ static void svga_set_viewport_states( struct pipe_context *pipe,
}
/**
* Called by state tracker to specify a callback function the driver
* can use to report info back to the state tracker.
*/
static void
svga_set_debug_callback(struct pipe_context *pipe,
const struct pipe_debug_callback *cb)
{
struct svga_context *svga = svga_context(pipe);
if (cb)
svga->debug.callback = *cb;
else
memset(&svga->debug.callback, 0, sizeof(svga->debug.callback));
}
void svga_init_misc_functions( struct svga_context *svga )
{
@@ -252,6 +268,7 @@ void svga_init_misc_functions( struct svga_context *svga )
svga->pipe.set_framebuffer_state = svga_set_framebuffer_state;
svga->pipe.set_clip_state = svga_set_clip_state;
svga->pipe.set_viewport_states = svga_set_viewport_states;
svga->pipe.set_debug_callback = svga_set_debug_callback;
}
@@ -352,6 +352,11 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
define_rasterizer_object(svga, rast);
}
if (templ->poly_smooth) {
pipe_debug_message(&svga->debug.callback, CONFORMANCE,
"GL_POLYGON_SMOOTH not supported");
}
svga->hud.num_state_objects++;
return rast;
@@ -62,6 +62,7 @@ update_need_pipeline(struct svga_context *svga, unsigned dirty)
{
boolean need_pipeline = FALSE;
struct svga_vertex_shader *vs = svga->curr.vs;
const char *reason = "";
/* SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE
*/
@@ -76,6 +77,20 @@ update_need_pipeline(struct svga_context *svga, unsigned dirty)
svga->curr.rast->need_pipeline_lines_str,
svga->curr.rast->need_pipeline_points_str);
need_pipeline = TRUE;
switch (svga->curr.reduced_prim) {
case PIPE_PRIM_POINTS:
reason = svga->curr.rast->need_pipeline_points_str;
break;
case PIPE_PRIM_LINES:
reason = svga->curr.rast->need_pipeline_lines_str;
break;
case PIPE_PRIM_TRIANGLES:
reason = svga->curr.rast->need_pipeline_tris_str;
break;
default:
assert(!"Unexpected reduced prim type");
}
}
/* EDGEFLAGS
@@ -83,6 +98,7 @@ update_need_pipeline(struct svga_context *svga, unsigned dirty)
if (vs && vs->base.info.writes_edgeflag) {
SVGA_DBG(DEBUG_SWTNL, "%s: edgeflags\n", __FUNCTION__);
need_pipeline = TRUE;
reason = "edge flags";
}
/* SVGA_NEW_FS, SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE
@@ -104,6 +120,7 @@ update_need_pipeline(struct svga_context *svga, unsigned dirty)
* point stage.
*/
need_pipeline = TRUE;
reason = "point sprite coordinate generation";
}
}
@@ -116,6 +133,12 @@ update_need_pipeline(struct svga_context *svga, unsigned dirty)
if (0 && svga->state.sw.need_pipeline)
debug_printf("sw.need_pipeline = %d\n", svga->state.sw.need_pipeline);
if (svga->state.sw.need_pipeline) {
assert(reason);
pipe_debug_message(&svga->debug.callback, FALLBACK,
"Using semi-fallback for %s", reason);
}
return PIPE_OK;
}