linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]: i810fb updates
@ 2003-03-26  3:37 Antonino Daplas
  2003-03-26  5:19 ` James Simmons
  0 siblings, 1 reply; 4+ messages in thread
From: Antonino Daplas @ 2003-03-26  3:37 UTC (permalink / raw)
  To: James Simmons; +Cc: Linux Fbdev development list

Updated i810fb to take advantage of the latest buffering scheme.  This
should squeeze a few more drops of speed from the hardware.

Tony

diff -Naur linux-2.5.66-orig/drivers/video/i810/i810.h linux-2.5.66/drivers/video/i810/i810.h
--- linux-2.5.66-orig/drivers/video/i810/i810.h	2003-03-26 02:25:01.000000000 +0000
+++ linux-2.5.66/drivers/video/i810/i810.h	2003-03-26 02:50:43.000000000 +0000
@@ -120,7 +120,6 @@
 #define MMIO_SIZE                   (512*1024)
 #define GTT_SIZE                    (16*1024) 
 #define RINGBUFFER_SIZE             (64*1024)
-#define PIXMAP_SIZE                 (4 * 4096)
 #define CURSOR_SIZE                 4096 
 #define OFF                         0
 #define ON                          1
@@ -251,7 +250,6 @@
 	struct heap_data         fb;
 	struct heap_data         iring;
 	struct heap_data         cursor_heap;
-	struct heap_data         pixmap;
 	struct vgastate          state;
 	drm_agp_t                *drm_agp;
 	atomic_t                 use_count;
@@ -260,10 +258,6 @@
 	unsigned long mmio_start_phys;
 	u8 *mmio_start_virtual;
 	u32 cursor_reset;
-	u8  red[64];
-	u8  green[64];
-	u8  blue[64];
-	u32 pixmap_offset;
 	u32 pitch;
 	u32 pixconf;
 	u32 watermark;
diff -Naur linux-2.5.66-orig/drivers/video/i810/i810_accel.c linux-2.5.66/drivers/video/i810/i810_accel.c
--- linux-2.5.66-orig/drivers/video/i810/i810_accel.c	2003-03-26 02:25:01.000000000 +0000
+++ linux-2.5.66/drivers/video/i810/i810_accel.c	2003-03-26 02:50:39.000000000 +0000
@@ -54,8 +54,9 @@
  * The function waits until a free space from the ringbuffer
  * is available 
  */	
-static inline int wait_for_space(struct i810fb_par *par, u32 space)
+static inline int wait_for_space(struct fb_info *info, u32 space)
 {
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	u32 head, count = WAIT_COUNT, tail;
 	u8 *mmio = par->mmio_start_virtual;
 
@@ -72,6 +73,7 @@
 	printk("ringbuffer lockup!!!\n");
 	i810_report_error(mmio); 
 	par->dev_flags |= LOCKUP;
+	info->pixmap.scan_align = 1;
 	return 1;
 }
 
@@ -83,11 +85,15 @@
  * This waits for lring(0), iring(1), and batch(3), etc to finish and
  * waits until ringbuffer is empty.
  */
-static inline int wait_for_engine_idle(struct i810fb_par *par)
+static inline int wait_for_engine_idle(struct fb_info *info)
 {
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	u8 *mmio = par->mmio_start_virtual;
 	int count = WAIT_COUNT;
 
+	if (wait_for_space(info, par->iring.size)) /* flush */
+		return 1;
+
 	while((i810_readw(INSTDONE, mmio) & 0x7B) != 0x7B && --count); 
 	if (count) return 0;
 
@@ -95,6 +101,7 @@
 	printk("INSTDONE: 0x%04x\n", i810_readl(INSTDONE, mmio));
 	i810_report_error(mmio); 
 	par->dev_flags |= LOCKUP;
+	info->pixmap.scan_align = 1;
 	return 1;
 }
 
@@ -106,11 +113,13 @@
  * Checks/waits for sufficent space in ringbuffer of size
  * space.  Returns the tail of the buffer
  */ 
-static inline u32 begin_iring(struct i810fb_par *par, u32 space)
+static inline u32 begin_iring(struct fb_info *info, u32 space)
 {
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+
 	if (par->dev_flags & ALWAYS_SYNC) 
-		wait_for_engine_idle(par);
-	return wait_for_space(par, space);
+		wait_for_engine_idle(info);
+	return wait_for_space(info, space);
 }
 
 /**
@@ -149,9 +158,11 @@
  */
 static inline void source_copy_blit(int dwidth, int dheight, int dpitch, 
 				    int xdir, int src, int dest, int rop, 
-				    int blit_bpp, struct i810fb_par *par)
+				    int blit_bpp, struct fb_info *info)
 {
-	if (begin_iring(par, 24 + IRING_PAD)) return;
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+
+	if (begin_iring(info, 24 + IRING_PAD)) return;
 
 	PUT_RING(BLIT | SOURCE_COPY_BLIT | 4);
 	PUT_RING(xdir | rop << 16 | dpitch | DYN_COLOR_EN | blit_bpp);
@@ -181,9 +192,11 @@
  */
 static inline void color_blit(int width, int height, int pitch,  int dest, 
 			      int rop, int what, int blit_bpp, 
-			      struct i810fb_par *par)
+			      struct fb_info *info)
 {
-	if (begin_iring(par, 24 + IRING_PAD)) return;
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+
+	if (begin_iring(info, 24 + IRING_PAD)) return;
 
 	PUT_RING(BLIT | COLOR_BLT | 3);
 	PUT_RING(rop << 16 | pitch | SOLIDPATTERN | DYN_COLOR_EN | blit_bpp);
@@ -220,9 +233,11 @@
 static inline void mono_src_copy_imm_blit(int dwidth, int dheight, int dpitch,
 					  int dsize, int blit_bpp, int rop,
 					  int dest, const u32 *src, int bg,
-					  int fg, struct i810fb_par *par)
+					  int fg, struct fb_info *info)
 {
-	if (begin_iring(par, 24 + (dsize << 2) + IRING_PAD)) return;
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+
+	if (begin_iring(info, 24 + (dsize << 2) + IRING_PAD)) return;
 
 	PUT_RING(BLIT | MONO_SOURCE_COPY_IMMEDIATE | (4 + dsize));
 	PUT_RING(DYN_COLOR_EN | blit_bpp | rop << 16 | dpitch);
@@ -261,9 +276,11 @@
 static inline void mono_src_copy_blit(int dwidth, int dheight, int dpitch, 
 				      int qsize, int blit_bpp, int rop, 
 				      int dest, int src, int bg,
-				      int fg, struct i810fb_par *par)
+				      int fg, struct fb_info *info)
 {
-	if (begin_iring(par, 32 + IRING_PAD)) return;
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+
+	if (begin_iring(info, 32 + IRING_PAD)) return;
 
 	PUT_RING(BLIT | MONO_SOURCE_COPY_BLIT | 6);
 	PUT_RING(DYN_COLOR_EN | blit_bpp | rop << 16 | dpitch | 1 << 27);
@@ -277,19 +294,23 @@
 	end_iring(par);
 }
 
-static u32 get_buffer_offset(u32 size, struct i810fb_par *par) 
+static inline void load_front(int offset, struct fb_info *info)
 {
-	u32 offset;
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
 
-	if (par->pixmap_offset + size > par->pixmap.size) {
-		wait_for_engine_idle(par);
-		par->pixmap_offset = 0;
-	}
+	if (begin_iring(info, 8 + IRING_PAD)) return;
 
-	offset = par->pixmap_offset;
-	par->pixmap_offset += size;
+	PUT_RING(PARSER | FLUSH);
+	PUT_RING(NOP);
 
-	return offset;
+	end_iring(par);
+
+	if (begin_iring(info, 8 + IRING_PAD)) return;
+
+	PUT_RING(PARSER | FRONT_BUFFER | ((par->pitch >> 3) << 8));
+	PUT_RING((par->fb.offset << 12) + offset);
+
+	end_iring(par);
 }
 
 /**
@@ -338,7 +359,7 @@
 
 	dest = info->fix.smem_start + (dy * info->fix.line_length) + dx;
 	color_blit(width, height, info->fix.line_length, dest, rop, color, 
-		   par->blit_bpp, par);
+		   par->blit_bpp, info);
 }
 	
 void i810fb_copyarea(struct fb_info *info, const struct fb_copyarea *region) 
@@ -377,14 +398,13 @@
 	dest = info->fix.smem_start + (dy * info->fix.line_length) + dx;
 
 	source_copy_blit(width, height, pitch, xdir, src, dest,
-			 PAT_COPY_ROP, par->blit_bpp, par);
+			 PAT_COPY_ROP, par->blit_bpp, info);
 }
 
 void i810fb_imageblit(struct fb_info *info, const struct fb_image *image)
 {
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
-	u32 fg = 0, bg = 0, s_pitch, d_pitch, size, offset, dst, i, j;
-	u8 *s_addr, *d_addr;
+	u32 fg = 0, bg = 0, size, dst;
 	
 	if (!info->var.accel_flags || par->dev_flags & LOCKUP ||
 	    par->depth == 4 || image->depth != 0) 
@@ -405,43 +425,17 @@
 	dst = info->fix.smem_start + (image->dy * info->fix.line_length) + 
 		(image->dx * par->depth);
 
-	s_pitch = (image->width+7)/8;
-	d_pitch = (s_pitch + 1) & ~1;
-	size = d_pitch * image->height;
-	if (s_pitch != d_pitch || size & 7) {
-		size += 7;
-		size &= ~7;
-		offset = get_buffer_offset(size, par);		
-		d_addr = par->pixmap.virtual + offset;
-		s_addr = (u8 *) image->data;
-		
-		if (s_pitch == d_pitch) {
-			memcpy_toio(d_addr, s_addr, s_pitch * image->height);
-		} else { 
-			for (i = image->height; i--; ) {
-				for (j = 0; j < s_pitch; j++) 
-					i810_writeb(j, d_addr, s_addr[j]);
-				s_addr += s_pitch;
-				d_addr += d_pitch;
-			}
-		}
-		mono_src_copy_blit(image->width * par->depth, image->height, 
-				   info->fix.line_length, size/8, 
-				   par->blit_bpp, PAT_COPY_ROP, dst, 
-				   par->pixmap.physical + offset,
-				   bg, fg, par);
-	}
-	/*
-	 * immediate blit if width is a multiple of 16 (hardware requirement)
-	 */
-	else {
-		mono_src_copy_imm_blit(image->width * par->depth, 
-				       image->height, info->fix.line_length, 
-				       size/4, par->blit_bpp,
-				       PAT_COPY_ROP, dst, (u32 *) image->data, 
-				       bg, fg, par);
-	} 
-}
+	size = (image->width+7)/8 + 1;
+	size &= ~1;
+	size *= image->height;
+	size += 7;
+	size &= ~7;
+	mono_src_copy_imm_blit(image->width * par->depth, 
+			       image->height, info->fix.line_length, 
+			       size/4, par->blit_bpp,
+			       PAT_COPY_ROP, dst, (u32 *) image->data, 
+			       bg, fg, info);
+} 
 
 int i810fb_sync(struct fb_info *info)
 {
@@ -450,9 +444,19 @@
 	if (!info->var.accel_flags || par->dev_flags & LOCKUP)
 		return 0;
 
-	return wait_for_engine_idle(par);
+	return wait_for_engine_idle(info);
 }
 
+void i810fb_load_front(u32 offset, struct fb_info *info)
+{
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+	u8 *mmio = par->mmio_start_virtual;
+
+	if (!info->var.accel_flags || par->dev_flags & LOCKUP)
+		i810_writel(DPLYBASE, mmio, par->fb.physical + offset);
+	else 
+		load_front(offset, info);
+}
 
 /**
  * i810fb_init_ringbuffer - initialize the ringbuffer
@@ -463,12 +467,13 @@
  * size and location of the ringbuffer.  It also sets 
  * the head and tail pointers = 0
  */
-void i810fb_init_ringbuffer(struct i810fb_par *par)
+void i810fb_init_ringbuffer(struct fb_info *info)
 {
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	u32 tmp1, tmp2;
 	u8 *mmio = par->mmio_start_virtual;
 	
-	wait_for_engine_idle(par);
+	wait_for_engine_idle(info);
 	i810fb_iring_enable(par, OFF);
 	i810_writel(IRING, mmio, 0);
 	i810_writel(IRING + 4, mmio, 0);
diff -Naur linux-2.5.66-orig/drivers/video/i810/i810_dvt.c linux-2.5.66/drivers/video/i810/i810_dvt.c
--- linux-2.5.66-orig/drivers/video/i810/i810_dvt.c	2003-02-16 00:48:53.000000000 +0000
+++ linux-2.5.66/drivers/video/i810/i810_dvt.c	2003-03-26 02:50:39.000000000 +0000
@@ -289,8 +289,7 @@
 		case 32:
 			wmark = params->bpp24_100;
 		}
-	}
-	else {					
+	} else {					
 		switch (var->bits_per_pixel) {
 		case 8:
 			wmark = params->bpp8_133;
diff -Naur linux-2.5.66-orig/drivers/video/i810/i810_gtf.c linux-2.5.66/drivers/video/i810/i810_gtf.c
--- linux-2.5.66-orig/drivers/video/i810/i810_gtf.c	2003-02-16 00:48:02.000000000 +0000
+++ linux-2.5.66/drivers/video/i810/i810_gtf.c	2003-03-26 02:50:39.000000000 +0000
@@ -1,5 +1,5 @@
 /*-*- linux-c -*-
- *  linux/drivers/video/i810_main.h -- Intel 810 Nondiscrete Video Timings 
+ *  linux/drivers/video/i810_main.h -- Intel 810 Non-discrete Video Timings 
  *                                     (VESA GTF)
  *
  *      Copyright (C) 2001 Antonino Daplas<adaplas@pol.net>
@@ -213,7 +213,7 @@
  * @par: pointer to i810fb_par structure
  *
  * DESCRIPTION:
- * Get's the required watermark based on 
+ * Gets the required watermark based on 
  * pixelclock and RAMBUS frequency.
  * 
  * RETURNS:
@@ -240,8 +240,7 @@
 			wmark = i810_wm_24_100;
 			size = ARRAY_SIZE(i810_wm_24_100);
 		}
-	}	
-	else {
+	} else {
 		switch(var->bits_per_pixel) {
 		case 8:
 			wmark = i810_wm_8_133;
diff -Naur linux-2.5.66-orig/drivers/video/i810/i810_main.c linux-2.5.66/drivers/video/i810/i810_main.c
--- linux-2.5.66-orig/drivers/video/i810/i810_main.c	2003-03-26 02:25:01.000000000 +0000
+++ linux-2.5.66/drivers/video/i810/i810_main.c	2003-03-26 02:50:40.000000000 +0000
@@ -631,8 +631,7 @@
 		if (f_out <= target_freq) {
 			n_reg++;
 			diff = target_freq - f_out;
-		}
-		else {
+		} else {
 			m_reg++;
 			diff = f_out - target_freq;
 		}
@@ -926,20 +925,21 @@
 	/*
 	 * Monitor limit
 	 */
+	switch (var->bits_per_pixel) {
+	case 8:
+		info->monspecs.dclkmax = 234000000;
+		break;
+	case 16:
+		info->monspecs.dclkmax = 229000000;
+		break;
+	case 24:
+	case 32:
+		info->monspecs.dclkmax = 204000000;
+		break;
+	}
+	info->monspecs.dclkmin = 15000000;
+
 	if (fb_validate_mode(var, info)) {
-		switch (var->bits_per_pixel) {
-		case 8:
-			info->monspecs.dclkmax = 234000000;
-			break;
-		case 16:
-			info->monspecs.dclkmax = 229000000;
-			break;
-		case 24:
-		case 32:
-			info->monspecs.dclkmax = 204000000;
-			break;
-		}
-		info->monspecs.dclkmin = 15000000;
 		if (fb_get_mode(FB_MAXTIMINGS, 0, var, info))
 			return -EINVAL;
 	}
@@ -1177,31 +1177,21 @@
 		for (i = 0; i < 8; i++) 
 			i810_write_dac((u8) (regno * 8) + i, (u8) red, 
 				       (u8) green, (u8) blue, mmio);
-	}
-				
-	else if (info->fix.visual == FB_VISUAL_DIRECTCOLOR && 
+	} else if (info->fix.visual == FB_VISUAL_DIRECTCOLOR && 
 		 info->var.green.length == 6) {
-		if (!regno) {
-			memset(par->red, 0, 64);
-			memset(par->green, 0, 64);
-			memset(par->blue, 0, 64);
-		}
-
-		par->red[regno] = (u8) red;
-		par->green[regno] = (u8) green;
-		par->blue[regno] = (u8) blue;
+		u8 r, g, b;
 
 		if (regno < 32) {
 			for (i = 0; i < 8; i++) 
 				i810_write_dac((u8) (regno * 8) + i,
-					       (u8) red, par->green[regno*2], 
+					       (u8) red, (u8) green, 
 					       (u8) blue, mmio);
 		}
+		i810_read_dac((u8) (regno*4), &r, &g, &b, mmio);
 		for (i = 0; i < 4; i++) 
-			i810_write_dac((u8) (regno*4) + i, par->red[regno/2],
-				       (u8) green, par->blue[regno/2], mmio);
-	}
-	else {
+			i810_write_dac((u8) (regno*4) + i, r, (u8) green, 
+				       b, mmio);
+	} else if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) {
 		i810_write_dac((u8) regno, (u8) red, (u8) green,
 			       (u8) blue, mmio);
 	}
@@ -1220,16 +1210,14 @@
 					((u32 *)info->pseudo_palette)[regno] = 
 						(regno << 11) | (regno << 5) |
 						regno;
-			}
-			else {
+			} else {
 				if (info->var.green.length == 5) {
 					/* RGB 555 */
 					((u32 *)info->pseudo_palette)[regno] = 
 						((red & 0xf800) >> 1) |
 						((green & 0xf800) >> 6) |
 						((blue & 0xf800) >> 11);
-				}
-				else {
+				} else {
 					/* RGB 565 */
 					((u32 *)info->pseudo_palette)[regno] =
 						(red & 0xf800) |
@@ -1260,11 +1248,10 @@
 {
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	u32 total;
-	u8 *mmio = par->mmio_start_virtual;
 	
 	total = var->xoffset * par->depth + 
 		var->yoffset * info->fix.line_length;
-	i810_writel(DPLYBASE, mmio, par->fb.physical + total);
+	i810fb_load_front(total, info);
 
 	return 0;
 }
@@ -1315,8 +1302,14 @@
 	i810_load_regs(par);
 	i810_init_cursor(par);
 	par->cursor_reset = 1;
+
 	encode_fix(&info->fix, info);
 
+	if (info->var.accel_flags && !(par->dev_flags & LOCKUP)) 
+		info->pixmap.scan_align = 2;
+	else 
+		info->pixmap.scan_align = 1;
+	
 	return 0;
 }
 
@@ -1512,10 +1505,6 @@
 		(par->iring.offset << 12);
 	par->cursor_heap.virtual = par->aperture.virtual+
 		(par->cursor_heap.offset << 12);
-	par->pixmap.virtual = par->aperture.virtual + 
-		(par->pixmap.offset << 12);
-	par->pixmap.physical = par->aperture.physical + 
-		(par->pixmap.offset << 12);
 }
 
 static void __init i810_fix_offsets(struct i810fb_par *par)
@@ -1531,10 +1520,7 @@
 	par->fb.offset = v_offset_default << 20;
 	par->fb.offset >>= 12;
 
-	par->pixmap.offset = par->fb.offset + (par->fb.size >> 12);
-	par->pixmap.size = PIXMAP_SIZE;
-
-	par->iring.offset = par->pixmap.offset + (PIXMAP_SIZE >> 12);
+	par->iring.offset = par->fb.offset + (par->fb.size >> 12);
 	par->iring.size = RINGBUFFER_SIZE;
 
 	par->cursor_heap.offset = par->iring.offset + (RINGBUFFER_SIZE >> 12);
@@ -1547,7 +1533,7 @@
 	int size;
 	
 	i810_fix_offsets(par);
-	size = par->fb.size + par->iring.size + par->pixmap.size;
+	size = par->fb.size + par->iring.size;
 
 	par->drm_agp = (drm_agp_t *) inter_module_get("drm_agp");
 	if (!par->drm_agp) {
@@ -1637,23 +1623,20 @@
 static void __init i810_init_defaults(struct i810fb_par *par, 
 				      struct fb_info *info)
 {
-	if (voffset) {
+	if (voffset) 
 		v_offset_default = voffset;
-	}
-	else {
-		if (par->aperture.size > 32 * 1024 * 1024)
-			v_offset_default = 16;
-		else
-			v_offset_default = 8;
-	}
+	else if (par->aperture.size > 32 * 1024 * 1024)
+		v_offset_default = 16;
+	else
+		v_offset_default = 8;
 
 	if (!vram) 
 		vram = 1;
 
-	if (accel)
+	if (accel) 
 		par->dev_flags |= HAS_ACCELERATION;
 
-	if (sync)
+	if (sync) 
 		par->dev_flags |= ALWAYS_SYNC;
 
 	if (bpp < 8)
@@ -1698,8 +1681,6 @@
 	pci_read_config_byte(par->dev, 0x50, &reg);
 	reg &= FREQ_MASK;
 	par->mem_freq = (reg) ? 133 : 100;
-
-	i810fb_init_ringbuffer(par);
 }
 
 static int __init 
@@ -1718,8 +1699,7 @@
 		par->aperture.physical = pci_resource_start(par->dev, 0);
 		par->aperture.size = pci_resource_len(par->dev, 0);
 		par->mmio_start_phys = pci_resource_start(par->dev, 1);
-	}
-	else {
+	} else {
 		par->aperture.physical = pci_resource_start(par->dev, 1);
 		par->aperture.size = pci_resource_len(par->dev, 1);
 		par->mmio_start_phys = pci_resource_start(par->dev, 0);
@@ -1737,7 +1717,7 @@
 	}
 	par->res_flags |= FRAMEBUFFER_REQ;
 
-	par->aperture.virtual = ioremap(par->aperture.physical, 
+	par->aperture.virtual = ioremap_nocache(par->aperture.physical, 
 					par->aperture.size);
 	if (!par->aperture.virtual) {
 		printk("i810fb_init: cannot remap framebuffer region\n");
@@ -1766,7 +1746,6 @@
 {
 	char *this_opt, *suffix = NULL;
 
-	i810_init = 1;
 	if (!options || !*options)
 		return 0;
 	
@@ -1795,13 +1774,11 @@
 			hsync1 = simple_strtoul(this_opt+7, &suffix, 0);
 			if (strncmp(suffix, "H", 1)) 
 				hsync1 *= 1000;
-		} 
-		else if (!strncmp(this_opt, "hsync2:", 7)) {
+		} else if (!strncmp(this_opt, "hsync2:", 7)) {
 			hsync2 = simple_strtoul(this_opt+7, &suffix, 0);
 			if (strncmp(suffix, "H", 1)) 
 				hsync2 *= 1000;
-		} 
-		else if (!strncmp(this_opt, "vsync1:", 7)) 
+		} else if (!strncmp(this_opt, "vsync1:", 7)) 
 			vsync1 = simple_strtoul(this_opt+7, NULL, 0);
 		else if (!strncmp(this_opt, "vsync2:", 7))
 			vsync2 = simple_strtoul(this_opt+7, NULL, 0);
@@ -1812,15 +1789,12 @@
 }
 
 static int __init i810fb_init_pci (struct pci_dev *dev, 
-				      const struct pci_device_id *entry)
+				   const struct pci_device_id *entry)
 {
 	struct fb_info    *info;
 	struct i810fb_par *par = NULL;
 	int err, vfreq, hfreq, pixclock;
 
-	if (!i810_init)
-		return -EINVAL;
-
 	if (!(info = kmalloc(sizeof(struct fb_info), GFP_KERNEL))) {
 		i810fb_release_resource(info, par);
 		return -ENOMEM;
@@ -1836,6 +1810,15 @@
 	par->dev = dev;
 	info->par = par;
 
+	if (!(info->pixmap.addr = kmalloc(64*1024, GFP_KERNEL))) {
+		i810fb_release_resource(info, par);
+		return -ENOMEM;
+	}
+	memset(info->pixmap.addr, 0, 64*1024);
+	info->pixmap.size = 64*1024;
+	info->pixmap.buf_align = 8;
+	info->pixmap.flags = FB_PIXMAP_SYSTEM;
+
 	if ((err = i810_allocate_pci_resource(par, entry))) {
 		i810fb_release_resource(info, par);
 		return err;
@@ -1864,6 +1847,7 @@
 	}
 	encode_fix(&info->fix, info); 
 	 	    
+	i810fb_init_ringbuffer(info);
 	err = register_framebuffer(info);
 	if (err < 0) {
     		i810fb_release_resource(info, par); 
@@ -1894,7 +1878,7 @@
 }
 
 /***************************************************************
- *                     Deinitialization                        *
+ *                     De-initialization                        *
  ***************************************************************/
 
 static void i810fb_release_resource(struct fb_info *info, 
@@ -1931,7 +1915,7 @@
 
 		kfree(par);
 	}
-	if (info)
+	if (info) 
 		kfree(info);
 }
 
@@ -1974,7 +1958,6 @@
 
 int __init i810fb_init(void)
 {
-	i810_init = 1;
 	hsync1 *= 1000;
 	hsync2 *= 1000;
 
@@ -1994,14 +1977,14 @@
 MODULE_PARM_DESC(bpp, "Color depth for display in bits per pixel"
 		 " (default = 8)");
 MODULE_PARM(xres, "i");
-MODULE_PARM_DESC(xres, "Hozizontal resolution in pixels (default = 640)");
+MODULE_PARM_DESC(xres, "Horizontal resolution in pixels (default = 640)");
 MODULE_PARM(yres, "i");
 MODULE_PARM_DESC(yres, "Vertical resolution in scanlines (default = 480)");
 MODULE_PARM(vyres, "i");
 MODULE_PARM_DESC(vyres, "Virtual vertical resolution in scanlines"
 		 " (default = 480)");
 MODULE_PARM(hsync1, "i");
-MODULE_PARM_DESC(hsync1, "Mimimum horizontal frequency of monitor in KHz"
+MODULE_PARM_DESC(hsync1, "Minimum horizontal frequency of monitor in KHz"
 		 " (default = 31)");
 MODULE_PARM(hsync2, "i");
 MODULE_PARM_DESC(hsync2, "Maximum horizontal frequency of monitor in KHz"
diff -Naur linux-2.5.66-orig/drivers/video/i810/i810_main.h linux-2.5.66/drivers/video/i810/i810_main.h
--- linux-2.5.66-orig/drivers/video/i810/i810_main.h	2003-03-26 02:25:01.000000000 +0000
+++ linux-2.5.66/drivers/video/i810/i810_main.h	2003-03-26 02:50:43.000000000 +0000
@@ -55,7 +55,6 @@
 	.resume   =     i810fb_resume,
 };	
 
-static int i810_init  __initdata = 0;
 static int vram       __initdata = 4;
 static int bpp        __initdata = 8;
 static int mtrr       __initdata = 0;
@@ -132,7 +131,8 @@
 extern void i810fb_imageblit(struct fb_info *p, const struct fb_image *image);
 extern int  i810fb_sync     (struct fb_info *p);
 
-extern void i810fb_init_ringbuffer   (struct i810fb_par *par);
+extern void i810fb_init_ringbuffer(struct fb_info *info);
+extern void i810fb_load_front     (u32 offset, struct fb_info *info);
 
 /* Conditionals */
 #if defined(__i386__)





-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH]: i810fb updates
@ 2003-01-18  7:59 Antonino Daplas
  2003-01-24 19:06 ` James Simmons
  0 siblings, 1 reply; 4+ messages in thread
From: Antonino Daplas @ 2003-01-18  7:59 UTC (permalink / raw)
  To: James Simmons; +Cc: Linux Fbdev development list

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

Hi James,

Attached is a diff against linux-2.5.59 with the following i810fb
updates:

1.  Uses fb_get_mode() and fb_validate_mode() to calculate/check display
timings.  

2. Fixed bug in i810fb_imageblit() and i810fb_cursor() when bitmap is not divisible
by 8.

3.  Removed unnecessary calls to wait_for_engine_idle() since fbcon
already guarantees that fb_sync() will be called whenever the
framebuffer memory is to be accessed.


The updates will remove around 250 lines of code :-)

Tony



[-- Attachment #2: i810fb1.diff --]
[-- Type: text/x-patch, Size: 19906 bytes --]

diff -Naur linux-2.5.59/drivers/video/i810/i810.h linux/drivers/video/i810/i810.h
--- linux-2.5.59/drivers/video/i810/i810.h	2003-01-17 11:35:47.000000000 +0000
+++ linux/drivers/video/i810/i810.h	2003-01-17 11:35:20.000000000 +0000
@@ -170,13 +170,6 @@
 #define REF_FREQ                    24000000
 #define TARGET_N_MAX                30
 
-#define FLYBACK                     550
-#define V_FRONTPORCH                1
-#define H_OFFSET                    40
-#define H_SCALEFACTOR               20
-#define H_BLANKSCALE                128
-#define H_GRADIENT                   600
-
 #define MAX_PIXELCLOCK              230000000
 #define MIN_PIXELCLOCK               15000000
 #define VFMAX                       60
diff -Naur linux-2.5.59/drivers/video/i810/i810_accel.c linux/drivers/video/i810/i810_accel.c
--- linux-2.5.59/drivers/video/i810/i810_accel.c	2003-01-17 11:35:44.000000000 +0000
+++ linux/drivers/video/i810/i810_accel.c	2003-01-17 11:35:18.000000000 +0000
@@ -75,8 +75,6 @@
 	return 1;
 }
 
-
-
 /** 
  * wait_for_engine_idle - waits for all hardware engines to finish
  * @par: pointer to i810fb_par structure
@@ -154,12 +152,14 @@
 				    int blit_bpp, struct i810fb_par *par)
 {
 	if (begin_iring(par, 24 + IRING_PAD)) return;
+
 	PUT_RING(BLIT | SOURCE_COPY_BLIT | 4);
 	PUT_RING(xdir | rop << 16 | dpitch | DYN_COLOR_EN | blit_bpp);
 	PUT_RING(dheight << 16 | dwidth);
 	PUT_RING(dest);
 	PUT_RING(dpitch);
 	PUT_RING(src);
+
 	end_iring(par);
 }	
 
@@ -184,12 +184,14 @@
 			      struct i810fb_par *par)
 {
 	if (begin_iring(par, 24 + IRING_PAD)) return;
+
 	PUT_RING(BLIT | COLOR_BLT | 3);
 	PUT_RING(rop << 16 | pitch | SOLIDPATTERN | DYN_COLOR_EN | blit_bpp);
 	PUT_RING(height << 16 | width);
 	PUT_RING(dest);
 	PUT_RING(what);
 	PUT_RING(NOP);
+
 	end_iring(par);
 }
  
@@ -220,17 +222,16 @@
 					  int dest, const u32 *src, int bg,
 					  int fg, struct i810fb_par *par)
 {
-	u32 i, *s = (u32 *) src;
-
 	if (begin_iring(par, 24 + (dsize << 2) + IRING_PAD)) return;
+
 	PUT_RING(BLIT | MONO_SOURCE_COPY_IMMEDIATE | (4 + dsize));
 	PUT_RING(DYN_COLOR_EN | blit_bpp | rop << 16 | dpitch);
 	PUT_RING(dheight << 16 | dwidth);
 	PUT_RING(dest);
 	PUT_RING(bg);
 	PUT_RING(fg);
-	for (i = dsize; i--; ) 
-		PUT_RING(*s++);
+	while (dsize--) 
+		PUT_RING(*src++);
 
 	end_iring(par);
 }
@@ -319,17 +320,10 @@
 	struct i810fb_par *par = (struct i810fb_par *) p->par;
 	u32 dx, dy, width, height, dest, rop = 0, color = 0;
 
-	if (!p->var.accel_flags || par->dev_flags & LOCKUP) {
-		cfb_fillrect(p, rect);
-		return;
-	}
+	if (!p->var.accel_flags || par->dev_flags & LOCKUP ||
+	    par->depth == 4) 
+		return cfb_fillrect(p, rect);
 
-	if (par->depth == 4) {
-		wait_for_engine_idle(par);
-		cfb_fillrect(p, rect);
-		return;
-	}
-			
 	if (par->depth == 1) 
 		color = rect->color;
 	else 
@@ -352,16 +346,9 @@
 	struct i810fb_par *par = (struct i810fb_par *) p->par;
 	u32 sx, sy, dx, dy, pitch, width, height, src, dest, xdir;
 
-	if (!p->var.accel_flags || par->dev_flags & LOCKUP) {
-		cfb_copyarea(p, region);
-		return;
-	}
-
-	if (par->depth == 4) {
-		wait_for_engine_idle(par);
-		cfb_copyarea(p, region);
-		return;
-	}
+	if (!p->var.accel_flags || par->dev_flags & LOCKUP ||
+	    par->depth == 4)
+		return cfb_copyarea(p, region);
 
 	dx = region->dx * par->depth;
 	sx = region->sx * par->depth;
@@ -399,16 +386,9 @@
 	u32 fg = 0, bg = 0, s_pitch, d_pitch, size, offset, dst, i, j;
 	u8 *s_addr, *d_addr;
 	
-	if (!p->var.accel_flags || par->dev_flags & LOCKUP) {
-		cfb_imageblit(p, image);
-		return;
-	}
-
-	if (par->depth == 4 || image->depth != 1) {
-		wait_for_engine_idle(par);
-		cfb_imageblit(p, image);
-		return;
-	}
+	if (!p->var.accel_flags || par->dev_flags & LOCKUP ||
+	    par->depth == 4 || image->depth != 1) 
+		return cfb_imageblit(p, image);
 
 	switch (p->var.bits_per_pixel) {
 	case 8:
@@ -425,14 +405,14 @@
 	dst = p->fix.smem_start + (image->dy * p->fix.line_length) + 
 		(image->dx * par->depth);
 
-	s_pitch = image->width/8;
+	s_pitch = (image->width+7)/8;
 	d_pitch = (s_pitch + 1) & ~1;
 	
-	size = d_pitch * image->height;
+	size = (d_pitch * image->height) + 7;
+	size &= ~7;
 
 	if (image->width & 15) {
-		offset = get_buffer_offset(size, par);
-		
+		offset = get_buffer_offset(size, par);		
 		d_addr = par->pixmap.virtual + offset;
 		s_addr = image->data;
 		
@@ -465,7 +445,7 @@
 {
 	struct i810fb_par *par = (struct i810fb_par *) p->par;
 	
-	if (!p->var.accel_flags)
+	if (!p->var.accel_flags || par->dev_flags & LOCKUP)
 		return 0;
 
 	return wait_for_engine_idle(par);
diff -Naur linux-2.5.59/drivers/video/i810/i810_main.c linux/drivers/video/i810/i810_main.c
--- linux-2.5.59/drivers/video/i810/i810_main.c	2003-01-17 11:35:44.000000000 +0000
+++ linux/drivers/video/i810/i810_main.c	2003-01-17 11:35:18.000000000 +0000
@@ -623,7 +623,7 @@
 	}
 
 	n_reg = m_reg = n_target = 3;	
-	while ((diff_min || mod_min) && (n_target < n_target_max)) {
+	while (diff_min && mod_min && (n_target < n_target_max)) {
 		f_out = (p_divisor * n_reg * 1000000)/(4 * 24 * m_reg);
 		mod = (p_divisor * n_reg * 1000000) % (4 * 24 * m_reg);
 		m_target = m_reg;
@@ -654,261 +654,6 @@
 	if (p) *p = (p_target << 4);
 }
 
-/**
- * i810_get_vblank - get vertical blank time
- * @hfreq: horizontal freq
- *
- * DESCRIPTION:
- * vblank = right_margin + vsync_len + left_margin 
- *    given: right_margin = 1 (V_FRONTPORCH)
- *           vsync_len    = 3
- *           flyback      = 550
- *
- *                          flyback * hfreq
- *           left_margin  = --------------- - vsync_len
- *                           1000000
- *           and flyback is set to 550
- */
-static u32 i810_get_vblank(u32 hfreq)
-{
-	u32 vblank;
-
-	vblank = (hfreq * FLYBACK)/1000; 
-	vblank = (vblank + 500)/1000;
-	return (vblank + V_FRONTPORCH);
-}
-
-/** 
- * i810_get_hblank - get horizontal blank time
- * @hfreq: horizontal freq
- * @xres: horizontal resolution in pixels
- *
- * DESCRIPTION:
- * duty cycle is the percent of htotal assigned to inactive display
- * duty cycle = C - (M/Hfreq)
- * where: C = ((offset - scale factor) * blank_scale)
- *            -------------------------------------- + scale factor
- *                        256 
- *        M = blank_scale * gradient
- *
- *           xres * duty_cycle
- * hblank = ------------------
- *           100 - duty_cycle
- */
-static u32 i810_get_hblank(u32 hfreq, u32 xres)
-{
-	u32 c_val, m_val, duty_cycle, hblank;
-
-	c_val = (((H_OFFSET - H_SCALEFACTOR) * H_BLANKSCALE)/256 + 
-		 H_SCALEFACTOR) * 1000;
-	m_val = (H_BLANKSCALE * H_GRADIENT)/256;
-	m_val = (m_val * 1000000)/hfreq;
-	duty_cycle = c_val - m_val;
-	hblank = (xres * duty_cycle)/(100000 - duty_cycle);
-	hblank = (hblank + 4) & ~7;
-	return (hblank);
-}
-
-/**
- * i810_estimate_hfreq - estimate hsync
- * @vfreq: vertical refresh rate
- * @yres: vertical resolution
- *
- * DESCRIPTION:
- * Based on:
- *
- *          (yres + front_port) * vfreq * 1000000
- * hfreq = -------------------------------------
- *          (1000000 - (vfreq * FLYBACK)
- * 
- */
-
-static u32 i810_estimate_hfreq(u32 vfreq, u32 yres)
-{
-	u64 hfreq;
-	u32 divisor;
-	
-	divisor = 1000000 - (vfreq * FLYBACK);
-	
-	hfreq = (u64) (yres + V_FRONTPORCH) *  
-		(u64) (vfreq)  * 1000000;
-	do_div(hfreq, divisor);
-	
-	return ((u32) hfreq);
-}
-
-/**
- * i810_calculate_timings - calculate video timings 
- * @info: pointer to fb_info structure
- * @var: pointer to current var
- * 
- * DESCRIPTION:
- * htotal: calculated using GTF
- * vtotal: calculated using GTF
- * hsync pulse:  8% of htotal
- * vsync pulse:  3 
- * left margin : (htotal - xres)/2 - hsync
- * right margin: sync + left margin
- * upper margin: 1
- * lower margin: vtotal - (yres + vsync + upper margin)
- *
- * Calculates necessary timing information based on 
- * monitor specifications.  This will use the 
- * VESA generalized timing formula. New values are
- * written to @var.
- */                      
-static int i810_calculate_timings(struct fb_info *info, 
-				  struct fb_var_screeninfo *var,
-				  u32 xres, u32 yres)
-{
-	u64 num = 1000000000000;
-	u32 htotal = 0, vtotal, hfreq, vfreq, hblank, vblank; 
-	u32 dclk, interlace = 0, dscan = 0;
-	u32 max_pixclock = 0;
-
-	switch (var->bits_per_pixel) {
-	case 8:
-		max_pixclock = 234000000;
-		break;
-	case 16:
-		max_pixclock = 229000000;
-		break;
-	case 24:
-	case 32:
-		max_pixclock = 204000000;
-		break;
-	default:
-		max_pixclock = 0;
-	}
-
-	if (var->vmode & FB_VMODE_INTERLACED) { 
-		yres >>= 1;
-		interlace = 1;
-	}
-	if (var->vmode & FB_VMODE_DOUBLE) {
-		yres <<= 1;
-		dscan = 1;
-	}
-
-	hfreq = info->monspecs.hfmax;
-	vblank = i810_get_vblank(hfreq);
-	vtotal = yres + vblank;
-	vfreq = hfreq/vtotal;
-	if (vfreq > info->monspecs.vfmax) { 
-		vfreq = info->monspecs.vfmax;
-		hfreq = i810_estimate_hfreq(vfreq, yres);
-		vblank = i810_get_vblank(hfreq);
-		vtotal = yres + vblank;
-	}	
-	hblank = i810_get_hblank(hfreq, xres);
-	htotal = xres + hblank;
-	dclk = htotal * hfreq;
-	while(dclk > max_pixclock          &&  
-	      hfreq > info->monspecs.hfmin &&
-	      vfreq > info->monspecs.vfmin)   {
-		hfreq -= 1000;
-		vblank = i810_get_vblank(hfreq);
-		vtotal = yres + vblank;
-		vfreq = hfreq/vtotal;
-		hblank = i810_get_hblank(hfreq, xres);
-		htotal = xres + hblank;
-		dclk = hfreq * htotal;
-	} 
-	if (vfreq < info->monspecs.vfmin) {
-		printk("i810fb: required vertical refresh, %dHz, "
-		       "for %dx%d is out of range\n",
-		       vfreq, xres, yres);
-		return -1;
-	}
-	if (hfreq < info->monspecs.hfmin) {
-		printk("i810fb: required horizontal sync frequency, %dKHz, "
-		       "for %dx%d is out of range\n", hfreq/1000, xres, yres);
-		return -1;
-	}
-	if (dclk < MIN_PIXELCLOCK) {
-		printk("i810fb: required pixelclock, %dMHz, for %dx%d"
-		       " is out of range\n", dclk/1000000, xres, yres);
-		return -1;
-	}
-
-	do_div(num, dclk);
-	var->pixclock = (u32) num;
-	var->hsync_len = ((htotal * 8)/100 + 4) & ~7;
-	var->right_margin = ((hblank >> 1) - var->hsync_len + 4) & ~7;
-	var->left_margin = (hblank-var->right_margin-var->hsync_len + 4) & ~7;
-
-	var->vsync_len = (3 << interlace) >> dscan; 
-	var->lower_margin = (1 << interlace) >> dscan;
-	var->upper_margin = ((vblank << interlace) >> dscan) -
-		(var->vsync_len + var->lower_margin);
-
-	if (yres > 480 || (yres == 200 && vfreq == 60 && hfreq/100 == 157))
-		var->sync |= FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT;
-	else {
-		if (yres == 400 && vfreq == 70 && hfreq/100 == 315)
-			var->sync |= FB_SYNC_VERT_HIGH_ACT;
-		if (yres == 350 && vfreq == 60 && hfreq/100 == 218)
-			var->sync |= FB_SYNC_HOR_HIGH_ACT;
-	}
-	return 0;
-}
-
-/**
- * i810_check_custom_timings - validates user entered timings
- * @info: pointer to fb_info
- * @var: pointer to current fb_var_screeninfo
- *
- * DESCRIPTION:
- * Validates user entered timings in @var.
- */
-static int i810_check_custom_timings(struct fb_info *info, 
-				     struct fb_var_screeninfo *var,
-				     u32 xres, u32 yres)
-{
-	u64 num = 1000000000000;
-	u32 hfreq, vfreq, htotal, vtotal, pixclock;
-	u32 max_pixclock = 0;
-
-	if (!var->pixclock)
-		return -EINVAL;
-	do_div(num, var->pixclock);
-	pixclock = (u32) num;
-
-	htotal = xres + var->right_margin + var->hsync_len + var->left_margin;
-	vtotal = yres + var->lower_margin + var->vsync_len + var->upper_margin;
-
-	if (var->vmode & FB_VMODE_INTERLACED) 
-		vtotal >>= 1;
-
-	if (var->vmode & FB_VMODE_DOUBLE)
-		vtotal <<= 1;
-
-	hfreq = pixclock/htotal;
-	vfreq = hfreq/vtotal;
-
-	switch (var->bits_per_pixel) {
-	case 8:
-		max_pixclock = 234000000;
-		break;
-	case 16:
-		max_pixclock = 229000000;
-		break;
-	case 24:
-	case 32:
-		max_pixclock = 204000000;
-		break;
-	default:
-		max_pixclock = 0;
-	}
-
-	if (pixclock < MIN_PIXELCLOCK || pixclock > max_pixclock ||
-	    hfreq < info->monspecs.hfmin || hfreq > info->monspecs.hfmax ||
-	    vfreq < info->monspecs.vfmin || vfreq > info->monspecs.vfmax)
-		return -EINVAL;
-	
-	return 0;
-}
-
 /*************************************************************
  *                Hardware Cursor Routines                   *
  *************************************************************/
@@ -950,19 +695,25 @@
 				   struct i810fb_par *par)
 {
 	u8 *addr = par->cursor_heap.virtual;
-	int i, j, w = (width + 7)/8;
-
+	int i, j, w = width/8;
+	int mod = width % 8, t_mask, d_mask;
+	
+	t_mask = 0xff >> mod;
+	d_mask = ~(0xff >> mod); 
 	for (i = height; i--; ) {
 		for (j = 0; j < w; j++) {
 			i810_writeb(j+0, addr, 0x00);
 			i810_writeb(j+8, addr, *data++);
 		}
+		if (mod) {
+			i810_writeb(j+0, addr, t_mask);
+			i810_writeb(j+8, addr, *data++ & d_mask);
+		}
 		addr += 16;
 	}
 }
 
-static void i810_load_cursor_colors(int fg, int bg, 
-				    struct fb_info *info)
+static void i810_load_cursor_colors(int fg, int bg, struct fb_info *info)
 {
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	u8 *mmio = par->mmio_start_virtual, temp;
@@ -1097,28 +848,14 @@
 		var->transp.length = 0;
 		break;
 	case 16:
-		if (var->green.length == 5) {
-			/* RGB 555 */
-			var->red.offset = 10;
-			var->red.length = 5;
-			var->green.offset = 5;
-			var->green.length = 5;
-			var->blue.offset = 0;
-			var->blue.length = 5;
-			var->transp.offset = 15;
-			var->transp.length = 1;
-		}
-		else {
-			/* RGB 565 */
-			var->red.offset = 11;
-			var->red.length = 5;
-			var->green.offset = 5;
-			var->green.length = 6;
-			var->blue.offset = 0;
-			var->blue.length = 5;
-			var->transp.offset = 0;
-			var->transp.length = 0;
-		}
+		var->green.length = (var->green.length == 5) ? 5 : 6;
+		var->red.length = 5;
+		var->blue.length = 5;
+		var->transp.length = 6 - var->green.length;
+		var->blue.offset = 0;
+		var->green.offset = 5;
+		var->red.offset = 5 + var->green.length;
+		var->transp.offset =  (5 + var->red.offset) & 15;
 		break;
 	case 24:	/* RGB 888   */
 	case 32:	/* RGBA 8888 */
@@ -1128,15 +865,9 @@
 		var->green.length = 8;
 		var->blue.offset = 0;
 		var->blue.length = 8;
-		if (var->bits_per_pixel == 24) {
-			var->transp.offset = 0;
-			var->transp.length = 0;
-		}
-		else {
-			var->transp.offset = 24;
-			var->transp.length = 8;
-			break;
-		}
+		var->transp.length = var->bits_per_pixel - 24;
+		var->transp.offset = (var->transp.length) ? 24 : 0;
+		break;
 	}
 	var->red.msb_right = 0;
 	var->green.msb_right = 0;
@@ -1195,11 +926,24 @@
 	/*
 	 * Monitor limit
 	 */
-	if (i810_check_custom_timings(info, var, xres, yres)) {
-		if (i810_calculate_timings(info, var, xres, yres)) {
-			return -EINVAL;
+	if (fb_validate_mode(var, info)) {
+		switch (var->bits_per_pixel) {
+		case 8:
+			info->monspecs.dclkmax = 234000000;
+			break;
+		case 16:
+			info->monspecs.dclkmax = 229000000;
+			break;
+		case 24:
+		case 32:
+			info->monspecs.dclkmax = 204000000;
+			break;
 		}
+		info->monspecs.dclkmin = 15000000;
+		if (fb_get_mode(FB_MAXTIMINGS, 0, var, info))
+			return -EINVAL;
 	}
+	
 	var->xres = xres;
 	var->yres = yres;
 	var->xres_virtual = vxres;
@@ -1245,8 +989,7 @@
 		return -EINVAL;
 	}
     	fix->ywrapstep = 0;
-	fix->line_length = get_line_length(par, info->var.xres_virtual, 
-					   info->var.bits_per_pixel);
+	fix->line_length = par->pitch;
 	fix->mmio_start = par->mmio_start_phys;
 	fix->mmio_len = MMIO_SIZE;
 	fix->accel = FB_ACCEL_I810;
@@ -1258,14 +1001,13 @@
  * decode_var - modify par according to contents of var
  * @var: pointer to fb_var_screeninfo
  * @par: pointer to i810fb_par
- * @info: pointer to fb_info
  *
  * DESCRIPTION:
  * Based on the contents of @var, @par will be dynamically filled up.
  * @par contains all information necessary to modify the hardware. 
 */
 static void decode_var(const struct fb_var_screeninfo *var, 
-		       struct i810fb_par *par, struct fb_info *info)
+		       struct i810fb_par *par)
 {
 	u32 xres, yres, vxres, vyres;
 
@@ -1569,7 +1311,7 @@
 {
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
 
-	decode_var(&info->var, par, info);
+	decode_var(&info->var, par);
 	i810_load_regs(par);
 	i810_init_cursor(par);
 	par->cursor_reset = 1;
@@ -1608,9 +1350,8 @@
 	u8 *mmio = par->mmio_start_virtual;	
 	u16 flags = cursor->set;
 
-	if (!info->var.accel_flags || par->dev_flags & LOCKUP) {
+	if (!info->var.accel_flags || par->dev_flags & LOCKUP) 
 		return soft_cursor(info, cursor);
-	}
 
 	if (cursor->image.width > 64 || cursor->image.height > 64 ||
 	    (cursor->dest == NULL && cursor->rop == ROP_XOR))
@@ -1655,9 +1396,9 @@
 		switch (cursor->rop) {
 		case ROP_XOR:
 			for (i = 0; i < size; i++) {
-				data[i] = (cursor->image.data[i] & 
-					   cursor->mask[i]) ^
-					cursor->dest[i];
+				data[i] = ((cursor->image.data[i] & 
+					    cursor->mask[i]) ^
+					   cursor->dest[i]);
 			}
 			break;
 		case ROP_COPY:
@@ -1680,19 +1421,19 @@
 }
 
 static struct fb_ops i810fb_ops __initdata = {
-    .owner =             THIS_MODULE,
-    .fb_open =           i810fb_open,
-    .fb_release =        i810fb_release,
-    .fb_check_var =      i810fb_check_var,
-    .fb_set_par =        i810fb_set_par,
-    .fb_setcolreg =      i810fb_setcolreg,
-    .fb_blank =          i810fb_blank,
-    .fb_pan_display =    i810fb_pan_display, 
-    .fb_fillrect =       i810fb_fillrect,
-    .fb_copyarea =       i810fb_copyarea,
-    .fb_imageblit =      i810fb_imageblit,
-    .fb_cursor =         i810fb_cursor,
-    .fb_sync =           i810fb_sync,
+	.owner =             THIS_MODULE,
+	.fb_open =           i810fb_open,
+	.fb_release =        i810fb_release,
+	.fb_check_var =      i810fb_check_var,
+	.fb_set_par =        i810fb_set_par,
+	.fb_setcolreg =      i810fb_setcolreg,
+	.fb_blank =          i810fb_blank,
+	.fb_pan_display =    i810fb_pan_display, 
+	.fb_fillrect =       i810fb_fillrect,
+	.fb_copyarea =       i810fb_copyarea,
+	.fb_imageblit =      i810fb_imageblit,
+	.fb_cursor =         i810fb_cursor,
+	.fb_sync =           i810fb_sync,
 };
 
 /***********************************************************************
@@ -1864,7 +1605,7 @@
 	info->var.yres = yres;
 	info->var.yres_virtual = vyres;
 	info->var.bits_per_pixel = bpp;
-	
+
 	if (dcolor)
 		info->var.nonstd = 1;
 
@@ -2076,22 +1817,13 @@
 	vfreq = hfreq/(info->var.yres + info->var.upper_margin +
 		       info->var.vsync_len + info->var.lower_margin);
 
-      	printk("fb: %s v%d.%d.%d%s, Tony Daplas\n"
+      	printk("fb: %s v%d.%d.%d%s, (c) Tony Daplas\n"
       	       "     Video RAM      : %dK\n" 
-	       "     Mode           : %dx%d-%dbpp@%dHz\n"
-	       "     Acceleration   : %sabled\n"
-	       "     MTRR           : %sabled\n"
-	       "     External VGA   : %sabled\n"
-	       "     Video Timings  : %s\n",	
+	       "     Mode           : %dx%d-%dbpp@%dHz\n",
 	       i810_pci_list[entry->driver_data],
 	       VERSION_MAJOR, VERSION_MINOR, VERSION_TEENIE, BRANCH_VERSION,
 	       (int) par->fb.size>>10, info->var.xres, 
-	       info->var.yres, info->var.bits_per_pixel, vfreq, 
-	       (par->dev_flags & HAS_ACCELERATION) ? "en" : "dis", 
-	       (par->dev_flags & HAS_MTRR) ? "en" : "dis", 
-	       (ext_vga) ? "en" : "dis", (IS_DVT) ? 
-	       "Intel(R) DVT" : "VESA GTF (US)");
-
+	       info->var.yres, info->var.bits_per_pixel, vfreq);
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-03-26  5:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-26  3:37 [PATCH]: i810fb updates Antonino Daplas
2003-03-26  5:19 ` James Simmons
  -- strict thread matches above, loose matches on Subject: below --
2003-01-18  7:59 Antonino Daplas
2003-01-24 19:06 ` James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).