Commit f0c7d2b72ad1a694c0c886a14cc708841181e9bd

Authored by Francisco Jerez
Committed by Linus Torvalds
1 parent 2ddce3fd0a

vgacon: prevent vgacon_deinit from touching the hardware for inactive consoles.

fbcon makes the (reasonable) assumption that it only needs to program the
hardware once, when fbcon_init() is called for the foreground console.

This doesn't always play well with vgacon because vgacon_deinit() is only
doing its job when the last console it owns is closed (when switching from
vgacon to fbcon, that's usually *after* fbcon_init() has set the new
mode).

Depending on the hardware this can cause the wrong framebuffer location to
be scanned out (e.g.  reproduced on nv05 with the nouveau framebuffer
driver).

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 5 additions and 3 deletions Side-by-side Diff

drivers/video/console/vgacon.c
... ... @@ -589,12 +589,14 @@
589 589  
590 590 static void vgacon_deinit(struct vc_data *c)
591 591 {
592   - /* When closing the last console, reset video origin */
593   - if (!--vgacon_uni_pagedir[1]) {
  592 + /* When closing the active console, reset video origin */
  593 + if (CON_IS_VISIBLE(c)) {
594 594 c->vc_visible_origin = vga_vram_base;
595 595 vga_set_mem_top(c);
596   - con_free_unimap(c);
597 596 }
  597 +
  598 + if (!--vgacon_uni_pagedir[1])
  599 + con_free_unimap(c);
598 600 c->vc_uni_pagedir_loc = &c->vc_uni_pagedir;
599 601 con_set_default_unimap(c);
600 602 }