Hello together,
I noticed microstuttering in Gameboy Games like Super Mario Land (60 FPS) on my RG34XX-H. To investigate, I launched RetroArch from the Apps and found that it estimated the display refresh rate (Settings, Video, Output) at around 106 Hz instead of 60 Hz.
I found TheGammaSqueeze’s 60 Hz fix ( rgxx_boot_package_mods/60hz at rg34xx · TheGammaSqueeze/rgxx_boot_package_mods · GitHub ) and tested it. The refresh rate was corrected, but unfortunately the patch also affected the controller/GPIO configuration, leaving several buttons unusable.
With some AI-assisted investigation, I looked into the LCD timings and the Allwinner H700 BSP driver. I think I’ve (or better: “the AI has”
) identified the underlying issue.
The original Andromeda configuration specifies:
lcd_dclk_freq = 27 MHz
lcd_ht = 840
lcd_vt = 536
This should produce 59.97 Hz. However, the related Allwinner sun50iw9 BSP uses a fixed TCON divider of 6 for the RGB/HV interface.
From disp_al.c:
static struct lcd_clk_info clk_tbl[] = {
{LCD_IF_HV, 6, 1, 1, 0},
{LCD_IF_CPU, 12, 1, 1, 0},
{LCD_IF_LVDS, 7, 1, 1, 0},
};
And disp_lcd.c calculates the parent clock accordingly:
dclk_rate = lcdp->panel_info.lcd_dclk_freq * 1000000;
/* ... */
lcd_rate = dclk_rate * clk_info.tcon_div;
pll_rate = lcd_rate * clk_info.lcd_div;
However, the pll_video0x4 frequency table starts at 288 MHz, as shown in clk-sun50iw9_tbl.c:
struct sunxi_clk_factor_freq factor_pllvideo0x4_tbl[] = {
PLLVIDEO0(23, 1, 288000000U),
PLLVIDEO0(24, 1, 300000000U),
PLLVIDEO0(25, 1, 312000000U),
PLLVIDEO0(26, 1, 324000000U),
The requested 27 MHz pixel clock requires a 162 MHz PLL clock (27 × 6), which is below the table’s minimum.
Instead, the hardware appears to use 288 MHz:
288 MHz / 6 = 48 MHz
48,000,000 / (840 × 536) = 106.61 Hz
This matches the observed behavior. I also confirmed via SSH with the original configuration:
pll_video0x4: 288000000
tcon_lcd: 288000000
lcd output: fps:106.5
TheGammaSqueeze’s fix works around this by setting the pixel clock to 54 MHz and increasing lcd_ht to 1679. This uses the supported 324 MHz PLL clock and results in approximately 60 Hz.
It looks like the underlying issue is the mismatch between the requested LCD pixel clock and the frequencies supported by the BSP clock configuration. The BSP sources from above are closely related, although I haven’t verified that they exactly match the kernel build used by Andromeda.
