diff options
author | Dave Airlie <airlied@linux.ie> | 2006-03-20 20:54:12 +1100 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-04-03 11:43:27 +1000 |
commit | 8492f081e5552ff388068f612eae6f55f7210ed4 (patch) | |
tree | 8d86450eea6a761ef4a541a5f67a9401f88aac19 /drivers/video | |
parent | d024960cff5173bef6e83c01cf9cd2763c2c0ab0 (diff) | |
download | lwn-8492f081e5552ff388068f612eae6f55f7210ed4.tar.gz lwn-8492f081e5552ff388068f612eae6f55f7210ed4.zip |
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/video')
-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 splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2) { int m1, m2; - - m1 = (m - 2 - (plls[index].min_m1 + plls[index].max_m2) / 2) / 5 - 2; - if (m1 < plls[index].min_m1) - m1 = plls[index].min_m1; - if (m1 > plls[index].max_m1) - m1 = plls[index].max_m1; - m2 = m - 5 * (m1 + 2) - 2; - if (m2 < plls[index].min_m2 || m2 > plls[index].max_m2 || m2 >= m1) { - return 1; - } else { + int testm; + /* no point optimising too much - brute force m */ + for (m1 = plls[index].min_m1; m1 < plls[index].max_m1+1; m1++) + { + for (m2 = plls[index].min_m2; m2 < plls[index].max_m2+1; m2++) + { + testm = ( 5 * ( m1 + 2 )) + (m2 + 2); + if (testm == m) + { *retm1 = (unsigned int)m1; - *retm2 = (unsigned int)m2; + *retm2 = (unsigned int)m2; return 0; + } + } } + return 1; } /* Split the P parameter into P1 and P2. */ |