Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Aug 2014 10:57:20 GMT
From:      seiya@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r272023 - in soc2014/seiya/bootsplash/sys/dev: fb syscons
Message-ID:  <201408071057.s77AvKKB055150@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: seiya
Date: Thu Aug  7 10:57:20 2014
New Revision: 272023
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272023

Log:
  exit gracefully (WIP)
  

Modified:
  soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c
  soc2014/seiya/bootsplash/sys/dev/fb/bsplash.h
  soc2014/seiya/bootsplash/sys/dev/syscons/syscons.c

Modified: soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c
==============================================================================
--- soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c	Thu Aug  7 09:38:27 2014	(r272022)
+++ soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c	Thu Aug  7 10:57:20 2014	(r272023)
@@ -51,7 +51,9 @@
 static int load_bmp(BMP_INFO *bmp, void* data);
 static int draw_bmp(BMP_INFO *bmp, int iy, int sy, int sx, int width, int height);
 
-static video_adapter_t *adp = NULL;
+static void *adp = NULL;
+static void *sc  = NULL;
+static void (*bsplash_stop)(void *adp, void *sc) = NULL;
 static BMP_INFO	bmp_info;
 static int	in_prompt		= 0;
 static int	background_enabled	= 1;	// 1:enabled, 0:disabled
@@ -64,12 +66,12 @@
 static int	progress_bar_y_origin, progress_bar_y, progress_bar_x;
 static int	progress_bar_width, progress_bar_height;
 
-
-int
-bsplash_early_init(video_adapter_t *_adp)
+void
+bsplash_early_init(void *_adp, void *_sc, void (*_bsplash_stop)(void *, void *))
 {
 	adp = _adp;
-	return 0;
+	sc  = _sc;
+	bsplash_stop = _bsplash_stop;
 }
 
 static int
@@ -252,7 +254,7 @@
 	/*
 	 *  change video mode
 	 */
-	if (vidd_set_mode(adp, M_VESA_CG1024x768) != 0)
+	if (vidd_set_mode((video_adapter_t *) adp, M_VESA_CG1024x768) != 0)
 		return 1;
 
 	/*
@@ -266,7 +268,6 @@
 
 	if (kthread_add(update_animation, NULL, NULL, NULL, 0, 0, "bsplash") != 0){
 		printf("bsplash: failed to start kernel thread 'update_animation()'\n");
-		vidd_set_mode(adp, M_TEXT_80x25);
 		return 1;
 	}
 
@@ -315,7 +316,7 @@
 
 			if (progress >= 100 /* boot has finished */ || count > 50 /* FIX<E */){
 				/* terminate boot splash */
-				vidd_set_mode(adp, M_TEXT_80x25);
+				(*bsplash_stop)(adp, sc);
 				kthread_exit();
 			}
 		}
@@ -393,7 +394,7 @@
 {
 	video_info_t	info;
 
-	if (vidd_get_info(adp, M_VESA_CG1024x768, &info) != 0)
+	if (vidd_get_info((video_adapter_t *) adp, M_VESA_CG1024x768, &info) != 0)
 		return 1;
 
 	if (bmp_init(bmp, (u_char *)data, info.vi_width,

Modified: soc2014/seiya/bootsplash/sys/dev/fb/bsplash.h
==============================================================================
--- soc2014/seiya/bootsplash/sys/dev/fb/bsplash.h	Thu Aug  7 09:38:27 2014	(r272022)
+++ soc2014/seiya/bootsplash/sys/dev/fb/bsplash.h	Thu Aug  7 10:57:20 2014	(r272023)
@@ -27,9 +27,7 @@
 #ifndef _FB_BSPLASH_H_
 #define _FB_BSPLASH_H_
 
-#include <sys/fbio.h>
-
-int bsplash_early_init (video_adapter_t *adp);
+void bsplash_early_init (void *_adp, void *_sc, void (*bsplash_stop)(void *adp, void *sc));
 int bsplash_prompt_user (const char *tag);
 int bsplash_prompt_success (const char *tag);
 int bsplash_prompt_failure (const char *tag);

Modified: soc2014/seiya/bootsplash/sys/dev/syscons/syscons.c
==============================================================================
--- soc2014/seiya/bootsplash/sys/dev/syscons/syscons.c	Thu Aug  7 09:38:27 2014	(r272022)
+++ soc2014/seiya/bootsplash/sys/dev/syscons/syscons.c	Thu Aug  7 10:57:20 2014	(r272023)
@@ -200,6 +200,10 @@
 static int and_region(int *s1, int *e1, int s2, int e2);
 static void scrn_update(scr_stat *scp, int show_cursor);
 
+#ifdef DEV_BSPLASH
+static void scbsplash_stop(void *_adp, void *_sc);
+#endif
+
 #ifdef DEV_SPLASH
 static int scsplash_callback(int event, void *arg);
 static void scsplash_saver(sc_softc_t *sc, int show);
@@ -2069,6 +2073,38 @@
     SC_VIDEO_UNLOCK(scp->sc);
 }
 
+
+#ifdef DEV_BSPLASH
+
+static void
+scbsplash_stop(void *_adp, void *_sc)
+{
+    video_adapter_t *adp;
+    sc_softc_t *sc;
+    scr_stat *scp;
+
+    adp = (video_adapter_t *) _adp;
+    sc  = (sc_softc_t *) _sc;
+    scp = sc->cur_scp;
+
+    vidd_set_mode(adp, M_TEXT_80x25);
+    update_font(scp);
+    sc_set_border(scp, scp->border);
+    sc_set_cursor_image(scp);
+
+#ifndef SC_NO_PALETTE_LOADING
+#ifdef SC_PIXEL_MODE
+    if (adp->va_info.vi_mem_model == V_INFO_MM_DIRECT)
+        vidd_load_palette(adp, sc->palette2);
+    else
+#endif
+    vidd_load_palette(adp, sc->palette);
+#endif
+}
+
+#endif /* DEV_BSPLASH */
+
+
 #ifdef DEV_SPLASH
 static int
 scsplash_callback(int event, void *arg)
@@ -3031,7 +3067,7 @@
 
 
 #ifdef DEV_BSPLASH
-	bsplash_early_init(sc->adp);
+	bsplash_early_init((void *) sc->adp, (void *) sc, scbsplash_stop);
 #endif
 
     }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408071057.s77AvKKB055150>