Introduce a new VT mode KD_TRANSPARENT which endevours to leave the current
content of the framebuffer untouched. This allows the bootloader to insert
a graphical splash and have the kernel maintain it until the OS splash
can take over. When we finally switch away (either through programs like
plymouth or manually) the content is lost and the VT reverts to text mode.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
#include <linux/uaccess.h>
#include <linux/kdb.h>
#include <linux/ctype.h>
#include <linux/uaccess.h>
#include <linux/kdb.h>
#include <linux/ctype.h>
+#include <linux/screen_info.h>
#define MAX_NR_CON_DRIVER 16
#define MAX_NR_CON_DRIVER 16
static int con_open(struct tty_struct *, struct file *);
static void vc_init(struct vc_data *vc, unsigned int rows,
static int con_open(struct tty_struct *, struct file *);
static void vc_init(struct vc_data *vc, unsigned int rows,
- unsigned int cols, int do_clear);
+ unsigned int cols, int do_clear, int mode);
static void gotoxy(struct vc_data *vc, int new_x, int new_y);
static void save_cur(struct vc_data *vc);
static void reset_terminal(struct vc_data *vc, int do_clear);
static void gotoxy(struct vc_data *vc, int new_x, int new_y);
static void save_cur(struct vc_data *vc);
static void reset_terminal(struct vc_data *vc, int do_clear);
static int cur_default = CUR_DEFAULT;
module_param(cur_default, int, S_IRUGO | S_IWUSR);
static int cur_default = CUR_DEFAULT;
module_param(cur_default, int, S_IRUGO | S_IWUSR);
+int vt_handoff = -1;
+module_param_named(handoff, vt_handoff, int, S_IRUGO | S_IWUSR);
+
/*
* ignore_poke: don't unblank the screen when things are typed. This is
* mainly for the privacy of braille terminal users.
/*
* ignore_poke: don't unblank the screen when things are typed. This is
* mainly for the privacy of braille terminal users.
}
if (tty0dev)
sysfs_notify(&tty0dev->kobj, NULL, "active");
}
if (tty0dev)
sysfs_notify(&tty0dev->kobj, NULL, "active");
+ /*
+ * If we are switching away from a transparent VT the contents
+ * will be lost, convert it into a blank text console then
+ * it will be repainted blank if we ever switch back.
+ */
+ if (old_vc->vc_mode == KD_TRANSPARENT)
+ old_vc->vc_mode = KD_TEXT;
} else {
hide_cursor(vc);
redraw = 1;
} else {
hide_cursor(vc);
redraw = 1;
if (global_cursor_default == -1)
global_cursor_default = 1;
if (global_cursor_default == -1)
global_cursor_default = 1;
- vc_init(vc, vc->vc_rows, vc->vc_cols, 1);
+ vc_init(vc, vc->vc_rows, vc->vc_cols, 1, KD_TEXT);
vcs_make_sysfs(currcons);
atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, ¶m);
}
vcs_make_sysfs(currcons);
atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, ¶m);
}
module_param_named(underline, default_underline_color, int, S_IRUGO | S_IWUSR);
static void vc_init(struct vc_data *vc, unsigned int rows,
module_param_named(underline, default_underline_color, int, S_IRUGO | S_IWUSR);
static void vc_init(struct vc_data *vc, unsigned int rows,
- unsigned int cols, int do_clear)
+ unsigned int cols, int do_clear, int mode)
set_origin(vc);
vc->vc_pos = vc->vc_origin;
set_origin(vc);
vc->vc_pos = vc->vc_origin;
for (j=k=0; j<16; j++) {
vc->vc_palette[k++] = default_red[j] ;
vc->vc_palette[k++] = default_grn[j] ;
for (j=k=0; j<16; j++) {
vc->vc_palette[k++] = default_red[j] ;
vc->vc_palette[k++] = default_grn[j] ;
mod_timer(&console_timer, jiffies + (blankinterval * HZ));
}
mod_timer(&console_timer, jiffies + (blankinterval * HZ));
}
+ if (vt_handoff >= 0) {
+ currcons = vt_handoff;
+ vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
+ INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
+ visual_init(vc, currcons, 1);
+ vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
+ vc_init(vc, vc->vc_rows, vc->vc_cols, 0, KD_TRANSPARENT);
+ }
for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
+ if (currcons == vt_handoff)
+ continue;
vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
tty_port_init(&vc->port);
visual_init(vc, currcons, 1);
vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
vc_init(vc, vc->vc_rows, vc->vc_cols,
vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
tty_port_init(&vc->port);
visual_init(vc, currcons, 1);
vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
vc_init(vc, vc->vc_rows, vc->vc_cols,
- currcons || !vc->vc_sw->con_save_screen);
+ currcons || !vc->vc_sw->con_save_screen, KD_TEXT);
}
currcons = fg_console = 0;
}
currcons = fg_console = 0;
+ if (vt_handoff >= 0) {
+ printk(KERN_INFO "vt handoff: transparent VT on %d\n",
+ vt_handoff);
+ currcons = fg_console = vt_handoff;
+ }
master_display_fg = vc = vc_cons[currcons].d;
set_origin(vc);
save_screen(vc);
master_display_fg = vc = vc_cons[currcons].d;
set_origin(vc);
save_screen(vc);
-void reset_vc(struct vc_data *vc)
+void reset_vc(struct vc_data *vc, int mode)
kbd_table[vc->vc_num].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
vc->vt_mode.mode = VT_AUTO;
vc->vt_mode.waitv = 0;
kbd_table[vc->vc_num].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
vc->vt_mode.mode = VT_AUTO;
vc->vt_mode.waitv = 0;
*/
if (tty)
__do_SAK(tty);
*/
if (tty)
__do_SAK(tty);
* this outside of VT_PROCESS but there is no single process
* to account for and tracking tty count may be undesirable.
*/
* this outside of VT_PROCESS but there is no single process
* to account for and tracking tty count may be undesirable.
*/
if (old_vc_mode != vc->vc_mode) {
if (vc->vc_mode == KD_TEXT)
if (old_vc_mode != vc->vc_mode) {
if (vc->vc_mode == KD_TEXT)
* this outside of VT_PROCESS but there is no single process
* to account for and tracking tty count may be undesirable.
*/
* this outside of VT_PROCESS but there is no single process
* to account for and tracking tty count may be undesirable.
*/
/*
* Fall through to normal (VT_AUTO) handling of the switch...
/*
* Fall through to normal (VT_AUTO) handling of the switch...
#define KD_GRAPHICS 0x01
#define KD_TEXT0 0x02 /* obsolete */
#define KD_TEXT1 0x03 /* obsolete */
#define KD_GRAPHICS 0x01
#define KD_TEXT0 0x02 /* obsolete */
#define KD_TEXT1 0x03 /* obsolete */
+#define KD_TRANSPARENT 0x04
#define KDGETMODE 0x4B3B /* get current mode */
#define KDMAPDISP 0x4B3C /* map display into address space */
#define KDGETMODE 0x4B3B /* get current mode */
#define KDMAPDISP 0x4B3C /* map display into address space */
void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
int vt_waitactive(int n);
void change_console(struct vc_data *new_vc);
void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
int vt_waitactive(int n);
void change_console(struct vc_data *new_vc);
-void reset_vc(struct vc_data *vc);
+void reset_vc(struct vc_data *vc, int mode);
extern int unbind_con_driver(const struct consw *csw, int first, int last,
int deflt);
int vty_init(const struct file_operations *console_fops);
extern int unbind_con_driver(const struct consw *csw, int first, int last,
int deflt);
int vty_init(const struct file_operations *console_fops);