gma ironlake: Move FDI override into Connectors.Prepare()
Tested w/ Kontron/KTQM77 and three monitors. If the second pipe
is enabled late, after the third pipe, with a high-resolution
monitor, we bail out correctly with
"Mode requirements exceed available bandwidth!"
Change-Id: Iac5334e91b1e706dca21e74845a3227c3b9b6503
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/463
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/common/ironlake/hw-gfx-gma-connectors.adb b/common/ironlake/hw-gfx-gma-connectors.adb
index 11ecdf6..d813fe4 100644
--- a/common/ironlake/hw-gfx-gma-connectors.adb
+++ b/common/ironlake/hw-gfx-gma-connectors.adb
@@ -14,6 +14,8 @@
--
with HW.GFX.GMA.Config;
+with HW.GFX.GMA.DP_Info;
+with HW.GFX.GMA.Registers;
with HW.GFX.GMA.Panel;
with HW.GFX.GMA.Connectors.EDP;
with HW.GFX.GMA.Connectors.FDI;
@@ -39,8 +41,33 @@
Port_Cfg : in out Port_Config;
Success : out Boolean)
is
+ -- Override lane count for FDI_B if FDI_C is used
+ procedure Override_FDI_Link
+ with
+ Post => Port_Cfg.Mode = Port_Cfg'Old.Mode
+ is
+ FDI_TX_CTL_FDI_TX_ENABLE : constant := 1 * 2 ** 31;
+ Enabled : Boolean;
+ begin
+ if Config.Has_FDI_C and then Port_Cfg.Port = DIGI_C then
+ -- if DIGI_D enabled: (FDI names are off by one)
+ Registers.Is_Set_Mask
+ (Register => Registers.FDI_TX_CTL_C,
+ Mask => FDI_TX_CTL_FDI_TX_ENABLE,
+ Result => Enabled);
+ if Enabled then
+ Port_Cfg.FDI.Receiver_Caps.Max_Lane_Count := DP_Lane_Count_2;
+ end if;
+ end if;
+
+ DP_Info.Preferred_Link_Setting (Port_Cfg.FDI, Port_Cfg.Mode, Success);
+ end Override_FDI_Link;
begin
- Success := True;
+ if Port_Cfg.Is_FDI then
+ Override_FDI_Link;
+ else
+ Success := True;
+ end if;
end Prepare;
----------------------------------------------------------------------------