Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jan 2012 19:15:26 -0500
From:      Eitan Adler <eadler@freebsd.org>
To:        freebsd-stable <freebsd-stable@freebsd.org>, Antony Mawer <antony@mawer.org>
Subject:   New feature: support for ASCII art splash screens in TheDraw format (svn commit r229994)
Message-ID:  <CAF6rxgnskzWf8NnLyKiTHtq17yUQpqSssijCCejvuH8pOPtOww@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I just committed this feature which some of you may be interested in
Example .bin files here: http://www.mawer.org/freebsd/

---------- Forwarded message ----------
From: Eitan Adler <eadler@freebsd.org>
Date: Wed, Jan 11, 2012 at 7:02 PM
Subject: svn commit: r229994 - in stable/9: share/man/man4 sys/dev/fb
sys/modules/splash sys/modules/splash/txt
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org


Author: eadler (ports committer)
Date: Thu Jan 12 00:02:14 2012
New Revision: 229994
URL: http://svn.freebsd.org/changeset/base/229994

Log:
=C2=A0MFC r228445:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 - Add support for ASCII art splash screens in T=
heDraw format

=C2=A0PR: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kern/143370
=C2=A0Approved by: =C2=A0ed

Added:
=C2=A0stable/9/sys/dev/fb/splash_txt.c
=C2=A0 =C2=A0 - copied unchanged from r228445, head/sys/dev/fb/splash_txt.c
=C2=A0stable/9/sys/modules/splash/txt/
=C2=A0 =C2=A0 - copied from r228445, head/sys/modules/splash/txt/
Modified:
=C2=A0stable/9/share/man/man4/splash.4
=C2=A0stable/9/sys/modules/splash/Makefile
Directory Properties:
=C2=A0stable/9/share/man/ =C2=A0 (props changed)
=C2=A0stable/9/share/man/man4/ =C2=A0 (props changed)
=C2=A0stable/9/sys/ =C2=A0 (props changed)

Modified: stable/9/share/man/man4/splash.4
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- stable/9/share/man/man4/splash.4 =C2=A0 =C2=A0Thu Jan 12 00:01:11 2012
=C2=A0(r229993)
+++ stable/9/share/man/man4/splash.4 =C2=A0 =C2=A0Thu Jan 12 00:02:14 2012
=C2=A0(r229994)
@@ -74,6 +74,14 @@ Bitmaps of other color depths will not b
=C2=A0ZSoft PCX decoder.
=C2=A0This decoder currently only supports version 5 8-bpp single-plane
=C2=A0images.
+.It Pa splash_txt.ko
+TheDraw binary ASCII drawing file decoder.
+Displays a text-mode 80x25 ASCII drawing, such as that produced by
+the Binary save format in TheDraw.
+This format consists of a sequence
+of two byte pairs representing the 80x25 display, where the first byte
+is the ASCII character to draw and the second byte indicates the
+colors/attributes to use when drawing the character.
=C2=A0.El
=C2=A0.Pp
=C2=A0The
@@ -223,6 +231,16 @@ If the VESA support is statically linked
=C2=A0necessary to load the VESA module.
=C2=A0Just load the bitmap file and the splash decoder module as in the
=C2=A0first example above.
+.Pp
+To load a binary ASCII drawing and display this while booting, include the
+following into your
+.Pa /boot/loader.conf
+:
+.Bd -literal -offset indent
+splash_txt_load=3D"YES"
+bitmap_load=3D"YES"
+bitmap_name=3D"/boot/splash.bin"
+.Ed
=C2=A0.\".Sh DIAGNOSTICS
=C2=A0.Sh SEE ALSO
=C2=A0.Xr vidcontrol 1 ,
@@ -256,6 +274,15 @@ module was written by
=C2=A0based on the
=C2=A0.Pa splash_bmp
=C2=A0code.
+The
+.Pa splash_txt
+module was written by
+.An Antony Mawer Aq antony@mawer.org
+based on the
+.Pa splash_bmp
+code, with some additional inspiration from the
+.Pa daemon_saver
+code.
=C2=A0.Sh CAVEATS
=C2=A0Both the splash screen and the screen saver work with
=C2=A0.Xr syscons 4

Copied: stable/9/sys/dev/fb/splash_txt.c (from r228445,
head/sys/dev/fb/splash_txt.c)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- /dev/null =C2=A0 00:00:00 1970 =C2=A0 (empty, because file is newly add=
ed)
+++ stable/9/sys/dev/fb/splash_txt.c =C2=A0 =C2=A0Thu Jan 12 00:02:14 2012
=C2=A0(r229994, copy of r228445, head/sys/dev/fb/splash_txt.c)
@@ -0,0 +1,135 @@
+/*-
+ * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
+ * Copyright (c) 1999 Kazutaka YOKOTA <yokota@freebsd.org>
+ * Copyright (c) 2005 Antony Mawer <antony@mawer.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * =C2=A0 =C2=A0notice, this list of conditions and the following disclaim=
er.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * =C2=A0 =C2=A0notice, this list of conditions and the following disclaim=
er in the
+ * =C2=A0 =C2=A0documentation and/or other materials provided with the dis=
tribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
+ * ARE DISCLAIMED. =C2=A0IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE =
LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/kernel.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
+
+#include <machine/pc/display.h>
+
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
+
+static int splash_on =3D FALSE;
+
+static int txt_init(video_adapter_t *adp);
+static int txt_end(video_adapter_t *adp);
+static int txt_splash(video_adapter_t * adp, const int on);
+
+/* These are rows by columns of the text-mode display device. */
+#define BIN_IMAGE_WIDTH =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A080
+#define BIN_IMAGE_HEIGHT =C2=A0 =C2=A0 =C2=A0 25
+
+static splash_decoder_t txt_decoder =3D {
+ =C2=A0 =C2=A0 =C2=A0 .name =3D "splash_txt",
+ =C2=A0 =C2=A0 =C2=A0 .init =3D txt_init,
+ =C2=A0 =C2=A0 =C2=A0 .term =3D txt_end,
+ =C2=A0 =C2=A0 =C2=A0 .splash =3D txt_splash,
+ =C2=A0 =C2=A0 =C2=A0 .data_type =3D SPLASH_IMAGE,
+};
+
+SPLASH_DECODER(splash_txt, txt_decoder);
+
+static void
+draw_text_splash(sc_softc_t *sc)
+{
+ =C2=A0 =C2=A0 =C2=A0 u_int x, y;
+ =C2=A0 =C2=A0 =C2=A0 u_char ch, attr;
+ =C2=A0 =C2=A0 =C2=A0 u_char *pdata =3D txt_decoder.data;
+
+ =C2=A0 =C2=A0 =C2=A0 /* Init failed. */
+ =C2=A0 =C2=A0 =C2=A0 if (txt_decoder.data =3D=3D NULL)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
+ =C2=A0 =C2=A0 =C2=A0 for (y =3D 0; y < BIN_IMAGE_HEIGHT; y++) {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (x =3D 0; x < BIN_IM=
AGE_WIDTH; x++) {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 ch =3D *pdata++;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 attr =3D *pdata++;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 sc_vtb_putc(&sc->cur_scp->scr,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 (y * sc->cur_scp->xsize) + x,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 sc->scr_map[ch], (int)attr << 8);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
+ =C2=A0 =C2=A0 =C2=A0 }
+}
+
+static int
+txt_init(video_adapter_t *adp)
+{
+
+ =C2=A0 =C2=A0 =C2=A0 /* Ensure that the image data exists. */
+ =C2=A0 =C2=A0 =C2=A0 if (txt_decoder.data =3D=3D NULL || txt_decoder.data=
_size <=3D 0) {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printf("splash_txt: No A=
SCII bitmap file found\n");
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (ENODEV);
+ =C2=A0 =C2=A0 =C2=A0 }
+ =C2=A0 =C2=A0 =C2=A0 return (0);
+}
+
+static int
+txt_end(video_adapter_t *adp)
+{
+
+ =C2=A0 =C2=A0 =C2=A0 return (0);
+}
+
+static int
+txt_splash(video_adapter_t *adp, const int on)
+{
+ =C2=A0 =C2=A0 =C2=A0 sc_softc_t *sc;
+ =C2=A0 =C2=A0 =C2=A0 scr_stat *scp;
+
+ =C2=A0 =C2=A0 =C2=A0 sc =3D sc_find_softc(adp, NULL);
+ =C2=A0 =C2=A0 =C2=A0 if (sc =3D=3D NULL)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (EAGAIN);
+ =C2=A0 =C2=A0 =C2=A0 scp =3D sc->cur_scp;
+ =C2=A0 =C2=A0 =C2=A0 if (on) {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!splash_on) {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 if (adp->va_info.vi_flags & V_INFO_GRAPHICS)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return EAGAIN;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 /* Clear screen and set border colour. */
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 sc_vtb_clear(&scp->scr, sc->scr_map[0x20],
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 (FG_LIGHTGREY | BG_BLACK) << 8);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 sc_set_border(scp, 0);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 splash_on =3D TRUE;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 /* Display the splash screen. */
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 draw_text_splash(sc);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0);
+ =C2=A0 =C2=A0 =C2=A0 } else {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* The video mode will b=
e restored by the caller. */
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 splash_on =3D FALSE;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0);
+ =C2=A0 =C2=A0 =C2=A0 }
+}
+
+

Modified: stable/9/sys/modules/splash/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- stable/9/sys/modules/splash/Makefile =C2=A0 =C2=A0 =C2=A0 =C2=A0Thu Jan=
 12 00:01:11
2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r229993)
+++ stable/9/sys/modules/splash/Makefile =C2=A0 =C2=A0 =C2=A0 =C2=A0Thu Jan=
 12 00:02:14
2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r229994)
@@ -1,5 +1,5 @@
=C2=A0# $FreeBSD$

-SUBDIR=3D =C2=A0 =C2=A0 =C2=A0 =C2=A0bmp pcx
+SUBDIR=3D =C2=A0 =C2=A0 =C2=A0 =C2=A0bmp pcx txt

=C2=A0.include <bsd.subdir.mk>

--=20
Eitan Adler
Ports committer
X11, Bugbusting teams



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