Skip to contentSkip to conversation

drm/i915: don't preserve inherited configs with nothing on

PATCH New Jesse Barnes 1 participant 1 message Feb 12, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: don't preserve inherited configs with nothing on

It can be corrected later and may be what was actually desired, but generally isn't, so if we find nothing is enabled, let the core DRM fb helper figure something out.

---
 drivers/gpu/drm/i915/intel_fbdev.c |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_fbdev.c +22 -2
index 85bfb3d..a7b398e 100644
@@ -288,7 +288,17 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 				    struct drm_display_mode **modes,
 				    bool *enabled, int width, int height)
 {
+	struct drm_device *dev = fb_helper->dev;
 	int i, j;
+	bool *save_enabled;
+	bool any_enabled = false;
+
+	save_enabled = kcalloc(dev->mode_config.num_connector, sizeof(bool),
+			       GFP_KERNEL);
+	if (!save_enabled)
+		return false;
+
+	memcpy(save_enabled, enabled, dev->mode_config.num_connector);
 
 	for (i = 0; i < fb_helper->connector_count; i++) {
 		struct drm_fb_helper_connector *fb_conn;
@@ -320,8 +330,10 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		 * match the BIOS.
 		 */
 		for (j = 0; j < fb_helper->connector_count; j++) {
-			if (crtcs[j] == new_crtc)
-				return false;
+			if (crtcs[j] == new_crtc) {
+				any_enabled = false;
+				goto out;
+			}
 		}
 
 		DRM_DEBUG_KMS("looking for cmdline mode on connector %d\n",
@@ -361,6 +373,14 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 			      drm_get_connector_name(connector),
 			      encoder->crtc->base.id,
 			      modes[i]->name);
+
+		any_enabled = true;
+	}
+
+out:
+	if (!any_enabled) {
+		memcpy(enabled, save_enabled, dev->mode_config.num_connector);
+		return false;
 	}
 
 	return true;
Signature · 1 line
1.7.9.5