diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template index ccc5c1ac5c..357b93ff9d 100644 --- a/common/hw-gfx-gma-config.ads.template +++ b/common/hw-gfx-gma-config.ads.template @@ -248,4 +248,9 @@ is Secondary => 4096, Tertiary => 4096)); + ---------------------------------------------------------------------------- + + HDMI_Max_Clock_24bpp : constant Frequency_Type := + (if CPU >= Haswell then 300_000_000 else 225_000_000); + end HW.GFX.GMA.Config; diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb index c50d943309..d156494119 100644 --- a/common/hw-gfx-gma.adb +++ b/common/hw-gfx-gma.adb @@ -237,6 +237,23 @@ is if Port_Cfg.Mode.BPC = Auto_BPC then Port_Cfg.Mode.BPC := Connector_Info.Default_BPC (Port_Cfg); end if; + if Port_Cfg.Display = HDMI then + declare + pragma Assert (Config.HDMI_Max_Clock_24bpp * 8 + / Port_Cfg.Mode.BPC >= Frequency_Type'First); + Max_Dotclock : constant Frequency_Type := + Config.HDMI_Max_Clock_24bpp * 8 / Port_Cfg.Mode.BPC; + begin + if Port_Cfg.Mode.Dotclock > Max_Dotclock then + pragma Debug (Debug.Put ("Dotclock ")); + pragma Debug (Debug.Put_Int64 (Port_Cfg.Mode.Dotclock)); + pragma Debug (Debug.Put (" too high, limiting to ")); + pragma Debug (Debug.Put_Int64 (Max_Dotclock)); + pragma Debug (Debug.Put_Line (".")); + Port_Cfg.Mode.Dotclock := Max_Dotclock; + end if; + end; + end if; end; else Port_Cfg := Port_Config'