- 
    Task 
- 
    Resolution: Fixed
- 
     Not Evaluated Not Evaluated
- 
    None
- 
    None
- 
    None
- 
        
- 
        6f25f703f (dev)
Currently we have slower path to scroll the image:
- copy entire dirty region from front buffer to back buffer to ensure both buffers have the same content
- scroll the image within back buffer (another copy)
- begin paint (we already have a valid back buffer after scrolling - we don't copy anything in this case)
- paint new content
- end paint and flush
Optimized path to scroll the image:
- gather scrolling deltas and regions which are before begin paint
- in begin paint, prepare new back buffer, but don't copy anything that will be scrolled or painted
- finalize scroll - use the front buffer image to scroll the data to the back buffer (we haven't copied them yet, we'll copy them with applied scrolling deltas)
- paint new content
- end paint and flush
This path prevents redundant copy from front buffer to back buffer the content which will be scrolled and painted (we'll override these pixels anyway).
—
Simple benchmark application:  wlscroll.tar.gz 
 
Results on KWin 6.4, 3840x2160, 200% scale, full screen, dual channel DDR5, AMD Ryzen (fixed clock):
| Mode | Draw QPixmap | Draw gradient | 
| Scroll OFF (repaint) | ~370 FPS | ~71 FPS | 
| SCROLL ON (dev branch) | ~240 FPS | ~240 FPS | 
| SCROLL ON (optimized) | ~620 FPS | ~580 FPS | 
| SCROLL ON (XWayland) | ~3750 FPS | ~2500 FPS | 
Related task for XCB backend scrolling optimization: QTBUG-64414
| For Gerrit Dashboard: QTBUG-139231 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V | 
| 685606,1 | wayland: Fix crash in QWaylandShmBackingStore::scroll() | dev | qt/qtbase | Status: NEW | 0 | 0 | 
| 667832,6 | wayland: Optimize scroll operation | dev | qt/qtbase | Status: MERGED | +2 | +1 |