Avoid unnecessary Frame Buffer updates

Frame Buffer updates are expensive, let's instead uses these CPU cycles
for testing RAM...
This commit is contained in:
01e3 2025-02-08 16:49:52 -08:00 committed by Lionel Debroux
parent 1eb65bd8bd
commit bc67b156b3

View File

@ -140,6 +140,10 @@ static int lfb_offset(int row, int col, int x, int y, int bpp)
static void lfb8_put_char(int row, int col, uint8_t ch, uint8_t attr) static void lfb8_put_char(int row, int col, uint8_t ch, uint8_t attr)
{ {
if (shadow_buffer[row][col].ch == ch &&
shadow_buffer[row][col].attr == attr)
return;
shadow_buffer[row][col].ch = ch; shadow_buffer[row][col].ch = ch;
shadow_buffer[row][col].attr = attr; shadow_buffer[row][col].attr = attr;
@ -170,6 +174,10 @@ static void lfb8_put_char(int row, int col, uint8_t ch, uint8_t attr)
static void lfb16_put_char(int row, int col, uint8_t ch, uint8_t attr) static void lfb16_put_char(int row, int col, uint8_t ch, uint8_t attr)
{ {
if (shadow_buffer[row][col].ch == ch &&
shadow_buffer[row][col].attr == attr)
return;
shadow_buffer[row][col].ch = ch; shadow_buffer[row][col].ch = ch;
shadow_buffer[row][col].attr = attr; shadow_buffer[row][col].attr = attr;
@ -200,6 +208,11 @@ static void lfb16_put_char(int row, int col, uint8_t ch, uint8_t attr)
static void lfb24_put_char(int row, int col, uint8_t ch, uint8_t attr) static void lfb24_put_char(int row, int col, uint8_t ch, uint8_t attr)
{ {
if (shadow_buffer[row][col].ch == ch &&
shadow_buffer[row][col].attr == attr)
return;
shadow_buffer[row][col].ch = ch; shadow_buffer[row][col].ch = ch;
shadow_buffer[row][col].attr = attr; shadow_buffer[row][col].attr = attr;
@ -236,6 +249,10 @@ static void lfb24_put_char(int row, int col, uint8_t ch, uint8_t attr)
static void lfb32_put_char(int row, int col, uint8_t ch, uint8_t attr) static void lfb32_put_char(int row, int col, uint8_t ch, uint8_t attr)
{ {
if (shadow_buffer[row][col].ch == ch &&
shadow_buffer[row][col].attr == attr)
return;
shadow_buffer[row][col].ch = ch; shadow_buffer[row][col].ch = ch;
shadow_buffer[row][col].attr = attr; shadow_buffer[row][col].attr = attr;