Closed totaam closed 4 months ago
With the latest test, we report the performance of each call to make_image_surface
.
Unsuprisingly, the zero-copy options are way faster:
RGBA to cairo.ARGB32 : 162 MPixels/s
RGBX to cairo.ARGB32 : 156 MPixels/s
BGRA to cairo.ARGB32 : 4543 MPixels/s
BGRX to cairo.ARGB32 : 179 MPixels/s
RGB to cairo.ARGB32 : 170 MPixels/s
BGR to cairo.ARGB32 : 152 MPixels/s
RGBA to cairo.RGB24 : 192 MPixels/s
RGBX to cairo.RGB24 : 193 MPixels/s
BGRA to cairo.RGB24 : 4529 MPixels/s
BGRX to cairo.RGB24 : 4535 MPixels/s
RGB to cairo.RGB24 : 192 MPixels/s
BGR to cairo.RGB24 : 171 MPixels/s
So we should really make sure that the cairo backend tells the decoder modules to provide BGRA
or BGRX
, not RGB
or BGR
even if they take up less space..
(the OpenGL backend doesn't care - the pixel upload functions support every format)
Changing the decoders to prefer BGRX
/ BGRA
:
avif
already OK: https://github.com/Xpra-org/xpra/blob/e2142ad41cd8bdae3ed442c571f2c561e6bebd9f/xpra/codecs/avif/decoder.pyx#L144spng
only supports RGBA
/ RGBX
(wrong byte order), we normally prefer webp
anyway: https://github.com/Xpra-org/xpra/blob/e2142ad41cd8bdae3ed442c571f2c561e6bebd9f/xpra/server/window/compress.py#L1145webp
: 398e51063db16e0f3088e64a399a36568542d818jpeg
: e2142ad41cd8bdae3ed442c571f2c561e6bebd9f
We can use ImageSurface.create_for_data if the pixel data stride satisfies stride_for_width Another undocumented constraint is that the memory must not be read-only..