Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: sys/dev/vt/vt.h
- ===================================================================
- --- sys/dev/vt/vt.h (revision 266903)
- +++ sys/dev/vt/vt.h (working copy)
- @@ -259,6 +259,7 @@
- #define VWF_CONSOLE 0x8 /* Kernel message console window. */
- #define VWF_VTYLOCK 0x10 /* Prevent window switch. */
- #define VWF_MOUSE_HIDE 0x20 /* Disable mouse events processing. */
- +#define VWF_READY 0x40 /* Window fully initialized. */
- #define VWF_SWWAIT_REL 0x10000 /* Program wait for VT acquire is done. */
- #define VWF_SWWAIT_ACQ 0x20000 /* Program wait for VT release is done. */
- pid_t vw_pid; /* Terminal holding process */
- Index: sys/dev/vt/vt_core.c
- ===================================================================
- --- sys/dev/vt/vt_core.c (revision 266903)
- +++ sys/dev/vt/vt_core.c (working copy)
- @@ -120,9 +120,10 @@
- VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode");
- VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend");
- +static struct vt_device vt_consdev;
- static unsigned int vt_unit = 0;
- static MALLOC_DEFINE(M_VT, "vt", "vt device");
- -struct vt_device *main_vd = NULL;
- +struct vt_device *main_vd = &vt_consdev;
- /* Boot logo. */
- extern unsigned int vt_logo_width;
- @@ -214,12 +215,16 @@
- vt_update_static(void *dummy)
- {
- - if (main_vd != NULL) {
- - printf("VT: running with driver \"%s\".\n",
- - main_vd->vd_driver->vd_name);
- +// if (main_vd != NULL) {
- + if (main_vd->vd_driver != NULL)
- + printf("VT: running with driver \"%s\".\n",
- + main_vd->vd_driver->vd_name);
- + else
- + printf("VT: init without driver.\n");
- +
- mtx_init(&main_vd->vd_lock, "vtdev", NULL, MTX_DEF);
- cv_init(&main_vd->vd_winswitch, "vtwswt");
- - }
- +// }
- }
- static void
- @@ -633,11 +638,9 @@
- keyboard_t *k0, *k;
- keyboard_info_t ki;
- - idx0 = kbd_allocate("kbdmux", -1, (void *)&vd->vd_keyboard,
- - vt_kbdevent, vd);
- - /* XXX: kb_token lost */
- + idx0 = kbd_allocate("kbdmux", -1, vd, vt_kbdevent, vd);
- vd->vd_keyboard = idx0;
- - if (idx0 != -1) {
- + if (idx0 >= 0) {
- DPRINTF(20, "%s: kbdmux allocated, idx = %d\n", __func__, idx0);
- k0 = kbd_get_keyboard(idx0);
- @@ -657,8 +660,11 @@
- }
- } else {
- DPRINTF(20, "%s: no kbdmux allocated\n", __func__);
- - idx0 = kbd_allocate("*", -1, (void *)&vd->vd_keyboard,
- - vt_kbdevent, vd);
- + idx0 = kbd_allocate("*", -1, vd, vt_kbdevent, vd);
- + if (idx0 < 0) {
- + DPRINTF(10, "%s: No keyboard found.\n", __func__);
- + return (-1);
- + }
- }
- DPRINTF(20, "%s: vd_keyboard = %d\n", __func__, vd->vd_keyboard);
- @@ -970,15 +976,17 @@
- if (vtdbest == NULL) {
- cp->cn_pri = CN_DEAD;
- vd->vd_flags |= VDF_DEAD;
- - return;
- +// return;
- }
- - vd->vd_driver = vtdbest;
- + if (vtdbest != NULL) {
- + vd->vd_driver = vtdbest;
- + cp->cn_pri = vd->vd_driver->vd_init(vd);
- + }
- - cp->cn_pri = vd->vd_driver->vd_init(vd);
- if (cp->cn_pri == CN_DEAD) {
- vd->vd_flags |= VDF_DEAD;
- - return;
- +// return;
- }
- /* Initialize any early-boot keyboard drivers */
- @@ -995,12 +1003,14 @@
- vt_winsize(vd, vw->vw_font, &wsz);
- terminal_set_winsize(tm, &wsz);
- + if (vtdbest != NULL) {
- #ifdef DEV_SPLASH
- - vtterm_splash(vd);
- + vtterm_splash(vd);
- #endif
- - vd->vd_flags |= VDF_INITIALIZED;
- - main_vd = vd;
- + vd->vd_flags |= VDF_INITIALIZED;
- + }
- +// main_vd = vd;
- }
- static int
- @@ -1988,28 +1998,27 @@
- unsigned int i;
- /* Device didn't pass vd_init() or already upgraded. */
- - if (vd->vd_flags & (VDF_ASYNC|VDF_DEAD)) {
- - /* Refill settings with new sizes anyway. */
- - vt_resize(vd);
- - return;
- - }
- - vd->vd_flags |= VDF_ASYNC;
- -
- +// if (vd->vd_flags & (VDF_ASYNC|VDF_DEAD)) {
- +// /* Refill settings with new sizes anyway. */
- +// vt_resize(vd);
- +// return;
- +// }
- for (i = 0; i < VT_MAXWINDOWS; i++) {
- vw = vd->vd_windows[i];
- if (vw == NULL) {
- /* New window. */
- vw = vt_allocate_window(vd, i);
- - } else if (vw->vw_flags & VWF_CONSOLE) {
- - /* For existing console window. */
- + }
- + if (!(vw->vw_flags & VWF_READY)) {
- callout_init(&vw->vw_proc_dead_timer, 0);
- + terminal_maketty(vw->vw_terminal, "v%r", VT_UNIT(vw));
- + vw->vw_flags |= VWF_READY;
- + if (vw->vw_flags & VWF_CONSOLE) {
- + /* For existing console window. */
- + EVENTHANDLER_REGISTER(shutdown_pre_sync,
- + vt_window_switch, vw, SHUTDOWN_PRI_DEFAULT);
- + }
- }
- - if (i == VT_CONSWINDOW) {
- - /* Console window. */
- - EVENTHANDLER_REGISTER(shutdown_pre_sync,
- - vt_window_switch, vw, SHUTDOWN_PRI_DEFAULT);
- - }
- - terminal_maketty(vw->vw_terminal, "v%r", VT_UNIT(vw));
- }
- VT_LOCK(vd);
- @@ -2016,15 +2025,19 @@
- if (vd->vd_curwindow == NULL)
- vd->vd_curwindow = vd->vd_windows[VT_CONSWINDOW];
- + if (!(vd->vd_flags & VDF_ASYNC)) {
- /* Attach keyboard. */
- vt_allocate_keyboard(vd);
- DPRINTF(20, "%s: vd_keyboard = %d\n", __func__, vd->vd_keyboard);
- - /* Init 25 Hz timer. */
- - callout_init_mtx(&vd->vd_timer, &vd->vd_lock, 0);
- + /* Init 25 Hz timer. */
- + callout_init_mtx(&vd->vd_timer, &vd->vd_lock, 0);
- - /* Start timer when everything ready. */
- - callout_reset(&vd->vd_timer, hz / VT_TIMERFREQ, vt_timer, vd);
- + /* Start timer when everything ready. */
- + vd->vd_flags |= VDF_ASYNC;
- + callout_reset(&vd->vd_timer, hz / VT_TIMERFREQ, vt_timer, vd);
- + }
- +
- VT_UNLOCK(vd);
- /* Refill settings with new sizes. */
- @@ -2055,18 +2068,24 @@
- struct vt_device *vd;
- struct winsize wsz;
- - if (main_vd == NULL) {
- - main_vd = malloc(sizeof *vd, M_VT, M_WAITOK|M_ZERO);
- - printf("VT: initialize with new VT driver \"%s\".\n",
- - drv->vd_name);
- - mtx_init(&main_vd->vd_lock, "vtdev", NULL, MTX_DEF);
- - cv_init(&main_vd->vd_winswitch, "vtwswt");
- -
- - } else {
- +// if (main_vd == NULL) {
- +// main_vd = malloc(sizeof *vd, M_VT, M_WAITOK|M_ZERO);
- +// printf("VT: initialize with new VT driver \"%s\".\n",
- +// drv->vd_name);
- +// mtx_init(&main_vd->vd_lock, "vtdev", NULL, MTX_DEF);
- +// cv_init(&main_vd->vd_winswitch, "vtwswt");
- +//
- +// } else {
- /*
- * Check if have rights to replace current driver. For example:
- * it is bad idea to replace KMS driver with generic VGA one.
- */
- + if (main_vd->vd_driver == NULL) {
- + main_vd->vd_driver = drv;
- + printf("VT: initialize with new VT driver \"%s\".\n",
- + drv->vd_name);
- + } else {
- +
- if (drv->vd_priority <= main_vd->vd_driver->vd_priority) {
- printf("VT: Driver priority %d too low. Current %d\n ",
- drv->vd_priority, main_vd->vd_driver->vd_priority);
- @@ -2075,6 +2094,8 @@
- printf("VT: Replacing driver \"%s\" with new \"%s\".\n",
- main_vd->vd_driver->vd_name, drv->vd_name);
- }
- +
- +// }
- vd = main_vd;
- VT_LOCK(vd);
- if (drv->vd_maskbitbltchr == NULL)
- @@ -2117,7 +2138,8 @@
- /* Update console window sizes to actual. */
- vt_winsize(vd, vd->vd_windows[VT_CONSWINDOW]->vw_font, &wsz);
- - terminal_set_winsize(vd->vd_windows[VT_CONSWINDOW]->vw_terminal, &wsz);
- + terminal_set_winsize_blank(vd->vd_windows[VT_CONSWINDOW]->vw_terminal,
- + &wsz, 0);
- }
- void
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement