TigerVNC / tigervnc

High performance, multi-platform VNC client and server
https://tigervnc.org
GNU General Public License v2.0
4.91k stars 912 forks source link

MacOS - vncviewer: High CPU load due to writing the image to the screen #372

Closed fredowski closed 7 years ago

fredowski commented 7 years ago

Hi,

i looked at XCode Instruments to see where the CPU cycles are consumed in the vncviewer process. I wanted to check if I can see a difference in the jpeg vs. jpeg-turbo build. I see roughly 20% of the load going to jpeg decoding, while 80% is spend more or less in writing the image to the screen. So on Mac the jpeg decoding seems to be a minor problem compared to image writing. I run this on a MacBook Pro with HighResolution Display - so maybe something is converted there...

Here is a screenshot showing the Main Thread vs. one of the worker threads with jpeg decoding: inst-overview

Here is the first part of the main thread:

inst1

and here is the remaining part.

inst2

60% of the total CPU power for vncviewer is spend in the OS routine: argb32_image_mark_RGB24.

Googling seems to show more problems with this: http://stackoverflow.com/questions/21665473/coregraphics-argb32-image-mark-rgb24-is-slow

Friedrich

CendioOssman commented 7 years ago

Yes, I'm afraid this is a somewhat known issue. Unfortunately none of the suggested fixes we've found so far have worked.

CendioOssman commented 7 years ago

It also happens on all Macs, not just high resolution displays.

CendioOssman commented 7 years ago

This should be fixed in 41a0c151c554a37fbffece8ef36848ed47fd17d3.