Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/videomode fix off-by-one error which happened when t...
details: https://anonhg.NetBSD.org/src/rev/db7dde00a0ba
branches: trunk
changeset: 758001:db7dde00a0ba
user: macallan <macallan%NetBSD.org@localhost>
date: Tue Oct 12 16:18:19 2010 +0000
description:
fix off-by-one error which happened when the first mode with matching size is
also the best match by refresh rate
diffstat:
sys/dev/videomode/pickmode.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (46 lines):
diff -r be7689e2eb69 -r db7dde00a0ba sys/dev/videomode/pickmode.c
--- a/sys/dev/videomode/pickmode.c Tue Oct 12 16:00:21 2010 +0000
+++ b/sys/dev/videomode/pickmode.c Tue Oct 12 16:18:19 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pickmode.c,v 1.1 2010/05/04 21:17:10 macallan Exp $ */
+/* $NetBSD: pickmode.c,v 1.2 2010/10/12 16:18:19 macallan Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pickmode.c,v 1.1 2010/05/04 21:17:10 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pickmode.c,v 1.2 2010/10/12 16:18:19 macallan Exp $");
#include <sys/param.h>
#include <dev/videomode/videomode.h>
@@ -81,9 +81,9 @@
this = &videomode_list[i];
mref = this->dot_clock * 1000 / (this->htotal * this->vtotal);
diff = abs(mref - refresh);
- if ((this->hdisplay != width) || (this->vdisplay != height) ||
- (diff > closest))
+ if ((this->hdisplay != width) || (this->vdisplay != height))
continue;
+ DPRINTF("%s in %d hz, diff %d\n", this->name, mref, diff);
if (best != NULL) {
if (diff < closest) {
@@ -91,11 +91,13 @@
best = this;
closest = diff;
}
- } else
+ } else {
best = this;
+ closest = diff;
+ }
}
if (best!= NULL)
- DPRINTF("found %s\n", best->name);
+ DPRINTF("found %s %d\n", best->name, best->dot_clock);
return best;
}
Home |
Main Index |
Thread Index |
Old Index