hw-gfx-edid: Clamp preferred mode BPC to 8
EDID often advertises 10+ BPC while the link (or FDI) cannot carry
that at the preferred mode. Cap Mode.BPC at 8 after reading the EDID
depth field so modes stay within typical DP/HDMI/FDI bandwidth.
Tested on samsung/stumpy with a Dell UW3419 over DisplayPort.
Change-Id: I8ef4e493ded3d29be26bda851b478db7c8ad2723
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/571
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/common/hw-gfx-edid.adb b/common/hw-gfx-edid.adb
index d8dba1d..57e0c7e 100644
--- a/common/hw-gfx-edid.adb
+++ b/common/hw-gfx-edid.adb
@@ -157,6 +157,11 @@
(Raw_EDID (INPUT) and INPUT_DIGITAL_DEPTH_MASK,
INPUT_DIGITAL_DEPTH_SHIFT))));
+ -- Clamp to 8-bit for compatibility and to conserve bandwidth
+ if Mode.BPC > 8 then
+ Mode.BPC := 8;
+ end if;
+
-- Calculate absolute values from EDID relative values.
Mode.H_Sync_Begin := Mode.H_Visible + Mode.H_Sync_Begin;
Mode.H_Sync_End := Mode.H_Sync_Begin + Mode.H_Sync_End;