[Mplayer-cvslog] CVS: main/libvo vo_fbdev.c,1.46,1.47

Szabolcs Berecz szabi at mplayer.dev.hu
Thu Aug 16 23:24:27 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv14813

Modified Files:
	vo_fbdev.c 
Log Message:
more verbose videomode selection

Index: vo_fbdev.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_fbdev.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- vo_fbdev.c	13 Aug 2001 11:08:18 -0000	1.46
+++ vo_fbdev.c	16 Aug 2001 21:24:24 -0000	1.47
@@ -395,6 +395,41 @@
 	return 0;
 }
 
+static int mode_works(fb_mode_t *m, range_t *hfreq, range_t *vfreq,
+		range_t *dotclock)
+{
+	float h = hsf(m);
+	float v = vsf(m);
+	float d = dcf(m);
+	int ret = 1;
+
+	if (verbose > 1)
+		printf(FBDEV "mode %dx%d:", m->xres, m->yres);
+	if (!in_range(hfreq, h)) {
+		ret = 0;
+		if (verbose > 1)
+			printf(" hsync out of range.");
+	}
+	if (!in_range(vfreq, v)) {
+		ret = 0;
+		if (verbose > 1)
+			printf(" vsync out of range.");
+	}
+	if (!in_range(dotclock, d)) {
+		ret = 0;
+		if (verbose > 1)
+			printf(" dotclock out of range.");
+	}
+	if (verbose > 1) {
+		if (ret)
+			printf(" hsync, vsync, dotclock ok.\n");
+		else
+			printf("\n");
+	}
+
+	return ret;
+}
+
 static fb_mode_t *find_best_mode(int xres, int yres, range_t *hfreq,
 		range_t *vfreq, range_t *dotclock)
 {
@@ -402,10 +437,11 @@
 	fb_mode_t *best = fb_modes;
 	fb_mode_t *curr;
 
-	/* find first working mode */
+	if (verbose > 1)
+		printf(FBDEV "Searching for first working mode\n");
+
 	for (i = 0; i < nr_modes; i++, best++)
-		if (in_range(hfreq, hsf(best)) && in_range(vfreq, vsf(best)) &&
-				in_range(dotclock, dcf(best)))
+		if (mode_works(best, hfreq, vfreq, dotclock))
 			break;
 
 	if (i == nr_modes)
@@ -413,40 +449,46 @@
 	if (i == nr_modes - 1)
 		return best;
 
-	if (verbose > 1)
-		printf(FBDEV "%dx%d\n", best->xres, best->yres);
+	if (verbose > 1) {
+		printf(FBDEV "First working mode: %dx%d\n", best->xres, best->yres);
+		printf(FBDEV "Searching for better modes\n");
+	}
 
-	for (curr = best + 1; i < nr_modes; i++, curr++) {
-		if (!in_range(hfreq, hsf(curr)) ||
-		    !in_range(vfreq, vsf(curr)) ||
-		    !in_range(dotclock, dcf(curr)))
+	for (curr = best + 1; i < nr_modes - 1; i++, curr++) {
+		if (!mode_works(curr, hfreq, vfreq, dotclock))
 			continue;
+
 		if (verbose > 1)
-			printf(FBDEV "%dx%d ", curr->xres, curr->yres);
-		if ((best->xres < xres || best->yres < yres) &&
-				(curr->xres > best->xres ||
-				 curr->yres > best->yres)) {
-			if (verbose > 1)
-				printf("better than %dx%d\n", best->xres,
-						best->yres);
-			best = curr;
-		} else if (curr->xres >= xres && curr->yres >= yres) {
-			if (curr->xres < best->xres && curr->yres < best->yres) {
+			printf(FBDEV);
+
+		if (best->xres < xres || best->yres < yres) {
+			if (curr->xres > best->xres || curr->yres > best->yres) {
 				if (verbose > 1)
-					printf("smaller than %dx%d\n",
+					printf("better than %dx%d, which is too small.\n",
 							best->xres, best->yres);
 				best = curr;
-			} else if (curr->xres == best->xres &&
-					curr->yres == best->yres &&
-					(vsf(curr) > vsf(best))) {
-				if (verbose > 1)
-					printf("faster screen refresh\n");
-				best = curr;
 			} else if (verbose > 1)
-				printf("\n");
-		} else if (verbose > 1)
-			printf("is too small\n");
+				printf("too small.\n");
+		} else if (curr->xres == best->xres && curr->yres == best->yres &&
+				vsf(curr) > vsf(best)) {
+			if (verbose > 1)
+				printf("faster screen refresh.\n");
+			best = curr;
+		} else if ((curr->xres <= best->xres && curr->yres <= best->yres) &&
+				(curr->xres >= xres && curr->yres >= yres)) {
+			if (verbose > 1)
+				printf("better than %dx%d, which is too large.\n",
+						best->xres, best->yres);
+			best = curr;
+		} else if (verbose > 1) {
+			if (curr->xres < xres || curr->yres < yres)
+				printf("too small.\n");
+			else if (curr->xres > best->xres || curr->yres > best->yres)
+				printf("too large.\n");
+			else printf("it's worse, don't know why.\n");
+		}
 	}
+
 	return best;
 }
 
@@ -711,7 +753,7 @@
 		goto err_out_fd;
 	}
 
-	/* 16 and 15 bpp is reported 16 bpp */
+	/* 16 and 15 bpp is reported as 16 bpp */
 	if (fb_bpp == 16)
 		fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length +
 			fb_vinfo.blue.length;




More information about the MPlayer-cvslog mailing list