patch-2.4.25 linux-2.4.25/drivers/video/sis/sis_accel.c

Next file: linux-2.4.25/drivers/video/sis/sis_accel.h
Previous file: linux-2.4.25/drivers/video/sis/osdef.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.24/drivers/video/sis/sis_accel.c linux-2.4.25/drivers/video/sis/sis_accel.c
@@ -1,14 +1,27 @@
 /*
- * SiS 300/630/730/540/315/550/650/740/330/660 frame buffer driver
- * for Linux kernels 2.4.x and 2.5.x
+ * SiS 300/630/730/540/315/550/65x/74x/330/760 frame buffer driver
+ * for Linux kernels 2.4.x and 2.6.x
  *
  * 2D acceleration part
  *
- * Based on the X driver's sis300_accel.c which is
- *     Copyright Xavier Ducoin <x.ducoin@lectra.com>
- *     Copyright 2002 by Thomas Winischhofer, Vienna, Austria
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the named License,
+ * or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Based on the XFree86 driver's sis300_accel.c which is
+ *     Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
  * and sis310_accel.c which is
- *     Copyright 2002 by Thomas Winischhofer, Vienna, Austria
+ *     Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
  *
  * Author: Thomas Winischhofer <thomas@winischhofer.net>
  *			(see http://www.winischhofer.net/
@@ -114,8 +127,8 @@
    };
 #endif
 
-/* 300 series */
-
+/* 300 series ----------------------------------------------------- */
+#ifdef CONFIG_FB_SIS_300
 static void
 SiS300Sync(void)
 {
@@ -123,12 +136,6 @@
 }
 
 static void
-SiS310Sync(void)
-{
-	SiS310Idle
-}
-
-static void
 SiS300SetupForScreenToScreenCopy(int xdir, int ydir, int rop,
                                 unsigned int planemask, int trans_color)
 {
@@ -210,8 +217,16 @@
 	SiS300SetupCMDFlag(X_INC | Y_INC | BITBLT)
 	SiS300DoCMD
 }
+#endif
 
-/* 315 series ---------------------------------------------------- */
+/* 315/330 series ------------------------------------------------- */
+
+#ifdef CONFIG_FB_SIS_315
+static void
+SiS310Sync(void)
+{
+	SiS310Idle
+}
 
 static void
 SiS310SetupForScreenToScreenCopy(int xdir, int ydir, int rop,
@@ -306,6 +321,7 @@
 	SiS310SetupCMDFlag(BITBLT)
 	SiS310DoCMD
 }
+#endif
 
 /* --------------------------------------------------------------------- */
 
@@ -322,9 +338,13 @@
 void sisfb_syncaccel(void)
 {
     if(sisvga_engine == SIS_300_VGA) {
+#ifdef CONFIG_FB_SIS_300
     	SiS300Sync();
+#endif
     } else {
+#ifdef CONFIG_FB_SIS_315
     	SiS310Sync();
+#endif
     }
 }
 
@@ -332,14 +352,19 @@
 
 int fbcon_sis_sync(struct fb_info *info)
 {
+   CRITFLAGS
+
    if(!ivideo.accel)
    	return 0;
    
-   CRITFLAGS
    if(sisvga_engine == SIS_300_VGA) {
+#ifdef CONFIG_FB_SIS_300
       SiS300Sync();
+#endif
    } else {
+#ifdef CONFIG_FB_SIS_315
       SiS310Sync();
+#endif
    }
    CRITEND
    return 0;
@@ -360,26 +385,30 @@
    }
    
    switch(info->var.bits_per_pixel) {
-		case 8: col = rect->color;
-			break;
-		case 16: col = ((u32 *)(info->pseudo_palette))[rect->color];
-			 break;
-		case 32: col = ((u32 *)(info->pseudo_palette))[rect->color];
-			 break;
-	}	
+	case 8:  col = rect->color;
+		 break;
+	case 16: col = ((u32 *)(info->pseudo_palette))[rect->color];
+		 break;
+	case 32: col = ((u32 *)(info->pseudo_palette))[rect->color];
+		 break;
+   }
 
    if(sisvga_engine == SIS_300_VGA) {
-	   CRITBEGIN
-	   SiS300SetupForSolidFill(col, myrops[rect->rop], 0);
-	   SiS300SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height);
-	   CRITEND
-	   SiS300Sync();
+#ifdef CONFIG_FB_SIS_300
+      CRITBEGIN
+      SiS300SetupForSolidFill(col, myrops[rect->rop], 0);
+      SiS300SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height);
+      CRITEND
+      SiS300Sync();
+#endif
    } else {
-	   CRITBEGIN
-	   SiS310SetupForSolidFill(col, myrops[rect->rop], 0);
-	   SiS310SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height);
-	   CRITEND
-	   SiS310Sync();
+#ifdef CONFIG_FB_SIS_315
+      CRITBEGIN
+      SiS310SetupForSolidFill(col, myrops[rect->rop], 0);
+      SiS310SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height);
+      CRITEND
+      SiS310Sync();
+#endif
    }
 
 }
@@ -404,17 +433,21 @@
    else                    ydir = 1;
 
    if(sisvga_engine == SIS_300_VGA) {
+#ifdef CONFIG_FB_SIS_300
       CRITBEGIN
       SiS300SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1);
       SiS300SubsequentScreenToScreenCopy(area->sx, area->sy, area->dx, area->dy, area->width, area->height);
       CRITEND
       SiS300Sync();
+#endif
    } else {
+#ifdef CONFIG_FB_SIS_315
       CRITBEGIN
       SiS310SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1);
       SiS310SubsequentScreenToScreenCopy(area->sx, area->sy, area->dx, area->dy, area->width, area->height);
       CRITEND
       SiS310Sync();
+#endif
    }
 }
 
@@ -462,25 +495,28 @@
 	else            ydir = 1;
 
 	if(sisvga_engine == SIS_300_VGA) {
+#ifdef CONFIG_FB_SIS_300
 	   CRITBEGIN
 	   SiS300SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1);
 	   SiS300SubsequentScreenToScreenCopy(srcx, srcy, dstx, dsty, width, height);
 	   CRITEND
 	   SiS300Sync();
+#endif
 	} else {
+#ifdef CONFIG_FB_SIS_315
 	   CRITBEGIN
 	   SiS310SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1);
 	   SiS310SubsequentScreenToScreenCopy(srcx, srcy, dstx, dsty, width, height);
 	   CRITEND
 	   SiS310Sync();
-#if 0	   
+#if 0
 	   printk(KERN_INFO "sis_bmove sx %d sy %d dx %d dy %d w %d h %d\n",
 		srcx, srcy, dstx, dsty, width, height);
-#endif		
+#endif
+#endif
 	}
 }
 
-
 static void fbcon_sis_clear(struct vc_data *conp, struct display *p,
 			int srcy, int srcx, int height, int width, int color)
 {
@@ -492,17 +528,21 @@
 	height *= fontheight(p);
 
 	if(sisvga_engine == SIS_300_VGA) {
+#ifdef CONFIG_FB_SIS_300
 	   CRITBEGIN
 	   SiS300SetupForSolidFill(color, 3, 0);
 	   SiS300SubsequentSolidFillRect(srcx, srcy, width, height);
 	   CRITEND
 	   SiS300Sync();
+#endif
 	} else {
+#ifdef CONFIG_FB_SIS_315
 	   CRITBEGIN
 	   SiS310SetupForSolidFill(color, 3, 0);
 	   SiS310SubsequentSolidFillRect(srcx, srcy, width, height);
 	   CRITEND
 	   SiS310Sync();
+#endif
 	}
 }
 
@@ -577,17 +617,21 @@
 	srcy *= fontheight(p);
 
 	if(sisvga_engine == SIS_300_VGA) {
+#ifdef CONFIG_FB_SIS_300
 	   CRITBEGIN
 	   SiS300SetupForSolidFill(0, 0x0a, 0);
 	   SiS300SubsequentSolidFillRect(srcx, srcy, fontwidth(p), fontheight(p));
 	   CRITEND
 	   SiS300Sync();
+#endif
 	} else {
+#ifdef CONFIG_FB_SIS_315
 	   CRITBEGIN
 	   SiS310SetupForSolidFill(0, 0x0a, 0);
 	   SiS310SubsequentSolidFillRect(srcx, srcy, fontwidth(p), fontheight(p));
 	   CRITEND
 	   SiS310Sync();
+#endif
 	}
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)