intel: Add always_flush_cache driconf option for debugging cache flush failure.

I keep wanting to hack this knob in as a one-time thing, so it seemed useful
to have all the time.
This commit is contained in:
Eric Anholt
2009-03-05 17:08:36 -08:00
parent 9882695052
commit f3687284c1
7 changed files with 42 additions and 2 deletions

View File

@@ -546,3 +546,13 @@ DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
DRI_CONF_DESC(fr,"Activer l'extension GL_NV_vertex_program") \ DRI_CONF_DESC(fr,"Activer l'extension GL_NV_vertex_program") \
DRI_CONF_DESC(sv,"Aktivera tillägget GL_NV_vertex_program") \ DRI_CONF_DESC(sv,"Aktivera tillägget GL_NV_vertex_program") \
DRI_CONF_OPT_END DRI_CONF_OPT_END
#define DRI_CONF_ALWAYS_FLUSH_CACHE(def) \
DRI_CONF_OPT_BEGIN(always_flush_cache,bool,def) \
DRI_CONF_DESC(en,"Enable flushing GPU caches with each draw call") \
DRI_CONF_DESC(de,"Enable flushing GPU caches with each draw call") \
DRI_CONF_DESC(es,"Enable flushing GPU caches with each draw call") \
DRI_CONF_DESC(nl,"Enable flushing GPU caches with each draw call") \
DRI_CONF_DESC(fr,"Enable flushing GPU caches with each draw call") \
DRI_CONF_DESC(sv,"Enable flushing GPU caches with each draw call") \
DRI_CONF_OPT_END

View File

@@ -237,3 +237,8 @@ DRI_CONF_OPT_END
DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \ DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
DRI_CONF_DESC(en,gettext("Enable extension GL_NV_vertex_program")) \ DRI_CONF_DESC(en,gettext("Enable extension GL_NV_vertex_program")) \
DRI_CONF_OPT_END DRI_CONF_OPT_END
#define DRI_CONF_ALWAYS_FLUSH_CACHE(def) \
DRI_CONF_OPT_BEGIN(always_flush_cache,bool,def) \
DRI_CONF_DESC(en,gettext("Enable flushing GPU caches with each draw call")) \
DRI_CONF_OPT_END

View File

@@ -127,6 +127,7 @@ static void brw_emit_prim(struct brw_context *brw,
uint32_t hw_prim) uint32_t hw_prim)
{ {
struct brw_3d_primitive prim_packet; struct brw_3d_primitive prim_packet;
struct intel_context *intel = &brw->intel;
if (INTEL_DEBUG & DEBUG_PRIMS) if (INTEL_DEBUG & DEBUG_PRIMS)
_mesa_printf("PRIM: %s %d %d\n", _mesa_lookup_enum_by_nr(prim->mode), _mesa_printf("PRIM: %s %d %d\n", _mesa_lookup_enum_by_nr(prim->mode),
@@ -146,10 +147,27 @@ static void brw_emit_prim(struct brw_context *brw,
/* Can't wrap here, since we rely on the validated state. */ /* Can't wrap here, since we rely on the validated state. */
brw->no_batch_wrap = GL_TRUE; brw->no_batch_wrap = GL_TRUE;
/* If we're set to always flush, do it before and after the primitive emit.
* We want to catch both missed flushes that hurt instruction/state cache
* and missed flushes of the render cache as it heads to other parts of
* the besides the draw code.
*/
if (intel->always_flush_cache) {
BEGIN_BATCH(1, IGNORE_CLIPRECTS);
OUT_BATCH(intel->vtbl.flush_cmd());
ADVANCE_BATCH();
}
if (prim_packet.verts_per_instance) { if (prim_packet.verts_per_instance) {
intel_batchbuffer_data( brw->intel.batch, &prim_packet, intel_batchbuffer_data( brw->intel.batch, &prim_packet,
sizeof(prim_packet), LOOP_CLIPRECTS); sizeof(prim_packet), LOOP_CLIPRECTS);
} }
if (intel->always_flush_cache) {
BEGIN_BATCH(1, IGNORE_CLIPRECTS);
OUT_BATCH(intel->vtbl.flush_cmd());
ADVANCE_BATCH();
}
brw->no_batch_wrap = GL_FALSE; brw->no_batch_wrap = GL_FALSE;
} }

View File

@@ -207,7 +207,7 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
used); used);
/* Emit a flush if the bufmgr doesn't do it for us. */ /* Emit a flush if the bufmgr doesn't do it for us. */
if (!intel->ttm) { if (intel->always_flush_cache || !intel->ttm) {
*(GLuint *) (batch->ptr) = intel->vtbl.flush_cmd(); *(GLuint *) (batch->ptr) = intel->vtbl.flush_cmd();
batch->ptr += 4; batch->ptr += 4;
used = batch->ptr - batch->map; used = batch->ptr - batch->map;

View File

@@ -618,6 +618,11 @@ intelInitContext(struct intel_context *intel,
intel->no_rast = 1; intel->no_rast = 1;
} }
if (driQueryOptionb(&intel->optionCache, "always_flush_cache")) {
fprintf(stderr, "flushing GPU caches before/after each draw call\n");
intel->always_flush_cache = 1;
}
/* Disable all hardware rendering (skip emitting batches and fences/waits /* Disable all hardware rendering (skip emitting batches and fences/waits
* to the kernel) * to the kernel)
*/ */

View File

@@ -228,6 +228,7 @@ struct intel_context
GLboolean hw_stipple; GLboolean hw_stipple;
GLboolean depth_buffer_is_float; GLboolean depth_buffer_is_float;
GLboolean no_rast; GLboolean no_rast;
GLboolean always_flush_cache;
/* 0 - nonconformant, best performance; /* 0 - nonconformant, best performance;
* 1 - fallback to sw for known conformance bugs * 1 - fallback to sw for known conformance bugs

View File

@@ -71,10 +71,11 @@ PUBLIC const char __driConfigOptions[] =
DRI_CONF_SECTION_END DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG DRI_CONF_SECTION_DEBUG
DRI_CONF_NO_RAST(false) DRI_CONF_NO_RAST(false)
DRI_CONF_ALWAYS_FLUSH_CACHE(false)
DRI_CONF_SECTION_END DRI_CONF_SECTION_END
DRI_CONF_END; DRI_CONF_END;
const GLuint __driNConfigOptions = 6; const GLuint __driNConfigOptions = 7;
#ifdef USE_NEW_INTERFACE #ifdef USE_NEW_INTERFACE
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;