From 36abc4832ba772878c66080c93ee4604d9e661ae Mon Sep 17 00:00:00 2001 From: arpi Date: Tue, 10 Sep 2002 20:41:13 +0000 Subject: It prevents mode change when Hsync out of range. Supports non-countinous Hsync freq spec. patch by Rudolf Marek git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7361 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_vesa.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'libvo/vo_vesa.c') diff --git a/libvo/vo_vesa.c b/libvo/vo_vesa.c index 1f788e6bd9..fc17b53c9e 100644 --- a/libvo/vo_vesa.c +++ b/libvo/vo_vesa.c @@ -527,6 +527,7 @@ unsigned fillMultiBuffer( unsigned long vsize, unsigned nbuffs ) return i; } + static int set_refresh(unsigned x, unsigned y, unsigned mode,struct VesaCRTCInfoBlock *crtc_pass) { unsigned pixclk; @@ -552,11 +553,12 @@ static int set_refresh(unsigned x, unsigned y, unsigned mode,struct VesaCRTCInfo do { - H_freq -= 0.1; + H_freq -= 0.01; GTF_calcTimings(x,y,H_freq,GTF_HF,0, 0,crtc_pass); // printf("PixelCLK %d\n",(unsigned)crtc_pass->PixelClock); } - while (!in_range(monitor_vfreq,crtc_pass->RefreshRate/100)); + while ( (!in_range(monitor_vfreq,crtc_pass->RefreshRate/100)|| + !in_range(monitor_hfreq,H_freq*1000))&&(H_freq>0)); pixclk = crtc_pass->PixelClock; // printf("PIXclk before %d\n",pixclk); @@ -575,8 +577,17 @@ static int set_refresh(unsigned x, unsigned y, unsigned mode,struct VesaCRTCInfo printf("RR %d\n",crtc_pass->RefreshRate); printf("PixelCLK %d\n",(unsigned)crtc_pass->PixelClock);*/ + + if (!in_range(monitor_vfreq,crtc_pass->RefreshRate/100)|| + !in_range(monitor_hfreq,H_freq*1000)) { + printf( "vo_vesa: Unable to fit the mode into monitor's limitation." + " Not changing refresh rate.\n"); + return 0; + } + return 1; } + /* fullscreen: * bit 0 (0x01) means fullscreen (-fs) * bit 1 (0x02) means mode switching (-vm) @@ -886,11 +897,13 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin PRINT_VBE_ERR("vbeSaveState",err); return -1; } - /* TODO: check for VBE 3, monitor limitation - user might pass refresh value + + /* TODO: + user might pass refresh value, GTF constants might be read from monitor - for best results + for best results, I don't have a spec (RM) */ + if (((int)(vib.VESAVersion >> 8) & 0xff) > 2) { if (set_refresh(dstW,dstH,video_mode,&crtc_pass)) -- cgit v1.2.3