From eea30dff43a5c9478e9e6056d0a8086b50a0bcb5 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 19 Mar 2013 11:49:08 -0700 Subject: [PATCH] i965: Add a driconf option to disable flush throttling. Normally when submitting the first batch buffer after a flush, we check whether the GPU has completed processing of the first batch buffer of the previous frame. If it hasn't, we wait for it to finish before submitting any more batches. This prevents GPU-heavy and CPU-light applications from racing too far ahead of the current frame, but at the expense of possibly lower frame rates. Sometimes when benchmarking we want to disable this mechanism. This patch adds the driconf option "disable_throttling" to disable the throttling mechanism. Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/common/xmlpool/t_options.h | 5 +++++ src/mesa/drivers/dri/intel/intel_context.c | 8 +++++++- src/mesa/drivers/dri/intel/intel_context.h | 1 + src/mesa/drivers/dri/intel/intel_screen.c | 3 ++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h index 1e7eced06bd..7b441c68f2d 100644 --- a/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -75,6 +75,11 @@ 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 +#define DRI_CONF_DISABLE_THROTTLING(def) \ +DRI_CONF_OPT_BEGIN(disable_throttling,bool,def) \ + DRI_CONF_DESC(en,gettext("Disable throttling on first batch after flush")) \ +DRI_CONF_OPT_END + #define DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(def) \ DRI_CONF_OPT_BEGIN(force_glsl_extensions_warn,bool,def) \ DRI_CONF_DESC(en,gettext("Force GLSL extension default behavior to 'warn'")) \ diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 2df70b75b47..bf4045eb3b6 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -440,7 +440,8 @@ intel_prepare_render(struct intel_context *intel) * so we just us the first batch we emitted after the last swap. */ if (intel->need_throttle && intel->first_post_swapbuffers_batch) { - drm_intel_bo_wait_rendering(intel->first_post_swapbuffers_batch); + if (!intel->disable_throttling) + drm_intel_bo_wait_rendering(intel->first_post_swapbuffers_batch); drm_intel_bo_unreference(intel->first_post_swapbuffers_batch); intel->first_post_swapbuffers_batch = NULL; intel->need_throttle = false; @@ -841,6 +842,11 @@ intelInitContext(struct intel_context *intel, intel->always_flush_cache = 1; } + if (driQueryOptionb(&intel->optionCache, "disable_throttling")) { + fprintf(stderr, "disabling flush throttling\n"); + intel->disable_throttling = 1; + } + return true; } diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 2df15d4f3df..59cf1979f0e 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -285,6 +285,7 @@ struct intel_context bool no_rast; bool always_flush_batch; bool always_flush_cache; + bool disable_throttling; /* State for intelvb.c and inteltris.c. */ diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 32e92594c08..3ca10c8e534 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -80,6 +80,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_NO_RAST(false) DRI_CONF_ALWAYS_FLUSH_BATCH(false) DRI_CONF_ALWAYS_FLUSH_CACHE(false) + DRI_CONF_DISABLE_THROTTLING(false) DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(false) DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(false) DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(false) @@ -94,7 +95,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_SECTION_END DRI_CONF_END; -const GLuint __driNConfigOptions = 16; +const GLuint __driNConfigOptions = 17; #include "intel_batchbuffer.h" #include "intel_buffers.h" -- 2.11.0