提交 917ae1a9 编写于 作者: J Jiri Slaby 提交者: Greg Kroah-Hartman

vc: introduce struct vc_draw_region

For passing of draw area among functions. This makes next patches
simpler.
Signed-off-by: NJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20200615074910.19267-17-jslaby@suse.czSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 a4236348
...@@ -2549,15 +2549,20 @@ static int is_double_width(uint32_t ucs) ...@@ -2549,15 +2549,20 @@ static int is_double_width(uint32_t ucs)
sizeof(struct interval), ucs_cmp) != NULL; sizeof(struct interval), ucs_cmp) != NULL;
} }
static void con_flush(struct vc_data *vc, unsigned long draw_from, struct vc_draw_region {
unsigned long draw_to, int *draw_x) unsigned long from, to;
int x;
};
static void con_flush(struct vc_data *vc, struct vc_draw_region *draw)
{ {
if (*draw_x < 0) if (draw->x < 0)
return; return;
vc->vc_sw->con_putcs(vc, (u16 *)draw_from, vc->vc_sw->con_putcs(vc, (u16 *)draw->from,
(u16 *)draw_to - (u16 *)draw_from, vc->state.y, *draw_x); (u16 *)draw->to - (u16 *)draw->from, vc->state.y,
*draw_x = -1; draw->x);
draw->x = -1;
} }
static inline int vc_translate_ascii(const struct vc_data *vc, int c) static inline int vc_translate_ascii(const struct vc_data *vc, int c)
...@@ -2689,9 +2694,11 @@ static inline unsigned char vc_invert_attr(const struct vc_data *vc) ...@@ -2689,9 +2694,11 @@ static inline unsigned char vc_invert_attr(const struct vc_data *vc)
/* acquires console_lock */ /* acquires console_lock */
static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count)
{ {
int c, next_c, tc, ok, n = 0, draw_x = -1; struct vc_draw_region draw = {
.x = -1,
};
int c, next_c, tc, ok, n = 0;
unsigned int currcons; unsigned int currcons;
unsigned long draw_from = 0, draw_to = 0;
struct vc_data *vc; struct vc_data *vc;
unsigned char vc_attr; unsigned char vc_attr;
struct vt_notifier_param param; struct vt_notifier_param param;
...@@ -2798,14 +2805,13 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co ...@@ -2798,14 +2805,13 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
vc_attr = vc->vc_attr; vc_attr = vc->vc_attr;
} else { } else {
vc_attr = vc_invert_attr(vc); vc_attr = vc_invert_attr(vc);
con_flush(vc, draw_from, draw_to, &draw_x); con_flush(vc, &draw);
} }
next_c = c; next_c = c;
while (1) { while (1) {
if (vc->vc_need_wrap || vc->vc_decim) if (vc->vc_need_wrap || vc->vc_decim)
con_flush(vc, draw_from, draw_to, con_flush(vc, &draw);
&draw_x);
if (vc->vc_need_wrap) { if (vc->vc_need_wrap) {
cr(vc); cr(vc);
lf(vc); lf(vc);
...@@ -2817,16 +2823,16 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co ...@@ -2817,16 +2823,16 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
((vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) : ((vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) :
(vc_attr << 8) + tc, (vc_attr << 8) + tc,
(u16 *) vc->vc_pos); (u16 *) vc->vc_pos);
if (con_should_update(vc) && draw_x < 0) { if (con_should_update(vc) && draw.x < 0) {
draw_x = vc->state.x; draw.x = vc->state.x;
draw_from = vc->vc_pos; draw.from = vc->vc_pos;
} }
if (vc->state.x == vc->vc_cols - 1) { if (vc->state.x == vc->vc_cols - 1) {
vc->vc_need_wrap = vc->vc_decawm; vc->vc_need_wrap = vc->vc_decawm;
draw_to = vc->vc_pos + 2; draw.to = vc->vc_pos + 2;
} else { } else {
vc->state.x++; vc->state.x++;
draw_to = (vc->vc_pos += 2); draw.to = (vc->vc_pos += 2);
} }
if (!--width) break; if (!--width) break;
...@@ -2838,17 +2844,17 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co ...@@ -2838,17 +2844,17 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
notify_write(vc, c); notify_write(vc, c);
if (inverse) if (inverse)
con_flush(vc, draw_from, draw_to, &draw_x); con_flush(vc, &draw);
if (rescan) if (rescan)
goto rescan_last_byte; goto rescan_last_byte;
continue; continue;
} }
con_flush(vc, draw_from, draw_to, &draw_x); con_flush(vc, &draw);
do_con_trol(tty, vc, orig); do_con_trol(tty, vc, orig);
} }
con_flush(vc, draw_from, draw_to, &draw_x); con_flush(vc, &draw);
vc_uniscr_debug_check(vc); vc_uniscr_debug_check(vc);
console_conditional_schedule(); console_conditional_schedule();
notify_update(vc); notify_update(vc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册