From 1dc72d368188ff78be062e3ea23f6fd088057df2 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 18 Jun 2013 20:19:09 +0000 Subject: [PATCH] On some generations of the Intel GPU, disabling of the VGA Display stops updating the vertical retrace indicator. The text mouse renderer in syscons is executing from the callout and spins waiting for the start of next frame. As result, after the X server finishes, since the VGA cannot be turned on, but syscons does not know about this, the clock swi spins forever. Hack around the problem by disabling wait for the retrace if KMS is activated. Diagnosed and tested by: Michiel Boland Sponsored by: The FreeBSD Foundation MFC after: 2 weeks --- sys/dev/drm2/i915/intel_fb.c | 3 +++ sys/dev/syscons/scvgarndr.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/dev/drm2/i915/intel_fb.c b/sys/dev/drm2/i915/intel_fb.c index 3cb3b787c60..e41a49fe0d4 100644 --- a/sys/dev/drm2/i915/intel_fb.c +++ b/sys/dev/drm2/i915/intel_fb.c @@ -207,6 +207,8 @@ static void intel_fbdev_destroy(struct drm_device *dev, } } +extern int sc_txtmouse_no_retrace_wait; + int intel_fbdev_init(struct drm_device *dev) { struct intel_fbdev *ifbdev; @@ -229,6 +231,7 @@ int intel_fbdev_init(struct drm_device *dev) drm_fb_helper_single_add_all_connectors(&ifbdev->helper); drm_fb_helper_initial_config(&ifbdev->helper, 32); + sc_txtmouse_no_retrace_wait = 1; return 0; } diff --git a/sys/dev/syscons/scvgarndr.c b/sys/dev/syscons/scvgarndr.c index 6e6663c27fc..fc7f02f58fe 100644 --- a/sys/dev/syscons/scvgarndr.c +++ b/sys/dev/syscons/scvgarndr.c @@ -395,6 +395,8 @@ vga_txtblink(scr_stat *scp, int at, int flip) { } +int sc_txtmouse_no_retrace_wait; + #ifndef SC_NO_CUTPASTE static void @@ -445,7 +447,9 @@ draw_txtmouse(scr_stat *scp, int x, int y) #if 1 /* wait for vertical retrace to avoid jitter on some videocards */ crtc_addr = scp->sc->adp->va_crtc_addr; - while (!(inb(crtc_addr + 6) & 0x08)) /* idle */ ; + while (!sc_txtmouse_no_retrace_wait && + !(inb(crtc_addr + 6) & 0x08)) + /* idle */ ; #endif c = scp->sc->mouse_char; vidd_load_font(scp->sc->adp, 0, 32, 8, font_buf, c, 4);