All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple@vodafone.de>
To: "Borislav Petkov" <bp@alien8.de>,
	"Christian König" <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Maling list - DRI developers <dri-devel@lists.freedesktop.org>
Subject: Re: 15-rc1: radeon modesetting fails
Date: Wed, 16 Apr 2014 12:07:20 +0200	[thread overview]
Message-ID: <534E5658.5090404@vodafone.de> (raw)
In-Reply-To: <20140415142454.GA4826@pd.tnic>

[-- Attachment #1: Type: text/plain, Size: 1452 bytes --]

Hi Borislav,

thanks for the logs, those were indeed quite helpful.

Attached are two patches, the first one tries to solve the problem by 
increasing the accuracy of the parameters if we don't match exactly and 
the second improves the logging of the calculation process by dumping a 
bunch of intermediate values used.

Please apply both on top of my drm-fixes-3.15-wip branch you are already 
using, if the first one doesn't solve the problem then please provide 
new dmesg logs with drm.debug=0xE.

Thanks in advance,
Christian.

Am 15.04.2014 16:24, schrieb Borislav Petkov:
> On Tue, Apr 15, 2014 at 03:09:02PM +0200, Christian König wrote:
>>> Does reverting:
>>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=32167016076f714f0e35e287fbead7de0f1fb179
>>> fix the issue?  We may need to tweak the pll parameters for older asics.
>> Yeah, indeed the most likely cause. Please provide dmesg outputs created
>> with drm.ebug=0xe for the old and the new kernel.
> Hey, I finally haz 15-rc1+ running here. And I can even see something!
>
> :-)
>
> Ok, so I reverted 32167016076f ontop of Christian's drm-fixes-3.15-wip
> branch which didn't apply cleanly. So I ended up fixing the conflicts
> and got the revert below.
>
> With it, the machine booted fine, so it looks like the revert worked.
>
> Christian, I'm sending dmesg outputs in another private mail to you
> guys.
>
> Thanks.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-drm-radeon-improve-PLL-params-if-we-don-t-match-exac.patch --]
[-- Type: text/x-diff; name="0001-drm-radeon-improve-PLL-params-if-we-don-t-match-exac.patch", Size: 2063 bytes --]

>From 19de393134c00989b5b1cc5e6dd4ed444a897ace Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
Date: Wed, 16 Apr 2014 11:54:21 +0200
Subject: [PATCH 1/2] drm/radeon: improve PLL params if we don't match exactly
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Otherwise we might be quite off on older chipsets.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/radeon/radeon_display.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 2f42912..fb3b505 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -865,7 +865,7 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
 	unsigned post_div_min, post_div_max, post_div;
 	unsigned ref_div_min, ref_div_max, ref_div;
 	unsigned post_div_best, diff_best;
-	unsigned nom, den, tmp;
+	unsigned nom, den;
 
 	/* determine allowed feedback divider range */
 	fb_div_min = pll->min_feedback_div;
@@ -941,22 +941,23 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
 	ref_div_max = min(210 / post_div, ref_div_max);
 
 	/* get matching reference and feedback divider */
-	ref_div = max(den / post_div, 1u);
-	fb_div = nom;
+	ref_div = DIV_ROUND_CLOSEST(den, post_div);
+	fb_div = DIV_ROUND_CLOSEST(nom * ref_div * post_div, den);
 
 	/* we're almost done, but reference and feedback
 	   divider might be to large now */
 
-	tmp = ref_div;
+	nom = fb_div;
+	den = ref_div;
 
         if (fb_div > fb_div_max) {
-		ref_div = ref_div * fb_div_max / fb_div;
+		ref_div = DIV_ROUND_CLOSEST(den * fb_div_max, nom);
 		fb_div = fb_div_max;
 	}
 
 	if (ref_div > ref_div_max) {
 		ref_div = ref_div_max;
-		fb_div = nom * ref_div_max / tmp;
+		fb_div = DIV_ROUND_CLOSEST(nom * ref_div_max, den);
 	}
 
 	/* reduce the numbers to a simpler ratio once more */
-- 
1.9.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-drm-radeon-improve-logging-of-PLL-parameter-calculat.patch --]
[-- Type: text/x-diff; name="0002-drm-radeon-improve-logging-of-PLL-parameter-calculat.patch", Size: 2472 bytes --]

>From e0e6fa5c0b7df9a3de1784082a878bcfebb8a941 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
Date: Wed, 16 Apr 2014 11:57:28 +0200
Subject: [PATCH 2/2] drm/radeon: improve logging of PLL parameter calculation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/radeon/radeon_display.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index fb3b505..037db45 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -820,6 +820,9 @@ static void avivo_reduce_ratio(unsigned *nom, unsigned *den,
 {
 	unsigned tmp;
 
+	DRM_DEBUG_KMS("nom: %d den: %d nom_min %d den_min %d\n",
+		      *nom, *den, nom_min, den_min);
+
 	/* reduce the numbers to a simpler ratio */
 	tmp = gcd(*nom, *den);
 	*nom /= tmp;
@@ -876,6 +879,9 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
 		fb_div_max *= 10;
 	}
 
+	DRM_DEBUG_KMS("fb_div_min: %d fb_div_max: %d\n",
+		      fb_div_min, fb_div_max);
+
 	/* determine allowed ref divider range */
 	if (pll->flags & RADEON_PLL_USE_REF_DIV)
 		ref_div_min = pll->reference_div;
@@ -883,6 +889,9 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
 		ref_div_min = pll->min_ref_div;
 	ref_div_max = pll->max_ref_div;
 
+	DRM_DEBUG_KMS("ref_div_min: %d ref_div_max: %d\n",
+		      ref_div_min, ref_div_max);
+
 	/* determine allowed post divider range */
 	if (pll->flags & RADEON_PLL_USE_POST_DIV) {
 		post_div_min = pll->post_div;
@@ -912,6 +921,9 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
 			post_div_max = pll->max_post_div;
 	}
 
+	DRM_DEBUG_KMS("post_div_min: %d post_div_max: %d\n",
+		      post_div_min, post_div_max);
+
 	/* represent the searched ratio as fractional number */
 	nom = pll->flags & RADEON_PLL_USE_FRAC_FB_DIV ? freq : freq / 10;
 	den = pll->reference_freq;
@@ -980,7 +992,7 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
 	*post_div_p = post_div;
 
 	DRM_DEBUG_KMS("%d - %d, pll dividers - fb: %d.%d ref: %d, post %d\n",
-		      freq, *dot_clock_p, *fb_div_p, *frac_fb_div_p,
+		      freq, *dot_clock_p * 10, *fb_div_p, *frac_fb_div_p,
 		      ref_div, post_div);
 }
 
-- 
1.9.1


[-- Attachment #4: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2014-04-16 10:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15  7:02 15-rc1: radeon modesetting fails Borislav Petkov
2014-04-15  9:28 ` Christian König
2014-04-15  9:28   ` Christian König
2014-04-15 12:07   ` Borislav Petkov
2014-04-15 12:07     ` Borislav Petkov
2014-04-15 13:06     ` Alex Deucher
2014-04-15 13:06       ` Alex Deucher
2014-04-15 13:09       ` Christian König
2014-04-15 14:24         ` Borislav Petkov
2014-04-15 14:24           ` Borislav Petkov
2014-04-16 10:07           ` Christian König [this message]
2014-04-16 17:41             ` Borislav Petkov
2014-04-15 17:08       ` Kertesz Laszlo
2014-04-15 17:08         ` Kertesz Laszlo
2014-04-15 17:27         ` Borislav Petkov
2014-04-15 17:27           ` Borislav Petkov
2014-04-15 18:02           ` Kertesz Laszlo
2014-04-15 18:02             ` Kertesz Laszlo
2014-04-15 18:07             ` Borislav Petkov
2014-04-15 18:07               ` Borislav Petkov
2014-04-15 21:49               ` Kertesz Laszlo
2014-04-15 21:49                 ` Kertesz Laszlo
2014-04-15 22:32                 ` Deucher, Alexander
2014-04-15 22:32                   ` Deucher, Alexander
2014-04-15 22:48                   ` Borislav Petkov
2014-04-15 22:48                     ` Borislav Petkov
2014-04-16  8:32                     ` Kertesz Laszlo
2014-04-16  8:32                       ` Kertesz Laszlo
2014-04-16  8:41                       ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=534E5658.5090404@vodafone.de \
    --to=deathsimple@vodafone.de \
    --cc=alexander.deucher@amd.com \
    --cc=bp@alien8.de \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.