[Intel-gfx] [PATCH] drm/i915: add i915 specific initial configuration function
Jesse Barnes
jbarnes at virtuousgeek.org
Fri Mar 27 22:07:40 CET 2009
Pushing the initial configuration down into the driver makes it easier
to add platform specific default configuration algorithms, and and speed
up the boot process.
This patch adds an i915 specific initial config function which defaults
to using LVDS as the primary head, if present. It also adds a new i915
module parameter, "primary", which can be used to specify an alternate
primary head to be used for the fb console, and panic and lastclose
configuration. It takes a simple string indicating the preferred
connector, e.g. "VGA-1" or "DVI-1".
Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
drivers/gpu/drm/drm_crtc_helper.c | 3 +-
drivers/gpu/drm/i915/i915_dma.c | 2 +-
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/intel_display.c | 64 ++++++++++++++++++++++++++++++++++
include/drm/drm_crtc_helper.h | 1 +
5 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index e59746a..6f5cf94 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -391,7 +391,7 @@ out:
return best_score;
}
-static void drm_setup_crtcs(struct drm_device *dev)
+void drm_setup_crtcs(struct drm_device *dev)
{
struct drm_crtc **crtcs;
struct drm_display_mode **modes;
@@ -452,6 +452,7 @@ static void drm_setup_crtcs(struct drm_device *dev)
kfree(modes);
kfree(enabled);
}
+EXPORT_SYMBOL(drm_setup_crtcs);
/**
* drm_encoder_crtc_ok - can a given crtc drive a given encoder?
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 908d24e..e9b8877 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1010,7 +1010,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
intel_modeset_init(dev);
- drm_helper_initial_config(dev, false);
+ intel_initial_config(dev);
return 0;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 36d6bc3..aa4731b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -676,6 +676,7 @@ static inline void opregion_enable_asle(struct drm_device *dev) { return; }
/* modesetting */
extern void intel_modeset_init(struct drm_device *dev);
extern void intel_modeset_cleanup(struct drm_device *dev);
+extern void intel_initial_config(struct drm_device *dev);
/**
* Lock test for when it's just for synchronization of ring access.
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index d9c50ff..3083802 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2024,3 +2024,67 @@ struct drm_encoder *intel_best_encoder(struct drm_connector *connector)
return &intel_output->enc;
}
+
+static char *i915_primary;
+module_param_named(primary, i915_primary, charp, 0400);
+
+/**
+ * intel_initial_config - set up an initial configuration
+ * @dev: DRM device
+ *
+ * Create an initial configuration for use by the framebuffer driver.
+ * The main aim of this config is to make sure that kernel messages
+ * are visible. This config will be used by both the framebuffer driver
+ * to create an initial console and by the panic & lastclose code to
+ * restore a usable configuration if something bad happens.
+ *
+ * Many platforms have a "primary" head, e.g. a laptop panel. If possible,
+ * use the primary head as the default config.
+ *
+ * Allow the user to override the default with the "primary" module option.
+ *
+ * If the primary head (either the autodetected one or the user specified one)
+ * isn't available, fall back to the core, which will just try to light up
+ * as much as possible.
+ */
+void intel_initial_config(struct drm_device *dev)
+{
+ struct drm_connector *connector, *primary_head = NULL;
+ char *primary_name = "LVDS-1";
+ int width, height;
+
+ if (i915_primary)
+ primary_name = i915_primary;
+
+ width = dev->mode_config.max_width;
+ height = dev->mode_config.max_height;
+
+ /* First, find the "primary" head */
+ DRM_DEBUG("looking for primary head \"%s\"\n", primary_name);
+ list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+ if (!strcmp(drm_get_connector_name(connector), primary_name)) {
+ primary_head = connector;
+ break;
+ }
+ }
+
+ if (!primary_head)
+ goto fallback;
+
+ if (!drm_helper_probe_single_connector_modes(primary_head, width,
+ height)) {
+ DRM_DEBUG("primary head \"%s\" has no modes, falling back\n",
+ primary_name);
+ goto fallback;
+ }
+
+ drm_setup_crtcs(dev);
+ dev->mode_config.funcs->fb_changed(dev);
+
+ return;
+
+fallback:
+ DRM_DEBUG("primary head \"%s\" not found, using default\n",
+ primary_name);
+ drm_helper_initial_config(dev);
+}
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index b672184..21cb8cb 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -94,6 +94,7 @@ extern void drm_helper_disable_unused_functions(struct drm_device *dev);
extern int drm_helper_hotplug_stage_two(struct drm_device *dev);
extern bool drm_helper_initial_config(struct drm_device *dev);
extern int drm_crtc_helper_set_config(struct drm_mode_set *set);
+extern void drm_setup_crtcs(struct drm_device *dev);
extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
struct drm_display_mode *mode,
int x, int y,
--
1.5.6.3
More information about the Intel-gfx
mailing list