Xpra-org / xpra-html5

HTML5 client for Xpra
Mozilla Public License 2.0
209 stars 55 forks source link

LibreOffice Calc blurry using HTML5 client and Ubuntu Jammy server #286

Closed jeffmax closed 7 months ago

jeffmax commented 7 months ago

I have been trying to run LibreOffice Calc using Xpra. When the application first starts things look good. As I continue to use it for a few seconds the areas in the sheet around where I am typing become blurry for a while, and then it eventually resolves. Scrolling will sometimes leave the whole screen blurry for a while. I've tried a number of settings and did notice that forcing it to use the webp encoding worked (although updates to typing in a cell became slow as if it wasn't detecting the change on screen). Reading through issues I thought that it might have to do with deskstop-scaling so I set that to off and 1 (I was not sure which was correct), but that did not fix the issue (it does seem to take a bit longer to happen though).

I started to suspect that I might not have all the encodings/codecs available to Xpra. I did follow the specific instructions for installing the server on Jammy. I am using xpra v5.0.5-r1 with the bundled HTML5 client in Chrome 121.0.6167.160 on OS X.

This is the output of xpra encoding

some GStreamer elements are missing or unavailable on this system:
 vaapih264enc, vaapih265enc, amfh264enc, amfh265enc
Error querying drm devices: -2
modules found:
* csc_cython           : No module named 'xpra.codecs.csc_cython'
* csc_libyuv           : No module named 'xpra.codecs.libyuv'
* csc_swscale          : /usr/lib/python3/dist-packages/xpra/codecs/ffmpeg/colorspace_converter.cpython-310-x86_64-linux-gnu.so
* dec_avcodec2         : /usr/lib/python3/dist-packages/xpra/codecs/ffmpeg/decoder.cpython-310-x86_64-linux-gnu.so
* dec_avif             : /usr/lib/python3/dist-packages/xpra/codecs/avif/decoder.cpython-310-x86_64-linux-gnu.so
* dec_gstreamer        : /usr/lib/python3/dist-packages/xpra/codecs/gstreamer/decoder.py
* dec_jpeg             : /usr/lib/python3/dist-packages/xpra/codecs/jpeg/decoder.cpython-310-x86_64-linux-gnu.so
* dec_nvjpeg           : No module named 'xpra.codecs.nvidia'
* dec_openh264         : No module named 'xpra.codecs.openh264'
* dec_pillow           : /usr/lib/python3/dist-packages/xpra/codecs/pillow/decoder.py
* dec_spng             : No module named 'xpra.codecs.spng'
* dec_vpx              : /usr/lib/python3/dist-packages/xpra/codecs/vpx/decoder.cpython-310-x86_64-linux-gnu.so
* dec_webp             : /usr/lib/python3/dist-packages/xpra/codecs/webp/decoder.cpython-310-x86_64-linux-gnu.so
* drm                  : /usr/lib/python3/dist-packages/xpra/codecs/drm/drm.cpython-310-x86_64-linux-gnu.so
* enc_avif             : /usr/lib/python3/dist-packages/xpra/codecs/avif/encoder.cpython-310-x86_64-linux-gnu.so
* enc_ffmpeg           : /usr/lib/python3/dist-packages/xpra/codecs/ffmpeg/encoder.cpython-310-x86_64-linux-gnu.so
* enc_gstreamer        : /usr/lib/python3/dist-packages/xpra/codecs/gstreamer/encoder.py
* enc_jpeg             : /usr/lib/python3/dist-packages/xpra/codecs/jpeg/encoder.cpython-310-x86_64-linux-gnu.so
* enc_nvjpeg           : No module named 'xpra.codecs.nvidia'
* enc_openh264         : No module named 'xpra.codecs.openh264'
* enc_pillow           : /usr/lib/python3/dist-packages/xpra/codecs/pillow/encoder.py
* enc_rgb              : /usr/lib/python3/dist-packages/xpra/codecs/argb/encoder.py
* enc_spng             : No module named 'xpra.codecs.spng'
* enc_vpx              : /usr/lib/python3/dist-packages/xpra/codecs/vpx/encoder.cpython-310-x86_64-linux-gnu.so
* enc_webp             : /usr/lib/python3/dist-packages/xpra/codecs/webp/encoder.cpython-310-x86_64-linux-gnu.so
* enc_x264             : /usr/lib/python3/dist-packages/xpra/codecs/x264/encoder.cpython-310-x86_64-linux-gnu.so
* evdi                 : No module named 'xpra.codecs.evdi'
* nvdec                : No module named 'xpra.codecs.nvidia'
* nvenc                : No module named 'xpra.codecs.nvidia'
* nvfbc                : No module named 'xpra.codecs.nvidia'
* v4l2                 : /usr/lib/python3/dist-packages/xpra/codecs/v4l2/pusher.cpython-310-x86_64-linux-gnu.so

codecs versions:
* avcodec2                        : 58.134.100
* avif                            : 0.9.3
* drm                             : 4.4
* ffmpeg                          : 58.134.100
* gstreamer                       : 5.0
* jpeg                            : 1.0
* pillow                          : 9.0.1
* rgb                             : 4.3
* swscale                         : 5.9.100
* v4l2                            : 1.0
* vpx                             : 1.11.0
* webp                            : 1.2.2
* x264                            : 163

I also noticed that when I connect manually via the client the offscreen decoding checkbox was greyed/disabled for me.

This is the latest set of flags I have tried while starting, but I have been iterating over many options with no luck aside from setting --encodings=webp.

/usr/bin/xpra start :1 --html=on --mdns=no --notifications=yes --exit-with-children --speaker=off --av-sync=no --file-transfer=no --idle-timeout=1800 --socket-dir=/run/user/1000/xpra --use-display=no --daemon=no --tray=no --desktop-scaling=1 --mousewheel=on --start-child='libreoffice --calc'

I tried the same thing on Debian Bookworm, the problem was the same.

Appreciate any advice anyone may have. Thanks!

totaam commented 7 months ago

Please provide the log samples corresponding to the problematic screen updates using the -d compress command line debug option.

jeffmax commented 7 months ago

I removed the --desktop-scaling flag when I ran this. It starts out fine, I am using the first sheet for a few seconds, the whole screen goes fuzzy/blurry, then the portion of the upper left sheet I am typing in becomes clear and the rest is fuzzy, and then finally at the end, the whole thing comes back into focus. Log attached. libreoffice-calc-html5-log.txt

totaam commented 7 months ago

Thanks for the logs. The application is correctly detected as text, so there should not be any lossy screen updates. But I do see some downscaled jpeg screen updates in there (everything else is lossless):

$ grep  "scaled_size"  libreoffice-calc-html5-log.txt 
│ 2024-02-14 14:18:38,855 compress:  10.8ms for 2046x1050 pixels at    0,0    for wid=4     using      jpeg with ratio   1.2%  ( 8392KB to    97KB), sequence   366, client_options={'csc-type': 'swscale', 'scaled_size': (1022, 524), 'encoder': 'jpeg', 'flush': 0}, options={'quality': 75, 'speed': 55, 'rgb_formats': ('RGBX', 'RGBA', 'RGB'), 'lz4': True, 'content-type': 'text', 'av-delay': 0, 'cuda-device-context': None}                   │
│ 2024-02-14 14:18:42,342 compress:   9.2ms for 2046x1050 pixels at    0,0    for wid=4     using      jpeg with ratio   2.3%  ( 8392KB to   192KB), sequence   391, client_options={'csc-type': 'swscale', 'scaled_size': (1022, 524), 'encoder': 'jpeg', 'flush': 0}, options={'quality': 100, 'speed': 55, 'rgb_formats': ('RGBX', 'RGBA', 'RGB'), 'lz4': True, 'content-type': 'text', 'av-delay': 0, 'cuda-device-context': None}                  │
│ 2024-02-14 14:18:44,490 compress:   9.6ms for 2046x1050 pixels at    0,0    for wid=4     using      jpeg with ratio   2.3%  ( 8392KB to   192KB), sequence   418, client_options={'csc-type': 'swscale', 'scaled_size': (1022, 524), 'encoder': 'jpeg', 'flush': 0}, options={'quality': 100, 'speed': 55, 'rgb_formats': ('RGBX', 'RGBA', 'RGB'), 'lz4': True, 'content-type': 'text', 'av-delay': 0, 'cuda-device-context': None}                  │
│ 2024-02-14 14:18:45,308 compress:   9.0ms for 2046x1050 pixels at    0,0    for wid=4     using      jpeg with ratio   1.1%  ( 8392KB to    91KB), sequence   443, client_options={'csc-type': 'swscale', 'scaled_size': (1022, 524), 'encoder': 'jpeg', 'flush': 0}, options={'quality': 70, 'speed': 58, 'rgb_formats': ('RGBX', 'RGBA', 'RGB'), 'lz4': True, 'content-type': 'text', 'av-delay': 0, 'cuda-device-context': None}

I believe that this issue is already fixed in https://github.com/Xpra-org/xpra/commit/fc89e36c0b11bb9cc5cb7a28706787e66ee911fb and will be included in v5.0.6 @jeffmax Please try the latest beta builds or apply this change by hand.

jeffmax commented 7 months ago

@totaam That completely fixed it, thank you! I came very close to trying the beta yesterday before posting this, but did not.