intel: use throttle ioctl for throttling
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 30 Dec 2010 21:47:39 +0000 (21:47 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 21 Feb 2011 12:59:37 +0000 (12:59 +0000)
Rather than waiting on the first batch after the last swapbuffers to be
retired, call into the kernel to wait upon the retirement of any request
less than 20ms old. This has the twofold advantage of (a) not blocking
any other clients from utilizing the device whilst we wait and (b) we
attain higher throughput without overloading the system.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/mesa/drivers/dri/intel/intel_batchbuffer.c
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_context.h

index 805f3a3..42b4f92 100644 (file)
@@ -128,11 +128,6 @@ _intel_batchbuffer_flush(struct intel_context *intel,
    if (intel->batch.used == 0)
       return;
 
-   if (intel->first_post_swapbuffers_batch == NULL) {
-      intel->first_post_swapbuffers_batch = intel->batch.bo;
-      drm_intel_bo_reference(intel->first_post_swapbuffers_batch);
-   }
-
    if (unlikely(INTEL_DEBUG & DEBUG_BATCH))
       fprintf(stderr, "%s:%d: Batchbuffer flush with %db used\n", file, line,
              4*intel->batch.used);
index c470feb..7dbd9d9 100644 (file)
@@ -470,11 +470,9 @@ intel_prepare_render(struct intel_context *intel)
     * the swap, and getting our hands on that doesn't seem worth it,
     * 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);
-      drm_intel_bo_unreference(intel->first_post_swapbuffers_batch);
-      intel->first_post_swapbuffers_batch = NULL;
-      intel->need_throttle = GL_FALSE;
+   if (intel->need_throttle) {
+       drmCommandNone(intel->driFd, DRM_I915_GEM_THROTTLE);
+       intel->need_throttle = GL_FALSE;
    }
 }
 
@@ -926,8 +924,6 @@ intelDestroyContext(__DRIcontext * driContextPriv)
       intel->prim.vb = NULL;
       drm_intel_bo_unreference(intel->prim.vb_bo);
       intel->prim.vb_bo = NULL;
-      drm_intel_bo_unreference(intel->first_post_swapbuffers_batch);
-      intel->first_post_swapbuffers_batch = NULL;
 
       driDestroyOptionCache(&intel->optionCache);
 
index 6116764..1ab38b1 100644 (file)
@@ -182,7 +182,6 @@ struct intel_context
       bool is_blit;
    } batch;
 
-   drm_intel_bo *first_post_swapbuffers_batch;
    GLboolean need_throttle;
    GLboolean no_batch_wrap;