[Intel-gfx] [RFC/PATCH] render reclock quirks

Andrew Lutomirski luto at mit.edu
Fri Oct 9 22:08:39 CEST 2009


Add a quirk to enable render reclocking on a Thinkpad X200s.

Signed-off-by: Andy Lutomirski <luto at mit.edu>
---
This probably shouldn't be applied as is, but it might be useful after
some massaging.

It also changes the !SUPPORTS_EDP logic, which used to disable render
reclocking on everything that doesn't support eDP (which is everything
shipping, AFAICT).

It might be a better idea to just say "i915: VBIOS disables some power
saving features.  See Documentation/whatever.txt if you want to help
us enable it."

--Andy


diff --git a/drivers/gpu/drm/i915/intel_bios.c
b/drivers/gpu/drm/i915/intel_bios.c
index 4337414..6a4bff5 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -29,10 +29,15 @@
 #include "i915_drm.h"
 #include "i915_drv.h"
 #include "intel_bios.h"
+#include <linux/dmi.h>

 #define	SLAVE_ADDR1	0x70
 #define	SLAVE_ADDR2	0x72

+static bool render_reclock_quirk_avail;
+static bool force_render_reclock;
+module_param(force_render_reclock, bool, 0400);
+
 static void *
 find_section(struct bdb_header *bdb, int section_id)
 {
@@ -351,21 +356,51 @@ parse_driver_features(struct drm_i915_private *dev_priv,
 	struct drm_device *dev = dev_priv->dev;
 	struct bdb_driver_features *driver;

-	/* set default for chips without eDP */
-	if (!SUPPORTS_EDP(dev)) {
-		dev_priv->edp_support = 0;
-		return;
-	}
-
+	/* Due to quirks, we continue even if driver == NULL. */
 	driver = find_section(bdb, BDB_DRIVER_FEATURES);
-	if (!driver)
-		return;

-	if (driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
+	if (driver && SUPPORTS_EDP(dev) && driver->lvds_config ==
BDB_DRIVER_FEATURE_EDP)
 		dev_priv->edp_support = 1;
+	else
+		dev_priv->edp_support = 0;

-	if (driver->dual_frequency)
+	if (driver && driver->dual_frequency) {
+		dev_priv->render_reclock_avail = true;
+	} else if (render_reclock_quirk_avail) {
+		dev_priv->render_reclock_avail = true;
+		printk(KERN_INFO "i915: Quirk-enabling render reclocking\n");
+	} else if (force_render_reclock) {
 		dev_priv->render_reclock_avail = true;
+		printk(KERN_WARNING "i915: Force-enabled render reclocking.  If
this works, please\n"
+			"  email dmesg and dmidecode output to intel-gfx at lists.freedesktop.org\n");
+	} else {
+		printk(KERN_INFO "i915: Your VBIOS does not support render reclocking.\n"
+		       "  Set the module parameter force_render_reclock=1 to try
forcing it on.");
+	}
+}
+
+static int render_reclock_quirk(const struct dmi_system_id *d)
+{
+	render_reclock_quirk_avail = true;
+	return 0;
+}
+
+static void
+load_quirks(void)
+{
+	static const struct dmi_system_id sysids[] = {
+                {
+                        .ident = "Lenovo X200s",
+                        .matches = {
+                                DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+                                DMI_MATCH(DMI_PRODUCT_VERSION,
"ThinkPad X200s"),
+                        },
+			.callback = render_reclock_quirk,
+                },
+		{}
+	};
+
+	dmi_check_system(sysids);
 }

 /**
@@ -393,6 +428,8 @@ intel_init_bios(struct drm_device *dev)
 	size_t size;
 	int i;

+	load_quirks();
+
 	bios = pci_map_rom(pdev, &size);
 	if (!bios)
 		return -1;



More information about the Intel-gfx mailing list