HaC-Mini icon indicating copy to clipboard operation
HaC-Mini copied to clipboard

Screen flickering

Open osy opened this issue 7 years ago • 85 comments

Probably an AMD framebuffer issue. Only appears if resolution is set to 2560x1440.

Workaround

One workaround is to always reset the resolution on display wakeup. We can use the displayplacer and sleepwatcher utilities to do this automatically after every display wakeup.

  1. Install https://github.com/jakehilborn/displayplacer
  2. Install https://www.bernhard-baehr.de with brew install sleepwatcher
  3. Run displayplacer list and get a string with all your displays, order, etc
  4. Create ~/Library/LaunchAgents/de.bernhard-baehr.sleepwatcher-displayfix.plist with the template below
  5. Run launchctl load ~/Library/LaunchAgents/de.bernhard-baehr.sleepwatcher-displayfix.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>de.bernhard-baehr.sleepwatcher-displayfix</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/sbin/sleepwatcher</string>
		<string>-W</string>
		<string>sleep 10; /usr/local/bin/displayplacer "id:E5BB9F08-9D64-22D5-06B5-9872624162C9 res:3008x1692 hz:60 color_depth:8 scaling:on origin:(0,0) degree:0" ; /usr/local/bin/displayplacer "id:E5BB9F08-9D64-22D5-06B5-9872624162C9 res:2560x1440 hz:60 color_depth:8 scaling:on origin:(0,0) degree:0"</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>KeepAlive</key>
	<true/>
</dict>
</plist>

Replace the two displayplacer argument strings with your own custom string. The difference between the two instances is that first we set the res to a higher one res:3008x1692 and then to what we want res:2560x1440. The sleep 10 prevents any issues trying to set the resolution before the display turns on.

osy avatar Jun 27 '19 03:06 osy

Do you fix it in kernel?

qibinghua avatar Sep 29 '19 05:09 qibinghua

It’s very difficult. I’ve been looking but I can’t find anything. The workaround is the best I can come up with right now.

osy avatar Sep 29 '19 07:09 osy

same issue after wakeup, on dell p2715q 3840 x 2160

ccsnake avatar Oct 02 '19 07:10 ccsnake

With workaround?

osy avatar Oct 02 '19 07:10 osy

Just 1.4.1 , is there any progress?thx:)

ccsnake avatar Oct 02 '19 07:10 ccsnake

What about Inject EDID? @osy86

qibinghua avatar Oct 06 '19 06:10 qibinghua

I have not tried, please let me know if you try.

osy avatar Oct 06 '19 07:10 osy

it is not working. and how do fix preview image?

qibinghua avatar Oct 06 '19 07:10 qibinghua

You're referring to #18 ?

osy avatar Oct 06 '19 07:10 osy

Just chiming in to relay my configuration and confirm that I'm seeing severe flickering on one of my monitors at any resolution when HiDPI is enabled:

HVK 10.15.1 (and also tested w/ 10.15.2 beta) HP Envy 27" 4K (flickering) QNIX 27" QHD (not flickering)

So far I've tried two cables - a mDP to DP cable, and a USB-C to USB-C cable. Both experience flickering that makes the system more or less unusable.

Thank you for all your hard work getting us this far!

derfbwh avatar Nov 23 '19 06:11 derfbwh

I've got 24k AOC U2879G6 screens. when use 1 screen and set HIDPI to 19201080,everything works fine. When I plug into the 2rd screen, all the 2 screens flickering, whatever HIDPI setting. Then I plug out the 2rd screen, everything become normal again without rebooting or log out.

petermaple avatar Jan 03 '20 00:01 petermaple

and no flicker happened when both screen are orignal 4K definition.

petermaple avatar Jan 03 '20 00:01 petermaple

delete whatevergreen changes nothing,still flickering

petermaple avatar Jan 03 '20 00:01 petermaple

Just chiming in to relay my configuration and confirm that I'm seeing severe flickering on one of my monitors at any resolution when HiDPI is enabled:

HVK 10.15.1 (and also tested w/ 10.15.2 beta) HP Envy 27" 4K (flickering) QNIX 27" QHD (not flickering)

So far I've tried two cables - a mDP to DP cable, and a USB-C to USB-C cable. Both experience flickering that makes the system more or less unusable.

Thank you for all your hard work getting us this far!

Have you ever tried to output 3 screens, like 2 via DP(or USB-C since ultimately it uses DP) and 1 via HDMI (you can connect both HDMI and DP to one of your display if possible).

KrisCris avatar Jan 28 '20 08:01 KrisCris

I have the same issue:

  1. When connecting only one 4K display (1.5:1 scaling, "looks like" 2560x1440), the workaround fixes the problem.
  2. If I then connect a second display (a 2K, 1200x1600; rotated) the 4K display starts flickering (even after the workaround which fixed it above). The workaround no-longer works when attempted after connecting the display. If I disconnect the 2K display, so there is only one 4K display connected, the workaround works again. Reconnecting the same 2K display a second time causes the 4K display to start flickering again.
  3. If I then connect a third display (another 2K, 1200x1600; rotated), the 4K display resets to 2:1 retina scaling. If I change it to 1.5:1 scaling, everything works again (i.e. workaround OK).
  4. With three displays connected, if I sleep and wake up the computer, the 4K display flickers again. The workaround doesn't help. One new workaround I found was to physically unplug the 4K display and plug it back in. That seems to reset the framebuffer, but is not ideal. Right now I am just disabling computer sleep in System Preferences, but would much rather have it sleep overnight when I do. ;-)

I am using two USB-C to DP adapters (one for 4K, one for 2K) and one DP port (second 2K). I found that using the HDMI port for the 4K display, and using both DP ports for each of the 2K displays, did not change the above behavior.

On a separate note, I found that using the HDMI port for the 4K display caused my windows to re-arrange on display wake up (not necessarily computer wake up). This hasn't happened so far when using two USB-C DP adapters and the DP port. Perhaps a lag in the AMD card initializing the HDMI chipset? Do they use a discrete IC that performs a DP > HDMI signal conversion like some of the other NUCs?

Happy to perform other tests, and any hacks the legendary @osy86 might come up with!

diskdude avatar Mar 23 '20 23:03 diskdude

Adding a 3rd display fixes the headache inducing flicker I was experiencing with a 2nd display...

Building on @Yrp said in #212 (that bug should probably be a dupe of this):

  • [ ] Going from 1 to 2 displays causes intermittent flickering
  • [x] Going from 2 to 3 displays resolves the flickering
  • [x] Dropping down from 3 to 2 displays -> no flickering either
  • [x] Going 2 to 3 to 2 again -> no flickering
  • [ ] Dropping from 2 to 1 and then back up to 2 again results in flickering

The displays I'm using are:

  1. LG 4K via miniDP
  2. Samsung 2K via miniDP
  3. 720p MPi3508 Raspberry Pi Display (3.5")

The resolutions of the displays doesn't seem to matter, the 4K w/ the 720p had flickering going from 1 to 2 displays.

I might be able to hook up a 4th display to the second HDMI, if knowing that behaviour would be helpful.

Haven't tried with any screens sleeping.

There are HDMI and DP Dummy (ghost) display adapter plugs that can be used to fake a screen which could be an inexpensive hardware workaround (~$2 on ebay from China)

deftdawg avatar Apr 10 '20 08:04 deftdawg

Adding a 3rd display fixes the headache inducing flicker I was experiencing with a 2nd display...

Building on @Yrp said in #212 (that bug should probably be a dupe of this):

  • [ ] Going from 1 to 2 displays causes intermittent flickering
  • [x] Going from 2 to 3 displays resolves the flickering
  • [x] Dropping down from 3 to 2 displays -> no flickering either
  • [x] Going 2 to 3 to 2 again -> no flickering
  • [ ] Dropping from 2 to 1 and then back up to 2 again results in flickering

The displays I'm using are:

  1. LG 4K via miniDP
  2. Samsung 2K via miniDP
  3. 720p MPi3508 Raspberry Pi Display (3.5")

The resolutions of the displays doesn't seem to matter, the 4K w/ the 720p had flickering going from 1 to 2 displays.

I might be able to hook up a 4th display to the second HDMI, if knowing that behaviour would be helpful.

Haven't tried with any screens sleeping.

There are HDMI and DP Dummy (ghost) display adapter plugs that can be used to fake a screen which could be an inexpensive hardware workaround (~$2 on ebay from China)

Your summary is very good!

Yrp avatar Apr 10 '20 17:04 Yrp

I've now done some additional testing with 4 displays. The displays I'm using are:

  1. LG 4K via miniDP
  2. Samsung 2K via miniDP
  3. 720p MPi3508 Raspberry Pi Display (3.5") via HDMI
  4. SyncMaster 206 (1680x1050 res) via HDMI
  • [x] Mirroring w/ 2 Displays -> no flickering
  • [ ] 1 to 2 mirrored to 2 not mirrored -> flickering
  • [x] 1 to 3 to 2 mirrored to 2 not mirrored -> no flickering
  • [x] 2 to 3 to 4 -> no flickering
  • [x] 4 to 3 to 2 -> no flickering

This seems to confirm the flickering effects only occur when a second display is added and clear after adding a 3rd or more displays until the number of active displays falls back to 1 and rises to 2 again.

deftdawg avatar Apr 10 '20 19:04 deftdawg

I've now done some additional testing with 4 displays. The displays I'm using are:

  1. LG 4K via miniDP
  2. Samsung 2K via miniDP
  3. 720p MPi3508 Raspberry Pi Display (3.5") via HDMI
  4. SyncMaster 206 (1680x1050 res) via HDMI
  • [x] Mirroring w/ 2 Displays -> no flickering
  • [ ] 1 to 2 mirrored to 2 not mirrored -> flickering
  • [x] 1 to 3 to 2 mirrored to 2 not mirrored -> no flickering
  • [x] 2 to 3 to 4 -> no flickering
  • [x] 4 to 3 to 2 -> no flickering

This seems to confirm the flickering effects only occur when a second display is added and clear after adding a 3rd or more displays until the number of active displays falls back to 1 and rises to 2 again.

In my case, mirroring displays can cause consistent flickering... (4K+2K)

KrisCris avatar Apr 11 '20 02:04 KrisCris

@KrisCris interesting... My 2K display is rotated 90 degrees. I wonder if that has an effect (certainly the mirrored resolution is lower)

deftdawg avatar Apr 12 '20 15:04 deftdawg