Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Apr 2026 21:36:48 +0000
From:      Ahmad Khalifa <vexeduxr@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d1854272b646 - main - vt_core: make sure the driver's functions exist
Message-ID:  <69ed33f0.3cdd0.4427224c@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by vexeduxr:

URL: https://cgit.FreeBSD.org/src/commit/?id=d1854272b646306de6546f8e5702e8072051d7f6

commit d1854272b646306de6546f8e5702e8072051d7f6
Author:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
AuthorDate: 2026-04-20 20:15:00 +0000
Commit:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
CommitDate: 2026-04-25 21:35:08 +0000

    vt_core: make sure the driver's functions exist
    
    These are NULL if they're not implemented. Make sure all the functions
    we need are there before doing anything.
    
    Also invert the first if statment to lessen the indentation a bit.
    
    Reported by:    Quentin Thébault <quentin.thebault@defenso.fr>
    MFC after:      3 days
---
 sys/dev/vt/vt_core.c | 59 ++++++++++++++++++++++++++++++----------------------
 1 file changed, 34 insertions(+), 25 deletions(-)

diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index ef8926a76286..68a9a71c3d72 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -1684,32 +1684,41 @@ vtterm_splash(struct vt_device *vd)
 	uintptr_t image;
 	vt_axis_t top, left;
 
-	if (!(vd->vd_flags & VDF_TEXTMODE) && (boothowto & RB_MUTE)) {
-		if (rebooting == 1) {
-			si = MD_FETCH(preload_kmdp, MODINFOMD_SHTDWNSPLASH, struct splash_info *);
-			vd->vd_driver->vd_blank(vd, TC_BLACK);
-		} else {
-			si = MD_FETCH(preload_kmdp, MODINFOMD_SPLASH, struct splash_info *);
-		}
-		if (si == NULL) {
-			top = (vd->vd_height - vt_logo_height) / 2;
-			left = (vd->vd_width - vt_logo_width) / 2;
-			vd->vd_driver->vd_bitblt_bmp(vd, vd->vd_curwindow,
-			    vt_logo_image, NULL, vt_logo_width, vt_logo_height,
-			    left, top, TC_WHITE, TC_BLACK);
-		} else {
-			if (si->si_depth != 4)
-				return;
-			image = (uintptr_t)si + sizeof(struct splash_info);
-			image = roundup2(image, 8);
-			top = (vd->vd_height - si->si_height) / 2;
-			left = (vd->vd_width - si->si_width) / 2;
-			vd->vd_driver->vd_bitblt_argb(vd, vd->vd_curwindow,
-			    (unsigned char *)image, si->si_width, si->si_height,
-			    left, top);
-		}
-		vd->vd_flags |= VDF_SPLASH;
+	if ((vd->vd_flags & VDF_TEXTMODE) != 0 || (boothowto & RB_MUTE) == 0)
+		return;
+
+	si = MD_FETCH(preload_kmdp, rebooting == 1 ? MODINFOMD_SHTDWNSPLASH :
+	    MODINFOMD_SPLASH, struct splash_info *);
+	if (si == NULL) {
+		if (vd->vd_driver->vd_bitblt_bmp == NULL)
+			return;
+	} else if (vd->vd_driver->vd_bitblt_argb == NULL)
+		return;
+
+	if (rebooting == 1) {
+		if (vd->vd_driver->vd_blank == NULL)
+			return;
+		vd->vd_driver->vd_blank(vd, TC_BLACK);
 	}
+
+	if (si == NULL) {
+		top = (vd->vd_height - vt_logo_height) / 2;
+		left = (vd->vd_width - vt_logo_width) / 2;
+		vd->vd_driver->vd_bitblt_bmp(vd,
+		    vd->vd_curwindow, vt_logo_image, NULL, vt_logo_width,
+		    vt_logo_height, left, top, TC_WHITE, TC_BLACK);
+	} else {
+		if (si->si_depth != 4)
+			return;
+		image = (uintptr_t)si + sizeof(struct splash_info);
+		image = roundup2(image, 8);
+		top = (vd->vd_height - si->si_height) / 2;
+		left = (vd->vd_width - si->si_width) / 2;
+		vd->vd_driver->vd_bitblt_argb(vd, vd->vd_curwindow,
+		    (unsigned char *)image, si->si_width, si->si_height,
+		    left, top);
+	}
+	vd->vd_flags |= VDF_SPLASH;
 }
 #endif
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69ed33f0.3cdd0.4427224c>