git: a06b366322fe - stable/14 - vt(4): Call post-switch callback after replacing the backend

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Sat, 17 Feb 2024 21:32:34 UTC
The branch stable/14 has been updated by wulf:

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

commit a06b366322fe22b211c16c2b0977fac313dce4e7
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-11-29 18:34:48 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-02-17 20:58:35 +0000

    vt(4): Call post-switch callback after replacing the backend
    
    [Why]
    For instance, it gives a chance to the new backend to refresh the
    screen. This is needed by the vt_drmfb backend and `drm_fb_helper`.
    
    This change was lost when I posted changes to reviews.freebsd.org and it
    broken the amdgpu driver... Thanks to manu@ for reporting the problem
    and wulf@ to find out the missing change!
    
    Tested by:      manu
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D42834
    
    (cherry picked from commit 40c20fc29cad4d38d9a565e9c7ba78612097308e)
---
 sys/dev/vt/vt_core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 4a1031f1aa69..797af56e5e1d 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -3284,6 +3284,13 @@ vt_replace_backend(const struct vt_driver *drv, void *softc)
 	/* Update windows sizes and initialize last items. */
 	vt_upgrade(vd);
 
+	/*
+	 * Give a chance to the new backend to run the post-switch code, for
+	 * instance to refresh the screen.
+	 */
+	if (vd->vd_driver->vd_postswitch)
+		vd->vd_driver->vd_postswitch(vd);
+
 #ifdef DEV_SPLASH
 	if (vd->vd_flags & VDF_SPLASH)
 		vtterm_splash(vd);