https://bugs.kde.org/show_bug.cgi?id=497521

--- Comment #2 from Noah Davis <noaha...@gmail.com> ---
Created attachment 176695
  --> https://bugs.kde.org/attachment.cgi?id=176695&action=edit
spectacle-perf-2024-12-16-master.perfparser

There's not a lot I can do about this in the near future. I've already tried
very hard in the past to improve the performance of the freehand drawing tool.
The more screens you have, the larger the drawing area is and the longer the
total length of the line is, the slower it gets. Keeping the shadow enabled
makes it worse, though not by a massive amount.

I have attached a perfparser file in case anyone can come up with good ways to
optimize this further. You can open it in Hotspot (the perf analysis app made
by KDAB). During the recording of the perf data, I scribbled on an 1920x1080@1x
screen for 3-4 seconds with a 4k@2.5x screen to the left and a 4K@2x screen to
the right. I couldn't make the recording longer than this because of the 4000KB
file size limit on this bug tracker, but the data should still be correct.

>From what I can see, these are the biggest CPU hogs:
- qt_qimageScaleAARGBA_down_xy_sse4 (64.6%, used by some kind of QRunnable,
maybe has something to do with QImage::transformed and QImage::scaled)
- QImage::copy (17.1%, mostly used by AnnotationViewport::updatePaintNode)
- QOpenGLFunctions::glTexSubImage2D (6.61%, mostly used by
QRhiGles2::executeCommandBuffer, indirectly by QRhi::endFrame)

It should be noted that updatePaintNode doesn't use QImage's CPU intensive copy
and scaled functions for no reason. One of the things we have to be careful
about is using too much GPU memory because if you run out of GPU memory, you
just get a black screen with no indication as to why. Even now, there's no
foolproof way to prevent running out of GPU memory, AFAIK.

Right now what we do is draw on a QImage with QPainter and send all or a
potentially scaled section of the image to the scene graph, depending on the
screen and image device pixel ratios and how much would fit on the screen.
Perhaps performance improvements could be made by reworking the annotation
system to draw directly in the scene graph and later save the texture to a
QImage? It's hard to say what is right at this point without further testing.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to