[metal] Reduce size of "screen of death" code

This commit is contained in:
tkchia 2022-10-06 05:04:44 +00:00
parent 01ca4af2f9
commit e8ef939274
3 changed files with 7 additions and 2 deletions

View file

@ -37,6 +37,7 @@
*/ */
#undef KLOGTTY #undef KLOGTTY
#define MAYUNROLLLOOPS unrollloops
#define COLOR TtyCanvasColor #define COLOR TtyCanvasColor
#define BPP 32 #define BPP 32

View file

@ -258,8 +258,9 @@ static void DRAWBITMAP(struct Tty *tty, size_t gy, size_t gx,
DIRTY(tty, gy, gx, gy + bm_ht, gx + bm_wid); DIRTY(tty, gy, gx, gy + bm_ht, gx + bm_wid);
} }
static unrollloops void FILLRECT(struct Tty *tty, size_t gy, size_t gx, static MAYUNROLLLOOPS void FILLRECT(struct Tty *tty, size_t gy, size_t gx,
size_t fill_ht, size_t fill_wid, COLOR bg) { size_t fill_ht, size_t fill_wid,
COLOR bg) {
size_t xs = tty->xs; size_t xs = tty->xs;
char *cplotter = tty->canvas + gy * xs + gx * sizeof(COLOR); char *cplotter = tty->canvas + gy * xs + gx * sizeof(COLOR);
size_t yleft = fill_ht, xleft; size_t yleft = fill_ht, xleft;

View file

@ -37,7 +37,10 @@
* @see libc/vga/tty-graph.inc * @see libc/vga/tty-graph.inc
*/ */
#pragma GCC optimize("s")
#define KLOGTTY #define KLOGTTY
#define MAYUNROLLLOOPS /* do not unroll loops; keep the code small! */
/* Instantiate output routines for 16-bit pixel formats. */ /* Instantiate output routines for 16-bit pixel formats. */
#define COLOR uint16_t #define COLOR uint16_t