171d7fec4Smrg/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_shadow.c,v 1.1 2002/12/10 15:12:23 alanh Exp $ */ 271d7fec4Smrg/* 371d7fec4Smrg * $Workfile: nsc_gx1_shadow.c $ 471d7fec4Smrg * $Revision: 1.1.1.1 $ 571d7fec4Smrg * $Author: mrg $ 671d7fec4Smrg * 771d7fec4Smrg * File Contents: Direct graphics display routines are implemented and 871d7fec4Smrg * graphics rendering are all done in memory. 971d7fec4Smrg * 1071d7fec4Smrg * Project: Geode Xfree Frame buffer device driver. 1171d7fec4Smrg * 1271d7fec4Smrg * 1371d7fec4Smrg */ 1471d7fec4Smrg 1571d7fec4Smrg/* 1671d7fec4Smrg * NSC_LIC_ALTERNATIVE_PREAMBLE 1771d7fec4Smrg * 1871d7fec4Smrg * Revision 1.0 1971d7fec4Smrg * 2071d7fec4Smrg * National Semiconductor Alternative GPL-BSD License 2171d7fec4Smrg * 2271d7fec4Smrg * National Semiconductor Corporation licenses this software 2371d7fec4Smrg * ("Software"): 2471d7fec4Smrg * 2571d7fec4Smrg * National Xfree frame buffer driver 2671d7fec4Smrg * 2771d7fec4Smrg * under one of the two following licenses, depending on how the 2871d7fec4Smrg * Software is received by the Licensee. 2971d7fec4Smrg * 3071d7fec4Smrg * If this Software is received as part of the Linux Framebuffer or 3171d7fec4Smrg * other GPL licensed software, then the GPL license designated 3271d7fec4Smrg * NSC_LIC_GPL applies to this Software; in all other circumstances 3371d7fec4Smrg * then the BSD-style license designated NSC_LIC_BSD shall apply. 3471d7fec4Smrg * 3571d7fec4Smrg * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ 3671d7fec4Smrg 3771d7fec4Smrg/* NSC_LIC_BSD 3871d7fec4Smrg * 3971d7fec4Smrg * National Semiconductor Corporation Open Source License for 4071d7fec4Smrg * 4171d7fec4Smrg * National Xfree frame buffer driver 4271d7fec4Smrg * 4371d7fec4Smrg * (BSD License with Export Notice) 4471d7fec4Smrg * 4571d7fec4Smrg * Copyright (c) 1999-2001 4671d7fec4Smrg * National Semiconductor Corporation. 4771d7fec4Smrg * All rights reserved. 4871d7fec4Smrg * 4971d7fec4Smrg * Redistribution and use in source and binary forms, with or without 5071d7fec4Smrg * modification, are permitted provided that the following conditions 5171d7fec4Smrg * are met: 5271d7fec4Smrg * 5371d7fec4Smrg * * Redistributions of source code must retain the above copyright 5471d7fec4Smrg * notice, this list of conditions and the following disclaimer. 5571d7fec4Smrg * 5671d7fec4Smrg * * Redistributions in binary form must reproduce the above 5771d7fec4Smrg * copyright notice, this list of conditions and the following 5871d7fec4Smrg * disclaimer in the documentation and/or other materials provided 5971d7fec4Smrg * with the distribution. 6071d7fec4Smrg * 6171d7fec4Smrg * * Neither the name of the National Semiconductor Corporation nor 6271d7fec4Smrg * the names of its contributors may be used to endorse or promote 6371d7fec4Smrg * products derived from this software without specific prior 6471d7fec4Smrg * written permission. 6571d7fec4Smrg * 6671d7fec4Smrg * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6771d7fec4Smrg * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 6871d7fec4Smrg * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 6971d7fec4Smrg * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 7071d7fec4Smrg * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 7171d7fec4Smrg * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 7271d7fec4Smrg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 7371d7fec4Smrg * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 7471d7fec4Smrg * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 7571d7fec4Smrg * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 7671d7fec4Smrg * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 7771d7fec4Smrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 7871d7fec4Smrg * OF SUCH DAMAGE. 7971d7fec4Smrg * 8071d7fec4Smrg * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 8171d7fec4Smrg * YOUR JURISDICTION. It is licensee's responsibility to comply with 8271d7fec4Smrg * any export regulations applicable in licensee's jurisdiction. Under 8371d7fec4Smrg * CURRENT (2001) U.S. export regulations this software 8471d7fec4Smrg * is eligible for export from the U.S. and can be downloaded by or 8571d7fec4Smrg * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 8671d7fec4Smrg * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 8771d7fec4Smrg * Syria, Sudan, Afghanistan and any other country to which the U.S. 8871d7fec4Smrg * has embargoed goods and services. 8971d7fec4Smrg * 9071d7fec4Smrg * END_NSC_LIC_BSD */ 9171d7fec4Smrg 9271d7fec4Smrg/* NSC_LIC_GPL 9371d7fec4Smrg * 9471d7fec4Smrg * National Semiconductor Corporation Gnu General Public License for 9571d7fec4Smrg * 9671d7fec4Smrg * National Xfree frame buffer driver 9771d7fec4Smrg * 9871d7fec4Smrg * (GPL License with Export Notice) 9971d7fec4Smrg * 10071d7fec4Smrg * Copyright (c) 1999-2001 10171d7fec4Smrg * National Semiconductor Corporation. 10271d7fec4Smrg * All rights reserved. 10371d7fec4Smrg * 10471d7fec4Smrg * Redistribution and use in source and binary forms, with or without 10571d7fec4Smrg * modification, are permitted under the terms of the GNU General 10671d7fec4Smrg * Public License as published by the Free Software Foundation; either 10771d7fec4Smrg * version 2 of the License, or (at your option) any later version 10871d7fec4Smrg * 10971d7fec4Smrg * In addition to the terms of the GNU General Public License, neither 11071d7fec4Smrg * the name of the National Semiconductor Corporation nor the names of 11171d7fec4Smrg * its contributors may be used to endorse or promote products derived 11271d7fec4Smrg * from this software without specific prior written permission. 11371d7fec4Smrg * 11471d7fec4Smrg * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 11571d7fec4Smrg * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 11671d7fec4Smrg * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 11771d7fec4Smrg * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 11871d7fec4Smrg * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 11971d7fec4Smrg * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 12071d7fec4Smrg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 12171d7fec4Smrg * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 12271d7fec4Smrg * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 12371d7fec4Smrg * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 12471d7fec4Smrg * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 12571d7fec4Smrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 12671d7fec4Smrg * OF SUCH DAMAGE. See the GNU General Public License for more details. 12771d7fec4Smrg * 12871d7fec4Smrg * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 12971d7fec4Smrg * YOUR JURISDICTION. It is licensee's responsibility to comply with 13071d7fec4Smrg * any export regulations applicable in licensee's jurisdiction. Under 13171d7fec4Smrg * CURRENT (2001) U.S. export regulations this software 13271d7fec4Smrg * is eligible for export from the U.S. and can be downloaded by or 13371d7fec4Smrg * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 13471d7fec4Smrg * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 13571d7fec4Smrg * Syria, Sudan, Afghanistan and any other country to which the U.S. 13671d7fec4Smrg * has embargoed goods and services. 13771d7fec4Smrg * 13871d7fec4Smrg * You should have received a copy of the GNU General Public License 13971d7fec4Smrg * along with this file; if not, write to the Free Software Foundation, 14071d7fec4Smrg * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14171d7fec4Smrg * 14271d7fec4Smrg * END_NSC_LIC_GPL */ 14371d7fec4Smrg 14471d7fec4Smrg#ifdef HAVE_CONFIG_H 14571d7fec4Smrg#include "config.h" 14671d7fec4Smrg#endif 14771d7fec4Smrg 14871d7fec4Smrg#include "xf86.h" 14971d7fec4Smrg#include "xf86_OSproc.h" 15071d7fec4Smrg#include "xf86Resources.h" 15171d7fec4Smrg#include "xf86PciInfo.h" 15271d7fec4Smrg#include "xf86Pci.h" 15371d7fec4Smrg#include "nsc.h" 15471d7fec4Smrg#include "shadowfb.h" 15571d7fec4Smrg#include "servermd.h" 15671d7fec4Smrg 15771d7fec4Smrgvoid GX1RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); 15871d7fec4Smrgvoid GX1PointerMoved(int index, int x, int y); 15971d7fec4Smrgvoid GX1RefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); 16071d7fec4Smrgvoid GX1RefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); 16171d7fec4Smrgvoid GX1RefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); 16271d7fec4Smrgvoid GX1RefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); 16371d7fec4Smrg 16471d7fec4Smrg/*---------------------------------------------------------------------------- 16571d7fec4Smrg * GX1RefreshArea. 16671d7fec4Smrg * 16771d7fec4Smrg * Description :This function copies the memory to be displayed from the 16871d7fec4Smrg * shadow pointer. 16971d7fec4Smrg * Parameters. 17071d7fec4Smrg * pScrn :Pointer to screen structure. 17171d7fec4Smrg * num :Specifies the num of squarebox area to be displayed. 17271d7fec4Smrg * pbox :Points to square of memory to be displayed. 17371d7fec4Smrg * Returns :none 17471d7fec4Smrg * 17571d7fec4Smrg * Comments : none 17671d7fec4Smrg * 17771d7fec4Smrg*---------------------------------------------------------------------------- 17871d7fec4Smrg*/ 17971d7fec4Smrgvoid 18071d7fec4SmrgGX1RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) 18171d7fec4Smrg{ 18271d7fec4Smrg GeodePtr pGeode = GEODEPTR(pScrn); 18371d7fec4Smrg int width, height, Bpp, FBPitch; 18471d7fec4Smrg unsigned char *src, *dst; 18571d7fec4Smrg 18671d7fec4Smrg Bpp = pScrn->bitsPerPixel >> 3; 18771d7fec4Smrg FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel); 18871d7fec4Smrg while (num--) { 18971d7fec4Smrg width = (pbox->x2 - pbox->x1) * Bpp; 19071d7fec4Smrg height = pbox->y2 - pbox->y1; 19171d7fec4Smrg src = pGeode->ShadowPtr + (pbox->y1 * pGeode->ShadowPitch) + 19271d7fec4Smrg (pbox->x1 * Bpp); 19371d7fec4Smrg dst = pGeode->FBBase + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); 19471d7fec4Smrg while (height--) { 19571d7fec4Smrg memcpy(dst, src, width); 19671d7fec4Smrg dst += FBPitch; 19771d7fec4Smrg src += pGeode->ShadowPitch; 19871d7fec4Smrg } 19971d7fec4Smrg 20071d7fec4Smrg pbox++; 20171d7fec4Smrg } 20271d7fec4Smrg} 20371d7fec4Smrg 20471d7fec4Smrg/*---------------------------------------------------------------------------- 20571d7fec4Smrg * GX1PointerMoved. 20671d7fec4Smrg * 20771d7fec4Smrg * Description :This function moves one screen memory from one area to other. 20871d7fec4Smrg * 20971d7fec4Smrg * Parameters. 21071d7fec4Smrg * index :Pointer to screen index. 21171d7fec4Smrg * x :Specifies the new x co-ordinates of new area. 21271d7fec4Smrg * y :Specifies the new y co-ordinates of new area. 21371d7fec4Smrg * Returns :none 21471d7fec4Smrg * 21571d7fec4Smrg * Comments :none 21671d7fec4Smrg * 21771d7fec4Smrg*---------------------------------------------------------------------------- 21871d7fec4Smrg*/ 21971d7fec4Smrgvoid 22071d7fec4SmrgGX1PointerMoved(int index, int x, int y) 22171d7fec4Smrg{ 22271d7fec4Smrg ScrnInfoPtr pScrn = xf86Screens[index]; 22371d7fec4Smrg GeodePtr pGeode = GEODEPTR(pScrn); 22471d7fec4Smrg int newX, newY; 22571d7fec4Smrg 22671d7fec4Smrg if (pGeode->Rotate == 1) { 22771d7fec4Smrg newX = pScrn->pScreen->height - y - 1; 22871d7fec4Smrg newY = x; 22971d7fec4Smrg } else { 23071d7fec4Smrg newX = y; 23171d7fec4Smrg newY = pScrn->pScreen->width - x - 1; 23271d7fec4Smrg } 23371d7fec4Smrg (*pGeode->PointerMoved) (index, newX, newY); 23471d7fec4Smrg} 23571d7fec4Smrg 23671d7fec4Smrg/*---------------------------------------------------------------------------- 23771d7fec4Smrg * GX1RefreshArea8. 23871d7fec4Smrg * 23971d7fec4Smrg * Description :This function copies the memory to be displayed from the 24071d7fec4Smrg * shadow pointer by 8bpp. 24171d7fec4Smrg * Parameters. 24271d7fec4Smrg * pScrn :Pointer to screen structure. 24371d7fec4Smrg * num :Specifies the num of squarebox area to be displayed. 24471d7fec4Smrg * pbox :Points to square of memory to be displayed. 24571d7fec4Smrg * Returns :none 24671d7fec4Smrg * 24771d7fec4Smrg * Comments :none 24871d7fec4Smrg * 24971d7fec4Smrg*---------------------------------------------------------------------------- 25071d7fec4Smrg*/ 25171d7fec4Smrgvoid 25271d7fec4SmrgGX1RefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) 25371d7fec4Smrg{ 25471d7fec4Smrg GeodePtr pGeode = GEODEPTR(pScrn); 25571d7fec4Smrg int count, width, height, y1, y2, dstPitch, srcPitch, srcPitch2, 25671d7fec4Smrg srcPitch3, srcPitch4; 25771d7fec4Smrg CARD8 *dstPtr, *srcPtr, *src; 25871d7fec4Smrg CARD32 *dst; 25971d7fec4Smrg 26071d7fec4Smrg dstPitch = pScrn->displayWidth; 26171d7fec4Smrg srcPitch = -pGeode->Rotate * pGeode->ShadowPitch; 26271d7fec4Smrg srcPitch2 = srcPitch * 2; 26371d7fec4Smrg srcPitch3 = srcPitch * 3; 26471d7fec4Smrg srcPitch4 = srcPitch * 4; 26571d7fec4Smrg while (num--) { 26671d7fec4Smrg width = pbox->x2 - pbox->x1; 26771d7fec4Smrg y1 = pbox->y1 & ~3; 26871d7fec4Smrg y2 = (pbox->y2 + 3) & ~3; 26971d7fec4Smrg height = (y2 - y1) >> 2; /* in dwords */ 27071d7fec4Smrg 27171d7fec4Smrg if (pGeode->Rotate == 1) { 27271d7fec4Smrg dstPtr = pGeode->FBBase + 27371d7fec4Smrg (pbox->x1 * dstPitch) + pScrn->virtualX - y2; 27471d7fec4Smrg srcPtr = pGeode->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; 27571d7fec4Smrg } else { 27671d7fec4Smrg dstPtr = pGeode->FBBase + 27771d7fec4Smrg ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; 27871d7fec4Smrg srcPtr = pGeode->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; 27971d7fec4Smrg } 28071d7fec4Smrg while (width--) { 28171d7fec4Smrg src = srcPtr; 28271d7fec4Smrg dst = (CARD32 *) dstPtr; 28371d7fec4Smrg count = height; 28471d7fec4Smrg while (count--) { 28571d7fec4Smrg *(dst++) = src[0] | (src[srcPitch] << 8) | 28671d7fec4Smrg (src[srcPitch2] << 16) | (src[srcPitch3] << 24); 28771d7fec4Smrg src += srcPitch4; 28871d7fec4Smrg } 28971d7fec4Smrg srcPtr += pGeode->Rotate; 29071d7fec4Smrg dstPtr += dstPitch; 29171d7fec4Smrg } 29271d7fec4Smrg pbox++; 29371d7fec4Smrg } 29471d7fec4Smrg} 29571d7fec4Smrg 29671d7fec4Smrg/*---------------------------------------------------------------------------- 29771d7fec4Smrg * GX1RefreshArea16. 29871d7fec4Smrg * 29971d7fec4Smrg * Description :This function copies the memory to be displayed from the 30071d7fec4Smrg * shadow pointer by 16bpp. 30171d7fec4Smrg * Parameters: 30271d7fec4Smrg * pScrn :Pointer to screen structure. 30371d7fec4Smrg * num :Specifies the num of squarebox area to be displayed. 30471d7fec4Smrg * pbox :Points to square of memory to be displayed. 30571d7fec4Smrg * Returns :none 30671d7fec4Smrg * 30771d7fec4Smrg * Comments :none 30871d7fec4Smrg * 30971d7fec4Smrg*---------------------------------------------------------------------------- 31071d7fec4Smrg*/ 31171d7fec4Smrgvoid 31271d7fec4SmrgGX1RefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) 31371d7fec4Smrg{ 31471d7fec4Smrg GeodePtr pGeode = GEODEPTR(pScrn); 31571d7fec4Smrg int count, width, height, y1, y2, dstPitch, srcPitch, srcPitch2; 31671d7fec4Smrg CARD16 *dstPtr, *srcPtr, *src; 31771d7fec4Smrg CARD32 *dst; 31871d7fec4Smrg 31971d7fec4Smrg dstPitch = pScrn->displayWidth; 32071d7fec4Smrg srcPitch = -pGeode->Rotate * pGeode->ShadowPitch >> 1; 32171d7fec4Smrg srcPitch2 = srcPitch * 2; 32271d7fec4Smrg while (num--) { 32371d7fec4Smrg width = pbox->x2 - pbox->x1; 32471d7fec4Smrg y1 = pbox->y1 & ~1; 32571d7fec4Smrg y2 = (pbox->y2 + 1) & ~1; 32671d7fec4Smrg height = (y2 - y1) >> 1; /* in dwords */ 32771d7fec4Smrg if (pGeode->Rotate == 1) { 32871d7fec4Smrg dstPtr = (CARD16 *) pGeode->FBBase + 32971d7fec4Smrg (pbox->x1 * dstPitch) + pScrn->virtualX - y2; 33071d7fec4Smrg srcPtr = (CARD16 *) pGeode->ShadowPtr + 33171d7fec4Smrg ((1 - y2) * srcPitch) + pbox->x1; 33271d7fec4Smrg } else { 33371d7fec4Smrg dstPtr = (CARD16 *) pGeode->FBBase + 33471d7fec4Smrg ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; 33571d7fec4Smrg srcPtr = (CARD16 *) pGeode->ShadowPtr + 33671d7fec4Smrg (y1 * srcPitch) + pbox->x2 - 1; 33771d7fec4Smrg } 33871d7fec4Smrg 33971d7fec4Smrg while (width--) { 34071d7fec4Smrg src = srcPtr; 34171d7fec4Smrg dst = (CARD32 *) dstPtr; 34271d7fec4Smrg count = height; 34371d7fec4Smrg while (count--) { 34471d7fec4Smrg *(dst++) = src[0] | (src[srcPitch] << 16); 34571d7fec4Smrg src += srcPitch2; 34671d7fec4Smrg } 34771d7fec4Smrg srcPtr += pGeode->Rotate; 34871d7fec4Smrg dstPtr += dstPitch; 34971d7fec4Smrg } 35071d7fec4Smrg 35171d7fec4Smrg pbox++; 35271d7fec4Smrg } 35371d7fec4Smrg} 35471d7fec4Smrg 35571d7fec4Smrg/*---------------------------------------------------------------------------- 35671d7fec4Smrg * GX1RefreshArea24. 35771d7fec4Smrg * 35871d7fec4Smrg * Description :This function copies the memory to be displayed from the 35971d7fec4Smrg * shadow pointer by 24bpp. 36071d7fec4Smrg * Parameters. 36171d7fec4Smrg * pScrn :Pointer to screen structure. 36271d7fec4Smrg * num :Specifies the num of squarebox area to be displayed. 36371d7fec4Smrg * pbox :Points to square of memory to be displayed. 36471d7fec4Smrg * Returns :none 36571d7fec4Smrg * 36671d7fec4Smrg * Comments :none 36771d7fec4Smrg * 36871d7fec4Smrg*---------------------------------------------------------------------------- 36971d7fec4Smrg*/ 37071d7fec4Smrgvoid 37171d7fec4SmrgGX1RefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) 37271d7fec4Smrg{ 37371d7fec4Smrg GeodePtr pGeode = GEODEPTR(pScrn); 37471d7fec4Smrg int count, width, height, y1, y2, dstPitch, srcPitch, srcPitch2, srcPitch3; 37571d7fec4Smrg CARD8 *dstPtr, *srcPtr, *src; 37671d7fec4Smrg CARD32 *dst; 37771d7fec4Smrg 37871d7fec4Smrg dstPitch = BitmapBytePad(pScrn->displayWidth * 24); 37971d7fec4Smrg srcPitch = -pGeode->Rotate * pGeode->ShadowPitch; 38071d7fec4Smrg srcPitch2 = srcPitch * 2; 38171d7fec4Smrg srcPitch3 = srcPitch * 3; 38271d7fec4Smrg while (num--) { 38371d7fec4Smrg width = pbox->x2 - pbox->x1; 38471d7fec4Smrg y1 = pbox->y1 & ~3; 38571d7fec4Smrg y2 = (pbox->y2 + 3) & ~3; 38671d7fec4Smrg height = (y2 - y1) >> 2; /* blocks of 3 dwords */ 38771d7fec4Smrg if (pGeode->Rotate == 1) { 38871d7fec4Smrg dstPtr = pGeode->FBBase + 38971d7fec4Smrg (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3); 39071d7fec4Smrg srcPtr = pGeode->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3); 39171d7fec4Smrg } else { 39271d7fec4Smrg dstPtr = pGeode->FBBase + 39371d7fec4Smrg ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3); 39471d7fec4Smrg srcPtr = pGeode->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3; 39571d7fec4Smrg } 39671d7fec4Smrg while (width--) { 39771d7fec4Smrg src = srcPtr; 39871d7fec4Smrg dst = (CARD32 *) dstPtr; 39971d7fec4Smrg count = height; 40071d7fec4Smrg while (count--) { 40171d7fec4Smrg dst[0] = src[0] | (src[1] << 8) | (src[2] << 16) | 40271d7fec4Smrg (src[srcPitch] << 24); 40371d7fec4Smrg dst[1] = src[srcPitch + 1] | (src[srcPitch + 2] << 8) | 40471d7fec4Smrg (src[srcPitch2] << 16) | (src[srcPitch2 + 1] << 24); 40571d7fec4Smrg dst[2] = src[srcPitch2 + 2] | (src[srcPitch3] << 8) | 40671d7fec4Smrg (src[srcPitch3 + 1] << 16) | (src[srcPitch3 + 2] << 24); 40771d7fec4Smrg dst += 3; 40871d7fec4Smrg src += srcPitch << 2; 40971d7fec4Smrg } 41071d7fec4Smrg srcPtr += pGeode->Rotate * 3; 41171d7fec4Smrg dstPtr += dstPitch; 41271d7fec4Smrg } 41371d7fec4Smrg pbox++; 41471d7fec4Smrg } 41571d7fec4Smrg} 41671d7fec4Smrg 41771d7fec4Smrg/*---------------------------------------------------------------------------- 41871d7fec4Smrg * GX1RefreshArea32. 41971d7fec4Smrg * 42071d7fec4Smrg * Description :This function copies the memory to be displayed from the 42171d7fec4Smrg * shadow pointer by 32bpp. 42271d7fec4Smrg * Parameters: 42371d7fec4Smrg * pScrn :Pointer to screen structure. 42471d7fec4Smrg * num :Specifies the num of squarebox area to be displayed. 42571d7fec4Smrg * pbox :Points to square of memory to be displayed. 42671d7fec4Smrg * Returns : none 42771d7fec4Smrg * 42871d7fec4Smrg * Comments :none 42971d7fec4Smrg * 43071d7fec4Smrg*---------------------------------------------------------------------------- 43171d7fec4Smrg*/ 43271d7fec4Smrgvoid 43371d7fec4SmrgGX1RefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) 43471d7fec4Smrg{ 43571d7fec4Smrg GeodePtr pGeode = GEODEPTR(pScrn); 43671d7fec4Smrg int count, width, height, dstPitch, srcPitch; 43771d7fec4Smrg CARD32 *dstPtr, *srcPtr, *src, *dst; 43871d7fec4Smrg 43971d7fec4Smrg dstPitch = pScrn->displayWidth; 44071d7fec4Smrg srcPitch = -pGeode->Rotate * pGeode->ShadowPitch >> 2; 44171d7fec4Smrg while (num--) { 44271d7fec4Smrg width = pbox->x2 - pbox->x1; 44371d7fec4Smrg height = pbox->y2 - pbox->y1; 44471d7fec4Smrg 44571d7fec4Smrg if (pGeode->Rotate == 1) { 44671d7fec4Smrg dstPtr = (CARD32 *) pGeode->FBBase + 44771d7fec4Smrg (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2; 44871d7fec4Smrg srcPtr = (CARD32 *) pGeode->ShadowPtr + 44971d7fec4Smrg ((1 - pbox->y2) * srcPitch) + pbox->x1; 45071d7fec4Smrg } else { 45171d7fec4Smrg dstPtr = (CARD32 *) pGeode->FBBase + 45271d7fec4Smrg ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1; 45371d7fec4Smrg srcPtr = (CARD32 *) pGeode->ShadowPtr + 45471d7fec4Smrg (pbox->y1 * srcPitch) + pbox->x2 - 1; 45571d7fec4Smrg } 45671d7fec4Smrg while (width--) { 45771d7fec4Smrg src = srcPtr; 45871d7fec4Smrg dst = dstPtr; 45971d7fec4Smrg count = height; 46071d7fec4Smrg while (count--) { 46171d7fec4Smrg *(dst++) = *src; 46271d7fec4Smrg src += srcPitch; 46371d7fec4Smrg } 46471d7fec4Smrg srcPtr += pGeode->Rotate; 46571d7fec4Smrg dstPtr += dstPitch; 46671d7fec4Smrg } 46771d7fec4Smrg pbox++; 46871d7fec4Smrg } 46971d7fec4Smrg} 47071d7fec4Smrg 47171d7fec4Smrg/* End of file */ 472