i965: Add a driconf option to disable flush throttling.
authorPaul Berry <stereotype441@gmail.com>
Tue, 19 Mar 2013 18:49:08 +0000 (11:49 -0700)
committerPaul Berry <stereotype441@gmail.com>
Thu, 21 Mar 2013 20:24:43 +0000 (13:24 -0700)
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 <eric@anholt.net>
src/mesa/drivers/dri/common/xmlpool/t_options.h
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_context.h
src/mesa/drivers/dri/intel/intel_screen.c

index 1e7eced06bd0951780b993ca9dc11fbf29c3cb8f..7b441c68f2dad8c84e7fc3119952be1ae5e19574 100644 (file)
@@ -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'")) \
index 2df70b75b472d1d4dfd14f4d7bf5b5d11eefad1e..bf4045eb3b658601971ce6b6b42010e3aeaa61f9 100644 (file)
@@ -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;
 }
 
index 2df15d4f3df6a0042357256f9a5cc75cd5523abe..59cf1979f0e9d68f5f32a1611db710f3ac2e7d65 100644 (file)
@@ -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.
     */
index 32e92594c0821fe8c976d7ef76b0f8a7bb9ad982..3ca10c8e5348e0a789b6d9bb9934c6c0a0952fb6 100644 (file)
@@ -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"