i915g: add some throttling
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 21 Feb 2011 18:14:02 +0000 (19:14 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Mon, 21 Feb 2011 23:42:54 +0000 (23:42 +0000)
Intel classic drivers switched to this, too, so it must be good.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c

index dec19d42698eb1d69c0b745632b36772a763b67a..afeab5eef42b07fe902cfa91c45767b59250582d 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "i915_drm.h"
 #include "i915/i915_debug.h"
+#include <xf86drm.h>
 
 #define BATCH_RESERVED 16
 
@@ -132,6 +133,12 @@ i915_drm_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch,
    return ret;
 }
 
+static void 
+i915_drm_throttle(struct i915_drm_winsys *idws)
+{
+   drmIoctl(idws->fd, DRM_IOCTL_I915_GEM_THROTTLE, NULL);
+}
+
 static void
 i915_drm_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch,
                             struct pipe_fence_handle **fence)
@@ -155,6 +162,8 @@ i915_drm_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch,
    if (ret == 0 && i915_drm_winsys(ibatch->iws)->send_cmd)
       ret = drm_intel_bo_exec(batch->bo, used, NULL, 0, 0);
 
+   i915_drm_throttle(i915_drm_winsys(ibatch->iws));
+
    if (ret != 0 || i915_drm_winsys(ibatch->iws)->dump_cmd) {
       i915_dump_batchbuffer(ibatch);
       assert(ret == 0);