You may be able to try and see if a reset of the Power Management Unit (PMU) can help
since the reset can affect the information set in the chip, and some of that may be related
to the graphics processor...
• Resetting the iMac (Flat Panel) Power Management Unit (PMU) - Apple Support
Another reset that may affect the display and graphics is the PRAM (parameter random
access memory) reset; the instructions on how to perform that, are exactly the same as
those for NVRAM reset. So here's a link that says NVRAM that will reset the PRAM.
The other support article was depreciated and replaced some time ago with this...
• How to Reset NVRAM on your Mac - Apple Support
Also at some point the clock battery on the logic board will no longer support holding
settings of the PRAM and power management unit between power disruptions or
periods of storage. Or at some point when the battery no longer holds 3.6V. It then
would need replaced. http://eshop.macsales.com/item/NewerTech/BAA36VPRAM/
An example of the correct 1/2AA 3.6V Lithium cell is shown ^ here, at fair price.
Be sure to make and keep a suitable external backup of your work files in archive.
There may be some hardware issue, since the model is vintage/obsolete. A service
provider who could deal with these is also becoming rarer; as experienced techs
with hands-on are decreasing in number.
If you need instructions on how to access the battery replacement, or other, ask.
Good luck & happy computing! 🙂