[Intel-gfx] [PATCH] drm/i915: Use PM QoS to prevent C-state memory starvation of the GPU

Chris Wilson chris at chris-wilson.co.uk
Wed Dec 8 17:24:35 CET 2010


This is just a preliminary attempt to see if this even helps. Obviously
some more effort will need to be spent investigating a better choice of
latency and when we need to request it, but first: does this help?

---
 drivers/gpu/drm/i915/i915_drv.h      |    2 ++
 drivers/gpu/drm/i915/intel_display.c |    8 ++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

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 +
-- 
1.7.2.3




More information about the Intel-gfx mailing list