From 3cd1542caff83756ef0be67064a8a5d596f93082 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Tue, 12 May 2020 21:01:41 +0200
Subject: [PATCH 1/5] kernel/syscons: Rename kms renderer to lfb renderer
 (linear frame buffer).

---
 .../misc/syscons/{sckmsrndr.c => sclfbrndr.c} | 78 +++++++++----------
 sys/dev/misc/syscons/scvidctl.c               | 12 +--
 sys/dev/misc/syscons/syscons.c                |  8 +-
 sys/platform/pc64/conf/files                  |  2 +-
 4 files changed, 50 insertions(+), 50 deletions(-)
 rename sys/dev/misc/syscons/{sckmsrndr.c => sclfbrndr.c} (90%)

diff --git a/sys/dev/misc/syscons/sckmsrndr.c b/sys/dev/misc/syscons/sclfbrndr.c
similarity index 90%
rename from sys/dev/misc/syscons/sckmsrndr.c
rename to sys/dev/misc/syscons/sclfbrndr.c
index 5555943100..fc301e7762 100644
--- a/sys/dev/misc/syscons/sckmsrndr.c
+++ b/sys/dev/misc/syscons/sclfbrndr.c
@@ -43,43 +43,43 @@
 
 #include <bus/isa/isareg.h>
 
-static vr_draw_border_t		kms_draw_border;
-static vr_draw_t		kms_draw;
-static vr_draw_cursor_t		kms_cursor;
-static vr_blink_cursor_t	kms_blink;
+static vr_draw_border_t		lfb_draw_border;
+static vr_draw_t		lfb_draw;
+static vr_draw_cursor_t		lfb_cursor;
+static vr_blink_cursor_t	lfb_blink;
 #ifndef SC_NO_CUTPASTE
-static vr_draw_mouse_t		kms_mouse;
+static vr_draw_mouse_t		lfb_mouse;
 #endif
 
-static void			kms_nop(scr_stat *scp, ...);
+static void			lfb_nop(scr_stat *scp, ...);
 
-static sc_rndr_sw_t kmsrndrsw = {
-	kms_draw_border,
-	kms_draw,
-	(vr_set_cursor_t *)kms_nop,
-	kms_cursor,
-	kms_blink,
+static sc_rndr_sw_t lfbrndrsw = {
+	lfb_draw_border,
+	lfb_draw,
+	(vr_set_cursor_t *)lfb_nop,
+	lfb_cursor,
+	lfb_blink,
 #ifndef SC_NO_CUTPASTE
-	kms_mouse,
+	lfb_mouse,
 #else
-	(vr_draw_mouse_t *)kms_nop,
+	(vr_draw_mouse_t *)lfb_nop,
 #endif
 };
-RENDERER(kms, V_INFO_MM_TEXT, kmsrndrsw, kms_set);
+RENDERER(lfb, V_INFO_MM_TEXT, lfbrndrsw, lfb_set);
 
 #ifndef SC_NO_MODE_CHANGE
 static sc_rndr_sw_t grrndrsw = {
-	(vr_draw_border_t *)kms_nop,
-	(vr_draw_t *)kms_nop,
-	(vr_set_cursor_t *)kms_nop,
-	(vr_draw_cursor_t *)kms_nop,
-	(vr_blink_cursor_t *)kms_nop,
-	(vr_draw_mouse_t *)kms_nop,
+	(vr_draw_border_t *)lfb_nop,
+	(vr_draw_t *)lfb_nop,
+	(vr_set_cursor_t *)lfb_nop,
+	(vr_draw_cursor_t *)lfb_nop,
+	(vr_blink_cursor_t *)lfb_nop,
+	(vr_draw_mouse_t *)lfb_nop,
 };
-RENDERER(kms, V_INFO_MM_OTHER, grrndrsw, kms_set);
+RENDERER(lfb, V_INFO_MM_OTHER, grrndrsw, lfb_set);
 #endif /* SC_NO_MODE_CHANGE */
 
-RENDERER_MODULE(kms, kms_set);
+RENDERER_MODULE(lfb, lfb_set);
 
 static uint32_t colormap[16] = {
 	0x00000000,	/* BLACK */
@@ -112,7 +112,7 @@ static u_short mouse_or_mask[16] = {
 #endif
 
 static void
-kms_nop(scr_stat *scp, ...)
+lfb_nop(scr_stat *scp, ...)
 {
 }
 
@@ -328,10 +328,10 @@ fill_rect24(scr_stat *scp, vm_offset_t draw_pos, int width, int height,
 	}
 }
 
-/* KMS renderer */
+/* LFB renderer */
 
 static void
-kms_draw_border(scr_stat *scp, int color)
+lfb_draw_border(scr_stat *scp, int color)
 {
 	sc_softc_t *sc = scp->sc;
 	int line_width, pixel_size;
@@ -371,7 +371,7 @@ kms_draw_border(scr_stat *scp, int color)
 }
 
 static void
-kms_draw(scr_stat *scp, int from, int count, int flip)
+lfb_draw(scr_stat *scp, int from, int count, int flip)
 {
 	sc_softc_t *sc = scp->sc;
 	u_char *char_data;
@@ -426,7 +426,7 @@ kms_draw(scr_stat *scp, int from, int count, int flip)
 }
 
 static void
-draw_kmscursor(scr_stat *scp, int at, int on, int flip)
+draw_lfbcursor(scr_stat *scp, int at, int on, int flip)
 {
 	sc_softc_t *sc = scp->sc;
 	int line_width, pixel_size;
@@ -483,7 +483,7 @@ draw_kmscursor(scr_stat *scp, int at, int on, int flip)
 static int pxlblinkrate = 0;
 
 static void
-kms_cursor(scr_stat *scp, int at, int blink, int on, int flip)
+lfb_cursor(scr_stat *scp, int at, int blink, int on, int flip)
 {
 	if (scp->cursor_height <= 0)	/* the text cursor is disabled */
 		return;
@@ -491,16 +491,16 @@ kms_cursor(scr_stat *scp, int at, int blink, int on, int flip)
 	if (on) {
 		if (!blink) {
 			scp->status |= VR_CURSOR_ON;
-			draw_kmscursor(scp, at, on, flip);
+			draw_lfbcursor(scp, at, on, flip);
 		} else if (++pxlblinkrate & 4) {
 			pxlblinkrate = 0;
 			scp->status ^= VR_CURSOR_ON;
-			draw_kmscursor(scp, at,
+			draw_lfbcursor(scp, at,
 			    scp->status & VR_CURSOR_ON, flip);
 		}
 	} else {
 		if (scp->status & VR_CURSOR_ON)
-			draw_kmscursor(scp, at, on, flip);
+			draw_lfbcursor(scp, at, on, flip);
 		scp->status &= ~VR_CURSOR_ON;
 	}
 	if (blink)
@@ -510,7 +510,7 @@ kms_cursor(scr_stat *scp, int at, int blink, int on, int flip)
 }
 
 static void
-kms_blink(scr_stat *scp, int at, int flip)
+lfb_blink(scr_stat *scp, int at, int flip)
 {
 	if (!(scp->status & VR_CURSOR_BLINK))
 		return;
@@ -518,13 +518,13 @@ kms_blink(scr_stat *scp, int at, int flip)
 		return;
 	pxlblinkrate = 0;
 	scp->status ^= VR_CURSOR_ON;
-	draw_kmscursor(scp, at, scp->status & VR_CURSOR_ON, flip);
+	draw_lfbcursor(scp, at, scp->status & VR_CURSOR_ON, flip);
 }
 
 #ifndef SC_NO_CUTPASTE
 
 static void
-draw_kmsmouse(scr_stat *scp, int x, int y)
+draw_lfbmouse(scr_stat *scp, int x, int y)
 {
 	sc_softc_t *sc = scp->sc;
 	int line_width, pixel_size;
@@ -569,7 +569,7 @@ draw_kmsmouse(scr_stat *scp, int x, int y)
 }
 
 static void
-remove_kmsmouse(scr_stat *scp, int x, int y)
+remove_lfbmouse(scr_stat *scp, int x, int y)
 {
 	int col, row;
 	int pos;
@@ -586,12 +586,12 @@ remove_kmsmouse(scr_stat *scp, int x, int y)
 }
 
 static void
-kms_mouse(scr_stat *scp, int x, int y, int on)
+lfb_mouse(scr_stat *scp, int x, int y, int on)
 {
 	if (on)
-		draw_kmsmouse(scp, x, y);
+		draw_lfbmouse(scp, x, y);
 	else
-		remove_kmsmouse(scp, x, y);
+		remove_lfbmouse(scp, x, y);
 }
 
 #endif /* SC_NO_CUTPASTE */
diff --git a/sys/dev/misc/syscons/scvidctl.c b/sys/dev/misc/syscons/scvidctl.c
index 3ca7c041ff..7e07886d20 100644
--- a/sys/dev/misc/syscons/scvidctl.c
+++ b/sys/dev/misc/syscons/scvidctl.c
@@ -116,7 +116,7 @@ sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
     }
 
     if (scp->sc->fbi != NULL &&
-	sc_render_match(scp, "kms", V_INFO_MM_TEXT) == NULL) {
+	sc_render_match(scp, "lfb", V_INFO_MM_TEXT) == NULL) {
 	lwkt_reltoken(&vga_token);
 	return ENODEV;
     }
@@ -207,7 +207,7 @@ sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode)
     }
 
     if (scp->sc->fbi != NULL &&
-	sc_render_match(scp, "kms", V_INFO_MM_OTHER) == NULL) {
+	sc_render_match(scp, "lfb", V_INFO_MM_OTHER) == NULL) {
 	crit_exit();
 	return ENODEV;
     }
@@ -519,7 +519,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag)
     case CONS_MODEINFO:		/* get mode information */
     case FBIO_MODEINFO:
 	if (scp->sc->fbi != NULL) {
-	    /* Fabricate some mode information for KMS framebuffer */
+	    /* Fabricate some mode information for LFB framebuffer */
 	    video_info_t *vinfo = (video_info_t *)data;
 	    vinfo->vi_mode = 0;
 	    vinfo->vi_flags = V_INFO_COLOR;
@@ -886,7 +886,7 @@ sc_update_render(scr_stat *scp)
 		rndr = sc_render_match(scp, sw->te_renderer, scp->model);
 	}
 	if (rndr == NULL && scp->sc->fbi != NULL) {
-		rndr = sc_render_match(scp, "kms", scp->model);
+		rndr = sc_render_match(scp, "lfb", scp->model);
 	}
 	if (rndr == NULL) {	/* this shouldn't happen */
 		rndr = sc_render_match(scp, scp->sc->adp->va_name, scp->model);
@@ -918,7 +918,7 @@ sc_update_render(scr_stat *scp)
 	scp->status |= MOUSE_HIDDEN;
 	if (scp->status & GRAPHICS_MODE) {
 		/*
-		 * We don't handle GRAPHICS_MODE at all when using a KMS
+		 * We don't handle GRAPHICS_MODE at all when using a LFB
 		 * framebuffer, so silently switch to UNKNOWN_MODE then.
 		 */
 		scp->status |= UNKNOWN_MODE;
@@ -934,7 +934,7 @@ sc_update_render(scr_stat *scp)
 	 */
 	sc_font_scale(scp, 0, 0);
 
-	DPRINTF(1, ("kms console: scale-to %dx%d cols=%d rows=%d\n",
+	DPRINTF(1, ("lfb console: scale-to %dx%d cols=%d rows=%d\n",
 		scp->blk_width, scp->blk_height, scp->xsize, scp->ysize));
 
 	/* allocate buffers */
diff --git a/sys/dev/misc/syscons/syscons.c b/sys/dev/misc/syscons/syscons.c
index e7645ed405..f0a2155132 100644
--- a/sys/dev/misc/syscons/syscons.c
+++ b/sys/dev/misc/syscons/syscons.c
@@ -337,7 +337,7 @@ register_framebuffer(struct fb_info *info)
 		return 0;
 	}
 
-	/* Ignore this framebuffer if we already switched to KMS framebuffer */
+	/* Ignore this framebuffer if we already switched to LFB framebuffer */
 	if (sc->fbi != NULL && sc->fbi != &efi_fb_info &&
 	    sc->fbi != sc->dummy_fb_info) {
 		lwkt_reltoken(&vga_token);
@@ -370,7 +370,7 @@ register_framebuffer(struct fb_info *info)
 	sc->fbi_generation++;
 	syscons_unlock();
 
-	kprintf("kms console: xpixels %d ypixels %d\n",
+	kprintf("lfb console: xpixels %d ypixels %d\n",
 	    sc->fbi->width, sc->fbi->height);
 	sc_update_render(sc->cur_scp);
 	if (info->fbops.fb_set_par != NULL)
@@ -3083,7 +3083,7 @@ exchange_scr(sc_softc_t *sc)
 	sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, scp->xsize, scp->ysize,
 		    (void *)sc->adp->va_window, FALSE);
     scp->status |= MOUSE_HIDDEN;
-    sc_update_render(scp);     /* Switch to kms renderer if necessary */
+    sc_update_render(scp);     /* Switch to lfb renderer if necessary */
     sc_move_cursor(scp, scp->xpos, scp->ypos);
     if (!ISGRAPHSC(scp))
 	sc_set_cursor_image(scp);
@@ -3717,7 +3717,7 @@ sc_init_emulator(scr_stat *scp, char *name)
 	rndr = sc_render_match(scp, sw->te_renderer, scp->model);
     }
     if (rndr == NULL && scp->sc->fbi != NULL) {
-	rndr = sc_render_match(scp, "kms", scp->model);
+	rndr = sc_render_match(scp, "lfb", scp->model);
     }
     if (rndr == NULL) {
 	rndr = sc_render_match(scp, scp->sc->adp->va_name, scp->model);
diff --git a/sys/platform/pc64/conf/files b/sys/platform/pc64/conf/files
index 946d672ff4..d8669e39d3 100644
--- a/sys/platform/pc64/conf/files
+++ b/sys/platform/pc64/conf/files
@@ -99,7 +99,7 @@ dev/misc/kbd/kbdsw.c			optional	atkbd
 dev/misc/kbd/kbdsw.c			optional	sc
 dev/misc/kbd/kbdsw.c			optional	ukbd
 dev/misc/syscons/schistory.c		optional	sc
-dev/misc/syscons/sckmsrndr.c		optional	sc
+dev/misc/syscons/sclfbrndr.c		optional	sc
 dev/misc/syscons/scmouse.c		optional	sc
 dev/misc/syscons/scterm.c		optional	sc
 dev/misc/syscons/scterm-dumb.c		optional	sc
-- 
2.28.0

