All of lore.kernel.org
 help / color / mirror / Atom feed
* cgsix bmove added for 2.4
@ 2006-05-26 16:51 Krzysztof Helt
  0 siblings, 0 replies; only message in thread
From: Krzysztof Helt @ 2006-05-26 16:51 UTC (permalink / raw)
  To: sparclinux

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

Hello,

This is a patch for the cg6 frame buffer which adds hardware
accelerated con_bmove function (bit blitter). It is used for some
functions like bash line editing and under vim, but it is not
used to scroll the screen by default. I forced it to be used for
scrolling (not included in the patch) but the speed of scrolling
with blitter is twice slower. I will look into it.

I tested it on SS20 with two SuperSparcs. I would like to hear a
feedback from someone with Ultrasparc system and cgsix.

I also found that the sbusfb driver uses only 1024x864 pixels for
the framebuffer area leaving a margin around. The 2.6.15 kernel
has not any margin. Is it a good idea to get rid of it for the
2.4 and have more characters on the frame buffer?

I also saw the cgsix driver is included into OpenSolaris. I
didn't look into it so this is my question. How can I look into
the OpenSolaris driver for the cgix and be able to wrote
something for the linux kernel? (It can be done through another
person if needed).

Regards,
Krzysztof
PS. The patch has also some formating changes.

----------------------------------------------------
Gdy nadchodzi przełomowy moment w historii, musisz zdecydować, 
po czyjej stronie będziesz. 
"X-Men: Ostatni bastion" - w kinach od 26 maja. 
http://klik.wp.pl/?adr=http%3A%2F%2Fwww.x-men.wp.pl&sid=763

[-- Attachment #2: cgsix-bmove.patch --]
[-- Type: application/octet-stream, Size: 10602 bytes --]

diff -ur linux-2.4.32/drivers/video/cgsixfb.c linux-2.4.33/drivers/video/cgsixfb.c
--- linux-2.4.32/drivers/video/cgsixfb.c	2001-10-17 23:16:39.000000000 +0200
+++ linux-2.4.33/drivers/video/cgsixfb.c	2006-05-26 16:52:19.000000000 +0200
@@ -42,30 +42,30 @@
 #define CG6_RAM_OFFSET       0x800000UL
 
 /* FHC definitions */
-#define CG6_FHC_FBID_SHIFT           24
-#define CG6_FHC_FBID_MASK            255
-#define CG6_FHC_REV_SHIFT            20
-#define CG6_FHC_REV_MASK             15
-#define CG6_FHC_FROP_DISABLE         (1 << 19)
-#define CG6_FHC_ROW_DISABLE          (1 << 18)
-#define CG6_FHC_SRC_DISABLE          (1 << 17)
-#define CG6_FHC_DST_DISABLE          (1 << 16)
-#define CG6_FHC_RESET                (1 << 15)
-#define CG6_FHC_LITTLE_ENDIAN        (1 << 13)
-#define CG6_FHC_RES_MASK             (3 << 11)
-#define CG6_FHC_1024                 (0 << 11)
-#define CG6_FHC_1152                 (1 << 11)
-#define CG6_FHC_1280                 (2 << 11)
-#define CG6_FHC_1600                 (3 << 11)
-#define CG6_FHC_CPU_MASK             (3 << 9)
-#define CG6_FHC_CPU_SPARC            (0 << 9)
-#define CG6_FHC_CPU_68020            (1 << 9)
-#define CG6_FHC_CPU_386              (2 << 9)
-#define CG6_FHC_TEST		     (1 << 8)
-#define CG6_FHC_TEST_X_SHIFT	     4
-#define CG6_FHC_TEST_X_MASK	     15
-#define CG6_FHC_TEST_Y_SHIFT	     0
-#define CG6_FHC_TEST_Y_MASK	     15
+#define CG6_FHC_FBID_SHIFT		24
+#define CG6_FHC_FBID_MASK		255
+#define CG6_FHC_REV_SHIFT		20
+#define CG6_FHC_REV_MASK		15
+#define CG6_FHC_FROP_DISABLE		(1 << 19)
+#define CG6_FHC_ROW_DISABLE		(1 << 18)
+#define CG6_FHC_SRC_DISABLE		(1 << 17)
+#define CG6_FHC_DST_DISABLE		(1 << 16)
+#define CG6_FHC_RESET			(1 << 15)
+#define CG6_FHC_LITTLE_ENDIAN		(1 << 13)
+#define CG6_FHC_RES_MASK		(3 << 11)
+#define CG6_FHC_1024			(0 << 11)
+#define CG6_FHC_1152			(1 << 11)
+#define CG6_FHC_1280			(2 << 11)
+#define CG6_FHC_1600			(3 << 11)
+#define CG6_FHC_CPU_MASK		(3 << 9)
+#define CG6_FHC_CPU_SPARC		(0 << 9)
+#define CG6_FHC_CPU_68020		(1 << 9)
+#define CG6_FHC_CPU_386	     		(2 << 9)
+#define CG6_FHC_TEST			(1 << 8)
+#define CG6_FHC_TEST_X_SHIFT		4
+#define CG6_FHC_TEST_X_MASK		15
+#define CG6_FHC_TEST_Y_SHIFT		0
+#define CG6_FHC_TEST_Y_MASK		15
 
 /* FBC mode definitions */
 #define CG6_FBC_BLIT_IGNORE		0x00000000
@@ -116,17 +116,17 @@
 #define CG6_FBC_INDEX_MASK		0x00000030
 
 /* THC definitions */
-#define CG6_THC_MISC_REV_SHIFT       16
-#define CG6_THC_MISC_REV_MASK        15
-#define CG6_THC_MISC_RESET           (1 << 12)
-#define CG6_THC_MISC_VIDEO           (1 << 10)
-#define CG6_THC_MISC_SYNC            (1 << 9)
-#define CG6_THC_MISC_VSYNC           (1 << 8)
-#define CG6_THC_MISC_SYNC_ENAB       (1 << 7)
-#define CG6_THC_MISC_CURS_RES        (1 << 6)
-#define CG6_THC_MISC_INT_ENAB        (1 << 5)
-#define CG6_THC_MISC_INT             (1 << 4)
-#define CG6_THC_MISC_INIT            0x9f
+#define CG6_THC_MISC_REV_SHIFT		16
+#define CG6_THC_MISC_REV_MASK		15
+#define CG6_THC_MISC_RESET		(1 << 12)
+#define CG6_THC_MISC_VIDEO		(1 << 10)
+#define CG6_THC_MISC_SYNC		(1 << 9)
+#define CG6_THC_MISC_VSYNC		(1 << 8)
+#define CG6_THC_MISC_SYNC_ENAB		(1 << 7)
+#define CG6_THC_MISC_CURS_RES		(1 << 6)
+#define CG6_THC_MISC_INT_ENAB		(1 << 5)
+#define CG6_THC_MISC_INT		(1 << 4)
+#define CG6_THC_MISC_INIT		0x9f
 
 MODULE_LICENSE("GPL");
 
@@ -138,7 +138,7 @@
 };
 
 struct cg6_thc {
-        uint thc_pad0[512];
+	uint thc_pad0[512];
 	volatile uint thc_hs;		/* hsync timing */
 	volatile uint thc_hsdvs;
 	volatile uint thc_hd;
@@ -156,7 +156,7 @@
 	u32		xxx0[1];
 	volatile u32	mode;
 	volatile u32	clip;
-	u32		xxx1[1];	    
+	u32		xxx1[1];
 	volatile u32	s;
 	volatile u32	draw;
 	volatile u32	blit;
@@ -211,15 +211,15 @@
 };
 
 static struct sbus_mmap_map cg6_mmap_map[] = {
-	{ CG6_FBC,		CG6_FBC_OFFSET,		PAGE_SIZE 		},
-	{ CG6_TEC,		CG6_TEC_OFFSET,		PAGE_SIZE 		},
-	{ CG6_BTREGS,		CG6_BROOKTREE_OFFSET,	PAGE_SIZE 		},
-	{ CG6_FHC,		CG6_FHC_OFFSET,		PAGE_SIZE 		},
-	{ CG6_THC,		CG6_THC_OFFSET,		PAGE_SIZE 		},
-	{ CG6_ROM,		CG6_ROM_OFFSET,		0x10000   		},
-	{ CG6_RAM,		CG6_RAM_OFFSET,		SBUS_MMAP_FBSIZE(1)  	},
-	{ CG6_DHC,		CG6_DHC_OFFSET,		0x40000   		},
-	{ 0,			0,			0	  		}
+	{ CG6_FBC,		CG6_FBC_OFFSET,		PAGE_SIZE		},
+	{ CG6_TEC,		CG6_TEC_OFFSET,		PAGE_SIZE		},
+	{ CG6_BTREGS,		CG6_BROOKTREE_OFFSET,	PAGE_SIZE		},
+	{ CG6_FHC,		CG6_FHC_OFFSET,		PAGE_SIZE		},
+	{ CG6_THC,		CG6_THC_OFFSET,		PAGE_SIZE		},
+	{ CG6_ROM,		CG6_ROM_OFFSET,		0x10000		},
+	{ CG6_RAM,		CG6_RAM_OFFSET,		SBUS_MMAP_FBSIZE(1)	},
+	{ CG6_DHC,		CG6_DHC_OFFSET,		0x40000		},
+	{ 0,			0,			0			}
 };
 
 static void cg6_setup(struct display *p)
@@ -228,6 +228,54 @@
 	p->next_plane = 0;
 }
 
+static void cg6_bmove(struct display *p, int sy, int sx, int dy, int dx,
+		  int height, int width)
+{
+	struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
+	register struct cg6_fbc *fbc = fb->s.cg6.fbc;
+	int x1, y1, x2, y2, w, h;
+	unsigned long flags;
+	int i;
+
+	if (fontheightlog(p)) {
+		y1 = sy << fontheightlog(p); y2 = dy << fontheightlog(p); h = height << fontheightlog(p);
+	} else {
+		y1 = sy * fontheight(p); y2 = dy * fontheight(p); h = height * fontheight(p);
+	}
+	if (fontwidthlog(p)) {
+		x1 = sx << fontwidthlog(p); x2 = dx << fontwidthlog(p); w = width << fontwidthlog(p);
+	} else {
+		x1 = sx * fontwidth(p); x2 = dx * fontwidth(p); w = width * fontwidth(p);
+	}
+	y1 += fb->y_margin;
+	y2 += fb->y_margin;
+	x1 += fb->x_margin;
+	x2 += fb->x_margin;
+	spin_lock_irqsave(&fb->lock, flags);
+	do {
+		i = sbus_readl(&fbc->s);
+	} while (i & 0x10000000);
+	sbus_writel(0xff, &fbc->fg);
+	sbus_writel(0x00, &fbc->bg);
+	sbus_writel(~0, &fbc->pixelm);
+	sbus_writel(0xe880cccc, &fbc->alu);
+	sbus_writel(0, &fbc->s);
+	sbus_writel(0, &fbc->clip);
+
+	sbus_writel(y1, &fbc->y0);
+	sbus_writel(x1, &fbc->x0);
+	sbus_writel(y1 + h - 1, &fbc->y1);
+	sbus_writel(x1 + w - 1, &fbc->x1);
+	sbus_writel(y2, &fbc->y2);
+	sbus_writel(x2, &fbc->x2);
+	sbus_writel(y2 + h - 1, &fbc->y3);
+	sbus_writel(x2 + w - 1, &fbc->x3);
+	do {
+		i = sbus_readl(&fbc->blit);
+	} while (i < 0 && (i & 0x20000000));
+	spin_unlock_irqrestore(&fb->lock, flags);
+}
+
 static void cg6_clear(struct vc_data *conp, struct display *p, int sy, int sx,
 		      int height, int width)
 {
@@ -236,7 +284,7 @@
 	unsigned long flags;
 	int x, y, w, h;
 	int i;
-	
+
 	spin_lock_irqsave(&fb->lock, flags);
 	do {
 		i = sbus_readl(&fbc->s);
@@ -249,7 +297,7 @@
 	sbus_writel(0, &fbc->clip);
 	sbus_writel(~0, &fbc->pm);
 
-        if (fontheightlog(p)) {
+	if (fontheightlog(p)) {
 		y = sy << fontheightlog(p); h = height << fontheightlog(p);
 	} else {
 		y = sy * fontheight(p); h = height * fontheight(p);
@@ -275,7 +323,7 @@
 	int i;
 	register struct cg6_fbc *fbc = fb->s.cg6.fbc;
 	unsigned long flags;
-	
+
 	spin_lock_irqsave(&fb->lock, flags);
 	do {
 		i = sbus_readl(&fbc->s);
@@ -422,7 +470,7 @@
 					u32 val = (((u32)*fd4++) |
 						   ((((u32)*fd3++) |
 						     ((((u32)*fd2++) |
-						       (((u32)*fd1++) 
+						       (((u32)*fd1++)
 							<< fontwidth(p))) <<
 						      fontwidth(p))) <<
 						    fontwidth(p))) <<
@@ -493,7 +541,7 @@
 	struct bt_regs *bt = fb->s.cg6.bt;
 	unsigned long flags;
 	int i;
-                
+
 	spin_lock_irqsave(&fb->lock, flags);
 	sbus_writel(index << 24, &bt->addr);
 	for (i = index; count--; i++){
@@ -511,7 +559,7 @@
 {
 	struct bt_regs *bt = fb->s.cg6.bt;
 	unsigned long flags;
-                
+
 	spin_lock_irqsave(&fb->lock, flags);
 	sbus_writel(0, &bt->addr);
 	sbus_writel(0xffffffff, &bt->color_map);
@@ -522,19 +570,19 @@
 
 static struct display_switch cg6_dispsw __initdata = {
 	setup:		cg6_setup,
-	bmove:		fbcon_redraw_bmove,
+	bmove:		cg6_bmove,
 	clear:		cg6_clear,
 	putc:		cg6_putc,
 	putcs:		cg6_putcs,
-	revc:		cg6_revc, 
+	revc:		cg6_revc,
 	fontwidthmask:	FONTWIDTHRANGE(1,16) /* Allow fontwidths up to 16 */
 };
 
 static void cg6_setcursormap (struct fb_info_sbusfb *fb, u8 *red, u8 *green, u8 *blue)
 {
-        struct bt_regs *bt = fb->s.cg6.bt;
+	struct bt_regs *bt = fb->s.cg6.bt;
 	unsigned long flags;
-        
+
 	spin_lock_irqsave(&fb->lock, flags);
 	sbus_writel(1 << 24, &bt->addr);
 	sbus_writel(red[0] << 24, &bt->cursor);
@@ -614,7 +662,7 @@
 	unsigned long flags;
 	u32 mode, tmp;
 	int i;
-	
+
 	spin_lock_irqsave(&fb->lock, flags);
 
 	/* Turn off stuff in the Transform Engine. */
@@ -679,7 +727,7 @@
 	struct fb_info_sbusfb *fb = sbusfbinfo(info);
 	register struct cg6_fbc *fbc = fb->s.cg6.fbc;
 	int i;
-	
+
 	do {
 		i = sbus_readl(&fbc->s);
 	} while (i & 0x10000000);
@@ -705,11 +753,11 @@
 	fbops = kmalloc(sizeof(*fbops), GFP_KERNEL);
 	if (fbops == NULL)
 		return NULL;
-	
+
 	*fbops = *fb->info.fbops;
 	fbops->fb_rasterimg = cg6_rasterimg;
 	fb->info.fbops = fbops;
-	
+
 	if (prom_getbool (fb->prom_node, "dblbuf")) {
 		type->fb_size *= 4;
 		fix->smem_len *= 4;
@@ -717,9 +765,9 @@
 
 	fix->line_length = fb->var.xres_virtual;
 	fix->accel = FB_ACCEL_SUN_CGSIX;
-	
+
 	var->accel_flags = FB_ACCELF_TEXT;
-	
+
 	disp->scrollmode = SCROLL_YREDRAW;
 	if (!disp->screen_base) {
 		disp->screen_base = (char *)
@@ -767,20 +815,20 @@
 	fb->blank = cg6_blank;
 	fb->unblank = cg6_unblank;
 	fb->reset = cg6_reset;
-	
+
 	fb->physbase = phys;
 	fb->mmap_map = cg6_mmap_map;
-	
+
 	/* Initialize Brooktree DAC */
-	sbus_writel(0x04 << 24, &bt->addr);         /* color planes */
+	sbus_writel(0x04 << 24, &bt->addr);	 /* color planes */
 	sbus_writel(0xff << 24, &bt->control);
 	sbus_writel(0x05 << 24, &bt->addr);
 	sbus_writel(0x00 << 24, &bt->control);
-	sbus_writel(0x06 << 24, &bt->addr);         /* overlay plane */
+	sbus_writel(0x06 << 24, &bt->addr);	 /* overlay plane */
 	sbus_writel(0x73 << 24, &bt->control);
 	sbus_writel(0x07 << 24, &bt->addr);
 	sbus_writel(0x00 << 24, &bt->control);
-	
+
 	conf = sbus_readl(fb->s.cg6.fhc);
 	switch(conf & CG6_FHC_CPU_MASK) {
 	case CG6_FHC_CPU_SPARC: p = "sparc"; break;
@@ -801,13 +849,13 @@
 			cardtype = "GX+";
 		}
 	}
-	                                                                        
-	sprintf(idstring, 
+
+	sprintf(idstring,
 #ifdef __sparc_v9__
 		    "cgsix at %016lx TEC Rev %x CPU %s Rev %x [%s]", phys,
-#else	
+#else
 		    "cgsix at %x.%08lx TEC Rev %x CPU %s Rev %x [%s]",
-		    fb->iospace, phys, 
+		    fb->iospace, phys,
 #endif
 		    ((sbus_readl(&fb->s.cg6.thc->thc_misc) >> CG6_THC_MISC_REV_SHIFT) &
 		     CG6_THC_MISC_REV_MASK),
@@ -815,8 +863,8 @@
 
 	sprintf(fb->info.modename, "CGsix [%s]", cardtype);
 	sprintf(fix->id, "CGsix [%s]", cardtype);
-		    
+
 	cg6_reset(fb);
-		    
+
 	return idstring;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-26 16:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-26 16:51 cgsix bmove added for 2.4 Krzysztof Helt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.