From 1ae58b2899332c9952c005f5dcbcdb7de1adaf22 Mon Sep 17 00:00:00 2001 From: sephe Date: Thu, 16 Jun 2016 04:32:11 +0000 Subject: [PATCH] MFC 297334 vt: Use textmode when we're running on hypervisors The graphic mode is noticeably slow on hypervisors, especially on Hyper-V (1 second to each line). Submitted by: Dexuan Cui Reviewed by: kib, sephe, royger (early loader version) MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5739 git-svn-id: svn://svn.freebsd.org/base/stable/10@301950 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/vt/hw/vga/vt_vga.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c index 62e409f03..43f564760 100644 --- a/sys/dev/vt/hw/vga/vt_vga.c +++ b/sys/dev/vt/hw/vga/vt_vga.c @@ -1200,7 +1200,6 @@ vga_init(struct vt_device *vd) if (vd->vd_softc == NULL) vd->vd_softc = (void *)&vga_conssoftc; sc = vd->vd_softc; - textmode = 0; #if defined(__amd64__) || defined(__i386__) sc->vga_fb_tag = X86_BUS_SPACE_MEM; @@ -1217,6 +1216,13 @@ vga_init(struct vt_device *vd) bus_space_map(sc->vga_reg_tag, VGA_REG_BASE, VGA_REG_SIZE, 0, &sc->vga_reg_handle); + /* + * If "hw.vga.textmode" is not set and we're running on hypervisor, + * we use text mode by default, this is because when we're on + * hypervisor, vt(4) is usually much slower in graphics mode than + * in text mode, especially when we're on Hyper-V. + */ + textmode = vm_guest != VM_GUEST_NO; TUNABLE_INT_FETCH("hw.vga.textmode", &textmode); if (textmode) { vd->vd_flags |= VDF_TEXTMODE; -- 2.45.0