The patch titled tridentfb: various pixclock and timing improvements has been added to the -mm tree. Its filename is tridentfb-various-pixclock-and-timing-improvements.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: tridentfb: various pixclock and timing improvements From: Krzysztof Helt <krzysztof.h1@xxxxx> This patch fixes few issues related to timings and pixclock generation: - disallow the pixclocks with numerator lower than double denominator. This fixes display instability for some modes. - choose the pixelclock with the highest numerator and denominator values. This improve image quality and fixes display instability for some modes. - make interlaced modes work. - set synchronization pulses polarization correctly. - horizontal synchronization timing are now the same as generated by X. Signed-off-by: Krzysztof Helt <krzysztof.h1@xxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/video/tridentfb.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff -puN drivers/video/tridentfb.c~tridentfb-various-pixclock-and-timing-improvements drivers/video/tridentfb.c --- a/drivers/video/tridentfb.c~tridentfb-various-pixclock-and-timing-improvements +++ a/drivers/video/tridentfb.c @@ -680,10 +680,12 @@ static void set_vclk(struct tridentfb_pa d = 20000; for (k = 1; k >= 0; k--) - for (m = 0; m < 32; m++) - for (n = 0; n < 122; n++) { + for (m = 0; m < 32; m++) { + n = 2 * (m + 2) - 8; + for (n = (n < 0 ? 0 : n); n < 122; n++) { fi = ((14318l * (n + 8)) / (m + 2)) >> k; - if ((di = abs(fi - freq)) < d) { + di = abs(fi - freq); + if (di <= d) { d = di; best_n = n; best_m = m; @@ -692,6 +694,7 @@ static void set_vclk(struct tridentfb_pa if (fi > freq) break; } + } if (is_oldclock(par->chip_id)) { lo = best_n | (best_m << 7); @@ -977,8 +980,8 @@ static int tridentfb_set_par(struct fb_i debug("enter\n"); hdispend = var->xres / 8 - 1; - hsyncstart = (var->xres + var->right_margin) / 8 - 1; - hsyncend = (var->xres + var->right_margin + var->hsync_len) / 8 - 1; + hsyncstart = (var->xres + var->right_margin) / 8; + hsyncend = (var->xres + var->right_margin + var->hsync_len) / 8; htotal = (var->xres + var->left_margin + var->right_margin + var->hsync_len) / 8 - 5; hblankstart = hdispend + 1; @@ -991,8 +994,22 @@ static int tridentfb_set_par(struct fb_i vblankstart = vdispend + 1; vblankend = vtotal; + if (info->var.vmode & FB_VMODE_INTERLACED) { + vtotal /= 2; + vdispend /= 2; + vsyncstart /= 2; + vsyncend /= 2; + vblankstart /= 2; + vblankend /= 2; + } + crtc_unlock(par); write3CE(par, CyberControl, 8); + tmp = 0xEB; + if (var->sync & FB_SYNC_HOR_HIGH_ACT) + tmp &= ~0x40; + if (var->sync & FB_SYNC_VERT_HIGH_ACT) + tmp &= ~0x80; if (par->flatpanel && var->xres < nativex) { /* @@ -1000,7 +1017,7 @@ static int tridentfb_set_par(struct fb_i * than requested resolution decide whether * we stretch or center */ - t_outb(par, 0xEB, VGA_MIS_W); + t_outb(par, tmp | 0xC0, VGA_MIS_W); shadowmode_on(par); @@ -1010,7 +1027,7 @@ static int tridentfb_set_par(struct fb_i screen_stretch(par); } else { - t_outb(par, 0x2B, VGA_MIS_W); + t_outb(par, tmp, VGA_MIS_W); write3CE(par, CyberControl, 8); } @@ -1071,6 +1088,10 @@ static int tridentfb_set_par(struct fb_i tmp = (info->var.vmode & FB_VMODE_INTERLACED) ? 0x84 : 0x80; /* enable access extended memory */ write3X4(par, CRTCModuleTest, tmp); + tmp = read3CE(par, MiscIntContReg) & ~0x4; + if (info->var.vmode & FB_VMODE_INTERLACED) + tmp |= 0x4; + write3CE(par, MiscIntContReg, tmp); /* enable GE for text acceleration */ write3X4(par, GraphEngReg, 0x80); _ Patches currently in -mm which might be from krzysztof.h1@xxxxx are tridentfb-replace-macros-with-functions.patch tridentfb-convert-fb_info-into-allocated-one.patch tridentfb-move-global-pseudo-palette-into-structure.patch tridentfb-move-global-chip_id-into-structure.patch tridentfb-move-global-flat-panel-variable-into-structure.patch tridentfb-convert-is_blade-and-is_xp-macros-into-functions.patch tridentfb-move-global-acceleration-hooks-into-structure.patch tridentfb-make-use-of-functions-and-constants-from-the-vgah.patch tridentfb-fix-timing-calculations.patch tridentfb-use-mmio-access-for-clock-setting.patch tridentfb-fix-clock-settings-for-older-trident-96xx-chips.patch tridentfb-improve-probe-function.patch tridentfb-improved-register-values-on-tgui-9680.patch tridentfb-add-tgui-9440-support.patch tridentfb-fix-unitialized-pseudo_palette.patch tridentfb-improve-check_var-function.patch tridentfb-preserve-memory-type-settings.patch tridentfb-fix-hi-color-modes-for-tgui-9440.patch tridentfb-add-acceleration-for-tgui-families.patch tridentfb-acceleration-code-improvements.patch tridentfb-acceleration-bug-fixes.patch tridentfb-various-pixclock-and-timing-improvements.patch tridentfb-acceleration-constants-change.patch tridentfb-source-code-improvements.patch tridentfb-fix-console-freeze-when-switching-from-x11.patch amifb-test-virtual-screen-range-before-subtraction-on-unsigned.patch atafb-test-virtual-screen-range-before-subtraction-on-unsigned.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html