Download raw body.
rasops32: fix fonts on byte swapped framebuffers
Indeed, the bug fix did grow beyond strictly handling the byte swap.
The other changes were intended to keep the pixel processing correct
when the framebuffer was aligned to four bytes rather than eight, or
when the row stride was not a multiple of eight bytes. Those are
separate correctness issues.
And yes, the comment wasn't really accurate. The existing fallback
already writes individual pixels.
Included below is the byte swap fix on its own. I've built and tested
it, and it works for me. The framebuffer capture matches the result
from the larger patch exactly.
The preprocessing suggestion is interesting, along with some other
possible performance changes. I think those are worth exploring
separately.
diff /usr/src
path + /usr/src
commit - 9a41316fee4f8507967e487ca8ed12429c06d449
blob - ec189be00b1232e0e25f7db1ee2c4416b74b82ce
file + sys/dev/rasops/rasops32.c
--- sys/dev/rasops/rasops32.c
+++ sys/dev/rasops/rasops32.c
@@ -111,6 +111,14 @@ rasops32_putchar(void *cookie, int row, int col, u_int
fs = ri->ri_font->stride;
/* double-pixel special cases for the common widths */
+ /*
+ * Reverse each mixed pair to keep the correct pixel order
+ * when writing two pixels to a byte swapped framebuffer.
+ */
+ if (ri->ri_flg & RI_BSWAP) {
+ u.d[1][0] = f; u.d[1][1] = b;
+ u.d[2][0] = b; u.d[2][1] = f;
+ }
switch (width) {
case 6:
while (height--) {
rasops32: fix fonts on byte swapped framebuffers