Home | History | Annotate | Download | only in wscons

Lines Matching refs:scr

165 vcons_use_intr(const struct vcons_screen *scr)
168 return scr->scr_vd->private->use_intr;
175 vcons_dirty(struct vcons_screen *scr)
179 atomic_inc_uint(&scr->scr_dirty);
268 vcons_lock(struct vcons_screen *scr)
275 SCREEN_BUSY(scr);
282 vcons_unlock(struct vcons_screen *scr)
289 SCREEN_IDLE(scr);
297 struct vcons_screen *scr, int exists,
311 vcons_alloc_buffers(struct vcons_data *vd, struct vcons_screen *scr)
313 struct rasops_info *ri = &scr->scr_ri;
326 scr->scr_lines_in_buffer = WSDISPLAY_SCROLLBACK_LINES;
327 scr->scr_current_line = 0;
328 scr->scr_line_wanted = 0;
329 scr->scr_offset_to_zero = ri->ri_cols * WSDISPLAY_SCROLLBACK_LINES;
330 scr->scr_current_offset = scr->scr_offset_to_zero;
334 scr->scr_attrs = malloc(cnt * (sizeof(long) +
336 if (scr->scr_attrs == NULL)
339 scr->scr_chars = (uint32_t *)&scr->scr_attrs[cnt];
350 scr->scr_attrs[i] = scr->scr_defattr;
351 scr->scr_chars[i] = 0x20;
367 } else if (SCREEN_IS_VISIBLE(scr))
374 vcons_init_screen(struct vcons_data *vd, struct vcons_screen *scr,
378 struct rasops_info *ri = &scr->scr_ri;
381 scr->scr_cookie = vd->cookie;
382 scr->scr_vd = scr->scr_origvd = vd;
383 scr->scr_busy = 0;
385 if (scr->scr_type == NULL)
386 scr->scr_type = vdp->defaulttype;
392 vd->init_screen(vd->cookie, scr, existing, defattr);
400 scr->putchar = ri->ri_ops.putchar;
402 if (scr->scr_flags & VCONS_NO_COPYCOLS) {
408 if (scr->scr_flags & VCONS_NO_COPYROWS) {
414 if (scr->scr_flags & VCONS_NO_CURSOR) {
428 ri->ri_hw = scr;
435 scr->scr_defattr = 0;
437 scr->scr_defattr = *defattr;
439 vcons_alloc_buffers(vd, scr);
442 vd->active = scr;
443 SCREEN_VISIBLE(scr);
447 SCREEN_VISIBLE(scr);
448 vd->active = scr;
450 SCREEN_INVISIBLE(scr);
453 LIST_INSERT_HEAD(&vdp->screens, scr, next);
462 struct vcons_screen *scr = cookie;
469 if (scr == NULL)
472 ri = &scr->scr_ri;
475 if ((scr->scr_flags & VCONS_LOADFONT) == 0) {
498 scr->scr_flags & VCONS_FONT_BITS_R2L ?
501 scr->scr_flags & VCONS_FONT_BYTES_R2L ?
512 if (SCREEN_IS_VISIBLE(scr))
513 vdp->eraserows(ri, 0, ri->ri_rows, scr->scr_defattr);
524 vd->init_screen(vd->cookie, scr, 1, &scr->scr_defattr);
525 DPRINTF("caps %x %x\n", scr->scr_type->capabilities, ri->ri_caps);
526 if (scr->scr_type->capabilities & WSSCREEN_RESIZE) {
527 scr->scr_type->nrows = ri->ri_rows;
528 scr->scr_type->ncols = ri->ri_cols;
534 if (scr->scr_attrs)
535 free(scr->scr_attrs, M_DEVBUF);
537 vcons_alloc_buffers(vd, scr);
542 scr->putchar = ri->ri_ops.putchar;
545 if (scr->scr_flags & VCONS_NO_COPYCOLS) {
551 if (scr->scr_flags & VCONS_NO_COPYROWS) {
557 if (scr->scr_flags & VCONS_NO_CURSOR) {
574 vd->show_screen_cb(scr, vd->show_screen_cookie);
596 struct vcons_screen *scr, *oldscr;
598 scr
599 if (!scr) {
630 if (scr == oldscr)
634 if (SCREEN_IS_VISIBLE(scr))
645 SCREEN_VISIBLE(scr);
646 vd->active = scr;
654 vd->show_screen_cb(scr, vd->show_screen_cookie);
656 if ((scr->scr_flags & VCONS_NO_REDRAW) == 0)
657 vcons_redraw_screen(scr);
664 vcons_redraw_screen(struct vcons_screen *scr)
666 uint32_t *charptr = scr->scr_chars, c;
667 long *attrptr = scr->scr_attrs, a, last_a = 0, mask, cmp, acmp;
668 struct rasops_info *ri = &scr->scr_ri;
669 struct vcons_data *vd = scr->scr_vd;
675 vcons_lock(scr);
676 if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
684 scr->scr_defattr);
685 cmp = scr->scr_defattr & mask;
690 offset = scr->scr_current_offset;
741 scr->putchar(ri, i, j, c, a);
757 scr->scr_vd->private->cursor(ri, 1, ri->ri_crow, ri->ri_ccol);
762 vcons_unlock(scr);
766 vcons_update_screen(struct vcons_screen *scr)
769 uint32_t *charptr = scr->scr_chars;
770 long *attrptr = scr->scr_attrs;
771 struct rasops_info *ri = &scr->scr_ri;
772 struct vcons_data *vd = scr->scr_vd;
776 vcons_lock(scr);
777 if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
781 offset = scr->scr_current_offset;
804 scr->putchar(ri, i, j,
814 scr->scr_vd->private->cursor(ri, 1, ri->ri_crow, ri->ri_ccol);
817 vcons_unlock(scr);
819 vcons_redraw_screen(scr);
887 struct vcons_screen *scr;
891 scr = malloc(sizeof(struct vcons_screen), M_DEVBUF, M_WAITOK | M_ZERO);
892 if (scr == NULL)
895 scr->scr_flags = 0;
896 scr->scr_status = 0;
897 scr->scr_busy = 0;
898 scr->scr_type = __UNCONST(type);
900 ret = vcons_init_screen(vd, scr, 0, defattrp);
902 free(scr, M_DEVBUF);
906 t->nrows = scr->scr_ri.ri_rows;
907 t->ncols = scr->scr_ri.ri_cols;
911 SCREEN_VISIBLE(scr);
912 vd->active = scr;
916 *cookiep = scr;
917 *curxp = scr->scr_ri.ri_ccol;
918 *curyp = scr->scr_ri.ri_crow;
926 struct vcons_screen *scr = cookie;
928 vcons_lock(scr);
931 LIST_REMOVE(scr, next);
933 if ((scr->scr_flags & VCONS_SCREEN_IS_STATIC) == 0) {
934 free(scr->scr_attrs, M_DEVBUF);
935 free(scr, M_DEVBUF);
948 if (vd->active == scr)
958 struct vcons_screen *scr;
960 scr = cookie;
961 if (scr == vd->active)
964 vdp->wanted = scr;
982 struct vcons_screen *scr = ri->ri_hw;
985 int offset = vcons_offset_to_zero(scr);
987 memmove(&scr->scr_attrs[offset + to], &scr->scr_attrs[offset + from],
989 memmove(&scr->scr_chars[offset + to], &scr->scr_chars[offset + from],
992 vcons_dirty(scr);
999 struct vcons_screen *scr = ri->ri_hw;
1003 if (vcons_use_intr(scr))
1006 vcons_lock(scr);
1007 if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
1009 vcons_update_screen(scr);
1011 scr->scr_vd->private->copycols(cookie, row, srccol, dstcol,
1015 vcons_unlock(scr);
1022 struct vcons_screen *scr = ri->ri_hw;
1024 struct vcons_data *vd = scr->scr_vd;
1028 vcons_lock(scr);
1029 if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
1033 offset = scr->scr_current_offset;
1041 if ((scr->scr_chars[pos] != vdp->chars[ppos]) ||
1042 (scr->scr_attrs[pos] != vdp->attrs[ppos])) {
1043 scr->putchar(cookie, row, c,
1044 scr->scr_chars[pos], scr->scr_attrs[pos]);
1045 vdp->chars[ppos] = scr->scr_chars[pos];
1046 vdp->attrs[ppos] = scr->scr_attrs[pos];
1049 scr->putchar(cookie, row, c, scr->scr_chars[pos],
1050 scr->scr_attrs[pos]);
1059 vcons_unlock(scr);
1066 struct vcons_screen *scr = ri->ri_hw;
1069 int offset = vcons_offset_to_zero(scr);
1072 scr->scr_attrs[offset + i] = fillattr;
1073 scr->scr_chars[offset + i] = 0x20;
1076 vcons_dirty(scr);
1084 struct vcons_screen *scr = ri->ri_hw;
1085 struct vcons_data *vd = scr->scr_vd;
1091 vdp->chars[i] = scr->scr_chars[i];
1092 vdp->attrs[i] = scr->scr_attrs[i];
1101 struct vcons_screen *scr = ri->ri_hw;
1105 if (vcons_use_intr(scr))
1108 vcons_lock(scr);
1109 if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
1114 scr->scr_vd->private->erasecols(cookie, row, startcol, ncols,
1118 vcons_unlock(scr);
1125 struct vcons_screen *scr = ri->ri_hw;
1127 int offset = vcons_offset_to_zero(scr);
1134 memmove(&scr->scr_attrs[to], &scr->scr_attrs[from],
1136 memmove(&scr->scr_chars[to], &scr->scr_chars[from],
1143 memmove(&scr->scr_attrs[to], &scr->scr_attrs[from],
1145 memmove(&scr->scr_chars[to], &scr->scr_chars[from],
1148 vcons_dirty(scr);
1155 struct vcons_screen *scr = ri->ri_hw;
1159 if (vcons_use_intr(scr))
1162 vcons_lock(scr);
1163 if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
1165 vcons_update_screen(scr);
1167 scr->scr_vd->private->copyrows(cookie, srcrow, dstrow, nrows);
1170 vcons_unlock(scr);
1177 struct vcons_screen *scr = ri->ri_hw;
1179 struct vcons_data *vd = scr->scr_vd;
1182 vcons_lock(scr);
1183 if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
1187 offset = scr->scr_current_offset;
1196 if ((scr->scr_chars[pos] != vdp->chars[ppos]) ||
1197 (scr->scr_attrs[pos] != vdp->attrs[ppos])) {
1198 scr->putchar(cookie, l, c,
1199 scr->scr_chars[pos], scr->scr_attrs[pos]);
1200 vdp->chars[ppos] = scr->scr_chars[pos];
1201 vdp->attrs[ppos] = scr->scr_attrs[pos];
1204 scr->putchar(cookie, l, c, scr->scr_chars[pos],
1205 scr->scr_attrs[pos]);
1214 vcons_unlock(scr);
1221 struct vcons_screen *scr = ri->ri_hw;
1222 int offset = vcons_offset_to_zero(scr);
1229 scr->scr_attrs[i] = fillattr;
1230 scr->scr_chars[i] = 0x20;
1233 vcons_dirty(scr);
1241 struct vcons_screen *scr = ri->ri_hw;
1242 struct vcons_data *vd = scr->scr_vd;
1258 struct vcons_screen *scr = ri->ri_hw;
1262 if (vcons_use_intr(scr))
1265 vcons_lock(scr);
1266 if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
1270 scr
1273 vcons_unlock(scr);
1280 struct vcons_screen *scr = ri->ri_hw;
1281 int offset = vcons_offset_to_zero(scr);
1287 ret = (scr->scr_attrs[pos + offset] != attr) ||
1288 (scr->scr_chars[pos + offset] != c);
1289 scr->scr_attrs[pos + offset] = attr;
1290 scr->scr_chars[pos + offset] = c;
1294 vcons_dirty(scr);
1303 struct vcons_screen *scr = ri->ri_hw;
1304 struct vcons_data *vd = scr->scr_vd;
1309 scr->putchar(cookie, row, col, c, attr);
1315 scr->putchar(cookie, row, col, c, attr);
1324 struct vcons_screen *scr = ri->ri_hw;
1329 if (vcons_use_intr(scr))
1332 vcons_lock(scr);
1333 if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
1340 scr->putchar(cookie, row, col, c, attr);
1342 scr->putchar(cookie, row, col, c, attr);
1345 vcons_unlock(scr);
1352 struct vcons_screen *scr = ri->ri_hw;
1354 if (vcons_use_intr(scr)) {
1355 vcons_lock(scr);
1356 if (scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) {
1357 scr->scr_ri.ri_crow = row;
1358 scr->scr_ri.ri_ccol = col;
1359 vcons_dirty(scr);
1361 vcons_unlock(scr);
1365 vcons_lock(scr);
1367 if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
1368 scr->scr_vd->private->cursor(cookie, on, row, col);
1370 scr->scr_ri.ri_crow = row;
1371 scr->scr_ri.ri_ccol = col;
1373 vcons_unlock(scr);
1380 struct vcons_screen *scr = ri->ri_hw;
1384 offset = scr->scr_current_offset;
1388 (((scr->scr_flags & VCONS_DONT_READ) != VCONS_DONT_READ) || on)) {
1389 scr->putchar(cookie, ri->ri_crow, ri->ri_ccol,
1390 scr->scr_chars[ofs], scr->scr_attrs[ofs]);
1397 scr->putchar(cookie, row, col, scr->scr_chars[ofs],
1401 ((scr->scr_attrs[ofs] & 0xff00ffff) ^ 0x0f000000) |
1404 scr->scr_attrs[ofs] ^ 0x0f0f0000);
1413 vcons_putwschar(struct vcons_screen *scr, struct wsdisplay_char *wsc)
1419 KASSERT(scr != NULL);
1422 ri = &scr->scr_ri;
1452 vcons_getwschar(struct vcons_screen *scr, struct wsdisplay_char *wsc)
1459 KASSERT(scr != NULL);
1462 ri = &scr->scr_ri;
1482 offset += vcons_offset_to_zero(scr);
1483 wsc->letter = scr->scr_chars[offset];
1484 attr = scr->scr_attrs[offset];
1520 vcons_offset_to_zero(const struct vcons_screen *scr)
1523 return scr->scr_offset_to_zero;
1534 struct vcons_screen *scr = vs;
1537 scr->scr_line_wanted = 0;
1539 scr->scr_line_wanted = scr->scr_line_wanted - where;
1540 if (scr->scr_line_wanted < 0)
1541 scr->scr_line_wanted = 0;
1542 if (scr->scr_line_wanted > scr->scr_lines_in_buffer)
1543 scr->scr_line_wanted = scr->scr_lines_in_buffer;
1546 if (scr->scr_line_wanted != scr->scr_current_line) {
1548 vcons_do_scroll(scr);
1553 vcons_do_scroll(struct vcons_screen *scr)
1559 if (scr->scr_line_wanted == scr->scr_current_line)
1561 dist = scr->scr_line_wanted - scr->scr_current_line;
1562 scr->scr_current_line = scr->scr_line_wanted;
1563 scr->scr_current_offset = scr->scr_ri.ri_cols *
1564 (scr->scr_lines_in_buffer - scr->scr_current_line);
1565 if (abs(dist) >= scr->scr_ri.ri_rows) {
1566 vcons_redraw_screen(scr);
1574 num = scr->scr_ri.ri_rows - dist;
1576 r_offset = scr->scr_current_offset;
1582 num = scr->scr_ri.ri_rows + dist;
1583 r_offset = scr->scr_current_offset + num * scr->scr_ri.ri_cols;
1586 scr->scr_vd->private->copyrows(scr, from, to, num);
1588 for (j = 0; j < scr->scr_ri.ri_cols; j++) {
1590 vcons_putchar_cached(scr, i + r_start, j,
1591 scr->scr_chars[r_offset],
1592 scr->scr_attrs[r_offset]);
1594 scr->putchar(scr, i + r_start, j,
1595 scr->scr_chars[r_offset],
1596 scr->scr_attrs[r_offset]);
1602 if (scr->scr_line_wanted == 0) {
1604 scr->scr_ri.ri_flg &= ~RI_CURSOR;
1605 scr->scr_vd->private->cursor(scr, 1, scr->scr_ri.ri_crow,
1606 scr->scr_ri.ri_ccol);
1627 struct vcons_screen *scr = vd->active;
1630 if (scr && vdp->use_intr) {
1631 if (!SCREEN_IS_BUSY(scr)) {
1632 dirty = atomic_swap_uint(&scr->scr_dirty, 0);
1635 if ((scr->scr_flags & VCONS_NO_REDRAW) == 0) {
1637 vcons_redraw_screen(scr);
1640 if ((scr->scr_flags & VCONS_NO_REDRAW) == 0)
1641 vcons_update_screen(scr);
1664 struct vcons_screen *scr = vd->active;
1672 if (scr && !SCREEN_IS_BUSY(scr)) {
1673 if ((scr->scr_flags & VCONS_NO_REDRAW) == 0)
1674 vcons_redraw_screen(scr);
1683 struct vcons_screen *scr = vd->active;
1689 if (scr)
1690 vcons_dirty(scr);
1695 vcons_hard_switch(struct vcons_screen *scr)
1697 struct vcons_data *vd = scr->scr_vd;
1705 SCREEN_VISIBLE(scr);
1706 vd->active = scr;
1710 vd->show_screen_cb(scr, vd->show_screen_cookie);