diff mbox

[RFC/PATCH] render reclock quirks

Message ID cb0375e10910091308g17407d0te2b561bcef009be0@mail.gmail.com
State Rejected
Headers show

Commit Message

Andrew Lutomirski Oct. 9, 2009, 8:08 p.m. UTC
None
diff mbox

Patch

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@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,
+                },
+		{}
+	};
+