mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
vc: introduce struct vc_draw_region
For passing of draw area among functions. This makes next patches simpler. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200615074910.19267-17-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a4236348f4
commit
917ae1a990
1 changed files with 25 additions and 19 deletions
|
@ -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)
|
||||||
/* 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 @@ rescan_last_byte:
|
||||||
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 @@ rescan_last_byte:
|
||||||
((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 @@ rescan_last_byte:
|
||||||
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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue