Skip to contentSkip to conversation

2.5.42 compiler error in video/vga16fb.c

DISCUSSION Bob Billson 4 participants 5 messages Oct 12, 2002 – Oct 19, 2002 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

In drivers/video/vga16fb.c gcc (2.95.4 and 3.2) gives:

gcc -Wp,-MD,drivers/video/.vga16fb.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -malign-functions=4 -Iarch/i386/mach-generic -nostdinc -iwithprefix include -DKBUILD_BASENAME=vga16fb -c -o drivers/video/vga16fb.o drivers/video/vga16fb.c
drivers/video/vga16fb.c: In function `vga16fb_set_disp':
drivers/video/vga16fb.c:177: structure has no member named visual' drivers/video/vga16fb.c:178: structure has no member named type' drivers/video/vga16fb.c:179: structure has no member named type_aux' drivers/video/vga16fb.c:180: structure has no member named ypanstep' drivers/video/vga16fb.c:181: structure has no member named ywrapstep' drivers/video/vga16fb.c:182: structure has no member named line_length' drivers/video/vga16fb.c: In function `vga_vesa_blank':
drivers/video/vga16fb.c:664: warning: implicit declaration of functioncli' drivers/video/vga16fb.c:671: warning: implicit declaration of functionsti' drivers/video/vga16fb.c: At top level:
drivers/video/vga16fb.c:814: unknown field fb_get_fix' specified in initializer drivers/video/vga16fb.c:814: warning: initialization from incompatible pointer type drivers/video/vga16fb.c:815: unknown field fb_get_var' specified in initializer drivers/video/vga16fb.c:815: warning: initialization from incompatible pointer type make[2]: *** [drivers/video/vga16fb.o] Error 1
make[1]: *** [drivers/video] Error 2
make: *** [drivers] Error 2

bob

Signature · 4 lines
 bob billson        email: [email protected]          ham: kc2wz    /)
                           [email protected]             beekeeper  -8|||}
 "Níl aon tinteán mar do thinteán féin." --Dorothy    Linux geek    \)
 [ GPG key--> http://bhive.dhs.org/gpgkey.html ]
#1 lore raw
Quoted 10 lines · Bob Billson

In drivers/video/vga16fb.c gcc (2.95.4 and 3.2) gives:

gcc -Wp,-MD,drivers/video/.vga16fb.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -malign-functions=4 -Iarch/i386/mach-generic -nostdinc -iwithprefix include -DKBUILD_BASENAME=vga16fb -c -o drivers/video/vga16fb.o drivers/video/vga16fb.c
drivers/video/vga16fb.c: In function `vga16fb_set_disp':
drivers/video/vga16fb.c:177: structure has no member named visual' drivers/video/vga16fb.c:178: structure has no member named type' drivers/video/vga16fb.c:179: structure has no member named type_aux' drivers/video/vga16fb.c:180: structure has no member named ypanstep' drivers/video/vga16fb.c:181: structure has no member named ywrapstep' drivers/video/vga16fb.c:182: structure has no member named line_length'

It looks like that nobody is interested in VGA anymore. Are there any objections against patch below? It is for current 2.5.42-bk, and it fixes vga16fb compilability, and adds -depth 8 (to get 320x200, or 360x480 in planar mode) and -depth 0 (to get fast textmode) to the vga16fb.

If there are no objections, I'll split it up and send to Linus. But as I already said (and already asked), I'm not going to be vga16fb maintainer (because of I use matroxfb everywhere), so if there is somebody else who has vga16fb fixes, or who wants to maintain vga16fb, please step up...

Best regards,
Petr Vandrovec [email protected]

drivers/video/Config.help +5 -0
diff -urdN linux/drivers/video/Config.help linux/drivers/video/Config.help
@@ -250,6 +250,11 @@
   Only answer Y here if you have a (very old) VGA card that isn't VESA
   2 compatible.
 
+CONFIG_FBCON_VGA
+  This is the low level frame buffer console driver for VGA text mode;
+  it is used by frame buffer device drivers that support VGA text
+  mode.
+
 CONFIG_FB_VGA16
   This is the frame buffer device driver for VGA 16 color graphic
   cards. Say Y if you have such a card.
drivers/video/Config.in +3 -0
diff -urdN linux/drivers/video/Config.in linux/drivers/video/Config.in
@@ -234,6 +234,7 @@
       tristate '    Atari interleaved bitplanes (8 planes) support' CONFIG_FBCON_IPLAN2P8
 #      tristate '    Atari interleaved bitplanes (16 planes) support' CONFIG_FBCON_IPLAN2P16
       tristate '    VGA 16-color planar support' CONFIG_FBCON_VGA_PLANES
+      tristate '    VGA characters/attributes support' CONFIG_FBCON_VGA
       tristate '    HGA monochrome support (EXPERIMENTAL)' CONFIG_FBCON_HGA
    else
       # Guess what we need
@@ -391,9 +392,11 @@
       fi
       if [ "$CONFIG_FB_VGA16" = "y" ]; then
 	 define_tristate CONFIG_FBCON_VGA_PLANES y
+	 define_tristate CONFIG_FBCON_VGA y
       else
 	 if [ "$CONFIG_FB_VGA16" = "m" ]; then
 	    define_tristate CONFIG_FBCON_VGA_PLANES m
+	    define_tristate CONFIG_FBCON_VGA m
 	 fi
       fi
       if [ "$CONFIG_FB_HGA" = "y" ]; then
drivers/video/Makefile +3 -2
diff -urdN linux/drivers/video/Makefile linux/drivers/video/Makefile
@@ -8,7 +8,7 @@
 export-objs    	:= fbmem.o fbcmap.o fbcon.o fbmon.o modedb.o \
 		   fbcon-afb.o fbcon-ilbm.o fbcon-accel.o cyber2000fb.o \
 		   fbcon-iplan2p2.o fbcon-iplan2p4.o fbgen.o \
-		   fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \
+		   fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-vga8-planes.o fbcon-vga.o fbcon-cfb16.o \
 		   fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \
 		   fbcon-cfb8.o fbcon-mfb.o fbcon-hga.o
 
@@ -68,7 +68,7 @@
 obj-$(CONFIG_FB_S3TRIO)           += S3triofb.o
 obj-$(CONFIG_FB_TGA)              += tgafb.o
 obj-$(CONFIG_FB_VESA)             += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o 
-obj-$(CONFIG_FB_VGA16)            += vga16fb.o fbcon-vga-planes.o
+obj-$(CONFIG_FB_VGA16)            += vga16fb.o fbcon-vga-planes.o fbcon-vga8-planes.o
 obj-$(CONFIG_FB_VIRGE)            += virgefb.o
 obj-$(CONFIG_FB_G364)             += g364fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_FM2)              += fm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
@@ -115,6 +115,7 @@
 obj-$(CONFIG_FBCON_IPLAN2P4)      += fbcon-iplan2p4.o
 obj-$(CONFIG_FBCON_IPLAN2P8)      += fbcon-iplan2p8.o
 obj-$(CONFIG_FBCON_MFB)           += fbcon-mfb.o
+obj-$(CONFIG_FBCON_VGA)		  += fbcon-vga.o
 obj-$(CONFIG_FBCON_HGA)           += fbcon-hga.o
 obj-$(CONFIG_FBCON_STI)           += fbcon-sti.o
 obj-$(CONFIG_FBCON_ACCEL)	  += fbcon-accel.o
drivers/video/fbcon-vga.c +213 -0

213 lines not on this page · raw message

drivers/video/fbcon-vga8-planes.c +382 -0

382 lines not on this page · raw message

drivers/video/fbgen.c +17 -3
diff -urdN linux/drivers/video/fbgen.c linux/drivers/video/fbgen.c
@@ -175,12 +175,26 @@
 
 void do_install_cmap(int con, struct fb_info *info)
 {
+    struct display* disp;
+
     if (con != info->currcon)
 	return;
-    if (fb_display[con].cmap.len)
-	fb_set_cmap(&fb_display[con].cmap, 1, info);
+    if (con >= 0) {
+        disp = fb_display + con;
+    } else {
+        disp = info->disp;
+    }
+    if (disp->cmap.len)
+	fb_set_cmap(&disp->cmap, 1, info);
     else {
-	int size = fb_display[con].var.bits_per_pixel == 16 ? 64 : 256;
+	int size;
+	
+	switch (disp->var.bits_per_pixel) {
+		case 1:  size = 2; break;
+		case 2:  size = 4; break;
+		case 3:  size = 8; break;
+		default: size = 16; break;
+	}
 	fb_set_cmap(fb_default_cmap(size), 1, info);
     }
 }
drivers/video/vga16fb.c +408 -235

918 lines not on this page · raw message

drivers/video/vgacon.c +7 -0
diff -urdN linux/drivers/video/vgacon.c linux/drivers/video/vgacon.c
@@ -180,6 +180,13 @@
 #endif
 	}
 
+	/* VGA16 modes are not handled by VGACON */
+	if ((ORIG_VIDEO_MODE == 0x0D) || /* 320x200/4 */
+	    (ORIG_VIDEO_MODE == 0x0E) || /* 640x200/4 */
+	    (ORIG_VIDEO_MODE == 0x10) || /* 640x350/4 */
+	    (ORIG_VIDEO_MODE == 0x12) || /* 640x480/4 */
+	    (ORIG_VIDEO_MODE == 0x6A))   /* 800x600/4, 0x6A is very common */
+		goto no_vga;
 
 	vga_video_num_lines = ORIG_VIDEO_LINES;
 	vga_video_num_columns = ORIG_VIDEO_COLS;
include/video/fbcon-vga-planes.h +1 -0
diff -urdN linux/include/video/fbcon-vga-planes.h linux/include/video/fbcon-vga-planes.h
@@ -18,6 +18,7 @@
 #endif
 
 extern struct display_switch fbcon_vga_planes;
+extern struct display_switch fbcon_vga8_planes;
 extern struct display_switch fbcon_ega_planes;
 extern void fbcon_vga_planes_setup(struct display *p);
 extern void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx,
#4 lore raw
In reply to Bob Billson
Quoted 2 lines

In drivers/video/vga16fb.c gcc (2.95.4 and 3.2) gives:

I have a newer file in fbdev BK but I haven't finished porting it to the new api yet.

Quoted 34 lines

gcc -Wp,-MD,drivers/video/.vga16fb.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -malign-functions=4 -Iarch/i386/mach-generic -nostdinc -iwithprefix include -DKBUILD_BASENAME=vga16fb -c -o drivers/video/vga16fb.o drivers/video/vga16fb.c
drivers/video/vga16fb.c: In function `vga16fb_set_disp':
drivers/video/vga16fb.c:177: structure has no member named visual' drivers/video/vga16fb.c:178: structure has no member named type' drivers/video/vga16fb.c:179: structure has no member named type_aux' drivers/video/vga16fb.c:180: structure has no member named ypanstep' drivers/video/vga16fb.c:181: structure has no member named ywrapstep' drivers/video/vga16fb.c:182: structure has no member named line_length' drivers/video/vga16fb.c: In function `vga_vesa_blank':
drivers/video/vga16fb.c:664: warning: implicit declaration of functioncli' drivers/video/vga16fb.c:671: warning: implicit declaration of functionsti' drivers/video/vga16fb.c: At top level:
drivers/video/vga16fb.c:814: unknown field fb_get_fix' specified in initializer drivers/video/vga16fb.c:814: warning: initialization from incompatible pointer type drivers/video/vga16fb.c:815: unknown field fb_get_var' specified in initializer drivers/video/vga16fb.c:815: warning: initialization from incompatible pointer type make[2]: *** [drivers/video/vga16fb.o] Error 1
make[1]: *** [drivers/video] Error 2
make: *** [drivers] Error 2

bob
--

 bob billson        email: [email protected]          ham: kc2wz    /)
                           [email protected]             beekeeper  -8|||}

"N�l aon tinte�n mar do thinte�n f�in." --Dorothy Linux geek \)
[ GPG key--> http://bhive.dhs.org/gpgkey.html ]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Petr Vandrovec
Quoted 5 lines

It looks like that nobody is interested in VGA anymore. Are there any objections against patch below? It is for current 2.5.42-bk, and it fixes vga16fb compilability, and adds -depth 8 (to get 320x200, or 360x480 in planar mode) and -depth 0 (to get fast textmode) to the vga16fb.

I'm working on it.

Quoted 1 line

If there are no objections, I'll split it up and send to Linus. But as

Wait. I have your work already in the fbdev BK tree. I'm porting it to the new api. I just need to write up a fillrect and copy area function for vga planes mode.

Quoted 3 lines

I already said (and already asked), I'm not going to be vga16fb maintainer (because of I use matroxfb everywhere), so if there is somebody else who has vga16fb fixes, or who wants to maintain vga16fb, please step up...

I guess I can do it. I need to rewrite vgacon in the near future anyways.

#3 lore raw
Quoted 6 lines · James Simmons
Quoted 5 lines

It looks like that nobody is interested in VGA anymore. Are there any objections against patch below? It is for current 2.5.42-bk, and it fixes vga16fb compilability, and adds -depth 8 (to get 320x200, or 360x480 in planar mode) and -depth 0 (to get fast textmode) to the vga16fb.

Quoted 8 lines

I'm working on it.

Quoted 1 line

If there are no objections, I'll split it up and send to Linus. But as

Wait. I have your work already in the fbdev BK tree. I'm porting it to the new api. I just need to write up a fillrect and copy area function for vga planes mode.

I have a fillrect, copyarea and imageblit for vga16 since it was one of the first drivers I tested with the new framework. If you're too busy, you may want to use them instead. Never posted it because I don't want to preempt Petr.

Tony

/*
* linux/drivers/video/fbcon-vga-planes.c -- Low level frame buffer operations
* for VGA 4-plane modes
*
* Copyright 1999 Ben Pfaff <[email protected]> and Petr Vandrovec <[email protected]>
* Based on code by Michael Schmitz
* Based on the old macfb.c 4bpp code by Alan Cox
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
* archive for more details. */

#include <linux/module.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/string.h>
#include <linux/fb.h>
#include <linux/vt_buffer.h>

#include <asm/io.h>

#include <video/fbcon.h>
#include <video/fbcon-vga-planes.h>

#include "vgaops.h"

void vgaplanes_copyarea(struct fb_info *p, struct fb_copyarea *area)

{
	int x, x2, y2, old_dx, old_dy, vxres, vyres;
	int height, width, line_ofs;
	char *dst = NULL, *src = NULL;

	vxres = p->var.xres_virtual;
	vyres = p->var.yres_virtual;
#ifdef FBCON_HAS_ROTATE
	if (p->var.vmode & (FB_VMODE_ROTATE_CW | FB_VMODE_ROTATE_CCW)) {
		vxres = p->var.yres_virtual;
		vyres = p->var.xres_virtual;
	}

#endif

	if (area->dx > vxres || 
	    area->sx > vxres ||
	    area->dy > vyres ||
	    area->sy > vyres)
		return;

	/* clip the destination */
	old_dx = area->dx;
	old_dy = area->dy;

	/*
	 * We could use hardware clipping but on many cards you get around
	 * hardware clipping by writing to framebuffer directly.
	 */
	x2 = area->dx + area->width;
	y2 = area->dy + area->height;
	area->dx = area->dx > 0 ? area->dx : 0;
	area->dy = area->dy > 0 ? area->dy : 0;
	x2 = x2 < vxres ? x2 : vxres;
	y2 = y2 < vyres ? y2 : vyres;
	area->width = x2 - area->dx;
	area->height = y2 - area->dy;

	/* update sx1,sy1 */
	area->sx += (area->dx - old_dx);
	area->sy += (area->dy - old_dy);

	/* the source must be completely inside the virtual screen */
	if (area->sx < 0 || area->sy < 0 ||
	    (area->sx + area->width) > vxres ||
	    (area->sy + area->height) > vyres)
		return;

	width = area->width/8;
	height = area->height;
	line_ofs = p->fix.line_length - width;

	setmode(1);
	setop(0);
	setsr(0xf);

	if (area->dy < area->sy || (area->dy == area->sy && area->dx < area->sx)) {
		dst = p->screen_base + (area->dx/8) + area->dy * p->fix.line_length;
		src = p->screen_base + (area->sx/8) + area->sy * p->fix.line_length;
		while (height--) {
			for (x = 0; x < width; x++) {
				readb(src);
				writeb(0, dst);
				dst++;
				src++;
			}
			src += line_ofs;
			dst += line_ofs;
		}
	} else {
		dst = p->screen_base + (area->dx/8) + width + (area->dy + height - 1) * p->fix.line_length;
		src = p->screen_base + (area->sx/8) + width + (area->sy + height - 1) * p->fix.line_length;
		while (height--) {
			for (x = 0; x < width; x++) {
				dst--;
				src--;
				readb(src);
				writeb(0, dst);
			}
			src -= line_ofs;
			dst -= line_ofs;
		}
	}
}

/*
* linux/drivers/video/fbcon-vga-planes.c -- Low level frame buffer operations
* for VGA 4-plane modes
*
* Copyright 1999 Ben Pfaff <[email protected]> and Petr Vandrovec <[email protected]>
* Based on code by Michael Schmitz
* Based on the old macfb.c 4bpp code by Alan Cox
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
* archive for more details. */

#include <linux/module.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/string.h>
#include <linux/fb.h>
#include <linux/vt_buffer.h>

#include <asm/io.h>

#include <video/fbcon.h>
#include <video/fbcon-vga-planes.h>

#include "vgaops.h"

void vgaplanes_fillrect(struct fb_info *p, struct fb_fillrect *rect)

{
	int x, x2, y2, vxres, vyres;
	int width, height;
	int line_ofs;
	char *dst;

	vxres = p->var.xres_virtual;
	vyres = p->var.yres_virtual;
#ifdef FBCON_HAS_ROTATE
	if (p->var.vmode & (FB_VMODE_ROTATE_CW | FB_VMODE_ROTATE_CCW)) {
		vxres = p->var.yres_virtual;
		vyres = p->var.xres_virtual;
	}

#endif

	if (!rect->width || !rect->height ||
	    rect->dx > vxres ||
	    rect->dy > vyres)
		return;

	/* We could use hardware clipping but on many cards you get around
	 * hardware clipping by writing to framebuffer directly. */

	x2 = rect->dx + rect->width;
	y2 = rect->dy + rect->height;
	x2 = x2 < vxres ? x2 : vxres;
	y2 = y2 < vyres ? y2 : vyres;
	rect->width = x2 - rect->dx;

	height = y2 - rect->dy;
	width = rect->width/8;

	line_ofs = p->fix.line_length - width;
	dst = p->screen_base + (rect->dx/8) + rect->dy * p->fix.line_length;

	switch (rect->rop) {
	case ROP_COPY:
		setmode(0);
		setop(0);
		setsr(0xf);
		setcolor(rect->color);
		selectmask();
		
		setmask(0xff);
		
		while (height--) {
			for (x = 0; x < width; x++) {
				writeb(0, dst);
				dst++;
			}
			dst += line_ofs;
		}
		break;
	case ROP_XOR:
		setmode(0);
		setop(0x18);
		setsr(0xf);
		setcolor(0xf);
		selectmask();
		
		setmask(0xff);
		while (height--) {
			for (x = 0; x < width; x++) {
				rmw(dst);
				dst++;
			}
			dst += line_ofs;
		}
		break;
	}
}

/*
* linux/drivers/video/fbcon-vga-planes.c -- Low level frame buffer operations
* for VGA 4-plane modes
*
* Copyright 1999 Ben Pfaff <[email protected]> and Petr Vandrovec <[email protected]>
* Based on code by Michael Schmitz
* Based on the old macfb.c 4bpp code by Alan Cox
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
* archive for more details. */

#include <linux/module.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/string.h>
#include <linux/fb.h>
#include <linux/vt_buffer.h>

#include <asm/io.h>

#include <video/fbcon.h>
#include <video/fbcon-vga-planes.h>

#include "vgaops.h"

void vgaplanes_imageblit(struct fb_info *p, struct fb_image *image)

{
	int x2, y2, vxres, vyres, i, j;
	int fg = image->fg_color;
	int bg = image->bg_color;
	int width, height;
	char *src = image->data, *dst;

	vxres = p->var.xres_virtual;
	vyres = p->var.yres_virtual;

	/* 
	 * We could use hardware clipping but on many cards you get around hardware
	 * clipping by writing to framebuffer directly like we are doing here. 
	 */
	if (image->dx > vxres ||
	    image->dy > vyres)
		return;

	x2 = image->dx + image->width;
	y2 = image->dy + image->height;
	image->dx = image->dx > 0 ? image->dx : 0;
	image->dy = image->dy > 0 ? image->dy : 0;
	x2 = x2 < vxres ? x2 : vxres;
	y2 = y2 < vyres ? y2 : vyres;
	image->width  = x2 - image->dx;
	image->height = y2 - image->dy;

	width = image->width/8;
	height = image->height;

	setmode(2);
	setop(0);
	setsr(0xf);
	setcolor(fg);
	selectmask();

	setmask(0xff);
	dst = p->screen_base + (image->dx/8) + image->dy * p->fix.line_length;
	writeb(bg, dst);
	rmb();
	readb(dst);
	setmode(3);
	wmb();

	for (i = 0; i < height; i++) {
		char *dst1;

		dst1 = dst;
		for (j = 0; j < width; j++) 
			writeb(*src++, dst1++);

		dst += p->fix.line_length;
	}
	wmb();
}

void egaplanes_imageblit(struct fb_info *p, struct fb_image *image)

{
	int x2, y2, vxres, vyres, i, j;
	int fg = image->fg_color;
	int bg = image->bg_color;
	int width, height;
	char *src = image->data, *dst;

	vxres = p->var.xres_virtual;
	vyres = p->var.yres_virtual;

	/* 
	 * We could use hardware clipping but on many cards you get around hardware
	 * clipping by writing to framebuffer directly like we are doing here. 
	 */
	if (image->dx > vxres ||
	    image->dy > vyres)
		return;

	x2 = image->dx + image->width;
	y2 = image->dy + image->height;
	image->dx = image->dx > 0 ? image->dx : 0;
	image->dy = image->dy > 0 ? image->dy : 0;
	x2 = x2 < vxres ? x2 : vxres;
	y2 = y2 < vyres ? y2 : vyres;
	image->width  = x2 - image->dx;
	image->height = y2 - image->dy;

	width = image->width/8;
	height = image->height;

	setmode(2);
	setop(0);
	selectmask();

	setmask(0xff);
	dst = p->screen_base + (image->dx/8) + image->dy * p->fix.line_length;
	writeb(bg, dst);
	rmb();
	readb(dst);
	wmb();
	selectmask();
	for (i = 0; i < height; i++) {
		char *dst1;

		dst1 = dst;
		for (j = 0; j < width; j++) {
			outb(*src++, GRAPHICS_DATA_REG);
			wmb();
			writeb(fg, dst1++);
		}
		dst += p->fix.line_length;
	}
	wmb();
}

/*
* linux/drivers/video/vgaops.h -- Low level frame buffer operations
* for VGA 4-plane modes
*
* Copyright 1999 Ben Pfaff <[email protected]> and Petr Vandrovec <[email protected]>
* Based on code by Michael Schmitz
* Based on the old macfb.c 4bpp code by Alan Cox
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
* archive for more details. */

#define GRAPHICS_ADDR_REG 0x3ce /* Graphics address register. */
#define GRAPHICS_DATA_REG 0x3cf /* Graphics data register. */

#define SET_RESET_INDEX 0 /* Set/Reset Register index. */
#define ENABLE_SET_RESET_INDEX 1 /* Enable Set/Reset Register index. */
#define DATA_ROTATE_INDEX 3 /* Data Rotate Register index. */
#define GRAPHICS_MODE_INDEX 5 /* Graphics Mode Register index. */
#define BIT_MASK_INDEX 8 /* Bit Mask Register index. */

/* The VGA's weird architecture often requires that we read a byte and
write a byte to the same location. It doesn't matter *what* byte we write, however. This is because all the action goes on behind the scenes in the VGA's 32-bit latch register, and reading and writing video memory just invokes latch behavior.

To avoid race conditions (is this necessary?), reading and writing the memory byte should be done with a single instruction. One suitable instruction is the x86 bitwise OR. The following read-modify-write routine should optimize to one such bitwise OR. */
#define rmw(p) \

{ \
	readb(p); \
	writeb(1, p); \
} \

/* Set the Graphics Mode Register. Bits 0-1 are write mode, bit 3 is
read mode. */
#define setmode(mode) \

{                                                     \
	outb(GRAPHICS_MODE_INDEX, GRAPHICS_ADDR_REG); \
	outb(mode, GRAPHICS_DATA_REG);                \
}

/* Select the Bit Mask Register. */
#define selectmask() \

{                                                     \
	outb(BIT_MASK_INDEX, GRAPHICS_ADDR_REG);      \
}

/* Set the value of the Bit Mask Register. It must already have been
selected with selectmask(). */
#define setmask(mask) \

{                                                     \
	outb(mask, GRAPHICS_DATA_REG);                \
}

/* Set the Data Rotate Register. Bits 0-2 are rotate count, bits 3-4
are logical operation (0=NOP, 1=AND, 2=OR, 3=XOR). */
#define setop(op) \

{                                                    \
	outb(DATA_ROTATE_INDEX, GRAPHICS_ADDR_REG);  \
	outb(op, GRAPHICS_DATA_REG);                 \
}

/* Set the Enable Set/Reset Register. The code here always uses value
0xf for this register. */
#define setsr(sr) \

{                                                        \
	outb(ENABLE_SET_RESET_INDEX, GRAPHICS_ADDR_REG); \
	outb(sr, GRAPHICS_DATA_REG);                     \
}

/* Set the Set/Reset Register. */
#define setcolor(color) \

{                                                    \
	outb(SET_RESET_INDEX, GRAPHICS_ADDR_REG);    \
	outb(color, GRAPHICS_DATA_REG);              \
}

/* Set the value in the Graphics Address Register. */
#define setindex(index) \

{                                                    \
	outb(index, GRAPHICS_ADDR_REG);              \
}