2003-01-28 15:01:03

by Geert Uytterhoeven

[permalink] [raw]
Subject: [Linux-fbdev-devel] Re: New logo code (fwd)

---------- Forwarded message ----------
Date: Fri, 17 Jan 2003 17:01:55 +0100 (MET)
From: Geert Uytterhoeven <[email protected]>
To: Linux Frame Buffer Device Development
<[email protected]>
Subject: [Linux-fbdev-devel] Re: New logo code

On Sun, 12 Jan 2003, Geert Uytterhoeven wrote:
> The current logo code is messy, complex, and inflexible. So I decided to
> rewrite it. My goals were:
> - Logos must be accessible easily by an image editor (currently: hex C source
> data must be converted to another format first)
> - Logos must be stored in ASCII-form in the source tree
> - Support arbitrary logo sizes (currently: fixed 80x80)
> - Allow the logo to be selected statically (at compile time) and/or
> dynamically (at run-time, based on machine type) (currently: at compile
> time only).
> - Allow simple adition of new logos
> - Support grayscale logos (not used yet)
>
> The patch achieves all of these. Logos are stored in ASCII PNM format in
> drivers/video/logo/, and automatically converted to hex C source arrays using
> scripts/pnmtologo. I chose ASCII PNM because (a) it's ASCII, (b) it's very
> simple to parse without an external library (XPM is more difficult to parse),
> and (c) it can be handled by many image manipulation programs.
>
> Code that wants to display a logo just calls fb_find_logo(), specifying the
> wanted logo type, and receives a pointer to a suitable logo (or NULL).
>
> I also modified fb_show_logo() to return the number of scanlines that are used
> by the logo, so fbcon knows how many lines to reserve.
>
> So far I tested it on Amiga only (with amifb), using the standard 3 logos
> (mono, vga16, and clut224, all 80x80), and using resized (171x171) versions of
> the standard logos, to verify that arbitrary logo sizes are working.
>
> Initial logo display is still a bit weird, because fbcon is initialized before
> the logo is drawn. What you see is this:
> - Initial text screen contents are drawn, starting at the top of the screen,
> - The logo is drawn,
> - New kernel messages are printed, until the bottom of the screen is reached,
> - The logo is drawn again, and the top of the screen is reserved for the
> logo,
> - New kernel messages are printed, and scrolling scrolls the text part only,
> leaving the logo at the top
>
> To do:
> - More testing
> - Clean ups:
> o Protect all drawing code by CONFIG_FB_LOGO
> o Move logo drawing code from fbmem.c to logo/logo.c?
> o Logo selection in Kconfig and logo.c?

I put a new version at

http://home.tvd.be/cr26864/Linux/fbdev/linux-logo-2.5.59.diff.bz2

Changes:
- Merge with 2.5.59
- New logo (CLUT224 only) for PA-RISC
- Let hgafb and newport_con include logo sources directly, since they need
access to the logos in non-init code

All comments are welcomed! Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


2003-02-05 12:29:30

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)

On Tue, 28 Jan 2003, Geert Uytterhoeven wrote:
> On Sun, 12 Jan 2003, Geert Uytterhoeven wrote:
> > The current logo code is messy, complex, and inflexible. So I decided to
> > rewrite it. My goals were:
> > - Logos must be accessible easily by an image editor (currently: hex C source
> > data must be converted to another format first)
> > - Logos must be stored in ASCII-form in the source tree
> > - Support arbitrary logo sizes (currently: fixed 80x80)
> > - Allow the logo to be selected statically (at compile time) and/or
> > dynamically (at run-time, based on machine type) (currently: at compile
> > time only).
> > - Allow simple adition of new logos
> > - Support grayscale logos (not used yet)
> >
> > The patch achieves all of these. Logos are stored in ASCII PNM format in
> > drivers/video/logo/, and automatically converted to hex C source arrays using
> > scripts/pnmtologo. I chose ASCII PNM because (a) it's ASCII, (b) it's very
> > simple to parse without an external library (XPM is more difficult to parse),
> > and (c) it can be handled by many image manipulation programs.
> >
> > Code that wants to display a logo just calls fb_find_logo(), specifying the
> > wanted logo type, and receives a pointer to a suitable logo (or NULL).
> >
> > I also modified fb_show_logo() to return the number of scanlines that are used
> > by the logo, so fbcon knows how many lines to reserve.
>
> I put a new version at
>
> http://home.tvd.be/cr26864/Linux/fbdev/linux-logo-2.5.59.diff.bz2
>
> Changes:
> - Merge with 2.5.59
> - New logo (CLUT224 only) for PA-RISC
> - Let hgafb and newport_con include logo sources directly, since they need
> access to the logos in non-init code
>
> All comments are welcomed! Thanks!

Come on, is there really no one to comment on this??

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2003-02-05 14:04:49

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)

On Wed, Feb 05, 2003 at 01:37:44PM +0100, Geert Uytterhoeven wrote:
> >
> > All comments are welcomed! Thanks!
>
> Come on, is there really no one to comment on this??

Except a question why it's not merged yet? :)

2003-02-05 19:06:25

by Torrey Hoffman

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)

> > On Sun, 12 Jan 2003, Geert Uytterhoeven wrote:
> > > The current logo code is messy, complex, and inflexible. So I decided to
> > > rewrite it. My goals were:
[ good list ]

This is wonderful. I (and some co-conspirators) started a similar
project, and put up patches at http://www.arnor.net/linuxlogo . But yours is up
to date, and ours is not (I was waiting until the framebuffer rewrite
was done, and then I didn't have time to catch up).

It would be great if your patch was merged. If I may offer some
suggestions... well, feature requests :-)

It would also be nice to have an option to turn off the blinking cursor
on the framebuffer. With a full-screen boot logo as used on embedded
systems, even with a serial console or console on tty2, you still get
the blinking cursor in the top corner of the screen. (at least in 2.4.x)

Other options that might be useful, but less important:
- Single logo option for SMP
- A "no logo" option, while still including framebuffer support
- Logo positioning (centered horizontally, vertically, both)
- Background and foreground text color options.

A combination of these features would make it possible to do a smaller
logo (say, 256 x 128) centered on the screen with a matching background
color that would make it look like a full-screen logo, while not
bloating the kernel image much.

Also, some simple documentation that would help beginners do a
full-screen boot logo with the console on tty2 or serial should be
included with the kernel. Lots of people want to use Linux on
"embedded" PC-based systems like kiosks, or just do this for fun on
their home computers, and doing this is confusing for beginners.

If you like, I would be happy to write documentation like this or help
in other ways.

I hope there is little resistance to merging a patch like this. If
anyone doubts the need, I can only say that despite our patches not
being kept up to date regularly, I get a lot of email about them. Also,
there are patches by other people to do things like this, some better
than others. Despite the hassle of finding and applying these patches,
people want the feature badly enough to make the effort. I see a lot
more desire for this feature than for many other worthwhile things that
are merged into the kernel...

Torrey Hoffman
[email protected]


On Wed, 2003-02-05 at 04:37, Geert Uytterhoeven wrote:
> On Tue, 28 Jan 2003, Geert Uytterhoeven wrote:
> > On Sun, 12 Jan 2003, Geert Uytterhoeven wrote:
> > > The current logo code is messy, complex, and inflexible. So I decided to
> > > rewrite it. My goals were:
> > > - Logos must be accessible easily by an image editor (currently: hex C source
> > > data must be converted to another format first)
> > > - Logos must be stored in ASCII-form in the source tree
> > > - Support arbitrary logo sizes (currently: fixed 80x80)
> > > - Allow the logo to be selected statically (at compile time) and/or
> > > dynamically (at run-time, based on machine type) (currently: at compile
> > > time only).
> > > - Allow simple adition of new logos
> > > - Support grayscale logos (not used yet)
> > >
> > > The patch achieves all of these. Logos are stored in ASCII PNM format in
> > > drivers/video/logo/, and automatically converted to hex C source arrays using
> > > scripts/pnmtologo. I chose ASCII PNM because (a) it's ASCII, (b) it's very
> > > simple to parse without an external library (XPM is more difficult to parse),
> > > and (c) it can be handled by many image manipulation programs.


2003-02-06 07:20:33

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)

On Wed, 2003-02-05 at 20:37, Geert Uytterhoeven wrote:
> On Tue, 28 Jan 2003, Geert Uytterhoeven wrote:
> > On Sun, 12 Jan 2003, Geert Uytterhoeven wrote:
> > > The current logo code is messy, complex, and inflexible. So I decided to
> > > rewrite it. My goals were:
> > > - Logos must be accessible easily by an image editor (currently: hex C source
> > > data must be converted to another format first)
> > > - Logos must be stored in ASCII-form in the source tree
> > > - Support arbitrary logo sizes (currently: fixed 80x80)
> > > - Allow the logo to be selected statically (at compile time) and/or
> > > dynamically (at run-time, based on machine type) (currently: at compile
> > > time only).
> > > - Allow simple adition of new logos
> > > - Support grayscale logos (not used yet)
> > >
> > > The patch achieves all of these. Logos are stored in ASCII PNM format in
> > > drivers/video/logo/, and automatically converted to hex C source arrays using
> > > scripts/pnmtologo. I chose ASCII PNM because (a) it's ASCII, (b) it's very
> > > simple to parse without an external library (XPM is more difficult to parse),
> > > and (c) it can be handled by many image manipulation programs.
> > >
> > > Code that wants to display a logo just calls fb_find_logo(), specifying the
> > > wanted logo type, and receives a pointer to a suitable logo (or NULL).
> > >
> > > I also modified fb_show_logo() to return the number of scanlines that are used
> > > by the logo, so fbcon knows how many lines to reserve.
> >
> > I put a new version at
> >
> > http://home.tvd.be/cr26864/Linux/fbdev/linux-logo-2.5.59.diff.bz2
> >
> > Changes:
> > - Merge with 2.5.59
> > - New logo (CLUT224 only) for PA-RISC
> > - Let hgafb and newport_con include logo sources directly, since they need
> > access to the logos in non-init code
> >
> > All comments are welcomed! Thanks!
>
> Come on, is there really no one to comment on this??
>

Actually, I tried the patch before, but it was erased so fast that I
never got to see the logo :-)

Anyway, I think it's because logo_lines require logo_height in
fbcon_set_display(). logo_height is returned by fb_show_logo(), however
fb_show_logo() is called after computing logo_lines.

So, how about breaking up fb_show_logo() into fb_prepare_logo() and
fb_show_logo()? We can call fb_prepare_logo() to get the logo height
for the logo_lines, then do an fb_show_logo() for the actual drawing.

Also I noticed that the type of logo depends solely on the framebuffer
depth. This is not necessarily correct. DirectColor at <24bpp
requires a 4-bit logo.

Overall, I like it, though it does add some kilobytes to the kernel
image size.

Tony

BTW: Do you know of any logo images that are compatible with your patch?
I'm beginning to get tired of seeing Tux always:-)

diff -Naur linux-2.5.59-gu/drivers/video/console/fbcon.c linux/drivers/video/console/fbcon.c
--- linux-2.5.59-gu/drivers/video/console/fbcon.c 2003-02-05 06:37:49.000000000 +0000
+++ linux/drivers/video/console/fbcon.c 2003-02-05 06:38:52.000000000 +0000
@@ -958,6 +958,7 @@
int cnt;
int step;

+ logo_height = fb_prepare_logo(info);
logo_lines = (logo_height + vc->vc_font.height - 1) /
vc->vc_font.height;
q = (unsigned short *) (vc->vc_origin +
@@ -1944,8 +1945,7 @@
accel_clear_margins(vc, p, 0);
if (logo_shown == -2) {
logo_shown = fg_console;
- /* This is protected above by initmem_freed */
- logo_height = fb_show_logo(info);
+ fb_show_logo(info); /* This is protected above by initmem_freed */
update_region(fg_console,
vc->vc_origin + vc->vc_size_row * vc->vc_top,
vc->vc_size_row * (vc->vc_bottom -
diff -Naur linux-2.5.59-gu/drivers/video/fbmem.c linux/drivers/video/fbmem.c
--- linux-2.5.59-gu/drivers/video/fbmem.c 2003-02-05 06:33:48.000000000 +0000
+++ linux/drivers/video/fbmem.c 2003-02-05 06:36:03.000000000 +0000
@@ -511,101 +511,119 @@
* We isolate each bit and expand each into a byte. The "needs_logo" flag will
* be set to 1.
*/
-int fb_show_logo(struct fb_info *info)
-{
- unsigned char *fb = info->screen_base, *logo_new = NULL;
- u32 *palette = NULL, *saved_pseudo_palette = NULL;
- int needs_directpalette = 0;
- int needs_truepalette = 0;
- int needs_cmapreset = 0;
- struct fb_image image;
- const struct linux_logo *logo = 0;
+static struct logo_data {
+ int depth;
+ int needs_logo;
+ int needs_directpalette;
+ int needs_truepalette;
+ int needs_cmapreset;
int type;
- int needs_logo = 0;
- int done = 0, x;
-
- /* Return if the frame buffer is not mapped */
- if (!fb || !info->fbops->fb_imageblit)
- return 0;
+ const struct linux_logo *logo;
+} fb_logo;

- image.depth = info->var.bits_per_pixel;
-
- /* reasonable default */
- if (image.depth >= 8)
- type = LINUX_LOGO_CLUT224;
- else if (image.depth >= 4)
- type = LINUX_LOGO_VGA16;
- else
- type = LINUX_LOGO_MONO;
-
- /* Return if no suitable logo was found */
- logo = fb_find_logo(type);
- if (!logo || logo->height > info->var.yres)
- return 0;
+int fb_prepare_logo(struct fb_info *info)
+{
+ memset(&fb_logo, 0, sizeof(struct logo_data));

- image.data = logo->data;
+ fb_logo.depth = info->var.bits_per_pixel;

switch (info->fix.visual) {
case FB_VISUAL_TRUECOLOR:
- needs_truepalette = 1;
- if (image.depth >= 4 && image.depth <= 8)
- needs_logo = 4;
- else if (image.depth < 4)
- needs_logo = 1;
+ if (fb_logo.depth > 8) {
+ fb_logo.needs_truepalette = 1;
+ fb_logo.needs_logo = 8;
+ } else if (fb_logo.depth >= 4 && fb_logo.depth <= 8)
+ fb_logo.needs_logo = 4;
+ else
+ fb_logo.needs_logo = 1;
break;
case FB_VISUAL_DIRECTCOLOR:
- if (image.depth >= 24) {
- needs_directpalette = 1;
- needs_cmapreset = 1;
+ if (fb_logo.depth >= 24) {
+ fb_logo.needs_directpalette = 1;
+ fb_logo.needs_cmapreset = 1;
+ fb_logo.needs_logo = 8;
}
/* 16 colors */
- else if (image.depth >= 16)
- needs_logo = 4;
+ else if (fb_logo.depth >= 16)
+ fb_logo.needs_logo = 4;
/* 2 colors */
else
- needs_logo = 1;
+ fb_logo.needs_logo = 1;
break;
case FB_VISUAL_MONO01:
/* reversed 0 = fg, 1 = bg */
- needs_logo = ~1;
+ fb_logo.needs_logo = ~1;
break;
case FB_VISUAL_MONO10:
- needs_logo = 1;
+ fb_logo.needs_logo = 1;
break;
case FB_VISUAL_PSEUDOCOLOR:
default:
- if (image.depth >= 8)
- needs_cmapreset = 1;
+ if (fb_logo.depth >= 8) {
+ fb_logo.needs_cmapreset = 1;
+ fb_logo.needs_logo = 8;
+ }
/* fall through */
case FB_VISUAL_STATIC_PSEUDOCOLOR:
/* 16 colors */
- if (image.depth >= 4 && image.depth < 8)
- needs_logo = 4;
+ if (fb_logo.depth >= 4 && fb_logo.depth < 8)
+ fb_logo.needs_logo = 4;
/* 2 colors */
- else if (image.depth < 4)
- needs_logo = 1;
+ else if (fb_logo.depth < 4)
+ fb_logo.needs_logo = 1;
break;
}

- if (needs_cmapreset)
- fb_set_logocmap(info, logo);
+ if (fb_logo.needs_logo >= 8)
+ fb_logo.type = LINUX_LOGO_CLUT224;
+ else if (fb_logo.needs_logo >= 4)
+ fb_logo.type = LINUX_LOGO_VGA16;
+ else
+ fb_logo.type = LINUX_LOGO_MONO;

- if (needs_truepalette || needs_directpalette) {
+ /* Return if no suitable logo was found */
+ fb_logo.logo = fb_find_logo(fb_logo.type);
+ if (!fb_logo.logo || fb_logo.logo->height > info->var.yres)
+ return 0;
+ return fb_logo.logo->height;
+}
+
+int fb_show_logo(struct fb_info *info)
+{
+ unsigned char *fb = info->screen_base, *logo_new = NULL;
+ u32 *palette = NULL, *saved_pseudo_palette = NULL;
+ struct fb_image image;
+ int done = 0, x;
+
+ /* Return if the frame buffer is not mapped */
+ if (!fb || !info->fbops->fb_imageblit ||
+ !fb_logo.depth)
+ return 0;
+
+ image.depth = fb_logo.depth;
+ image.data = fb_logo.logo->data;
+
+ if (fb_logo.needs_cmapreset)
+ fb_set_logocmap(info, fb_logo.logo);
+
+ if (fb_logo.needs_truepalette ||
+ fb_logo.needs_directpalette) {
palette = kmalloc(256 * 4, GFP_KERNEL);
if (palette == NULL)
return 0;

- if (needs_truepalette)
- fb_set_logo_truepalette(info, logo, palette);
+ if (fb_logo.needs_truepalette)
+ fb_set_logo_truepalette(info, fb_logo.logo, palette);
else
- fb_set_logo_directpalette(info, logo, palette);
+ fb_set_logo_directpalette(info, fb_logo.logo, palette);

saved_pseudo_palette = info->pseudo_palette;
info->pseudo_palette = palette;
}

- if (needs_logo) {
- logo_new = kmalloc(logo->width * logo->height, GFP_KERNEL);
+ if (fb_logo.needs_logo != 8) {
+ logo_new = kmalloc(fb_logo.logo->width * fb_logo.logo->height,
+ GFP_KERNEL);
if (logo_new == NULL) {
if (palette)
kfree(palette);
@@ -615,27 +633,27 @@
}

image.data = logo_new;
- fb_set_logo(info, logo, logo_new, needs_logo);
+ fb_set_logo(info, fb_logo.logo, logo_new, fb_logo.needs_logo);
}

- image.width = logo->width;
- image.height = logo->height;
+ image.width = fb_logo.logo->width;
+ image.height = fb_logo.logo->height;
image.dy = 0;

- for (x = 0; x < num_online_cpus() * (logo->width + 8) &&
- x <= info->var.xres-logo->width; x += (logo->width + 8)) {
+ for (x = 0; x < num_online_cpus() * (fb_logo.logo->width + 8) &&
+ x <= info->var.xres-fb_logo.logo->width; x += (fb_logo.logo->width + 8)) {
image.dx = x;
info->fbops->fb_imageblit(info, &image);
done = 1;
}
-
+
if (palette != NULL)
kfree(palette);
if (saved_pseudo_palette != NULL)
info->pseudo_palette = saved_pseudo_palette;
if (logo_new != NULL)
kfree(logo_new);
- return logo->height;
+ return fb_logo.logo->height;
}

static int fbmem_read_proc(char *buf, char **start, off_t offset,
@@ -1213,6 +1231,7 @@
EXPORT_SYMBOL(num_registered_fb);
EXPORT_SYMBOL(registered_fb);
EXPORT_SYMBOL(fb_show_logo);
+EXPORT_SYMBOL(fb_prepare_logo);
EXPORT_SYMBOL(fb_set_var);
EXPORT_SYMBOL(fb_blank);
EXPORT_SYMBOL(fb_pan_display);
diff -Naur linux-2.5.59-gu/include/linux/fb.h linux/include/linux/fb.h
--- linux-2.5.59-gu/include/linux/fb.h 2003-02-05 06:39:34.000000000 +0000
+++ linux/include/linux/fb.h 2003-02-05 06:40:30.000000000 +0000
@@ -464,6 +464,7 @@
/* drivers/video/fbmem.c */
extern int register_framebuffer(struct fb_info *fb_info);
extern int unregister_framebuffer(struct fb_info *fb_info);
+extern int fb_prepare_logo(struct fb_info *fb_info);
extern int fb_show_logo(struct fb_info *fb_info);
extern struct fb_info *registered_fb[FB_MAX];
extern int num_registered_fb;

2003-02-06 07:21:37

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)

On Thu, 2003-02-06 at 03:17, Torrey Hoffman wrote:
> > > On Sun, 12 Jan 2003, Geert Uytterhoeven wrote:
> > > > The current logo code is messy, complex, and inflexible. So I decided to
> > > > rewrite it. My goals were:
> [ good list ]
>
> This is wonderful. I (and some co-conspirators) started a similar
> project, and put up patches at http://www.arnor.net/linuxlogo . But yours is up
> to date, and ours is not (I was waiting until the framebuffer rewrite
> was done, and then I didn't have time to catch up).
>
> It would be great if your patch was merged. If I may offer some
> suggestions... well, feature requests :-)
>
> It would also be nice to have an option to turn off the blinking cursor

You can control some of the attributes of the cursor in 2.5. The
examples illustrated in linux/Documentation/VGA-Softcursor.txt should
work.

Tony



2003-02-06 09:11:39

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)

On 5 Feb 2003, Antonino Daplas wrote:
> On Wed, 2003-02-05 at 20:37, Geert Uytterhoeven wrote:
> > Come on, is there really no one to comment on this??
>
> Actually, I tried the patch before, but it was erased so fast that I
> never got to see the logo :-)
>
> Anyway, I think it's because logo_lines require logo_height in
> fbcon_set_display(). logo_height is returned by fb_show_logo(), however
> fb_show_logo() is called after computing logo_lines.

I always see the logo twice. The first time it's erased by the text (because
initially fbcon thinks logo_height = 0), the second time it's displayed
correctly.

So I also wondered why it's drawn twice?

> So, how about breaking up fb_show_logo() into fb_prepare_logo() and
> fb_show_logo()? We can call fb_prepare_logo() to get the logo height
> for the logo_lines, then do an fb_show_logo() for the actual drawing.

OK for me.

> Overall, I like it, though it does add some kilobytes to the kernel
> image size.

Why would it increase kernel size that much? The logos were there before as
well (unless you enable all of them, of course :-).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2003-02-06 09:14:27

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)

On 5 Feb 2003, Torrey Hoffman wrote:
> Other options that might be useful, but less important:
> - Single logo option for SMP
> - A "no logo" option, while still including framebuffer support

FB_LOGO=n?

This still includes the logo code (not the images), but that can be fixed.

> - Logo positioning (centered horizontally, vertically, both)
> - Background and foreground text color options.
>
> A combination of these features would make it possible to do a smaller
> logo (say, 256 x 128) centered on the screen with a matching background
> color that would make it look like a full-screen logo, while not
> bloating the kernel image much.

Just two extra fields in fb_logo.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2003-02-06 09:30:42

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)

On Thu, 2003-02-06 at 17:19, Geert Uytterhoeven wrote:
>
> I always see the logo twice. The first time it's erased by the text (because
> initially fbcon thinks logo_height = 0), the second time it's displayed
> correctly.
>
> So I also wondered why it's drawn twice?

I was expecting this behavior because I remember you mentioning it in
one of your early mails. In my case, it was only drawn once which
lasted only for a blink.

> > Overall, I like it, though it does add some kilobytes to the kernel
> > image size.
>
> Why would it increase kernel size that much? The logos were there before as
> well (unless you enable all of them, of course :-).
>
My fault, I accidentally enabled ACPI :-)

Tony


2003-02-12 20:27:24

by James Simmons

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)


> > > All comments are welcomed! Thanks!
> >
> > Come on, is there really no one to comment on this??
>
> Except a question why it's not merged yet? :)

Looking for work has keot me busy. I merged it. One change I did do was
changed the CONFIG_FB_LOGO_* to CONFIG_LOGO_. In theory any one can use
the logo (i.e newport console). It is a much welcomed improvement. I
removed the hgafb logo code in the latest tree. It should use the standard
logo code. Also how should we go about for personal logos. Companies might
want to throw in there own thing which I have no issue with.


2003-02-12 20:43:19

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)

On Wed, 12 Feb 2003, James Simmons wrote:
> > > > All comments are welcomed! Thanks!
> > >
> > > Come on, is there really no one to comment on this??
> >
> > Except a question why it's not merged yet? :)
>
> Looking for work has keot me busy. I merged it. One change I did do was
> changed the CONFIG_FB_LOGO_* to CONFIG_LOGO_. In theory any one can use
> the logo (i.e newport console). It is a much welcomed improvement. I

OK.

> removed the hgafb logo code in the latest tree. It should use the standard
> logo code. Also how should we go about for personal logos. Companies might
> want to throw in there own thing which I have no issue with.

An option CONFIG_LOGO_USER, and a path CONFIG_LOGO_USER_PATH to a logo? Or
multiple user-specific logos (one of each type)?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2003-02-13 09:29:45

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code (fwd)

On Wed, 12 Feb 2003, Geert Uytterhoeven wrote:
> On Wed, 12 Feb 2003, James Simmons wrote:
> > > > > All comments are welcomed! Thanks!
> > > >
> > > > Come on, is there really no one to comment on this??
> > >
> > > Except a question why it's not merged yet? :)
> >
> > Looking for work has keot me busy. I merged it. One change I did do was
> > changed the CONFIG_FB_LOGO_* to CONFIG_LOGO_. In theory any one can use
> > the logo (i.e newport console). It is a much welcomed improvement. I
>
> OK.

BTW, most of the logo drawing is still not protected by CONFIG_(FB_)_LOGO. This
needs to change before it's submitted to Linus.

And why is the logo drawn from fbcon_switch() (which is not __init)? Does this
also explain why it's drawn twice (at least on some fbdevs)?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2003-02-17 10:22:13

by Nico Schottelius

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code [CONFIG OPTIONS]

[snipped out patch discussion]

I think if the patch and the features talked about are included in the
kernel we'll have (names are not correct)

CONFIG_LOGO=y/n
CONFIG_LOGO_XRES=128
CONFIG_LOGO_YRES=64
CONFIG_LOGO_BPP=8
CONFIG_LOGO_PATH="" # (/usr/src/linux/.../logo/tux.pnm)
CONFIG_LOGO_POS_X="left|center|right" # or absolute ?
CONFIG_LOGO_POS_Y="top|center|bottom" # like X windows +110,+200 ?
CONFIG_LOGO_BGCOL=#ef0000 # depends on bpp of framebuffer...

I think this would be enough for all and possible implementable for the
developers..or am I wrong ?

Greetings,

Nico


Attachments:
(No filename) (594.00 B)
(No filename) (189.00 B)
Download all attachments

2003-02-17 10:28:48

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code [CONFIG OPTIONS]

On Sat, 15 Feb 2003, Nico Schottelius wrote:
> I think if the patch and the features talked about are included in the
> kernel we'll have (names are not correct)
>
> CONFIG_LOGO=y/n
> CONFIG_LOGO_XRES=128
> CONFIG_LOGO_YRES=64
> CONFIG_LOGO_BPP=8

The 3 above are stored in struct linux_logo.

> CONFIG_LOGO_PATH="" # (/usr/src/linux/.../logo/tux.pnm)
> CONFIG_LOGO_POS_X="left|center|right" # or absolute ?
> CONFIG_LOGO_POS_Y="top|center|bottom" # like X windows +110,+200 ?
> CONFIG_LOGO_BGCOL=#ef0000 # depends on bpp of framebuffer...

I prefer to store the background color in struct linux_logo as well. And it
must be a palette index, not an RGB triplet, I think.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2003-02-17 19:13:03

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code [CONFIG OPTIONS]

On Mon, 2003-02-17 at 18:36, Geert Uytterhoeven wrote:
> > CONFIG_LOGO_POS_X="left|center|right" # or absolute ?
> > CONFIG_LOGO_POS_Y="top|center|bottom" # like X windows +110,+200 ?

Geert,

I was wondering how to implement positioning of the logo with the
current method of displaying it (by reserving screen space of height
"logo_lines"). This is not so nice to look at when we position the logo
in the center or the bottom.

So how about making the logo "float" above/obscure the text (ie,
overlay)? It's not difficult to implement since fbcon.c has "redraw"
versions of fbcon_bmove() and fbcon_clear(). All that needs to be done
is do a "scissors" test before an fb_imageblit().

Here's a trial implementation. The logo configuration has extra options
for the "overlay method" (CONFIG_LOGO_OVERLAY) and positioning of the
logo (top, bottom, left, right, center). The logo will always stay on
top while the underlying text is scrolling.

Attached is a diff. James' latest fbdev.diff and the series of patches
I submitted must be applied first.

Tony


diff -Naur linux-2.5.61-fbdev/drivers/video/console/fbcon.c linux-2.5.61/drivers/video/console/fbcon.c
--- linux-2.5.61-fbdev/drivers/video/console/fbcon.c 2003-02-17 17:57:37.000000000 +0000
+++ linux-2.5.61/drivers/video/console/fbcon.c 2003-02-17 18:39:56.000000000 +0000
@@ -106,9 +106,25 @@

struct display fb_display[MAX_NR_CONSOLES];
char con2fb_map[MAX_NR_CONSOLES];
+static struct fb_fillrect dim_logo;
static int logo_height;
static int logo_lines;
static int logo_shown = -1;
+
+#ifdef CONFIG_LOGO_OVERLAY
+static int logo_scissors = 1;
+static inline int get_logo_height(void)
+{
+ return 0;
+}
+#else
+static int logo_scissors = 0;
+static inline int get_logo_height(void)
+{
+ return (dim_logo.height);
+}
+#endif /* CONFIG_LOGO_OVERLAY */
+
/* Software scrollback */
int fbcon_softback_size = 32768;
static unsigned long softback_buf, softback_curr;
@@ -394,6 +410,27 @@
image.height = vc->vc_font.height;
image.depth = 0;

+ if (logo_scissors) {
+ int sx1 = dim_logo.dx;
+ int sx2 = dim_logo.dx + dim_logo.width;
+ int sy1 = dim_logo.dy;
+ int sy2 = dim_logo.dy + dim_logo.height;
+
+ image.width = vc->vc_font.width;
+ while (count--) {
+ if (!(image.dx + image.width > sx1 &&
+ image.dy + image.height > sy1 &&
+ image.dx < sx2 && image.dy < sy2)) {
+ image.data = p->fontdata +
+ (scr_readw(s) & charmask) * cellsize;
+ info->fbops->fb_imageblit(info, &image);
+ }
+ image.dx += vc->vc_font.width;
+ s++;
+ }
+ return;
+ }
+
if (!(vc->vc_font.width & 7)) {
unsigned int pitch, cnt, i, j, k;
unsigned int maxcnt = FB_PIXMAPSIZE/cellsize;
@@ -563,6 +600,19 @@
cursor.dest = dest;
cursor.rop = ROP_XOR;

+ if (logo_scissors) {
+ int sx1 = dim_logo.dx;
+ int sx2 = dim_logo.dx + dim_logo.width;
+ int sy1 = dim_logo.dy;
+ int sy2 = dim_logo.dy + dim_logo.height;
+
+ if (cursor.image.dx < sx2 &&
+ cursor.image.dy < sy2 &&
+ cursor.image.dx + cursor.image.width > sx1 &&
+ cursor.image.dy + cursor.image.height > sy1)
+ return;
+ }
+
if (info->fbops->fb_cursor)
info->fbops->fb_cursor(info, &cursor);
}
@@ -945,7 +995,8 @@
int cnt;
int step;

- logo_height = fb_prepare_logo(info);
+ fb_prepare_logo(&dim_logo, info);
+ logo_height = get_logo_height();
logo_lines = (logo_height + vc->vc_font.height - 1) /
vc->vc_font.height;
q = (unsigned short *) (vc->vc_origin +
@@ -1115,6 +1166,11 @@
redraw_cursor = 1;
}

+ if (logo_scissors) {
+ fbcon_redraw_clear(vc, p, sy, sx, height, width);
+ return;
+ }
+
/* Split blits that cross physical y_wrap boundary */

y_break = p->vrows - p->yscroll;
@@ -1151,12 +1207,23 @@
redraw_cursor = 1;
}

- image.fg_color = attr_fgcol(p, c);
- image.bg_color = attr_bgcol(p, c);
image.dx = xpos * vc->vc_font.width;
image.dy = real_y(p, ypos) * vc->vc_font.height;
image.width = vc->vc_font.width;
image.height = vc->vc_font.height;
+ if (logo_scissors) {
+ int sx1 = dim_logo.dx;
+ int sx2 = dim_logo.dx + dim_logo.width;
+ int sy1 = dim_logo.dy;
+ int sy2 = dim_logo.dy + dim_logo.height;
+
+ if (image.dx < sx2 && image.dy < sy2 &&
+ image.dx + image.width > sx1 &&
+ image.dy + image.height > sy1)
+ return;
+ }
+ image.fg_color = attr_fgcol(p, c);
+ image.bg_color = attr_bgcol(p, c);
image.depth = 1;
image.data = p->fontdata + (c & charmask) * vc->vc_font.height * width;

@@ -1707,8 +1774,7 @@
redraw_up:
fbcon_redraw(vc, p, t, b - t - count,
count * vc->vc_cols);
- accel_clear(vc, p, real_y(p, b - count), 0,
- count, vc->vc_cols);
+ fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
scr_memsetw((unsigned short *) (vc->vc_origin +
vc->vc_size_row *
(b - count)),
@@ -1913,6 +1979,7 @@
&& conp2->vc_bottom == conp2->vc_rows)
conp2->vc_top = 0;
logo_shown = -1;
+ logo_scissors = 0;
}
if (info)
info->var.yoffset = p->yscroll = 0;
@@ -2476,6 +2543,7 @@
logo_lines * vc->vc_cols);
}
logo_shown = -1;
+ logo_scissors = 0;
}
fbcon_cursor(vc, CM_ERASE | CM_SOFTBACK);
fbcon_redraw_softback(vc, p, lines);
diff -Naur linux-2.5.61-fbdev/drivers/video/fbmem.c linux-2.5.61/drivers/video/fbmem.c
--- linux-2.5.61-fbdev/drivers/video/fbmem.c 2003-02-17 17:57:40.000000000 +0000
+++ linux-2.5.61/drivers/video/fbmem.c 2003-02-17 18:38:50.000000000 +0000
@@ -363,15 +363,15 @@
static int ofonly __initdata = 0;
#endif

+#ifdef CONFIG_LOGO
+#include <linux/linux_logo.h>
+
static inline unsigned safe_shift(unsigned d, int n)
{
return n < 0 ? d >> -n : d << n;
}

-#ifdef CONFIG_FB_LOGO
-#include <linux/linux_logo.h>
-
-static void __init fb_set_logocmap(struct fb_info *info,
+static void fb_set_logocmap(struct fb_info *info,
const struct linux_logo *logo)
{
struct fb_cmap palette_cmap;
@@ -435,7 +435,7 @@
}
}

-static void __init fb_set_logo_directpalette(struct fb_info *info,
+static void fb_set_logo_directpalette(struct fb_info *info,
const struct linux_logo *logo,
u32 *palette)
{
@@ -520,15 +520,72 @@
int needs_truepalette;
int needs_cmapreset;
int type;
+ int dx;
+ int dy;
const struct linux_logo *logo;
} fb_logo;

-int fb_prepare_logo(struct fb_info *info)
+#ifdef CONFIG_LOGO_CENTER
+static inline int get_logo_xpos(struct fb_info *info)
{
- memset(&fb_logo, 0, sizeof(struct logo_data));
+ return ((info->var.xres - fb_logo.logo->width)/2);
+}
+#elif CONFIG_LOGO_RIGHT
+static inline int get_logo_xpos(struct fb_info *info)
+{
+ return (info->var.xres - fb_logo.logo->width);
+}
+#else
+static inline int get_logo_xpos(struct fb_info *info)
+{
+ return (0);
+}
+#endif

- fb_logo.depth = info->var.bits_per_pixel;
+#ifdef CONFIG_LOGO_MIDDLE
+static inline int get_logo_ypos(struct fb_info *info)
+{
+ return ((info->var.yres - fb_logo.logo->height)/2);
+}
+#elif CONFIG_LOGO_BOTTOM
+static inline int get_logo_ypos(struct fb_info *info)
+{
+ return (info->var.yres - fb_logo.logo->height);
+}
+#else
+static inline int get_logo_ypos(struct fb_info *info)
+{
+ return (0);
+}
+#endif
+
+#ifdef CONFIG_LOGO_OVERLAY
+static inline void draw_logo(struct fb_image *image, struct fb_info *info)
+{
+ image->dx = fb_logo.dx;
+ info->fbops->fb_imageblit(info, image);
+}
+#else
+static inline void draw_logo(struct fb_image *image, struct fb_info *info)
+{
+ int xpos = fb_logo.dx;
+ int width = fb_logo.logo->width + 8;
+ int times = num_online_cpus(), x;

+ for (x = xpos; x < times * width &&
+ x <= info->var.xres-width; x += width) {
+ image->dx = x;
+ info->fbops->fb_imageblit(info, image);
+ }
+}
+#endif /* CONFIG_LOGO_OVERLAY */
+
+void fb_prepare_logo(struct fb_fillrect *rect, struct fb_info *info)
+{
+ memset(&fb_logo, 0, sizeof(struct logo_data));
+ memset(rect, 0, sizeof(struct fb_fillrect));
+ fb_logo.depth = info->var.bits_per_pixel;
+
switch (info->fix.visual) {
case FB_VISUAL_TRUECOLOR:
if (fb_logo.depth >= 8) {
@@ -587,9 +644,14 @@
fb_logo.logo = fb_find_logo(fb_logo.type);
if (!fb_logo.logo || fb_logo.logo->height > info->var.yres) {
fb_logo.logo = NULL;
- return 0;
+ return;
}
- return fb_logo.logo->height;
+ fb_logo.dx = get_logo_xpos(info);
+ fb_logo.dy = get_logo_ypos(info);
+ rect->dx = fb_logo.dx;
+ rect->dy = fb_logo.dy;
+ rect->width = fb_logo.logo->width;
+ rect->height = fb_logo.logo->height;
}

int fb_show_logo(struct fb_info *info)
@@ -597,7 +659,6 @@
unsigned char *fb = info->screen_base, *logo_new = NULL;
u32 *palette = NULL, *saved_pseudo_palette = NULL;
struct fb_image image;
- int x;

/* Return if the frame buffer is not mapped */
if (!fb || !info->fbops->fb_imageblit ||
@@ -642,14 +703,10 @@

image.width = fb_logo.logo->width;
image.height = fb_logo.logo->height;
- image.dy = 0;
+ image.dy = fb_logo.dy;
+
+ draw_logo(&image, info);

- for (x = 0; x < num_online_cpus() * (fb_logo.logo->width + 8) &&
- x <= info->var.xres-fb_logo.logo->width; x += (fb_logo.logo->width + 8)) {
- image.dx = x;
- info->fbops->fb_imageblit(info, &image);
- }
-
if (palette != NULL)
kfree(palette);
if (saved_pseudo_palette != NULL)
@@ -659,9 +716,10 @@
return fb_logo.logo->height;
}
#else
-int fb_prepare_logo(struct fb_info *info) { return 0; }
+void fb_prepare_logo(struct fb_fillrect *rect, struct fb_info *info)
+{ return 0; }
int fb_show_logo(struct fb_info *info) { return 0; }
-#endif /* CONFIG_FB_LOGO */
+#endif /* CONFIG_LOGO */

static int fbmem_read_proc(char *buf, char **start, off_t offset,
int len, int *eof, void *private)
diff -Naur linux-2.5.61-fbdev/drivers/video/logo/Kconfig linux-2.5.61/drivers/video/logo/Kconfig
--- linux-2.5.61-fbdev/drivers/video/logo/Kconfig 2003-02-17 18:10:15.000000000 +0000
+++ linux-2.5.61/drivers/video/logo/Kconfig 2003-02-17 18:08:22.000000000 +0000
@@ -8,6 +8,47 @@
bool "Bootup logo"
depends on FB || CONFIG_SGI_NEWPORT_CONSOLE

+config LOGO_OVERLAY
+ bool "Logo Overlay"
+ depends on LOGO && FB
+ ---help---
+ If you say Y, the logo will appear to "float" over
+ the primary display, obstructing the underlying
+ text.
+
+ If unsure, say N.
+choice
+ prompt "Horizontal Position"
+ depends on LOGO_OVERLAY
+ default LOGO_LEFT
+
+config LOGO_LEFT
+ bool "Left"
+
+config LOGO_CENTER
+ bool "Center"
+
+config LOGO_RIGHT
+ bool "Right"
+
+endchoice
+
+choice
+ prompt "Vertical Position"
+ depends on LOGO_OVERLAY
+ default LOGO_TOP
+
+config LOGO_TOP
+ bool "Top"
+
+config LOGO_MIDDLE
+ bool "Center"
+
+config LOGO_BOTTOM
+ bool "Bottom"
+
+endchoice
+
config LOGO_LINUX_MONO
bool "Black and white Linux logo"
depends on LOGO
diff -Naur linux-2.5.61-fbdev/include/linux/fb.h linux-2.5.61/include/linux/fb.h
--- linux-2.5.61-fbdev/include/linux/fb.h 2003-02-17 17:57:37.000000000 +0000
+++ linux-2.5.61/include/linux/fb.h 2003-02-17 18:05:01.000000000 +0000
@@ -462,7 +462,7 @@
/* drivers/video/fbmem.c */
extern int register_framebuffer(struct fb_info *fb_info);
extern int unregister_framebuffer(struct fb_info *fb_info);
-extern int fb_prepare_logo(struct fb_info *fb_info);
+extern void fb_prepare_logo(struct fb_fillrect *rect, struct fb_info *fb_info);
extern int fb_show_logo(struct fb_info *fb_info);
extern struct fb_info *registered_fb[FB_MAX];
extern int num_registered_fb;

2003-02-17 19:22:24

by John Bradford

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code [CONFIG OPTIONS]

> So how about making the logo "float" above/obscure the text (ie,
> overlay)? It's not difficult to implement since fbcon.c has "redraw"
> versions of fbcon_bmove() and fbcon_clear(). All that needs to be done
> is do a "scissors" test before an fb_imageblit().

On the subject of the new logo code, would it be worth making it do
something, (change colour, move, or animate), during a console bell?

John.

2003-02-18 21:47:32

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: New logo code [CONFIG OPTIONS]

On Tue, 2003-02-18 at 03:32, John Bradford wrote:
> > So how about making the logo "float" above/obscure the text (ie,
> > overlay)? It's not difficult to implement since fbcon.c has "redraw"
> > versions of fbcon_bmove() and fbcon_clear(). All that needs to be done
> > is do a "scissors" test before an fb_imageblit().
>
> On the subject of the new logo code, would it be worth making it do
> something, (change colour, move, or animate), during a console bell?
>

Possibly, it depends on the console/input developers if they want to add
something like fb_flash_logo() besides doing a kd_mksound(). Also, if
you don't mind compiling in a bunch of logo images to your kernel.

On a more practical note, the "scissors test" (I should have named this
"exclusive clipping test") can perhaps be enabled arbitrarily by
userland clients. You'll be left with a rectangular screen space that
will not be touched by the console. Then a distributor can do whatever
it wants with that screen estate, say an animating splash or a pop-up
window, which in theory can be triggered any time.

Tony