Linux-kernel mailing list archive 2000-40,: RE: [patch] Make linux logo centered, add margins, etc. for 2.2.1

# RE: [patch] Make linux logo centered, add margins, etc. for 2.2.1

Torrey Hoffman (torrey.hoffman@myrio.com)
Tue, 3 Oct 2000 17:36:15 -0700

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Thomas Davis: "Re: Tux2 - evil patents sighted"
- Previous message: Jeff Dike: "user-mode port 0.32-2.4.0-test9"

(This is an improved version of my earlier patch to linux-2.2.17. Thanks
are
due to Mohammad A. Haque and Even Jeffrey who gave me helpful tips on my
first
attempt. This version should correctly handle multiple CPUs.)

The patch adds an option to display a single, horizontally centered logo
with
optional vertical margins (LOGO_MARGIN), when framebuffer support is
compiled into the kernel, and an appropriate VGA= parameter is supplied.
This option is enabled by defining LOGO_CENTERED.

If LOGO_CENTERED is not defined, one logo will be shown for each CPU,
starting
from the left, (as the current code does) but still adding the margins above

and below.

Either way, the boot console displays in the remaining space. As before,
all
80x80 pixel restrictions on the logo size are removed, and the definitions
of
the logo size are moved to linux_logo.h so changing the logo only requires
changes to the single header file.

If you want to use this patch but keep the existing behavior, leave
LOGO_CENTERED
undefined and set all definitions of LOGO_MARGIN to 0.

Note: The _existing_ problem of what happens when (LOGO_W * smp_num_cpus) is

greater than the horizontal screen resolution has not been addressed.

For more information on this patch, see my first posting to this thread.
Please
let me know of bugs or problems - all I can really say is "it works for me",
and
it's pretty simple patch, so it should be ok.

Thanks.

Torrey Hoffman.

diff -u -r -x *.o -x *.flags -x *.depend -x *.config
linux-2.2.17/drivers/video/fbcon.c linux/drivers/video/fbcon.c
--- linux-2.2.17/drivers/video/fbcon.c Mon Sep 4 10:39:22 2000
+++ linux/drivers/video/fbcon.c Tue Oct 3 11:25:34 2000
@@ -31,6 +31,9 @@
*
* Random hacking by Martin Mares <mj@ucw.cz>
*
+ * Small changes for arbitrary size, optionally centered logos with
margins,
+ * cleanup so all logo size and positioning options are in linux_logo.h
+ * by Torrey Hoffman (Torrey.Hoffman@myrio.com).
*
* The low level operations for the various display memory organizations
are
* now in separate source files.
@@ -107,8 +110,6 @@
# define DPRINTK(fmt, args...)
#endif
-#define LOGO_H 80
-#define LOGO_W 80
#define LOGO_LINE (LOGO_W/8)
struct display fb_display[MAX_NR_CONSOLES];
@@ -522,7 +523,7 @@
int cnt;
int step;
- logo_lines = (LOGO_H + fontheight(p) - 1) / fontheight(p);
+ logo_lines = (LOGO_H + LOGO_MARGIN + LOGO_MARGIN + fontheight(p) -
1) / fontheight(p);
q = (unsigned short *)(conp->vc_origin + conp->vc_size_row *
old_rows);
step = logo_lines * old_cols;
for (r = q - logo_lines * old_cols; r < q; r++)
@@ -2013,9 +2014,14 @@
if (p->fb_info->fbops->fb_rasterimg)
p->fb_info->fbops->fb_rasterimg(p->fb_info, 1);
+#if defined(LOGO_CENTERED)
+ if (1) {
+ x = (p->var.xres - LOGO_W) / 2;
+#else
for (x = 0; x < smp_num_cpus * (LOGO_W + 8) &&
x < p->var.xres - (LOGO_W + 8); x += (LOGO_W + 8)) {
-
+#endif
+
#if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \
defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FB_SBUS)
if (p->visual == FB_VISUAL_DIRECTCOLOR) {
@@ -2032,7 +2038,7 @@
/* have at least 8 bits per color */
src = logo;
bdepth = depth/8;
- for( y1 = 0; y1 < LOGO_H; y1++ ) {
+ for( y1 = LOGO_MARGIN; y1 < LOGO_H + LOGO_MARGIN; y1++ ) {
dst = fb + y1*line + x*bdepth;
for( x1 = 0; x1 < LOGO_W; x1++, src++ ) {
val = (*src << redshift) |
@@ -2058,7 +2064,7 @@
unsigned int pix;
src = linux_logo16;
bdepth = (depth+7)/8;
- for( y1 = 0; y1 < LOGO_H; y1++ ) {
+ for( y1 = LOGO_MARGIN; y1 < LOGO_H + LOGO_MARGIN; y1++ ) {
dst = fb + y1*line + x*bdepth;
for( x1 = 0; x1 < LOGO_W/2; x1++, src++ ) {
pix = (*src >> 4) | 0x10; /* upper nibble */
@@ -2106,12 +2112,13 @@
blueshift = p->var.blue.offset - (8-p->var.blue.length);
src = logo;
- for( y1 = 0; y1 < LOGO_H; y1++ ) {
+ for( y1 = LOGO_MARGIN; y1 < LOGO_H + LOGO_MARGIN; y1++ ) {
dst = fb + y1*line + x*bdepth;
for( x1 = 0; x1 < LOGO_W; x1++, src++ ) {
val = safe_shift((linux_logo_red[*src-32] & redmask),
redshift) |
safe_shift((linux_logo_green[*src-32] &
greenmask), greenshift) |
safe_shift((linux_logo_blue[*src-32] & bluemask),
blueshift);
+
if (bdepth == 4 && !((long)dst & 3)) {
/* Some cards require 32bit access */
*(u32 *)dst = val;
@@ -2132,7 +2139,7 @@
#if defined(CONFIG_FBCON_CFB4)
if (depth == 4 && p->type == FB_TYPE_PACKED_PIXELS) {
src = logo;
- for( y1 = 0; y1 < LOGO_H; y1++) {
+ for( y1 = LOGO_MARGIN; y1 < LOGO_H + LOGO_MARGIN; y1++) {
dst = fb + y1*line + x/2;
for( x1 = 0; x1 < LOGO_W/2; x1++) {
u8 q = *src++;
@@ -2148,7 +2155,7 @@
/* depth 8 or more, packed, with color registers */
src = logo;
- for( y1 = 0; y1 < LOGO_H; y1++ ) {
+ for( y1 = LOGO_MARGIN; y1 < LOGO_H + LOGO_MARGIN; y1++ ) {
dst = fb + y1*line + x;
for( x1 = 0; x1 < LOGO_W; x1++ )
*dst++ = *src++;
@@ -2180,7 +2187,7 @@
(1 << ((8-((pix*logo_depth)&7)-logo_depth) + bit)))
src = logo;
- for( y1 = 0; y1 < LOGO_H; y1++ ) {
+ for( y1 = LOGO_MARGIN; y1 < LOGO_H + LOGO_MARGIN; y1++ ) {
for( x1 = 0; x1 < LOGO_LINE; x1++, src += logo_depth ) {
dst = fb + y1*line + MAP_X(x/8+x1);
for( bit = 0; bit < logo_depth; bit++ ) {
@@ -2199,7 +2206,7 @@
* special case for logo_depth == 4: we used color registers
16..31,
* so fill plane 4 with 1 bits instead of 0 */
if (depth > logo_depth) {
- for( y1 = 0; y1 < LOGO_H; y1++ ) {
+ for( y1 = LOGO_MARGIN; y1 < LOGO_H + LOGO_MARGIN; y1++ ) {
for( x1 = 0; x1 < LOGO_LINE; x1++ ) {
dst = fb + y1*line + MAP_X(x/8+x1) +
logo_depth*plane;
for( i = logo_depth; i < depth; i++, dst += plane )
@@ -2224,7 +2231,7 @@
? 0x00 : 0xff;
/* can't use simply memcpy because need to apply inverse */
- for( y1 = 0; y1 < LOGO_H; y1++ ) {
+ for( y1 = LOGO_MARGIN; y1 < LOGO_H + LOGO_MARGIN; y1++ ) {
src = logo + y1*LOGO_LINE;
dst = fb + y1*line + x/8;
for( x1 = 0; x1 < LOGO_LINE; ++x1 )
@@ -2240,7 +2247,7 @@
outb_p(5,0x3ce); outb_p(0,0x3cf);
src = logo;
- for (y1 = 0; y1 < LOGO_H; y1++) {
+ for (y1 = LOGO_MARGIN; y1 < LOGO_H + LOGO_MARGIN; y1++) {
for (x1 = 0; x1 < LOGO_W / 2; x1++) {
dst = fb + y1*line + x1/4 + x/8;
@@ -2270,7 +2277,7 @@
/* Modes not yet supported: packed pixels with depth != 8 (does such a
* thing exist in reality?) */
- return done ? (LOGO_H + fontheight(p) - 1) / fontheight(p) : 0 ;
+ return done ? (LOGO_H + LOGO_MARGIN + LOGO_MARGIN + fontheight(p) - 1)
/ fontheight(p) : 0 ;
}
/*

diff -u -r -x *.o -x *.flags -x *.depend -x *.config
linux-2.2.17/include/linux/linux_logo.h linux/include/linux/linux_logo.h
--- linux-2.2.17/include/linux/linux_logo.h Wed Sep 30 14:16:33 1998
+++ linux/include/linux/linux_logo.h Tue Oct 3 11:26:54 2000
@@ -4,22 +4,40 @@
*
* Copyright (C) 1996 Larry Ewing (lewing@isc.tamu.edu)
* Copyright (C) 1996,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
+ *
+ * Modified 2000 Torrey Hoffman (Torrey.Hoffman@myrio.com)
+ * in a patch to optionally display the logo centered horizontally,
+ * with a margin above and below, removing the 80x80 size restriction,
+ * and supporting different logo sizes for different color depths.
+ * If LOGO_CENTERED is defined, a single logo will be centered on the
+ * screen. Otherwise, one logo for each CPU will be shown, left-
+ * justified.
*
+ * Note that there is a GPL'ed gimp plugin called "glogo",
+ * copyright 1998 Jens Ch. Restemeier, which makes it much easier
+ * to create this file. A modified version by Torrey Hoffman to
+ * support this updated version of the file, logos larger than 80x80,
+ * and Gimp 1.1.26 is available from Torrey.Hoffman@myrio.com
+ *
* You can put anything here, but:
* LINUX_LOGO_COLORS has to be less than 224
- * image size has to be 80x80
* values have to start from 0x20
* (i.e. RGB(linux_logo_red[0],
* linux_logo_green[0],
* linux_logo_blue[0]) is color 0x20)
- * BW image has to be 80x80 as well, with MS bit
- * on the left
+ * BW image has to have MS bit on the left.
* Serial_console ascii image can be any size,
* but should contain %s to display the version
*/
+#define LOGO_CENTERED;
+
#if LINUX_LOGO_COLORS == 214
+#define LOGO_H 80
+#define LOGO_W 80
+#define LOGO_MARGIN 120
+
unsigned char linux_logo_red[] __initdata = {
0x02, 0x9E, 0xE9, 0xC4, 0x50, 0xC9, 0xC4, 0xE9,
0x65, 0xE3, 0xC2, 0x25, 0xA4, 0xEC, 0x90, 0xA6,
@@ -917,6 +935,10 @@
#ifdef INCLUDE_LINUX_LOGOBW
+#define LOGO_H 80
+#define LOGO_W 80
+#define LOGO_MARGIN 120
+
unsigned char linux_logo_bw[] __initdata = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x3F,
@@ -1023,6 +1045,10 @@
#endif
#ifdef INCLUDE_LINUX_LOGO16
+
+#define LOGO_H 80
+#define LOGO_W 80
+#define LOGO_MARGIN 120
unsigned char linux_logo16_red[] __initdata = {
0x00, 0x90, 0xb0, 0x9c, 0xf7, 0x35, 0x83, 0xa5,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

- Next message: Thomas Davis: "Re: Tux2 - evil patents sighted"
- Previous message: Jeff Dike: "user-mode port 0.32-2.4.0-test9"