diff mbox

[04/15] drm/i915: honour forced connector modes

Message ID 1407250286-1801-5-git-send-email-rodrigo.vivi@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi Aug. 5, 2014, 2:51 p.m. UTC
From: Chris Wilson <chris@chris-wilson.co.uk>

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 that tries to enable a connector (disabling is easy!).

Based on earlier patches by Jesse Barnes.

v2: Remove Jesse's patch

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_fbdev.c | 33 ++++++++++++---------------------
 1 file changed, 12 insertions(+), 21 deletions(-)

Comments

Daniel Vetter Aug. 6, 2014, 8:15 a.m. UTC | #1
On Tue, Aug 05, 2014 at 07:51:15AM -0700, Rodrigo Vivi wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
> 
> 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 that tries to enable a connector (disabling is easy!).
> 
> Based on earlier patches by Jesse Barnes.
> 
> v2: Remove Jesse's patch
> 
> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Queued for -next, thanks for the patch. I've also pulled in the drm
cmdline mode parsing rework. Is that all that's been straggling wrt our
own initial config juggling?
-Daniel
> ---
>  drivers/gpu/drm/i915/intel_fbdev.c | 33 ++++++++++++---------------------
>  1 file changed, 12 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index f475414..5d879d18 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -331,24 +331,6 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>  	int num_connectors_enabled = 0;
>  	int num_connectors_detected = 0;
>  
> -	/*
> -	 * 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)
> @@ -374,8 +356,18 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>  			continue;
>  		}
>  
> +		if (connector->force == DRM_FORCE_OFF) {
> +			DRM_DEBUG_KMS("connector %s is disabled by user, skipping\n",
> +				      connector->name);
> +			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 %s has no encoder or crtc, skipping\n",
>  				      connector->name);
>  			enabled[i] = false;
> @@ -394,8 +386,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>  		for (j = 0; j < fb_helper->connector_count; j++) {
>  			if (crtcs[j] == new_crtc) {
>  				DRM_DEBUG_KMS("fallback: cloned configuration\n");
> -				fallback = true;
> -				goto out;
> +				goto bail;
>  			}
>  		}
>  
> @@ -466,8 +457,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>  		fallback = true;
>  	}
>  
> -out:
>  	if (fallback) {
> +bail:
>  		DRM_DEBUG_KMS("Not using firmware configuration\n");
>  		memcpy(enabled, save_enabled, dev->mode_config.num_connector);
>  		kfree(save_enabled);
> -- 
> 1.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jesse Barnes Aug. 6, 2014, 3 p.m. UTC | #2
On Tue,  5 Aug 2014 07:51:15 -0700
Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:

> From: Chris Wilson <chris@chris-wilson.co.uk>
> 
> 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 that tries to enable a connector (disabling is easy!).
> 
> Based on earlier patches by Jesse Barnes.
> 
> v2: Remove Jesse's patch
> 
> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_fbdev.c | 33 ++++++++++++---------------------
>  1 file changed, 12 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index f475414..5d879d18 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -331,24 +331,6 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>  	int num_connectors_enabled = 0;
>  	int num_connectors_detected = 0;
>  
> -	/*
> -	 * 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)
> @@ -374,8 +356,18 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>  			continue;
>  		}
>  
> +		if (connector->force == DRM_FORCE_OFF) {
> +			DRM_DEBUG_KMS("connector %s is disabled by user, skipping\n",
> +				      connector->name);
> +			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 %s has no encoder or crtc, skipping\n",
>  				      connector->name);
>  			enabled[i] = false;
> @@ -394,8 +386,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>  		for (j = 0; j < fb_helper->connector_count; j++) {
>  			if (crtcs[j] == new_crtc) {
>  				DRM_DEBUG_KMS("fallback: cloned configuration\n");
> -				fallback = true;
> -				goto out;
> +				goto bail;
>  			}
>  		}
>  
> @@ -466,8 +457,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>  		fallback = true;
>  	}
>  
> -out:
>  	if (fallback) {
> +bail:
>  		DRM_DEBUG_KMS("Not using firmware configuration\n");
>  		memcpy(enabled, save_enabled, dev->mode_config.num_connector);
>  		kfree(save_enabled);

Could have sworn I'd already R-b'd this one, but maybe that was the
other one to read the force config earlier.  Anyway:

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index f475414..5d879d18 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -331,24 +331,6 @@  static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 	int num_connectors_enabled = 0;
 	int num_connectors_detected = 0;
 
-	/*
-	 * 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)
@@ -374,8 +356,18 @@  static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 			continue;
 		}
 
+		if (connector->force == DRM_FORCE_OFF) {
+			DRM_DEBUG_KMS("connector %s is disabled by user, skipping\n",
+				      connector->name);
+			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 %s has no encoder or crtc, skipping\n",
 				      connector->name);
 			enabled[i] = false;
@@ -394,8 +386,7 @@  static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		for (j = 0; j < fb_helper->connector_count; j++) {
 			if (crtcs[j] == new_crtc) {
 				DRM_DEBUG_KMS("fallback: cloned configuration\n");
-				fallback = true;
-				goto out;
+				goto bail;
 			}
 		}
 
@@ -466,8 +457,8 @@  static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		fallback = true;
 	}
 
-out:
 	if (fallback) {
+bail:
 		DRM_DEBUG_KMS("Not using firmware configuration\n");
 		memcpy(enabled, save_enabled, dev->mode_config.num_connector);
 		kfree(save_enabled);