From 6bf7fbb4144bdc701224764dcadc2336d4112687 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Imre=20Vad=C3=A1sz?= Date: Fri, 25 Nov 2016 01:26:32 +0100 Subject: [PATCH] syscons - Handle kms framebuffer activation better when not in text mode. * We shouldn't just silently remove the GRAPHICS_MODE or UNKNOWN_MODE flags, instead try to handle those cases a bit more graceful. * This avoid's Xorg's VT being silently switched back from UNKNOWN_MODE to text mode, when the drm driver module is automatically loaded while Xorg is starting. --- sys/dev/misc/syscons/scvidctl.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/dev/misc/syscons/scvidctl.c b/sys/dev/misc/syscons/scvidctl.c index 705241393e..250cf1b568 100644 --- a/sys/dev/misc/syscons/scvidctl.c +++ b/sys/dev/misc/syscons/scvidctl.c @@ -839,6 +839,9 @@ sc_update_render(scr_stat *scp) crit_enter(); scp->fbi = scp->sc->fbi; + /* Needed in case we are implicitly leaving PIXEL_MODE here */ + if (scp->model != V_INFO_MM_OTHER) + scp->model = V_INFO_MM_TEXT; rndr = NULL; if (strcmp(sw->te_renderer, "*") != 0) { rndr = sc_render_match(scp, sw->te_renderer, scp->model); @@ -873,9 +876,17 @@ sc_update_render(scr_stat *scp) } #endif prev_ysize = scp->ysize; - scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN; - scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE | MOUSE_VISIBLE); - scp->model = V_INFO_MM_TEXT; + scp->status |= MOUSE_HIDDEN; + if (scp->status & GRAPHICS_MODE) { + /* + * We don't handle GRAPHICS_MODE at all when using a KMS + * framebuffer, so silently switch to UNKNOWN_MODE then. + */ + scp->status |= UNKNOWN_MODE; + scp->status &= ~GRAPHICS_MODE; + } + /* Implicitly leave PIXEL_MODE, but stay in UNKNOWN mode */ + scp->status &= ~(PIXEL_MODE | MOUSE_VISIBLE); scp->xpixel = scp->fbi->width; scp->ypixel = scp->fbi->height; @@ -904,7 +915,6 @@ sc_update_render(scr_stat *scp) } #endif crit_exit(); - scp->status &= ~UNKNOWN_MODE; tp = VIRTUAL_TTY(scp->sc, scp->index); if (tp == NULL) return; -- 2.11.4.GIT