CoreElec bug - When setting resolutions like 1280x1024p60hz

I think there is a bug with the frequency CoreElec sets when setting resolutions that have width and height resolutions for example 1024x768p60hz, 1280x1024p60hz.
When setting 720p60hz to mode like so:

echo 720p60hz > /sys/class/display/mode

All is fine and the mode changes, however when you change it to a width and height valid resolution the frequency becomes based on the previous single value you have entered, in this case which would be 720p60hz.

echo 1280x1024p60hz > /sys/class/display/mode

becomes a different frequency based on the previous value:
1280x720x60 = 55296000
Then the next frequency becomes:
55296000 / (1280x1024) approximately 42hz (shows up as 41hz on my display).

When the frequency for the width x height value should just be 60hz. It’s a pretty serious issue as people are having big issues with resolutions that are not single HD values.

If someone could pass this bug to CoreELEC it would be much appreciated, I tried to signup to there forums but e-mail is down for me.

edit: fixed type from 1080p60hz to 720p60hz in this demonstration.

This is the first reply:

That bug you just pointed a link to, can you ask the user about what device, what display, and what emuelec version this is in regards to.

Beelink GT KING Pro - Smart TV BOX - AmLogic S922X rev b - Mali G52
Video output - Hisense 72 inch 4K UHD Television - HDMI 2.0 cable.
EmuELEC 4.5 I think. It has been slightly modified.
Linux Kernel 4.9.269
CoreElec version 20.0

Are you having the issue with CoreELEC as well?? or just EmuELEC?

@EmuELEC
The bug goes deep within the linux kernel we are using.

Maybe some resolutions can be added here?

Hey good find, but according to that:

{ "1280x1024p60hz", VMODE_HDMI, 1280, 1024, 60, 0},

Has the refresh rate there but it’s not respecting the set refresh rate it’s going back to the previous single HD resolutions refresh rate (ex. 720p60hz) If I dont call the previous HDMI mode single value in mode, the frequency sets to really high and causes the signal to go out of range.
It must be something in the code that the double values ( X _ x _ Y p60hz) frequency setting is not being respected and set properly.

I looked at my tv manual and 1280x1024 isnt listed as a valid resolution. The issue is still relevant because even when I was 1024x768p60z (a valid res on tv) it only shows if I first set display mode to a single named resolution 720p60hz, then change it to 1024x768p60hz (though the frequency is incorrect still).

edit: I checked dmesg for errors:

[    2.254374@3]- dim:err:dim_get_vpu_clkb: get clk vpu error.
[    2.710049@2]- hdmitx: fs = 3, cd = 4, tmds_clk = 593407
[    2.710050@2]- hdmitx: hw: aud_n_para = 5824
[    2.710056@2]- hdmitx: hw: set channel status
[    2.710068@2]- hdmitx: hw: [0x10e3] = 0x1f
[    2.710085@2]- hdmitx: audio: Audio Type: PCM
[    3.396300@2]- TDM id 2 i2s2hdmi:1
[    3.399654@2]- snd_tdm ff642000.audiobus:i2s2hdmi: lane_mask_out = f, lane_oe_mask_out = 0
[    3.407956@2]- snd_tdm ff642000.audiobus:i2s2hdmi: neither mclk_pad nor mclk2pad set
[    3.415607@2]- snd_tdm ff642000.audiobus:i2s2hdmi: aml_tdm_get_pins error!
[    3.698193@2]- snd_tdm ff642000.audiobus:i2s2hdmi: ASoC: Failed to add I2SIn CLK: -16
[    3.871968@0]- hdmitx: hdr_work_func: disable DRM
[   22.797355@4]- hdmitx: hdmitx_set_current_vmode[5445]
[   22.797356@4]- hdmitx: system: recalc before 1280x1024p60hz 60 1, frac 0
[   22.797358@4]- hdmitx: system: recalc after 1280x1024p60hz 2997 50, frac 1
[   22.797360@4]- hdmitx: hdmitx: display colourdepth was 8 in cur_param 0x0ad62880 (VIC: 97)
[   22.797361@4]- hdmitx: system: get current mode: 1280x1024p60hz
[   22.797362@4]- hdmitx: system: update physical size: 1150 650
[   22.797375@4]- hdmitx: hdmitx: display colourdepth is 10 in cur_param 0x0ad62880 (VIC: 97)
[   22.797398@4]- hdmitx: video: already init VIC = 0  Now VIC = 780
[   22.797400@4]- hdmitx: hdmitx: VESA only support RGB format
[   22.797401@4]- hdmitx: hw: div40: 0
[   22.825966@4]- hdmitx: frac_rate = 1
[   22.825969@4]- hdmitx: hdmitx: set clk: VIC = 780  cd = 5  cs = 0 frac_rate = 1
[   22.825971@4]- hdmitx: Not find VIC = 780 for hpll setting
[   22.825973@4]- hdmitx: set enc for VIC: 780
[   22.825982@2]h hdmitx: system: irq 80000001 0
[   22.867967@4]- hdmitx: hw:  config hdmitx IP vic = 780 cd:5 cs: 0
[   22.878063@4]- hdmitx: video: Sink is HDMI device
[   22.878095@4]- hdmitx: hw: set audio
[   22.878099@4]- hdmitx: hw: hdmitx tx_aud_src = 0, audio_param->channel_num = 1, hdev->aud_output_ch = 0
[   22.878109@4]- hdmitx: fs = 3, cd = 4, tmds_clk = 108000
[   22.878111@4]- hdmitx: hw: aud_n_para = 6144
[   22.878117@4]- hdmitx: hw: set channel status
[   22.878130@4]- hdmitx: hw: [0x10e3] = 0x1f
[   22.878147@4]- hdmitx: audio: Audio Type: PCM
[   22.878149@4]- hdmitx: system: update rx hdr info d
[   22.881183@2]h hdmitx: system: irq 80000001 0

To reproduce bug in amlogic-linux 4.9:

echo 720p60hz > /sys/class/display/mode
echo 1280x1024p60hz > /sys/class/display/mode

Check tv input it will be at approx 41hz.

echo 1080p60hz > /sys/class/display/mode
echo 1280x1024p60hz > /sys/class/display/mode

Check tv input it will be at approx 82hz.

I think the clock setting for 1280x1024p60hz should be tmds_clk = 78750.