This is needed for WM computation workaround for arbitrated display
bandwidth.

Signed-off-by: Shobhit Kumar <shobhit.ku...@intel.com>
---
 drivers/gpu/drm/i915/i915_dma.c | 19 +++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h |  6 ++++++
 2 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index a0f5659..03c3131 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -49,6 +49,7 @@
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
 #include <linux/oom.h>
+#include <linux/dmi.h>
 
 
 static int i915_getparam(struct drm_device *dev, void *data,
@@ -855,6 +856,21 @@ static void intel_init_dpio(struct drm_i915_private 
*dev_priv)
        }
 }
 
+static void dmi_decode_memory_info(const struct dmi_header *hdr, void *priv)
+{
+       struct drm_i915_private *dev_priv = (struct drm_i915_private *) priv;
+       const u8 *data = (const u8 *) hdr;
+
+       if (hdr->type == 17 && hdr->length > 0x17) {
+
+               /* Found a memory channel */
+               dev_priv->dmi.mem_channel++;
+
+               /* Get the speed */
+               dev_priv->dmi.mem_speed = (uint16_t) (*((uint16_t *)(data + 
0x15)));
+       }
+}
+
 /**
  * i915_driver_load - setup chip and create an initial config
  * @dev: DRM device
@@ -882,6 +898,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long 
flags)
        dev->dev_private = dev_priv;
        dev_priv->dev = dev;
 
+       /* walk the dmi device table for getting platform memory information */
+       dmi_walk(dmi_decode_memory_info, (void *) dev_priv);
+
        /* Setup the write-once "constant" device info */
        device_info = (struct intel_device_info *)&dev_priv->info;
        memcpy(device_info, info, sizeof(dev_priv->info));
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 104bd18..f588993 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1962,6 +1962,12 @@ struct drm_i915_private {
         * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
         * will be rejected. Instead look for a better place.
         */
+
+       /* DMI data for memory bandwidth calculation */
+       struct {
+               uint16_t mem_channel;
+               uint16_t mem_speed;
+       } dmi;
 };
 
 static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
-- 
2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to