From 28b08ae63cfe79da8b31c3a50238ac5a3547370a Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Mon, 11 May 2020 11:59:01 -0500 Subject: Fix a bug introduced by the full-screen scan. You will get occasional screen glitches; you could observe this doing an 'ls; clear' pattern again and again. This was caused by the full screen optimization made in 97517317bdc3 which can cause some scan reports to be incorrectly discarded. Full disclosure: I modified Brendan's original patch to introduce this bug, so the blame is mine alone. Acked-by: Frediano Ziglio --- src/display.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/display.c b/src/display.c index e6755e6..db2033e 100644 --- a/src/display.c +++ b/src/display.c @@ -665,9 +665,18 @@ int display_scan_whole_screen(display_t *d, int num_vertical_tiles, int num_hori } } - /* We've just read the full screen; may as well use it */ - destroy_shm_image(d, d->fullscreen); - d->fullscreen = fullscreen_new; + /* Note: it is tempting to replace d->fullscreen now, but that causes + display glitches. The issue is the optimization in scanner_push. + That will cause us to discard a SCANLINE_SCAN_REPORT if there + is a whole screen SCANLINE_DAMAGE_REPORT right behind it. That logic is + reasonable, if the scan will continue to find a problem. But replacing + d->fullscreen now will cause that damage report to fail to find any + problems, and we'll have discarded a valid scan report. + You can modify scan.c to drop that optimization for DAMAGE reports, + but a naive perf analysis suggests that actually costs you. + This is partly because call to display_copy_image_into_fullscreen + in handle_scan_report() still occurs, so you haven't saved that time. */ + destroy_shm_image(d, fullscreen_new); return ret; } -- cgit v1.2.3