Commit 0a4a1fce authored by Bjorn Astrom's avatar Bjorn Astrom
Browse files

[WIP] More video mode stuff, scandoubler refresh rate tweak

parent e1df5e14
......@@ -370,42 +370,65 @@ void pixelclock_init(int mhz) {
u32 otherdiv = 11;
// Multiply/divide 100mhz fabric clock to desired pixel clock
if (mhz == 50) {
mul = 15;
div = 1;
otherdiv = 30;
} else if (mhz == 40) {
mul = 14;
div = 1;
otherdiv = 35;
} else if (mhz == 75) {
mul = 15;
div = 1;
otherdiv = 20;
} else if (mhz == 65) {
mul = 13;
div = 1;
otherdiv = 20;
} else if (mhz == 27) {
mul = 27;
div = 2;
otherdiv = 50;
} else if (mhz == 54) {
mul = 27;
div = 1;
otherdiv = 50;
} else if (mhz == 150) {
mul = 15;
div = 1;
otherdiv = 10;
} else if (mhz == 25) { // 25.205
mul = 15;
div = 1;
otherdiv = 60;
} else if (mhz == 108) {
mul = 54;
div = 5;
otherdiv = 10;
// Max multiplier is 64
// Max div is 56
// Max otherdiv is 128
switch (mhz) {
case 50:
mul = 15;
div = 1;
otherdiv = 30;
break;
case 40:
mul = 14;
div = 1;
otherdiv = 35;
break;
case 75:
mul = 15;
div = 1;
otherdiv = 20;
break;
case 65:
mul = 13;
div = 1;
otherdiv = 20;
break;
case 27:
// Ever so slightly off from the exact PAL Amiga refresh rate, causes one
// frame tear every minute or two.
// 45 / 2 / 83 = 27.1084 MHz = 49.92 Hz
mul = 45;
div = 2;
otherdiv = 83;
// Slightly faster than the exact PAL Amiga refresh rate, causes one
// duplicated frame every ~45 seconds.
// 64 / 2 / 118 = 27.1186 MHz = 49.94 Hz
//mul = 45;
//div = 2;
//otherdiv = 83;
break;
case 54:
mul = 27;
div = 1;
otherdiv = 50;
break;
case 150:
mul = 15;
div = 1;
otherdiv = 10;
break;
case 25: // 25.205
mul = 15;
div = 1;
otherdiv = 60;
break;
case 108:
mul = 54;
div = 5;
otherdiv = 10;
break;
}
XClk_Wiz_WriteReg(XPAR_CLK_WIZ_0_BASEADDR, 0x200, (mul << 8) | div);
......@@ -504,7 +527,7 @@ void video_system_init(int hres, int vres, int htotal, int vtotal, int mhz,
printf("...done.\n");
printf("hdmi_set_video_mode()...\n");
hdmi_set_video_mode(hres, vres, mhz, vhz, hdmi);
//hdmi_set_video_mode(hres, vres, mhz, vhz, hdmi);
printf("hdmi_ctrl_init()...\n");
hdmi_ctrl_init();
......
......@@ -25,12 +25,12 @@ struct zz_video_mode preset_video_modes[ZZVMODE_NUM] = {
// HRES VRES HSTART HEND HMAX VSTART VEND VMAX POLARITY MHZ PIXELCLOCK HZ VERTICAL HZ HDMI
{ 1280, 720, 1390, 1430, 1650, 725, 730, 750, 0, 75, 75000000, 60, 0 },
{ 800, 600, 840, 968, 1056, 601, 605, 628, 0, 40, 40000000, 60, 0 },
{ 640, 480, 656, 752, 800, 490, 492, 525, 0, 25, 25000000, 60, 0 },
{ 640, 480, 656, 752, 800, 490, 492, 525, 0, 25, 25175000, 60, 0 },
{ 1024, 768, 1048, 1184, 1344, 771, 777, 806, 0, 65, 65000000, 60, 0 },
{ 1280, 1024, 1328, 1440, 1688, 1025, 1028, 1066, 0, 108, 108000000, 60, 0 },
{ 1920, 1080, 2008, 2052, 2200, 1084, 1089, 1125, 0, 150, 150000000, 60, 0 },
{ 720, 576, 732, 796, 864, 581, 586, 625, 1, 27, 27000000, 50, 0 },
{ 1920, 1080, 2448, 2492, 2640, 1084, 1089, 1125, 0, 150, 150000000, 50, 0 },
{ 720, 480, 720, 752, 800, 490, 492, 525, 0, 25, 25000000, 60, 0 },
{ 720, 480, 720, 752, 800, 490, 492, 525, 0, 25, 25175000, 60, 0 },
{ 640, 512, 840, 968, 1056, 601, 605, 628, 0, 40, 40000000, 60, 0 },
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment