microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.82k stars 29.12k forks source link

vscode flickering on mac (macbook air M1 ) while using with external display. #165681

Open gitsameep opened 1 year ago

gitsameep commented 1 year ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Connect your laptop with an external display.
  2. Use your vscode on fullscreen. (On any display)
  3. Start using your vscode, after sometime it will start happening. (No pattern here, Unable to reproduce consistently)
  4. Maybe switching between two displays triggers this issue. Not sure. (Like browser on main display then switch to vscode on another display and it happens)

Flickering happens on the main and external display as well. Flickering is random. Sometimes the screen goes black for a long (3-4 secs). Sometimes it flickers continuously.

Will publish more related videos. It's pretty random. Unable to record all situations.

https://user-images.githubusercontent.com/96908258/200257870-5a55e608-844d-44d0-a7b4-e99a6043c3ab.mp4

cevenkadir commented 1 year ago

I have the same problem with my MBA M1.

Bovey0809 commented 1 year ago

The same on mbp 14 m1pro

wehype-jonas commented 1 year ago

I am experiencing the same issues. Very problematic as it is occurring more frequently as of today for me. But the problem started when updating to MacOS 13.0

kdubrovsky commented 1 year ago

Same issues. MacBook Pro 16 and external Benq 4k display

khanhmai20 commented 1 year ago

same issue

dmo-code commented 1 year ago

M1 Max MacBook Pro 16 and external Benq 4k display.

Dylan-Ranger commented 1 year ago

Yeah, same exact issue. M1 chip MacBook Pro 14 inch.

eduelias commented 1 year ago

Me too. Following.

AlexDingleberries commented 1 year ago

Me too, MBAM2 external Samsung monitor.

deepak1556 commented 1 year ago

Please try our exploration build based on newer runtime and confirm if the issue still persists. Thanks!

cypressf commented 1 year ago

Mine flickers very fast, in both the stable build and the exploration build. Gets worse or better depending on the window position.

Able to reproduce when

I wasn't able to reproduce when VS Code was set to Dark+ V2 (Experimental), or when macOS was in light mode and VS Code was in Dark+ (default dark)

Laptop

MacBook Pro 14-inch, 2021 Apple M1 Pro 32 GB macOS 13.1 (22065)

External Display

BenQ PD3220U, 4k 60hz, used as main display, macbook in clamshell mode

aneelang commented 1 year ago

Having the same issue lately

kferrone commented 1 year ago

The flicker is bad, gives me a headache. I did find out it is partly because of the themes. Not always though, the themes seem to make it happen just more often. Especially the kimbie dark theme. When it gets really bad, I must close everything and be on an empty desktop until it stops.

The external display on the macs hdmi port is the culprit. The laptop screen and the other connected with thunderbolt never flicker.

External Display: Asus VS247.

zDEFz commented 1 year ago

https://forums.macrumors.com/threads/m1-air-ghosting-flickering-with-external-display.2271670/page-23

Having had my m1 mac for a long time, using my m1 mac mini as a headless server and for work I already switched to "normal" x86 machine. Problem is even worse when running asahilinux. But, hear me out: It is rumored that its a issue with EDID, which could mean that running your display with a capture card that has passthrough in between could actually help. Cost around 160 bucks ( e.g NZXT Signal 4K30 ) Alternatively could try a EDID Emulator device. But it could also be a regional issue - some machines may not have the issue, produced somewhere else.

Not always though, the themes seem to make it happen just more often. Especially the kimbie dark theme.

@kferrone thats absolutely correct. Those were also the findings in the link posted above...

jagibson commented 1 year ago

Happened to me on my M1 macbook pro after I switched from HDMI to USB-C/Displayport. After I switched away from "Solarized Dark" theme to "Dark+ V2 (Experimental)" the flickering went away.

aneelang commented 1 year ago

I doubt it has to do with the theme. Can you let me know if you don't have any flickering for the next couple days?

dmo-code commented 1 year ago

I have now switched back to HDMI from the MacBook.

Now the flickering is gone. Seems like it doesn't have anything with VS Code Theme. It seems to be a USB-C problem with a BenQ 4K monitor.

jagibson commented 1 year ago

@aneelang After looking at the video I think my issue is different. My flickering is much quicker than the reporter's. It almost looks like it's doing interlacing like an old TV, except it's vertical and not horizontal. Also it makes the whole monitor flicker even if code is only using half of the screen. It does not stop flickering until I change the theme or I remove "black" dialogs hovering over the main editor window.

I agree that it's not likely the theme but maybe it could be the rendering/contrast? I could get it to happen pretty consistently by doing the following:

Having the almost-black background of the dialog hover over the slightly lighter background of Solarized Dark seems to be the trigger. I tried a few other themes but couldn't re-create it as noticeably.

After I restarted Code today I could not reproduce the issue. I've had it open for several days including suspend/resumes.

Other notes

zDEFz commented 1 year ago

@jagibson I absolutely have no evidence about what I'm about to say: This is a issue with M Series devices which is triggered by certain colors/schemes which apple is unable to fix. As pointed above, in the countless sub-links in the link I've posted: Changing the EDID sometimes had helped. But the real fix would be related to hardware, rather than software.

samuelan commented 1 year ago

I have LG Ultrafine external, Macbook Pro connected via Thunderbolt, and as soon as I disconnect from the external display, it will first go complete dark, then it will come back, and the flickering starts, and more than half of the screen will go dark. Even after I kill vscode, the problem is still there, but seems less frequent than when Vscode is on. I've tried many things include reset System Management Controller, and now I am on this thread here. I really don't know what it is.

zDEFz commented 1 year ago

Some people claim that disabling nightlight/nightshift helps.

samuelan commented 1 year ago

It looks definitely related to VS code. This morning I used browser, notes for about 30 minutes with no flickering or dark screen problem whatsoever, but as soon as I started the vscode, the problem started. I quit the vscode, for about 30 seconds, it has a lingering effect on the flickering and mouse cursor was sluggish, then the problem stopped. I suspect vscode triggerred something in the display settings/driver, and causing this issue. Here is my settings from vscode. Version: 1.76.2 Commit: ee2b180d582a7f601fa6ecfdad8d9fd269ab1884 Date: 2023-03-14T17:54:09.061Z Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Darwin x64 22.3.0 Sandboxed: No

zDEFz commented 1 year ago

I suspect vscode triggerred something in the display settings/driver

Thats what I was talking about. Everything dark-theme related or specific dark gray tones seem to trigger this specific behavior. @samuelan Are you certain this issue ever shows up on light themes?

samuelan commented 1 year ago

Thank for asking, @zDEFz. I have night shift turned off, and I always use light theme, never really used dark theme.

AnalyticsWithScott commented 1 year ago

I am having the same issue. The flickering on my screen is very rapid. Just bought a brand new MacBook Pro M1 Max 32 GB RAM and my screen flickers when I use full screen visual studio code with HDMI to an external LG monitor.

Will continue following.

samuelan commented 1 year ago

Update 4/4/2023. I replaced my Macbook. The technician said it was not vscode or any other software. It was the hardware related to the display. The flickering and half screen goes black in non-deterministic fashion got worse last few days with or without the VScode running. I conclude it's not vs code.

sdairs commented 1 year ago

This absolutely is an issue with VS Code. No other app triggers this, and its happening to a lot of people.

M1 Mac, Dark theme (Solarized dark), external display (1440p 165Hz) over HDMI

kferrone commented 1 year ago

I found a workaround ... mostly. I make sure every workspace only has one single theme extension enabled. I went to all my workspaces and disabled all themes globally first. Then in each workspace, I only enable the extension for the theme I want in that workspace. This means all the others theme extensions are disabled.

If I enable every theme extension in a workspace and then choose a theme, the flicker will get bad. I am also suspicious of too many extensions in general so I only enable extensions selectively per workspace and have all global extensions disabled.

I blame extensions fighting with each-other.

zDEFz commented 1 year ago

This absolutely is an issue with VS Code. No other app triggers this, and its happening to a lot of people.

M1 Mac, Dark theme (Solarized dark), external display (1440p 165Hz) over HDMI

I have a M1 Mac too and other apps trigger this as well Correlation does not imply causation So which apps am I talking about? mostly https://github.com/electron/electron/issues/8127 electron based ones. And it is most visible in dark scenes. But due to my experiences this is most likely related with the internal hardware. You might seen that they talk about a Nvidia GPU handling the display.

It is not really undermining the point I had made, rather a secondary possible cause. In some electron based apps like microsoft teams, it can help to deactivate the hardware acceleration.

Sometimes it is so bad it can trigger epileptic seizures... and thats not even on a M1 device, it's on a x86 lenovo thinkpad laptop.

But it is completely possible that a large quantity of electronics are faulty and won't be replaced with a working model / can't be fixed. It could also be possible that this issue is related to which batch you got and in which region you bought your device.

Of course: Those are the less common "individual cases"... right? By the way: I had screen related issues even when on Linux, booting from a M1 device. And they were even much more likely to show up. I suggest to get either a new apple device or start using a 'normal' x86 device.

FYI Theres also this https://www.eizoglobal.com/support/compatibility/pc/mac/apple-m1/ which is a statement regarding limitations about m1/m2 devices. But not so much related to flicker.

ibreakthecloud commented 1 year ago

happens with me too. MacBook Pro M2 Pro external monitor: LG

LordAelfric commented 1 year ago

This was happening to me when using a MacBook Pro (Apple M1 Pro, Ventura 13.4) and using a Samsung G9 Odyssey monitor in Pip mode (split screen). It would cause my other split to flash and be very distracting. It would only happen when the terminal window was visible on the Mac. You could resize the window to zero height or close it entirely and it would stop happening.

To solve this, I changed my theme from Dark Modern to Dark+.

jagibson commented 1 year ago

I think @zDEFz is right - the issue is deeper than vscode. I had it happen with Microsoft Remote Desktop (another MS product?) when connecting to a remote server that had just the right subdued colors.

zDEFz commented 1 year ago

Not a recommendation, just an observation.

I've checked on the thread I've posted before once again. There is a person claiming to have found a fix with 'technically an external GPU'

https://forums.macrumors.com/threads/m1-m2-flickering-ghosting-with-external-display-merged.2271670/post-32017012

I haven't tried it personally. It involves buying a 140 EUR adapter OWCCADPDL2HDMI https://www.amazon.de/OWC-Display-DISPLAYLINK-Thunderbolt-OWCCADPDL2HDMI/dp/B09RMVL865 and a 10 EUR HDMI Emulator.

---snip--- Pros:

Cons:

kferrone commented 1 year ago

The flicker is even worse when you are already feeling nauseous. Uggh, this about made me puke today. Just wait till someone has epilepsy and comes across this one.

zDEFz commented 1 year ago

The flicker is even worse when you are already feeling nauseous. Uggh, this about made me puke today. Just wait till someone has epilepsy and comes across this one.

Not all triggers are visual. Any type of stress can trigger epilepsy as well.

justinhernandez commented 1 year ago

Potential fix: Switch color profile to "Generic RGB Profile", it worked for my m2 laptop + external monitor [reddit]

Screenshot 2023-07-02 at 11 42 07 AM
achyutzeni commented 1 year ago

For me switching the theme Dark+ worked as a temp fix for the flickering on my BenQ 4K external monitor.

jhadida commented 1 year ago

Disabling the "True Tone" option in system preferences seemingly fixed the flickering for me. In my case it was a scroll-dependent flicker visible mainly in the status bar at the bottom of the VSCode window, as well as the accordion section titles in the sidebar.

Laptop: MBP 14in M2 Max Monitor: BenQ EW3280U (USB-C) VSCode: 1.82.2 Electron: 25.8.1 ElectronBuildId: 23779380 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Darwin arm64 22.6.0

prpetten commented 1 year ago

I was getting the flickering pretty bad with an older (2018, non-Apple Silicon) MBP

Model: MBP 15in 2.6 GHz 6-Core Intel Core i7 Monitor: AOC U2790B VSCode: 1.82.0 Version: 1.82.0 Electron: 25.8.0 ElectronBuildId: 23503258 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Darwin x64 22.6.0

UPDATE This solved my issue:

I fixed the problem by disabling automatic graphics switching on my macbook pro. The setting is located in system preferences -> battery. It worked!

https://stackoverflow.com/questions/29966747/how-can-i-disable-gpu-rendering-in-visual-studio-code

spockoyno commented 1 year ago

These two combined steps worked for me:

  1. For the monitor, set the Color Profile to Generic RGB Profile as in this suggestion
  2. Use the monitor's default resolution, rather than scaled.
lgo commented 1 year ago

I recently ran into this with a Samsung LF32TU87 monitor. While setting the Color profile did not resolve the problem, using the native resolution did. Thank you spockoyno!

tudor commented 1 year ago

The one thing that worked for me was disabling GPU rendering. Preferences: Configure Runtime Arguments, add "disable-hardware-acceleration": true

rvanxer commented 11 months ago

I was getting the flickering pretty bad with an older (2018, non-Apple Silicon) MBP

Model: MBP 15in 2.6 GHz 6-Core Intel Core i7 Monitor: AOC U2790B VSCode: 1.82.0 Version: 1.82.0 Electron: 25.8.0 ElectronBuildId: 23503258 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Darwin x64 22.6.0

UPDATE This solved my issue:

I fixed the problem by disabling automatic graphics switching on my macbook pro. The setting is located in system preferences -> battery. It worked!

https://stackoverflow.com/questions/29966747/how-can-i-disable-gpu-rendering-in-visual-studio-code

This worked for me, though scrolling seems not so smooth now. But it's much better than that flickering.

adamwdennis commented 9 months ago

This resolved it for me... With VSCode open:

  1. Open the command palette: {CMD}+{SHIFT}+P
  2. Open the configuration file: type "Preferences : Configure Runtime Arguments"
  3. Change the property "disable-color-correct-rendering" to false.
misha-antonenko commented 9 months ago

Apparently, "disable-color-correct-rendering" was removed from both Electron and VSCode in recent versions

zDEFz commented 9 months ago

To sum it up - Apple did mess something up, and it is working if it doesn't use Apples implementation?

notsoluckycharm commented 9 months ago

For me, changing the resolution ratio worked on my Dell. It didn't like the intermediary options. I had to scale it all the way until it matched a native resolution of the monitor. This makes sense to me. Apple seems to be generating resolutions based on UX, rather than hardware capability.

zDEFz commented 9 months ago

For me, changing the resolution ratio worked on my Dell. It didn't like the intermediary options. I had to scale it all the way until it matched a native resolution of the monitor.

You know, its all kind of weird. On my older macbook pro from 2016, after update to ventura/sonoma, Microsoft Teams is only usable through the Browser if NO external display is connected. Otherwise, the whole application becomes non-interactable.

panos-dimitriadis commented 9 months ago

In my case the flickering stated after the sonora update (M1 max pro laptop on a 4k asus monitor), and stopped when i disabled the hardware acceleration from Preferences : Configure Runtime Arguments

DeviousM commented 7 months ago

So, is there no solution to this except for disabling the hardware acceleration, which by itself comes at a cost of reduced performance?