chewitt / linux

Linux kernel source tree -- WARNING I REBASE MY BRANCHES!
Other
23 stars 18 forks source link

VP9 will not play using 59.94 fractional rate #3

Closed chewitt closed 5 months ago

chewitt commented 1 year ago

4K VP9 media with 59.94 fractional refresh rate causes the screen to go blank (no sync) with the following error reported in system logs:

[   89.610280] Fatal Error, invalid HDMI vclk freq 593406

Modetest shows the following:

3840x2160 59.94 3840 4016 4104 4400 2160 2168 2178 2250 593407 flags: phsync, pvsync; type: driver
calculated value -----------------------------------------^

Tweaking DIV_ROUND_CLOSEST formula to use 1002 in calculations instead of 1001 results in 593406 and 4K 59.94 media plays correctly:

diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c
index 2a82119eb58e..3fc7d9cb9953 100644
--- a/drivers/gpu/drm/meson/meson_vclk.c
+++ b/drivers/gpu/drm/meson/meson_vclk.c
@@ -110,7 +110,7 @@
 #define HDMI_PLL_LOCK      BIT(31)
 #define HDMI_PLL_LOCK_G12A (3 << 30)

-#define FREQ_1000_1001(_freq)  DIV_ROUND_CLOSEST(_freq * 1000, 1001)
+#define FREQ_1000_1001(_freq)  DIV_ROUND_CLOSEST(_freq * 1000, 1002)

 /* VID PLL Dividers */
 enum {

However 1001 is the correct value and essential for other fractional rates like 23.976.

Perhaps a precision or rounding error?

chewitt commented 10 months ago

Resolved with https://patchwork.kernel.org/project/linux-amlogic/patch/20240109230704.4120561-1-christianshewitt@gmail.com/

chewitt commented 5 months ago

Closing as merged and picked to stable/fixes upstream.