Download raw body.
rasops32: fix fonts on byte swapped framebuffers
Hello Crystal, I went back through the history of this function. The optimization using a union to write two pixels together was contributed by John Carmack in 2020: The existing implementation is already reasonably well optimized. The problem addressed by my patch is the order of those pixels when writing to a byte swapped framebuffer, as happens with Radeon on SPARC64. The patch corrects that while preserving the existing optimization. In my assessment it's the correct approach for now, it fixes the bug and keeps carmacks optimization. There are probably some good optimizations that could be implemented, especially blank characters, but this code touches so many architectures that I think it's better to just fix the bug for now so that I can actually use my terminal without feeling more blind than I actually am. Like the other patch, I recommend taking this one as is after its reviewed. Ted On Wed, Oct 7, 2026 at 9:57 AM Ted Bullock <tbullock@comlore.com> wrote: > > On Wed, Oct 7, 2026 at 8:29 AM Crystal Kolipe > <kolipe.c@exoticsilicon.com> wrote: > > > > On Wed, Oct 07, 2026 at 06:34:02AM -0600, tbullock@comlore.com wrote: > > > This patch fixes font rendering on 32 bit byte swapped framebuffers. > > > The function uses a union to write two 32 bit pixels together as one > > > 64 bit value. With sparc64's byte swapped access, that reverses the > > > positions of the two pixels. > > > > Wouldn't it be far simpler and give better performance to just create a > > pixel-swapped font variation in memory the first time this function is called > > and use that with the existing blitting code on subsequent calls? > > > > I did almost exactly that to implement italics and other font variants in > > rasops32.c. > > Honestly I have.a lot of emotional thoughts when I saw the original > union implementation in this function. > > It feels like someone was being needlessly clever and it is also > completely unsurprising that there are endian adjacent problems when > someone starts throwing unions around. > > -- > Ted Bullock <tbullock@comlore.com> -- Ted Bullock <tbullock@comlore.com>
rasops32: fix fonts on byte swapped framebuffers