Screen flicker like dark window shadows
I have been seeing this issue since I upgraded to Big Sur, which might only be a coincidence. Every so often the Mac seems to freeze and the screen shows dark frames like window shadows at 100% black. They flicker and pulse in strength and while this happens the computer appears frozen. Although sometimes I can tab out to another app or the finder and it stops, sometimes I cannot tab out right away, and sometimes tabbing out does not stop it, and sometimes I can tell that whatever I clicked while the computer looked frozen was actually actioned but not when until the flickering stopped. It might last up to 15 seconds or several minutes. generally shorter. For instance I just had several minutes of this and now it seems fine. I am always running a lot of different apps so it is very hard to say if it relates to one of those or not. I have run apple diagnostic and all was fine.
Hoping someone else has seen this or might have a clue if this is more likely a hardware or software issue.
iMac 27″, macOS 11.3