NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-sparc64/44933: Adding SPLASHSCREEN support to ffb(4) on sparc64



>Number:         44933
>Category:       port-sparc64
>Synopsis:       The ffb(4) driver does not implement the SPLASHSCREEN option
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-sparc64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 04 22:50:01 +0000 2011
>Originator:     Pierre Pronchery
>Release:        NetBSD 5.1_STABLE
>Organization:
>Environment:
Architecture: sparc64
Machine: sparc64
>Description:
NetBSD is able to draw and refresh a splash screen at boot, along with a
progress bar, via the SPLASHSCREEN and SPLASHSCREEN_PROGRESS kernel
options. This is however not implemented by the framebuffer driver for
the Creator series of framebuffers on this platform.
>How-To-Repeat:
Compile and boot a sparc64 kernel with the SPLASHSCREEN and
SPLASHSCREEN_PROGRESS options set, on a box with a graphic card matching
the ffb(4) driver.
>Fix:
The following patch is mostly complete; I am experiencing issues with
the colors: the background is light cyan instead of white when drawing
the splash screen.

This patch applies to NetBSD 5.1_STABLE; let me know if you would need
it adapted to suit -current.

Index: sys/arch/sparc64/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/conf/GENERIC,v
retrieving revision 1.104.2.3
diff -p -u -r1.104.2.3 GENERIC
--- sys/arch/sparc64/conf/GENERIC       21 Nov 2010 03:05:04 -0000      
1.104.2.3
+++ sys/arch/sparc64/conf/GENERIC       25 Apr 2011 23:25:34 -0000
@@ -886,6 +886,8 @@ options     WSDISPLAY_COMPAT_USL            # VT hand
 options        WSDISPLAY_COMPAT_RAWKBD         # can get raw scancodes
 options        WSDISPLAY_DEFAULTSCREENS=4
 options        FONT_GALLANT12x22               # PROM font look-alike
+options                SPLASHSCREEN
+options                SPLASHSCREEN_PROGRESS
 
 #### Other device configuration
 
Index: sys/arch/sparc64/conf/files.sparc64
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/conf/files.sparc64,v
retrieving revision 1.118.20.1
diff -p -u -r1.118.20.1 files.sparc64
--- sys/arch/sparc64/conf/files.sparc64 16 Oct 2009 11:56:10 -0000      
1.118.20.1
+++ sys/arch/sparc64/conf/files.sparc64 25 Apr 2011 23:25:34 -0000
@@ -147,7 +147,7 @@ device cgfourteen
 attach cgfourteen at sbus
 file   arch/sparc64/dev/cgfourteen.c   cgfourteen needs-flag
 
-device ffb: wsemuldisplaydev, rasops8, rasops16, rasops24, rasops32, fb, vcons
+device ffb: wsemuldisplaydev, rasops8, rasops16, rasops24, rasops32, fb, 
vcons, splash
 file   arch/sparc64/dev/ffb.c                  ffb
 
 attach ffb at mainbus with ffb_mainbus
Index: sys/arch/sparc64/dev/ffb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/dev/ffb.c,v
retrieving revision 1.35.4.3
diff -p -u -r1.35.4.3 ffb.c
--- sys/arch/sparc64/dev/ffb.c  18 Oct 2009 14:39:37 -0000      1.35.4.3
+++ sys/arch/sparc64/dev/ffb.c  25 Apr 2011 23:25:35 -0000
@@ -65,6 +65,12 @@ __KERNEL_RCSID(0, "$NetBSD: ffb.c,v 1.35
 #define WS_DEFAULT_BG 0xf
 #endif
 
+#ifdef FFB_DISABLE_TEXT
+#include <sys/reboot.h>
+#define DISABLESPLASH (boothowto & (RB_SINGLE | RB_USERCONF | RB_ASKNAME | \
+                       AB_VERBOSE | AB_DEBUG) )
+#endif
+
 extern struct cfdriver ffb_cd;
 
 struct wsscreen_descr ffb_stdscreen = {
@@ -242,13 +248,45 @@ ffb_attach(struct ffb_softc *sc)
        if (sc->sc_console) {
                wsdisplay_cnattach(&ffb_stdscreen, ri, 0, 0, defattr);
        }
+#ifdef SPLASHSCREEN
+/*
+ * If system isn't going to go multiuser, or user has requested to see
+ * boot text, don't render splash screen immediately
+ */
+       if (DISABLESPLASH)
+#endif
+               ffb_clearscreen(sc);
+#ifdef SPLASHSCREEN
+       sc->sc_splash.si_depth = ri->ri_depth;
+       sc->sc_splash.si_bits = ri->ri_bits;
+       sc->sc_splash.si_hwbits = ri->ri_hwbits;
+       sc->sc_splash.si_width = ri->ri_width;
+       sc->sc_splash.si_height = ri->ri_height;
+       sc->sc_splash.si_stride = ri->ri_stride;
+       sc->sc_splash.si_fillrect = NULL;
+       if (!DISABLESPLASH)
+               splash_render(&sc->sc_splash, SPLASH_F_CENTER|SPLASH_F_FILL);
+#ifdef SPLASHSCREEN_PROGRESS
+       sc->sc_progress.sp_top = (ri->ri_height / 8) * 7;
+       sc->sc_progress.sp_width = (ri->ri_width / 4) * 3;
+       sc->sc_progress.sp_left = (ri->ri_width - ri->ri_width / 2);
+       sc->sc_progress.sp_height = 20;
+       sc->sc_progress.sp_state = -1;
+       sc->sc_progress.sp_si = &sc->sc_splash;
+       splash_progress_init(&sc->sc_progress);
+#endif
+#endif
 
-       ffb_clearscreen(sc);
-       
        waa.console = sc->sc_console;
        waa.scrdata = &ffb_screenlist;
        waa.accessops = &ffb_accessops;
        waa.accesscookie = &sc->vd;
+
+#ifdef FFB_DISABLE_TEXT
+       if (!DISABLESPLASH)
+               SCREEN_DISABLE_DRAWING(&ffb_console_screen);
+#endif
+
        config_found(&sc->sc_dv, &waa, wsemuldisplaydevprint);
 }
 
@@ -323,6 +361,26 @@ ffb_ioctl(void *v, void *vs, u_long cmd,
                        }
                }               
                break;
+       case WSDISPLAYIO_SSPLASH:
+#if defined(SPLASHSCREEN)
+               if (*(int *)data == 1) {
+                       SCREEN_DISABLE_DRAWING(&ffb_console_screen);
+                       splash_render(&sc->sc_splash, 
SPLASH_F_CENTER|SPLASH_F_FILL);
+               } else
+                       SCREEN_ENABLE_DRAWING(&ffb_console_screen);
+               break;
+#else
+               return ENODEV;
+#endif
+       case WSDISPLAYIO_SPROGRESS:
+#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS)
+               sc->sc_progress.sp_force = 1;
+               splash_progress_update(&sc->sc_progress);
+               sc->sc_progress.sp_force = 0;
+               break;
+#else
+               return ENODEV;
+#endif
        case WSDISPLAYIO_GINFO:
                wdf = (void *)data;
                wdf->height = sc->sc_height;
@@ -897,4 +955,9 @@ ffb_init_screen(void *cookie, struct vco
        if (sc->putchar == NULL)
                sc->putchar = ri->ri_ops.putchar;
        ri->ri_ops.putchar = ffb_putchar;
+
+#ifdef FFB_DISABLE_TEXT
+       if (scr == &ffb_console_screen && !DISABLESPLASH)
+               SCREEN_DISABLE_DRAWING(&ffb_console_screen);
+#endif
 }
Index: sys/arch/sparc64/dev/ffbvar.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/dev/ffbvar.h,v
retrieving revision 1.8
diff -p -u -r1.8 ffbvar.h
--- sys/arch/sparc64/dev/ffbvar.h       14 Sep 2006 16:05:18 -0000      1.8
+++ sys/arch/sparc64/dev/ffbvar.h       25 Apr 2011 23:25:35 -0000
@@ -33,8 +33,17 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "opt_splash.h"
+
 #include <dev/wscons/wsdisplay_vconsvar.h>
 
+#ifdef SPLASHSCREEN
+#define FFB_DISABLE_TEXT
+#include <dev/splash/splash.h>
+/* XXX */
+extern const char _splash_header_data_cmap[64+32][3];
+#endif
+
 #define FFB_CREATOR            0
 #define FFB_AFB                        1
 
@@ -63,6 +72,13 @@ struct ffb_softc {
        /* virtual console stuff */
        void (*putchar)(void *c, int row, int col, u_int uc, long attr);
        struct vcons_data vd;
+
+#ifdef SPLASHSCREEN
+       struct splash_info sc_splash;
+#ifdef SPLASHSCREEN_PROGRESS
+       struct splash_progress sc_progress;
+#endif
+#endif
 };
 
 #define        DAC_WRITE(sc,r,v) \
Index: sys/dev/splash/splash.c
===================================================================
RCS file: /cvsroot/src/sys/dev/splash/splash.c,v
retrieving revision 1.6
diff -p -u -r1.6 splash.c
--- sys/dev/splash/splash.c     10 May 2008 15:31:05 -0000      1.6
+++ sys/dev/splash/splash.c     25 Apr 2011 23:25:46 -0000
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: splash.c,v 1
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/types.h>
+#include <sys/device.h>
 #include <sys/kernel.h>
 #include <sys/kthread.h>
 
Index: sys/kern/subr_autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_autoconf.c,v
retrieving revision 1.163.4.3
diff -p -u -r1.163.4.3 subr_autoconf.c
--- sys/kern/subr_autoconf.c    20 Nov 2010 17:41:27 -0000      1.163.4.3
+++ sys/kern/subr_autoconf.c    25 Apr 2011 23:25:53 -0000
@@ -118,7 +118,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_autocon
 #include <sys/userconf.h>
 #endif
 
-#ifdef __i386__
+#if defined(__i386__) || defined(__sparc64__)
 #include "opt_splash.h"
 #if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS)
 #include <dev/splash/splash.h>



Home | Main Index | Thread Index | Old Index