summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszabi <szabi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-08-16 21:24:24 +0000
committerszabi <szabi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-08-16 21:24:24 +0000
commit03f2e23bc72f3b9a8c047efc4f27c9c6cf548b09 (patch)
tree2d949089e1f796c89b27b4da15284c9e25dd255e
parent2d3a8284a17b759285eb086501f159ee653be243 (diff)
downloadmpv-03f2e23bc72f3b9a8c047efc4f27c9c6cf548b09.tar.bz2
mpv-03f2e23bc72f3b9a8c047efc4f27c9c6cf548b09.tar.xz
more verbose videomode selection
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1562 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libvo/vo_fbdev.c102
1 files changed, 72 insertions, 30 deletions
diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c
index 6a2cda5026..f345043a0b 100644
--- a/libvo/vo_fbdev.c
+++ b/libvo/vo_fbdev.c
@@ -395,6 +395,41 @@ static int in_range(range_t *r, float f)
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 @@ static fb_mode_t *find_best_mode(int xres, int yres, range_t *hfreq,
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 @@ static fb_mode_t *find_best_mode(int xres, int yres, range_t *hfreq,
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 @@ static int fb_preinit(void)
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;