|
From: Jan-Benedict G. <jb...@us...> - 2004-11-19 20:11:35
|
Update of /cvsroot/linux-vax/kernel-2.5/drivers/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21920 Modified Files: vaxlcgfb.c Log Message: - Initialization of framebuffer drivers changed. - This brings vaxlcgfb.c in line with the new scheme. - Also cleans up some debugging code I used to have in the file. Index: vaxlcgfb.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/drivers/video/vaxlcgfb.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- vaxlcgfb.c 1 Apr 2004 20:45:23 -0000 1.13 +++ vaxlcgfb.c 19 Nov 2004 20:11:26 -0000 1.14 @@ -1,7 +1,7 @@ /* * ./linux/drivers/video/vaxlcgfb.c - Driver for VAX Low Cost Graphics Framebuffer * - * Copyright (C) 2003 by Jan-Benedict Glaw <jb...@lu...> + * Copyright (C) 2003,2004 by Jan-Benedict Glaw <jb...@lu...> * * The initial skeleton was stolen from: * pmagb-b-fb.c, (C) by Michael Engel <en...@un...>, @@ -29,11 +29,8 @@ /* * Debugging cruft */ -#undef LUT_DEBUGGING -#define OLD_CRUFT -#undef BLAZ_DOUBLE #define PROBE_DEBUG - +#undef DEBUG_HELPERS #ifdef PROBE_DEBUG #define PROBE_PRINTK(x...) printk(x) @@ -94,9 +91,6 @@ VAXLCGFB_48_1280x1024x8_SH, /* 4000/VLC */ VAXLCGFB_48_1024x768x8_SH, VAXLCGFB_48_640x480x8_SH, -#ifdef BLAZ_DOUBLE - VAXLCGFB_48_1024x768x8_SH, -#endif /* BLAZ_DOUBLE */ VAXLCGFB_48_1024x864x8_SH, }; @@ -139,9 +133,6 @@ TYPE (VAXLCGFB_48_1280x1024x8_SH, 1280, 1024, 8, 1), TYPE (VAXLCGFB_48_1024x768x8_SH, 1024, 768, 8, 1), TYPE (VAXLCGFB_48_640x480x8_SH, 640, 480, 8, 1), -#ifdef BLAZ_DOUBLE - TYPE (VAXLCGFB_48_1024x768x8_SH, 1024, 768, 8, 1), -#endif /* BLAZ_DOUBLE */ TYPE (VAXLCGFB_48_1024x864x8_SH, 1024, 864, 8, 1), }; @@ -196,13 +187,8 @@ type = VAXLCGFB_48_1024x768x8_SH; else if (value1 == 0x06 && value2 == 0x00) type = VAXLCGFB_48_640x480x8_SH; -#ifdef BLAZ_DOUBLE - else if (value1 == 0x07 && value2 == 0x80) - type = VAXLCGFB_48_1024x768x8_SH; -#else else if (value1 == 0x07 && value2 == 0x80) type = VAXLCGFB_48_1024x768x8_SH; -#endif /* BLAZ_DOUBLE */ else if (value1 == 0x07 && value2 == 0x00) type = VAXLCGFB_48_1024x864x8_SH; } @@ -321,7 +307,60 @@ return 0; } -#ifdef OLD_CRUFT +#ifdef DEBUG_HELPERS +static int +set_dot (struct fb_info *info, int x, int y, unsigned int colour) +{ + volatile unsigned char *dot; + + dot = (volatile unsigned char *) info->screen_base; + + dot += info->fix.line_length * y + x; + + *dot = (unsigned char) (colour & 0xff); + + return 0; +} + +/* + * (x1|y1) needs to be the upper left corner, + * (x2|y2) needs to be the lower right corner. + */ +static int +draw_rectangle (struct fb_info *info, int x1, int y1, int x2, int y2, unsigned int colour) +{ + int x, y; + + for (x = x1; x <= x1; x++) { + set_dot (info, x, y1, colour); /* top horizonthal line */ + set_dot (info, x, y2, colour); /* bottom horizonthal line */ + } + + for (y = y1; y <= y2; y++) { + set_dot (info, x1, y, colour); /* left vertical line */ + set_dot (info, x2, y, colour); /* right vertical line */ + } + + return 0; +} + +static int +draw_some_bullshit (struct fb_info *info) +{ +#define RECT_SIZE 20 + int x = info->var.xres - 1; + int y = info->var.yres - 1; + + draw_rectangle (info, 0, 0, RECT_SIZE - 1, RECT_SIZE - 1, 1); /* top-left */ + draw_rectangle (info, x - RECT_SIZE, 0, x, RECT_SIZE - 1, 1); /* top-right */ + draw_rectangle (info, 0, y - RECT_SIZE, RECT_SIZE - 1, y, 1); /* bottom-left */ + draw_rectangle (info, x - RECT_SIZE, y - RECT_SIZE, x, y, 1); /* bottom-right */ + + draw_rectangle (info, 0, 0, x, y, 1); /* fullscreen square */ + + return 0; +} + static void vaxlcgfb_show_info (struct fb_info *info) { @@ -370,7 +409,7 @@ printk (KERN_INFO "HTIMING =0x%08lx\n", GET_REG (me, REG_VIDEO_HTIMING)); printk (KERN_INFO "TIMING =0x%08lx\n", GET_REG (me, REG_VIDEO_TIMING)); } -#endif /* OLD_CRUFT */ +#endif /* DEBUG_HELPERS */ static int vaxlcgfb_setcolreg (unsigned int regno, unsigned int red, @@ -430,6 +469,8 @@ mdelay (10); /* FIXME: I didn't need to reset this flag to zero */ SET_REG (me, REG_LUT_CONSOLE_SEL, 0); /* Done with reload */ +#else + SET_REG (me, REG_LUT_CONSOLE_SEL, 0); /* Start reload */ #endif return 0; @@ -445,19 +486,7 @@ }; - -int -vaxlcgfb_setup (char *options) -{ - if (!options || !*options) - return 0; - - printk (KERN_INFO "vaxlcgfb options: %s\n", options); - - return 0; -} - -int +static int __init vaxlcgfb_init (void) { unsigned char *n_lut_base; @@ -534,35 +563,27 @@ vaxlcgfb_priv[i].online = 1; } -#ifdef LUT_DEBUGGING - if (base_fb != -1) { - for (i = 0; i < 255; i++) { - vaxlcgfb_setcolreg (i, (255-i) << 8, - (255-i) << 8, - (255-i) << 8, - 0, &vaxlcgfb_fb_info[base_fb]); - } - } -#endif - - -#ifdef OLD_CRUFT +#ifdef DEBUG_HELPERS vaxlcgfb_show_info (&vaxlcgfb_fb_info[0]); -#endif /* OLD_CRUFT */ -#ifdef LUT_DEBUGGING + for (i = 0; i < 4; i++) { + if (vaxlcgfb_priv[i].online) + draw_some_bullshit (&vaxlcgfb_fb_info[i]); + } + { volatile unsigned char *pixel; int x, y; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { /* Draw a square on all FBs */ if (vaxlcgfb_priv[i].online) { pixel = vaxlcgfb_priv[i].fb_base; for (y = 500; y < 550; y++) for (x = 500; x < 550; x++) - *(pixel + (y * xres (type)) + x) = 17; + *(pixel + (y * xres (type)) + x) = 1; } + } printk (KERN_ERR "Done with pattern\n"); mdelay (5000); @@ -572,17 +593,16 @@ int shade; for (shade = 0; shade < 256; shade++) { - vaxlcgfb_setcolreg (17, shade << 8, + vaxlcgfb_setcolreg (1, shade << 8, shade << 8, shade << 8, 0, &vaxlcgfb_fb_info[base_fb]); - if (shade == 0) + if (shade % 5 == 0) mdelay (20); - printk (KERN_ERR "shade = %d\n", shade); } } } -#endif /* LUT_DEBUGGING */ +#endif /* DEBUG_HELPERS */ /* * Display what we've found @@ -648,8 +668,11 @@ return; } -MODULE_LICENSE ("GPLv2"); -MODULE_AUTHOR ("Jan-Benedict Glaw"); +MODULE_LICENSE ("GPL"); +MODULE_AUTHOR ("Jan-Benedict Glaw <jb...@lu...>"); MODULE_DESCRIPTION ("Module for the VAX LCG framebuffer option found on " "4000/60 and 4000/VLC like machines"); +module_init (vaxlcgfb_init); +module_exit (vaxlcgfb_exit); + |