Loading textures noticably blocks rendering
This issue is mostly about addressing loupe#217
Switching between images with large dimensions has a noticeable hang if the texture hasn't been shown before. Apparently, it is more noticeable on older/slower hardware.
After being close to a meltdown about sysprof not giving me what I wanted, I at least found this:
This is for switching to a 20000 × 13334 px texture that has already been available as a GdkMemoryTexture. So practically a more than one-second block of the UI.
My idea was that those textures should maybe be asynchronously uploaded after the GdkMemoryTexture is created. With my naivete I thought that was simple since with a shared context, it could just be a different thread uploading the texture. But it sounded like things are more complicated than that.
A somewhat related question would be if using an dmabuf could (at least) speed up the texture upload.
There has been a question as to why the upload is not instant on my system since I'm using an integrated CPU (i5-11600K). I think that's worth investigating if it's possible to save a copy here. But since dedicated GPUs exist, I think we have to solve the upload problem anyways.