Skip to content

Commit

Permalink
intelfb: change splitm to be brute force
Browse files Browse the repository at this point in the history
The old splitm didn't always work use a brute force.

Signed-off-by: Dave Airlie <airlied@linux.ie>
  • Loading branch information
Dave Airlie committed Apr 3, 2006
1 parent d024960 commit 8492f08
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions drivers/video/intelfb/intelfbhw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 8492f08

Please sign in to comment.