aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_display.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-06-05 06:28:59 -0400
committerDave Airlie <airlied@redhat.com>2014-06-05 06:28:59 -0400
commit8d4ad9d4bb0a618c975a32d77087694ec6336f68 (patch)
treed18d12688174a623e3503b11118e44ef8186c90b /drivers/gpu/drm/radeon/radeon_display.c
parent5ea1f752ae04be403a3dc8ec876a60d7f5f6990a (diff)
parent9e9a928eed8796a0a1aaed7e0b676db86ba84594 (diff)
Merge commit '9e9a928eed8796a0a1aaed7e0b676db86ba84594' into drm-next
Merge drm-fixes into drm-next. Both i915 and radeon need this done for later patches. Conflicts: drivers/gpu/drm/drm_crtc_helper.c drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_gem_gtt.c
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_display.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index e330e762c360..a4e725c6b8c8 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -289,6 +289,10 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id)
289 u32 update_pending; 289 u32 update_pending;
290 int vpos, hpos; 290 int vpos, hpos;
291 291
292 /* can happen during initialization */
293 if (radeon_crtc == NULL)
294 return;
295
292 spin_lock_irqsave(&rdev->ddev->event_lock, flags); 296 spin_lock_irqsave(&rdev->ddev->event_lock, flags);
293 work = radeon_crtc->flip_work; 297 work = radeon_crtc->flip_work;
294 if (work == NULL) { 298 if (work == NULL) {
@@ -872,14 +876,14 @@ static void avivo_reduce_ratio(unsigned *nom, unsigned *den,
872 876
873 /* make sure nominator is large enough */ 877 /* make sure nominator is large enough */
874 if (*nom < nom_min) { 878 if (*nom < nom_min) {
875 tmp = (nom_min + *nom - 1) / *nom; 879 tmp = DIV_ROUND_UP(nom_min, *nom);
876 *nom *= tmp; 880 *nom *= tmp;
877 *den *= tmp; 881 *den *= tmp;
878 } 882 }
879 883
880 /* make sure the denominator is large enough */ 884 /* make sure the denominator is large enough */
881 if (*den < den_min) { 885 if (*den < den_min) {
882 tmp = (den_min + *den - 1) / *den; 886 tmp = DIV_ROUND_UP(den_min, *den);
883 *nom *= tmp; 887 *nom *= tmp;
884 *den *= tmp; 888 *den *= tmp;
885 } 889 }
@@ -904,7 +908,7 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div,
904 unsigned *fb_div, unsigned *ref_div) 908 unsigned *fb_div, unsigned *ref_div)
905{ 909{
906 /* limit reference * post divider to a maximum */ 910 /* limit reference * post divider to a maximum */
907 ref_div_max = min(210 / post_div, ref_div_max); 911 ref_div_max = max(min(100 / post_div, ref_div_max), 1u);
908 912
909 /* get matching reference and feedback divider */ 913 /* get matching reference and feedback divider */
910 *ref_div = min(max(DIV_ROUND_CLOSEST(den, post_div), 1u), ref_div_max); 914 *ref_div = min(max(DIV_ROUND_CLOSEST(den, post_div), 1u), ref_div_max);
@@ -1039,6 +1043,16 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
1039 /* this also makes sure that the reference divider is large enough */ 1043 /* this also makes sure that the reference divider is large enough */
1040 avivo_reduce_ratio(&fb_div, &ref_div, fb_div_min, ref_div_min); 1044 avivo_reduce_ratio(&fb_div, &ref_div, fb_div_min, ref_div_min);
1041 1045
1046 /* avoid high jitter with small fractional dividers */
1047 if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV && (fb_div % 10)) {
1048 fb_div_min = max(fb_div_min, (9 - (fb_div % 10)) * 20 + 50);
1049 if (fb_div < fb_div_min) {
1050 unsigned tmp = DIV_ROUND_UP(fb_div_min, fb_div);
1051 fb_div *= tmp;
1052 ref_div *= tmp;
1053 }
1054 }
1055
1042 /* and finally save the result */ 1056 /* and finally save the result */
1043 if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) { 1057 if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) {
1044 *fb_div_p = fb_div / 10; 1058 *fb_div_p = fb_div / 10;