From: Petr V. <VAN...@vc...> - 2001-01-30 22:48:48
|
On 30 Jan 01 at 11:01, James Simmons wrote: > Petr, for some reason I can't get this to work right. Does it look right > to you? It should work, as far as my brain sees. But my brain is not VGA hardware... What about: > static void vga16fb_fillrect(struct fb_info *info, int x1, int y1, > unsigned int width, unsigned int height, > unsigned long color, int rop) > { > int line_ofs = info->fix.line_length - width; > char *where; > int x; > - vga_io_wgfx(VGA_GFX_MODE, 0); + vga_io_wgfx(VGA_GFX_MODE, 2); > vga_io_wgfx(VGA_GFX_DATA_ROTATE, 0); - vga_io_wgfx(VGA_GFX_SR_ENABLE, 0xf); - vga_io_wgfx(VGA_GFX_SR_VALUE, color); > vga_io_wgfx(VGA_GFX_BIT_MASK, 0xff); > > where = info->screen_base + x1 + y1 * info->fix.line_length; > > while (height--) { > for (x = 0; x < width; x++) { - fb_writeb(0, where); + fb_writeb(color, where); > where++; > } Saves two outw, at cost of using 'color' instead of zero in loop... But both can be optimized to 'memset(where, X, width);' on most of archs. Anyway, your original code is used by fbcon-vga-planes.c, at least AFAIS... (different macros, writeb instead of fb_writeb...) On non-ia32 you may have troubles with read/write ordering, but in this code and with current VGA adapters just 'wmb()' before 'while (height--)' should be sufficient, if 'vga_io_wgfx' uses outw and not two outb. Best regards, Petr Vandrovec van...@vc... |