Skip to contentSkip to conversation

drm/i915: honor forced connector modes v2

PATCH Applied Jesse Barnes 3 participants 3 messages Feb 20, 2014 – Mar 4, 2014

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

PATCH 1/1 drm/i915: honor forced connector modes v2

In the move over to use BIOS connector configs, we lost the ability to force a specific set of connectors on or off. Try to remedy that by dropping back to the old behavior if we detect a hard coded connector config.

v2: don't deref connector state for disabled connectors (Jesse)

---
 drivers/gpu/drm/i915/intel_fbdev.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/i915/intel_fbdev.c +18 -0
index 7693728..5935544 100644
@@ -293,6 +293,24 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 	bool *save_enabled;
 	bool any_enabled = false;
 
+	/*
+	 * If the user specified any force options, just bail here
+	 * and use that config.
+	 */
+	for (i = 0; i < fb_helper->connector_count; i++) {
+		struct drm_fb_helper_connector *fb_conn;
+		struct drm_connector *connector;
+
+		fb_conn = fb_helper->connector_info[i];
+		connector = fb_conn->connector;
+
+		if (!enabled[i])
+			continue;
+
+		if (connector->force != DRM_FORCE_UNSPECIFIED)
+			return false;
+	}
+
 	save_enabled = kcalloc(dev->mode_config.num_connector, sizeof(bool),
 			       GFP_KERNEL);
 	if (!save_enabled)
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 9 lines · Jesse Barnes

In the move over to use BIOS connector configs, we lost the ability to force a specific set of connectors on or off. Try to remedy that by dropping back to the old behavior if we detect a hard coded connector config.

v2: don't deref connector state for disabled connectors (Jesse)

Borrowing this idea, but extending it to only bail if we need to turn stuff on (i.e. helps with video=LVDS:d etc):

drivers/gpu/drm/i915/intel_fbdev.c +14 -7
index 19be4bfbcc59..6feacf574697 100644
@@ -312,8 +312,18 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 			continue;
 		}
 
+		if (connector->force == DRM_FORCE_OFF) {
+			DRM_DEBUG_KMS("connector %d is disabled by user, skipping\n",
+				      connector->base.id);
+			enabled[i] = false;
+			continue;
+		}
+
 		encoder = connector->encoder;
 		if (!encoder || WARN_ON(!encoder->crtc)) {
+			if (connector->force > DRM_FORCE_OFF)
+				goto bail;
+
 			DRM_DEBUG_KMS("connector %d has no encoder or crtc, skipping\n",
 				      connector->base.id);
 			enabled[i] = false;
@@ -327,12 +337,9 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		 * with a single CRTC, since our cloning support may not
 		 * match the BIOS.
 		 */
-		for (j = 0; j < fb_helper->connector_count; j++) {
-			if (crtcs[j] == new_crtc) {
-				any_enabled = false;
-				goto out;
-			}
-		}
+		for (j = 0; j < fb_helper->connector_count; j++)
+			if (crtcs[j] == new_crtc)
+				goto bail;
 
 		DRM_DEBUG_KMS("looking for cmdline mode on connector %d\n",
 			      fb_conn->connector->base.id);
@@ -375,8 +382,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		any_enabled = true;
 	}
 
-out:
 	if (!any_enabled) {
+bail:
 		memcpy(enabled, save_enabled, dev->mode_config.num_connector);
 		kfree(save_enabled);
 		return false;
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
In reply to Jesse Barnes
Quoted 9 lines · Jesse Barnes

In the move over to use BIOS connector configs, we lost the ability to force a specific set of connectors on or off. Try to remedy that by dropping back to the old behavior if we detect a hard coded connector config.

v2: don't deref connector state for disabled connectors (Jesse)

Queued for -next, thanks for the patch.
-Daniel

Quoted 40 lines
---
 drivers/gpu/drm/i915/intel_fbdev.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/i915/intel_fbdev.c +18 -0
index 7693728..5935544 100644
@@ -293,6 +293,24 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 	bool *save_enabled;
 	bool any_enabled = false;
 
+	/*
+	 * If the user specified any force options, just bail here
+	 * and use that config.
+	 */
+	for (i = 0; i < fb_helper->connector_count; i++) {
+		struct drm_fb_helper_connector *fb_conn;
+		struct drm_connector *connector;
+
+		fb_conn = fb_helper->connector_info[i];
+		connector = fb_conn->connector;
+
+		if (!enabled[i])
+			continue;
+
+		if (connector->force != DRM_FORCE_UNSPECIFIED)
+			return false;
+	}
+
 	save_enabled = kcalloc(dev->mode_config.num_connector, sizeof(bool),
 			       GFP_KERNEL);
 	if (!save_enabled)
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch