Why does a Macbook pro's internal screen flicker ONLY when it is on a GPU?
I've been diagnosing a similar issue. It's helpful to run this tool with various configurations, then use unix diff to compare the configuration settings.
/System/Library/Extensions/AppleGraphicsControl.kext/Contents/MacOS/AGDCDiagnose

e.g.
diff -u AGDCDiagnose-high-freq-after-detection.txt AGDCDiagnose-without-EDR.txt |
@@ -1772,8 +2354,8 @@
 Link Lanes 4 {4,4}
 Link Rate (Mbps)   3240 {3240,3240}
 Link Bits  30 {18,30}
-Voltage Swing (Level)  {255,255,255,255}
-Pre-Emphasis (Level)   {255,255,255,255}
+Voltage Swing (Level)  {0,0,0,0}
+Pre-Emphasis (Level)   {0,0,0,0}
 Spread Enabled
 Enhanced Framing   Enabled
 Scrambler  Enabled
@@ -1820,7 +2402,7 @@
 DIG FE B
 Number of Devices  1
 Timing DICT    21
-Display Mode   80004003
+Display Mode   80006003
 Refresh Rate (Calculated)  60 Hz
 Refresh Rate (Stored)  0.0 Hz
 Window (Active)    2880 x 1800
@@ -1924,7 +2506,7 @@
 DIG FE A
 Number of Devices  1
 Timing DICT    21
-Display Mode   80005022
+Display Mode   80003022
 Refresh Rate (Calculated)  60 Hz
 Refresh Rate (Stored)  0.0 Hz
 Window (Active)    3840 x 2160
@@ -1947,12 +2529,12 @@
 Dynamic Range  1 (SDR)