--- linux-cjktty-5.4.65.patch 2020-09-18 00:19:07.610052000 +0800 +++ linux-cjktty-5.4.66.patch 2020-09-18 19:03:23.870884705 +0800 @@ -284,7 +284,7 @@ #include #include #include -@@ -43,6 +44,21 @@ static void update_attr(u8 *dst, u8 *src, int attribute, +@@ -43,6 +44,19 @@ static void update_attr(u8 *dst, u8 *src, int attribute, } } @@ -293,8 +293,6 @@ + unsigned long p = (long)utf8; + if (p >= vc->vc_origin && p < vc->vc_scr_end) { + return scr_readw((unsigned short *)(p + vc->vc_screenbuf_size)); -+ } else if (vc->vc_num == fg_console && fbcon_is_softback(utf8)){ -+ return scr_readw((unsigned short *)(p + fbcon_softback_size)); + } else { + u16 extra_c; + int c = *(int*)utf8; @@ -381,7 +379,7 @@ + cursor.set = 0; - if (softback_lines) { + c = scr_readw((u16 *) vc->vc_pos); @@ -258,7 +299,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, c = scr_readw((u16 *) vc->vc_pos); @@ -395,43 +393,7 @@ index c9235a2f42f89..7ed69f292db9b 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c -@@ -123,7 +123,8 @@ static int logo_lines; - enums. */ - static int logo_shown = FBCON_LOGO_CANSHOW; - /* Software scrollback */ --static int fbcon_softback_size = 32768; -+/*I need to use it out side fbcon.c */ -+int fbcon_softback_size = 32768; - static unsigned long softback_buf, softback_curr; - static unsigned long softback_in; - static unsigned long softback_top, softback_end; -@@ -216,6 +217,14 @@ static void fbcon_start(void); - static void fbcon_exit(void); - static struct device *fbcon_device; - -+int fbcon_is_softback(const unsigned short *str) -+{ -+ unsigned long p = (long)str; -+ if(p >= softback_buf && p fix.type != FB_TYPE_TEXT) { - if (fbcon_softback_size) { - if (!softback_buf) { -- softback_buf = -- (unsigned long) -- kvmalloc(fbcon_softback_size, -- GFP_KERNEL); -+ softback_buf = (unsigned long) kmalloc(fbcon_softback_size * 2, GFP_KERNEL); - if (!softback_buf) { - fbcon_softback_size = 0; - softback_top = 0; + @@ -1051,7 +1057,8 @@ static const char *fbcon_startup(void) vc->vc_font.width = font->width; vc->vc_font.height = font->height; @@ -481,31 +443,6 @@ p->userfont = t->userfont; if (p->userfont) REFCOUNT(p->fontdata)++; -@@ -1612,6 +1618,7 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) - static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p, - long delta) - { -+ u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; - int count = vc->vc_rows; - unsigned short *d, *s; - unsigned long n; -@@ -1674,6 +1681,8 @@ static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p, - start = s; - } - } -+ if( ((scr_readw(s) & charmask) == 0xff || (scr_readw(s) & charmask) == 0xfe) && scr_readw(s + (vc->vc_screenbuf_size >> 1)) != 0){ -+ }else{ - if (c == scr_readw(d)) { - if (s > start) { - fbcon_putcs(vc, start, s - start, -@@ -1685,6 +1694,7 @@ static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p, - start++; - } - } -+ } - s++; - d++; - } while (s < le); @@ -1767,6 +1777,7 @@ static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, } @@ -554,14 +491,6 @@ console_conditional_schedule(); s++; d++; -@@ -1852,6 +1868,7 @@ static inline void fbcon_softback_note(struct vc_data *vc, int t, - - while (count) { - scr_memcpyw((u16 *) softback_in, p, vc->vc_size_row); -+ scr_memcpyw((u16 *) softback_in + (fbcon_softback_size >> 1), p + (vc->vc_screenbuf_size >> 1), vc->vc_size_row); - count--; - p = advance_row(p, 1); - softback_in += vc->vc_size_row; @@ -2455,7 +2472,6 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font) font->width = vc->vc_font.width; @@ -570,40 +499,22 @@ if (!font->data) return 0; -@@ -2760,6 +2776,19 @@ static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) - unsigned long p; - int line; - +@@ -2593,6 +2593,10 @@ static void fbcon_set_palette(struct vc_ + + static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) + { + if (offset < 0) { + offset = -offset - 1; -+ if (vc->vc_num != fg_console || !softback_lines) -+ return (u16 *)(vc->vc_origin + offset + (vc->vc_screenbuf_size)); -+ line = offset / vc->vc_size_row; -+ if (line >= softback_lines) -+ return (u16 *) (vc->vc_origin + offset - softback_lines * vc->vc_size_row + (vc->vc_screenbuf_size)); -+ p = softback_curr + offset; -+ if (p >= softback_end) -+ p += softback_buf - softback_end; -+ return (u16 *) (p + (fbcon_softback_size)); -+ } -+ - if (vc->vc_num != fg_console || !softback_lines) - return (u16 *) (vc->vc_origin + offset); - line = offset / vc->vc_size_row; -@@ -2867,6 +2896,8 @@ static void fbcon_scrolldelta(struct vc_data *vc, int lines) - q -= vc->vc_size_row; - scr_memcpyw((u16 *) q, (u16 *) p, - vc->vc_size_row); -+ scr_memcpyw((u16 *) (q + (vc->vc_screenbuf_size >> 1)), (u16 *) (p + (fbcon_softback_size >> 1)), -+ vc->vc_size_row); - } - softback_in = softback_curr = p; - update_region(vc, vc->vc_origin, ++ return (u16 *)(vc->vc_origin + offset + (vc->vc_screenbuf_size)); ++ } + return (u16 *) (vc->vc_origin + offset); + } + diff --git a/drivers/video/fbdev/core/fbcon.h b/drivers/video/fbdev/core/fbcon.h index 20dea853765f5..b34c419dd1eb2 100644 --- a/drivers/video/fbdev/core/fbcon.h +++ b/drivers/video/fbdev/core/fbcon.h -@@ -262,4 +262,13 @@ extern void fbcon_set_rotate(struct fbcon_ops *ops); +@@ -262,4 +262,10 @@ extern void fbcon_set_rotate(struct fbcon_ops *ops); #define fbcon_set_rotate(x) do {} while(0) #endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */ @@ -613,9 +524,6 @@ +#define fbcon_platform_get_rotate(i) FB_ROTATE_UR +#endif /* CONFIG_DMI */ + -+extern int fbcon_softback_size; -+extern int fbcon_is_softback(const unsigned short *str); -+ #endif /* _VIDEO_FBCON_H */ diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c index dfa9a8aa4509c..beb33f5795061 100644 @@ -665,8 +573,8 @@ if (!ops->fontbuffer) return; @@ -245,9 +258,19 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode, - y += softback_lines; - } + + cursor.set = 0; - c = scr_readw((u16 *) vc->vc_pos); + c = scr_readw((u16 *) vc->vc_pos);