xpra icon
Bug tracker and wiki

Opened 5 years ago

Closed 5 years ago

#471 closed enhancement (wontfix)

cursor improvements: send as picture, cache pixels client side

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: trivial Milestone: future
Component: core Version:
Keywords: Cc:

Description

The cursor pixel data is in pre-multiplied argb format.
We could encode it with a picture encoder which will be a lot more efficient than lz4/zlib.
Also, if the client supports the feature, we could build up a cache of cursor pixels we have sent already and avoid re-sending those again, sending the unique ID of the cursor cache instead. (the cursor cache could be limited to a fixed number of cursor serial numbers to prevent growing too much).

Since cursor changes are fairly rare, the bandwidth savings would be very small - so this is a very low priority ticket.

Attachments (2)

png-cursors.patch (6.1 KB) - added by Antoine Martin 5 years ago.
adds ability to send cursors compressed with png if client supports it
png-cursors.2.patch (6.3 KB) - added by Antoine Martin 5 years ago.
adds ability to send cursors compressed with png if client supports it - records compression timing

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by Antoine Martin

Attachment: png-cursors.patch added

adds ability to send cursors compressed with png if client supports it

comment:1 Changed 5 years ago by Antoine Martin

Owner: changed from Antoine Martin to Antoine Martin
Status: newassigned

As the lz4 compression tests were very interesting (see r4925 and ticket:443#comment:4), I thought I would try to compare png and lz4 compression for cursors.
Using the png-cursors.patch, and starting an xterm then the "test custom cursor" test script, I found:

  • using png encoder:
    serial=2, pixels=<type 'str'>=9216
    sent cursor as png: 745 bytes
    cursor compression took: 2.1439ms
    
    serial=10, pixels=<type 'str'>=16384
    sent cursor as png: 346 bytes
    cursor compression took: 2.4788ms
    
  • with lz4:
    serial=2, pixels=<type 'str'>=9216
    sent cursor as: LevelCompressed(cursor: 549 bytes as zlib/5)
    cursor compression took: 1.0080ms
    
    serial=10, pixels=<type 'str'>=16384
    sent cursor as: LevelCompressed(cursor: 177 bytes as zlib/5)
    cursor compression took: 0.9391ms
    

So lz4 compresses a lot better than png, and takes half the time to do it!
That is just incredibly efficient. This patch will not be merged, and lz4 is likely to be used in places where we currently prefer png (after further tests).


Caching cursors could still be a win, so I am keeping this ticket opened.

Changed 5 years ago by Antoine Martin

Attachment: png-cursors.2.patch added

adds ability to send cursors compressed with png if client supports it - records compression timing

comment:2 Changed 5 years ago by Antoine Martin

Resolution: wontfix
Status: assignedclosed

Recent changes have brought more generic support for compression, including lz4 compression of cursors.

Compressed cursors are already so small that I don't see any point in complicating things with cursor caching.

Note: See TracTickets for help on using tickets.