All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] [PATCH] Voodoo framebuffer on PARISC
@ 2002-09-15  0:09 Helge Deller
  2002-09-15  4:28 ` [parisc-linux] " B. Douglas Hilton
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Helge Deller @ 2002-09-15  0:09 UTC (permalink / raw)
  To: debian-hppa, parisc-linux; +Cc: B. Douglas Hilton

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

Hi,

there has been some discussions on this lists a few weeks back
about getting the Voodoo framebuffer driver  working on HPPA.
The attached patch allows me to use my Voodoo 2 with the sstfb
framebuffer driver in 16bpp in 640x480, 800x600 and 1024x768
resolutions on console and under X.

Greetings,
Helge

NB: This patch is already integrated into the 2.4.19-pa18 kernel and
I'll continue to do some more code-cleanups before trying to get it
into the official kernel.

[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 10847 bytes --]

Index: sstfb.c
===================================================================
RCS file: /var/cvs/linux/drivers/video/sstfb.c,v
retrieving revision 1.4
diff -u -p -r1.4 sstfb.c
--- sstfb.c	4 Aug 2002 22:59:15 -0000	1.4
+++ sstfb.c	14 Sep 2002 23:58:43 -0000
@@ -107,6 +107,7 @@
 
 #include <asm/io.h>
 #include <asm/ioctl.h>
+#include <asm/uaccess.h>
 
 #include <video/fbcon.h>
 #include <video/fbcon-cfb16.h>
@@ -332,7 +333,7 @@ static void sst_dbg_print_var(struct fb_
 
 #if (SST_DEBUG_REG > 0)
 static void sst_dbg_print_read_reg (u32 reg, u32 val) {
-	char * regname =NULL;
+	char * regname = NULL;
 	switch (reg) {
 	case FBIINIT0: regname="FbiInit0"; break;
 	case FBIINIT1: regname="FbiInit1"; break;
@@ -366,8 +367,8 @@ static void sst_dbg_print_write_reg (u32
 		r_dprintk(" sst_write(%s, %#x)\n", regname, val);
 }
 #else /*  (SST_DEBUG_REG > 0) */
-#  define sst_dbg_print_read_reg(reg, val)	do {}while(0)
-#  define sst_dbg_print_write_reg(reg, val)	do {}while(0)
+#  define sst_dbg_print_read_reg(reg, val)	do {} while(0)
+#  define sst_dbg_print_write_reg(reg, val)	do {} while(0)
 #endif /*  (SST_DEBUG_REG > 0) */
 
 /* register access */
@@ -530,20 +531,15 @@ static int sstfb_setcolreg(u_int regno, 
 		break;
 #endif
 #ifdef EN_24_32_BPP
-#ifdef FBCON_HAS_CFB24
+#if defined(FBCON_HAS_CFB24) || defined(FBCON_HAS_CFB32)
 	case 24:
-		sst_info->fbcon_cmap.cfb32[regno]=col;
-		break;
-#endif
-#ifdef FBCON_HAS_CFB32
 	case 32:
 		sst_info->fbcon_cmap.cfb32[regno]=col;
 		break;
 #endif
 #endif
 	default:
-		eprintk("bug line %d: bad depth '%u'\n",__LINE__,
-			disp->var.bits_per_pixel);
+		BUG();
 		break;
 	}
 	f_dddprintk("bpp: %d . encoded color: %#x\n",
@@ -735,6 +731,7 @@ static int sstfb_encode_var (struct fb_v
 #ifdef EN_24_32_BPP
 	case 24:	/* RGB 888 LfbMode 4 */
 	case 32:	/* ARGB 8888 LfbMode 5 */
+	       	/* in 24bpp we fake a 32 bpp mode */
 		var->red.length    = 8;
 		var->green.length  = 8;
 		var->blue.length   = 8;
@@ -743,11 +740,11 @@ static int sstfb_encode_var (struct fb_v
 		var->red.offset    = 16;
 		var->green.offset  = 8;
 		var->blue.offset   = 0;
-		var->transp.offset = 0; /* in 24bpp we fake a 32 bpp mode */
+		var->transp.offset = 0;
 		break;
 #endif
 	default:
-		eprintk ("bug line %d: bad depth '%u'\n", __LINE__, par->bpp);
+		eprintk("bug line %d: bad depth '%u'\n", __LINE__, par->bpp);
 		break;
 	}
 	return 0;
@@ -775,11 +772,15 @@ static int sstfb_get_fix(struct fb_fix_s
 #define sst_info	((struct sstfb_info *) info)
 
 	struct fb_var_screeninfo *var;
+	struct fb_var_screeninfo var2;
 
 	f_dprintk("sstfb_get_fix(con: %d)\n",con);
-	if (con == -1)
-		sstfb_encode_var(var, &sst_info->current_par, sst_info);
-	else
+	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
+	
+	if (con == -1) {
+		sstfb_encode_var(&var2, &sst_info->current_par, sst_info);
+		var = &var2;
+	} else
 		var = &fb_display[con].var;
 
 	strcpy(fix->id, sst_info->info.modename);
@@ -789,6 +790,7 @@ static int sstfb_get_fix(struct fb_fix_s
 
 	fix->type        = FB_TYPE_PACKED_PIXELS;
 	fix->visual      = FB_VISUAL_TRUECOLOR;
+	fix->accel       = FB_ACCEL_NONE;
 	/*
 	 *   According to the specs, the linelength must be of 1024 *pixels*.
 	 * and the 24bpp mode is in fact a 32 bpp mode.
@@ -966,42 +968,47 @@ static int sstfb_ioctl(struct inode *ino
                        struct fb_info *info)
 {
 #define sst_info	((struct sstfb_info *) info)
-#if (SST_DEBUG_IOCTL >0)
 	int i;
 	u_long p;
-	u32 tmp;
+	u32 tmp, val;
 	u32 fbiinit0;
 	struct pci_dev * sst_dev = sst_info->dev;
-#endif
 
 	f_dprintk("sstfb_ioctl(%x)\n", cmd);
-#if (SST_DEBUG_IOCTL >0)
+	
 	switch (cmd) {
-#  if (SST_DEBUG_VAR >0)
-/* tmp ioctl : dumps fb_display[0-5] */
+		
+#if (SST_DEBUG_VAR >0)
+	/* tmp ioctl : dumps fb_display[0-5] */
 	case _IO('F', 0xdb):		/* 0x46db */
 		f_dprintk("dumping fb_display[0-5].var\n");
 		for (i = 0 ; i< 6 ; i++) {
 			print_var(&fb_display[i].var, "var(%d)", i);
 		}
 		return 0;
-#  endif /* (SST_DEBUG_VAR >0) */
-/* fills the lfb up to *(u32*)arg */
+#endif /* (SST_DEBUG_VAR >0) */
+
+	/* fills the lfb up to given count of pixels */
 	case _IOW('F', 0xdc, u32):	/* 0x46dc */
-		if (*(u32*)arg > 0x400000 )
-			*(u32*) arg = 0x400000;
-		f_dprintk("filling %#x \n", *(u32*)arg);
-		for (p = 0 ; p < *(u32*)arg; p+=2)
+		if (copy_from_user(&val, (void *) arg, sizeof(val)))
+			return -EFAULT;
+		if (val > 0x400000 )
+			val = 0x400000;
+		f_dprintk("filling %#x \n", val);
+		for (p = 0 ; p < val; p+=2)
 			writew( p >> 6 , sst_info->video.vbase + p);
 		return 0;
-/* change VGA pass_through */
+		
+	/* enable/disable VGA pass_through */
 	case _IOW('F', 0xdd, u32):	/* 0x46dd */
+		if (copy_from_user(&val, (void *) arg, sizeof(val)))
+			return -EFAULT;
 		f_dprintk("switch VGA pass-through\n");
 		pci_read_config_dword(sst_dev, PCI_INIT_ENABLE, &tmp);
 		pci_write_config_dword(sst_dev, PCI_INIT_ENABLE,
 				       tmp | PCI_EN_INIT_WR );
 		fbiinit0 = sst_read (FBIINIT0);
-		if (* (u32*)arg) {
+		if (val) {
 			sst_write(FBIINIT0, fbiinit0 & ~EN_VGA_PASSTHROUGH);
 			iprintk ( "Disabling VGA pass-through\n");
 		} else {
@@ -1010,28 +1017,29 @@ static int sstfb_ioctl(struct inode *ino
 		}
 		pci_write_config_dword(sst_dev, PCI_INIT_ENABLE, tmp);
 		return 0;
+
+	/* display test pattern */
 	case _IO('F', 0xde):		/* 0x46de */
 		f_dprintk("test color display\n");
 		f_ddprintk("currcon: %d, bpp %d\n", sst_info->currcon,
 			  sst_info->current_par.bpp);
 		memset_io(sst_info->video.vbase, 0, sst_info->video.len);
-	switch (sst_info->current_par.bpp) {
+		switch (sst_info->current_par.bpp) {
 	       	case 16:
 			sstfb_test16(sst_info);
 			break;
-#  ifdef EN_24_32_BPP
+#ifdef EN_24_32_BPP
 		case 24:
 		case 32:
 			sstfb_test32(sst_info);
 			break;
-#  endif
+#endif
 		default:
-			dprintk("bug line %d: bad depth '%u'\n", __LINE__,
-			        sst_info->current_par.bpp);
-			}
+			return -EFAULT;
+		}
 		return 0;
 	}
-#endif /* (SST_DEBUG_IOCTL >0) */
+	
 	return -EINVAL;
 #undef sst_info
 }
@@ -1494,7 +1502,7 @@ static int sstfb_set_par(const struct ss
 	pci_write_config_dword(sst_dev, PCI_INIT_ENABLE, PCI_EN_FIFO_WR);
 
 	/* set lfbmode : set mode + front buffer for reads/writes
-	   + disable pipeline + disable byte swapping */
+	   + disable pipeline  */
 	switch(par->bpp) {
 	case 16:
 		lfbmode = LFB_565;
@@ -1508,12 +1516,16 @@ static int sstfb_set_par(const struct ss
 		break;
 #endif
 	default:
-		dprintk("bug line %d: bad depth '%u'\n", __LINE__,
-			par->bpp );
+		BUG();
 		return 0;
-		break;
 	}
 
+#if defined(__BIG_ENDIAN)
+	/* enable byte-swizzle functionality in hardware */
+	lfbmode |= ( LFB_WORD_SWIZZLE_WR | LFB_BYTE_SWIZZLE_WR | 
+		     LFB_WORD_SWIZZLE_RD | LFB_BYTE_SWIZZLE_RD );
+#endif
+
 	if (clipping) {
 		sst_write(LFBMODE, lfbmode | EN_PXL_PIPELINE);
 	/*
@@ -1521,7 +1533,7 @@ static int sstfb_set_par(const struct ss
 	 * writes to offscreen areas of the framebuffer are performed,
 	 * the "behaviour is undefined" (_very_ undefined) - Urs
 	 */
-	/* btw, it requires enabling pixel pipeline in LFBMODE .
+	/* btw, it requires enabling pixel pipeline in LFBMODE.
 	   off screen read/writes will just wrap and read/print pixels
 	   on screen. Ugly but not that dangerous */
 
@@ -1536,7 +1548,7 @@ static int sstfb_set_par(const struct ss
 		sst_write(LFBMODE, lfbmode );
 	}
 
-	sst_info->current_par = *par ;
+	sst_info->current_par = *par;
 	return 1;
 }
 
@@ -1571,8 +1583,7 @@ static void sst_set_vidmod_att_ti(struct
 		break;
 #endif
 	default:
-		dprintk("bug line %d: bad depth '%u'\n", __LINE__, bpp);
-		break;
+		BUG();
 	}
 }
 
@@ -1590,8 +1601,7 @@ static void sst_set_vidmod_ics(struct ss
 		break;
 #endif
 	default:
-		dprintk("bug line %d: bad depth '%u'\n", __LINE__, bpp);
-		break;
+		BUG();
 	}
 }
 
@@ -1987,34 +1997,34 @@ static void sstfb_test16(struct sstfb_in
 	u_long fbbase_virt = sst_info->video.vbase;
 
 	f_dprintk("sstfb_test16\n");
-	/* rect blanc 20x100+200+0 */
+	/* white rectangle 20x100+200+0 */
 	for (i=0 ; i< 100; i++) {
 	  p = fbbase_virt + 2048 *i+400;
-	  for (j=0 ; j < 10 ; j++) {
-	    writel( 0xffffffff, p);
+	  for (j=0; j < 10; j++) {
+	    writel(0xffffffff, p);
 	    p+=4;
 	  }
 	}
-	/* rect bleu 180x200+0+0 */
+	/* blue rectangle 180x200+0+0 */
 	for (i=0 ; i< 200; i++) {
 	  p = fbbase_virt + 2048 *i;
-	  for (j=0 ; j < 90 ; j++) {
-	    writel(0x001f001f,p);
+	  for (j=0; j < 90; j++) {
+	    writel(0x001f001f, p);
 	    p+=4;
 	  }
 	}
-	/* carre vert 40x40+100+0 */
+	/* green rectangle 40x40+100+0 */
 	for (i=0 ; i< 40 ; i++) {
 	  p = fbbase_virt + 2048 *i + 200;
-	  for (j=0; j <20;j++) {
+	  for (j=0; j <20; j++) {
 	    writel(0x07e007e0, p);
 	    p+=4;
 	  }
 	}
-	/*carre rouge 40x40+100+40 */
+	/* red rectangle 40x40+100+40 */
 	for (i=0; i<40; i++) {
 	  p = fbbase_virt + 2048 * (i+40) + 200;
-	  for (j=0; j <20;j++) {
+	  for (j=0; j <20; j++) {
 	    writel( 0xf800f800, p);
 	    p+=4;
 	  }
@@ -2034,22 +2044,22 @@ static void sstfb_test32(struct sstfb_in
 	for (i=0 ; i< 100; i++) {
 	  p = fbbase_virt + 4096*i + 800;
 	  for (j=0 ; j < 20 ; j++) {
-	    writel( 0x00ffffff, p);
+	    writel(0x00ffffff, p);
 	    p+=4;
 	  }
 	}
 	/* rect bleu 180x200+0+0 */
 	for (i=0 ; i< 200; i++) {
 	  p = fbbase_virt + 4096 * i;
-	  for (j=0 ; j < 180 ; j++) {
-	    writel(0x000000ff,p);
+	  for (j=0 ; j < 180; j++) {
+	    writel(0x000000ff, p);
 	    p+=4;
 	  }
 	}
 	/* carre vert 40x40+100+0 */
 	for (i=0 ; i< 40 ; i++) {
 	  p = fbbase_virt + 4096 *i + 400;
-	  for (j=0; j <40;j++) {
+	  for (j=0; j <40; j++) {
 	    writel(0x0000ff00, p);
 	    p+=4;
 	  }
@@ -2057,8 +2067,8 @@ static void sstfb_test32(struct sstfb_in
 	/*carre rouge 40x40+100+10 */
 	for (i=0; i<40; i++) {
 	  p = fbbase_virt + 4096 * (i+40) + 400;
-	  for (j=0; j <40;j++) {
-	    writel( 0x00ff0000, p);
+	  for (j=0; j <40; j++) {
+	    writel(0x00ff0000, p);
 	    p+=4;
 	  }
 	}
Index: sstfb.h
===================================================================
RCS file: /var/cvs/linux/drivers/video/sstfb.h,v
retrieving revision 1.3
diff -u -p -r1.3 sstfb.h
--- sstfb.h	4 Aug 2002 22:59:15 -0000	1.3
+++ sstfb.h	14 Sep 2002 23:58:44 -0000
@@ -114,7 +114,11 @@
 #  define RD_BUFF_FRONT		  0		/* read buff select (front) */
 #  define RD_BUFF_BACK		  (1 << 6)	/* back */
 #  define EN_PXL_PIPELINE	  BIT(8)	/* pixel pipeline (clip..)*/
+#  define LFB_WORD_SWIZZLE_WR	  BIT(11)	/* enable write-wordswap (big-endian) */
+#  define LFB_BYTE_SWIZZLE_WR	  BIT(12)	/* enable write-byteswap (big-endian) */
 #  define LFB_INVERT_Y		  BIT(13)	/* invert Y origin (LFB) */
+#  define LFB_WORD_SWIZZLE_RD	  BIT(15)	/* enable read-wordswap (big-endian) */
+#  define LFB_BYTE_SWIZZLE_RD	  BIT(16)	/* enable read-byteswap (big-endian) */
 #define CLIP_LEFT_RIGHT		0x0118
 #define CLIP_LOWY_HIGHY		0x011c
 #define NOPCMD			0x0120

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

* [parisc-linux] Re: [PATCH] Voodoo framebuffer on PARISC
  2002-09-15  0:09 [parisc-linux] [PATCH] Voodoo framebuffer on PARISC Helge Deller
  2002-09-15  4:28 ` [parisc-linux] " B. Douglas Hilton
@ 2002-09-15  4:28 ` B. Douglas Hilton
  2002-09-15  8:31   ` Helge Deller
  2002-09-15  8:31   ` Helge Deller
  2002-09-15 22:13 ` [parisc-linux] " Tobias Giesen
  2 siblings, 2 replies; 11+ messages in thread
From: B. Douglas Hilton @ 2002-09-15  4:28 UTC (permalink / raw)
  To: Helge Deller; +Cc: debian-hppa, parisc-linux

Fantastic! I was tinkering with this but I stalled out. I had
to cart my C200 in to work to use as a prototype server machine
for a proof of concept on a new project, but I will be sure to
give it a whirl as it still has the V2 inside it.

This might really help the project as now all the FX guys
have an inexpensive option for graphics!

When building the kernel should I disable "console on STI fb"
option then? Did you add a "console on sstfb" option to config?

Can't wait to try it out!

Cheers!
- Doug



Helge Deller wrote:
> Hi,
> 
> there has been some discussions on this lists a few weeks back
> about getting the Voodoo framebuffer driver  working on HPPA.
> The attached patch allows me to use my Voodoo 2 with the sstfb
> framebuffer driver in 16bpp in 640x480, 800x600 and 1024x768
> resolutions on console and under X.
> 
> Greetings,
> Helge
> 
> NB: This patch is already integrated into the 2.4.19-pa18 kernel and
> I'll continue to do some more code-cleanups before trying to get it
> into the official kernel.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: sstfb.c
> ===================================================================
> RCS file: /var/cvs/linux/drivers/video/sstfb.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 sstfb.c
> --- sstfb.c	4 Aug 2002 22:59:15 -0000	1.4
> +++ sstfb.c	14 Sep 2002 23:58:43 -0000
> @@ -107,6 +107,7 @@
>  
>  #include <asm/io.h>
>  #include <asm/ioctl.h>
> +#include <asm/uaccess.h>
>  
>  #include <video/fbcon.h>
>  #include <video/fbcon-cfb16.h>
> @@ -332,7 +333,7 @@ static void sst_dbg_print_var(struct fb_
>  
>  #if (SST_DEBUG_REG > 0)
>  static void sst_dbg_print_read_reg (u32 reg, u32 val) {
> -	char * regname =NULL;
> +	char * regname = NULL;
>  	switch (reg) {
>  	case FBIINIT0: regname="FbiInit0"; break;
>  	case FBIINIT1: regname="FbiInit1"; break;
> @@ -366,8 +367,8 @@ static void sst_dbg_print_write_reg (u32
>  		r_dprintk(" sst_write(%s, %#x)\n", regname, val);
>  }
>  #else /*  (SST_DEBUG_REG > 0) */
> -#  define sst_dbg_print_read_reg(reg, val)	do {}while(0)
> -#  define sst_dbg_print_write_reg(reg, val)	do {}while(0)
> +#  define sst_dbg_print_read_reg(reg, val)	do {} while(0)
> +#  define sst_dbg_print_write_reg(reg, val)	do {} while(0)
>  #endif /*  (SST_DEBUG_REG > 0) */
>  
>  /* register access */
> @@ -530,20 +531,15 @@ static int sstfb_setcolreg(u_int regno, 
>  		break;
>  #endif
>  #ifdef EN_24_32_BPP
> -#ifdef FBCON_HAS_CFB24
> +#if defined(FBCON_HAS_CFB24) || defined(FBCON_HAS_CFB32)
>  	case 24:
> -		sst_info->fbcon_cmap.cfb32[regno]=col;
> -		break;
> -#endif
> -#ifdef FBCON_HAS_CFB32
>  	case 32:
>  		sst_info->fbcon_cmap.cfb32[regno]=col;
>  		break;
>  #endif
>  #endif
>  	default:
> -		eprintk("bug line %d: bad depth '%u'\n",__LINE__,
> -			disp->var.bits_per_pixel);
> +		BUG();
>  		break;
>  	}
>  	f_dddprintk("bpp: %d . encoded color: %#x\n",
> @@ -735,6 +731,7 @@ static int sstfb_encode_var (struct fb_v
>  #ifdef EN_24_32_BPP
>  	case 24:	/* RGB 888 LfbMode 4 */
>  	case 32:	/* ARGB 8888 LfbMode 5 */
> +	       	/* in 24bpp we fake a 32 bpp mode */
>  		var->red.length    = 8;
>  		var->green.length  = 8;
>  		var->blue.length   = 8;
> @@ -743,11 +740,11 @@ static int sstfb_encode_var (struct fb_v
>  		var->red.offset    = 16;
>  		var->green.offset  = 8;
>  		var->blue.offset   = 0;
> -		var->transp.offset = 0; /* in 24bpp we fake a 32 bpp mode */
> +		var->transp.offset = 0;
>  		break;
>  #endif
>  	default:
> -		eprintk ("bug line %d: bad depth '%u'\n", __LINE__, par->bpp);
> +		eprintk("bug line %d: bad depth '%u'\n", __LINE__, par->bpp);
>  		break;
>  	}
>  	return 0;
> @@ -775,11 +772,15 @@ static int sstfb_get_fix(struct fb_fix_s
>  #define sst_info	((struct sstfb_info *) info)
>  
>  	struct fb_var_screeninfo *var;
> +	struct fb_var_screeninfo var2;
>  
>  	f_dprintk("sstfb_get_fix(con: %d)\n",con);
> -	if (con == -1)
> -		sstfb_encode_var(var, &sst_info->current_par, sst_info);
> -	else
> +	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
> +	
> +	if (con == -1) {
> +		sstfb_encode_var(&var2, &sst_info->current_par, sst_info);
> +		var = &var2;
> +	} else
>  		var = &fb_display[con].var;
>  
>  	strcpy(fix->id, sst_info->info.modename);
> @@ -789,6 +790,7 @@ static int sstfb_get_fix(struct fb_fix_s
>  
>  	fix->type        = FB_TYPE_PACKED_PIXELS;
>  	fix->visual      = FB_VISUAL_TRUECOLOR;
> +	fix->accel       = FB_ACCEL_NONE;
>  	/*
>  	 *   According to the specs, the linelength must be of 1024 *pixels*.
>  	 * and the 24bpp mode is in fact a 32 bpp mode.
> @@ -966,42 +968,47 @@ static int sstfb_ioctl(struct inode *ino
>                         struct fb_info *info)
>  {
>  #define sst_info	((struct sstfb_info *) info)
> -#if (SST_DEBUG_IOCTL >0)
>  	int i;
>  	u_long p;
> -	u32 tmp;
> +	u32 tmp, val;
>  	u32 fbiinit0;
>  	struct pci_dev * sst_dev = sst_info->dev;
> -#endif
>  
>  	f_dprintk("sstfb_ioctl(%x)\n", cmd);
> -#if (SST_DEBUG_IOCTL >0)
> +	
>  	switch (cmd) {
> -#  if (SST_DEBUG_VAR >0)
> -/* tmp ioctl : dumps fb_display[0-5] */
> +		
> +#if (SST_DEBUG_VAR >0)
> +	/* tmp ioctl : dumps fb_display[0-5] */
>  	case _IO('F', 0xdb):		/* 0x46db */
>  		f_dprintk("dumping fb_display[0-5].var\n");
>  		for (i = 0 ; i< 6 ; i++) {
>  			print_var(&fb_display[i].var, "var(%d)", i);
>  		}
>  		return 0;
> -#  endif /* (SST_DEBUG_VAR >0) */
> -/* fills the lfb up to *(u32*)arg */
> +#endif /* (SST_DEBUG_VAR >0) */
> +
> +	/* fills the lfb up to given count of pixels */
>  	case _IOW('F', 0xdc, u32):	/* 0x46dc */
> -		if (*(u32*)arg > 0x400000 )
> -			*(u32*) arg = 0x400000;
> -		f_dprintk("filling %#x \n", *(u32*)arg);
> -		for (p = 0 ; p < *(u32*)arg; p+=2)
> +		if (copy_from_user(&val, (void *) arg, sizeof(val)))
> +			return -EFAULT;
> +		if (val > 0x400000 )
> +			val = 0x400000;
> +		f_dprintk("filling %#x \n", val);
> +		for (p = 0 ; p < val; p+=2)
>  			writew( p >> 6 , sst_info->video.vbase + p);
>  		return 0;
> -/* change VGA pass_through */
> +		
> +	/* enable/disable VGA pass_through */
>  	case _IOW('F', 0xdd, u32):	/* 0x46dd */
> +		if (copy_from_user(&val, (void *) arg, sizeof(val)))
> +			return -EFAULT;
>  		f_dprintk("switch VGA pass-through\n");
>  		pci_read_config_dword(sst_dev, PCI_INIT_ENABLE, &tmp);
>  		pci_write_config_dword(sst_dev, PCI_INIT_ENABLE,
>  				       tmp | PCI_EN_INIT_WR );
>  		fbiinit0 = sst_read (FBIINIT0);
> -		if (* (u32*)arg) {
> +		if (val) {
>  			sst_write(FBIINIT0, fbiinit0 & ~EN_VGA_PASSTHROUGH);
>  			iprintk ( "Disabling VGA pass-through\n");
>  		} else {
> @@ -1010,28 +1017,29 @@ static int sstfb_ioctl(struct inode *ino
>  		}
>  		pci_write_config_dword(sst_dev, PCI_INIT_ENABLE, tmp);
>  		return 0;
> +
> +	/* display test pattern */
>  	case _IO('F', 0xde):		/* 0x46de */
>  		f_dprintk("test color display\n");
>  		f_ddprintk("currcon: %d, bpp %d\n", sst_info->currcon,
>  			  sst_info->current_par.bpp);
>  		memset_io(sst_info->video.vbase, 0, sst_info->video.len);
> -	switch (sst_info->current_par.bpp) {
> +		switch (sst_info->current_par.bpp) {
>  	       	case 16:
>  			sstfb_test16(sst_info);
>  			break;
> -#  ifdef EN_24_32_BPP
> +#ifdef EN_24_32_BPP
>  		case 24:
>  		case 32:
>  			sstfb_test32(sst_info);
>  			break;
> -#  endif
> +#endif
>  		default:
> -			dprintk("bug line %d: bad depth '%u'\n", __LINE__,
> -			        sst_info->current_par.bpp);
> -			}
> +			return -EFAULT;
> +		}
>  		return 0;
>  	}
> -#endif /* (SST_DEBUG_IOCTL >0) */
> +	
>  	return -EINVAL;
>  #undef sst_info
>  }
> @@ -1494,7 +1502,7 @@ static int sstfb_set_par(const struct ss
>  	pci_write_config_dword(sst_dev, PCI_INIT_ENABLE, PCI_EN_FIFO_WR);
>  
>  	/* set lfbmode : set mode + front buffer for reads/writes
> -	   + disable pipeline + disable byte swapping */
> +	   + disable pipeline  */
>  	switch(par->bpp) {
>  	case 16:
>  		lfbmode = LFB_565;
> @@ -1508,12 +1516,16 @@ static int sstfb_set_par(const struct ss
>  		break;
>  #endif
>  	default:
> -		dprintk("bug line %d: bad depth '%u'\n", __LINE__,
> -			par->bpp );
> +		BUG();
>  		return 0;
> -		break;
>  	}
>  
> +#if defined(__BIG_ENDIAN)
> +	/* enable byte-swizzle functionality in hardware */
> +	lfbmode |= ( LFB_WORD_SWIZZLE_WR | LFB_BYTE_SWIZZLE_WR | 
> +		     LFB_WORD_SWIZZLE_RD | LFB_BYTE_SWIZZLE_RD );
> +#endif
> +
>  	if (clipping) {
>  		sst_write(LFBMODE, lfbmode | EN_PXL_PIPELINE);
>  	/*
> @@ -1521,7 +1533,7 @@ static int sstfb_set_par(const struct ss
>  	 * writes to offscreen areas of the framebuffer are performed,
>  	 * the "behaviour is undefined" (_very_ undefined) - Urs
>  	 */
> -	/* btw, it requires enabling pixel pipeline in LFBMODE .
> +	/* btw, it requires enabling pixel pipeline in LFBMODE.
>  	   off screen read/writes will just wrap and read/print pixels
>  	   on screen. Ugly but not that dangerous */
>  
> @@ -1536,7 +1548,7 @@ static int sstfb_set_par(const struct ss
>  		sst_write(LFBMODE, lfbmode );
>  	}
>  
> -	sst_info->current_par = *par ;
> +	sst_info->current_par = *par;
>  	return 1;
>  }
>  
> @@ -1571,8 +1583,7 @@ static void sst_set_vidmod_att_ti(struct
>  		break;
>  #endif
>  	default:
> -		dprintk("bug line %d: bad depth '%u'\n", __LINE__, bpp);
> -		break;
> +		BUG();
>  	}
>  }
>  
> @@ -1590,8 +1601,7 @@ static void sst_set_vidmod_ics(struct ss
>  		break;
>  #endif
>  	default:
> -		dprintk("bug line %d: bad depth '%u'\n", __LINE__, bpp);
> -		break;
> +		BUG();
>  	}
>  }
>  
> @@ -1987,34 +1997,34 @@ static void sstfb_test16(struct sstfb_in
>  	u_long fbbase_virt = sst_info->video.vbase;
>  
>  	f_dprintk("sstfb_test16\n");
> -	/* rect blanc 20x100+200+0 */
> +	/* white rectangle 20x100+200+0 */
>  	for (i=0 ; i< 100; i++) {
>  	  p = fbbase_virt + 2048 *i+400;
> -	  for (j=0 ; j < 10 ; j++) {
> -	    writel( 0xffffffff, p);
> +	  for (j=0; j < 10; j++) {
> +	    writel(0xffffffff, p);
>  	    p+=4;
>  	  }
>  	}
> -	/* rect bleu 180x200+0+0 */
> +	/* blue rectangle 180x200+0+0 */
>  	for (i=0 ; i< 200; i++) {
>  	  p = fbbase_virt + 2048 *i;
> -	  for (j=0 ; j < 90 ; j++) {
> -	    writel(0x001f001f,p);
> +	  for (j=0; j < 90; j++) {
> +	    writel(0x001f001f, p);
>  	    p+=4;
>  	  }
>  	}
> -	/* carre vert 40x40+100+0 */
> +	/* green rectangle 40x40+100+0 */
>  	for (i=0 ; i< 40 ; i++) {
>  	  p = fbbase_virt + 2048 *i + 200;
> -	  for (j=0; j <20;j++) {
> +	  for (j=0; j <20; j++) {
>  	    writel(0x07e007e0, p);
>  	    p+=4;
>  	  }
>  	}
> -	/*carre rouge 40x40+100+40 */
> +	/* red rectangle 40x40+100+40 */
>  	for (i=0; i<40; i++) {
>  	  p = fbbase_virt + 2048 * (i+40) + 200;
> -	  for (j=0; j <20;j++) {
> +	  for (j=0; j <20; j++) {
>  	    writel( 0xf800f800, p);
>  	    p+=4;
>  	  }
> @@ -2034,22 +2044,22 @@ static void sstfb_test32(struct sstfb_in
>  	for (i=0 ; i< 100; i++) {
>  	  p = fbbase_virt + 4096*i + 800;
>  	  for (j=0 ; j < 20 ; j++) {
> -	    writel( 0x00ffffff, p);
> +	    writel(0x00ffffff, p);
>  	    p+=4;
>  	  }
>  	}
>  	/* rect bleu 180x200+0+0 */
>  	for (i=0 ; i< 200; i++) {
>  	  p = fbbase_virt + 4096 * i;
> -	  for (j=0 ; j < 180 ; j++) {
> -	    writel(0x000000ff,p);
> +	  for (j=0 ; j < 180; j++) {
> +	    writel(0x000000ff, p);
>  	    p+=4;
>  	  }
>  	}
>  	/* carre vert 40x40+100+0 */
>  	for (i=0 ; i< 40 ; i++) {
>  	  p = fbbase_virt + 4096 *i + 400;
> -	  for (j=0; j <40;j++) {
> +	  for (j=0; j <40; j++) {
>  	    writel(0x0000ff00, p);
>  	    p+=4;
>  	  }
> @@ -2057,8 +2067,8 @@ static void sstfb_test32(struct sstfb_in
>  	/*carre rouge 40x40+100+10 */
>  	for (i=0; i<40; i++) {
>  	  p = fbbase_virt + 4096 * (i+40) + 400;
> -	  for (j=0; j <40;j++) {
> -	    writel( 0x00ff0000, p);
> +	  for (j=0; j <40; j++) {
> +	    writel(0x00ff0000, p);
>  	    p+=4;
>  	  }
>  	}
> Index: sstfb.h
> ===================================================================
> RCS file: /var/cvs/linux/drivers/video/sstfb.h,v
> retrieving revision 1.3
> diff -u -p -r1.3 sstfb.h
> --- sstfb.h	4 Aug 2002 22:59:15 -0000	1.3
> +++ sstfb.h	14 Sep 2002 23:58:44 -0000
> @@ -114,7 +114,11 @@
>  #  define RD_BUFF_FRONT		  0		/* read buff select (front) */
>  #  define RD_BUFF_BACK		  (1 << 6)	/* back */
>  #  define EN_PXL_PIPELINE	  BIT(8)	/* pixel pipeline (clip..)*/
> +#  define LFB_WORD_SWIZZLE_WR	  BIT(11)	/* enable write-wordswap (big-endian) */
> +#  define LFB_BYTE_SWIZZLE_WR	  BIT(12)	/* enable write-byteswap (big-endian) */
>  #  define LFB_INVERT_Y		  BIT(13)	/* invert Y origin (LFB) */
> +#  define LFB_WORD_SWIZZLE_RD	  BIT(15)	/* enable read-wordswap (big-endian) */
> +#  define LFB_BYTE_SWIZZLE_RD	  BIT(16)	/* enable read-byteswap (big-endian) */
>  #define CLIP_LEFT_RIGHT		0x0118
>  #define CLIP_LOWY_HIGHY		0x011c
>  #define NOPCMD			0x0120

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

* [parisc-linux] Re: [PATCH] Voodoo framebuffer on PARISC
  2002-09-15  0:09 [parisc-linux] [PATCH] Voodoo framebuffer on PARISC Helge Deller
@ 2002-09-15  4:28 ` B. Douglas Hilton
  2002-09-15  4:28 ` B. Douglas Hilton
  2002-09-15 22:13 ` [parisc-linux] " Tobias Giesen
  2 siblings, 0 replies; 11+ messages in thread
From: B. Douglas Hilton @ 2002-09-15  4:28 UTC (permalink / raw)
  To: Helge Deller; +Cc: debian-hppa, parisc-linux

Fantastic! I was tinkering with this but I stalled out. I had
to cart my C200 in to work to use as a prototype server machine
for a proof of concept on a new project, but I will be sure to
give it a whirl as it still has the V2 inside it.

This might really help the project as now all the FX guys
have an inexpensive option for graphics!

When building the kernel should I disable "console on STI fb"
option then? Did you add a "console on sstfb" option to config?

Can't wait to try it out!

Cheers!
- Doug



Helge Deller wrote:
> Hi,
> 
> there has been some discussions on this lists a few weeks back
> about getting the Voodoo framebuffer driver  working on HPPA.
> The attached patch allows me to use my Voodoo 2 with the sstfb
> framebuffer driver in 16bpp in 640x480, 800x600 and 1024x768
> resolutions on console and under X.
> 
> Greetings,
> Helge
> 
> NB: This patch is already integrated into the 2.4.19-pa18 kernel and
> I'll continue to do some more code-cleanups before trying to get it
> into the official kernel.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: sstfb.c
> ===================================================================
> RCS file: /var/cvs/linux/drivers/video/sstfb.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 sstfb.c
> --- sstfb.c	4 Aug 2002 22:59:15 -0000	1.4
> +++ sstfb.c	14 Sep 2002 23:58:43 -0000
> @@ -107,6 +107,7 @@
>  
>  #include <asm/io.h>
>  #include <asm/ioctl.h>
> +#include <asm/uaccess.h>
>  
>  #include <video/fbcon.h>
>  #include <video/fbcon-cfb16.h>
> @@ -332,7 +333,7 @@ static void sst_dbg_print_var(struct fb_
>  
>  #if (SST_DEBUG_REG > 0)
>  static void sst_dbg_print_read_reg (u32 reg, u32 val) {
> -	char * regname =NULL;
> +	char * regname = NULL;
>  	switch (reg) {
>  	case FBIINIT0: regname="FbiInit0"; break;
>  	case FBIINIT1: regname="FbiInit1"; break;
> @@ -366,8 +367,8 @@ static void sst_dbg_print_write_reg (u32
>  		r_dprintk(" sst_write(%s, %#x)\n", regname, val);
>  }
>  #else /*  (SST_DEBUG_REG > 0) */
> -#  define sst_dbg_print_read_reg(reg, val)	do {}while(0)
> -#  define sst_dbg_print_write_reg(reg, val)	do {}while(0)
> +#  define sst_dbg_print_read_reg(reg, val)	do {} while(0)
> +#  define sst_dbg_print_write_reg(reg, val)	do {} while(0)
>  #endif /*  (SST_DEBUG_REG > 0) */
>  
>  /* register access */
> @@ -530,20 +531,15 @@ static int sstfb_setcolreg(u_int regno, 
>  		break;
>  #endif
>  #ifdef EN_24_32_BPP
> -#ifdef FBCON_HAS_CFB24
> +#if defined(FBCON_HAS_CFB24) || defined(FBCON_HAS_CFB32)
>  	case 24:
> -		sst_info->fbcon_cmap.cfb32[regno]=col;
> -		break;
> -#endif
> -#ifdef FBCON_HAS_CFB32
>  	case 32:
>  		sst_info->fbcon_cmap.cfb32[regno]=col;
>  		break;
>  #endif
>  #endif
>  	default:
> -		eprintk("bug line %d: bad depth '%u'\n",__LINE__,
> -			disp->var.bits_per_pixel);
> +		BUG();
>  		break;
>  	}
>  	f_dddprintk("bpp: %d . encoded color: %#x\n",
> @@ -735,6 +731,7 @@ static int sstfb_encode_var (struct fb_v
>  #ifdef EN_24_32_BPP
>  	case 24:	/* RGB 888 LfbMode 4 */
>  	case 32:	/* ARGB 8888 LfbMode 5 */
> +	       	/* in 24bpp we fake a 32 bpp mode */
>  		var->red.length    = 8;
>  		var->green.length  = 8;
>  		var->blue.length   = 8;
> @@ -743,11 +740,11 @@ static int sstfb_encode_var (struct fb_v
>  		var->red.offset    = 16;
>  		var->green.offset  = 8;
>  		var->blue.offset   = 0;
> -		var->transp.offset = 0; /* in 24bpp we fake a 32 bpp mode */
> +		var->transp.offset = 0;
>  		break;
>  #endif
>  	default:
> -		eprintk ("bug line %d: bad depth '%u'\n", __LINE__, par->bpp);
> +		eprintk("bug line %d: bad depth '%u'\n", __LINE__, par->bpp);
>  		break;
>  	}
>  	return 0;
> @@ -775,11 +772,15 @@ static int sstfb_get_fix(struct fb_fix_s
>  #define sst_info	((struct sstfb_info *) info)
>  
>  	struct fb_var_screeninfo *var;
> +	struct fb_var_screeninfo var2;
>  
>  	f_dprintk("sstfb_get_fix(con: %d)\n",con);
> -	if (con == -1)
> -		sstfb_encode_var(var, &sst_info->current_par, sst_info);
> -	else
> +	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
> +	
> +	if (con == -1) {
> +		sstfb_encode_var(&var2, &sst_info->current_par, sst_info);
> +		var = &var2;
> +	} else
>  		var = &fb_display[con].var;
>  
>  	strcpy(fix->id, sst_info->info.modename);
> @@ -789,6 +790,7 @@ static int sstfb_get_fix(struct fb_fix_s
>  
>  	fix->type        = FB_TYPE_PACKED_PIXELS;
>  	fix->visual      = FB_VISUAL_TRUECOLOR;
> +	fix->accel       = FB_ACCEL_NONE;
>  	/*
>  	 *   According to the specs, the linelength must be of 1024 *pixels*.
>  	 * and the 24bpp mode is in fact a 32 bpp mode.
> @@ -966,42 +968,47 @@ static int sstfb_ioctl(struct inode *ino
>                         struct fb_info *info)
>  {
>  #define sst_info	((struct sstfb_info *) info)
> -#if (SST_DEBUG_IOCTL >0)
>  	int i;
>  	u_long p;
> -	u32 tmp;
> +	u32 tmp, val;
>  	u32 fbiinit0;
>  	struct pci_dev * sst_dev = sst_info->dev;
> -#endif
>  
>  	f_dprintk("sstfb_ioctl(%x)\n", cmd);
> -#if (SST_DEBUG_IOCTL >0)
> +	
>  	switch (cmd) {
> -#  if (SST_DEBUG_VAR >0)
> -/* tmp ioctl : dumps fb_display[0-5] */
> +		
> +#if (SST_DEBUG_VAR >0)
> +	/* tmp ioctl : dumps fb_display[0-5] */
>  	case _IO('F', 0xdb):		/* 0x46db */
>  		f_dprintk("dumping fb_display[0-5].var\n");
>  		for (i = 0 ; i< 6 ; i++) {
>  			print_var(&fb_display[i].var, "var(%d)", i);
>  		}
>  		return 0;
> -#  endif /* (SST_DEBUG_VAR >0) */
> -/* fills the lfb up to *(u32*)arg */
> +#endif /* (SST_DEBUG_VAR >0) */
> +
> +	/* fills the lfb up to given count of pixels */
>  	case _IOW('F', 0xdc, u32):	/* 0x46dc */
> -		if (*(u32*)arg > 0x400000 )
> -			*(u32*) arg = 0x400000;
> -		f_dprintk("filling %#x \n", *(u32*)arg);
> -		for (p = 0 ; p < *(u32*)arg; p+=2)
> +		if (copy_from_user(&val, (void *) arg, sizeof(val)))
> +			return -EFAULT;
> +		if (val > 0x400000 )
> +			val = 0x400000;
> +		f_dprintk("filling %#x \n", val);
> +		for (p = 0 ; p < val; p+=2)
>  			writew( p >> 6 , sst_info->video.vbase + p);
>  		return 0;
> -/* change VGA pass_through */
> +		
> +	/* enable/disable VGA pass_through */
>  	case _IOW('F', 0xdd, u32):	/* 0x46dd */
> +		if (copy_from_user(&val, (void *) arg, sizeof(val)))
> +			return -EFAULT;
>  		f_dprintk("switch VGA pass-through\n");
>  		pci_read_config_dword(sst_dev, PCI_INIT_ENABLE, &tmp);
>  		pci_write_config_dword(sst_dev, PCI_INIT_ENABLE,
>  				       tmp | PCI_EN_INIT_WR );
>  		fbiinit0 = sst_read (FBIINIT0);
> -		if (* (u32*)arg) {
> +		if (val) {
>  			sst_write(FBIINIT0, fbiinit0 & ~EN_VGA_PASSTHROUGH);
>  			iprintk ( "Disabling VGA pass-through\n");
>  		} else {
> @@ -1010,28 +1017,29 @@ static int sstfb_ioctl(struct inode *ino
>  		}
>  		pci_write_config_dword(sst_dev, PCI_INIT_ENABLE, tmp);
>  		return 0;
> +
> +	/* display test pattern */
>  	case _IO('F', 0xde):		/* 0x46de */
>  		f_dprintk("test color display\n");
>  		f_ddprintk("currcon: %d, bpp %d\n", sst_info->currcon,
>  			  sst_info->current_par.bpp);
>  		memset_io(sst_info->video.vbase, 0, sst_info->video.len);
> -	switch (sst_info->current_par.bpp) {
> +		switch (sst_info->current_par.bpp) {
>  	       	case 16:
>  			sstfb_test16(sst_info);
>  			break;
> -#  ifdef EN_24_32_BPP
> +#ifdef EN_24_32_BPP
>  		case 24:
>  		case 32:
>  			sstfb_test32(sst_info);
>  			break;
> -#  endif
> +#endif
>  		default:
> -			dprintk("bug line %d: bad depth '%u'\n", __LINE__,
> -			        sst_info->current_par.bpp);
> -			}
> +			return -EFAULT;
> +		}
>  		return 0;
>  	}
> -#endif /* (SST_DEBUG_IOCTL >0) */
> +	
>  	return -EINVAL;
>  #undef sst_info
>  }
> @@ -1494,7 +1502,7 @@ static int sstfb_set_par(const struct ss
>  	pci_write_config_dword(sst_dev, PCI_INIT_ENABLE, PCI_EN_FIFO_WR);
>  
>  	/* set lfbmode : set mode + front buffer for reads/writes
> -	   + disable pipeline + disable byte swapping */
> +	   + disable pipeline  */
>  	switch(par->bpp) {
>  	case 16:
>  		lfbmode = LFB_565;
> @@ -1508,12 +1516,16 @@ static int sstfb_set_par(const struct ss
>  		break;
>  #endif
>  	default:
> -		dprintk("bug line %d: bad depth '%u'\n", __LINE__,
> -			par->bpp );
> +		BUG();
>  		return 0;
> -		break;
>  	}
>  
> +#if defined(__BIG_ENDIAN)
> +	/* enable byte-swizzle functionality in hardware */
> +	lfbmode |= ( LFB_WORD_SWIZZLE_WR | LFB_BYTE_SWIZZLE_WR | 
> +		     LFB_WORD_SWIZZLE_RD | LFB_BYTE_SWIZZLE_RD );
> +#endif
> +
>  	if (clipping) {
>  		sst_write(LFBMODE, lfbmode | EN_PXL_PIPELINE);
>  	/*
> @@ -1521,7 +1533,7 @@ static int sstfb_set_par(const struct ss
>  	 * writes to offscreen areas of the framebuffer are performed,
>  	 * the "behaviour is undefined" (_very_ undefined) - Urs
>  	 */
> -	/* btw, it requires enabling pixel pipeline in LFBMODE .
> +	/* btw, it requires enabling pixel pipeline in LFBMODE.
>  	   off screen read/writes will just wrap and read/print pixels
>  	   on screen. Ugly but not that dangerous */
>  
> @@ -1536,7 +1548,7 @@ static int sstfb_set_par(const struct ss
>  		sst_write(LFBMODE, lfbmode );
>  	}
>  
> -	sst_info->current_par = *par ;
> +	sst_info->current_par = *par;
>  	return 1;
>  }
>  
> @@ -1571,8 +1583,7 @@ static void sst_set_vidmod_att_ti(struct
>  		break;
>  #endif
>  	default:
> -		dprintk("bug line %d: bad depth '%u'\n", __LINE__, bpp);
> -		break;
> +		BUG();
>  	}
>  }
>  
> @@ -1590,8 +1601,7 @@ static void sst_set_vidmod_ics(struct ss
>  		break;
>  #endif
>  	default:
> -		dprintk("bug line %d: bad depth '%u'\n", __LINE__, bpp);
> -		break;
> +		BUG();
>  	}
>  }
>  
> @@ -1987,34 +1997,34 @@ static void sstfb_test16(struct sstfb_in
>  	u_long fbbase_virt = sst_info->video.vbase;
>  
>  	f_dprintk("sstfb_test16\n");
> -	/* rect blanc 20x100+200+0 */
> +	/* white rectangle 20x100+200+0 */
>  	for (i=0 ; i< 100; i++) {
>  	  p = fbbase_virt + 2048 *i+400;
> -	  for (j=0 ; j < 10 ; j++) {
> -	    writel( 0xffffffff, p);
> +	  for (j=0; j < 10; j++) {
> +	    writel(0xffffffff, p);
>  	    p+=4;
>  	  }
>  	}
> -	/* rect bleu 180x200+0+0 */
> +	/* blue rectangle 180x200+0+0 */
>  	for (i=0 ; i< 200; i++) {
>  	  p = fbbase_virt + 2048 *i;
> -	  for (j=0 ; j < 90 ; j++) {
> -	    writel(0x001f001f,p);
> +	  for (j=0; j < 90; j++) {
> +	    writel(0x001f001f, p);
>  	    p+=4;
>  	  }
>  	}
> -	/* carre vert 40x40+100+0 */
> +	/* green rectangle 40x40+100+0 */
>  	for (i=0 ; i< 40 ; i++) {
>  	  p = fbbase_virt + 2048 *i + 200;
> -	  for (j=0; j <20;j++) {
> +	  for (j=0; j <20; j++) {
>  	    writel(0x07e007e0, p);
>  	    p+=4;
>  	  }
>  	}
> -	/*carre rouge 40x40+100+40 */
> +	/* red rectangle 40x40+100+40 */
>  	for (i=0; i<40; i++) {
>  	  p = fbbase_virt + 2048 * (i+40) + 200;
> -	  for (j=0; j <20;j++) {
> +	  for (j=0; j <20; j++) {
>  	    writel( 0xf800f800, p);
>  	    p+=4;
>  	  }
> @@ -2034,22 +2044,22 @@ static void sstfb_test32(struct sstfb_in
>  	for (i=0 ; i< 100; i++) {
>  	  p = fbbase_virt + 4096*i + 800;
>  	  for (j=0 ; j < 20 ; j++) {
> -	    writel( 0x00ffffff, p);
> +	    writel(0x00ffffff, p);
>  	    p+=4;
>  	  }
>  	}
>  	/* rect bleu 180x200+0+0 */
>  	for (i=0 ; i< 200; i++) {
>  	  p = fbbase_virt + 4096 * i;
> -	  for (j=0 ; j < 180 ; j++) {
> -	    writel(0x000000ff,p);
> +	  for (j=0 ; j < 180; j++) {
> +	    writel(0x000000ff, p);
>  	    p+=4;
>  	  }
>  	}
>  	/* carre vert 40x40+100+0 */
>  	for (i=0 ; i< 40 ; i++) {
>  	  p = fbbase_virt + 4096 *i + 400;
> -	  for (j=0; j <40;j++) {
> +	  for (j=0; j <40; j++) {
>  	    writel(0x0000ff00, p);
>  	    p+=4;
>  	  }
> @@ -2057,8 +2067,8 @@ static void sstfb_test32(struct sstfb_in
>  	/*carre rouge 40x40+100+10 */
>  	for (i=0; i<40; i++) {
>  	  p = fbbase_virt + 4096 * (i+40) + 400;
> -	  for (j=0; j <40;j++) {
> -	    writel( 0x00ff0000, p);
> +	  for (j=0; j <40; j++) {
> +	    writel(0x00ff0000, p);
>  	    p+=4;
>  	  }
>  	}
> Index: sstfb.h
> ===================================================================
> RCS file: /var/cvs/linux/drivers/video/sstfb.h,v
> retrieving revision 1.3
> diff -u -p -r1.3 sstfb.h
> --- sstfb.h	4 Aug 2002 22:59:15 -0000	1.3
> +++ sstfb.h	14 Sep 2002 23:58:44 -0000
> @@ -114,7 +114,11 @@
>  #  define RD_BUFF_FRONT		  0		/* read buff select (front) */
>  #  define RD_BUFF_BACK		  (1 << 6)	/* back */
>  #  define EN_PXL_PIPELINE	  BIT(8)	/* pixel pipeline (clip..)*/
> +#  define LFB_WORD_SWIZZLE_WR	  BIT(11)	/* enable write-wordswap (big-endian) */
> +#  define LFB_BYTE_SWIZZLE_WR	  BIT(12)	/* enable write-byteswap (big-endian) */
>  #  define LFB_INVERT_Y		  BIT(13)	/* invert Y origin (LFB) */
> +#  define LFB_WORD_SWIZZLE_RD	  BIT(15)	/* enable read-wordswap (big-endian) */
> +#  define LFB_BYTE_SWIZZLE_RD	  BIT(16)	/* enable read-byteswap (big-endian) */
>  #define CLIP_LEFT_RIGHT		0x0118
>  #define CLIP_LOWY_HIGHY		0x011c
>  #define NOPCMD			0x0120

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

* [parisc-linux] Re: [PATCH] Voodoo framebuffer on PARISC
  2002-09-15  4:28 ` B. Douglas Hilton
@ 2002-09-15  8:31   ` Helge Deller
  2002-09-16  0:17     ` Tobias Giesen
  2002-09-15  8:31   ` Helge Deller
  1 sibling, 1 reply; 11+ messages in thread
From: Helge Deller @ 2002-09-15  8:31 UTC (permalink / raw)
  To: B. Douglas Hilton; +Cc: debian-hppa, parisc-linux

Hi Douglas,

it's safe to enable both (stifb and sstfb), in which case one of
them is /dev/fb0 (presumably the sstfb) and the other /dev/fb1 (stifb).
If you hook them up to different monitors you can use both graphic
cards at the same time. If you connect them in chain, only the
sstfb will be visible.

Greetings,
Helge

On Sunday 15 September 2002 06:28, B. Douglas Hilton wrote:
> Fantastic! I was tinkering with this but I stalled out. I had
> to cart my C200 in to work to use as a prototype server machine
> for a proof of concept on a new project, but I will be sure to
> give it a whirl as it still has the V2 inside it.
>
> This might really help the project as now all the FX guys
> have an inexpensive option for graphics!
>
> When building the kernel should I disable "console on STI fb"
> option then? Did you add a "console on sstfb" option to config?
>
> Can't wait to try it out!
>
> Cheers!
> - Doug
>
> Helge Deller wrote:
> > Hi,
> >
> > there has been some discussions on this lists a few weeks back
> > about getting the Voodoo framebuffer driver  working on HPPA.
> > The attached patch allows me to use my Voodoo 2 with the sstfb
> > framebuffer driver in 16bpp in 640x480, 800x600 and 1024x768
> > resolutions on console and under X.
> >
> > Greetings,
> > Helge
> >
> > NB: This patch is already integrated into the 2.4.19-pa18 kernel and
> > I'll continue to do some more code-cleanups before trying to get it
> > into the official kernel.
> >
> > ...patch removed...

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

* [parisc-linux] Re: [PATCH] Voodoo framebuffer on PARISC
  2002-09-15  4:28 ` B. Douglas Hilton
  2002-09-15  8:31   ` Helge Deller
@ 2002-09-15  8:31   ` Helge Deller
  1 sibling, 0 replies; 11+ messages in thread
From: Helge Deller @ 2002-09-15  8:31 UTC (permalink / raw)
  To: B. Douglas Hilton; +Cc: debian-hppa, parisc-linux

Hi Douglas,

it's safe to enable both (stifb and sstfb), in which case one of
them is /dev/fb0 (presumably the sstfb) and the other /dev/fb1 (stifb).
If you hook them up to different monitors you can use both graphic
cards at the same time. If you connect them in chain, only the
sstfb will be visible.

Greetings,
Helge

On Sunday 15 September 2002 06:28, B. Douglas Hilton wrote:
> Fantastic! I was tinkering with this but I stalled out. I had
> to cart my C200 in to work to use as a prototype server machine
> for a proof of concept on a new project, but I will be sure to
> give it a whirl as it still has the V2 inside it.
>
> This might really help the project as now all the FX guys
> have an inexpensive option for graphics!
>
> When building the kernel should I disable "console on STI fb"
> option then? Did you add a "console on sstfb" option to config?
>
> Can't wait to try it out!
>
> Cheers!
> - Doug
>
> Helge Deller wrote:
> > Hi,
> >
> > there has been some discussions on this lists a few weeks back
> > about getting the Voodoo framebuffer driver  working on HPPA.
> > The attached patch allows me to use my Voodoo 2 with the sstfb
> > framebuffer driver in 16bpp in 640x480, 800x600 and 1024x768
> > resolutions on console and under X.
> >
> > Greetings,
> > Helge
> >
> > NB: This patch is already integrated into the 2.4.19-pa18 kernel and
> > I'll continue to do some more code-cleanups before trying to get it
> > into the official kernel.
> >
> > ...patch removed...

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

* RE: [parisc-linux] [PATCH] Voodoo framebuffer on PARISC
  2002-09-15  0:09 [parisc-linux] [PATCH] Voodoo framebuffer on PARISC Helge Deller
  2002-09-15  4:28 ` [parisc-linux] " B. Douglas Hilton
  2002-09-15  4:28 ` B. Douglas Hilton
@ 2002-09-15 22:13 ` Tobias Giesen
  2002-09-16  0:18   ` Thibaut VARENE
  2 siblings, 1 reply; 11+ messages in thread
From: Tobias Giesen @ 2002-09-15 22:13 UTC (permalink / raw)
  To: parisc-linux

Helge wrote:

> This patch is already integrated into the 2.4.19-pa18 
> kernel ...

Where can I get pa18? The latest on ftp.parisc-linux.org seems to be
pa17.

Cheers,
Tobias

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

* RE: [parisc-linux] Re: [PATCH] Voodoo framebuffer on PARISC
  2002-09-15  8:31   ` Helge Deller
@ 2002-09-16  0:17     ` Tobias Giesen
  2002-09-16  2:31       ` James P. Kinney III
  2002-09-16  6:29       ` Helge Deller
  0 siblings, 2 replies; 11+ messages in thread
From: Tobias Giesen @ 2002-09-16  0:17 UTC (permalink / raw)
  To: 'Helge Deller', 'B. Douglas Hilton'; +Cc: parisc-linux

Hello,

I think I need some more help with this. Here's what I did:

- grabbed fresh 2.4.19-pa17 sources
- applied sstfb.c and .h patch
- set kernel options to include sst1
- compiled & installed new kernel

The new kernel seems to try to activate a Voodoo console shortly after
the "If this is the last message you see ..." warning. However, my
monitor says the frequencies are out of range and switches itself off.
The main sti console is then dead also.

Any ideas? Maybe could I try a precompiled kernel with Voodoo support?

Thanks.

Best wishes,
Tobias Giesen

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

* Re: [parisc-linux] [PATCH] Voodoo framebuffer on PARISC
  2002-09-15 22:13 ` [parisc-linux] " Tobias Giesen
@ 2002-09-16  0:18   ` Thibaut VARENE
  0 siblings, 0 replies; 11+ messages in thread
From: Thibaut VARENE @ 2002-09-16  0:18 UTC (permalink / raw)
  To: Tobias Giesen; +Cc: parisc-linux

Le lundi, 16 sep 2002, =E0 00:13 Europe/Paris, Tobias Giesen a =E9crit :

> Helge wrote:
>
>> This patch is already integrated into the 2.4.19-pa18
>> kernel ...
>
> Where can I get pa18? The latest on ftp.parisc-linux.org seems to be
> pa17.
I'm currently building pa18 lifimage/iso, they will be available soon.
Though I think there's no point for you in trying to find a precompiled=20=

kernel,
since IIRC precomp are built with default debian-configs, which do not=20=

enable support
for sstfb.

Therefore I think you'd better get the latest kernel source from=20
cvs.parisc-linux.org
and build it with your own options :)

Greetings,


Thibaut VARENE
PA/Linux ESIEE Team
http://pateam.esiee.fr/=

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

* RE: [parisc-linux] Re: [PATCH] Voodoo framebuffer on PARISC
  2002-09-16  0:17     ` Tobias Giesen
@ 2002-09-16  2:31       ` James P. Kinney III
  2002-09-16  6:29       ` Helge Deller
  1 sibling, 0 replies; 11+ messages in thread
From: James P. Kinney III @ 2002-09-16  2:31 UTC (permalink / raw)
  To: Tobias Giesen; +Cc: palinux

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

As I don't have the Voodoo card, I didn't keep the patch, but, are there
settings in the sstfb patch that can be used to define the default
frequencies?  The only other alternative will be to get a very high
frequency monitor that supports 1280x1024@72Hz. My HP A4033A monitor has
no problem with that. But my Digiview croaked on it on my SGI Octane. So
now I have to switch out between the two boxes (Octane and C160) with
the A4033A. I haven't tried my Panasonic E21. It supports 1600x1280@60
so it should handle it OK.

On Sun, 2002-09-15 at 20:17, Tobias Giesen wrote:
> Hello,
> 
> I think I need some more help with this. Here's what I did:
> 
> - grabbed fresh 2.4.19-pa17 sources
> - applied sstfb.c and .h patch
> - set kernel options to include sst1
> - compiled & installed new kernel
> 
> The new kernel seems to try to activate a Voodoo console shortly after
> the "If this is the last message you see ..." warning. However, my
> monitor says the frequencies are out of range and switches itself off.
> The main sti console is then dead also.
> 
> Any ideas? Maybe could I try a precompiled kernel with Voodoo support?
> 
> Thanks.
> 
> Best wishes,
> Tobias Giesen
> 
> 
> 
> _______________________________________________
> parisc-linux mailing list
> parisc-linux@lists.parisc-linux.org
> http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
-- 
James P. Kinney III   \Changing the mobile computing world/
President and CEO      \          one Linux user         /
Local Net Solutions,LLC \           at a time.          /
770-493-8244             \.___________________________./

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<jkinney@localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7 



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: [parisc-linux] Re: [PATCH] Voodoo framebuffer on PARISC
  2002-09-16  0:17     ` Tobias Giesen
  2002-09-16  2:31       ` James P. Kinney III
@ 2002-09-16  6:29       ` Helge Deller
  2002-09-19 19:28         ` Tobias Giesen
  1 sibling, 1 reply; 11+ messages in thread
From: Helge Deller @ 2002-09-16  6:29 UTC (permalink / raw)
  To: Tobias Giesen; +Cc: parisc-linux

Hi Tobias,

you should use a standard PC mulitfrequency monitor, as most
HP monitors are fixed frequency and won't work.

Furthermore you might search in sstfb.c for:
/*
  Default video mode .
  0 800x600@60  took from glide
  1 640x480@75  took from glide
  2 1024x768@76 std fb.mode
  3 640x480@60  glide default */
#define DEFAULT_MODE 1

and try to change the DEFAULT_MODE to 2 or 0.

Greetings,
Helge

On Monday 16 September 2002 02:17, Tobias Giesen wrote:
> Hello,
>
> I think I need some more help with this. Here's what I did:
>
> - grabbed fresh 2.4.19-pa17 sources
> - applied sstfb.c and .h patch
> - set kernel options to include sst1
> - compiled & installed new kernel
>
> The new kernel seems to try to activate a Voodoo console shortly after
> the "If this is the last message you see ..." warning. However, my
> monitor says the frequencies are out of range and switches itself off.
> The main sti console is then dead also.
>
> Any ideas? Maybe could I try a precompiled kernel with Voodoo support?
>
> Thanks.
>
> Best wishes,
> Tobias Giesen

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

* RE: [parisc-linux] Re: [PATCH] Voodoo framebuffer on PARISC
  2002-09-16  6:29       ` Helge Deller
@ 2002-09-19 19:28         ` Tobias Giesen
  0 siblings, 0 replies; 11+ messages in thread
From: Tobias Giesen @ 2002-09-19 19:28 UTC (permalink / raw)
  To: 'Helge Deller'; +Cc: parisc-linux

Hello again,

I tried some more today, and I changed my setting to

#define DEFAULT_MODE 2

and recompiled and installed the new kernel, but it seems
the Voodoo2 is simply misconfigured by the driver. My monitor 
can take anything, so that's not the problem.

Are there any kernel parameters that I could try? Could it
be that my Voodoo2 is not compatible with Helge's?

I am on a Visualize C200.

Cheers,
Tobias

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

end of thread, other threads:[~2002-09-19 19:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-15  0:09 [parisc-linux] [PATCH] Voodoo framebuffer on PARISC Helge Deller
2002-09-15  4:28 ` [parisc-linux] " B. Douglas Hilton
2002-09-15  4:28 ` B. Douglas Hilton
2002-09-15  8:31   ` Helge Deller
2002-09-16  0:17     ` Tobias Giesen
2002-09-16  2:31       ` James P. Kinney III
2002-09-16  6:29       ` Helge Deller
2002-09-19 19:28         ` Tobias Giesen
2002-09-15  8:31   ` Helge Deller
2002-09-15 22:13 ` [parisc-linux] " Tobias Giesen
2002-09-16  0:18   ` Thibaut VARENE

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.