提交 8492f081 编写于 作者: D Dave Airlie

intelfb: change splitm to be brute force

The old splitm didn't always work use a brute force.
Signed-off-by: NDave Airlie <airlied@linux.ie>
上级 d024960c
...@@ -746,20 +746,22 @@ static int ...@@ -746,20 +746,22 @@ static int
splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2) splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2)
{ {
int m1, m2; int m1, m2;
int testm;
m1 = (m - 2 - (plls[index].min_m1 + plls[index].max_m2) / 2) / 5 - 2; /* no point optimising too much - brute force m */
if (m1 < plls[index].min_m1) for (m1 = plls[index].min_m1; m1 < plls[index].max_m1+1; m1++)
m1 = plls[index].min_m1; {
if (m1 > plls[index].max_m1) for (m2 = plls[index].min_m2; m2 < plls[index].max_m2+1; m2++)
m1 = plls[index].max_m1; {
m2 = m - 5 * (m1 + 2) - 2; testm = ( 5 * ( m1 + 2 )) + (m2 + 2);
if (m2 < plls[index].min_m2 || m2 > plls[index].max_m2 || m2 >= m1) { if (testm == m)
return 1; {
} else {
*retm1 = (unsigned int)m1; *retm1 = (unsigned int)m1;
*retm2 = (unsigned int)m2; *retm2 = (unsigned int)m2;
return 0; return 0;
}
}
} }
return 1;
} }
/* Split the P parameter into P1 and P2. */ /* Split the P parameter into P1 and P2. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册