Skip to contentSkip to conversation

tdfxfb: fix for background used in fbcon_clear

PATCH New Jakub Bogusz 1 participant 1 message Jul 30, 2003 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tdfxfb: fix for background used in fbcon_clear

Hello,

This time I checked recent linux-fbdev-devel archives - and didn't see any patch for this issue. So here is my fix.

There was wrong color used in fillrect in 16/24/32bpp (pseudo_palette mapping was omitted), which resulted in ugly black (well, almost black) rectangles painted when some "clear" terminal command was sent (like "^[[J", "^[[K") with background colour different than black. It was visible e.g. in mc's View.

BTW, if I use 800x600 framebuffer (i.e. 100x37.5 charasters) the remaining half line at the bottom sometimes changes colour from black to some other (used as background in last "clear" command). Shouldn't margins always be black?
Background of last erase character is definitely not what we want...

I changed "region.color = attr_bgcol_ec(bgshift, vc);" to "region.color = 0;" in accel_clear_margins() (linux/drivers/video/console/fbcon.c:505) - it fixed this issue and I can't see any side-effects.

Signature · 2 lines
Jakub Bogusz    http://cyber.cs.net.pl/~qboosh/
PLD Linux       http://www.pld-linux.org/

This fixes background used for "clear" terminal commands (^[[J, ^[[K etc.) in 16/24/32bpp modes.

drivers/video/tdfxfb.c renamed from drivers/video/tdfxfb.c.orig +5 -1
@@ -890,7 +890,11 @@
 
 	banshee_make_room(par, 5);
 	tdfx_outl(par,	DSTFORMAT, fmt);
-	tdfx_outl(par,	COLORFORE, rect->color);
+	if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) {
+		tdfx_outl(par,	COLORFORE, rect->color);
+	} else { /* FB_VISUAL_TRUECOLOR */
+		tdfx_outl(par, COLORFORE, ((u32*)(info->pseudo_palette))[rect->color]);
+	}
 	tdfx_outl(par,	COMMAND_2D, COMMAND_2D_FILLRECT | (tdfx_rop << 24));
 	tdfx_outl(par,	DSTSIZE,    rect->width | (rect->height << 16));
 	tdfx_outl(par,	LAUNCH_2D,  rect->dx | (rect->dy << 16));