Replace a pair of 8-bit writes to VGA memory with a single 16-bit write.
The VGA "text mode" buffer has a pair of bytes for each character: One byte for the character symbol, and an "attribute" byte encoding the foreground and background colours. When updating the screen, we were writing these two bytes separately. On some virtualized systems, every write results in a glyph being redrawn into a (graphical) virtual screen; writing these two bytes separately results in twice as much work being done to draw characters, whereas if we perform a single 16-bit write instead, the character only needs to be redrawn once. On an EC2 c5.4xlarge instance, this change cuts 1.30s from the kernel boot, speeding it up from 8.90s to 7.60s. MFC after: 1 week
This commit is contained in:
parent
95bdea60e0
commit
0b4d5eb8fd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=337411
@ -68,6 +68,8 @@ struct vga_softc {
|
||||
bus_space_read_1(sc->vga_fb_tag, sc->vga_fb_handle, ofs)
|
||||
#define MEM_WRITE1(sc, ofs, val) \
|
||||
bus_space_write_1(sc->vga_fb_tag, sc->vga_fb_handle, ofs, val)
|
||||
#define MEM_WRITE2(sc, ofs, val) \
|
||||
bus_space_write_2(sc->vga_fb_tag, sc->vga_fb_handle, ofs, val)
|
||||
#define REG_READ1(sc, reg) \
|
||||
bus_space_read_1(sc->vga_reg_tag, sc->vga_reg_handle, reg)
|
||||
#define REG_WRITE1(sc, reg, val) \
|
||||
@ -894,10 +896,8 @@ vga_bitblt_text_txtmode(struct vt_device *vd, const struct vt_window *vw,
|
||||
cons_to_vga_colors[bg] << 4 |
|
||||
cons_to_vga_colors[fg];
|
||||
|
||||
MEM_WRITE1(sc, (row * 80 + col) * 2 + 0,
|
||||
ch);
|
||||
MEM_WRITE1(sc, (row * 80 + col) * 2 + 1,
|
||||
attr);
|
||||
MEM_WRITE2(sc, (row * 80 + col) * 2 + 0,
|
||||
ch + ((uint16_t)(attr) << 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user