From 0f7ad13c08cbd4b80ab1fe88a3aeb9424b76b0eb Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 23 May 2025 10:52:55 +0800 Subject: [PATCH] only set dirty bits for precursor-like targets This was introducing a mysterious "line" artifact on text rendering in new systems. Probably need to do some real on-device testing of this change because the automated tests won't catch a dirty bit error on the LCD. --- libs/blitstr2/src/blit.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/blitstr2/src/blit.rs b/libs/blitstr2/src/blit.rs index 0edd25eb5..aab9b86e9 100644 --- a/libs/blitstr2/src/blit.rs +++ b/libs/blitstr2/src/blit.rs @@ -111,10 +111,13 @@ pub fn xor_glyph(fb: &mut FrBuf, p: (isize, isize), gs: &GlyphSprite, xor: bool, 0xffff_ffff ^ ((pattern >> px_in_dest_low_word) & partial_mask_hi); } } + #[cfg(any(feature = "hosted", feature = "renode", feature = "precursor"))] + { + fb[(row_base as usize + WORDS_PER_LINE - 1) as usize] |= 0x1_0000; // set the dirty bit on the line + } } else { log::trace!("absolute x/y fail"); } - fb[(row_base as usize + WORDS_PER_LINE - 1) as usize] |= 0x1_0000; // set the dirty bit on the line } else { log::trace!("off the top"); } @@ -206,6 +209,10 @@ pub fn xor_glyph_large(fb: &mut FrBuf, p: (isize, isize), gs: &GlyphSprite, xor: 0xffff_ffff ^ ((src >> px_in_dest_low_word) & partial_mask_hi); } } + #[cfg(any(feature = "hosted", feature = "renode", feature = "precursor"))] + { + fb[(row_base as usize + WORDS_PER_LINE - 1) as usize] |= 0x1_0000; // set the dirty bit on the line + } } } // Advance destination offset using + instead of * to maybe save some CPU cycles @@ -307,6 +314,10 @@ pub fn xor_glyph_2x(fb: &mut FrBuf, p: (isize, isize), gs: &GlyphSprite, xor: bo 0xffff_ffff ^ ((src >> px_in_dest_low_word) & partial_mask_hi); } } + #[cfg(any(feature = "hosted", feature = "renode", feature = "precursor"))] + { + fb[(row_base as usize + WORDS_PER_LINE - 1) as usize] |= 0x1_0000; // set the dirty bit on the line + } } } // Advance destination offset using + instead of * to maybe save some CPU cycles