<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 27, 2019 at 7:26 PM Christian Mauderer <<a href="mailto:list@c-mauderer.de">list@c-mauderer.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'm still not entirely convinced what VT does. I tried to remove it (had<br>
to remove the vt_fb_attach() / _detach() from fbd.c too) and it still<br>
works. So why do you need VT?<br>
<br></blockquote><div>I removed the VT commit and the app was not able to open the fb device,</div><div>if you can open the device with just removing the VT part from fbd, then</div><div>maybe some other part of the VT commit is necessary to open the device,</div><div>I'll have a look and report and try to see if minimum to no parts of vt is needed.</div><div>(We already removed most part from it, just initialization is there). </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
By the way: The fbd commits won't link without that one. So if you<br>
convince me that VT is necessary you _have_ to reorder or merge fbd and<br>
VT. We can't have any commits that don't compile. It would prevent to<br>
use tools like `git bisect`.<br>
<br></blockquote><div>OK. I will merge them into one FBD patch then and put them before the display</div><div>driver patch of am335x</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
On 26/07/2019 13:22, Vijay Kumar Banerjee wrote:<br>
> ---<br>
> freebsd/sys/dev/vt/colors/vt_termcolors.c | 2 ++<br>
> freebsd/sys/dev/vt/hw/fb/vt_fb.c | 2 ++<br>
> freebsd/sys/dev/vt/vt_core.c | 30 +++++++++++++++++++++++<br>
> libbsd.py | 3 +++<br>
> rtemsbsd/include/machine/vm.h | 1 +<br>
> 5 files changed, 38 insertions(+)<br>
> <br>
> diff --git a/freebsd/sys/dev/vt/colors/vt_termcolors.c b/freebsd/sys/dev/vt/colors/vt_termcolors.c<br>
> index c7ef4b80..6a3836c4 100644<br>
> --- a/freebsd/sys/dev/vt/colors/vt_termcolors.c<br>
> +++ b/freebsd/sys/dev/vt/colors/vt_termcolors.c<br>
> @@ -144,6 +144,7 @@ vt_palette_init(void)<br>
> for (i = 0; i < NCOLORS; i++) {<br>
> snprintf(tunable, sizeof(tunable),<br>
> "kern.vt.color.%d.rgb", i);<br>
> +#ifndef __rtems__<br>
> if (TUNABLE_STR_FETCH(tunable, rgb, sizeof(rgb))) {<br>
> if (vt_parse_rgb_triplet(rgb, &r, &g, &b) == 0) {<br>
> /* convert to percentages */<br>
> @@ -152,6 +153,7 @@ vt_palette_init(void)<br>
> color_def[i].b = b*100/255;<br>
> }<br>
> }<br>
> +#endif /* __rtems__ */> }<br>
> }<br>
> <br>
> diff --git a/freebsd/sys/dev/vt/hw/fb/vt_fb.c b/freebsd/sys/dev/vt/hw/fb/vt_fb.c<br>
> index 8eb2744b..c9544c06 100644<br>
> --- a/freebsd/sys/dev/vt/hw/fb/vt_fb.c<br>
> +++ b/freebsd/sys/dev/vt/hw/fb/vt_fb.c<br>
> @@ -51,10 +51,12 @@ static struct vt_driver vt_fb_driver = {<br>
> .vd_init = vt_fb_init,<br>
> .vd_fini = vt_fb_fini,<br>
> .vd_blank = vt_fb_blank,<br>
> +#ifndef __rtems__<br>
> .vd_bitblt_text = vt_fb_bitblt_text,<br>
> .vd_invalidate_text = vt_fb_invalidate_text,<br>
> .vd_bitblt_bmp = vt_fb_bitblt_bitmap,<br>
> .vd_drawrect = vt_fb_drawrect,<br>
> +#endif /* __rtems__ */<br>
> .vd_setpixel = vt_fb_setpixel,<br>
> .vd_postswitch = vt_fb_postswitch,<br>
> .vd_priority = VD_PRIORITY_GENERIC+10,> diff --git a/freebsd/sys/dev/vt/vt_core.c b/freebsd/sys/dev/vt/vt_core.c<br>
> index 5f2b1b0e..af0e47eb 100644<br>
> --- a/freebsd/sys/dev/vt/vt_core.c<br>
> +++ b/freebsd/sys/dev/vt/vt_core.c<br>
> @@ -47,7 +47,9 @@ __FBSDID("$FreeBSD$");<br>
> #include <sys/lock.h><br>
> #include <sys/malloc.h><br>
> #include <sys/mutex.h><br>
> +#ifndef __rtems__<br>
> #include <sys/power.h><br>
> +#endif /* __rtems__ */<br>
> #include <sys/priv.h><br>
> #include <sys/proc.h><br>
> #include <sys/random.h><br>
> @@ -83,6 +85,7 @@ static tc_opened_t vtterm_opened;<br>
> static tc_ioctl_t vtterm_ioctl;<br>
> static tc_mmap_t vtterm_mmap;<br>
> <br>
> +#ifndef __rtems__<br>
> const struct terminal_class vt_termclass = {<br>
> .tc_bell = vtterm_bell,<br>
> .tc_cursor = vtterm_cursor,<br>
> @@ -104,6 +107,7 @@ const struct terminal_class vt_termclass = {<br>
> .tc_ioctl = vtterm_ioctl,<br>
> .tc_mmap = vtterm_mmap,<br>
> };<br>
> +#endif /* __rtems__ */<br>
> <br>
> /*<br>
> * Use a constant timer of 25 Hz to redraw the screen.<br>
> @@ -129,6 +133,7 @@ static VT_SYSCTL_INT(debug, 0, "vt(9) debug level");<br>
> static VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode");<br>
> static VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend");<br>
> <br>
> +#ifndef __rtems__<br>
> /* Allow to disable some keyboard combinations. */<br>
> static VT_SYSCTL_INT(kbd_halt, 1, "Enable halt keyboard combination. "<br>
> "See kbdmap(5) to configure.");<br>
> @@ -149,11 +154,13 @@ VT_SYSCTL_INT(splash_ncpu, 0, "Override number of logos displayed "<br>
> VT_SYSCTL_INT(splash_cpu_style, 2, "Draw logo style "<br>
> "(0 = Alternate beastie, 1 = Beastie, 2 = Orb)");<br>
> VT_SYSCTL_INT(splash_cpu_duration, 10, "Hide logos after (seconds)");<br>
> +#endif /* __rtems__ */<br>
> <br>
> static unsigned int vt_unit = 0;<br>
> static MALLOC_DEFINE(M_VT, "vt", "vt device");<br>
> struct vt_device *main_vd = &vt_consdev;<br>
> <br>
> +#ifndef __rtems__<br>
> /* Boot logo. */<br>
> extern unsigned int vt_logo_width;<br>
> extern unsigned int vt_logo_height;<br>
> @@ -169,6 +176,7 @@ extern struct vt_font vt_font_default;<br>
> #ifndef SC_NO_CUTPASTE<br>
> extern struct vt_mouse_cursor vt_default_mouse_pointer;<br>
> #endif<br>
> +#endif /* __rtems__ */<br>
> <br>
> static int signal_vt_rel(struct vt_window *);<br>
> static int signal_vt_acq(struct vt_window *);<br>
> @@ -206,6 +214,7 @@ struct vt_device vt_consdev = {<br>
> .vd_windows = { [VT_CONSWINDOW] = &vt_conswindow, },<br>
> .vd_curwindow = &vt_conswindow,<br>
> .vd_kbstate = 0,<br>
> +#ifndef __rtems__<br>
> #ifndef SC_NO_CUTPASTE<br>
> .vd_pastebuf = {<br>
> .vpb_buf = NULL,<br>
> @@ -216,6 +225,7 @@ struct vt_device vt_consdev = {<br>
> .vd_mcursor_fg = TC_WHITE,<br>
> .vd_mcursor_bg = TC_BLACK,<br>
> #endif<br>
> +#endif /* __rtems__ */<br>
> <br>
> #ifndef SC_NO_CONSDRAWN<br>
> .vd_drawn = vt_consdrawn,<br>
> @@ -247,6 +257,7 @@ static struct vt_window vt_conswindow = {<br>
> .vw_kbdmode = K_XLATE,<br>
> .vw_grabbed = 0,<br>
> };<br>
> +#ifndef __rtems__<br>
> struct terminal vt_consterm = {<br>
> .tm_class = &vt_termclass,<br>
> .tm_softc = &vt_conswindow,<br>
> @@ -270,14 +281,17 @@ SYSINIT(vt_update_static, SI_SUB_KMEM, SI_ORDER_ANY, vt_update_static,<br>
> /* Delay until all devices attached, to not waste time. */<br>
> SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vt_upgrade,<br>
> &vt_consdev);<br>
> +#endif /* __rtems__ */<br>
> <br>
> /* Initialize locks/mem depended members. */<br>
> static void<br>
> vt_update_static(void *dummy)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (!vty_enabled(VTY_VT))<br>
> return;<br>
> +#endif /* __rtems__ */<br>
> if (main_vd->vd_driver != NULL)<br>
> printf("VT(%s): %s %ux%u\n", main_vd->vd_driver->vd_name,<br>
> (main_vd->vd_flags & VDF_TEXTMODE) ? "text" : "resolution",<br>
> @@ -339,6 +353,7 @@ vt_switch_timer(void *arg)<br>
> vt_late_window_switch((struct vt_window *)arg);<br>
> }<br>
> <br>
> +#ifndef __rtems__<br>
> static int<br>
> vt_save_kbd_mode(struct vt_window *vw, keyboard_t *kbd)<br>
> {<br>
> @@ -429,6 +444,7 @@ vt_update_kbd_leds(struct vt_window *vw, keyboard_t *kbd)<br>
> <br>
> return (ret);<br>
> }<br>
> +#endif /* __rtems__ */<br>
> <br>
> static int<br>
> vt_window_preswitch(struct vt_window *vw, struct vt_window *curvw)<br>
> @@ -454,6 +470,7 @@ vt_window_postswitch(struct vt_window *vw)<br>
> return (0);<br>
> }<br>
> <br>
> +#ifndef __rtems__<br>
> /* vt_late_window_switch will done VT switching for regular case. */<br>
> static int<br>
> vt_late_window_switch(struct vt_window *vw)<br>
> @@ -2832,6 +2849,7 @@ vt_replace_backend(const struct vt_driver *drv, void *softc)<br>
> */<br>
> termcn_cnregister(vd->vd_windows[VT_CONSWINDOW]->vw_terminal);<br>
> }<br>
> +#endif /* __rtems__ */<br>
> <br>
> static void<br>
> vt_suspend_handler(void *priv)<br>
> @@ -2859,8 +2877,10 @@ void<br>
> vt_allocate(const struct vt_driver *drv, void *softc)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (!vty_enabled(VTY_VT))<br>
> return;<br>
> +#endif /* __rtems__ */<br>
> <br>
> if (main_vd->vd_driver == NULL) {<br>
> main_vd->vd_driver = drv;<br>
> @@ -2880,15 +2900,19 @@ vt_allocate(const struct vt_driver *drv, void *softc)<br>
> main_vd->vd_driver->vd_name, drv->vd_name);<br>
> }<br>
> <br>
> +#ifndef __rtems__<br>
> vt_replace_backend(drv, softc);<br>
> +#endif /* __rtems__ */<br>
> }<br>
> <br>
> void<br>
> vt_deallocate(const struct vt_driver *drv, void *softc)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (!vty_enabled(VTY_VT))<br>
> return;<br>
> +#endif /* __rtems__ */<br>
> <br>
> if (main_vd->vd_prev_driver == NULL ||<br>
> main_vd->vd_driver != drv ||<br>
> @@ -2898,7 +2922,9 @@ vt_deallocate(const struct vt_driver *drv, void *softc)<br>
> printf("VT: Switching back from \"%s\" to \"%s\".\n",<br>
> main_vd->vd_driver->vd_name, main_vd->vd_prev_driver->vd_name);<br>
> <br>
> +#ifndef __rtems__<br>
> vt_replace_backend(NULL, NULL);<br>
> +#endif /* __rtems__ */<br>
> }<br>
> <br>
> void<br>
> @@ -2910,8 +2936,10 @@ vt_suspend(struct vt_device *vd)<br>
> return;<br>
> /* Save current window. */<br>
> vd->vd_savedwindow = vd->vd_curwindow;<br>
> +#ifndef __rtems__<br>
> /* Ask holding process to free window and switch to console window */<br>
> vt_proc_window_switch(vd->vd_windows[VT_CONSWINDOW]);<br>
> +#endif /* __rtems__ */<br>
> <br>
> /* Wait for the window switch to complete. */<br>
> error = 0;<br>
> @@ -2927,7 +2955,9 @@ vt_resume(struct vt_device *vd)<br>
> <br>
> if (vt_suspendswitch == 0)<br>
> return;<br>
> +#ifndef __rtems__<br>
> /* Switch back to saved window, if any */<br>
> vt_proc_window_switch(vd->vd_savedwindow);<br>
> +#endif /* __rtems__ */<br>
> vd->vd_savedwindow = NULL;<br>
> }<br>
> diff --git a/libbsd.py b/libbsd.py<br>
> index 71eb3577..775eeeac 100644<br>
> --- a/libbsd.py<br>
> +++ b/libbsd.py<br>
> @@ -825,6 +825,9 @@ class display(builder.Module):<br>
> 'sys/arm/ti/am335x/am335x_ecap.c',<br>
> 'sys/dev/fb/fb.c',<br>
> 'sys/dev/fb/fbd.c',<br>
> + 'sys/dev/vt/hw/fb/vt_fb.c',<br>
> + 'sys/dev/vt/vt_core.c',<br>
> + 'sys/dev/vt/colors/vt_termcolors.c',<br>
> ],<br>
> mm.generator['source']()<br>
> )<br>
> diff --git a/rtemsbsd/include/machine/vm.h b/rtemsbsd/include/machine/vm.h<br>
> index 351b7472..b90a4cf4 100644<br>
> --- a/rtemsbsd/include/machine/vm.h<br>
> +++ b/rtemsbsd/include/machine/vm.h<br>
> @@ -1,2 +1,3 @@<br>
> #define VM_MEMATTR_DEFAULT 0<br>
> #define VM_MEMATTR_UNCACHEABLE 1<br>
> +#define vtophys(a) (a)<br>
> <br>
</blockquote></div></div>