Commit 87203ecd authored by James Simmons's avatar James Simmons

Ported riva and vga16fb over to new api. Thanks Antonia Daplas!!! More optimizations in fbcon.c

parent 96b01c31
...@@ -69,7 +69,7 @@ obj-$(CONFIG_FB_MAXINE) += maxinefb.o cfbfillrect.o cfbcopyarea.o cfbi ...@@ -69,7 +69,7 @@ obj-$(CONFIG_FB_MAXINE) += maxinefb.o cfbfillrect.o cfbcopyarea.o cfbi
obj-$(CONFIG_FB_TX3912) += tx3912fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_TX3912) += tx3912fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_MATROX) += matrox/ obj-$(CONFIG_FB_MATROX) += matrox/
obj-$(CONFIG_FB_RIVA) += riva/ obj-$(CONFIG_FB_RIVA) += riva/ cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_SIS) += sis/ obj-$(CONFIG_FB_SIS) += sis/
obj-$(CONFIG_FB_ATY) += aty/ cfbimgblt.o obj-$(CONFIG_FB_ATY) += aty/ cfbimgblt.o
......
This diff is collapsed.
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
obj-$(CONFIG_FB_RIVA) += rivafb.o obj-$(CONFIG_FB_RIVA) += rivafb.o
rivafb-objs := fbdev.o riva_hw.o accel.o rivafb-objs := fbdev.o riva_hw.o
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
This diff is collapsed.
This diff is collapsed.
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <video/fbcon.h>
#include "riva_hw.h" #include "riva_hw.h"
/* GGI compatibility macros */ /* GGI compatibility macros */
...@@ -23,6 +22,10 @@ struct riva_regs { ...@@ -23,6 +22,10 @@ struct riva_regs {
RIVA_HW_STATE ext; RIVA_HW_STATE ext;
}; };
typedef struct {
unsigned char red, green, blue, transp;
} riva_cfb8_cmap_t;
struct riva_par { struct riva_par {
RIVA_HW_INST riva; /* interface to riva_hw.c */ RIVA_HW_INST riva; /* interface to riva_hw.c */
...@@ -32,7 +35,10 @@ struct riva_par { ...@@ -32,7 +35,10 @@ struct riva_par {
struct riva_regs initial_state; /* initial startup video mode */ struct riva_regs initial_state; /* initial startup video mode */
struct riva_regs current_state; struct riva_regs current_state;
struct riva_cursor *cursor; riva_cfb8_cmap_t cmap[256]; /* VGA DAC palette cache */
u32 riva_palette[16];
u32 cursor_data[32 * 32/4];
int cursor_reset;
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
struct { int vram; int vram_valid; } mtrr; struct { int vram; int vram_valid; } mtrr;
#endif #endif
......
...@@ -1062,8 +1062,10 @@ void vga_8planes_copyarea(struct fb_info *info, struct fb_copyarea *area) ...@@ -1062,8 +1062,10 @@ void vga_8planes_copyarea(struct fb_info *info, struct fb_copyarea *area)
} }
} else { } else {
line_ofs = info->fix.line_length - area->width; line_ofs = info->fix.line_length - area->width;
dest = info->screen_base + area->dx + area->width + (area->dy + height - 1) * info->fix.line_length; dest = info->screen_base + area->dx + area->width +
src = info->screen_base + area->sx + area->width + (area->sy + height - 1) * info->fix.line_length; (area->dy + height - 1) * info->fix.line_length;
src = info->screen_base + area->sx + area->width +
(area->sy + height - 1) * info->fix.line_length;
while (height--) { while (height--) {
for (x = 0; x < area->width; x++) { for (x = 0; x < area->width; x++) {
--src; --src;
...@@ -1147,8 +1149,10 @@ void vga16fb_copyarea(struct fb_info *info, struct fb_copyarea *area) ...@@ -1147,8 +1149,10 @@ void vga16fb_copyarea(struct fb_info *info, struct fb_copyarea *area)
dst += line_ofs; dst += line_ofs;
} }
} else { } else {
dst = info->screen_base + (area->dx/8) + width + (area->dy + height - 1) * info->fix.line_length; dst = info->screen_base + (area->dx/8) + width +
src = info->screen_base + (area->sx/8) + width + (area->sy + height - 1) * info->fix.line_length; (area->dy + height - 1) * info->fix.line_length;
src = info->screen_base + (area->sx/8) + width +
(area->sy + height - 1) * info->fix.line_length;
while (height--) { while (height--) {
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
dst--; dst--;
...@@ -1224,68 +1228,120 @@ void vga_8planes_imageblit(struct fb_info *info, struct fb_image *image) ...@@ -1224,68 +1228,120 @@ void vga_8planes_imageblit(struct fb_info *info, struct fb_image *image)
void vga_imageblit_expand(struct fb_info *info, struct fb_image *image) void vga_imageblit_expand(struct fb_info *info, struct fb_image *image)
{ {
char *where = info->screen_base + (image->dx/image->width) + image->dy * info->fix.line_length; char *where = info->screen_base + (image->dx/8) +
image->dy * info->fix.line_length;
struct vga16fb_par *par = (struct vga16fb_par *) info->par; struct vga16fb_par *par = (struct vga16fb_par *) info->par;
u8 *cdat = image->data; u8 *cdat = image->data, *dst;
int y; int x, y;
switch (info->fix.type) { switch (info->fix.type) {
case FB_TYPE_VGA_PLANES: case FB_TYPE_VGA_PLANES:
if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4) { if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4) {
if (par->isVGA) { if (par->isVGA) {
setmode(2); setmode(2);
setop(0); setop(0);
setsr(0xf); setsr(0xf);
setcolor(image->fg_color); setcolor(image->fg_color);
selectmask(); selectmask();
setmask(0xff); setmask(0xff);
writeb(image->bg_color, where); writeb(image->bg_color, where);
rmb(); rmb();
readb(where); /* fill latches */ readb(where); /* fill latches */
setmode(3); setmode(3);
wmb(); wmb();
for (y = 0; y < image->height; y++, where += info->fix.line_length) for (y = 0; y < image->height; y++) {
writeb(cdat[y], where); dst = where;
wmb(); for (x = image->width/8; x--;)
} else { writeb(*cdat++, dst++);
setmode(0); where += info->fix.line_length;
setop(0); }
setsr(0xf); wmb();
setcolor(image->bg_color); } else {
selectmask(); setmode(0);
setop(0);
setmask(0xff); setsr(0xf);
for (y = 0; y < image->height; y++, where += info->fix.line_length) setcolor(image->bg_color);
rmw(where); selectmask();
where -= info->fix.line_length * y; setmask(0xff);
setcolor(image->fg_color); for (y = 0; y < image->height; y++) {
selectmask(); dst = where;
for (y = 0; y < image->height; y++, where += info->fix.line_length) for (x=image->width/8; x--;){
if (cdat[y]) { rmw(dst);
setmask(cdat[y]); setcolor(image->fg_color);
rmw(where); selectmask();
if (*cdat) {
setmask(*cdat++);
rmw(dst++);
}
} }
where += info->fix.line_length;
} }
} else }
vga_8planes_imageblit(info, image); } else
break; vga_8planes_imageblit(info, image);
break;
#ifdef FBCON_HAS_VGA #ifdef FBCON_HAS_VGA
case FB_TYPE_TEXT: case FB_TYPE_TEXT:
break; break;
#endif #endif
case FB_TYPE_PACKED_PIXELS: case FB_TYPE_PACKED_PIXELS:
default: default:
cfb_imageblit(info, image); cfb_imageblit(info, image);
break; break;
} }
} }
void vga_imageblit_color(struct fb_info *info, struct fb_image *image)
{
/*
* Draw logo
*/
struct vga16fb_par *par = (struct vga16fb_par *) info->par;
char *where = info->screen_base + image->dy * info->fix.line_length +
image->dx/8;
char *cdat = image->data, *dst;
int x, y;
switch (info->fix.type) {
case FB_TYPE_VGA_PLANES:
if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4 &&
par->isVGA) {
setsr(0xf);
setop(0);
setmode(0);
for (y = 0; y < image->height; y++) {
for (x = 0; x < image->width; x++) {
dst = where + x/8;
setcolor(*cdat);
selectmask();
setmask(1 << (7 - (x % 8)));
fb_readb(dst);
fb_writeb(0, dst);
cdat++;
}
where += info->fix.line_length;
}
}
break;
case FB_TYPE_PACKED_PIXELS:
cfb_imageblit(info, image);
break;
default:
break;
}
}
void vga16fb_imageblit(struct fb_info *info, struct fb_image *image) void vga16fb_imageblit(struct fb_info *info, struct fb_image *image)
{ {
if (image->depth == 1) if (image->depth == 1)
vga_imageblit_expand(info, image); vga_imageblit_expand(info, image);
else if (image->depth == info->var.bits_per_pixel)
vga_imageblit_color(info, image);
} }
static struct fb_ops vga16fb_ops = { static struct fb_ops vga16fb_ops = {
...@@ -1298,6 +1354,7 @@ static struct fb_ops vga16fb_ops = { ...@@ -1298,6 +1354,7 @@ static struct fb_ops vga16fb_ops = {
.fb_fillrect = vga16fb_fillrect, .fb_fillrect = vga16fb_fillrect,
.fb_copyarea = vga16fb_copyarea, .fb_copyarea = vga16fb_copyarea,
.fb_imageblit = vga16fb_imageblit, .fb_imageblit = vga16fb_imageblit,
.fb_cursor = soft_cursor,
}; };
int vga16fb_setup(char *options) int vga16fb_setup(char *options)
...@@ -1349,6 +1406,11 @@ int __init vga16fb_init(void) ...@@ -1349,6 +1406,11 @@ int __init vga16fb_init(void)
i = (vga16fb_defined.bits_per_pixel == 8) ? 256 : 16; i = (vga16fb_defined.bits_per_pixel == 8) ? 256 : 16;
fb_alloc_cmap(&vga16fb.cmap, i, 0); fb_alloc_cmap(&vga16fb.cmap, i, 0);
if (vga16fb_check_var(&vga16fb.var, &vga16fb))
return -EINVAL;
vga16fb_update_fix(&vga16fb);
if (register_framebuffer(&vga16fb) < 0) { if (register_framebuffer(&vga16fb) < 0) {
iounmap(vga16fb.screen_base); iounmap(vga16fb.screen_base);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment