diff mbox

drm/i915: Use PM QoS to prevent C-state memory starvation of the GPU

Message ID 1291825475-22106-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Dec. 8, 2010, 4:24 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index d9b54a2..4675f6d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -35,6 +35,7 @@ 
 #include "intel_ringbuffer.h"
 #include <linux/io-mapping.h>
 #include <linux/i2c.h>
+#include <linux/pm_qos_params.h>
 #include <drm/intel-gtt.h>
 
 /* General customization:
@@ -659,6 +660,7 @@  typedef struct drm_i915_private {
 	int lvds_downclock;
 	struct work_struct idle_work;
 	struct timer_list idle_timer;
+	struct pm_qos_request_list pm_qos;
 	bool busy;
 	u16 orig_clock;
 	int child_dev_num;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e213529..128020a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4765,6 +4765,8 @@  static void intel_gpu_idle_timer(unsigned long arg)
 		return;
 	}
 
+	pm_qos_remove_request(&dev_priv->pm_qos);
+
 	dev_priv->busy = false;
 	queue_work(dev_priv->wq, &dev_priv->idle_work);
 }
@@ -4940,6 +4942,12 @@  void intel_mark_busy(struct drm_device *dev, struct drm_i915_gem_object *obj)
 			fw_blc_self &= ~FW_BLC_SELF_EN;
 			I915_WRITE(FW_BLC_SELF, fw_blc_self | FW_BLC_SELF_EN_MASK);
 		}
+
+		/* Install a handle to prevent C-state starvation of the GPU */
+		pm_qos_add_request(&dev_priv->pm_qos,
+				   PM_QOS_CPU_DMA_LATENCY,
+				   20);
+
 		dev_priv->busy = true;
 	} else
 		mod_timer(&dev_priv->idle_timer, jiffies +