From 80d64b6b1e37fcfb0017080c010f19cd18c82f0f Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 6 Feb 2025 22:12:43 +0700 Subject: [PATCH] #4496 plan to drop non-bytes image data and only use the metadata to store the mmap chunks information --- xpra/client/gui/window_backing_base.py | 4 +++- xpra/server/window/compress.py | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xpra/client/gui/window_backing_base.py b/xpra/client/gui/window_backing_base.py index 2f6fe5c0dd..94b395e7d1 100644 --- a/xpra/client/gui/window_backing_base.py +++ b/xpra/client/gui/window_backing_base.py @@ -857,7 +857,9 @@ def paint_mmap(self, img_data, x: int, y: int, width: int, height: int, rowstrid options: typedict, callbacks: PaintCallbacks) -> None: assert self.mmap from xpra.net.mmap import mmap_read - data, free_cb = mmap_read(self.mmap.mmap, *img_data) + # newer versions use the 'chunks' option, older versions overload the 'img_data' + chunks = options.tupleget("chunks") or img_data + data, free_cb = mmap_read(self.mmap.mmap, *chunks) callbacks.append(free_cb) rgb_format = options.strget("rgb_format", "RGB") # Note: BGR(A) is only handled by gl.backing diff --git a/xpra/server/window/compress.py b/xpra/server/window/compress.py index 41a21ca116..17d917392e 100644 --- a/xpra/server/window/compress.py +++ b/xpra/server/window/compress.py @@ -204,7 +204,6 @@ def __init__(self, # mmap: self._mmap = mmap self._mmap_size = mmap_size - log.warn("mmap=%s, mmap-size=%s", self._mmap, self._mmap_size) self.init_vars() @@ -2875,8 +2874,11 @@ def mmap_encode(self, coding: str, image: ImageWrapper, _options) -> tuple: return () self.global_statistics.mmap_bytes_sent += len(data) self.global_statistics.mmap_free_size = mmap_free_size(self._mmap, self._mmap_size) - # the data we send is the index within the mmap area: + # the data we send is the index within the mmap area + # send the list of chunks as both: + # * 'chunks' metadata for newer versions + # * overloaded 'img_data' for older versions return ( - "mmap", mmap_data, {"rgb_format": pf}, + "mmap", mmap_data, {"rgb_format": pf, "chunks": mmap_data}, image.get_width(), image.get_height(), image.get_rowstride(), len(pf)*8, )