static void vcons_cursor(void *cookie, int on, int row, int col) { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; #if defined(VCONS_DRAW_INTR) if (scr->scr_vd->use_intr) { vcons_lock(scr); if (scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) { scr->scr_ri.ri_crow = row; scr->scr_ri.ri_ccol = col; atomic_inc_uint(&scr->scr_dirty); } vcons_unlock(scr); return; } #endif vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { scr->scr_vd->cursor(cookie, on, row, col); } else { scr->scr_ri.ri_crow = row; scr->scr_ri.ri_ccol = col; } vcons_unlock(scr); }
void vcons_update_screen(struct vcons_screen *scr) { uint32_t *charptr = scr->scr_chars; long *attrptr = scr->scr_attrs; struct rasops_info *ri = &scr->scr_ri; struct vcons_data *vd = scr->scr_vd; int i, j, offset, boffset = 0; vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { /* redraw the screen */ #ifdef WSDISPLAY_SCROLLSUPPORT offset = scr->scr_current_offset; #else offset = 0; #endif /* * we mark the character cell occupied by the cursor as dirty * so we don't have to deal with it * notice that this isn't necessarily the position where rasops * thinks it is, just where we drew it the last time */ if (vd->cursor_offset >= 0) vd->attrs[vd->cursor_offset] = 0xffffffff; for (i = 0; i < ri->ri_rows; i++) { for (j = 0; j < ri->ri_cols; j++) { /* * no need to use the wrapper function - we * don't change any characters or attributes * and we already made sure the screen we're * working on is visible */ if ((vd->chars[boffset] != charptr[offset]) || (vd->attrs[boffset] != attrptr[offset])) { vd->putchar(ri, i, j, charptr[offset], attrptr[offset]); vd->chars[boffset] = charptr[offset]; vd->attrs[boffset] = attrptr[offset]; } offset++; boffset++; } } ri->ri_flg &= ~RI_CURSOR; scr->scr_vd->cursor(ri, 1, ri->ri_crow, ri->ri_ccol); vd->cursor_offset = ri->ri_crow * ri->ri_cols + ri->ri_ccol; } vcons_unlock(scr); }
static void vcons_putchar(void *cookie, int row, int col, u_int c, long attr) { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; vcons_putchar_buffer(cookie, row, col, c, attr); vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { scr->scr_vd->putchar(cookie, row, col, c, attr); } vcons_unlock(scr); }
static void vcons_eraserows(void *cookie, int row, int nrows, long fillattr) { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; vcons_eraserows_buffer(cookie, row, nrows, fillattr); vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { scr->scr_vd->eraserows(cookie, row, nrows, fillattr); } vcons_unlock(scr); }
static void vcons_copyrows(void *cookie, int srcrow, int dstrow, int nrows) { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; vcons_copyrows_buffer(cookie, srcrow, dstrow, nrows); vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { scr->scr_vd->copyrows(cookie, srcrow, dstrow, nrows); } vcons_unlock(scr); }
static void vcons_cursor(void *cookie, int on, int row, int col) { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { scr->scr_vd->cursor(cookie, on, row, col); } else { scr->scr_ri.ri_crow = row; scr->scr_ri.ri_ccol = col; } vcons_unlock(scr); }
void vcons_redraw_screen(struct vcons_screen *scr) { uint16_t *charptr = scr->scr_chars; long *attrptr = scr->scr_attrs; struct rasops_info *ri = &scr->scr_ri; int i, j, offset; vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { /* * only clear the screen when RI_FULLCLEAR is set since we're * going to overwrite every single character cell anyway */ if (ri->ri_flg & RI_FULLCLEAR) { scr->scr_vd->eraserows(ri, 0, ri->ri_rows, scr->scr_defattr); } /* redraw the screen */ #ifdef WSDISPLAY_SCROLLSUPPORT offset = scr->scr_current_offset; #else offset = 0; #endif for (i = 0; i < ri->ri_rows; i++) { for (j = 0; j < ri->ri_cols; j++) { /* * no need to use the wrapper function - we * don't change any characters or attributes * and we already made sure the screen we're * working on is visible */ scr->scr_vd->putchar(ri, i, j, charptr[offset], attrptr[offset]); offset++; } } ri->ri_flg &= ~RI_CURSOR; scr->scr_vd->cursor(ri, 1, ri->ri_crow, ri->ri_ccol); } vcons_unlock(scr); }
static void vcons_eraserows(void *cookie, int row, int nrows, long fillattr) { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; vcons_eraserows_buffer(cookie, row, nrows, fillattr); #if defined(VCONS_DRAW_INTR) if (scr->scr_vd->use_intr) return; #endif vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { scr->scr_vd->eraserows(cookie, row, nrows, fillattr); } vcons_unlock(scr); }
static void vcons_copycols(void *cookie, int row, int srccol, int dstcol, int ncols) { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; vcons_copycols_buffer(cookie, row, srccol, dstcol, ncols); #if defined(VCONS_DRAW_INTR) if (scr->scr_vd->use_intr) return; #endif vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { scr->scr_vd->copycols(cookie, row, srccol, dstcol, ncols); } vcons_unlock(scr); }
static void vcons_copyrows_noread(void *cookie, int srcrow, int dstrow, int nrows) { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; struct vcons_data *vd = scr->scr_vd; vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { int pos, l, c, offset, ppos; #ifdef WSDISPLAY_SCROLLSUPPORT offset = scr->scr_current_offset; #else offset = 0; #endif ppos = ri->ri_cols * dstrow; pos = ppos + offset; for (l = dstrow; l < (dstrow + nrows); l++) { for (c = 0; c < ri->ri_cols; c++) { #ifdef VCONS_DRAW_INTR if ((scr->scr_chars[pos] != vd->chars[ppos]) || (scr->scr_attrs[pos] != vd->attrs[ppos])) { vd->putchar(cookie, l, c, scr->scr_chars[pos], scr->scr_attrs[pos]); vd->chars[ppos] = scr->scr_chars[pos]; vd->attrs[ppos] = scr->scr_attrs[pos]; } #else vd->putchar(cookie, l, c, scr->scr_chars[pos], scr->scr_attrs[pos]); #endif pos++; ppos++; } } } vcons_unlock(scr); }
static void vcons_copyrows(void *cookie, int srcrow, int dstrow, int nrows) { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; vcons_copyrows_buffer(cookie, srcrow, dstrow, nrows); #if defined(VCONS_DRAW_INTR) if (scr->scr_vd->use_intr) return; #endif vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { scr->scr_vd->copyrows(cookie, srcrow, dstrow, nrows); #if defined(VCONS_DRAW_INTR) vcons_invalidate_cache(scr->scr_vd); #endif } vcons_unlock(scr); }
static void vcons_putchar(void *cookie, int row, int col, u_int c, long attr) { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; vcons_putchar_buffer(cookie, row, col, c, attr); #if defined(VCONS_DRAW_INTR) if (scr->scr_vd->use_intr) return; #endif vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { #ifdef VCONS_DRAW_INTR vcons_putchar_cached(cookie, row, col, c, attr); #else scr->scr_vd->putchar(cookie, row, col, c, attr); #endif } vcons_unlock(scr); }
void vcons_redraw_screen(struct vcons_screen *scr) { uint32_t *charptr = scr->scr_chars, c; long *attrptr = scr->scr_attrs, a, last_a = 0, mask, cmp, acmp; struct rasops_info *ri = &scr->scr_ri; struct vcons_data *vd = scr->scr_vd; int i, j, offset, boffset = 0, start = -1; mask = 0x00ff00ff; /* background and flags */ cmp = -1; /* never match anything */ vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { /* * only clear the screen when RI_FULLCLEAR is set since we're * going to overwrite every single character cell anyway */ if (ri->ri_flg & RI_FULLCLEAR) { vd->eraserows(ri, 0, ri->ri_rows, scr->scr_defattr); cmp = scr->scr_defattr & mask; } /* redraw the screen */ #ifdef WSDISPLAY_SCROLLSUPPORT offset = scr->scr_current_offset; #else offset = 0; #endif for (i = 0; i < ri->ri_rows; i++) { start = -1; for (j = 0; j < ri->ri_cols; j++) { /* * no need to use the wrapper function - we * don't change any characters or attributes * and we already made sure the screen we're * working on is visible */ c = charptr[offset]; a = attrptr[offset]; acmp = a & mask; if (c == ' ') { /* * if we already erased the background * and this blank uses the same colour * and flags we don't need to do * anything here */ if (acmp == cmp) goto next; /* * see if we can optimize things a * little bit by drawing stretches of * blanks using erasecols */ if (start == -1) { start = j; last_a = acmp; } else if (acmp != last_a) { /* * different attr, need to * flush */ vd->erasecols(ri, i, start, j - start, last_a); start = -1; } } else { if (start != -1) { vd->erasecols(ri, i, start, j - start, last_a); start = -1; } vd->putchar(ri, i, j, c, a); } next: #ifdef VCONS_DRAW_INTR vd->chars[boffset] = charptr[offset]; vd->attrs[boffset] = attrptr[offset]; #endif offset++; boffset++; } /* end of the line - draw all defered blanks, if any */ if (start != -1) { vd->erasecols(ri, i, start, j - start, last_a); } } ri->ri_flg &= ~RI_CURSOR; scr->scr_vd->cursor(ri, 1, ri->ri_crow, ri->ri_ccol); #ifdef VCONS_DRAW_INTR vd->cursor_offset = ri->ri_crow * ri->ri_cols + ri->ri_ccol; #endif } vcons_unlock(scr); }