From aaddf3c8218da08372fdb789e09888e6254d459a Mon Sep 17 00:00:00 2001 From: Stuart Bennett Date: Fri, 15 Aug 2008 23:02:48 +0100 Subject: [PATCH] Apply minimum front porch only when necessary (#15949) Also, read minimum front porch from bios table --- src/nv_bios.c | 14 ++++++++------ src/nv_crtc.c | 5 ++++- src/nv_type.h | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/nv_bios.c b/src/nv_bios.c index 9afe270..7018a0d 100644 --- a/src/nv_bios.c +++ b/src/nv_bios.c @@ -3083,10 +3083,8 @@ static void parse_fp_mode_table(ScrnInfoPtr pScrn, bios_t *bios, struct fppointe headerlen = fptable[1]; recordlen = fptable[2]; fpentries = fptable[3]; - /* fptable[4] is the minimum RAMDAC_FP_HCRTC->RAMDAC_FP_HSYNC_START gap. - * Only seen 0x4b (=75) which is what is used in nv_crtc.c anyway, - * so we're not using this table value for now - */ + /* fptable[4] is the minimum RAMDAC_FP_HCRTC->RAMDAC_FP_HSYNC_START gap */ + bios->digital_min_front_porch = fptable[4]; ofs = 0; break; default: @@ -3096,6 +3094,10 @@ static void parse_fp_mode_table(ScrnInfoPtr pScrn, bios_t *bios, struct fppointe return; } + /* non mobile only needs to set digital_min_front_porch */ + if (!(bios->feature_byte & FEATURE_MOBILE)) + return; + parse_lvds_manufacturer_table_header(pScrn, bios, <h); switch (lth.lvds_ver) { @@ -3865,8 +3867,7 @@ static void parse_bit_structure(ScrnInfoPtr pScrn, bios_t *bios, const uint16_t parse_bit_C_tbl_entry(pScrn, bios, &bitentry); break; case 'D': - if (bios->feature_byte & FEATURE_MOBILE) - parse_bit_display_tbl_entry(pScrn, bios, &bitentry); + parse_bit_display_tbl_entry(pScrn, bios, &bitentry); break; case 'I': parse_bit_init_tbl_entry(pScrn, bios, &bitentry); @@ -3941,6 +3942,7 @@ static void parse_bmp_structure(ScrnInfoPtr pScrn, bios_t *bios, unsigned int of pNv->dcb_table.i2c_read[0] = 0x3e; pNv->dcb_table.i2c_write[1] = 0x37; pNv->dcb_table.i2c_read[1] = 0x36; + bios->digital_min_front_porch = 0x4b; bios->fmaxvco = 256000; bios->fminvco = 128000; bios->fp.duallink_transition_clk = 90000; diff --git a/src/nv_crtc.c b/src/nv_crtc.c index 292c6bb..7876d46 100644 --- a/src/nv_crtc.c +++ b/src/nv_crtc.c @@ -945,7 +945,10 @@ nv_crtc_mode_set_fp_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr a regp->fp_horiz_regs[REG_DISP_END] = adjusted_mode->HDisplay - 1; regp->fp_horiz_regs[REG_DISP_TOTAL] = adjusted_mode->HTotal - 1; - regp->fp_horiz_regs[REG_DISP_CRTC] = adjusted_mode->HSyncStart - 75 - 1; + if ((adjusted_mode->HSyncStart - adjusted_mode->HDisplay) >= pNv->VBIOS.digital_min_front_porch) + regp->fp_horiz_regs[REG_DISP_CRTC] = adjusted_mode->HDisplay; + else + regp->fp_horiz_regs[REG_DISP_CRTC] = adjusted_mode->HSyncStart - pNv->VBIOS.digital_min_front_porch - 1; regp->fp_horiz_regs[REG_DISP_SYNC_START] = adjusted_mode->HSyncStart - 1; regp->fp_horiz_regs[REG_DISP_SYNC_END] = adjusted_mode->HSyncEnd - 1; regp->fp_horiz_regs[REG_DISP_VALID_START] = adjusted_mode->HSkew; diff --git a/src/nv_type.h b/src/nv_type.h index d3cae3a..4659295 100644 --- a/src/nv_type.h +++ b/src/nv_type.h @@ -303,6 +303,8 @@ typedef struct { uint16_t pll_limit_tbl_ptr; uint16_t ram_restrict_tbl_ptr; + uint8_t digital_min_front_porch; + struct { DisplayModePtr native_mode; uint8_t *edid; -- 1.5.4.4