coreboot-kgpe-d16/payloads/libpayload/drivers
Yu-Ping Wu 541f2f74a3 libpayload: cbgfx: Fix 'equals' counter for Lanczos resampling
The current initialization of the 'equals' counter is incorrect, so that
when 'equals >= SSZ * SSZ', the pixels in the sample array might not be
all the same, leading to a wrong pixel value being set in the
framebuffer.

The 'equals' counter stores the number of latest pixels that were
exactly equal. Within the for loop of 'ox', the sample array is updated
in a column-based order, and the 'equals' counter is updated
accordingly. However, the 'equals' counter is initialized in a row-based
order, which causes it to be set too large than it should be. Consider
the example where sample[sx][sy] are initially:

 [X X X A A A]  // sy = 0
 [X X X B B B]
 [X X X B B B]
 [X X X B B B]
 [X X X B B B]
 [X X X B B B]  // sy = SSZ

Then, the correct implementation will initialize 'equals' to be 15, with
last_equal being B. Suppose all of the remaining pixels are B. Then, at
the end of the 'while (fpfloor(ixfp) > ix)' loop when ix = 4, or
equivalently after 4 more columns of sample are updated, 'equals' will
be 15 + 6 * 4 = 39, which is greater than SSZ * SSZ = 36, but we can see
there are still 2 A's in the sample:

 [B B B B A A]
 [B B B B B B]
 [B B B B B B]
 [B B B B B B]
 [B B B B B B]
 [B B B B B B]

Therefore, we must also initialize the 'equals' counter in a
column-based order.

BUG=b:167739127
TEST=emerge-puff libpayload
TEST=Character 'k' is rendered correctly on puff
BRANCH=zork

Change-Id: Ibc91ad1af85adcf093eff40797cd54f32f57111d
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45235
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2020-09-18 01:35:35 +00:00
..
i8042 treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
serial libpayload: Cache physical location of serial-console struct 2020-08-24 09:13:09 +00:00
storage treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
timer treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
udc treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
usb libpayload/xhci: Fix Slot State field width definition 2020-09-04 19:13:31 +00:00
video libpayload: cbgfx: Fix 'equals' counter for Lanczos resampling 2020-09-18 01:35:35 +00:00
Makefile.inc treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
cbmem_console.c libpayload: Cache physical cbmem console address 2020-08-24 09:12:47 +00:00
hid.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
mouse_cursor.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
nvram.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
options.c libpayload: Cache physical CMOS option table location 2020-08-24 09:12:56 +00:00
pci.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
speaker.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00