diff options
author | Frederic Cambus <fcambus@cvs.openbsd.org> | 2018-12-26 11:33:58 +0000 |
---|---|---|
committer | Frederic Cambus <fcambus@cvs.openbsd.org> | 2018-12-26 11:33:58 +0000 |
commit | 46d5ec45ce083977b84137b8e399a6638ee8c6c6 (patch) | |
tree | 68e6ca7b15cfc5da6412f6dbaf4630e91196e2a0 /sys/dev/rasops | |
parent | 2105097227877cb1c93b3f52c87c8f54a71f8307 (diff) |
Remove the rasops24_erasecols and rasops24_eraserows functions from
rasops(9).
We only build rasops24 functions on amd64 (for EFI support in QEMU) and
on armv7 and arm64, and we can safely use the generic functions on those
platforms, like we do for all other color depths. No other platform uses
rasops24, Miod explains why here [1].
No performance regression observed when testing with QEMU in EFI mode.
[1] https://marc.info/?l=openbsd-ppc&m=118664346819989&w=2
OK kettenis@
Diffstat (limited to 'sys/dev/rasops')
-rw-r--r-- | sys/dev/rasops/rasops24.c | 226 |
1 files changed, 1 insertions, 225 deletions
diff --git a/sys/dev/rasops/rasops24.c b/sys/dev/rasops/rasops24.c index 9022a898f22..086b5af329e 100644 --- a/sys/dev/rasops/rasops24.c +++ b/sys/dev/rasops/rasops24.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rasops24.c,v 1.10 2014/12/19 22:44:59 guenther Exp $ */ +/* $OpenBSD: rasops24.c,v 1.11 2018/12/26 11:33:57 fcambus Exp $ */ /* $NetBSD: rasops24.c,v 1.12 2000/04/12 14:22:29 pk Exp $ */ /*- @@ -39,8 +39,6 @@ #include <dev/wscons/wsconsio.h> #include <dev/rasops/rasops.h> -int rasops24_erasecols(void *, int, int, int, long); -int rasops24_eraserows(void *, int, int, long); int rasops24_putchar(void *, int, int, u_int, long attr); #ifndef RASOPS_SMALL int rasops24_putchar8(void *, int, int, u_int, long attr); @@ -101,9 +99,6 @@ rasops24_init(struct rasops_info *ri) ri->ri_bnum = 8; ri->ri_bpos = 16; } - - ri->ri_ops.erasecols = rasops24_erasecols; - ri->ri_ops.eraserows = rasops24_eraserows; } /* @@ -482,222 +477,3 @@ rasops24_putchar16(void *cookie, int row, int col, u_int uc, long attr) return 0; } #endif /* !RASOPS_SMALL */ - -/* - * Erase rows. This is nice and easy due to alignment. - */ -int -rasops24_eraserows(void *cookie, int row, int num, long attr) -{ - int n9, n3, n1, cnt, stride, delta; - u_int32_t *dp, clr, stamp[3]; - struct rasops_info *ri; - - /* - * If the color is gray, we can cheat and use the generic routines - * (which are faster, hopefully) since the r,g,b values are the same. - */ - if ((attr & 4) != 0) - return rasops_eraserows(cookie, row, num, attr); - - ri = (struct rasops_info *)cookie; - -#ifdef RASOPS_CLIPPING - if (row < 0) { - num += row; - row = 0; - } - - if ((row + num) > ri->ri_rows) - num = ri->ri_rows - row; - - if (num <= 0) - return 0; -#endif - - clr = ri->ri_devcmap[(attr >> 16) & 0xf] & 0xffffff; - stamp[0] = (clr << 8) | (clr >> 16); - stamp[1] = (clr << 16) | (clr >> 8); - stamp[2] = (clr << 24) | clr; - -#if BYTE_ORDER == LITTLE_ENDIAN - if ((ri->ri_flg & RI_BSWAP) == 0) { -#else - if ((ri->ri_flg & RI_BSWAP) != 0) { -#endif - stamp[0] = swap32(stamp[0]); - stamp[1] = swap32(stamp[1]); - stamp[2] = swap32(stamp[2]); - } - - /* - * XXX the wsdisplay_emulops interface seems a little deficient in - * that there is no way to clear the *entire* screen. We provide a - * workaround here: if the entire console area is being cleared, and - * the RI_FULLCLEAR flag is set, clear the entire display. - */ - if (num == ri->ri_rows && (ri->ri_flg & RI_FULLCLEAR) != 0) { - stride = ri->ri_stride; - num = ri->ri_height; - dp = (int32_t *)ri->ri_origbits; - delta = 0; - } else { - stride = ri->ri_emustride; - num *= ri->ri_font->fontheight; - dp = (int32_t *)(ri->ri_bits + row * ri->ri_yscale); - delta = ri->ri_delta; - } - - n9 = stride / 36; - cnt = (n9 << 5) + (n9 << 2); /* (32*n9) + (4*n9) */ - n3 = (stride - cnt) / 12; - cnt += (n3 << 3) + (n3 << 2); /* (8*n3) + (4*n3) */ - n1 = (stride - cnt) >> 2; - - while (num--) { - for (cnt = n9; cnt; cnt--) { - dp[0] = stamp[0]; - dp[1] = stamp[1]; - dp[2] = stamp[2]; - dp[3] = stamp[0]; - dp[4] = stamp[1]; - dp[5] = stamp[2]; - dp[6] = stamp[0]; - dp[7] = stamp[1]; - dp[8] = stamp[2]; - dp += 9; - } - - for (cnt = n3; cnt; cnt--) { - dp[0] = stamp[0]; - dp[1] = stamp[1]; - dp[2] = stamp[2]; - dp += 3; - } - - for (cnt = 0; cnt < n1; cnt++) - *dp++ = stamp[cnt]; - - DELTA(dp, delta, int32_t *); - } - - return 0; -} - -/* - * Erase columns. - */ -int -rasops24_erasecols(void *cookie, int row, int col, int num, long attr) -{ - int n12, n4, height, cnt, slop, clr, stamp[3]; - struct rasops_info *ri; - int32_t *dp, *rp; - u_char *dbp; - - /* - * If the color is gray, we can cheat and use the generic routines - * (which are faster, hopefully) since the r,g,b values are the same. - */ - if ((attr & 4) != 0) - return rasops_erasecols(cookie, row, col, num, attr); - - ri = (struct rasops_info *)cookie; - -#ifdef RASOPS_CLIPPING - /* Catches 'row < 0' case too */ - if ((unsigned)row >= (unsigned)ri->ri_rows) - return 0; - - if (col < 0) { - num += col; - col = 0; - } - - if ((col + num) > ri->ri_cols) - num = ri->ri_cols - col; - - if (num <= 0) - return 0; -#endif - - rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale); - num *= ri->ri_font->fontwidth; - height = ri->ri_font->fontheight; - - clr = ri->ri_devcmap[(attr >> 16) & 0xf] & 0xffffff; - stamp[0] = (clr << 8) | (clr >> 16); - stamp[1] = (clr << 16) | (clr >> 8); - stamp[2] = (clr << 24) | clr; - -#if BYTE_ORDER == LITTLE_ENDIAN - if ((ri->ri_flg & RI_BSWAP) == 0) { -#else - if ((ri->ri_flg & RI_BSWAP) != 0) { -#endif - stamp[0] = swap32(stamp[0]); - stamp[1] = swap32(stamp[1]); - stamp[2] = swap32(stamp[2]); - } - - /* - * The current byte offset mod 4 tells us the number of 24-bit pels - * we need to write for alignment to 32-bits. Once we're aligned on - * a 32-bit boundary, we're also aligned on a 4 pixel boundary, so - * the stamp does not need to be rotated. The following shows the - * layout of 4 pels in a 3 word region and illustrates this: - * - * aaab bbcc cddd - */ - slop = (long)rp & 3; num -= slop; - n12 = num / 12; num -= (n12 << 3) + (n12 << 2); - n4 = num >> 2; num &= 3; - - while (height--) { - dbp = (u_char *)rp; - DELTA(rp, ri->ri_stride, int32_t *); - - /* Align to 4 bytes */ - /* XXX handle with masks, bring under control of RI_BSWAP */ - for (cnt = slop; cnt; cnt--) { - *dbp++ = (clr >> 16); - *dbp++ = (clr >> 8); - *dbp++ = clr; - } - - dp = (int32_t *)dbp; - - /* 12 pels per loop */ - for (cnt = n12; cnt; cnt--) { - dp[0] = stamp[0]; - dp[1] = stamp[1]; - dp[2] = stamp[2]; - dp[3] = stamp[0]; - dp[4] = stamp[1]; - dp[5] = stamp[2]; - dp[6] = stamp[0]; - dp[7] = stamp[1]; - dp[8] = stamp[2]; - dp += 9; - } - - /* 4 pels per loop */ - for (cnt = n4; cnt; cnt--) { - dp[0] = stamp[0]; - dp[1] = stamp[1]; - dp[2] = stamp[2]; - dp += 3; - } - - /* Trailing slop */ - /* XXX handle with masks, bring under control of RI_BSWAP */ - dbp = (u_char *)dp; - for (cnt = num; cnt; cnt--) { - *dbp++ = (clr >> 16); - *dbp++ = (clr >> 8); - *dbp++ = clr; - } - } - - return 0; -} |