Patchwork [3/3] UBUNTU: SAUCE: KMS: cache the EDID information of the LVDS

login
register
mail settings
Submitter Andy Whitcroft
Date Dec. 9, 2009, 4:05 p.m.
Message ID <1260374733-15526-4-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/40729/
State Accepted
Delegated to: Andy Whitcroft
Headers show

Comments

Andy Whitcroft - Dec. 9, 2009, 4:05 p.m.
From: Arjan van de Ven <arjan@linux.intel.com>

you're not going to replace your LVDS at runtime..... so this patch
caches the EDID information of the LVDS. An LVDS probe can easily take
200 milliseconds, and we do this multiple times during a system startup.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 drivers/gpu/drm/i915/intel_drv.h   |    1 +
 drivers/gpu/drm/i915/intel_lvds.c  |    2 ++
 drivers/gpu/drm/i915/intel_modes.c |    9 ++++++++-
 3 files changed, 11 insertions(+), 1 deletions(-)

Patch

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index ef61fe9..4f4a61c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -102,6 +102,7 @@  struct intel_output {
 	int type;
 	struct i2c_adapter *i2c_bus;
 	struct i2c_adapter *ddc_bus;
+	struct edid *edid;
 	bool load_detect_temp;
 	bool needs_tv_clock;
 	void *dev_priv;
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 05598ae..4b8cbda 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -716,6 +716,7 @@  static void intel_lvds_destroy(struct drm_connector *connector)
 		acpi_lid_notifier_unregister(&dev_priv->lid_notifier);
 	drm_sysfs_connector_remove(connector);
 	drm_connector_cleanup(connector);
+	kfree(intel_output->edid);
 	kfree(connector);
 }
 
@@ -1093,5 +1094,6 @@  failed:
 	if (intel_output->ddc_bus)
 		intel_i2c_destroy(intel_output->ddc_bus);
 	drm_connector_cleanup(connector);
+	kfree(intel_output->edid);
 	kfree(intel_output);
 }
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
index 67e2f46..5ac537f 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -74,6 +74,10 @@  int intel_ddc_get_modes(struct intel_output *intel_output)
 	int ret = 0;
 
 	intel_i2c_quirk_set(intel_output->base.dev, true);
+	if (intel_output->edid && intel_output->type == INTEL_OUTPUT_LVDS) {
+		printk(KERN_INFO "Skipping EDID probe due to cached edid\n");
+		return ret;
+	}
 	edid = drm_get_edid(&intel_output->base, intel_output->ddc_bus);
 	intel_i2c_quirk_set(intel_output->base.dev, false);
 	if (edid) {
@@ -81,7 +85,10 @@  int intel_ddc_get_modes(struct intel_output *intel_output)
 							edid);
 		ret = drm_add_edid_modes(&intel_output->base, edid);
 		intel_output->base.display_info.raw_edid = NULL;
-		kfree(edid);
+		if (intel_output->type == INTEL_OUTPUT_LVDS)
+			intel_output->edid = edid;
+		else
+			kfree(edid);
 	}
 
 	return ret;