171d7fec4Smrg/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rndr.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ 271d7fec4Smrg/* 371d7fec4Smrg * $Workfile: gfx_rndr.c $ 471d7fec4Smrg * 571d7fec4Smrg * This file contains routines to program the 2D acceleration hardware: 671d7fec4Smrg * 771d7fec4Smrg * gfx_set_bpp 871d7fec4Smrg * gfx_set_solid_pattern 971d7fec4Smrg * gfx_set_mono_pattern 1071d7fec4Smrg * gfx_set_color_pattern 1171d7fec4Smrg * gfx_load_color_pattern_line 1271d7fec4Smrg * gfx_set_solid_source 1371d7fec4Smrg * gfx_set_mono_source 1471d7fec4Smrg * gfx_set_raster_operation 1571d7fec4Smrg * gfx_pattern_fill 1671d7fec4Smrg * gfx_color_pattern_fill 1771d7fec4Smrg * gfx_screen_to_screen_blt 1871d7fec4Smrg * gfx_screen_to_screen_xblt 1971d7fec4Smrg * gfx_color_bitmap_to_screen_blt 2071d7fec4Smrg * gfx_color_bitmap_to_screen_xblt 2171d7fec4Smrg * gfx_mono_bitmap_to_screen_blt 2271d7fec4Smrg * gfx_bresenham_line 2371d7fec4Smrg * gfx_wait_until_idle 2471d7fec4Smrg * 2571d7fec4Smrg * NSC_LIC_ALTERNATIVE_PREAMBLE 2671d7fec4Smrg * 2771d7fec4Smrg * Revision 1.0 2871d7fec4Smrg * 2971d7fec4Smrg * National Semiconductor Alternative GPL-BSD License 3071d7fec4Smrg * 3171d7fec4Smrg * National Semiconductor Corporation licenses this software 3271d7fec4Smrg * ("Software"): 3371d7fec4Smrg * 3471d7fec4Smrg * Durango 3571d7fec4Smrg * 3671d7fec4Smrg * under one of the two following licenses, depending on how the 3771d7fec4Smrg * Software is received by the Licensee. 3871d7fec4Smrg * 3971d7fec4Smrg * If this Software is received as part of the Linux Framebuffer or 4071d7fec4Smrg * other GPL licensed software, then the GPL license designated 4171d7fec4Smrg * NSC_LIC_GPL applies to this Software; in all other circumstances 4271d7fec4Smrg * then the BSD-style license designated NSC_LIC_BSD shall apply. 4371d7fec4Smrg * 4471d7fec4Smrg * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ 4571d7fec4Smrg 4671d7fec4Smrg/* NSC_LIC_BSD 4771d7fec4Smrg * 4871d7fec4Smrg * National Semiconductor Corporation Open Source License for Durango 4971d7fec4Smrg * 5071d7fec4Smrg * (BSD License with Export Notice) 5171d7fec4Smrg * 5271d7fec4Smrg * Copyright (c) 1999-2001 5371d7fec4Smrg * National Semiconductor Corporation. 5471d7fec4Smrg * All rights reserved. 5571d7fec4Smrg * 5671d7fec4Smrg * Redistribution and use in source and binary forms, with or without 5771d7fec4Smrg * modification, are permitted provided that the following conditions 5871d7fec4Smrg * are met: 5971d7fec4Smrg * 6071d7fec4Smrg * * Redistributions of source code must retain the above copyright 6171d7fec4Smrg * notice, this list of conditions and the following disclaimer. 6271d7fec4Smrg * 6371d7fec4Smrg * * Redistributions in binary form must reproduce the above 6471d7fec4Smrg * copyright notice, this list of conditions and the following 6571d7fec4Smrg * disclaimer in the documentation and/or other materials provided 6671d7fec4Smrg * with the distribution. 6771d7fec4Smrg * 6871d7fec4Smrg * * Neither the name of the National Semiconductor Corporation nor 6971d7fec4Smrg * the names of its contributors may be used to endorse or promote 7071d7fec4Smrg * products derived from this software without specific prior 7171d7fec4Smrg * written permission. 7271d7fec4Smrg * 7371d7fec4Smrg * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 7471d7fec4Smrg * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7571d7fec4Smrg * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 7671d7fec4Smrg * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 7771d7fec4Smrg * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 7871d7fec4Smrg * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 7971d7fec4Smrg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 8071d7fec4Smrg * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 8171d7fec4Smrg * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 8271d7fec4Smrg * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 8371d7fec4Smrg * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 8471d7fec4Smrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 8571d7fec4Smrg * OF SUCH DAMAGE. 8671d7fec4Smrg * 8771d7fec4Smrg * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 8871d7fec4Smrg * YOUR JURISDICTION. It is licensee's responsibility to comply with 8971d7fec4Smrg * any export regulations applicable in licensee's jurisdiction. Under 9071d7fec4Smrg * CURRENT (2001) U.S. export regulations this software 9171d7fec4Smrg * is eligible for export from the U.S. and can be downloaded by or 9271d7fec4Smrg * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 9371d7fec4Smrg * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 9471d7fec4Smrg * Syria, Sudan, Afghanistan and any other country to which the U.S. 9571d7fec4Smrg * has embargoed goods and services. 9671d7fec4Smrg * 9771d7fec4Smrg * END_NSC_LIC_BSD */ 9871d7fec4Smrg 9971d7fec4Smrg/* NSC_LIC_GPL 10071d7fec4Smrg * 10171d7fec4Smrg * National Semiconductor Corporation Gnu General Public License for Durango 10271d7fec4Smrg * 10371d7fec4Smrg * (GPL License with Export Notice) 10471d7fec4Smrg * 10571d7fec4Smrg * Copyright (c) 1999-2001 10671d7fec4Smrg * National Semiconductor Corporation. 10771d7fec4Smrg * All rights reserved. 10871d7fec4Smrg * 10971d7fec4Smrg * Redistribution and use in source and binary forms, with or without 11071d7fec4Smrg * modification, are permitted under the terms of the GNU General 11171d7fec4Smrg * Public License as published by the Free Software Foundation; either 11271d7fec4Smrg * version 2 of the License, or (at your option) any later version 11371d7fec4Smrg * 11471d7fec4Smrg * In addition to the terms of the GNU General Public License, neither 11571d7fec4Smrg * the name of the National Semiconductor Corporation nor the names of 11671d7fec4Smrg * its contributors may be used to endorse or promote products derived 11771d7fec4Smrg * from this software without specific prior written permission. 11871d7fec4Smrg * 11971d7fec4Smrg * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 12071d7fec4Smrg * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 12171d7fec4Smrg * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 12271d7fec4Smrg * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 12371d7fec4Smrg * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 12471d7fec4Smrg * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 12571d7fec4Smrg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 12671d7fec4Smrg * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 12771d7fec4Smrg * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 12871d7fec4Smrg * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 12971d7fec4Smrg * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 13071d7fec4Smrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 13171d7fec4Smrg * OF SUCH DAMAGE. See the GNU General Public License for more details. 13271d7fec4Smrg * 13371d7fec4Smrg * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 13471d7fec4Smrg * YOUR JURISDICTION. It is licensee's responsibility to comply with 13571d7fec4Smrg * any export regulations applicable in licensee's jurisdiction. Under 13671d7fec4Smrg * CURRENT (2001) U.S. export regulations this software 13771d7fec4Smrg * is eligible for export from the U.S. and can be downloaded by or 13871d7fec4Smrg * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 13971d7fec4Smrg * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 14071d7fec4Smrg * Syria, Sudan, Afghanistan and any other country to which the U.S. 14171d7fec4Smrg * has embargoed goods and services. 14271d7fec4Smrg * 14371d7fec4Smrg * You should have received a copy of the GNU General Public License 14471d7fec4Smrg * along with this file; if not, write to the Free Software Foundation, 14571d7fec4Smrg * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14671d7fec4Smrg * 14771d7fec4Smrg * END_NSC_LIC_GPL */ 14871d7fec4Smrg 14971d7fec4Smrg/* STATIC VARIABLES */ 15071d7fec4Smrg 15171d7fec4Smrgunsigned short GFXbpp = 16; 15271d7fec4Smrgunsigned short GFXbb0Base = 0x400; 15371d7fec4Smrgunsigned short GFXbb1Base = 0x930; 15471d7fec4Smrgunsigned short GFXbufferWidthPixels = 400; 15571d7fec4Smrg 15671d7fec4Smrgunsigned short GFXpatternFlags = 0; 15771d7fec4Smrgunsigned short GFXsourceFlags = 0; 15871d7fec4Smrgunsigned long GFXsavedColor = 0; 15971d7fec4Smrgunsigned short GFXsavedRop = 0; 16071d7fec4Smrgunsigned short GFXusesDstData = 0; 16171d7fec4Smrg 16271d7fec4Smrg/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ 16371d7fec4Smrg 16471d7fec4Smrg#if GFX_2DACCEL_GU1 16571d7fec4Smrg#include "rndr_gu1.c" 16671d7fec4Smrg#endif 16771d7fec4Smrg 16871d7fec4Smrg/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */ 16971d7fec4Smrg 17071d7fec4Smrg#if GFX_2DACCEL_GU2 17171d7fec4Smrg#include "rndr_gu2.c" 17271d7fec4Smrg#endif 17371d7fec4Smrg 17471d7fec4Smrgvoid gfx_reset_pitch(unsigned short pitch); 17571d7fec4Smrg 17671d7fec4Smrg/* WRAPPERS IF DYNAMIC SELECTION */ 17771d7fec4Smrg/* Extra layer to call either first or second generation routines. */ 17871d7fec4Smrg 17971d7fec4Smrg#if GFX_2DACCEL_DYNAMIC 18071d7fec4Smrg 18171d7fec4Smrg/*--------------------------------------------------------------------------- 18271d7fec4Smrg * gfx_reset_pitch (PRIVATE ROUTINE - NOT PART OF API) 18371d7fec4Smrg *--------------------------------------------------------------------------- 18471d7fec4Smrg */ 18571d7fec4Smrgvoid 18671d7fec4Smrggfx_reset_pitch(unsigned short pitch) 18771d7fec4Smrg{ 18871d7fec4Smrg# if GFX_2DACCEL_GU2 18971d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 19071d7fec4Smrg gu2_reset_pitch(pitch); 19171d7fec4Smrg# endif 19271d7fec4Smrg} 19371d7fec4Smrg 19471d7fec4Smrg/*--------------------------------------------------------------------------- 19571d7fec4Smrg * gfx_set_bpp 19671d7fec4Smrg *--------------------------------------------------------------------------- 19771d7fec4Smrg */ 19871d7fec4Smrgvoid 19971d7fec4Smrggfx_set_bpp(unsigned short bpp) 20071d7fec4Smrg{ 20171d7fec4Smrg# if GFX_2DACCEL_GU1 20271d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 20371d7fec4Smrg gu1_set_bpp(bpp); 20471d7fec4Smrg# endif 20571d7fec4Smrg# if GFX_2DACCEL_GU2 20671d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 20771d7fec4Smrg gu2_set_bpp(bpp); 20871d7fec4Smrg# endif 20971d7fec4Smrg} 21071d7fec4Smrg 21171d7fec4Smrg/*--------------------------------------------------------------------------- 21271d7fec4Smrg * gfx_set_solid_source 21371d7fec4Smrg *--------------------------------------------------------------------------- 21471d7fec4Smrg */ 21571d7fec4Smrgvoid 21671d7fec4Smrggfx_set_solid_source(unsigned long color) 21771d7fec4Smrg{ 21871d7fec4Smrg# if GFX_2DACCEL_GU1 21971d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 22071d7fec4Smrg gu1_set_solid_source(color); 22171d7fec4Smrg# endif 22271d7fec4Smrg# if GFX_2DACCEL_GU2 22371d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 22471d7fec4Smrg gu2_set_solid_source(color); 22571d7fec4Smrg# endif 22671d7fec4Smrg} 22771d7fec4Smrg 22871d7fec4Smrg/*--------------------------------------------------------------------------- 22971d7fec4Smrg * gfx_set_mono_source 23071d7fec4Smrg *--------------------------------------------------------------------------- 23171d7fec4Smrg */ 23271d7fec4Smrgvoid 23371d7fec4Smrggfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, 23471d7fec4Smrg unsigned short transparent) 23571d7fec4Smrg{ 23671d7fec4Smrg# if GFX_2DACCEL_GU1 23771d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 23871d7fec4Smrg gu1_set_mono_source(bgcolor, fgcolor, transparent); 23971d7fec4Smrg# endif 24071d7fec4Smrg# if GFX_2DACCEL_GU2 24171d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 24271d7fec4Smrg gu2_set_mono_source(bgcolor, fgcolor, transparent); 24371d7fec4Smrg# endif 24471d7fec4Smrg} 24571d7fec4Smrg 24671d7fec4Smrgvoid 24771d7fec4Smrggfx_set_pattern_flags(unsigned short flags) 24871d7fec4Smrg{ 24971d7fec4Smrg GFXpatternFlags |= flags; 25071d7fec4Smrg} 25171d7fec4Smrg 25271d7fec4Smrg/*--------------------------------------------------------------------------- 25371d7fec4Smrg * gfx_set_solid_pattern 25471d7fec4Smrg *--------------------------------------------------------------------------- 25571d7fec4Smrg */ 25671d7fec4Smrgvoid 25771d7fec4Smrggfx_set_solid_pattern(unsigned long color) 25871d7fec4Smrg{ 25971d7fec4Smrg# if GFX_2DACCEL_GU1 26071d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 26171d7fec4Smrg gu1_set_solid_pattern(color); 26271d7fec4Smrg# endif 26371d7fec4Smrg# if GFX_2DACCEL_GU2 26471d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 26571d7fec4Smrg gu2_set_solid_pattern(color); 26671d7fec4Smrg# endif 26771d7fec4Smrg} 26871d7fec4Smrg 26971d7fec4Smrg/*--------------------------------------------------------------------------- 27071d7fec4Smrg * gfx_set_mono_pattern 27171d7fec4Smrg *--------------------------------------------------------------------------- 27271d7fec4Smrg */ 27371d7fec4Smrgvoid 27471d7fec4Smrggfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, 27571d7fec4Smrg unsigned long data0, unsigned long data1, 27671d7fec4Smrg unsigned char transparent) 27771d7fec4Smrg{ 27871d7fec4Smrg# if GFX_2DACCEL_GU1 27971d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 28071d7fec4Smrg gu1_set_mono_pattern(bgcolor, fgcolor, data0, data1, transparent); 28171d7fec4Smrg# endif 28271d7fec4Smrg# if GFX_2DACCEL_GU2 28371d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 28471d7fec4Smrg gu2_set_mono_pattern(bgcolor, fgcolor, data0, data1, transparent); 28571d7fec4Smrg# endif 28671d7fec4Smrg} 28771d7fec4Smrg 28871d7fec4Smrg/*--------------------------------------------------------------------------- 28971d7fec4Smrg * gfx_set_color_pattern 29071d7fec4Smrg *--------------------------------------------------------------------------- 29171d7fec4Smrg */ 29271d7fec4Smrgvoid 29371d7fec4Smrggfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, 29471d7fec4Smrg unsigned long data0, unsigned long data1, 29571d7fec4Smrg unsigned long data2, unsigned long data3, 29671d7fec4Smrg unsigned char transparent) 29771d7fec4Smrg{ 29871d7fec4Smrg# if GFX_2DACCEL_GU1 29971d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 30071d7fec4Smrg gu1_set_color_pattern(bgcolor, fgcolor, data0, data1, data2, data3, 30171d7fec4Smrg transparent); 30271d7fec4Smrg# endif 30371d7fec4Smrg# if GFX_2DACCEL_GU2 30471d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 30571d7fec4Smrg gu2_set_color_pattern(bgcolor, fgcolor, data0, data1, data2, data3, 30671d7fec4Smrg transparent); 30771d7fec4Smrg# endif 30871d7fec4Smrg} 30971d7fec4Smrg 31071d7fec4Smrg/*--------------------------------------------------------------------------- 31171d7fec4Smrg * gfx_load_color_pattern_line 31271d7fec4Smrg *--------------------------------------------------------------------------- 31371d7fec4Smrg */ 31471d7fec4Smrgvoid 31571d7fec4Smrggfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) 31671d7fec4Smrg{ 31771d7fec4Smrg# if GFX_2DACCEL_GU1 31871d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 31971d7fec4Smrg gu1_load_color_pattern_line(y, pattern_8x8); 32071d7fec4Smrg# endif 32171d7fec4Smrg# if GFX_2DACCEL_GU2 32271d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 32371d7fec4Smrg gu2_load_color_pattern_line(y, pattern_8x8); 32471d7fec4Smrg# endif 32571d7fec4Smrg} 32671d7fec4Smrg 32771d7fec4Smrg/*--------------------------------------------------------------------------- 32871d7fec4Smrg * gfx_set_raster_operation 32971d7fec4Smrg *--------------------------------------------------------------------------- 33071d7fec4Smrg */ 33171d7fec4Smrgvoid 33271d7fec4Smrggfx_set_raster_operation(unsigned char rop) 33371d7fec4Smrg{ 33471d7fec4Smrg# if GFX_2DACCEL_GU1 33571d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 33671d7fec4Smrg gu1_set_raster_operation(rop); 33771d7fec4Smrg# endif 33871d7fec4Smrg# if GFX_2DACCEL_GU2 33971d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 34071d7fec4Smrg gu2_set_raster_operation(rop); 34171d7fec4Smrg# endif 34271d7fec4Smrg} 34371d7fec4Smrg 34471d7fec4Smrg/*--------------------------------------------------------------------------- 34571d7fec4Smrg * gfx_pattern_fill 34671d7fec4Smrg *--------------------------------------------------------------------------- 34771d7fec4Smrg */ 34871d7fec4Smrgvoid 34971d7fec4Smrggfx_pattern_fill(unsigned short x, unsigned short y, 35071d7fec4Smrg unsigned short width, unsigned short height) 35171d7fec4Smrg{ 35271d7fec4Smrg# if GFX_2DACCEL_GU1 35371d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 35471d7fec4Smrg gu1_pattern_fill(x, y, width, height); 35571d7fec4Smrg# endif 35671d7fec4Smrg# if GFX_2DACCEL_GU2 35771d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 35871d7fec4Smrg gu2_pattern_fill(x, y, width, height); 35971d7fec4Smrg# endif 36071d7fec4Smrg} 36171d7fec4Smrg 36271d7fec4Smrg/*--------------------------------------------------------------------------- 36371d7fec4Smrg * gfx_color_pattern_fill 36471d7fec4Smrg *--------------------------------------------------------------------------- 36571d7fec4Smrg */ 36671d7fec4Smrgvoid 36771d7fec4Smrggfx_color_pattern_fill(unsigned short x, unsigned short y, 36871d7fec4Smrg unsigned short width, unsigned short height, 36971d7fec4Smrg unsigned long *pattern) 37071d7fec4Smrg{ 37171d7fec4Smrg# if GFX_2DACCEL_GU1 37271d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 37371d7fec4Smrg gu1_color_pattern_fill(x, y, width, height, pattern); 37471d7fec4Smrg# endif 37571d7fec4Smrg# if GFX_2DACCEL_GU2 37671d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 37771d7fec4Smrg gu2_color_pattern_fill(x, y, width, height, pattern); 37871d7fec4Smrg# endif 37971d7fec4Smrg} 38071d7fec4Smrg 38171d7fec4Smrg/*--------------------------------------------------------------------------- 38271d7fec4Smrg * gfx_screen_to_screen_blt 38371d7fec4Smrg *--------------------------------------------------------------------------- 38471d7fec4Smrg */ 38571d7fec4Smrgvoid 38671d7fec4Smrggfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, 38771d7fec4Smrg unsigned short dstx, unsigned short dsty, 38871d7fec4Smrg unsigned short width, unsigned short height) 38971d7fec4Smrg{ 39071d7fec4Smrg# if GFX_2DACCEL_GU1 39171d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 39271d7fec4Smrg gu1_screen_to_screen_blt(srcx, srcy, dstx, dsty, width, height); 39371d7fec4Smrg# endif 39471d7fec4Smrg# if GFX_2DACCEL_GU2 39571d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 39671d7fec4Smrg gu2_screen_to_screen_blt(srcx, srcy, dstx, dsty, width, height); 39771d7fec4Smrg# endif 39871d7fec4Smrg} 39971d7fec4Smrg 40071d7fec4Smrg/*--------------------------------------------------------------------------- 40171d7fec4Smrg * gfx_screen_to_screen_xblt 40271d7fec4Smrg *--------------------------------------------------------------------------- 40371d7fec4Smrg */ 40471d7fec4Smrgvoid 40571d7fec4Smrggfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, 40671d7fec4Smrg unsigned short dstx, unsigned short dsty, 40771d7fec4Smrg unsigned short width, unsigned short height, 40871d7fec4Smrg unsigned long color) 40971d7fec4Smrg{ 41071d7fec4Smrg# if GFX_2DACCEL_GU1 41171d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 41271d7fec4Smrg gu1_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, color); 41371d7fec4Smrg# endif 41471d7fec4Smrg# if GFX_2DACCEL_GU2 41571d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 41671d7fec4Smrg gu2_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, color); 41771d7fec4Smrg# endif 41871d7fec4Smrg} 41971d7fec4Smrg 42071d7fec4Smrg/*--------------------------------------------------------------------------- 42171d7fec4Smrg * gfx_color_bitmap_to_screen_blt 42271d7fec4Smrg *--------------------------------------------------------------------------- 42371d7fec4Smrg */ 42471d7fec4Smrgvoid 42571d7fec4Smrggfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, 42671d7fec4Smrg unsigned short dstx, unsigned short dsty, 42771d7fec4Smrg unsigned short width, unsigned short height, 42871d7fec4Smrg unsigned char *data, long pitch) 42971d7fec4Smrg{ 43071d7fec4Smrg# if GFX_2DACCEL_GU1 43171d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 43271d7fec4Smrg gu1_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, 43371d7fec4Smrg data, pitch); 43471d7fec4Smrg# endif 43571d7fec4Smrg# if GFX_2DACCEL_GU2 43671d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 43771d7fec4Smrg gu2_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, 43871d7fec4Smrg data, pitch); 43971d7fec4Smrg# endif 44071d7fec4Smrg} 44171d7fec4Smrg 44271d7fec4Smrg/*--------------------------------------------------------------------------- 44371d7fec4Smrg * gfx_color_bitmap_to_screen_xblt 44471d7fec4Smrg *--------------------------------------------------------------------------- 44571d7fec4Smrg */ 44671d7fec4Smrgvoid 44771d7fec4Smrggfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, 44871d7fec4Smrg unsigned short dstx, unsigned short dsty, 44971d7fec4Smrg unsigned short width, unsigned short height, 45071d7fec4Smrg unsigned char *data, long pitch, 45171d7fec4Smrg unsigned long color) 45271d7fec4Smrg{ 45371d7fec4Smrg# if GFX_2DACCEL_GU1 45471d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 45571d7fec4Smrg gu1_color_bitmap_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, 45671d7fec4Smrg data, pitch, color); 45771d7fec4Smrg# endif 45871d7fec4Smrg# if GFX_2DACCEL_GU2 45971d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 46071d7fec4Smrg gu2_color_bitmap_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, 46171d7fec4Smrg data, pitch, color); 46271d7fec4Smrg# endif 46371d7fec4Smrg} 46471d7fec4Smrg 46571d7fec4Smrg/*--------------------------------------------------------------------------- 46671d7fec4Smrg * gfx_mono_bitmap_to_screen_blt 46771d7fec4Smrg *--------------------------------------------------------------------------- 46871d7fec4Smrg */ 46971d7fec4Smrgvoid 47071d7fec4Smrggfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, 47171d7fec4Smrg unsigned short dstx, unsigned short dsty, 47271d7fec4Smrg unsigned short width, unsigned short height, 47371d7fec4Smrg unsigned char *data, short pitch) 47471d7fec4Smrg{ 47571d7fec4Smrg# if GFX_2DACCEL_GU1 47671d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 47771d7fec4Smrg gu1_mono_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, 47871d7fec4Smrg data, pitch); 47971d7fec4Smrg# endif 48071d7fec4Smrg# if GFX_2DACCEL_GU2 48171d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 48271d7fec4Smrg gu2_mono_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, 48371d7fec4Smrg data, pitch); 48471d7fec4Smrg# endif 48571d7fec4Smrg} 48671d7fec4Smrg 48771d7fec4Smrg/*--------------------------------------------------------------------------- 48871d7fec4Smrg * gfx_text_blt 48971d7fec4Smrg *--------------------------------------------------------------------------- 49071d7fec4Smrg */ 49171d7fec4Smrgvoid 49271d7fec4Smrggfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, 49371d7fec4Smrg unsigned short height, unsigned char *data) 49471d7fec4Smrg{ 49571d7fec4Smrg# if GFX_2DACCEL_GU1 49671d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 49771d7fec4Smrg gu1_text_blt(dstx, dsty, width, height, data); 49871d7fec4Smrg# endif 49971d7fec4Smrg# if GFX_2DACCEL_GU2 50071d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 50171d7fec4Smrg gu2_text_blt(dstx, dsty, width, height, data); 50271d7fec4Smrg# endif 50371d7fec4Smrg} 50471d7fec4Smrg 50571d7fec4Smrg/*--------------------------------------------------------------------------- 50671d7fec4Smrg * gfx_bresenham_line 50771d7fec4Smrg *--------------------------------------------------------------------------- 50871d7fec4Smrg */ 50971d7fec4Smrgvoid 51071d7fec4Smrggfx_bresenham_line(unsigned short x, unsigned short y, 51171d7fec4Smrg unsigned short length, unsigned short initerr, 51271d7fec4Smrg unsigned short axialerr, unsigned short diagerr, 51371d7fec4Smrg unsigned short flags) 51471d7fec4Smrg{ 51571d7fec4Smrg# if GFX_2DACCEL_GU1 51671d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 51771d7fec4Smrg gu1_bresenham_line(x, y, length, initerr, axialerr, diagerr, flags); 51871d7fec4Smrg# endif 51971d7fec4Smrg# if GFX_2DACCEL_GU2 52071d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 52171d7fec4Smrg gu2_bresenham_line(x, y, length, initerr, axialerr, diagerr, flags); 52271d7fec4Smrg# endif 52371d7fec4Smrg} 52471d7fec4Smrg 52571d7fec4Smrg/*--------------------------------------------------------------------------- 52671d7fec4Smrg * gfx_wait_until_idle 52771d7fec4Smrg *--------------------------------------------------------------------------- 52871d7fec4Smrg */ 52971d7fec4Smrgvoid 53071d7fec4Smrggfx_wait_until_idle(void) 53171d7fec4Smrg{ 53271d7fec4Smrg# if GFX_2DACCEL_GU1 53371d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 53471d7fec4Smrg gu1_wait_until_idle(); 53571d7fec4Smrg# endif 53671d7fec4Smrg# if GFX_2DACCEL_GU2 53771d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 53871d7fec4Smrg gu2_wait_until_idle(); 53971d7fec4Smrg# endif 54071d7fec4Smrg} 54171d7fec4Smrg 54271d7fec4Smrg/*--------------------------------------------------------------------------- 54371d7fec4Smrg * gfx_test_blt_pending 54471d7fec4Smrg *--------------------------------------------------------------------------- 54571d7fec4Smrg */ 54671d7fec4Smrgint 54771d7fec4Smrggfx_test_blt_pending(void) 54871d7fec4Smrg{ 54971d7fec4Smrg int retval = 0; 55071d7fec4Smrg 55171d7fec4Smrg# if GFX_2DACCEL_GU1 55271d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 55371d7fec4Smrg retval = gu1_test_blt_pending(); 55471d7fec4Smrg# endif 55571d7fec4Smrg# if GFX_2DACCEL_GU2 55671d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 55771d7fec4Smrg retval = gu2_test_blt_pending(); 55871d7fec4Smrg# endif 55971d7fec4Smrg return (retval); 56071d7fec4Smrg} 56171d7fec4Smrg 56271d7fec4Smrg/*--------------------------------------------------------------------------- 56371d7fec4Smrg * NEW ROUTINES FOR REDCLOUD 56471d7fec4Smrg *--------------------------------------------------------------------------- 56571d7fec4Smrg */ 56671d7fec4Smrg 56771d7fec4Smrg/*--------------------------------------------------------------------------- 56871d7fec4Smrg * gfx2_set_source_stride 56971d7fec4Smrg *--------------------------------------------------------------------------- 57071d7fec4Smrg */ 57171d7fec4Smrgvoid 57271d7fec4Smrggfx2_set_source_stride(unsigned short stride) 57371d7fec4Smrg{ 57471d7fec4Smrg# if GFX_2DACCEL_GU2 57571d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 57671d7fec4Smrg gu22_set_source_stride(stride); 57771d7fec4Smrg# endif 57871d7fec4Smrg} 57971d7fec4Smrg 58071d7fec4Smrg/*--------------------------------------------------------------------------- 58171d7fec4Smrg * gfx2_set_destination_stride 58271d7fec4Smrg *--------------------------------------------------------------------------- 58371d7fec4Smrg */ 58471d7fec4Smrgvoid 58571d7fec4Smrggfx2_set_destination_stride(unsigned short stride) 58671d7fec4Smrg{ 58771d7fec4Smrg# if GFX_2DACCEL_GU2 58871d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 58971d7fec4Smrg gu22_set_destination_stride(stride); 59071d7fec4Smrg# endif 59171d7fec4Smrg} 59271d7fec4Smrg 59371d7fec4Smrg/*--------------------------------------------------------------------------- 59471d7fec4Smrg * gfx2_set_pattern_origin 59571d7fec4Smrg *--------------------------------------------------------------------------- 59671d7fec4Smrg */ 59771d7fec4Smrgvoid 59871d7fec4Smrggfx2_set_pattern_origin(int x, int y) 59971d7fec4Smrg{ 60071d7fec4Smrg# if GFX_2DACCEL_GU2 60171d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 60271d7fec4Smrg gu22_set_pattern_origin(x, y); 60371d7fec4Smrg# endif 60471d7fec4Smrg} 60571d7fec4Smrg 60671d7fec4Smrg/*--------------------------------------------------------------------------- 60771d7fec4Smrg * gfx2_set_source_transparency 60871d7fec4Smrg *--------------------------------------------------------------------------- 60971d7fec4Smrg */ 61071d7fec4Smrgvoid 61171d7fec4Smrggfx2_set_source_transparency(unsigned long color, unsigned long mask) 61271d7fec4Smrg{ 61371d7fec4Smrg# if GFX_2DACCEL_GU2 61471d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 61571d7fec4Smrg gu22_set_source_transparency(color, mask); 61671d7fec4Smrg# endif 61771d7fec4Smrg} 61871d7fec4Smrg 61971d7fec4Smrg/*--------------------------------------------------------------------------- 62071d7fec4Smrg * gfx2_set_alpha_mode 62171d7fec4Smrg *--------------------------------------------------------------------------- 62271d7fec4Smrg */ 62371d7fec4Smrgvoid 62471d7fec4Smrggfx2_set_alpha_mode(int mode) 62571d7fec4Smrg{ 62671d7fec4Smrg# if GFX_2DACCEL_GU2 62771d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 62871d7fec4Smrg gu22_set_alpha_mode(mode); 62971d7fec4Smrg# endif 63071d7fec4Smrg} 63171d7fec4Smrg 63271d7fec4Smrg/*--------------------------------------------------------------------------- 63371d7fec4Smrg * gfx2_set_alpha_value 63471d7fec4Smrg *--------------------------------------------------------------------------- 63571d7fec4Smrg */ 63671d7fec4Smrgvoid 63771d7fec4Smrggfx2_set_alpha_value(unsigned char value) 63871d7fec4Smrg{ 63971d7fec4Smrg# if GFX_2DACCEL_GU2 64071d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 64171d7fec4Smrg gu22_set_alpha_value(value); 64271d7fec4Smrg# endif 64371d7fec4Smrg} 64471d7fec4Smrg 64571d7fec4Smrg/*--------------------------------------------------------------------------- 64671d7fec4Smrg * gfx2_pattern_fill 64771d7fec4Smrg *--------------------------------------------------------------------------- 64871d7fec4Smrg */ 64971d7fec4Smrgvoid 65071d7fec4Smrggfx2_pattern_fill(unsigned long dstoffset, unsigned short width, 65171d7fec4Smrg unsigned short height) 65271d7fec4Smrg{ 65371d7fec4Smrg# if GFX_2DACCEL_GU2 65471d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 65571d7fec4Smrg gu22_pattern_fill(dstoffset, width, height); 65671d7fec4Smrg# endif 65771d7fec4Smrg} 65871d7fec4Smrg 65971d7fec4Smrg/*--------------------------------------------------------------------------- 66071d7fec4Smrg * gfx2_color_pattern_fill 66171d7fec4Smrg *--------------------------------------------------------------------------- 66271d7fec4Smrg */ 66371d7fec4Smrgvoid 66471d7fec4Smrggfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, 66571d7fec4Smrg unsigned short height, unsigned long *pattern) 66671d7fec4Smrg{ 66771d7fec4Smrg# if GFX_2DACCEL_GU2 66871d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 66971d7fec4Smrg gu22_color_pattern_fill(dstoffset, width, height, pattern); 67071d7fec4Smrg# endif 67171d7fec4Smrg} 67271d7fec4Smrg 67371d7fec4Smrg/*--------------------------------------------------------------------------- 67471d7fec4Smrg * gfx2_screen_to_screen_blt 67571d7fec4Smrg *--------------------------------------------------------------------------- 67671d7fec4Smrg */ 67771d7fec4Smrgvoid 67871d7fec4Smrggfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, 67971d7fec4Smrg unsigned short width, unsigned short height, 68071d7fec4Smrg int flags) 68171d7fec4Smrg{ 68271d7fec4Smrg# if GFX_2DACCEL_GU2 68371d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 68471d7fec4Smrg gu22_screen_to_screen_blt(srcoffset, dstoffset, width, height, flags); 68571d7fec4Smrg# endif 68671d7fec4Smrg} 68771d7fec4Smrg 68871d7fec4Smrg/*--------------------------------------------------------------------------- 68971d7fec4Smrg * gfx2_mono_expand_blt 69071d7fec4Smrg *--------------------------------------------------------------------------- 69171d7fec4Smrg */ 69271d7fec4Smrgvoid 69371d7fec4Smrggfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, 69471d7fec4Smrg unsigned short srcy, unsigned long dstoffset, 69571d7fec4Smrg unsigned short width, unsigned short height, 69671d7fec4Smrg int byte_packed) 69771d7fec4Smrg{ 69871d7fec4Smrg# if GFX_2DACCEL_GU2 69971d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 70071d7fec4Smrg gu22_mono_expand_blt(srcbase, srcx, srcy, dstoffset, width, height, 70171d7fec4Smrg byte_packed); 70271d7fec4Smrg# endif 70371d7fec4Smrg} 70471d7fec4Smrg 70571d7fec4Smrg/*--------------------------------------------------------------------------- 70671d7fec4Smrg * gfx2_color_bitmap_to_screen_blt 70771d7fec4Smrg *--------------------------------------------------------------------------- 70871d7fec4Smrg */ 70971d7fec4Smrgvoid 71071d7fec4Smrggfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, 71171d7fec4Smrg unsigned long dstoffset, unsigned short width, 71271d7fec4Smrg unsigned short height, unsigned char *data, 71371d7fec4Smrg short pitch) 71471d7fec4Smrg{ 71571d7fec4Smrg# if GFX_2DACCEL_GU2 71671d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 71771d7fec4Smrg gu22_color_bitmap_to_screen_blt(srcx, srcy, dstoffset, width, height, 71871d7fec4Smrg data, pitch); 71971d7fec4Smrg# endif 72071d7fec4Smrg} 72171d7fec4Smrg 72271d7fec4Smrg/*--------------------------------------------------------------------------- 72371d7fec4Smrg * gfx2_text_blt 72471d7fec4Smrg *--------------------------------------------------------------------------- 72571d7fec4Smrg */ 72671d7fec4Smrgvoid 72771d7fec4Smrggfx2_text_blt(unsigned long dstoffset, unsigned short width, 72871d7fec4Smrg unsigned short height, unsigned char *data) 72971d7fec4Smrg{ 73071d7fec4Smrg# if GFX_2DACCEL_GU2 73171d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 73271d7fec4Smrg gu22_text_blt(dstoffset, width, height, data); 73371d7fec4Smrg# endif 73471d7fec4Smrg} 73571d7fec4Smrg 73671d7fec4Smrg/*--------------------------------------------------------------------------- 73771d7fec4Smrg * gfx2_mono_bitmap_to_screen_blt 73871d7fec4Smrg *--------------------------------------------------------------------------- 73971d7fec4Smrg */ 74071d7fec4Smrgvoid 74171d7fec4Smrggfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, 74271d7fec4Smrg unsigned long dstoffset, unsigned short width, 74371d7fec4Smrg unsigned short height, unsigned char *data, 74471d7fec4Smrg short pitch) 74571d7fec4Smrg{ 74671d7fec4Smrg# if GFX_2DACCEL_GU2 74771d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 74871d7fec4Smrg gu22_mono_bitmap_to_screen_blt(srcx, srcy, dstoffset, width, height, 74971d7fec4Smrg data, pitch); 75071d7fec4Smrg# endif 75171d7fec4Smrg} 75271d7fec4Smrg 75371d7fec4Smrg/*--------------------------------------------------------------------------- 75471d7fec4Smrg * gfx2_bresenham_line 75571d7fec4Smrg *--------------------------------------------------------------------------- 75671d7fec4Smrg */ 75771d7fec4Smrgvoid 75871d7fec4Smrggfx2_bresenham_line(unsigned long dstoffset, 75971d7fec4Smrg unsigned short length, unsigned short initerr, 76071d7fec4Smrg unsigned short axialerr, unsigned short diagerr, 76171d7fec4Smrg unsigned short flags) 76271d7fec4Smrg{ 76371d7fec4Smrg# if GFX_2DACCEL_GU2 76471d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 76571d7fec4Smrg gu22_bresenham_line(dstoffset, length, initerr, axialerr, diagerr, 76671d7fec4Smrg flags); 76771d7fec4Smrg# endif 76871d7fec4Smrg} 76971d7fec4Smrg 77071d7fec4Smrg/*--------------------------------------------------------------------------- 77171d7fec4Smrg * gfx2_sync_to_vblank 77271d7fec4Smrg *--------------------------------------------------------------------------- 77371d7fec4Smrg */ 77471d7fec4Smrgvoid 77571d7fec4Smrggfx2_sync_to_vblank(void) 77671d7fec4Smrg{ 77771d7fec4Smrg# if GFX_2DACCEL_GU2 77871d7fec4Smrg if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 77971d7fec4Smrg gu22_sync_to_vblank(); 78071d7fec4Smrg# endif 78171d7fec4Smrg} 78271d7fec4Smrg 78371d7fec4Smrg#endif /* GFX_2DACCEL_DYNAMIC */ 78471d7fec4Smrg 78571d7fec4Smrg/* END OF FILE */ 78671d7fec4Smrg 787