diff --git a/MiSTer.ini b/MiSTer.ini index 7ca1eea..4f269df 100644 --- a/MiSTer.ini +++ b/MiSTer.ini @@ -24,6 +24,8 @@ dvi_mode=0 ; set to 1 for DVI mode. Audio won't be transmitted throu ; 5 - 800x600@60 ; 6 - 640x480@60 ; 7 - 1280x720@50 +; 8 - 1920x1080@60 +; 9 - 1920x1080@50 ; ; custom mode: 0,hact,hfp,hs,hbp,vact,vfp,vs,vbp,4,M,3,N,5,C0,9,CP,8,BW,7,Mfrac ; 0,1280,48,112,248,1024,1,3,38,4,1028,3,65536,5,514,9,2,8,7,7,0xA3D709E8 @@ -31,3 +33,13 @@ dvi_mode=0 ; set to 1 for DVI mode. Audio won't be transmitted throu ; custom mode: 1,hact,hfp,hs,hbp,vact,vfp,vs,vbp,Fpix ; 1,1280,48,112,248,1024,1,3,38,108 video_mode=0 + +; set to 1-10 to display video info on startup/change +video_info=0 + +; set to 1 for automatic HDMI VSync rate adjust to match original VSync. +; This option makes video butter smooth like on original emulated system. +; Adjusting is done by changing pixel clock. Not every display supports variable pixel clock. +; For proper adjusting and to reduce possible out of range pixel clock, use 60Hz HDMI video +; modes as a base even for 50Hz systems. +vsync_adjust=0 diff --git a/cfg.c b/cfg.c index 8599f89..bfd6421 100644 --- a/cfg.c +++ b/cfg.c @@ -31,7 +31,8 @@ const ini_var_t ini_vars[] = { { "RESET_COMBO", (void*)(&(cfg.reset_combo)), UINT8, 0, 3, 1 }, { "KEY_MENU_AS_RGUI", (void*)(&(cfg.key_menu_as_rgui)), UINT8, 0, 1, 1 }, { "VIDEO_MODE", (void*)(cfg.video_conf), STRING, 0, sizeof(cfg.video_conf)-1, 1 }, - { "VSYNC_AUTO", (void*)(&(cfg.vsync_auto)), UINT8, 0, 1, 1 }, + { "VIDEO_INFO", (void*)(&(cfg.video_info)), UINT8, 0, 10, 1 }, + { "VSYNC_ADJUST", (void*)(&(cfg.vsync_adjust)), UINT8, 0, 1, 1 }, { "HDMI_AUDIO_96K", (void*)(&(cfg.hdmi_audio_96k)), UINT8, 0, 1, 1 }, { "DVI_MODE", (void*)(&(cfg.dvi)), UINT8, 0, 1, 1 }, { "KBD_NOMOUSE", (void*)(&(cfg.kbd_nomouse)), UINT8, 0, 1, 1 }, diff --git a/cfg.h b/cfg.h index 5c40046..4275aef 100644 --- a/cfg.h +++ b/cfg.h @@ -23,7 +23,8 @@ typedef struct { uint8_t hdmi_audio_96k; uint8_t dvi; uint8_t video_mode; - uint8_t vsync_auto; + uint8_t video_info; + uint8_t vsync_adjust; uint8_t kbd_nomouse; uint8_t mouse_throttle; char video_conf[1024]; diff --git a/user_io.c b/user_io.c index 779a70c..8fcffeb 100644 --- a/user_io.c +++ b/user_io.c @@ -976,6 +976,9 @@ int hasAPI1_5() static int coldreset_req = 0; +static uint32_t vitems[32]; +double Fpix = 0; + int adjust_video_mode(uint32_t vtime); uint32_t show_video_info(int force) { @@ -1005,6 +1008,18 @@ uint32_t show_video_info(int force) printf("\033[1;33mINFO: Frame time (100MHz counter): VGA = %d, HDMI = %d\033[0m\n", vtime, vtimeh); if (vtimeh) api1_5 = 1; + if (hasAPI1_5() && cfg.video_info) + { + static char str[128]; + float vrateh = 100000000; + if (vtimeh) vrateh /= vtimeh; else vrateh = 0; + sprintf(str, "\n %4dx%-4d %6.2fKHz %4.1fHz" \ + "\n \x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81" \ + "\n %4dx%-4d %6.2fMHz %4.1fHz", + width, height, hrate, vrate, vitems[1], vitems[5], Fpix, vrateh); + InfoEx(str, 28, 5, cfg.video_info*1000); + } + if (vtime && vtimeh) return vtime; } else @@ -1535,7 +1550,7 @@ void user_io_poll() { res_timer = GetTimer(500); uint32_t vtime = show_video_info(0); - if (vtime && cfg.vsync_auto) + if (vtime && cfg.vsync_adjust) { adjust_video_mode(vtime); usleep(100000); @@ -2029,8 +2044,6 @@ struct }; #define VMODES_NUM (sizeof(vmodes) / sizeof(vmodes[0])) -static uint32_t vitems[32]; - static uint32_t getPLLdiv(uint32_t div) { if (div & 1) return 0x20000 | (((div / 2) + 1) << 8) | (div / 2); @@ -2039,6 +2052,8 @@ static uint32_t getPLLdiv(uint32_t div) static int setPLL(double Fout) { + Fpix = Fout; + uint32_t c = 1; while ((Fout*c) < 400) c++;