vserver 1.9.5.x5
[linux-2.6.git] / drivers / video / console / vgacon.c
index 0e91d6b..fb5d594 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 #include <video/vga.h>
 #include <asm/io.h>
 
-static spinlock_t vga_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(vga_lock);
+static int cursor_size_lastfrom;
+static int cursor_size_lastto;
 static struct vgastate state;
 
 #define BLANK 0x0020
@@ -408,17 +411,16 @@ static void vgacon_set_cursor_size(int xpos, int from, int to)
 {
        unsigned long flags;
        int curs, cure;
-       static int lastfrom, lastto;
 
 #ifdef TRIDENT_GLITCH
        if (xpos < 16)
                from--, to--;
 #endif
 
-       if ((from == lastfrom) && (to == lastto))
+       if ((from == cursor_size_lastfrom) && (to == cursor_size_lastto))
                return;
-       lastfrom = from;
-       lastto = to;
+       cursor_size_lastfrom = from;
+       cursor_size_lastto = to;
 
        spin_lock_irqsave(&vga_lock, flags);
        outb_p(0x0a, vga_video_port_reg);       /* Cursor start */
@@ -763,6 +765,7 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
                charmap += 4 * cmapsz;
 #endif
 
+       unlock_kernel();
        spin_lock_irq(&vga_lock);
        /* First, the Sequencer */
        vga_wseq(state->vgabase, VGA_SEQ_RESET, 0x1);
@@ -848,6 +851,7 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
                vga_wattr(state->vgabase, VGA_AR_ENABLE_DISPLAY, 0);    
        }
        spin_unlock_irq(&vga_lock);
+       lock_kernel();
        return 0;
 }
 
@@ -859,11 +863,6 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight)
        unsigned char ovr, vde, fsr;
        int rows, maxscan, i;
 
-       if (fontheight == vc->vc_font.height)
-               return 0;
-
-       vc->vc_font.height = fontheight;
-
        rows = vc->vc_scan_lines / fontheight;  /* Number of video rows we end up with */
        maxscan = rows * fontheight - 1;        /* Scan lines to actually display-1 */
 
@@ -901,8 +900,16 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight)
        for (i = 0; i < MAX_NR_CONSOLES; i++) {
                struct vc_data *c = vc_cons[i].d;
 
-               if (c && c->vc_sw == &vga_con)
+               if (c && c->vc_sw == &vga_con) {
+                       if (CON_IS_VISIBLE(c)) {
+                               /* void size to cause regs to be rewritten */
+                               cursor_size_lastfrom = 0;
+                               cursor_size_lastto = 0;
+                               c->vc_sw->con_cursor(c, CM_DRAW);
+                       }
+                       c->vc_font.height = fontheight;
                        vc_resize(c->vc_num, 0, rows);  /* Adjust console size */
+               }
        }
        return 0;
 }