diff mbox

drm/i915/fbdev: Stop repeating tile configuration on stagnation

Message ID 20170218153753.4559-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Feb. 18, 2017, 3:37 p.m. UTC
If we cease making progress in finding matching outputs for a tiled
configuration, stop looping over the remaining unconfigured outputs.

Fixes: b0ee9e7fa5b4 ("drm/fb: add support for tiled monitor configurations. (v2)")
Cc: Tomasz Lis <tomasz.lis@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: <stable@vger.kernel.org> # v3.19+
---
 drivers/gpu/drm/i915/intel_fbdev.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Lis, Tomasz Feb. 20, 2017, 3:37 p.m. UTC | #1
I tested this variant (reverted the change to "pass" variable before 
testing), and it fixes the issue with count=0 as well as possible 
infinite loop issue.

But something needs to be done with the "pass" var, one way or the other 
- commented below.


W dniu 2017-02-18 o 16:37, Chris Wilson pisze:
> If we cease making progress in finding matching outputs for a tiled
> configuration, stop looping over the remaining unconfigured outputs.
>
> Fixes: b0ee9e7fa5b4 ("drm/fb: add support for tiled monitor configurations. (v2)")
> Cc: Tomasz Lis <tomasz.lis@intel.com>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: <stable@vger.kernel.org> # v3.19+
> ---
>   drivers/gpu/drm/i915/intel_fbdev.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 041322fef607..32d0af6b07a7 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -348,7 +348,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>   				    bool *enabled, int width, int height)
>   {
>   	struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
> -	unsigned long conn_configured, mask;
> +	unsigned long conn_configured, conn_seq, mask;
>   	unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
>   	int i, j;
>   	bool *save_enabled;
> @@ -365,6 +365,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>   	mask = GENMASK(count - 1, 0);
>   	conn_configured = 0;
>   retry:
> +	conn_seq = conn_configured;
>   	for (i = 0; i < count; i++) {
>   		struct drm_fb_helper_connector *fb_conn;
>   		struct drm_connector *connector;
> @@ -489,10 +490,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
>   		conn_configured |= BIT(i);
>   	}
>   
> -	if ((conn_configured & mask) != mask) {
> -		pass++;
This doesn't seem right; increasing the amount of passes should stay, or 
the use of "pass" variable should be completely replaced by conn_seq.
- Tomasz
> +	if ((conn_configured & mask) != mask && conn_configured != conn_seq)
>   		goto retry;
> -	}
>   
>   	/*
>   	 * If the BIOS didn't enable everything it could, fall back to have the
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 041322fef607..32d0af6b07a7 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -348,7 +348,7 @@  static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 				    bool *enabled, int width, int height)
 {
 	struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
-	unsigned long conn_configured, mask;
+	unsigned long conn_configured, conn_seq, mask;
 	unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
 	int i, j;
 	bool *save_enabled;
@@ -365,6 +365,7 @@  static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 	mask = GENMASK(count - 1, 0);
 	conn_configured = 0;
 retry:
+	conn_seq = conn_configured;
 	for (i = 0; i < count; i++) {
 		struct drm_fb_helper_connector *fb_conn;
 		struct drm_connector *connector;
@@ -489,10 +490,8 @@  static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		conn_configured |= BIT(i);
 	}
 
-	if ((conn_configured & mask) != mask) {
-		pass++;
+	if ((conn_configured & mask) != mask && conn_configured != conn_seq)
 		goto retry;
-	}
 
 	/*
 	 * If the BIOS didn't enable everything it could, fall back to have the