diff options
author | Dave Airlie <airlied@linux.ie> | 2006-03-20 04:54:12 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-04-02 21:43:27 -0400 |
commit | 8492f081e5552ff388068f612eae6f55f7210ed4 (patch) | |
tree | 8d86450eea6a761ef4a541a5f67a9401f88aac19 /drivers | |
parent | d024960cff5173bef6e83c01cf9cd2763c2c0ab0 (diff) |
intelfb: change splitm to be brute force
The old splitm didn't always work use a brute force.
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/intelfb/intelfbhw.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c index bf742aad08e9..d52921931a3e 100644 --- a/drivers/video/intelfb/intelfbhw.c +++ b/drivers/video/intelfb/intelfbhw.c | |||
@@ -746,20 +746,22 @@ static int | |||
746 | splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2) | 746 | splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2) |
747 | { | 747 | { |
748 | int m1, m2; | 748 | int m1, m2; |
749 | 749 | int testm; | |
750 | m1 = (m - 2 - (plls[index].min_m1 + plls[index].max_m2) / 2) / 5 - 2; | 750 | /* no point optimising too much - brute force m */ |
751 | if (m1 < plls[index].min_m1) | 751 | for (m1 = plls[index].min_m1; m1 < plls[index].max_m1+1; m1++) |
752 | m1 = plls[index].min_m1; | 752 | { |
753 | if (m1 > plls[index].max_m1) | 753 | for (m2 = plls[index].min_m2; m2 < plls[index].max_m2+1; m2++) |
754 | m1 = plls[index].max_m1; | 754 | { |
755 | m2 = m - 5 * (m1 + 2) - 2; | 755 | testm = ( 5 * ( m1 + 2 )) + (m2 + 2); |
756 | if (m2 < plls[index].min_m2 || m2 > plls[index].max_m2 || m2 >= m1) { | 756 | if (testm == m) |
757 | return 1; | 757 | { |
758 | } else { | ||
759 | *retm1 = (unsigned int)m1; | 758 | *retm1 = (unsigned int)m1; |
760 | *retm2 = (unsigned int)m2; | 759 | *retm2 = (unsigned int)m2; |
761 | return 0; | 760 | return 0; |
761 | } | ||
762 | } | ||
762 | } | 763 | } |
764 | return 1; | ||
763 | } | 765 | } |
764 | 766 | ||
765 | /* Split the P parameter into P1 and P2. */ | 767 | /* Split the P parameter into P1 and P2. */ |