summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/intel
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-02-22 13:15:20 -0800
committerEric Anholt <[email protected]>2013-03-05 14:25:00 -0800
commit14cec07177f438717cc6fb9252525e16d6b3d8dd (patch)
treeef3f489d5391a0a861a47e4ed60f976d8d94cff0 /src/mesa/drivers/dri/intel
parent0a1c6bcfb0ecca2ad7d3e1ecaa2c2f49b2a5a50c (diff)
i965: Make perf_debug() output to GL_ARB_debug_output in a debug context.
I tried to ensure that performance in the non-debug case doesn't change (we still just check one condition up front), and I think the impact is small enough in the debug context case to warrant including all of it. Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffer_objects.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h17
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_copy.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_subimage.c2
6 files changed, 21 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index f94c6f570ff..34eb7c9ea2c 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -227,7 +227,7 @@ intel_bufferobj_subdata(struct gl_context * ctx,
drm_intel_bo_unreference(temp_bo);
}
} else {
- if (unlikely(INTEL_DEBUG & DEBUG_PERF)) {
+ if (unlikely(intel->perf_debug)) {
if (drm_intel_bo_busy(intel_obj->buffer)) {
perf_debug("Stalling on the GPU in glBufferSubData().\n");
}
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 435f0974445..9e508f7bb9b 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -803,6 +803,8 @@ intelInitContext(struct intel_context *intel,
"shader_time debugging requires gen7 (Ivybridge) or better.\n");
INTEL_DEBUG &= ~DEBUG_SHADER_TIME;
}
+ if (INTEL_DEBUG & DEBUG_PERF)
+ intel->perf_debug = true;
if (INTEL_DEBUG & DEBUG_AUB)
drm_intel_bufmgr_gem_set_aub_dump(intel->bufmgr, true);
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index c72176ad416..42db5a7d96d 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -239,6 +239,13 @@ struct intel_context
bool no_batch_wrap;
bool tnl_pipeline_running; /**< Set while i915's _tnl_run_pipeline. */
+ /**
+ * Set if we're either a debug context or the INTEL_DEBUG=perf environment
+ * variable is set, this is the flag indicating to do expensive work that
+ * might lead to a perf_debug() call.
+ */
+ bool perf_debug;
+
struct
{
GLuint id;
@@ -462,8 +469,14 @@ extern int INTEL_DEBUG;
} while(0)
#define perf_debug(...) do { \
- if (unlikely(INTEL_DEBUG & DEBUG_PERF)) \
- dbg_printf(__VA_ARGS__); \
+ static GLuint msg_id = 0; \
+ if (unlikely(INTEL_DEBUG & DEBUG_PERF)) \
+ dbg_printf(__VA_ARGS__); \
+ if (intel->perf_debug) \
+ _mesa_gl_debug(&intel->ctx, &msg_id, \
+ MESA_DEBUG_TYPE_PERFORMANCE, \
+ MESA_DEBUG_SEVERITY_MEDIUM, \
+ __VA_ARGS__); \
} while(0)
#define WARN_ONCE(cond, fmt...) do { \
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index a5e49d99e9f..7f535d7cdc4 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -123,7 +123,7 @@ intel_region_map(struct intel_context *intel, struct intel_region *region,
* flush is only needed on first map of the buffer.
*/
- if (unlikely(INTEL_DEBUG & DEBUG_PERF)) {
+ if (unlikely(intel->perf_debug)) {
if (drm_intel_bo_busy(region->bo)) {
perf_debug("Mapping a busy BO, causing a stall on the GPU.\n");
}
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index 085b6fdbd35..6043ed26adb 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -114,8 +114,7 @@ intel_copy_texsubimage(struct intel_context *intel,
}
if (!copy_supported && !copy_supported_with_alpha_override) {
- if (unlikely(INTEL_DEBUG & DEBUG_PERF))
- fprintf(stderr, "%s mismatched formats %s, %s\n",
+ perf_debug("%s mismatched formats %s, %s\n",
__FUNCTION__,
_mesa_get_format_name(intelImage->base.Base.TexFormat),
_mesa_get_format_name(intel_rb_format(irb)));
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index 7a2f713c88f..b02e5fc549a 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -230,7 +230,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
intel_batchbuffer_flush(intel);
}
- if (unlikely(INTEL_DEBUG & DEBUG_PERF)) {
+ if (unlikely(intel->perf_debug)) {
if (drm_intel_bo_busy(bo)) {
perf_debug("Mapping a busy BO, causing a stall on the GPU.\n");
}