summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@FreeBSD.org>2006-07-05 14:41:08 -0700
committerEric Anholt <anholt@FreeBSD.org>2006-07-05 14:41:08 -0700
commitffa6ecc18bc54151061d9956f1d12575fc057da3 (patch)
treee5d3ae22da883d0ca889670ecac1fa014dd85edc
parentdfd7fef457c048c9f0d826e37d91453d9e1485b9 (diff)
More fixes to "choose closest mode for the pipe" code to select correct refresh.
-rw-r--r--src/i830_display.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/i830_display.c b/src/i830_display.c
index b5461c2f..d31c100b 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -275,12 +275,19 @@ i830PipeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, int pipe)
for (pScan = pI830->pipeMon[pipe]->Modes; pScan != NULL;
pScan = pScan->next)
{
+ /* If there's an exact match, we're done. */
+ if (I830ModesEqual(pScan, pMode)) {
+ pBest = pMode;
+ break;
+ }
+
/* Reject if it's larger than the desired mode. */
if (pScan->HDisplay > pMode->HDisplay ||
pScan->VDisplay > pMode->VDisplay)
{
continue;
}
+
if (pBest == NULL) {
pBest = pScan;
continue;
@@ -288,8 +295,10 @@ i830PipeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, int pipe)
/* Find if it's closer to the right size than the current best
* option.
*/
- if (pScan->HDisplay >= pBest->HDisplay &&
- pScan->VDisplay >= pBest->VDisplay)
+ if ((pScan->HDisplay > pBest->HDisplay &&
+ pScan->VDisplay >= pBest->VDisplay) ||
+ (pScan->HDisplay >= pBest->HDisplay &&
+ pScan->VDisplay > pBest->VDisplay))
{
pBest = pScan;
continue;