aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Khalifa <vexeduxr@FreeBSD.org>2026-04-20 20:15:00 +0000
committerAhmad Khalifa <vexeduxr@FreeBSD.org>2026-04-25 21:35:08 +0000
commitd1854272b646306de6546f8e5702e8072051d7f6 (patch)
tree095b0bf7e0ba4e4589fad9d3af83613fc92e841c
parente72c59315e7a2bedd654ac7c6e82dd3ceba30ed2 (diff)
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
-rw-r--r--sys/dev/vt/vt_core.c59
1 files 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