diff options
author | Colin Percival <cperciva@FreeBSD.org> | 2018-08-25 16:14:56 +0000 |
---|---|---|
committer | Colin Percival <cperciva@FreeBSD.org> | 2018-08-25 16:14:56 +0000 |
commit | ee97b2336aa47851a1dc5681ea2017cc2193aac4 (patch) | |
tree | b71313b22544758bd031086c18aff3b055fa793e /sys/dev/vt/vt.h | |
parent | fedded8d048045db541bcff2287ab894cb290bd4 (diff) | |
download | src-ee97b2336aa47851a1dc5681ea2017cc2193aac4.tar.gz src-ee97b2336aa47851a1dc5681ea2017cc2193aac4.zip |
Speed up vt(4) by keeping a record of the most recently drawn character and
the foreground and background colours. In bitblt_text functions, compare
values to this cache and don't re-draw the characters if they haven't changed.
When invalidating the display, clear this cache in order to force characters
to be redrawn; also force full redraws between suspend/resume pairs since odd
artifacts can otherwise result.
When scrolling the display (which is where most time is spent within the vt
driver) this yields a significant performance improvement if most lines are
less than the width of the terminal, since this avoids re-drawing blanks on
top of blanks.
(Note that "re-drawing" here includes writing to the VGA text mode buffer; on
virtualized systems this can be extremely slow since it triggers a glyph
being rendered onto a 640x480 screen).
On a c5.4xlarge EC2 instance (with emulated text mode VGA) this cuts the time
spent in vt(4) during the kernel boot from 1200 ms to 700ms; on my laptop
(with a 3200x1800 display) the corresponding time is reduced from 970 ms down
to 155 ms.
Reviewed by: imp, cem
Approved by: re (gjb)
Relnotes: Significant speedup in vt(4) and the system boot generally.
Differential Revision: https://reviews.freebsd.org/D16723
Notes
Notes:
svn path=/head/; revision=338316
Diffstat (limited to 'sys/dev/vt/vt.h')
-rw-r--r-- | sys/dev/vt/vt.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h index 745f9de836cb..712da20b7634 100644 --- a/sys/dev/vt/vt.h +++ b/sys/dev/vt/vt.h @@ -156,11 +156,15 @@ struct vt_device { #define VDF_INITIALIZED 0x20 /* vtterm_cnprobe already done. */ #define VDF_MOUSECURSOR 0x40 /* Mouse cursor visible. */ #define VDF_QUIET_BELL 0x80 /* Disable bell. */ +#define VDF_SUSPENDED 0x100 /* Device has been suspended. */ #define VDF_DOWNGRADE 0x8000 /* The driver is being downgraded. */ int vd_keyboard; /* (G) Keyboard index. */ unsigned int vd_kbstate; /* (?) Device unit. */ unsigned int vd_unit; /* (c) Device unit. */ int vd_altbrk; /* (?) Alt break seq. state */ + term_char_t *vd_drawn; /* (?) Most recent char drawn. */ + term_color_t *vd_drawnfg; /* (?) Most recent fg color drawn. */ + term_color_t *vd_drawnbg; /* (?) Most recent bg color drawn. */ }; #define VD_PASTEBUF(vd) ((vd)->vd_pastebuf.vpb_buf) @@ -320,6 +324,8 @@ typedef void vd_postswitch_t(struct vt_device *vd); typedef void vd_blank_t(struct vt_device *vd, term_color_t color); typedef void vd_bitblt_text_t(struct vt_device *vd, const struct vt_window *vw, const term_rect_t *area); +typedef void vd_invalidate_text_t(struct vt_device *vd, + const term_rect_t *area); typedef void vd_bitblt_bmp_t(struct vt_device *vd, const struct vt_window *vw, const uint8_t *pattern, const uint8_t *mask, unsigned int width, unsigned int height, @@ -345,6 +351,7 @@ struct vt_driver { vd_drawrect_t *vd_drawrect; vd_setpixel_t *vd_setpixel; vd_bitblt_text_t *vd_bitblt_text; + vd_invalidate_text_t *vd_invalidate_text; vd_bitblt_bmp_t *vd_bitblt_bmp; /* Framebuffer ioctls, if present. */ |