Skip to content

Use texture unpacking for QImage uploads when possible

Manuel Stoeckl requested to merge mstoeckl/kwin:unpack-when-possible into master

This change avoids unnecessary QImage copies when using formats other than WL_SHM_FORMAT_ARGB8888. I ended up reorganizing the entire GLTexture::update function, to avoid needing to write almost the same lines of code on the GL and GLES branches, and to make the condition for when to unpack simpler.

Programs this can be tested with:

  • Running OpenGL programs with environment variable LIBGL_ALWAYS_SOFTWARE=1 often sends XRGB8888. These usually damage the full surface and thus don't use unpacking in GLTexture::update
  • I have a modified version of weston-simple-shm at https://gitlab.freedesktop.org/mstoeckl/weston/-/tree/simple-shm-10 , which can submit various (XRGB2101010, XRGB8888, ARGB8888, etc.) wl_shm formats. After the first frame, it damages the central rectangle of the frame, so when supported GLTexture::update would use unpacking.
Edited by Manuel Stoeckl

Merge request reports