11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
2544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer * SiS 300/540/630[S]/730[S],
3544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer * SiS 315[E|PRO]/550/[M]650/651/[M]661[F|M]X/740/[M]741[GX]/330/[M]760[GX],
4544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer * XGI V3XT/V5/V8, Z7
5544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer * frame buffer driver for Linux kernels >= 2.4.14 and >=2.6.3
61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 2D acceleration part
81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This program is free software; you can redistribute it and/or modify
101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * it under the terms of the GNU General Public License as published by
111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the Free Software Foundation; either version 2 of the named License,
121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * or any later version.
131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This program is distributed in the hope that it will be useful,
151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * but WITHOUT ANY WARRANTY; without even the implied warranty of
161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * GNU General Public License for more details.
181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * You should have received a copy of the GNU General Public License
201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * along with this program; if not, write to the Free Software
211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Based on the XFree86/X.org driver which is
24544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer *     Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Author: Thomas Winischhofer <thomas@winischhofer.net>
271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *			(see http://www.winischhofer.net/
281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *			for more information and updates)
291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/module.h>
321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/kernel.h>
331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/fb.h>
341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/ioport.h>
351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/types.h>
361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <asm/io.h>
371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include "sis.h"
391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include "sis_accel.h"
401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic const u8 sisALUConv[] =
421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x00,       /* dest = 0;            0,      GXclear,        0 */
441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x88,       /* dest &= src;         DSa,    GXand,          0x1 */
451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x44,       /* dest = src & ~dest;  SDna,   GXandReverse,   0x2 */
461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xCC,       /* dest = src;          S,      GXcopy,         0x3 */
471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x22,       /* dest &= ~src;        DSna,   GXandInverted,  0x4 */
481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xAA,       /* dest = dest;         D,      GXnoop,         0x5 */
491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x66,       /* dest = ^src;         DSx,    GXxor,          0x6 */
501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xEE,       /* dest |= src;         DSo,    GXor,           0x7 */
511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x11,       /* dest = ~src & ~dest; DSon,   GXnor,          0x8 */
521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x99,       /* dest ^= ~src ;       DSxn,   GXequiv,        0x9 */
531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x55,       /* dest = ~dest;        Dn,     GXInvert,       0xA */
541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xDD,       /* dest = src|~dest ;   SDno,   GXorReverse,    0xB */
551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x33,       /* dest = ~src;         Sn,     GXcopyInverted, 0xC */
561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xBB,       /* dest |= ~src;        DSno,   GXorInverted,   0xD */
571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x77,       /* dest = ~src|~dest;   DSan,   GXnand,         0xE */
581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xFF,       /* dest = 0xFF;         1,      GXset,          0xF */
591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds};
601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* same ROP but with Pattern as Source */
611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic const u8 sisPatALUConv[] =
621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x00,       /* dest = 0;            0,      GXclear,        0 */
641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xA0,       /* dest &= src;         DPa,    GXand,          0x1 */
651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x50,       /* dest = src & ~dest;  PDna,   GXandReverse,   0x2 */
661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xF0,       /* dest = src;          P,      GXcopy,         0x3 */
671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x0A,       /* dest &= ~src;        DPna,   GXandInverted,  0x4 */
681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xAA,       /* dest = dest;         D,      GXnoop,         0x5 */
691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x5A,       /* dest = ^src;         DPx,    GXxor,          0x6 */
701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xFA,       /* dest |= src;         DPo,    GXor,           0x7 */
711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x05,       /* dest = ~src & ~dest; DPon,   GXnor,          0x8 */
721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xA5,       /* dest ^= ~src ;       DPxn,   GXequiv,        0x9 */
731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x55,       /* dest = ~dest;        Dn,     GXInvert,       0xA */
741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xF5,       /* dest = src|~dest ;   PDno,   GXorReverse,    0xB */
751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x0F,       /* dest = ~src;         Pn,     GXcopyInverted, 0xC */
761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xAF,       /* dest |= ~src;        DPno,   GXorInverted,   0xD */
771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0x5F,       /* dest = ~src|~dest;   DPan,   GXnand,         0xE */
781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds    0xFF,       /* dest = 0xFF;         1,      GXset,          0xF */
791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds};
801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic const int myrops[] = {
821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   	3, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds};
841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 300 series ----------------------------------------------------- */
861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_FB_SIS_300
871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic void
881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsSiS300Sync(struct sis_video_info *ivideo)
891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300Idle
911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic void
941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsSiS300SetupForScreenToScreenCopy(struct sis_video_info *ivideo, int xdir, int ydir,
951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds                                 int rop, int trans_color)
961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupDSTColorDepth(ivideo->DstColor);
981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupSRCPitch(ivideo->video_linelength)
991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupDSTRect(ivideo->video_linelength, 0xffff)
1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(trans_color != -1) {
1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		SiS300SetupROP(0x0A)
1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		SiS300SetupSRCTrans(trans_color)
1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		SiS300SetupCMDFlag(TRANSPARENT_BITBLT)
1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	} else {
1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	        SiS300SetupROP(sisALUConv[rop])
1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(xdir > 0) {
1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		SiS300SetupCMDFlag(X_INC)
1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(ydir > 0) {
1121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		SiS300SetupCMDFlag(Y_INC)
1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic void
1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsSiS300SubsequentScreenToScreenCopy(struct sis_video_info *ivideo, int src_x,
1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds				   int src_y, int dst_x, int dst_y, int width, int height)
1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 srcbase = 0, dstbase = 0;
1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(src_y >= 2048) {
1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		srcbase = ivideo->video_linelength * src_y;
1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		src_y = 0;
1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(dst_y >= 2048) {
1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		dstbase = ivideo->video_linelength * dst_y;
1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		dst_y = 0;
1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupSRCBase(srcbase);
1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupDSTBase(dstbase);
1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(!(ivideo->CommandReg & X_INC))  {
1351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		src_x += width-1;
1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		dst_x += width-1;
1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(!(ivideo->CommandReg & Y_INC))  {
1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		src_y += height-1;
1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		dst_y += height-1;
1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupRect(width, height)
1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupSRCXY(src_x, src_y)
1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupDSTXY(dst_x, dst_y)
1451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300DoCMD
1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic void
1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsSiS300SetupForSolidFill(struct sis_video_info *ivideo, u32 color, int rop)
1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupPATFG(color)
1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupDSTRect(ivideo->video_linelength, 0xffff)
1531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupDSTColorDepth(ivideo->DstColor);
1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupROP(sisPatALUConv[rop])
1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupCMDFlag(PATFG)
1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic void
1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsSiS300SubsequentSolidFillRect(struct sis_video_info *ivideo, int x, int y, int w, int h)
1601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
1611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 dstbase = 0;
1621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(y >= 2048) {
1641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		dstbase = ivideo->video_linelength * y;
1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		y = 0;
1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupDSTBase(dstbase)
1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupDSTXY(x,y)
1691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupRect(w,h)
1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300SetupCMDFlag(X_INC | Y_INC | BITBLT)
1711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS300DoCMD
1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
175544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer/* 315/330/340 series ---------------------------------------------- */
1761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_FB_SIS_315
1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic void
1791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsSiS310Sync(struct sis_video_info *ivideo)
1801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310Idle
1821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
1831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic void
1851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsSiS310SetupForScreenToScreenCopy(struct sis_video_info *ivideo, int rop, int trans_color)
1861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
1871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupDSTColorDepth(ivideo->DstColor);
1881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupSRCPitch(ivideo->video_linelength)
189544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	SiS310SetupDSTRect(ivideo->video_linelength, 0x0fff)
1901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(trans_color != -1) {
1911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		SiS310SetupROP(0x0A)
1921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		SiS310SetupSRCTrans(trans_color)
1931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		SiS310SetupCMDFlag(TRANSPARENT_BITBLT)
1941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	} else {
1951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	        SiS310SetupROP(sisALUConv[rop])
1961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		/* Set command - not needed, both 0 */
1971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		/* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */
1981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
1991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupCMDFlag(ivideo->SiS310_AccelDepth)
200544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	/* The chip is smart enough to know the direction */
2011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
2021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic void
2041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsSiS310SubsequentScreenToScreenCopy(struct sis_video_info *ivideo, int src_x, int src_y,
2051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds			 int dst_x, int dst_y, int width, int height)
2061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
2071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 srcbase = 0, dstbase = 0;
2081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int mymin = min(src_y, dst_y);
2091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int mymax = max(src_y, dst_y);
210544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer
2111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	/* Although the chip knows the direction to use
212544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	 * if the source and destination areas overlap,
2131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	 * that logic fails if we fiddle with the bitmap
2141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	 * addresses. Therefore, we check if the source
215544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	 * and destination blitting areas overlap and
216544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	 * adapt the bitmap addresses synchronously
2171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	 * if the coordinates exceed the valid range.
218544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	 * The the areas do not overlap, we do our
2191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	 * normal check.
2201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	 */
221544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if((mymax - mymin) < height) {
222544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		if((src_y >= 2048) || (dst_y >= 2048)) {
223544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer			srcbase = ivideo->video_linelength * mymin;
224544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer			dstbase = ivideo->video_linelength * mymin;
225544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer			src_y -= mymin;
226544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer			dst_y -= mymin;
227544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		}
2281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	} else {
229544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		if(src_y >= 2048) {
230544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer			srcbase = ivideo->video_linelength * src_y;
231544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer			src_y = 0;
232544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		}
233544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		if(dst_y >= 2048) {
234544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer			dstbase = ivideo->video_linelength * dst_y;
235544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer			dst_y = 0;
236544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		}
2371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
2381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
239544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	srcbase += ivideo->video_offset;
240544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	dstbase += ivideo->video_offset;
241544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer
2421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupSRCBase(srcbase);
2431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupDSTBase(dstbase);
2441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupRect(width, height)
2451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupSRCXY(src_x, src_y)
2461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupDSTXY(dst_x, dst_y)
2471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310DoCMD
2481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
2491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic void
2511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsSiS310SetupForSolidFill(struct sis_video_info *ivideo, u32 color, int rop)
2521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
2531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupPATFG(color)
254544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	SiS310SetupDSTRect(ivideo->video_linelength, 0x0fff)
2551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupDSTColorDepth(ivideo->DstColor);
2561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupROP(sisPatALUConv[rop])
2571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupCMDFlag(PATFG | ivideo->SiS310_AccelDepth)
2581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
2591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic void
2611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsSiS310SubsequentSolidFillRect(struct sis_video_info *ivideo, int x, int y, int w, int h)
2621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
2631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 dstbase = 0;
2641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(y >= 2048) {
2661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		dstbase = ivideo->video_linelength * y;
2671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		y = 0;
2681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
269544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	dstbase += ivideo->video_offset;
2701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupDSTBase(dstbase)
2711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupDSTXY(x,y)
2721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupRect(w,h)
2731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310SetupCMDFlag(BITBLT)
2741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	SiS310DoCMD
2751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
2761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
2771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* --------------------------------------------------------------------- */
2791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* The exported routines */
2811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint sisfb_initaccel(struct sis_video_info *ivideo)
2831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
2841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef SISFB_USE_SPINLOCKS
285544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	spin_lock_init(&ivideo->lockaccel);
2861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
287544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	return 0;
2881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
2891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid sisfb_syncaccel(struct sis_video_info *ivideo)
2911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
292544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if(ivideo->sisvga_engine == SIS_300_VGA) {
2931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_FB_SIS_300
294544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		SiS300Sync(ivideo);
2951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
296544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	} else {
2971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_FB_SIS_315
298544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		SiS310Sync(ivideo);
2991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
300544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	}
3011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
3021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
3031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint fbcon_sis_sync(struct fb_info *info)
3041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
305544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	struct sis_video_info *ivideo = (struct sis_video_info *)info->par;
306544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	CRITFLAGS
3071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
308544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if((!ivideo->accel) || (!ivideo->engineok))
309544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		return 0;
3101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
311544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	CRITBEGIN
312544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	sisfb_syncaccel(ivideo);
313544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	CRITEND
314544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer
315544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	return 0;
3161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
3171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
3181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid fbcon_sis_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
3191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
320544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	struct sis_video_info *ivideo = (struct sis_video_info *)info->par;
321544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	u32 col = 0;
322544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	u32 vxres = info->var.xres_virtual;
323544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	u32 vyres = info->var.yres_virtual;
324544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	int width, height;
325544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	CRITFLAGS
326544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer
327544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if(info->state != FBINFO_STATE_RUNNING)
328544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		return;
329544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer
330544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if((!ivideo->accel) || (!ivideo->engineok)) {
331544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		cfb_fillrect(info, rect);
332544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		return;
333544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	}
334544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer
335544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if(!rect->width || !rect->height || rect->dx >= vxres || rect->dy >= vyres)
336544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		return;
337544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer
338544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	/* Clipping */
339544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	width = ((rect->dx + rect->width) > vxres) ? (vxres - rect->dx) : rect->width;
340544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	height = ((rect->dy + rect->height) > vyres) ? (vyres - rect->dy) : rect->height;
341544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer
342544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	switch(info->var.bits_per_pixel) {
3431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	case 8:  col = rect->color;
3441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		 break;
3451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	case 16:
3461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	case 32: col = ((u32 *)(info->pseudo_palette))[rect->color];
3471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		 break;
348544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	}
3491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
350544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if(ivideo->sisvga_engine == SIS_300_VGA) {
3511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_FB_SIS_300
352544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		CRITBEGIN
353544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		SiS300SetupForSolidFill(ivideo, col, myrops[rect->rop]);
354544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		SiS300SubsequentSolidFillRect(ivideo, rect->dx, rect->dy, width, height);
355544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		CRITEND
3561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
357544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	} else {
3581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_FB_SIS_315
359544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		CRITBEGIN
360544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		SiS310SetupForSolidFill(ivideo, col, myrops[rect->rop]);
361544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		SiS310SubsequentSolidFillRect(ivideo, rect->dx, rect->dy, width, height);
362544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		CRITEND
3631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
364544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	}
3651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
366544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	sisfb_syncaccel(ivideo);
3671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
3681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
3691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid fbcon_sis_copyarea(struct fb_info *info, const struct fb_copyarea *area)
3701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{
371544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	struct sis_video_info *ivideo = (struct sis_video_info *)info->par;
372544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	u32 vxres = info->var.xres_virtual;
373544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	u32 vyres = info->var.yres_virtual;
374544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	int width = area->width;
375544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	int height = area->height;
3761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	CRITFLAGS
3771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
378544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if(info->state != FBINFO_STATE_RUNNING)
379544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		return;
3801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
381544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if((!ivideo->accel) || (!ivideo->engineok)) {
382544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		cfb_copyarea(info, area);
383544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		return;
3841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
3851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
386544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if(!width || !height ||
387544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	   area->sx >= vxres || area->sy >= vyres ||
388544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	   area->dx >= vxres || area->dy >= vyres)
389544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		return;
3901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
391544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	/* Clipping */
392544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if((area->sx + width) > vxres) width = vxres - area->sx;
393544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if((area->dx + width) > vxres) width = vxres - area->dx;
394544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if((area->sy + height) > vyres) height = vyres - area->sy;
395544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	if((area->dy + height) > vyres) height = vyres - area->dy;
3961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
3971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	if(ivideo->sisvga_engine == SIS_300_VGA) {
3981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_FB_SIS_300
399544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		int xdir, ydir;
400544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer
401544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		if(area->sx < area->dx) xdir = 0;
402544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		else                    xdir = 1;
403544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		if(area->sy < area->dy) ydir = 0;
404544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		else                    ydir = 1;
405544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer
406544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		CRITBEGIN
407544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		SiS300SetupForScreenToScreenCopy(ivideo, xdir, ydir, 3, -1);
408544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		SiS300SubsequentScreenToScreenCopy(ivideo, area->sx, area->sy,
409544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer					area->dx, area->dy, width, height);
410544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		CRITEND
4111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
4121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	} else {
4131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_FB_SIS_315
414544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		CRITBEGIN
415544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		SiS310SetupForScreenToScreenCopy(ivideo, 3, -1);
416544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		SiS310SubsequentScreenToScreenCopy(ivideo, area->sx, area->sy,
417544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer					area->dx, area->dy, width, height);
418544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer		CRITEND
4191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
4201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	}
4211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
422544393fe584d333480659a4bed30f5295355df11Thomas Winischhofer	sisfb_syncaccel(ivideo);
4231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}
424