diff options
Diffstat (limited to 'usr/src/uts/common/io/tem_safe.c')
-rw-r--r-- | usr/src/uts/common/io/tem_safe.c | 85 |
1 files changed, 76 insertions, 9 deletions
diff --git a/usr/src/uts/common/io/tem_safe.c b/usr/src/uts/common/io/tem_safe.c index b039a816de..a0e30ffa3f 100644 --- a/usr/src/uts/common/io/tem_safe.c +++ b/usr/src/uts/common/io/tem_safe.c @@ -151,6 +151,8 @@ static void bit_to_pix4(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color, text_color_t bg_color); static void bit_to_pix8(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color, text_color_t bg_color); +static void bit_to_pix16(struct tem_vt_state *tem, uchar_t c, + text_color_t fg_color, text_color_t bg_color); static void bit_to_pix24(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color, text_color_t bg_color); static void bit_to_pix32(struct tem_vt_state *tem, uchar_t c, @@ -1603,6 +1605,10 @@ tem_safe_pix_bit2pix(struct tem_vt_state *tem, unsigned char c, case 8: fp = bit_to_pix8; break; + case 15: + case 16: + fp = bit_to_pix16; + break; case 24: fp = bit_to_pix24; break; @@ -1682,11 +1688,20 @@ void tem_safe_pix_clear_entire_screen(struct tem_vt_state *tem, cred_t *credp, enum called_from called_from) { + struct vis_consclear cl; + text_color_t fg_color; + text_color_t bg_color; int nrows, ncols, width, height; ASSERT((MUTEX_HELD(&tems.ts_lock) && MUTEX_HELD(&tem->tvs_lock)) || called_from == CALLED_FROM_STANDALONE); + /* call driver first, if error, clear terminal area */ + tem_safe_get_color(tem, &fg_color, &bg_color, TEM_ATTR_SCREEN_REVERSE); + cl.bg_color = bg_color; + if (tems_cls_layered(&cl, credp) == 0) + return; + width = tems.ts_font.width; height = tems.ts_font.height; @@ -2012,6 +2027,8 @@ tem_safe_pix_cursor(struct tem_vt_state *tem, short action, cred_t *credp, enum called_from called_from) { struct vis_conscursor ca; + uint32_t color; + text_color_t fg, bg; ASSERT((MUTEX_HELD(&tems.ts_lock) && MUTEX_HELD(&tem->tvs_lock)) || called_from == CALLED_FROM_STANDALONE); @@ -2022,15 +2039,28 @@ tem_safe_pix_cursor(struct tem_vt_state *tem, short action, tems.ts_p_offset.x; ca.width = tems.ts_font.width; ca.height = tems.ts_font.height; - if (tems.ts_pdepth == 8 || tems.ts_pdepth == 4) { - if (tem->tvs_flags & TEM_ATTR_REVERSE) { - ca.fg_color.mono = TEM_TEXT_WHITE; - ca.bg_color.mono = TEM_TEXT_BLACK; - } else { - ca.fg_color.mono = TEM_TEXT_BLACK; - ca.bg_color.mono = TEM_TEXT_WHITE; - } - } else if (tems.ts_pdepth == 24 || tems.ts_pdepth == 32) { + + tem_safe_get_color(tem, &fg, &bg, TEM_ATTR_REVERSE); + + switch (tems.ts_pdepth) { + case 4: + case 8: + ca.fg_color.mono = fg; + ca.bg_color.mono = bg; + break; + case 15: + case 16: + color = tems.ts_color_map(fg); + ca.fg_color.sixteen[0] = (color >> 8) & 0xFF; + ca.fg_color.sixteen[1] = color & 0xFF; + color = tems.ts_color_map(bg); + ca.bg_color.sixteen[0] = (color >> 8) & 0xFF; + ca.bg_color.sixteen[1] = color & 0xFF; + break; + case 24: + case 32: +#ifdef _HAVE_TEM_FIRMWARE + /* Keeping this block to support old binary only drivers */ if (tem->tvs_flags & TEM_ATTR_REVERSE) { ca.fg_color.twentyfour[0] = TEM_TEXT_WHITE24_RED; ca.fg_color.twentyfour[1] = TEM_TEXT_WHITE24_GREEN; @@ -2048,6 +2078,17 @@ tem_safe_pix_cursor(struct tem_vt_state *tem, short action, ca.bg_color.twentyfour[1] = TEM_TEXT_WHITE24_GREEN; ca.bg_color.twentyfour[2] = TEM_TEXT_WHITE24_BLUE; } +#else + color = tems.ts_color_map(fg); + ca.fg_color.twentyfour[0] = (color >> 16) & 0xFF; + ca.fg_color.twentyfour[1] = (color >> 8) & 0xFF; + ca.fg_color.twentyfour[2] = color & 0xFF; + color = tems.ts_color_map(bg); + ca.bg_color.twentyfour[0] = (color >> 16) & 0xFF; + ca.bg_color.twentyfour[1] = (color >> 8) & 0xFF; + ca.bg_color.twentyfour[2] = color & 0xFF; + break; +#endif } ca.action = action; @@ -2079,6 +2120,22 @@ bit_to_pix8(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color, } static void +bit_to_pix16(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color4, + text_color_t bg_color4) +{ + uint16_t fg_color16, bg_color16; + uint16_t *dest; + + ASSERT(fg_color4 < 16 && bg_color4 < 16); + + fg_color16 = (uint16_t)tems.ts_color_map(fg_color4); + bg_color16 = (uint16_t)tems.ts_color_map(bg_color4); + + dest = (uint16_t *)tem->tvs_pix_data; + font_bit_to_pix16(&tems.ts_font, dest, c, fg_color16, bg_color16); +} + +static void bit_to_pix24(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color4, text_color_t bg_color4) { @@ -2087,8 +2144,13 @@ bit_to_pix24(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color4, ASSERT(fg_color4 < 16 && bg_color4 < 16); +#ifdef _HAVE_TEM_FIRMWARE fg_color32 = PIX4TO32(fg_color4); bg_color32 = PIX4TO32(bg_color4); +#else + fg_color32 = tems.ts_color_map(fg_color4); + bg_color32 = tems.ts_color_map(bg_color4); +#endif dest = (uint8_t *)tem->tvs_pix_data; font_bit_to_pix24(&tems.ts_font, dest, c, fg_color32, bg_color32); @@ -2102,8 +2164,13 @@ bit_to_pix32(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color4, ASSERT(fg_color4 < 16 && bg_color4 < 16); +#ifdef _HAVE_TEM_FIRMWARE fg_color32 = PIX4TO32(fg_color4); bg_color32 = PIX4TO32(bg_color4); +#else + fg_color32 = ((uint32_t)0xFF << 24) | tems.ts_color_map(fg_color4); + bg_color32 = ((uint32_t)0xFF << 24) | tems.ts_color_map(bg_color4); +#endif dest = (uint32_t *)tem->tvs_pix_data; font_bit_to_pix32(&tems.ts_font, dest, c, fg_color32, bg_color32); |