summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-15 03:32:22 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-15 03:32:22 +0000
commitf1da2c3860e301527d56a1ef0b56c649ee7c4b1b (patch)
tree562b5d2e8b9cb62eb983d78ff6bcf9789e08fcf6 /drivers/video
parent00f11569ac8ca73cbcdef8822de1583e79aee571 (diff)
Merge with Linux 2.4.0-test5-pre1. This works again on Origin UP.
The IP22 cache bugs which are plaguing some machines are still unfixed.
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbcon-mac.c120
-rw-r--r--drivers/video/fbcon.c10
-rw-r--r--drivers/video/fbmem.c17
-rw-r--r--drivers/video/vesafb.c6
4 files changed, 65 insertions, 88 deletions
diff --git a/drivers/video/fbcon-mac.c b/drivers/video/fbcon-mac.c
index 0b3e816e7..2d021dd87 100644
--- a/drivers/video/fbcon-mac.c
+++ b/drivers/video/fbcon-mac.c
@@ -100,8 +100,8 @@ void fbcon_mac_bmove(struct display *p, int sy, int sx, int dy, int dx,
err_buf[cnt] = 0x700 | err_str[cnt];
fbcon_mac_putcs(p->conp, p, err_buf, len, 0, 0);
/* pause for the user */
- for(cnt = 0; cnt < 50000; cnt++)
- udelay(100);
+ printk( "ERROR: shift algorithm...\n" );
+ mdelay(5000);
return;
}
}
@@ -318,12 +318,25 @@ void fbcon_mac_revc(struct display *p, int xx, int yy)
}
}
+static inline void plot_helper(u8 *dest, u8 bit, int bw)
+{
+ switch (bw) {
+ case PIXEL_BLACK_MAC:
+ fb_writeb( fb_readb(dest) | bit, dest );
+ break;
+ case PIXEL_WHITE_MAC:
+ fb_writeb( fb_readb(dest) & (~bit), dest );
+ break;
+ case PIXEL_INVERT_MAC:
+ fb_writeb( fb_readb(dest) ^ bit, dest );
+ break;
+ default:
+ printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
+ }
+}
+
/*
* plot_pixel_mac
- *
- * bw == 0 = black
- * 1 = white
- * 2 = invert
*/
static void plot_pixel_mac(struct display *p, int bw, int pixel_x, int pixel_y)
{
@@ -333,10 +346,8 @@ static void plot_pixel_mac(struct display *p, int bw, int pixel_x, int pixel_y)
/* There *are* 68k Macs that support more than 832x624, you know :-) */
if (pixel_x < 0 || pixel_y < 0 || pixel_x >= p->var.xres || pixel_y >= p->var.yres) {
- int cnt;
printk ("ERROR: pixel_x == %d, pixel_y == %d", pixel_x, pixel_y);
- for(cnt = 0; cnt < 100000; cnt++)
- udelay(100);
+ mdelay(1000);
return;
}
@@ -344,90 +355,36 @@ static void plot_pixel_mac(struct display *p, int bw, int pixel_x, int pixel_y)
case 1:
dest = (u8 *) ((pixel_x >> 3) + p->screen_base + pixel_y * p->next_line);
bit = 0x80 >> (pixel_x & 7);
- switch (bw) {
- case PIXEL_BLACK_MAC:
- *dest |= bit;
- break;
- case PIXEL_WHITE_MAC:
- *dest &= ~bit;
- break;
- case PIXEL_INVERT_MAC:
- *dest ^= bit;
- break;
- default:
- printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
- }
+ plot_helper(dest, bit, bw);
break;
case 2:
dest = (u8 *) ((pixel_x >> 2) + p->screen_base + pixel_y * p->next_line);
bit = 0xC0 >> ((pixel_x & 3) << 1);
- switch (bw) {
- case PIXEL_BLACK_MAC:
- *dest |= bit;
- break;
- case PIXEL_WHITE_MAC:
- *dest &= ~bit;
- break;
- case PIXEL_INVERT_MAC:
- *dest ^= bit;
- break;
- default:
- printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
- }
+ plot_helper(dest, bit, bw);
break;
case 4:
- dest = (u8 *) ((pixel_x / 2) + p->screen_base + pixel_y * p->next_line);
+ dest = (u8 *) ((pixel_x >> 1) + p->screen_base + pixel_y * p->next_line);
bit = 0xF0 >> ((pixel_x & 1) << 2);
- switch (bw) {
- case PIXEL_BLACK_MAC:
- *dest |= bit;
- break;
- case PIXEL_WHITE_MAC:
- *dest &= ~bit;
- break;
- case PIXEL_INVERT_MAC:
- *dest ^= bit;
- break;
- default:
- printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
- }
+ plot_helper(dest, bit, bw);
break;
case 8:
dest = (u8 *) (pixel_x + p->screen_base + pixel_y * p->next_line);
bit = 0xFF;
- switch (bw) {
- case PIXEL_BLACK_MAC:
- *dest |= bit;
- break;
- case PIXEL_WHITE_MAC:
- *dest &= ~bit;
- break;
- case PIXEL_INVERT_MAC:
- *dest ^= bit;
- break;
- default:
- printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
- }
+ plot_helper(dest, bit, bw);
break;
+/* FIXME: You can't access framebuffer directly like this! */
case 16:
dest16 = (u16 *) ((pixel_x *2) + p->screen_base + pixel_y * p->next_line);
pix16 = 0xFFFF;
switch (bw) {
- case PIXEL_BLACK_MAC:
- *dest16 = ~pix16;
- break;
- case PIXEL_WHITE_MAC:
- *dest16 = pix16;
- break;
- case PIXEL_INVERT_MAC:
- *dest16 ^= pix16;
- break;
- default:
- printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
+ case PIXEL_BLACK_MAC: *dest16 = ~pix16; break;
+ case PIXEL_WHITE_MAC: *dest16 = pix16; break;
+ case PIXEL_INVERT_MAC: *dest16 ^= pix16; break;
+ default: printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
}
break;
@@ -435,17 +392,10 @@ static void plot_pixel_mac(struct display *p, int bw, int pixel_x, int pixel_y)
dest32 = (u32 *) ((pixel_x *4) + p->screen_base + pixel_y * p->next_line);
pix32 = 0xFFFFFFFF;
switch (bw) {
- case PIXEL_BLACK_MAC:
- *dest32 = ~pix32;
- break;
- case PIXEL_WHITE_MAC:
- *dest32 = pix32;
- break;
- case PIXEL_INVERT_MAC:
- *dest32 ^= pix32;
- break;
- default:
- printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
+ case PIXEL_BLACK_MAC: *dest32 = ~pix32; break;
+ case PIXEL_WHITE_MAC: *dest32 = pix32; break;
+ case PIXEL_INVERT_MAC: *dest32 ^= pix32; break;
+ default: printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
}
break;
}
@@ -497,7 +447,7 @@ static int get_pixel_mac(struct display *p, int pixel_x, int pixel_y)
*/
struct display_switch fbcon_mac = {
- fbcon_mac_setup, fbcon_mac_bmove, fbcon_mac_clear, fbcon_mac_putc,
+ fbcon_mac_setup, fbcon_redraw_bmove, fbcon_redraw_clear, fbcon_mac_putc,
fbcon_mac_putcs, fbcon_mac_revc, NULL, NULL, NULL, FONTWIDTHRANGE(1,8)
};
diff --git a/drivers/video/fbcon.c b/drivers/video/fbcon.c
index c2611d0a6..bf74fa162 100644
--- a/drivers/video/fbcon.c
+++ b/drivers/video/fbcon.c
@@ -1124,6 +1124,15 @@ static void fbcon_redraw(struct vc_data *conp, struct display *p,
}
}
+void fbcon_redraw_clear(struct vc_data *conp, struct display *p, int sy, int sx,
+ int height, int width)
+{
+ int x, y;
+ for (y=0; y<height; y++)
+ for (x=0; x<width; x++)
+ fbcon_putc(conp, ' ', sy+y, sx+x);
+}
+
/* This cannot be used together with ypan or ywrap */
void fbcon_redraw_bmove(struct display *p, int sy, int sx, int dy, int dx, int h, int w)
{
@@ -2422,5 +2431,6 @@ struct display_switch fbcon_dummy = {
EXPORT_SYMBOL(fb_display);
EXPORT_SYMBOL(fbcon_redraw_bmove);
+EXPORT_SYMBOL(fbcon_redraw_clear);
EXPORT_SYMBOL(fbcon_dummy);
EXPORT_SYMBOL(fb_con);
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 2ab527f02..30bd06d32 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -14,6 +14,7 @@
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/malloc.h>
@@ -473,8 +474,13 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
off = vma->vm_pgoff << PAGE_SHIFT;
if (!fb)
return -ENODEV;
- if (fb->fb_mmap)
- return fb->fb_mmap(info, file, vma);
+ if (fb->fb_mmap) {
+ int res;
+ lock_kernel();
+ res = fb->fb_mmap(info, file, vma);
+ unlock_kernel();
+ return res;
+ }
#if defined(__sparc__) && !defined(__sparc_v9__)
/* Should never get here, all fb drivers should have their own
@@ -483,6 +489,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
#else
/* !sparc32... */
+ lock_kernel();
fb->fb_get_fix(&fix, PROC_CONSOLE(info), info);
/* frame buffer memory */
@@ -497,6 +504,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
start = fix.mmio_start;
len = PAGE_ALIGN((start & ~PAGE_MASK)+fix.mmio_len);
}
+ unlock_kernel();
start &= PAGE_MASK;
if ((vma->vm_end - vma->vm_start + off) > len)
return -EINVAL;
@@ -612,12 +620,15 @@ static int
fb_release(struct inode *inode, struct file *file)
{
int fbidx = GET_FB_IDX(inode->i_rdev);
- struct fb_info *info = registered_fb[fbidx];
+ struct fb_info *info;
+ lock_kernel();
+ info = registered_fb[fbidx];
if (info->fbops->fb_release)
info->fbops->fb_release(info,1);
if (info->fbops->owner)
__MOD_DEC_USE_COUNT(info->fbops->owner);
+ unlock_kernel();
return 0;
}
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index 261ce3d3c..c465bafc7 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -30,6 +30,7 @@
#include <video/fbcon-cfb16.h>
#include <video/fbcon-cfb24.h>
#include <video/fbcon-cfb32.h>
+#include <video/fbcon-mac.h>
#define dac_reg (0x3c8)
#define dac_val (0x3c9)
@@ -220,8 +221,13 @@ static void vesafb_set_disp(int con)
break;
#endif
default:
+#ifdef FBCON_HAS_MAC
+ sw = &fbcon_mac;
+ break;
+#else
sw = &fbcon_dummy;
return;
+#endif
}
memcpy(&vesafb_sw, sw, sizeof(*sw));
display->dispsw = &vesafb_sw;