fix(kvm): exclude the BGRX pad byte from tile change-detection #126
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/VA-127-tile-hash-skip-bgrx-pad-byte"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes the badly-flickering remote desktop on hosts whose X11 driver returns a nondeterministic BGRX pad byte (observed on ds-08: an Intel/glamor Xorg LightDM greeter). The tile change-detector hashed the unused 4th byte of every BGRX pixel, which the JPEG encoder never ships, so a static screen re-shipped all 510 tiles every frame and the browser repainted the whole canvas ~30x/sec.
Tracked in VA-127, which is required for VAPP-77.
Root cause (proven on ds-08 by elimination)
import -window root(plainXGetImage) grabs showed exactly two distinct images differing by 73 pixels (the greeter clock indicator blinking). The visible screen is static except that one ~1-tile element.Hosts whose driver returns a constant pad byte never flickered, which is why this reproduced only on some hosts. The tile-diff core was otherwise correct (its existing tests use
Rgb, which has no pad byte).Fix
hash_tilenow takes thePixelLayoutand hashes only the color bytes per pixel (the first 3), skipping the BGRX pad byte via a newPixelLayout::color_bytes(). This matches exactly whatencode_tile_to_jpegships, so "changed" tracks what the viewer sees. ForRgb(Wayland/grim, 3 bpp) the hashed bytes are identical in value and order to before, so that path is byte-for-byte unchanged.Tests
bgrx_pad_byte_noise_ships_zero_tiles: a BGRX frame with identical R,G,B but every pad byte flipped between two frames ships zero tiles (fails before this change, passes after).hash_is_stable_for_identical_bytesextended to assert a pad-byte flip does not change the tile hash while a color-byte flip does.hash_distinguishes_rgb_and_bgrx_layouts_consistentlyupdated off the oldbppsignature and made to actually hash both layouts.just pre-commit(fmt + clippy-D warnings+ full workspace tests) green.