| @@ -277,8 +277,15 @@ static void notify_update(struct vc_data *vc) · 276 unmodified lines |
| 277 | * Low-Level Functions | 277 | * Low-Level Functions |
| 278 | */ | 278 | */ |
| 279 | | 279 | |
| 280 | #define IS_FG(vc) ((vc)->vc_num == fg_console) | 280 | static inline bool con_is_fg(const struct vc_data *vc) |
| 281 | #define DO_UPDATE(vc) (CON_IS_VISIBLE(vc) && !console_blanked) | 281 | { |
| | 282 | return vc->vc_num == fg_console; |
| | 283 | } |
| | 284 | |
| | 285 | static inline bool con_should_update(const struct vc_data *vc) |
| | 286 | { |
| | 287 | return con_is_visible(vc) && !console_blanked; |
| | 288 | } |
| 282 | | 289 | |
| 283 | static inline unsigned short *screenpos(struct vc_data *vc, int offset, int viewed) | 290 | static inline unsigned short *screenpos(struct vc_data *vc, int offset, int viewed) |
| 284 | { | 291 | { |
| @@ -316,7 +323,7 @@ static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr) · 31 unmodified lines |
| 316 | nr = b - t - 1; | 323 | nr = b - t - 1; |
| 317 | if (b > vc->vc_rows || t >= b || nr < 1) | 324 | if (b > vc->vc_rows || t >= b || nr < 1) |
| 318 | return; | 325 | return; |
| 319 | if (CON_IS_VISIBLE(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_UP, nr)) | 326 | if (con_is_visible(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_UP, nr)) |
| 320 | return; | 327 | return; |
| 321 | d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); | 328 | d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); |
| 322 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr)); | 329 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr)); |
| @@ -334,7 +341,7 @@ static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr) · 11 unmodified lines |
| 334 | nr = b - t - 1; | 341 | nr = b - t - 1; |
| 335 | if (b > vc->vc_rows || t >= b || nr < 1) | 342 | if (b > vc->vc_rows || t >= b || nr < 1) |
| 336 | return; | 343 | return; |
| 337 | if (CON_IS_VISIBLE(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_DOWN, nr)) | 344 | if (con_is_visible(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_DOWN, nr)) |
| 338 | return; | 345 | return; |
| 339 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); | 346 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); |
| 340 | step = vc->vc_cols * nr; | 347 | step = vc->vc_cols * nr; |
| @@ -390,7 +397,7 @@ void update_region(struct vc_data *vc, unsigned long start, int count) · 49 unmodified lines |
| 390 | { | 397 | { |
| 391 | WARN_CONSOLE_UNLOCKED(); | 398 | WARN_CONSOLE_UNLOCKED(); |
| 392 | | 399 | |
| 393 | if (DO_UPDATE(vc)) { | 400 | if (con_should_update(vc)) { |
| 394 | hide_cursor(vc); | 401 | hide_cursor(vc); |
| 395 | do_update_region(vc, start, count); | 402 | do_update_region(vc, start, count); |
| 396 | set_cursor(vc); | 403 | set_cursor(vc); |
| @@ -490,7 +497,7 @@ void invert_screen(struct vc_data *vc, int offset, int count, int viewed) · 93 unmodified lines |
| 490 | } | 497 | } |
| 491 | } | 498 | } |
| 492 | | 499 | |
| 493 | if (DO_UPDATE(vc)) | 500 | if (con_should_update(vc)) |
| 494 | do_update_region(vc, (unsigned long) p, count); | 501 | do_update_region(vc, (unsigned long) p, count); |
| 495 | notify_update(vc); | 502 | notify_update(vc); |
| 496 | } | 503 | } |
| @@ -507,7 +514,7 @@ void complement_pos(struct vc_data *vc, int offset) · 10 unmodified lines |
| 507 | if (old_offset != -1 && old_offset >= 0 && | 514 | if (old_offset != -1 && old_offset >= 0 && |
| 508 | old_offset < vc->vc_screenbuf_size) { | 515 | old_offset < vc->vc_screenbuf_size) { |
| 509 | scr_writew(old, screenpos(vc, old_offset, 1)); | 516 | scr_writew(old, screenpos(vc, old_offset, 1)); |
| 510 | if (DO_UPDATE(vc)) | 517 | if (con_should_update(vc)) |
| 511 | vc->vc_sw->con_putc(vc, old, oldy, oldx); | 518 | vc->vc_sw->con_putc(vc, old, oldy, oldx); |
| 512 | notify_update(vc); | 519 | notify_update(vc); |
| 513 | } | 520 | } |
| @@ -522,7 +529,7 @@ void complement_pos(struct vc_data *vc, int offset) · 8 unmodified lines |
| 522 | old = scr_readw(p); | 529 | old = scr_readw(p); |
| 523 | new = old ^ vc->vc_complement_mask; | 530 | new = old ^ vc->vc_complement_mask; |
| 524 | scr_writew(new, p); | 531 | scr_writew(new, p); |
| 525 | if (DO_UPDATE(vc)) { | 532 | if (con_should_update(vc)) { |
| 526 | oldx = (offset >> 1) % vc->vc_cols; | 533 | oldx = (offset >> 1) % vc->vc_cols; |
| 527 | oldy = (offset >> 1) / vc->vc_cols; | 534 | oldy = (offset >> 1) / vc->vc_cols; |
| 528 | vc->vc_sw->con_putc(vc, new, oldy, oldx); | 535 | vc->vc_sw->con_putc(vc, new, oldy, oldx); |
| @@ -538,7 +545,7 @@ static void insert_char(struct vc_data *vc, unsigned int nr) · 9 unmodified lines |
| 538 | scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x - nr) * 2); | 545 | scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x - nr) * 2); |
| 539 | scr_memsetw(p, vc->vc_video_erase_char, nr * 2); | 546 | scr_memsetw(p, vc->vc_video_erase_char, nr * 2); |
| 540 | vc->vc_need_wrap = 0; | 547 | vc->vc_need_wrap = 0; |
| 541 | if (DO_UPDATE(vc)) | 548 | if (con_should_update(vc)) |
| 542 | do_update_region(vc, (unsigned long) p, | 549 | do_update_region(vc, (unsigned long) p, |
| 543 | vc->vc_cols - vc->vc_x); | 550 | vc->vc_cols - vc->vc_x); |
| 544 | } | 551 | } |
| @@ -551,7 +558,7 @@ static void delete_char(struct vc_data *vc, unsigned int nr) · 6 unmodified lines |
| 551 | scr_memsetw(p + vc->vc_cols - vc->vc_x - nr, vc->vc_video_erase_char, | 558 | scr_memsetw(p + vc->vc_cols - vc->vc_x - nr, vc->vc_video_erase_char, |
| 552 | nr * 2); | 559 | nr * 2); |
| 553 | vc->vc_need_wrap = 0; | 560 | vc->vc_need_wrap = 0; |
| 554 | if (DO_UPDATE(vc)) | 561 | if (con_should_update(vc)) |
| 555 | do_update_region(vc, (unsigned long) p, | 562 | do_update_region(vc, (unsigned long) p, |
| 556 | vc->vc_cols - vc->vc_x); | 563 | vc->vc_cols - vc->vc_x); |
| 557 | } | 564 | } |
| @@ -571,7 +578,7 @@ static void add_softcursor(struct vc_data *vc) · 13 unmodified lines |
| 571 | if ((type & 0x20) && ((softcursor_original & 0x7000) == (i & 0x7000))) i ^= 0x7000; | 578 | if ((type & 0x20) && ((softcursor_original & 0x7000) == (i & 0x7000))) i ^= 0x7000; |
| 572 | if ((type & 0x40) && ((i & 0x700) == ((i & 0x7000) >> 4))) i ^= 0x0700; | 579 | if ((type & 0x40) && ((i & 0x700) == ((i & 0x7000) >> 4))) i ^= 0x0700; |
| 573 | scr_writew(i, (u16 *) vc->vc_pos); | 580 | scr_writew(i, (u16 *) vc->vc_pos); |
| 574 | if (DO_UPDATE(vc)) | 581 | if (con_should_update(vc)) |
| 575 | vc->vc_sw->con_putc(vc, i, vc->vc_y, vc->vc_x); | 582 | vc->vc_sw->con_putc(vc, i, vc->vc_y, vc->vc_x); |
| 576 | } | 583 | } |
| 577 | | 584 | |
| @@ -579,7 +586,7 @@ static void hide_softcursor(struct vc_data *vc) · 1 unmodified line |
| 579 | { | 586 | { |
| 580 | if (softcursor_original != -1) { | 587 | if (softcursor_original != -1) { |
| 581 | scr_writew(softcursor_original, (u16 *)vc->vc_pos); | 588 | scr_writew(softcursor_original, (u16 *)vc->vc_pos); |
| 582 | if (DO_UPDATE(vc)) | 589 | if (con_should_update(vc)) |
| 583 | vc->vc_sw->con_putc(vc, softcursor_original, | 590 | vc->vc_sw->con_putc(vc, softcursor_original, |
| 584 | vc->vc_y, vc->vc_x); | 591 | vc->vc_y, vc->vc_x); |
| 585 | softcursor_original = -1; | 592 | softcursor_original = -1; |
| @@ -596,8 +603,7 @@ static void hide_cursor(struct vc_data *vc) · 10 unmodified lines |
| 596 | | 603 | |
| 597 | static void set_cursor(struct vc_data *vc) | 604 | static void set_cursor(struct vc_data *vc) |
| 598 | { | 605 | { |
| 599 | if (!IS_FG(vc) || console_blanked || | 606 | if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS) |
| 600 | vc->vc_mode == KD_GRAPHICS) | | |
| 601 | return; | 607 | return; |
| 602 | if (vc->vc_deccm) { | 608 | if (vc->vc_deccm) { |
| 603 | if (vc == sel_cons) | 609 | if (vc == sel_cons) |
| @@ -613,7 +619,7 @@ static void set_origin(struct vc_data *vc) · 9 unmodified lines |
| 613 | { | 619 | { |
| 614 | WARN_CONSOLE_UNLOCKED(); | 620 | WARN_CONSOLE_UNLOCKED(); |
| 615 | | 621 | |
| 616 | if (!CON_IS_VISIBLE(vc) || | 622 | if (!con_is_visible(vc) || |
| 617 | !vc->vc_sw->con_set_origin || | 623 | !vc->vc_sw->con_set_origin || |
| 618 | !vc->vc_sw->con_set_origin(vc)) | 624 | !vc->vc_sw->con_set_origin(vc)) |
| 619 | vc->vc_origin = (unsigned long)vc->vc_screenbuf; | 625 | vc->vc_origin = (unsigned long)vc->vc_screenbuf; |
| @@ -661,12 +667,12 @@ void redraw_screen(struct vc_data *vc, int is_switch) · 41 unmodified lines |
| 661 | struct vc_data *old_vc = vc_cons[fg_console].d; | 667 | struct vc_data *old_vc = vc_cons[fg_console].d; |
| 662 | if (old_vc == vc) | 668 | if (old_vc == vc) |
| 663 | return; | 669 | return; |
| 664 | if (!CON_IS_VISIBLE(vc)) | 670 | if (!con_is_visible(vc)) |
| 665 | redraw = 1; | 671 | redraw = 1; |
| 666 | *vc->vc_display_fg = vc; | 672 | *vc->vc_display_fg = vc; |
| 667 | fg_console = vc->vc_num; | 673 | fg_console = vc->vc_num; |
| 668 | hide_cursor(old_vc); | 674 | hide_cursor(old_vc); |
| 669 | if (!CON_IS_VISIBLE(old_vc)) { | 675 | if (!con_is_visible(old_vc)) { |
| 670 | save_screen(old_vc); | 676 | save_screen(old_vc); |
| 671 | set_origin(old_vc); | 677 | set_origin(old_vc); |
| 672 | } | 678 | } |
| @@ -941,7 +947,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, · 268 unmodified lines |
| 941 | tty_do_resize(tty, &ws); | 947 | tty_do_resize(tty, &ws); |
| 942 | } | 948 | } |
| 943 | | 949 | |
| 944 | if (CON_IS_VISIBLE(vc)) | 950 | if (con_is_visible(vc)) |
| 945 | update_screen(vc); | 951 | update_screen(vc); |
| 946 | vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); | 952 | vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); |
| 947 | return err; | 953 | return err; |
| @@ -1171,7 +1177,7 @@ static void csi_J(struct vc_data *vc, int vpar) · 223 unmodified lines |
| 1171 | scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char, | 1177 | scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char, |
| 1172 | vc->vc_screenbuf_size >> 1); | 1178 | vc->vc_screenbuf_size >> 1); |
| 1173 | set_origin(vc); | 1179 | set_origin(vc); |
| 1174 | if (CON_IS_VISIBLE(vc)) | 1180 | if (con_is_visible(vc)) |
| 1175 | update_screen(vc); | 1181 | update_screen(vc); |
| 1176 | /* fall through */ | 1182 | /* fall through */ |
| 1177 | case 2: /* erase whole display */ | 1183 | case 2: /* erase whole display */ |
| @@ -1182,7 +1188,7 @@ static void csi_J(struct vc_data *vc, int vpar) · 4 unmodified lines |
| 1182 | return; | 1188 | return; |
| 1183 | } | 1189 | } |
| 1184 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); | 1190 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); |
| 1185 | if (DO_UPDATE(vc)) | 1191 | if (con_should_update(vc)) |
| 1186 | do_update_region(vc, (unsigned long) start, count); | 1192 | do_update_region(vc, (unsigned long) start, count); |
| 1187 | vc->vc_need_wrap = 0; | 1193 | vc->vc_need_wrap = 0; |
| 1188 | } | 1194 | } |
| @@ -1210,7 +1216,7 @@ static void csi_K(struct vc_data *vc, int vpar) · 21 unmodified lines |
| 1210 | } | 1216 | } |
| 1211 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); | 1217 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); |
| 1212 | vc->vc_need_wrap = 0; | 1218 | vc->vc_need_wrap = 0; |
| 1213 | if (DO_UPDATE(vc)) | 1219 | if (con_should_update(vc)) |
| 1214 | do_update_region(vc, (unsigned long) start, count); | 1220 | do_update_region(vc, (unsigned long) start, count); |
| 1215 | } | 1221 | } |
| 1216 | | 1222 | |
| @@ -1223,7 +1229,7 @@ static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar posi · 6 unmodified lines |
| 1223 | count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar; | 1229 | count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar; |
| 1224 | | 1230 | |
| 1225 | scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count); | 1231 | scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count); |
| 1226 | if (DO_UPDATE(vc)) | 1232 | if (con_should_update(vc)) |
| 1227 | vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count); | 1233 | vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count); |
| 1228 | vc->vc_need_wrap = 0; | 1234 | vc->vc_need_wrap = 0; |
| 1229 | } | 1235 | } |
| @@ -2208,7 +2214,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co · 978 unmodified lines |
| 2208 | charmask = himask ? 0x1ff : 0xff; | 2214 | charmask = himask ? 0x1ff : 0xff; |
| 2209 | | 2215 | |
| 2210 | /* undraw cursor first */ | 2216 | /* undraw cursor first */ |
| 2211 | if (IS_FG(vc)) | 2217 | if (con_is_fg(vc)) |
| 2212 | hide_cursor(vc); | 2218 | hide_cursor(vc); |
| 2213 | | 2219 | |
| 2214 | param.vc = vc; | 2220 | param.vc = vc; |
| @@ -2380,7 +2386,7 @@ rescan_last_byte: · 165 unmodified lines |
| 2380 | ((vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) : | 2386 | ((vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) : |
| 2381 | (vc_attr << 8) + tc, | 2387 | (vc_attr << 8) + tc, |
| 2382 | (u16 *) vc->vc_pos); | 2388 | (u16 *) vc->vc_pos); |
| 2383 | if (DO_UPDATE(vc) && draw_x < 0) { | 2389 | if (con_should_update(vc) && draw_x < 0) { |
| 2384 | draw_x = vc->vc_x; | 2390 | draw_x = vc->vc_x; |
| 2385 | draw_from = vc->vc_pos; | 2391 | draw_from = vc->vc_pos; |
| 2386 | } | 2392 | } |
| @@ -2564,7 +2570,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) · 177 unmodified lines |
| 2564 | goto quit; | 2570 | goto quit; |
| 2565 | | 2571 | |
| 2566 | /* undraw cursor first */ | 2572 | /* undraw cursor first */ |
| 2567 | if (IS_FG(vc)) | 2573 | if (con_is_fg(vc)) |
| 2568 | hide_cursor(vc); | 2574 | hide_cursor(vc); |
| 2569 | | 2575 | |
| 2570 | start = (ushort *)vc->vc_pos; | 2576 | start = (ushort *)vc->vc_pos; |
| @@ -2575,7 +2581,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) · 4 unmodified lines |
| 2575 | c = *b++; | 2581 | c = *b++; |
| 2576 | if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { | 2582 | if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { |
| 2577 | if (cnt > 0) { | 2583 | if (cnt > 0) { |
| 2578 | if (CON_IS_VISIBLE(vc)) | 2584 | if (con_is_visible(vc)) |
| 2579 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); | 2585 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); |
| 2580 | vc->vc_x += cnt; | 2586 | vc->vc_x += cnt; |
| 2581 | if (vc->vc_need_wrap) | 2587 | if (vc->vc_need_wrap) |
| @@ -2607,7 +2613,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) · 25 unmodified lines |
| 2607 | myx++; | 2613 | myx++; |
| 2608 | } | 2614 | } |
| 2609 | if (cnt > 0) { | 2615 | if (cnt > 0) { |
| 2610 | if (CON_IS_VISIBLE(vc)) | 2616 | if (con_is_visible(vc)) |
| 2611 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); | 2617 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); |
| 2612 | vc->vc_x += cnt; | 2618 | vc->vc_x += cnt; |
| 2613 | if (vc->vc_x == vc->vc_cols) { | 2619 | if (vc->vc_x == vc->vc_cols) { |
| @@ -3154,7 +3160,7 @@ static int do_bind_con_driver(const struct consw *csw, int first, int last, · 540 unmodified lines |
| 3154 | | 3160 | |
| 3155 | j = i; | 3161 | j = i; |
| 3156 | | 3162 | |
| 3157 | if (CON_IS_VISIBLE(vc)) { | 3163 | if (con_is_visible(vc)) { |
| 3158 | k = i; | 3164 | k = i; |
| 3159 | save_screen(vc); | 3165 | save_screen(vc); |
| 3160 | } | 3166 | } |