diff options
author | jrfonseca <jrfonseca> | 2003-09-30 22:43:22 +0000 |
---|---|---|
committer | jrfonseca <jrfonseca> | 2003-09-30 22:43:22 +0000 |
commit | a39039a988a0c87182ec1f20ce39c78ba455b8cf (patch) | |
tree | 40c24193470c7d837b8e870d13e4303bfbe4ef4e | |
parent | bdd30a13c1b7a8609117ba1b13b47a1fd11ddba9 (diff) |
Initial import of VIA's CLE266 driver plus Alan Cox changes to bring the 3D driver to version 4.3.0.cle266-0-0-1-branch
91 files changed, 54562 insertions, 12472 deletions
diff --git a/xc/config/cf/host.def b/xc/config/cf/host.def index 2edf5d8a4..5bc43efc3 100644 --- a/xc/config/cf/host.def +++ b/xc/config/cf/host.def @@ -26,18 +26,18 @@ #if defined(PpcArchitecture) -#define XF86CardDrivers ati -#define DriDrivers r128 radeon r200 +#define XF86CardDrivers via +#define DriDrivers via #elif defined(i386Architecture) -#define XF86CardDrivers tdfx i810 mga ati glint vga -#define DriDrivers r200 tdfx mga i810 r128 radeon gamma i830 ffb sis +#define XF86CardDrivers via +#define DriDrivers via #else -#define XF86CardDrivers tdfx mga ati glint vga -#define DriDrivers r200 tdfx mga r128 radeon gamma ffb +#define XF86CardDrivers via +#define DriDrivers via #endif diff --git a/xc/lib/GL/mesa/src/drv/via/Imakefile b/xc/lib/GL/mesa/src/drv/via/Imakefile new file mode 100644 index 000000000..db335fc0b --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/Imakefile @@ -0,0 +1,82 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/via/Imakefile,v 1.21 2002/02/23 00:45:49 dawes Exp $ + +#include <Threads.tmpl> + +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoExtraLib SharedLibGlx +#define DoDebugLib DebugLibGlx +#define DoProfileLib ProfileLibGlx +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtrasLib NO +#define DoDebugLib Yes +#define DoProfileLib NO +#endif + +#include "../common/Imakefile.inc" +#include "Imakefile.inc" +#include "../../array_cache/Imakefile.inc" +#include "../../math/Imakefile.inc" +#include "../../swrast/Imakefile.inc" +#include "../../swrast_setup/Imakefile.inc" +#include "../../tnl/Imakefile.inc" +#include "../../tnl_dd/Imakefile.inc" +#include "../../Imakefile.inc" +#if defined(i386Architecture) && MesaUseX86Asm +#include "../../X86/Imakefile.inc" +#endif +#ifdef SparcArchitecture +#include "../../SPARC/Imakefile.inc" +#endif + + + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) + INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) + + DRIOBJS = $(GLXLIBSRC)/dri/dri_util.o + + DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ + $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ + $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ + $(GLXLIBSRC)/dri/drm/xf86drmSL.o + +#ifdef GlxSoProf + LOSRCS = ../../../../lowpc.c + HISRCS = ../../../../highpc.c + + LOOBJS = ../../../../lowpc.o + HIOBJS = ../../../../highpc.o +#endif + + SRCS = $(VIASRCS) + OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \ + $(MESA_ASM_OBJS) $(COMMONOBJS) $(VIAOBJS) $(HIOBJS) + +/* support saam */ +#REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) +REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) -lXinerama + +#include <Library.tmpl> + +LibraryObjectRule() + +SubdirLibraryRule($(VIAOBJS)) +NormalLintTarget($(SRCS)) + +#if !GlxUseBuiltInDRIDriver +LIBNAME = via_dri.so +SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) +InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) + +#ifdef GlxSoProf +SOPROF_LIBNAME = _via_dri_p +NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) +InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) +#endif +#endif + +DependTarget() + diff --git a/xc/lib/GL/mesa/src/drv/via/Imakefile.inc b/xc/lib/GL/mesa/src/drv/via/Imakefile.inc new file mode 100644 index 000000000..bf7c1b66a --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/Imakefile.inc @@ -0,0 +1,121 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/via/Imakefile.inc,v 1.2 2001/05/02 15:06:03 dawes Exp $ + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + +#ifndef MesaDrvVIABuildDir +#define MesaDrvVIABuildDir /**/ +#endif +MESADRVVIABUILDDIR = MesaDrvVIABuildDir + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +#if BuildXF86DRI + DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER) + DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ + -I$(GLXLIBSRC)/glx \ + -I$(INCLUDESRC) \ + -I$(INCLUDESRC)/GL \ + -I$(SERVERSRC)/GL/dri \ + -I$(XF86OSSRC) \ + -I$(XF86DRIVERSRC)/via \ + -I$(XF86COMSRC) \ + -I$(GLXLIBSRC)/dri/drm \ + -I$(GLXLIBSRC)/include +#endif + +MESA_INCLUDES = -I$(MESASRCDIR)/src \ + -I$(MESADRVSRCDIR)/common \ + -I$(MESADRVSRCDIR)/via + X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) + + VIASRCS = $(MESADRVVIABUILDDIR)via_context.c \ + $(MESADRVVIABUILDDIR)via_ioctl.c \ + $(MESADRVVIABUILDDIR)via_render.c \ + $(MESADRVVIABUILDDIR)via_screen.c \ + $(MESADRVVIABUILDDIR)via_span.c \ + $(MESADRVVIABUILDDIR)via_state.c \ + $(MESADRVVIABUILDDIR)via_tex.c \ + $(MESADRVVIABUILDDIR)via_texmem.c \ + $(MESADRVVIABUILDDIR)via_texstate.c \ + $(MESADRVVIABUILDDIR)via_tris.c \ + $(MESADRVVIABUILDDIR)via_fb.c \ + $(MESADRVVIABUILDDIR)xf86drmVIA.c \ + $(MESADRVVIABUILDDIR)via_vb.c + + VIAOBJS = $(MESADRVVIABUILDDIR)via_context.o \ + $(MESADRVVIABUILDDIR)via_ioctl.o \ + $(MESADRVVIABUILDDIR)via_render.o \ + $(MESADRVVIABUILDDIR)via_screen.o \ + $(MESADRVVIABUILDDIR)via_span.o \ + $(MESADRVVIABUILDDIR)via_state.o \ + $(MESADRVVIABUILDDIR)via_tex.o \ + $(MESADRVVIABUILDDIR)via_texmem.o \ + $(MESADRVVIABUILDDIR)via_texstate.o \ + $(MESADRVVIABUILDDIR)via_tris.o \ + $(MESADRVVIABUILDDIR)via_fb.o \ + $(MESADRVVIABUILDDIR)xf86drmVIA.o \ + $(MESADRVVIABUILDDIR)via_vb.o + + VIAUOBJS = $(MESADRVVIABUILDDIR)unshared/via_context.o \ + $(MESADRVVIABUILDDIR)unshared/via_ioctl.o \ + $(MESADRVVIABUILDDIR)unshared/via_render.o \ + $(MESADRVVIABUILDDIR)unshared/via_screen.o \ + $(MESADRVVIABUILDDIR)unshared/via_span.o \ + $(MESADRVVIABUILDDIR)unshared/via_state.o \ + $(MESADRVVIABUILDDIR)unshared/via_tex.o \ + $(MESADRVVIABUILDDIR)unshared/via_texmem.o \ + $(MESADRVVIABUILDDIR)unshared/via_texstate.o \ + $(MESADRVVIABUILDDIR)unshared/via_tris.o \ + $(MESADRVVIABUILDDIR)unshared/via_fb.o \ + $(MESADRVVIABUILDDIR)unshared/xf86drmVIA.o \ + $(MESADRVVIABUILDDIR)unshared/via_vb.o + + VIADOBJS = $(MESADRVVIABUILDDIR)debugger/via_context.o \ + $(MESADRVVIABUILDDIR)debugger/via_ioctl.o \ + $(MESADRVVIABUILDDIR)debugger/via_render.o \ + $(MESADRVVIABUILDDIR)debugger/via_screen.o \ + $(MESADRVVIABUILDDIR)debugger/via_span.o \ + $(MESADRVVIABUILDDIR)debugger/via_state.o \ + $(MESADRVVIABUILDDIR)debugger/via_tex.o \ + $(MESADRVVIABUILDDIR)debugger/via_texmem.o \ + $(MESADRVVIABUILDDIR)debugger/via_texstate.o \ + $(MESADRVVIABUILDDIR)debugger/via_tris.o \ + $(MESADRVVIABUILDDIR)debugger/via_fb.o \ + $(MESADRVVIABUILDDIR)debugger/xf86drmVIA.o \ + $(MESADRVVIABUILDDIR)debugger/via_vb.o + + VIAPOBJS = $(MESADRVVIABUILDDIR)profiled/via_context.o \ + $(MESADRVVIABUILDDIR)profiled/via_ioctl.o \ + $(MESADRVVIABUILDDIR)profiled/via_render.o \ + $(MESADRVVIABUILDDIR)profiled/via_screen.o \ + $(MESADRVVIABUILDDIR)profiled/via_span.o \ + $(MESADRVVIABUILDDIR)profiled/via_state.o \ + $(MESADRVVIABUILDDIR)profiled/via_tex.o \ + $(MESADRVVIABUILDDIR)profiled/via_texmem.o \ + $(MESADRVVIABUILDDIR)profiled/via_texstate.o \ + $(MESADRVVIABUILDDIR)profiled/via_tris.o \ + $(MESADRVVIABUILDDIR)profiled/via_fb.o \ + $(MESADRVVIABUILDDIR)profiled/xf86drmVIA.o \ + $(MESADRVVIABUILDDIR)profiled/via_vb.o + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(via_context.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_ioctl.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_render.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_screen.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_span.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_state.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_tex.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_texmem.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_texstate.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_tris.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_fb.c, $(MESADRVSRCDIR)/via) +LinkSourceFile(via_vb.c, $(MESADRVSRCDIR)/via) +#endif + diff --git a/xc/lib/GL/mesa/src/drv/via/via_3d_reg.h b/xc/lib/GL/mesa/src/drv/via/via_3d_reg.h new file mode 100644 index 000000000..97f37ada3 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_3d_reg.h @@ -0,0 +1,1640 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef VIA_3D_REG_H +#define VIA_3D_REG_H +#define HC_REG_BASE 0x0400 + +#define HC_ParaN_MASK 0xffffffff +#define HC_Para_MASK 0x00ffffff +#define HC_SubA_MASK 0xff000000 +#define HC_SubA_SHIFT 24 +/* Transmission Setting + */ +#define HC_REG_TRANS_SET 0x003c +#define HC_ParaSubType_MASK 0xff000000 +#define HC_ParaType_MASK 0x00ff0000 +#define HC_ParaOS_MASK 0x0000ff00 +#define HC_ParaAdr_MASK 0x000000ff +#define HC_ParaSubType_SHIFT 24 +#define HC_ParaType_SHIFT 16 +#define HC_ParaOS_SHIFT 8 +#define HC_ParaAdr_SHIFT 0 + +#define HC_ParaType_CmdVdata 0x0000 +#define HC_ParaType_NotTex 0x0001 +#define HC_ParaType_Tex 0x0002 +#define HC_ParaType_Palette 0x0003 +#define HC_ParaType_PreCR 0x0010 +#define HC_ParaType_Auto 0x00fe + +/* Transmission Space + */ +#define HC_REG_Hpara0 0x0040 +#define HC_REG_HpataAF 0x02fc + +/* Read + */ +#define HC_REG_HREngSt 0x0000 +#define HC_REG_HRFIFOempty 0x0004 +#define HC_REG_HRFIFOfull 0x0008 +#define HC_REG_HRErr 0x000c +#define HC_REG_FIFOstatus 0x0010 +/* HC_REG_HREngSt 0x0000 + */ +#define HC_HDASZC_MASK 0x00010000 +#define HC_HSGEMI_MASK 0x0000f000 +#define HC_HLGEMISt_MASK 0x00000f00 +#define HC_HCRSt_MASK 0x00000080 +#define HC_HSE0St_MASK 0x00000040 +#define HC_HSE1St_MASK 0x00000020 +#define HC_HPESt_MASK 0x00000010 +#define HC_HXESt_MASK 0x00000008 +#define HC_HBESt_MASK 0x00000004 +#define HC_HE2St_MASK 0x00000002 +#define HC_HE3St_MASK 0x00000001 +/* HC_REG_HRFIFOempty 0x0004 + */ +#define HC_HRZDempty_MASK 0x00000010 +#define HC_HRTXAempty_MASK 0x00000008 +#define HC_HRTXDempty_MASK 0x00000004 +#define HC_HWZDempty_MASK 0x00000002 +#define HC_HWCDempty_MASK 0x00000001 +/* HC_REG_HRFIFOfull 0x0008 + */ +#define HC_HRZDfull_MASK 0x00000010 +#define HC_HRTXAfull_MASK 0x00000008 +#define HC_HRTXDfull_MASK 0x00000004 +#define HC_HWZDfull_MASK 0x00000002 +#define HC_HWCDfull_MASK 0x00000001 +/* HC_REG_HRErr 0x000c + */ +#define HC_HAGPCMErr_MASK 0x80000000 +#define HC_HAGPCMErrC_MASK 0x70000000 +/* HC_REG_FIFOstatus 0x0010 + */ +#define HC_HRFIFOATall_MASK 0x80000000 +#define HC_HRFIFOATbusy_MASK 0x40000000 +#define HC_HRATFGMDo_MASK 0x00000100 +#define HC_HRATFGMDi_MASK 0x00000080 +#define HC_HRATFRZD_MASK 0x00000040 +#define HC_HRATFRTXA_MASK 0x00000020 +#define HC_HRATFRTXD_MASK 0x00000010 +#define HC_HRATFWZD_MASK 0x00000008 +#define HC_HRATFWCD_MASK 0x00000004 +#define HC_HRATTXTAG_MASK 0x00000002 +#define HC_HRATTXCH_MASK 0x00000001 + +/* AGP Command Setting + */ +#define HC_SubA_HAGPBstL 0x0060 +#define HC_SubA_HAGPBendL 0x0061 +#define HC_SubA_HAGPCMNT 0x0062 +#define HC_SubA_HAGPBpL 0x0063 +#define HC_SubA_HAGPBpH 0x0064 +/* HC_SubA_HAGPCMNT 0x0062 + */ +#define HC_HAGPCMNT_MASK 0x00800000 +#define HC_HCmdErrClr_MASK 0x00400000 +#define HC_HAGPBendH_MASK 0x0000ff00 +#define HC_HAGPBstH_MASK 0x000000ff +#define HC_HAGPBendH_SHIFT 8 +#define HC_HAGPBstH_SHIFT 0 +/* HC_SubA_HAGPBpL 0x0063 + */ +#define HC_HAGPBpL_MASK 0x00fffffc +#define HC_HAGPBpID_MASK 0x00000003 +#define HC_HAGPBpID_PAUSE 0x00000000 +#define HC_HAGPBpID_JUMP 0x00000001 +#define HC_HAGPBpID_STOP 0x00000002 +/* HC_SubA_HAGPBpH 0x0064 + */ +#define HC_HAGPBpH_MASK 0x00ffffff + +/* Miscellaneous Settings + */ +#define HC_SubA_HClipTB 0x0070 +#define HC_SubA_HClipLR 0x0071 +#define HC_SubA_HFPClipTL 0x0072 +#define HC_SubA_HFPClipBL 0x0073 +#define HC_SubA_HFPClipLL 0x0074 +#define HC_SubA_HFPClipRL 0x0075 +#define HC_SubA_HFPClipTBH 0x0076 +#define HC_SubA_HFPClipLRH 0x0077 +#define HC_SubA_HLP 0x0078 +#define HC_SubA_HLPRF 0x0079 +#define HC_SubA_HSolidCL 0x007a +#define HC_SubA_HPixGC 0x007b +#define HC_SubA_HSPXYOS 0x007c +#define HC_SubA_HVertexCNT 0x007d + +#define HC_HClipT_MASK 0x00fff000 +#define HC_HClipT_SHIFT 12 +#define HC_HClipB_MASK 0x00000fff +#define HC_HClipB_SHIFT 0 +#define HC_HClipL_MASK 0x00fff000 +#define HC_HClipL_SHIFT 12 +#define HC_HClipR_MASK 0x00000fff +#define HC_HClipR_SHIFT 0 +#define HC_HFPClipBH_MASK 0x0000ff00 +#define HC_HFPClipBH_SHIFT 8 +#define HC_HFPClipTH_MASK 0x000000ff +#define HC_HFPClipTH_SHIFT 0 +#define HC_HFPClipRH_MASK 0x0000ff00 +#define HC_HFPClipRH_SHIFT 8 +#define HC_HFPClipLH_MASK 0x000000ff +#define HC_HFPClipLH_SHIFT 0 +#define HC_HSolidCH_MASK 0x000000ff +#define HC_HPixGC_MASK 0x00800000 +#define HC_HSPXOS_MASK 0x00fff000 +#define HC_HSPXOS_SHIFT 12 +#define HC_HSPYOS_MASK 0x00000fff + +/* Command + * Command A + */ +#define HC_HCmdHeader_MASK 0xfe000000 /*0xffe00000*/ +#define HC_HE3Fire_MASK 0x00100000 +#define HC_HPMType_MASK 0x000f0000 +#define HC_HEFlag_MASK 0x0000e000 +#define HC_HShading_MASK 0x00001c00 +#define HC_HPMValidN_MASK 0x00000200 +#define HC_HPLEND_MASK 0x00000100 +#define HC_HVCycle_MASK 0x000000ff +#define HC_HVCycle_Style_MASK 0x000000c0 +#define HC_HVCycle_ChgA_MASK 0x00000030 +#define HC_HVCycle_ChgB_MASK 0x0000000c +#define HC_HVCycle_ChgC_MASK 0x00000003 +#define HC_HPMType_Point 0x00000000 +#define HC_HPMType_Line 0x00010000 +#define HC_HPMType_Tri 0x00020000 +#define HC_HPMType_TriWF 0x00040000 +#define HC_HEFlag_NoAA 0x00000000 +#define HC_HEFlag_ab 0x00008000 +#define HC_HEFlag_bc 0x00004000 +#define HC_HEFlag_ca 0x00002000 +#define HC_HShading_Solid 0x00000000 +#define HC_HShading_FlatA 0x00000400 +#define HC_HShading_FlatB 0x00000800 +#define HC_HShading_FlatC 0x00000c00 +#define HC_HShading_Gouraud 0x00001000 +#define HC_HVCycle_Full 0x00000000 +#define HC_HVCycle_AFP 0x00000040 +#define HC_HVCycle_One 0x000000c0 +#define HC_HVCycle_NewA 0x00000000 +#define HC_HVCycle_AA 0x00000010 +#define HC_HVCycle_AB 0x00000020 +#define HC_HVCycle_AC 0x00000030 +#define HC_HVCycle_NewB 0x00000000 +#define HC_HVCycle_BA 0x00000004 +#define HC_HVCycle_BB 0x00000008 +#define HC_HVCycle_BC 0x0000000c +#define HC_HVCycle_NewC 0x00000000 +#define HC_HVCycle_CA 0x00000001 +#define HC_HVCycle_CB 0x00000002 +#define HC_HVCycle_CC 0x00000003 + +/* Command B + */ +#define HC_HLPrst_MASK 0x00010000 +#define HC_HLLastP_MASK 0x00008000 +#define HC_HVPMSK_MASK 0x00007f80 +#define HC_HBFace_MASK 0x00000040 +#define HC_H2nd1VT_MASK 0x0000003f +#define HC_HVPMSK_X 0x00004000 +#define HC_HVPMSK_Y 0x00002000 +#define HC_HVPMSK_Z 0x00001000 +#define HC_HVPMSK_W 0x00000800 +#define HC_HVPMSK_Cd 0x00000400 +#define HC_HVPMSK_Cs 0x00000200 +#define HC_HVPMSK_S 0x00000100 +#define HC_HVPMSK_T 0x00000080 + +/* Enable Setting + */ +#define HC_SubA_HEnable 0x0000 +#define HC_HenTXEnvMap_MASK 0x00200000 +#define HC_HenVertexCNT_MASK 0x00100000 +#define HC_HenCPUDAZ_MASK 0x00080000 +#define HC_HenDASZWC_MASK 0x00040000 +#define HC_HenFBCull_MASK 0x00020000 +#define HC_HenCW_MASK 0x00010000 +#define HC_HenAA_MASK 0x00008000 +#define HC_HenST_MASK 0x00004000 +#define HC_HenZT_MASK 0x00002000 +#define HC_HenZW_MASK 0x00001000 +#define HC_HenAT_MASK 0x00000800 +#define HC_HenAW_MASK 0x00000400 +#define HC_HenSP_MASK 0x00000200 +#define HC_HenLP_MASK 0x00000100 +#define HC_HenTXCH_MASK 0x00000080 +#define HC_HenTXMP_MASK 0x00000040 +#define HC_HenTXPP_MASK 0x00000020 +#define HC_HenTXTR_MASK 0x00000010 +#define HC_HenCS_MASK 0x00000008 +#define HC_HenFOG_MASK 0x00000004 +#define HC_HenABL_MASK 0x00000002 +#define HC_HenDT_MASK 0x00000001 + +/* Z Setting + */ +#define HC_SubA_HZWBBasL 0x0010 +#define HC_SubA_HZWBBasH 0x0011 +#define HC_SubA_HZWBType 0x0012 +#define HC_SubA_HZBiasL 0x0013 +#define HC_SubA_HZWBend 0x0014 +#define HC_SubA_HZWTMD 0x0015 +#define HC_SubA_HZWCDL 0x0016 +#define HC_SubA_HZWCTAGnum 0x0017 +#define HC_SubA_HZCYNum 0x0018 +#define HC_SubA_HZWCFire 0x0019 +/* HC_SubA_HZWBType + */ +#define HC_HZWBType_MASK 0x00800000 +#define HC_HZBiasedWB_MASK 0x00400000 +#define HC_HZONEasFF_MASK 0x00200000 +#define HC_HZOONEasFF_MASK 0x00100000 +#define HC_HZWBFM_MASK 0x00030000 +#define HC_HZWBLoc_MASK 0x0000c000 +#define HC_HZWBPit_MASK 0x00003fff +#define HC_HZWBFM_16 0x00000000 +#define HC_HZWBFM_32 0x00020000 +#define HC_HZWBFM_24 0x00030000 +#define HC_HZWBLoc_Local 0x00000000 +#define HC_HZWBLoc_SyS 0x00004000 +/* HC_SubA_HZWBend + */ +#define HC_HZWBend_MASK 0x00ffe000 +#define HC_HZBiasH_MASK 0x000000ff +#define HC_HZWBend_SHIFT 10 +/* HC_SubA_HZWTMD + */ +#define HC_HZWTMD_MASK 0x00070000 +#define HC_HEBEBias_MASK 0x00007f00 +#define HC_HZNF_MASK 0x000000ff +#define HC_HZWTMD_NeverPass 0x00000000 +#define HC_HZWTMD_LT 0x00010000 +#define HC_HZWTMD_EQ 0x00020000 +#define HC_HZWTMD_LE 0x00030000 +#define HC_HZWTMD_GT 0x00040000 +#define HC_HZWTMD_NE 0x00050000 +#define HC_HZWTMD_GE 0x00060000 +#define HC_HZWTMD_AllPass 0x00070000 +#define HC_HEBEBias_SHIFT 8 +/* HC_SubA_HZWCDL 0x0016 + */ +#define HC_HZWCDL_MASK 0x00ffffff +/* HC_SubA_HZWCTAGnum 0x0017 + */ +#define HC_HZWCTAGnum_MASK 0x00ff0000 +#define HC_HZWCTAGnum_SHIFT 16 +#define HC_HZWCDH_MASK 0x000000ff +#define HC_HZWCDH_SHIFT 0 +/* HC_SubA_HZCYNum 0x0018 + */ +#define HC_HZCYNum_MASK 0x00030000 +#define HC_HZCYNum_SHIFT 16 +#define HC_HZWCQWnum_MASK 0x00003fff +#define HC_HZWCQWnum_SHIFT 0 +/* HC_SubA_HZWCFire 0x0019 + */ +#define HC_ZWCFire_MASK 0x00010000 +#define HC_HZWCQWnumLast_MASK 0x00003fff +#define HC_HZWCQWnumLast_SHIFT 0 + +/* Stencil Setting + */ +#define HC_SubA_HSTREF 0x0023 +#define HC_SubA_HSTMD 0x0024 +/* HC_SubA_HSBFM + */ +#define HC_HSBFM_MASK 0x00030000 +#define HC_HSBLoc_MASK 0x0000c000 +#define HC_HSBPit_MASK 0x00003fff +/* HC_SubA_HSTREF + */ +#define HC_HSTREF_MASK 0x00ff0000 +#define HC_HSTOPMSK_MASK 0x0000ff00 +#define HC_HSTBMSK_MASK 0x000000ff +#define HC_HSTREF_SHIFT 16 +#define HC_HSTOPMSK_SHIFT 8 +/* HC_SubA_HSTMD + */ +#define HC_HSTMD_MASK 0x00070000 +#define HC_HSTOPSF_MASK 0x000001c0 +#define HC_HSTOPSPZF_MASK 0x00000038 +#define HC_HSTOPSPZP_MASK 0x00000007 +#define HC_HSTMD_NeverPass 0x00000000 +#define HC_HSTMD_LT 0x00010000 +#define HC_HSTMD_EQ 0x00020000 +#define HC_HSTMD_LE 0x00030000 +#define HC_HSTMD_GT 0x00040000 +#define HC_HSTMD_NE 0x00050000 +#define HC_HSTMD_GE 0x00060000 +#define HC_HSTMD_AllPass 0x00070000 +#define HC_HSTOPSF_KEEP 0x00000000 +#define HC_HSTOPSF_ZERO 0x00000040 +#define HC_HSTOPSF_REPLACE 0x00000080 +#define HC_HSTOPSF_INCRSAT 0x000000c0 +#define HC_HSTOPSF_DECRSAT 0x00000100 +#define HC_HSTOPSF_INVERT 0x00000140 +#define HC_HSTOPSF_INCR 0x00000180 +#define HC_HSTOPSF_DECR 0x000001c0 +#define HC_HSTOPSPZF_KEEP 0x00000000 +#define HC_HSTOPSPZF_ZERO 0x00000008 +#define HC_HSTOPSPZF_REPLACE 0x00000010 +#define HC_HSTOPSPZF_INCRSAT 0x00000018 +#define HC_HSTOPSPZF_DECRSAT 0x00000020 +#define HC_HSTOPSPZF_INVERT 0x00000028 +#define HC_HSTOPSPZF_INCR 0x00000030 +#define HC_HSTOPSPZF_DECR 0x00000038 +#define HC_HSTOPSPZP_KEEP 0x00000000 +#define HC_HSTOPSPZP_ZERO 0x00000001 +#define HC_HSTOPSPZP_REPLACE 0x00000002 +#define HC_HSTOPSPZP_INCRSAT 0x00000003 +#define HC_HSTOPSPZP_DECRSAT 0x00000004 +#define HC_HSTOPSPZP_INVERT 0x00000005 +#define HC_HSTOPSPZP_INCR 0x00000006 +#define HC_HSTOPSPZP_DECR 0x00000007 + +/* Alpha Setting + */ +#define HC_SubA_HABBasL 0x0030 +#define HC_SubA_HABBasH 0x0031 +#define HC_SubA_HABFM 0x0032 +#define HC_SubA_HATMD 0x0033 +#define HC_SubA_HABLCsat 0x0034 +#define HC_SubA_HABLCop 0x0035 +#define HC_SubA_HABLAsat 0x0036 +#define HC_SubA_HABLAop 0x0037 +#define HC_SubA_HABLRCa 0x0038 +#define HC_SubA_HABLRFCa 0x0039 +#define HC_SubA_HABLRCbias 0x003a +#define HC_SubA_HABLRCb 0x003b +#define HC_SubA_HABLRFCb 0x003c +#define HC_SubA_HABLRAa 0x003d +#define HC_SubA_HABLRAb 0x003e +/* HC_SubA_HABFM + */ +#define HC_HABFM_MASK 0x00030000 +#define HC_HABLoc_MASK 0x0000c000 +#define HC_HABPit_MASK 0x000007ff +/* HC_SubA_HATMD + */ +#define HC_HATMD_MASK 0x00000700 +#define HC_HATREF_MASK 0x000000ff +#define HC_HATMD_NeverPass 0x00000000 +#define HC_HATMD_LT 0x00000100 +#define HC_HATMD_EQ 0x00000200 +#define HC_HATMD_LE 0x00000300 +#define HC_HATMD_GT 0x00000400 +#define HC_HATMD_NE 0x00000500 +#define HC_HATMD_GE 0x00000600 +#define HC_HATMD_AllPass 0x00000700 +/* HC_SubA_HABLCsat + */ +#define HC_HABLCsat_MASK 0x00010000 +#define HC_HABLCa_MASK 0x0000fc00 +#define HC_HABLCa_C_MASK 0x0000c000 +#define HC_HABLCa_OPC_MASK 0x00003c00 +#define HC_HABLFCa_MASK 0x000003f0 +#define HC_HABLFCa_C_MASK 0x00000300 +#define HC_HABLFCa_OPC_MASK 0x000000f0 +#define HC_HABLCbias_MASK 0x0000000f +#define HC_HABLCbias_C_MASK 0x00000008 +#define HC_HABLCbias_OPC_MASK 0x00000007 +/*-- Define the input color. + */ +#define HC_XC_Csrc 0x00000000 +#define HC_XC_Cdst 0x00000001 +#define HC_XC_Asrc 0x00000002 +#define HC_XC_Adst 0x00000003 +#define HC_XC_Fog 0x00000004 +#define HC_XC_HABLRC 0x00000005 +#define HC_XC_minSrcDst 0x00000006 +#define HC_XC_maxSrcDst 0x00000007 +#define HC_XC_mimAsrcInvAdst 0x00000008 +#define HC_XC_OPC 0x00000000 +#define HC_XC_InvOPC 0x00000010 +#define HC_XC_OPCp5 0x00000020 +/*-- Define the input Alpha + */ +#define HC_XA_OPA 0x00000000 +#define HC_XA_InvOPA 0x00000010 +#define HC_XA_OPAp5 0x00000020 +#define HC_XA_0 0x00000000 +#define HC_XA_Asrc 0x00000001 +#define HC_XA_Adst 0x00000002 +#define HC_XA_Fog 0x00000003 +#define HC_XA_minAsrcFog 0x00000004 +#define HC_XA_minAsrcAdst 0x00000005 +#define HC_XA_maxAsrcFog 0x00000006 +#define HC_XA_maxAsrcAdst 0x00000007 +#define HC_XA_HABLRA 0x00000008 +#define HC_XA_minAsrcInvAdst 0x00000008 +#define HC_XA_HABLFRA 0x00000009 +/*-- + */ +#define HC_HABLCa_OPC (HC_XC_OPC << 10) +#define HC_HABLCa_InvOPC (HC_XC_InvOPC << 10) +#define HC_HABLCa_OPCp5 (HC_XC_OPCp5 << 10) +#define HC_HABLCa_Csrc (HC_XC_Csrc << 10) +#define HC_HABLCa_Cdst (HC_XC_Cdst << 10) +#define HC_HABLCa_Asrc (HC_XC_Asrc << 10) +#define HC_HABLCa_Adst (HC_XC_Adst << 10) +#define HC_HABLCa_Fog (HC_XC_Fog << 10) +#define HC_HABLCa_HABLRCa (HC_XC_HABLRC << 10) +#define HC_HABLCa_minSrcDst (HC_XC_minSrcDst << 10) +#define HC_HABLCa_maxSrcDst (HC_XC_maxSrcDst << 10) +#define HC_HABLFCa_OPC (HC_XC_OPC << 4) +#define HC_HABLFCa_InvOPC (HC_XC_InvOPC << 4) +#define HC_HABLFCa_OPCp5 (HC_XC_OPCp5 << 4) +#define HC_HABLFCa_Csrc (HC_XC_Csrc << 4) +#define HC_HABLFCa_Cdst (HC_XC_Cdst << 4) +#define HC_HABLFCa_Asrc (HC_XC_Asrc << 4) +#define HC_HABLFCa_Adst (HC_XC_Adst << 4) +#define HC_HABLFCa_Fog (HC_XC_Fog << 4) +#define HC_HABLFCa_HABLRCa (HC_XC_HABLRC << 4) +#define HC_HABLFCa_minSrcDst (HC_XC_minSrcDst << 4) +#define HC_HABLFCa_maxSrcDst (HC_XC_maxSrcDst << 4) +#define HC_HABLFCa_mimAsrcInvAdst (HC_XC_mimAsrcInvAdst << 4) +#define HC_HABLCbias_HABLRCbias 0x00000000 +#define HC_HABLCbias_Asrc 0x00000001 +#define HC_HABLCbias_Adst 0x00000002 +#define HC_HABLCbias_Fog 0x00000003 +#define HC_HABLCbias_Cin 0x00000004 +/* HC_SubA_HABLCop 0x0035 + */ +#define HC_HABLdot_MASK 0x00010000 +#define HC_HABLCop_MASK 0x00004000 +#define HC_HABLCb_MASK 0x00003f00 +#define HC_HABLCb_C_MASK 0x00003000 +#define HC_HABLCb_OPC_MASK 0x00000f00 +#define HC_HABLFCb_MASK 0x000000fc +#define HC_HABLFCb_C_MASK 0x000000c0 +#define HC_HABLFCb_OPC_MASK 0x0000003c +#define HC_HABLCshift_MASK 0x00000003 +#define HC_HABLCb_OPC (HC_XC_OPC << 8) +#define HC_HABLCb_InvOPC (HC_XC_InvOPC << 8) +#define HC_HABLCb_OPCp5 (HC_XC_OPCp5 << 8) +#define HC_HABLCb_Csrc (HC_XC_Csrc << 8) +#define HC_HABLCb_Cdst (HC_XC_Cdst << 8) +#define HC_HABLCb_Asrc (HC_XC_Asrc << 8) +#define HC_HABLCb_Adst (HC_XC_Adst << 8) +#define HC_HABLCb_Fog (HC_XC_Fog << 8) +#define HC_HABLCb_HABLRCa (HC_XC_HABLRC << 8) +#define HC_HABLCb_minSrcDst (HC_XC_minSrcDst << 8) +#define HC_HABLCb_maxSrcDst (HC_XC_maxSrcDst << 8) +#define HC_HABLFCb_OPC (HC_XC_OPC << 2) +#define HC_HABLFCb_InvOPC (HC_XC_InvOPC << 2) +#define HC_HABLFCb_OPCp5 (HC_XC_OPCp5 << 2) +#define HC_HABLFCb_Csrc (HC_XC_Csrc << 2) +#define HC_HABLFCb_Cdst (HC_XC_Cdst << 2) +#define HC_HABLFCb_Asrc (HC_XC_Asrc << 2) +#define HC_HABLFCb_Adst (HC_XC_Adst << 2) +#define HC_HABLFCb_Fog (HC_XC_Fog << 2) +#define HC_HABLFCb_HABLRCb (HC_XC_HABLRC << 2) +#define HC_HABLFCb_minSrcDst (HC_XC_minSrcDst << 2) +#define HC_HABLFCb_maxSrcDst (HC_XC_maxSrcDst << 2) +#define HC_HABLFCb_mimAsrcInvAdst (HC_XC_mimAsrcInvAdst << 2) +/* HC_SubA_HABLAsat 0x0036 + */ +#define HC_HABLAsat_MASK 0x00010000 +#define HC_HABLAa_MASK 0x0000fc00 +#define HC_HABLAa_A_MASK 0x0000c000 +#define HC_HABLAa_OPA_MASK 0x00003c00 +#define HC_HABLFAa_MASK 0x000003f0 +#define HC_HABLFAa_A_MASK 0x00000300 +#define HC_HABLFAa_OPA_MASK 0x000000f0 +#define HC_HABLAbias_MASK 0x0000000f +#define HC_HABLAbias_A_MASK 0x00000008 +#define HC_HABLAbias_OPA_MASK 0x00000007 +#define HC_HABLAa_OPA (HC_XA_OPA << 10) +#define HC_HABLAa_InvOPA (HC_XA_InvOPA << 10) +#define HC_HABLAa_OPAp5 (HC_XA_OPAp5 << 10) +#define HC_HABLAa_0 (HC_XA_0 << 10) +#define HC_HABLAa_Asrc (HC_XA_Asrc << 10) +#define HC_HABLAa_Adst (HC_XA_Adst << 10) +#define HC_HABLAa_Fog (HC_XA_Fog << 10) +#define HC_HABLAa_minAsrcFog (HC_XA_minAsrcFog << 10) +#define HC_HABLAa_minAsrcAdst (HC_XA_minAsrcAdst << 10) +#define HC_HABLAa_maxAsrcFog (HC_XA_maxAsrcFog << 10) +#define HC_HABLAa_maxAsrcAdst (HC_XA_maxAsrcAdst << 10) +#define HC_HABLAa_HABLRA (HC_XA_HABLRA << 10) +#define HC_HABLFAa_OPA (HC_XA_OPA << 4) +#define HC_HABLFAa_InvOPA (HC_XA_InvOPA << 4) +#define HC_HABLFAa_OPAp5 (HC_XA_OPAp5 << 4) +#define HC_HABLFAa_0 (HC_XA_0 << 4) +#define HC_HABLFAa_Asrc (HC_XA_Asrc << 4) +#define HC_HABLFAa_Adst (HC_XA_Adst << 4) +#define HC_HABLFAa_Fog (HC_XA_Fog << 4) +#define HC_HABLFAa_minAsrcFog (HC_XA_minAsrcFog << 4) +#define HC_HABLFAa_minAsrcAdst (HC_XA_minAsrcAdst << 4) +#define HC_HABLFAa_maxAsrcFog (HC_XA_maxAsrcFog << 4) +#define HC_HABLFAa_maxAsrcAdst (HC_XA_maxAsrcAdst << 4) +#define HC_HABLFAa_minAsrcInvAdst (HC_XA_minAsrcInvAdst << 4) +#define HC_HABLFAa_HABLFRA (HC_XA_HABLFRA << 4) +#define HC_HABLAbias_HABLRAbias 0x00000000 +#define HC_HABLAbias_Asrc 0x00000001 +#define HC_HABLAbias_Adst 0x00000002 +#define HC_HABLAbias_Fog 0x00000003 +#define HC_HABLAbias_Aaa 0x00000004 +/* HC_SubA_HABLAop 0x0037 + */ +#define HC_HABLAop_MASK 0x00004000 +#define HC_HABLAb_MASK 0x00003f00 +#define HC_HABLAb_OPA_MASK 0x00000f00 +#define HC_HABLFAb_MASK 0x000000fc +#define HC_HABLFAb_OPA_MASK 0x0000003c +#define HC_HABLAshift_MASK 0x00000003 +#define HC_HABLAb_OPA (HC_XA_OPA << 8) +#define HC_HABLAb_InvOPA (HC_XA_InvOPA << 8) +#define HC_HABLAb_OPAp5 (HC_XA_OPAp5 << 8) +#define HC_HABLAb_0 (HC_XA_0 << 8) +#define HC_HABLAb_Asrc (HC_XA_Asrc << 8) +#define HC_HABLAb_Adst (HC_XA_Adst << 8) +#define HC_HABLAb_Fog (HC_XA_Fog << 8) +#define HC_HABLAb_minAsrcFog (HC_XA_minAsrcFog << 8) +#define HC_HABLAb_minAsrcAdst (HC_XA_minAsrcAdst << 8) +#define HC_HABLAb_maxAsrcFog (HC_XA_maxAsrcFog << 8) +#define HC_HABLAb_maxAsrcAdst (HC_XA_maxAsrcAdst << 8) +#define HC_HABLAb_HABLRA (HC_XA_HABLRA << 8) +#define HC_HABLFAb_OPA (HC_XA_OPA << 2) +#define HC_HABLFAb_InvOPA (HC_XA_InvOPA << 2) +#define HC_HABLFAb_OPAp5 (HC_XA_OPAp5 << 2) +#define HC_HABLFAb_0 (HC_XA_0 << 2) +#define HC_HABLFAb_Asrc (HC_XA_Asrc << 2) +#define HC_HABLFAb_Adst (HC_XA_Adst << 2) +#define HC_HABLFAb_Fog (HC_XA_Fog << 2) +#define HC_HABLFAb_minAsrcFog (HC_XA_minAsrcFog << 2) +#define HC_HABLFAb_minAsrcAdst (HC_XA_minAsrcAdst << 2) +#define HC_HABLFAb_maxAsrcFog (HC_XA_maxAsrcFog << 2) +#define HC_HABLFAb_maxAsrcAdst (HC_XA_maxAsrcAdst << 2) +#define HC_HABLFAb_minAsrcInvAdst (HC_XA_minAsrcInvAdst << 2) +#define HC_HABLFAb_HABLFRA (HC_XA_HABLFRA << 2) +/* HC_SubA_HABLRAa 0x003d + */ +#define HC_HABLRAa_MASK 0x00ff0000 +#define HC_HABLRFAa_MASK 0x0000ff00 +#define HC_HABLRAbias_MASK 0x000000ff +#define HC_HABLRAa_SHIFT 16 +#define HC_HABLRFAa_SHIFT 8 +/* HC_SubA_HABLRAb 0x003e + */ +#define HC_HABLRAb_MASK 0x0000ff00 +#define HC_HABLRFAb_MASK 0x000000ff +#define HC_HABLRAb_SHIFT 8 + +/* Destination Setting + */ +#define HC_SubA_HDBBasL 0x0040 +#define HC_SubA_HDBBasH 0x0041 +#define HC_SubA_HDBFM 0x0042 +#define HC_SubA_HFBBMSKL 0x0043 +#define HC_SubA_HROP 0x0044 +/* HC_SubA_HDBFM 0x0042 + */ +#define HC_HDBFM_MASK 0x001f0000 +#define HC_HDBLoc_MASK 0x0000c000 +#define HC_HDBPit_MASK 0x00003fff +#define HC_HDBFM_RGB555 0x00000000 +#define HC_HDBFM_RGB565 0x00010000 +#define HC_HDBFM_ARGB4444 0x00020000 +#define HC_HDBFM_ARGB1555 0x00030000 +#define HC_HDBFM_BGR555 0x00040000 +#define HC_HDBFM_BGR565 0x00050000 +#define HC_HDBFM_ABGR4444 0x00060000 +#define HC_HDBFM_ABGR1555 0x00070000 +#define HC_HDBFM_ARGB0888 0x00080000 +#define HC_HDBFM_ARGB8888 0x00090000 +#define HC_HDBFM_ABGR0888 0x000a0000 +#define HC_HDBFM_ABGR8888 0x000b0000 +#define HC_HDBLoc_Local 0x00000000 +#define HC_HDBLoc_Sys 0x00004000 +/* HC_SubA_HROP 0x0044 + */ +#define HC_HROP_MASK 0x00000f00 +#define HC_HFBBMSKH_MASK 0x000000ff +#define HC_HROP_BLACK 0x00000000 +#define HC_HROP_DPon 0x00000100 +#define HC_HROP_DPna 0x00000200 +#define HC_HROP_Pn 0x00000300 +#define HC_HROP_PDna 0x00000400 +#define HC_HROP_Dn 0x00000500 +#define HC_HROP_DPx 0x00000600 +#define HC_HROP_DPan 0x00000700 +#define HC_HROP_DPa 0x00000800 +#define HC_HROP_DPxn 0x00000900 +#define HC_HROP_D 0x00000a00 +#define HC_HROP_DPno 0x00000b00 +#define HC_HROP_P 0x00000c00 +#define HC_HROP_PDno 0x00000d00 +#define HC_HROP_DPo 0x00000e00 +#define HC_HROP_WHITE 0x00000f00 + +/* Fog Setting + */ +#define HC_SubA_HFogLF 0x0050 +#define HC_SubA_HFogCL 0x0051 +#define HC_SubA_HFogCH 0x0052 +#define HC_SubA_HFogStL 0x0053 +#define HC_SubA_HFogStH 0x0054 +#define HC_SubA_HFogOOdMF 0x0055 +#define HC_SubA_HFogOOdEF 0x0056 +#define HC_SubA_HFogEndL 0x0057 +#define HC_SubA_HFogDenst 0x0058 +/* HC_SubA_FogLF 0x0050 + */ +#define HC_FogLF_MASK 0x00000010 +#define HC_FogEq_MASK 0x00000008 +#define HC_FogMD_MASK 0x00000007 +#define HC_FogMD_LocalFog 0x00000000 +#define HC_FogMD_LinearFog 0x00000002 +#define HC_FogMD_ExponentialFog 0x00000004 +#define HC_FogMD_Exponential2Fog 0x00000005 +/* #define HC_FogMD_FogTable 0x00000003 */ + +/* HC_SubA_HFogDenst 0x0058 + */ +#define HC_FogDenst_MASK 0x001fff00 +#define HC_FogEndL_MASK 0x000000ff + +/* Texture subtype definitions + */ +#define HC_SubType_Tex0 0x00000000 +#define HC_SubType_Tex1 0x00000001 +#define HC_SubType_TexGeneral 0x000000fe + +/* Attribute of texture n + */ +#define HC_SubA_HTXnL0BasL 0x0000 +#define HC_SubA_HTXnL1BasL 0x0001 +#define HC_SubA_HTXnL2BasL 0x0002 +#define HC_SubA_HTXnL3BasL 0x0003 +#define HC_SubA_HTXnL4BasL 0x0004 +#define HC_SubA_HTXnL5BasL 0x0005 +#define HC_SubA_HTXnL6BasL 0x0006 +#define HC_SubA_HTXnL7BasL 0x0007 +#define HC_SubA_HTXnL8BasL 0x0008 +#define HC_SubA_HTXnL9BasL 0x0009 +#define HC_SubA_HTXnLaBasL 0x000a +#define HC_SubA_HTXnLbBasL 0x000b +#define HC_SubA_HTXnLcBasL 0x000c +#define HC_SubA_HTXnLdBasL 0x000d +#define HC_SubA_HTXnLeBasL 0x000e +#define HC_SubA_HTXnLfBasL 0x000f +#define HC_SubA_HTXnL10BasL 0x0010 +#define HC_SubA_HTXnL11BasL 0x0011 +#define HC_SubA_HTXnL012BasH 0x0020 +#define HC_SubA_HTXnL345BasH 0x0021 +#define HC_SubA_HTXnL678BasH 0x0022 +#define HC_SubA_HTXnL9abBasH 0x0023 +#define HC_SubA_HTXnLcdeBasH 0x0024 +#define HC_SubA_HTXnLf1011BasH 0x0025 +#define HC_SubA_HTXnL0Pit 0x002b +#define HC_SubA_HTXnL1Pit 0x002c +#define HC_SubA_HTXnL2Pit 0x002d +#define HC_SubA_HTXnL3Pit 0x002e +#define HC_SubA_HTXnL4Pit 0x002f +#define HC_SubA_HTXnL5Pit 0x0030 +#define HC_SubA_HTXnL6Pit 0x0031 +#define HC_SubA_HTXnL7Pit 0x0032 +#define HC_SubA_HTXnL8Pit 0x0033 +#define HC_SubA_HTXnL9Pit 0x0034 +#define HC_SubA_HTXnLaPit 0x0035 +#define HC_SubA_HTXnLbPit 0x0036 +#define HC_SubA_HTXnLcPit 0x0037 +#define HC_SubA_HTXnLdPit 0x0038 +#define HC_SubA_HTXnLePit 0x0039 +#define HC_SubA_HTXnLfPit 0x003a +#define HC_SubA_HTXnL10Pit 0x003b +#define HC_SubA_HTXnL11Pit 0x003c +#define HC_SubA_HTXnL0_5WE 0x004b +#define HC_SubA_HTXnL6_bWE 0x004c +#define HC_SubA_HTXnLc_11WE 0x004d +#define HC_SubA_HTXnL0_5HE 0x0051 +#define HC_SubA_HTXnL6_bHE 0x0052 +#define HC_SubA_HTXnLc_11HE 0x0053 +#define HC_SubA_HTXnL0OS 0x0077 +#define HC_SubA_HTXnTB 0x0078 +#define HC_SubA_HTXnMPMD 0x0079 +#define HC_SubA_HTXnCLODu 0x007a +#define HC_SubA_HTXnFM 0x007b +#define HC_SubA_HTXnTRCH 0x007c +#define HC_SubA_HTXnTRCL 0x007d +#define HC_SubA_HTXnTBC 0x007e +#define HC_SubA_HTXnTRAH 0x007f +#define HC_SubA_HTXnTBLCsat 0x0080 +#define HC_SubA_HTXnTBLCop 0x0081 +#define HC_SubA_HTXnTBLMPfog 0x0082 +#define HC_SubA_HTXnTBLAsat 0x0083 +#define HC_SubA_HTXnTBLRCa 0x0085 +#define HC_SubA_HTXnTBLRCb 0x0086 +#define HC_SubA_HTXnTBLRCc 0x0087 +#define HC_SubA_HTXnTBLRCbias 0x0088 +#define HC_SubA_HTXnTBLRAa 0x0089 +#define HC_SubA_HTXnTBLRFog 0x008a +#define HC_SubA_HTXnBumpM00 0x0090 +#define HC_SubA_HTXnBumpM01 0x0091 +#define HC_SubA_HTXnBumpM10 0x0092 +#define HC_SubA_HTXnBumpM11 0x0093 +#define HC_SubA_HTXnLScale 0x0094 +#define HC_SubA_HTXSMD 0x0000 +/* HC_SubA_HTXnL012BasH 0x0020 + */ +#define HC_HTXnL0BasH_MASK 0x000000ff +#define HC_HTXnL1BasH_MASK 0x0000ff00 +#define HC_HTXnL2BasH_MASK 0x00ff0000 +#define HC_HTXnL1BasH_SHIFT 8 +#define HC_HTXnL2BasH_SHIFT 16 +/* HC_SubA_HTXnL345BasH 0x0021 + */ +#define HC_HTXnL3BasH_MASK 0x000000ff +#define HC_HTXnL4BasH_MASK 0x0000ff00 +#define HC_HTXnL5BasH_MASK 0x00ff0000 +#define HC_HTXnL4BasH_SHIFT 8 +#define HC_HTXnL5BasH_SHIFT 16 +/* HC_SubA_HTXnL678BasH 0x0022 + */ +#define HC_HTXnL6BasH_MASK 0x000000ff +#define HC_HTXnL7BasH_MASK 0x0000ff00 +#define HC_HTXnL8BasH_MASK 0x00ff0000 +#define HC_HTXnL7BasH_SHIFT 8 +#define HC_HTXnL8BasH_SHIFT 16 +/* HC_SubA_HTXnL9abBasH 0x0023 + */ +#define HC_HTXnL9BasH_MASK 0x000000ff +#define HC_HTXnLaBasH_MASK 0x0000ff00 +#define HC_HTXnLbBasH_MASK 0x00ff0000 +#define HC_HTXnLaBasH_SHIFT 8 +#define HC_HTXnLbBasH_SHIFT 16 +/* HC_SubA_HTXnLcdeBasH 0x0024 + */ +#define HC_HTXnLcBasH_MASK 0x000000ff +#define HC_HTXnLdBasH_MASK 0x0000ff00 +#define HC_HTXnLeBasH_MASK 0x00ff0000 +#define HC_HTXnLdBasH_SHIFT 8 +#define HC_HTXnLeBasH_SHIFT 16 +/* HC_SubA_HTXnLcdeBasH 0x0025 + */ +#define HC_HTXnLfBasH_MASK 0x000000ff +#define HC_HTXnL10BasH_MASK 0x0000ff00 +#define HC_HTXnL11BasH_MASK 0x00ff0000 +#define HC_HTXnL10BasH_SHIFT 8 +#define HC_HTXnL11BasH_SHIFT 16 +/* HC_SubA_HTXnL0Pit 0x002b + */ +#define HC_HTXnLnPit_MASK 0x00003fff +#define HC_HTXnEnPit_MASK 0x00080000 +#define HC_HTXnLnPitE_MASK 0x00f00000 +#define HC_HTXnLnPitE_SHIFT 20 +/* HC_SubA_HTXnL0_5WE 0x004b + */ +#define HC_HTXnL0WE_MASK 0x0000000f +#define HC_HTXnL1WE_MASK 0x000000f0 +#define HC_HTXnL2WE_MASK 0x00000f00 +#define HC_HTXnL3WE_MASK 0x0000f000 +#define HC_HTXnL4WE_MASK 0x000f0000 +#define HC_HTXnL5WE_MASK 0x00f00000 +#define HC_HTXnL1WE_SHIFT 4 +#define HC_HTXnL2WE_SHIFT 8 +#define HC_HTXnL3WE_SHIFT 12 +#define HC_HTXnL4WE_SHIFT 16 +#define HC_HTXnL5WE_SHIFT 20 +/* HC_SubA_HTXnL6_bWE 0x004c + */ +#define HC_HTXnL6WE_MASK 0x0000000f +#define HC_HTXnL7WE_MASK 0x000000f0 +#define HC_HTXnL8WE_MASK 0x00000f00 +#define HC_HTXnL9WE_MASK 0x0000f000 +#define HC_HTXnLaWE_MASK 0x000f0000 +#define HC_HTXnLbWE_MASK 0x00f00000 +#define HC_HTXnL7WE_SHIFT 4 +#define HC_HTXnL8WE_SHIFT 8 +#define HC_HTXnL9WE_SHIFT 12 +#define HC_HTXnLaWE_SHIFT 16 +#define HC_HTXnLbWE_SHIFT 20 +/* HC_SubA_HTXnLc_11WE 0x004d + */ +#define HC_HTXnLcWE_MASK 0x0000000f +#define HC_HTXnLdWE_MASK 0x000000f0 +#define HC_HTXnLeWE_MASK 0x00000f00 +#define HC_HTXnLfWE_MASK 0x0000f000 +#define HC_HTXnL10WE_MASK 0x000f0000 +#define HC_HTXnL11WE_MASK 0x00f00000 +#define HC_HTXnLdWE_SHIFT 4 +#define HC_HTXnLeWE_SHIFT 8 +#define HC_HTXnLfWE_SHIFT 12 +#define HC_HTXnL10WE_SHIFT 16 +#define HC_HTXnL11WE_SHIFT 20 +/* HC_SubA_HTXnL0_5HE 0x0051 + */ +#define HC_HTXnL0HE_MASK 0x0000000f +#define HC_HTXnL1HE_MASK 0x000000f0 +#define HC_HTXnL2HE_MASK 0x00000f00 +#define HC_HTXnL3HE_MASK 0x0000f000 +#define HC_HTXnL4HE_MASK 0x000f0000 +#define HC_HTXnL5HE_MASK 0x00f00000 +#define HC_HTXnL1HE_SHIFT 4 +#define HC_HTXnL2HE_SHIFT 8 +#define HC_HTXnL3HE_SHIFT 12 +#define HC_HTXnL4HE_SHIFT 16 +#define HC_HTXnL5HE_SHIFT 20 +/* HC_SubA_HTXnL6_bHE 0x0052 + */ +#define HC_HTXnL6HE_MASK 0x0000000f +#define HC_HTXnL7HE_MASK 0x000000f0 +#define HC_HTXnL8HE_MASK 0x00000f00 +#define HC_HTXnL9HE_MASK 0x0000f000 +#define HC_HTXnLaHE_MASK 0x000f0000 +#define HC_HTXnLbHE_MASK 0x00f00000 +#define HC_HTXnL7HE_SHIFT 4 +#define HC_HTXnL8HE_SHIFT 8 +#define HC_HTXnL9HE_SHIFT 12 +#define HC_HTXnLaHE_SHIFT 16 +#define HC_HTXnLbHE_SHIFT 20 +/* HC_SubA_HTXnLc_11HE 0x0053 + */ +#define HC_HTXnLcHE_MASK 0x0000000f +#define HC_HTXnLdHE_MASK 0x000000f0 +#define HC_HTXnLeHE_MASK 0x00000f00 +#define HC_HTXnLfHE_MASK 0x0000f000 +#define HC_HTXnL10HE_MASK 0x000f0000 +#define HC_HTXnL11HE_MASK 0x00f00000 +#define HC_HTXnLdHE_SHIFT 4 +#define HC_HTXnLeHE_SHIFT 8 +#define HC_HTXnLfHE_SHIFT 12 +#define HC_HTXnL10HE_SHIFT 16 +#define HC_HTXnL11HE_SHIFT 20 +/* HC_SubA_HTXnL0OS 0x0077 + */ +#define HC_HTXnL0OS_MASK 0x003ff000 +#define HC_HTXnLVmax_MASK 0x00000fc0 +#define HC_HTXnLVmin_MASK 0x0000003f +#define HC_HTXnL0OS_SHIFT 12 +#define HC_HTXnLVmax_SHIFT 6 +/* HC_SubA_HTXnTB 0x0078 + */ +#define HC_HTXnTB_MASK 0x00f00000 +#define HC_HTXnFLSe_MASK 0x0000e000 +#define HC_HTXnFLSs_MASK 0x00001c00 +#define HC_HTXnFLTe_MASK 0x00000380 +#define HC_HTXnFLTs_MASK 0x00000070 +#define HC_HTXnFLDs_MASK 0x0000000f +#define HC_HTXnTB_NoTB 0x00000000 +#define HC_HTXnTB_TBC_S 0x00100000 +#define HC_HTXnTB_TBC_T 0x00200000 +#define HC_HTXnTB_TB_S 0x00400000 +#define HC_HTXnTB_TB_T 0x00800000 +#define HC_HTXnFLSe_Nearest 0x00000000 +#define HC_HTXnFLSe_Linear 0x00002000 +#define HC_HTXnFLSe_NonLinear 0x00004000 +#define HC_HTXnFLSe_Sharp 0x00008000 +#define HC_HTXnFLSe_Flat_Gaussian_Cubic 0x0000c000 +#define HC_HTXnFLSs_Nearest 0x00000000 +#define HC_HTXnFLSs_Linear 0x00000400 +#define HC_HTXnFLSs_NonLinear 0x00000800 +#define HC_HTXnFLSs_Flat_Gaussian_Cubic 0x00001800 +#define HC_HTXnFLTe_Nearest 0x00000000 +#define HC_HTXnFLTe_Linear 0x00000080 +#define HC_HTXnFLTe_NonLinear 0x00000100 +#define HC_HTXnFLTe_Sharp 0x00000180 +#define HC_HTXnFLTe_Flat_Gaussian_Cubic 0x00000300 +#define HC_HTXnFLTs_Nearest 0x00000000 +#define HC_HTXnFLTs_Linear 0x00000010 +#define HC_HTXnFLTs_NonLinear 0x00000020 +#define HC_HTXnFLTs_Flat_Gaussian_Cubic 0x00000060 +#define HC_HTXnFLDs_Tex0 0x00000000 +#define HC_HTXnFLDs_Nearest 0x00000001 +#define HC_HTXnFLDs_Linear 0x00000002 +#define HC_HTXnFLDs_NonLinear 0x00000003 +#define HC_HTXnFLDs_Dither 0x00000004 +#define HC_HTXnFLDs_ConstLOD 0x00000005 +#define HC_HTXnFLDs_Ani 0x00000006 +#define HC_HTXnFLDs_AniDither 0x00000007 +/* HC_SubA_HTXnMPMD 0x0079 + */ +#define HC_HTXnMPMD_SMASK 0x00070000 +#define HC_HTXnMPMD_TMASK 0x00380000 +#define HC_HTXnLODDTf_MASK 0x00000007 +#define HC_HTXnXY2ST_MASK 0x00000008 +#define HC_HTXnMPMD_Tsingle 0x00000000 +#define HC_HTXnMPMD_Tclamp 0x00080000 +#define HC_HTXnMPMD_Trepeat 0x00100000 +#define HC_HTXnMPMD_Tmirror 0x00180000 +#define HC_HTXnMPMD_Twrap 0x00200000 +#define HC_HTXnMPMD_Ssingle 0x00000000 +#define HC_HTXnMPMD_Sclamp 0x00010000 +#define HC_HTXnMPMD_Srepeat 0x00020000 +#define HC_HTXnMPMD_Smirror 0x00030000 +#define HC_HTXnMPMD_Swrap 0x00040000 +/* HC_SubA_HTXnCLODu 0x007a + */ +#define HC_HTXnCLODu_MASK 0x000ffc00 +#define HC_HTXnCLODd_MASK 0x000003ff +#define HC_HTXnCLODu_SHIFT 10 +/* HC_SubA_HTXnFM 0x007b + */ +#define HC_HTXnFM_MASK 0x00ff0000 +#define HC_HTXnLoc_MASK 0x00000003 +#define HC_HTXnFM_INDEX 0x00000000 +#define HC_HTXnFM_Intensity 0x00080000 +#define HC_HTXnFM_Lum 0x00100000 +#define HC_HTXnFM_Alpha 0x00180000 +#define HC_HTXnFM_DX 0x00280000 +#define HC_HTXnFM_ARGB16 0x00880000 +#define HC_HTXnFM_ARGB32 0x00980000 +#define HC_HTXnFM_ABGR16 0x00a80000 +#define HC_HTXnFM_ABGR32 0x00b80000 +#define HC_HTXnFM_RGBA16 0x00c80000 +#define HC_HTXnFM_RGBA32 0x00d80000 +#define HC_HTXnFM_BGRA16 0x00e80000 +#define HC_HTXnFM_BGRA32 0x00f80000 +#define HC_HTXnFM_BUMPMAP 0x00380000 +#define HC_HTXnFM_Index1 (HC_HTXnFM_INDEX | 0x00000000) +#define HC_HTXnFM_Index2 (HC_HTXnFM_INDEX | 0x00010000) +#define HC_HTXnFM_Index4 (HC_HTXnFM_INDEX | 0x00020000) +#define HC_HTXnFM_Index8 (HC_HTXnFM_INDEX | 0x00030000) +#define HC_HTXnFM_T1 (HC_HTXnFM_Intensity | 0x00000000) +#define HC_HTXnFM_T2 (HC_HTXnFM_Intensity | 0x00010000) +#define HC_HTXnFM_T4 (HC_HTXnFM_Intensity | 0x00020000) +#define HC_HTXnFM_T8 (HC_HTXnFM_Intensity | 0x00030000) +#define HC_HTXnFM_L1 (HC_HTXnFM_Lum | 0x00000000) +#define HC_HTXnFM_L2 (HC_HTXnFM_Lum | 0x00010000) +#define HC_HTXnFM_L4 (HC_HTXnFM_Lum | 0x00020000) +#define HC_HTXnFM_L8 (HC_HTXnFM_Lum | 0x00030000) +#define HC_HTXnFM_AL44 (HC_HTXnFM_Lum | 0x00040000) +#define HC_HTXnFM_AL88 (HC_HTXnFM_Lum | 0x00050000) +#define HC_HTXnFM_A1 (HC_HTXnFM_Alpha | 0x00000000) +#define HC_HTXnFM_A2 (HC_HTXnFM_Alpha | 0x00010000) +#define HC_HTXnFM_A4 (HC_HTXnFM_Alpha | 0x00020000) +#define HC_HTXnFM_A8 (HC_HTXnFM_Alpha | 0x00030000) +#define HC_HTXnFM_DX1 (HC_HTXnFM_DX | 0x00010000) +#define HC_HTXnFM_DX23 (HC_HTXnFM_DX | 0x00020000) +#define HC_HTXnFM_DX45 (HC_HTXnFM_DX | 0x00030000) +#define HC_HTXnFM_RGB555 (HC_HTXnFM_ARGB16 | 0x00000000) +#define HC_HTXnFM_RGB565 (HC_HTXnFM_ARGB16 | 0x00010000) +#define HC_HTXnFM_ARGB1555 (HC_HTXnFM_ARGB16 | 0x00020000) +#define HC_HTXnFM_ARGB4444 (HC_HTXnFM_ARGB16 | 0x00030000) +#define HC_HTXnFM_ARGB0888 (HC_HTXnFM_ARGB32 | 0x00000000) +#define HC_HTXnFM_ARGB8888 (HC_HTXnFM_ARGB32 | 0x00010000) +#define HC_HTXnFM_BGR555 (HC_HTXnFM_ABGR16 | 0x00000000) +#define HC_HTXnFM_BGR565 (HC_HTXnFM_ABGR16 | 0x00010000) +#define HC_HTXnFM_ABGR1555 (HC_HTXnFM_ABGR16 | 0x00020000) +#define HC_HTXnFM_ABGR4444 (HC_HTXnFM_ABGR16 | 0x00030000) +#define HC_HTXnFM_ABGR0888 (HC_HTXnFM_ABGR32 | 0x00000000) +#define HC_HTXnFM_ABGR8888 (HC_HTXnFM_ABGR32 | 0x00010000) +#define HC_HTXnFM_RGBA5550 (HC_HTXnFM_RGBA16 | 0x00000000) +#define HC_HTXnFM_RGBA5551 (HC_HTXnFM_RGBA16 | 0x00020000) +#define HC_HTXnFM_RGBA4444 (HC_HTXnFM_RGBA16 | 0x00030000) +#define HC_HTXnFM_RGBA8880 (HC_HTXnFM_RGBA32 | 0x00000000) +#define HC_HTXnFM_RGBA8888 (HC_HTXnFM_RGBA32 | 0x00010000) +#define HC_HTXnFM_BGRA5550 (HC_HTXnFM_BGRA16 | 0x00000000) +#define HC_HTXnFM_BGRA5551 (HC_HTXnFM_BGRA16 | 0x00020000) +#define HC_HTXnFM_BGRA4444 (HC_HTXnFM_BGRA16 | 0x00030000) +#define HC_HTXnFM_BGRA8880 (HC_HTXnFM_BGRA32 | 0x00000000) +#define HC_HTXnFM_BGRA8888 (HC_HTXnFM_BGRA32 | 0x00010000) +#define HC_HTXnFM_VU88 (HC_HTXnFM_BUMPMAP | 0x00000000) +#define HC_HTXnFM_LVU655 (HC_HTXnFM_BUMPMAP | 0x00010000) +#define HC_HTXnFM_LVU888 (HC_HTXnFM_BUMPMAP | 0x00020000) +#define HC_HTXnLoc_Local 0x00000000 +#define HC_HTXnLoc_Sys 0x00000002 +#define HC_HTXnLoc_AGP 0x00000003 +/* HC_SubA_HTXnTRAH 0x007f + */ +#define HC_HTXnTRAH_MASK 0x00ff0000 +#define HC_HTXnTRAL_MASK 0x0000ff00 +#define HC_HTXnTBA_MASK 0x000000ff +#define HC_HTXnTRAH_SHIFT 16 +#define HC_HTXnTRAL_SHIFT 8 +/* HC_SubA_HTXnTBLCsat 0x0080 + *-- Define the input texture. + */ +#define HC_XTC_TOPC 0x00000000 +#define HC_XTC_InvTOPC 0x00000010 +#define HC_XTC_TOPCp5 0x00000020 +#define HC_XTC_Cbias 0x00000000 +#define HC_XTC_InvCbias 0x00000010 +#define HC_XTC_0 0x00000000 +#define HC_XTC_Dif 0x00000001 +#define HC_XTC_Spec 0x00000002 +#define HC_XTC_Tex 0x00000003 +#define HC_XTC_Cur 0x00000004 +#define HC_XTC_Adif 0x00000005 +#define HC_XTC_Fog 0x00000006 +#define HC_XTC_Atex 0x00000007 +#define HC_XTC_Acur 0x00000008 +#define HC_XTC_HTXnTBLRC 0x00000009 +#define HC_XTC_Ctexnext 0x0000000a +/*-- + */ +#define HC_HTXnTBLCsat_MASK 0x00800000 +#define HC_HTXnTBLCa_MASK 0x000fc000 +#define HC_HTXnTBLCb_MASK 0x00001f80 +#define HC_HTXnTBLCc_MASK 0x0000003f +#define HC_HTXnTBLCa_TOPC (HC_XTC_TOPC << 14) +#define HC_HTXnTBLCa_InvTOPC (HC_XTC_InvTOPC << 14) +#define HC_HTXnTBLCa_TOPCp5 (HC_XTC_TOPCp5 << 14) +#define HC_HTXnTBLCa_0 (HC_XTC_0 << 14) +#define HC_HTXnTBLCa_Dif (HC_XTC_Dif << 14) +#define HC_HTXnTBLCa_Spec (HC_XTC_Spec << 14) +#define HC_HTXnTBLCa_Tex (HC_XTC_Tex << 14) +#define HC_HTXnTBLCa_Cur (HC_XTC_Cur << 14) +#define HC_HTXnTBLCa_Adif (HC_XTC_Adif << 14) +#define HC_HTXnTBLCa_Fog (HC_XTC_Fog << 14) +#define HC_HTXnTBLCa_Atex (HC_XTC_Atex << 14) +#define HC_HTXnTBLCa_Acur (HC_XTC_Acur << 14) +#define HC_HTXnTBLCa_HTXnTBLRC (HC_XTC_HTXnTBLRC << 14) +#define HC_HTXnTBLCa_Ctexnext (HC_XTC_Ctexnext << 14) +#define HC_HTXnTBLCb_TOPC (HC_XTC_TOPC << 7) +#define HC_HTXnTBLCb_InvTOPC (HC_XTC_InvTOPC << 7) +#define HC_HTXnTBLCb_TOPCp5 (HC_XTC_TOPCp5 << 7) +#define HC_HTXnTBLCb_0 (HC_XTC_0 << 7) +#define HC_HTXnTBLCb_Dif (HC_XTC_Dif << 7) +#define HC_HTXnTBLCb_Spec (HC_XTC_Spec << 7) +#define HC_HTXnTBLCb_Tex (HC_XTC_Tex << 7) +#define HC_HTXnTBLCb_Cur (HC_XTC_Cur << 7) +#define HC_HTXnTBLCb_Adif (HC_XTC_Adif << 7) +#define HC_HTXnTBLCb_Fog (HC_XTC_Fog << 7) +#define HC_HTXnTBLCb_Atex (HC_XTC_Atex << 7) +#define HC_HTXnTBLCb_Acur (HC_XTC_Acur << 7) +#define HC_HTXnTBLCb_HTXnTBLRC (HC_XTC_HTXnTBLRC << 7) +#define HC_HTXnTBLCb_Ctexnext (HC_XTC_Ctexnext << 7) +#define HC_HTXnTBLCc_TOPC (HC_XTC_TOPC << 0) +#define HC_HTXnTBLCc_InvTOPC (HC_XTC_InvTOPC << 0) +#define HC_HTXnTBLCc_TOPCp5 (HC_XTC_TOPCp5 << 0) +#define HC_HTXnTBLCc_0 (HC_XTC_0 << 0) +#define HC_HTXnTBLCc_Dif (HC_XTC_Dif << 0) +#define HC_HTXnTBLCc_Spec (HC_XTC_Spec << 0) +#define HC_HTXnTBLCc_Tex (HC_XTC_Tex << 0) +#define HC_HTXnTBLCc_Cur (HC_XTC_Cur << 0) +#define HC_HTXnTBLCc_Adif (HC_XTC_Adif << 0) +#define HC_HTXnTBLCc_Fog (HC_XTC_Fog << 0) +#define HC_HTXnTBLCc_Atex (HC_XTC_Atex << 0) +#define HC_HTXnTBLCc_Acur (HC_XTC_Acur << 0) +#define HC_HTXnTBLCc_HTXnTBLRC (HC_XTC_HTXnTBLRC << 0) +#define HC_HTXnTBLCc_Ctexnext (HC_XTC_Ctexnext << 0) +/* HC_SubA_HTXnTBLCop 0x0081 + */ +#define HC_HTXnTBLdot_MASK 0x00c00000 +#define HC_HTXnTBLCop_MASK 0x00380000 +#define HC_HTXnTBLCbias_MASK 0x0007c000 +#define HC_HTXnTBLCshift_MASK 0x00001800 +#define HC_HTXnTBLAop_MASK 0x00000380 +#define HC_HTXnTBLAbias_MASK 0x00000078 +#define HC_HTXnTBLAshift_MASK 0x00000003 +#define HC_HTXnTBLCop_Add 0x00000000 +#define HC_HTXnTBLCop_Sub 0x00080000 +#define HC_HTXnTBLCop_Min 0x00100000 +#define HC_HTXnTBLCop_Max 0x00180000 +#define HC_HTXnTBLCop_Mask 0x00200000 +#define HC_HTXnTBLCbias_Cbias (HC_XTC_Cbias << 14) +#define HC_HTXnTBLCbias_InvCbias (HC_XTC_InvCbias << 14) +#define HC_HTXnTBLCbias_0 (HC_XTC_0 << 14) +#define HC_HTXnTBLCbias_Dif (HC_XTC_Dif << 14) +#define HC_HTXnTBLCbias_Spec (HC_XTC_Spec << 14) +#define HC_HTXnTBLCbias_Tex (HC_XTC_Tex << 14) +#define HC_HTXnTBLCbias_Cur (HC_XTC_Cur << 14) +#define HC_HTXnTBLCbias_Adif (HC_XTC_Adif << 14) +#define HC_HTXnTBLCbias_Fog (HC_XTC_Fog << 14) +#define HC_HTXnTBLCbias_Atex (HC_XTC_Atex << 14) +#define HC_HTXnTBLCbias_Acur (HC_XTC_Acur << 14) +#define HC_HTXnTBLCbias_HTXnTBLRC (HC_XTC_HTXnTBLRC << 14) +#define HC_HTXnTBLCshift_1 0x00000000 +#define HC_HTXnTBLCshift_2 0x00000800 +#define HC_HTXnTBLCshift_No 0x00001000 +#define HC_HTXnTBLCshift_DotP 0x00001800 +#define HC_HTXnTBLAop_Add 0x00000000 +#define HC_HTXnTBLAop_Sub 0x00000080 +#define HC_HTXnTBLAop_Min 0x00000100 +#define HC_HTXnTBLAop_Max 0x00000180 +#define HC_HTXnTBLAop_Mask 0x00000200 +#define HC_HTXnTBLAbias_Inv 0x00000040 +#define HC_HTXnTBLAbias_Adif 0x00000000 +#define HC_HTXnTBLAbias_Fog 0x00000008 +#define HC_HTXnTBLAbias_Acur 0x00000010 +#define HC_HTXnTBLAbias_HTXnTBLRAbias 0x00000018 +#define HC_HTXnTBLAbias_Atex 0x00000020 +#define HC_HTXnTBLAshift_1 0x00000000 +#define HC_HTXnTBLAshift_2 0x00000001 +#define HC_HTXnTBLAshift_No 0x00000002 +/* #define HC_HTXnTBLAshift_DotP 0x00000003 */ +/* HC_SubA_HTXnTBLMPFog 0x0082 + */ +#define HC_HTXnTBLMPfog_MASK 0x00e00000 +#define HC_HTXnTBLMPfog_0 0x00000000 +#define HC_HTXnTBLMPfog_Adif 0x00200000 +#define HC_HTXnTBLMPfog_Fog 0x00400000 +#define HC_HTXnTBLMPfog_Atex 0x00600000 +#define HC_HTXnTBLMPfog_Acur 0x00800000 +#define HC_HTXnTBLMPfog_GHTXnTBLRFog 0x00a00000 +/* HC_SubA_HTXnTBLAsat 0x0083 + *-- Define the texture alpha input. + */ +#define HC_XTA_TOPA 0x00000000 +#define HC_XTA_InvTOPA 0x00000008 +#define HC_XTA_TOPAp5 0x00000010 +#define HC_XTA_Adif 0x00000000 +#define HC_XTA_Fog 0x00000001 +#define HC_XTA_Acur 0x00000002 +#define HC_XTA_HTXnTBLRA 0x00000003 +#define HC_XTA_Atex 0x00000004 +#define HC_XTA_Atexnext 0x00000005 +/*-- + */ +#define HC_HTXnTBLAsat_MASK 0x00800000 +#define HC_HTXnTBLAMB_MASK 0x00700000 +#define HC_HTXnTBLAa_MASK 0x0007c000 +#define HC_HTXnTBLAb_MASK 0x00000f80 +#define HC_HTXnTBLAc_MASK 0x0000001f +#define HC_HTXnTBLAMB_SHIFT 20 +#define HC_HTXnTBLAa_TOPA (HC_XTA_TOPA << 14) +#define HC_HTXnTBLAa_InvTOPA (HC_XTA_InvTOPA << 14) +#define HC_HTXnTBLAa_TOPAp5 (HC_XTA_TOPAp5 << 14) +#define HC_HTXnTBLAa_Adif (HC_XTA_Adif << 14) +#define HC_HTXnTBLAa_Fog (HC_XTA_Fog << 14) +#define HC_HTXnTBLAa_Acur (HC_XTA_Acur << 14) +#define HC_HTXnTBLAa_HTXnTBLRA (HC_XTA_HTXnTBLRA << 14) +#define HC_HTXnTBLAa_Atex (HC_XTA_Atex << 14) +#define HC_HTXnTBLAa_Atexnext (HC_XTA_Atexnext << 14) +#define HC_HTXnTBLAb_TOPA (HC_XTA_TOPA << 7) +#define HC_HTXnTBLAb_InvTOPA (HC_XTA_InvTOPA << 7) +#define HC_HTXnTBLAb_TOPAp5 (HC_XTA_TOPAp5 << 7) +#define HC_HTXnTBLAb_Adif (HC_XTA_Adif << 7) +#define HC_HTXnTBLAb_Fog (HC_XTA_Fog << 7) +#define HC_HTXnTBLAb_Acur (HC_XTA_Acur << 7) +#define HC_HTXnTBLAb_HTXnTBLRA (HC_XTA_HTXnTBLRA << 7) +#define HC_HTXnTBLAb_Atex (HC_XTA_Atex << 7) +#define HC_HTXnTBLAb_Atexnext (HC_XTA_Atexnext << 7) +#define HC_HTXnTBLAc_TOPA (HC_XTA_TOPA << 0) +#define HC_HTXnTBLAc_InvTOPA (HC_XTA_InvTOPA << 0) +#define HC_HTXnTBLAc_TOPAp5 (HC_XTA_TOPAp5 << 0) +#define HC_HTXnTBLAc_Adif (HC_XTA_Adif << 0) +#define HC_HTXnTBLAc_Fog (HC_XTA_Fog << 0) +#define HC_HTXnTBLAc_Acur (HC_XTA_Acur << 0) +#define HC_HTXnTBLAc_HTXnTBLRA (HC_XTA_HTXnTBLRA << 0) +#define HC_HTXnTBLAc_Atex (HC_XTA_Atex << 0) +#define HC_HTXnTBLAc_Atexnext (HC_XTA_Atexnext << 0) +/* HC_SubA_HTXnTBLRAa 0x0089 + */ +#define HC_HTXnTBLRAa_MASK 0x00ff0000 +#define HC_HTXnTBLRAb_MASK 0x0000ff00 +#define HC_HTXnTBLRAc_MASK 0x000000ff +#define HC_HTXnTBLRAa_SHIFT 16 +#define HC_HTXnTBLRAb_SHIFT 8 +#define HC_HTXnTBLRAc_SHIFT 0 +/* HC_SubA_HTXnTBLRFog 0x008a + */ +#define HC_HTXnTBLRFog_MASK 0x0000ff00 +#define HC_HTXnTBLRAbias_MASK 0x000000ff +#define HC_HTXnTBLRFog_SHIFT 8 +#define HC_HTXnTBLRAbias_SHIFT 0 +/* HC_SubA_HTXnLScale 0x0094 + */ +#define HC_HTXnLScale_MASK 0x0007fc00 +#define HC_HTXnLOff_MASK 0x000001ff +#define HC_HTXnLScale_SHIFT 10 +/* HC_SubA_HTXSMD 0x0000 + */ +#define HC_HTXSMD_MASK 0x00000080 +#define HC_HTXTMD_MASK 0x00000040 +#define HC_HTXNum_MASK 0x00000038 +#define HC_HTXTRMD_MASK 0x00000006 +#define HC_HTXCHCLR_MASK 0x00000001 +#define HC_HTXNum_SHIFT 3 + +/* Texture Palette n + */ +#define HC_SubType_TexPalette0 0x00000000 +#define HC_SubType_TexPalette1 0x00000001 +#define HC_SubType_FogTable 0x00000010 +#define HC_SubType_Stipple 0x00000014 +/* HC_SubA_TexPalette0 0x0000 + */ +#define HC_HTPnA_MASK 0xff000000 +#define HC_HTPnR_MASK 0x00ff0000 +#define HC_HTPnG_MASK 0x0000ff00 +#define HC_HTPnB_MASK 0x000000ff +/* HC_SubA_FogTable 0x0010 + */ +#define HC_HFPn3_MASK 0xff000000 +#define HC_HFPn2_MASK 0x00ff0000 +#define HC_HFPn1_MASK 0x0000ff00 +#define HC_HFPn_MASK 0x000000ff +#define HC_HFPn3_SHIFT 24 +#define HC_HFPn2_SHIFT 16 +#define HC_HFPn1_SHIFT 8 + +/* Auto Testing & Security + */ +#define HC_SubA_HenFIFOAT 0x0000 +#define HC_SubA_HFBDrawFirst 0x0004 +#define HC_SubA_HFBBasL 0x0005 +#define HC_SubA_HFBDst 0x0006 +/* HC_SubA_HenFIFOAT 0x0000 + */ +#define HC_HenFIFOAT_MASK 0x00000020 +#define HC_HenGEMILock_MASK 0x00000010 +#define HC_HenFBASwap_MASK 0x00000008 +#define HC_HenOT_MASK 0x00000004 +#define HC_HenCMDQ_MASK 0x00000002 +#define HC_HenTXCTSU_MASK 0x00000001 +/* HC_SubA_HFBDrawFirst 0x0004 + */ +#define HC_HFBDrawFirst_MASK 0x00000800 +#define HC_HFBQueue_MASK 0x00000400 +#define HC_HFBLock_MASK 0x00000200 +#define HC_HEOF_MASK 0x00000100 +#define HC_HFBBasH_MASK 0x000000ff + +/* GEMI Setting + */ +#define HC_SubA_HTArbRCM 0x0008 +#define HC_SubA_HTArbRZ 0x000a +#define HC_SubA_HTArbWZ 0x000b +#define HC_SubA_HTArbRTX 0x000c +#define HC_SubA_HTArbRCW 0x000d +#define HC_SubA_HTArbE2 0x000e +#define HC_SubA_HArbRQCM 0x0010 +#define HC_SubA_HArbWQCM 0x0011 +#define HC_SubA_HGEMITout 0x0020 +#define HC_SubA_HFthRTXD 0x0040 +#define HC_SubA_HFthRTXA 0x0044 +#define HC_SubA_HCMDQstL 0x0050 +#define HC_SubA_HCMDQendL 0x0051 +#define HC_SubA_HCMDQLen 0x0052 +/* HC_SubA_HTArbRCM 0x0008 + */ +#define HC_HTArbRCM_MASK 0x0000ffff +/* HC_SubA_HTArbRZ 0x000a + */ +#define HC_HTArbRZ_MASK 0x0000ffff +/* HC_SubA_HTArbWZ 0x000b + */ +#define HC_HTArbWZ_MASK 0x0000ffff +/* HC_SubA_HTArbRTX 0x000c + */ +#define HC_HTArbRTX_MASK 0x0000ffff +/* HC_SubA_HTArbRCW 0x000d + */ +#define HC_HTArbRCW_MASK 0x0000ffff +/* HC_SubA_HTArbE2 0x000e + */ +#define HC_HTArbE2_MASK 0x0000ffff +/* HC_SubA_HArbRQCM 0x0010 + */ +#define HC_HTArbRQCM_MASK 0x0000ffff +/* HC_SubA_HArbWQCM 0x0011 + */ +#define HC_HArbWQCM_MASK 0x0000ffff +/* HC_SubA_HGEMITout 0x0020 + */ +#define HC_HGEMITout_MASK 0x000f0000 +#define HC_HNPArbZC_MASK 0x0000ffff +#define HC_HGEMITout_SHIFT 16 +/* HC_SubA_HFthRTXD 0x0040 + */ +#define HC_HFthRTXD_MASK 0x00ff0000 +#define HC_HFthRZD_MASK 0x0000ff00 +#define HC_HFthWZD_MASK 0x000000ff +#define HC_HFthRTXD_SHIFT 16 +#define HC_HFthRZD_SHIFT 8 +/* HC_SubA_HFthRTXA 0x0044 + */ +#define HC_HFthRTXA_MASK 0x000000ff + +/****************************************************************************** +** Define the Halcyon Internal register access constants. For simulator only. +******************************************************************************/ +#define HC_SIMA_HAGPBstL 0x0000 +#define HC_SIMA_HAGPBendL 0x0001 +#define HC_SIMA_HAGPCMNT 0x0002 +#define HC_SIMA_HAGPBpL 0x0003 +#define HC_SIMA_HAGPBpH 0x0004 +#define HC_SIMA_HClipTB 0x0005 +#define HC_SIMA_HClipLR 0x0006 +#define HC_SIMA_HFPClipTL 0x0007 +#define HC_SIMA_HFPClipBL 0x0008 +#define HC_SIMA_HFPClipLL 0x0009 +#define HC_SIMA_HFPClipRL 0x000a +#define HC_SIMA_HFPClipTBH 0x000b +#define HC_SIMA_HFPClipLRH 0x000c +#define HC_SIMA_HLP 0x000d +#define HC_SIMA_HLPRF 0x000e +#define HC_SIMA_HSolidCL 0x000f +#define HC_SIMA_HPixGC 0x0010 +#define HC_SIMA_HSPXYOS 0x0011 +#define HC_SIMA_HCmdA 0x0012 +#define HC_SIMA_HCmdB 0x0013 +#define HC_SIMA_HEnable 0x0014 +#define HC_SIMA_HZWBBasL 0x0015 +#define HC_SIMA_HZWBBasH 0x0016 +#define HC_SIMA_HZWBType 0x0017 +#define HC_SIMA_HZBiasL 0x0018 +#define HC_SIMA_HZWBend 0x0019 +#define HC_SIMA_HZWTMD 0x001a +#define HC_SIMA_HZWCDL 0x001b +#define HC_SIMA_HZWCTAGnum 0x001c +#define HC_SIMA_HZCYNum 0x001d +#define HC_SIMA_HZWCFire 0x001e +/* #define HC_SIMA_HSBBasL 0x001d */ +/* #define HC_SIMA_HSBBasH 0x001e */ +/* #define HC_SIMA_HSBFM 0x001f */ +#define HC_SIMA_HSTREF 0x0020 +#define HC_SIMA_HSTMD 0x0021 +#define HC_SIMA_HABBasL 0x0022 +#define HC_SIMA_HABBasH 0x0023 +#define HC_SIMA_HABFM 0x0024 +#define HC_SIMA_HATMD 0x0025 +#define HC_SIMA_HABLCsat 0x0026 +#define HC_SIMA_HABLCop 0x0027 +#define HC_SIMA_HABLAsat 0x0028 +#define HC_SIMA_HABLAop 0x0029 +#define HC_SIMA_HABLRCa 0x002a +#define HC_SIMA_HABLRFCa 0x002b +#define HC_SIMA_HABLRCbias 0x002c +#define HC_SIMA_HABLRCb 0x002d +#define HC_SIMA_HABLRFCb 0x002e +#define HC_SIMA_HABLRAa 0x002f +#define HC_SIMA_HABLRAb 0x0030 +#define HC_SIMA_HDBBasL 0x0031 +#define HC_SIMA_HDBBasH 0x0032 +#define HC_SIMA_HDBFM 0x0033 +#define HC_SIMA_HFBBMSKL 0x0034 +#define HC_SIMA_HROP 0x0035 +#define HC_SIMA_HFogLF 0x0036 +#define HC_SIMA_HFogCL 0x0037 +#define HC_SIMA_HFogCH 0x0038 +#define HC_SIMA_HFogStL 0x0039 +#define HC_SIMA_HFogStH 0x003a +#define HC_SIMA_HFogOOdMF 0x003b +#define HC_SIMA_HFogOOdEF 0x003c +#define HC_SIMA_HFogEndL 0x003d +#define HC_SIMA_HFogDenst 0x003e +/*---- start of texture 0 setting ---- + */ +#define HC_SIMA_HTX0L0BasL 0x0040 +#define HC_SIMA_HTX0L1BasL 0x0041 +#define HC_SIMA_HTX0L2BasL 0x0042 +#define HC_SIMA_HTX0L3BasL 0x0043 +#define HC_SIMA_HTX0L4BasL 0x0044 +#define HC_SIMA_HTX0L5BasL 0x0045 +#define HC_SIMA_HTX0L6BasL 0x0046 +#define HC_SIMA_HTX0L7BasL 0x0047 +#define HC_SIMA_HTX0L8BasL 0x0048 +#define HC_SIMA_HTX0L9BasL 0x0049 +#define HC_SIMA_HTX0LaBasL 0x004a +#define HC_SIMA_HTX0LbBasL 0x004b +#define HC_SIMA_HTX0LcBasL 0x004c +#define HC_SIMA_HTX0LdBasL 0x004d +#define HC_SIMA_HTX0LeBasL 0x004e +#define HC_SIMA_HTX0LfBasL 0x004f +#define HC_SIMA_HTX0L10BasL 0x0050 +#define HC_SIMA_HTX0L11BasL 0x0051 +#define HC_SIMA_HTX0L012BasH 0x0052 +#define HC_SIMA_HTX0L345BasH 0x0053 +#define HC_SIMA_HTX0L678BasH 0x0054 +#define HC_SIMA_HTX0L9abBasH 0x0055 +#define HC_SIMA_HTX0LcdeBasH 0x0056 +#define HC_SIMA_HTX0Lf1011BasH 0x0057 +#define HC_SIMA_HTX0L0Pit 0x0058 +#define HC_SIMA_HTX0L1Pit 0x0059 +#define HC_SIMA_HTX0L2Pit 0x005a +#define HC_SIMA_HTX0L3Pit 0x005b +#define HC_SIMA_HTX0L4Pit 0x005c +#define HC_SIMA_HTX0L5Pit 0x005d +#define HC_SIMA_HTX0L6Pit 0x005e +#define HC_SIMA_HTX0L7Pit 0x005f +#define HC_SIMA_HTX0L8Pit 0x0060 +#define HC_SIMA_HTX0L9Pit 0x0061 +#define HC_SIMA_HTX0LaPit 0x0062 +#define HC_SIMA_HTX0LbPit 0x0063 +#define HC_SIMA_HTX0LcPit 0x0064 +#define HC_SIMA_HTX0LdPit 0x0065 +#define HC_SIMA_HTX0LePit 0x0066 +#define HC_SIMA_HTX0LfPit 0x0067 +#define HC_SIMA_HTX0L10Pit 0x0068 +#define HC_SIMA_HTX0L11Pit 0x0069 +#define HC_SIMA_HTX0L0_5WE 0x006a +#define HC_SIMA_HTX0L6_bWE 0x006b +#define HC_SIMA_HTX0Lc_11WE 0x006c +#define HC_SIMA_HTX0L0_5HE 0x006d +#define HC_SIMA_HTX0L6_bHE 0x006e +#define HC_SIMA_HTX0Lc_11HE 0x006f +#define HC_SIMA_HTX0L0OS 0x0070 +#define HC_SIMA_HTX0TB 0x0071 +#define HC_SIMA_HTX0MPMD 0x0072 +#define HC_SIMA_HTX0CLODu 0x0073 +#define HC_SIMA_HTX0FM 0x0074 +#define HC_SIMA_HTX0TRCH 0x0075 +#define HC_SIMA_HTX0TRCL 0x0076 +#define HC_SIMA_HTX0TBC 0x0077 +#define HC_SIMA_HTX0TRAH 0x0078 +#define HC_SIMA_HTX0TBLCsat 0x0079 +#define HC_SIMA_HTX0TBLCop 0x007a +#define HC_SIMA_HTX0TBLMPfog 0x007b +#define HC_SIMA_HTX0TBLAsat 0x007c +#define HC_SIMA_HTX0TBLRCa 0x007d +#define HC_SIMA_HTX0TBLRCb 0x007e +#define HC_SIMA_HTX0TBLRCc 0x007f +#define HC_SIMA_HTX0TBLRCbias 0x0080 +#define HC_SIMA_HTX0TBLRAa 0x0081 +#define HC_SIMA_HTX0TBLRFog 0x0082 +#define HC_SIMA_HTX0BumpM00 0x0083 +#define HC_SIMA_HTX0BumpM01 0x0084 +#define HC_SIMA_HTX0BumpM10 0x0085 +#define HC_SIMA_HTX0BumpM11 0x0086 +#define HC_SIMA_HTX0LScale 0x0087 +/*---- end of texture 0 setting ---- 0x008f + */ +#define HC_SIMA_TX0TX1_OFF 0x0050 +/*---- start of texture 1 setting ---- + */ +#define HC_SIMA_HTX1L0BasL (HC_SIMA_HTX0L0BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L1BasL (HC_SIMA_HTX0L1BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L2BasL (HC_SIMA_HTX0L2BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L3BasL (HC_SIMA_HTX0L3BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L4BasL (HC_SIMA_HTX0L4BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L5BasL (HC_SIMA_HTX0L5BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L6BasL (HC_SIMA_HTX0L6BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L7BasL (HC_SIMA_HTX0L7BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L8BasL (HC_SIMA_HTX0L8BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L9BasL (HC_SIMA_HTX0L9BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LaBasL (HC_SIMA_HTX0LaBasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LbBasL (HC_SIMA_HTX0LbBasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LcBasL (HC_SIMA_HTX0LcBasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LdBasL (HC_SIMA_HTX0LdBasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LeBasL (HC_SIMA_HTX0LeBasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LfBasL (HC_SIMA_HTX0LfBasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L10BasL (HC_SIMA_HTX0L10BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L11BasL (HC_SIMA_HTX0L11BasL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L012BasH (HC_SIMA_HTX0L012BasH + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L345BasH (HC_SIMA_HTX0L345BasH + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L678BasH (HC_SIMA_HTX0L678BasH + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L9abBasH (HC_SIMA_HTX0L9abBasH + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LcdeBasH (HC_SIMA_HTX0LcdeBasH + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1Lf1011BasH (HC_SIMA_HTX0Lf1011BasH + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L0Pit (HC_SIMA_HTX0L0Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L1Pit (HC_SIMA_HTX0L1Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L2Pit (HC_SIMA_HTX0L2Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L3Pit (HC_SIMA_HTX0L3Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L4Pit (HC_SIMA_HTX0L4Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L5Pit (HC_SIMA_HTX0L5Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L6Pit (HC_SIMA_HTX0L6Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L7Pit (HC_SIMA_HTX0L7Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L8Pit (HC_SIMA_HTX0L8Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L9Pit (HC_SIMA_HTX0L9Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LaPit (HC_SIMA_HTX0LaPit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LbPit (HC_SIMA_HTX0LbPit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LcPit (HC_SIMA_HTX0LcPit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LdPit (HC_SIMA_HTX0LdPit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LePit (HC_SIMA_HTX0LePit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LfPit (HC_SIMA_HTX0LfPit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L10Pit (HC_SIMA_HTX0L10Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L11Pit (HC_SIMA_HTX0L11Pit + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L0_5WE (HC_SIMA_HTX0L0_5WE + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L6_bWE (HC_SIMA_HTX0L6_bWE + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1Lc_11WE (HC_SIMA_HTX0Lc_11WE + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L0_5HE (HC_SIMA_HTX0L0_5HE + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L6_bHE (HC_SIMA_HTX0L6_bHE + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1Lc_11HE (HC_SIMA_HTX0Lc_11HE + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1L0OS (HC_SIMA_HTX0L0OS + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TB (HC_SIMA_HTX0TB + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1MPMD (HC_SIMA_HTX0MPMD + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1CLODu (HC_SIMA_HTX0CLODu + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1FM (HC_SIMA_HTX0FM + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TRCH (HC_SIMA_HTX0TRCH + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TRCL (HC_SIMA_HTX0TRCL + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBC (HC_SIMA_HTX0TBC + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TRAH (HC_SIMA_HTX0TRAH + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LTC (HC_SIMA_HTX0LTC + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LTA (HC_SIMA_HTX0LTA + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBLCsat (HC_SIMA_HTX0TBLCsat + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBLCop (HC_SIMA_HTX0TBLCop + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBLMPfog (HC_SIMA_HTX0TBLMPfog + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBLAsat (HC_SIMA_HTX0TBLAsat + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBLRCa (HC_SIMA_HTX0TBLRCa + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBLRCb (HC_SIMA_HTX0TBLRCb + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBLRCc (HC_SIMA_HTX0TBLRCc + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBLRCbias (HC_SIMA_HTX0TBLRCbias + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBLRAa (HC_SIMA_HTX0TBLRAa + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1TBLRFog (HC_SIMA_HTX0TBLRFog + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1BumpM00 (HC_SIMA_HTX0BumpM00 + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1BumpM01 (HC_SIMA_HTX0BumpM01 + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1BumpM10 (HC_SIMA_HTX0BumpM10 + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1BumpM11 (HC_SIMA_HTX0BumpM11 + HC_SIMA_TX0TX1_OFF) +#define HC_SIMA_HTX1LScale (HC_SIMA_HTX0LScale + HC_SIMA_TX0TX1_OFF) +/*---- end of texture 1 setting ---- 0xaf + */ +#define HC_SIMA_HTXSMD 0x00b0 +#define HC_SIMA_HenFIFOAT 0x00b1 +#define HC_SIMA_HFBDrawFirst 0x00b2 +#define HC_SIMA_HFBBasL 0x00b3 +#define HC_SIMA_HTArbRCM 0x00b4 +#define HC_SIMA_HTArbRZ 0x00b5 +#define HC_SIMA_HTArbWZ 0x00b6 +#define HC_SIMA_HTArbRTX 0x00b7 +#define HC_SIMA_HTArbRCW 0x00b8 +#define HC_SIMA_HTArbE2 0x00b9 +#define HC_SIMA_HGEMITout 0x00ba +#define HC_SIMA_HFthRTXD 0x00bb +#define HC_SIMA_HFthRTXA 0x00bc +/* Define the texture palette 0 + */ +#define HC_SIMA_HTP0 0x0100 +#define HC_SIMA_HTP1 0x0200 +#define HC_SIMA_FOGTABLE 0x0300 +#define HC_SIMA_STIPPLE 0x0400 +#define HC_SIMA_HE3Fire 0x0440 +#define HC_SIMA_TRANS_SET 0x0441 +#define HC_SIMA_HREngSt 0x0442 +#define HC_SIMA_HRFIFOempty 0x0443 +#define HC_SIMA_HRFIFOfull 0x0444 +#define HC_SIMA_HRErr 0x0445 +#define HC_SIMA_FIFOstatus 0x0446 + +/****************************************************************************** +** Define the AGP command header. +******************************************************************************/ +#define HC_ACMD_MASK 0xfe000000 +#define HC_ACMD_SUB_MASK 0x0c000000 +#define HC_ACMD_HCmdA 0xee000000 +#define HC_ACMD_HCmdB 0xec000000 +#define HC_ACMD_HCmdC 0xea000000 +#define HC_ACMD_H1 0xf0000000 +#define HC_ACMD_H2 0xf2000000 +#define HC_ACMD_H3 0xf4000000 +#define HC_ACMD_H4 0xf6000000 + +#define HC_ACMD_H1IO_MASK 0x000001ff +#define HC_ACMD_H2IO1_MASK 0x001ff000 +#define HC_ACMD_H2IO2_MASK 0x000001ff +#define HC_ACMD_H2IO1_SHIFT 12 +#define HC_ACMD_H2IO2_SHIFT 0 +#define HC_ACMD_H3IO_MASK 0x000001ff +#define HC_ACMD_H3COUNT_MASK 0x01fff000 +#define HC_ACMD_H3COUNT_SHIFT 12 +#define HC_ACMD_H4ID_MASK 0x000001ff +#define HC_ACMD_H4COUNT_MASK 0x01fffe00 +#define HC_ACMD_H4COUNT_SHIFT 9 + +/******************************************************************************** +** Define Header +********************************************************************************/ +#define HC_HEADER2 0xF210F110 + +/******************************************************************************** +** Define Dummy Value +********************************************************************************/ +#define HC_DUMMY 0xCCCCCCCC +/******************************************************************************** +** Define for DMA use +********************************************************************************/ +#define HALCYON_HEADER2 0XF210F110 +#define HALCYON_FIRECMD 0XEE100000 +#define HALCYON_FIREMASK 0XFFF00000 +#define HALCYON_CMDB 0XEC000000 +#define HALCYON_CMDBMASK 0XFFFE0000 +#define HALCYON_SUB_ADDR0 0X00000000 +#define HALCYON_HEADER1MASK 0XFFFFFF00 +#define HALCYON_HEADER1 0XF0000000 +#define HC_SubA_HAGPBstL 0x0060 +#define HC_SubA_HAGPBendL 0x0061 +#define HC_SubA_HAGPCMNT 0x0062 +#define HC_SubA_HAGPBpL 0x0063 +#define HC_SubA_HAGPBpH 0x0064 +#define HC_HAGPCMNT_MASK 0x00800000 +#define HC_HCmdErrClr_MASK 0x00400000 +#define HC_HAGPBendH_MASK 0x0000ff00 +#define HC_HAGPBstH_MASK 0x000000ff +#define HC_HAGPBendH_SHIFT 8 +#define HC_HAGPBstH_SHIFT 0 +#define HC_HAGPBpL_MASK 0x00fffffc +#define HC_HAGPBpID_MASK 0x00000003 +#define HC_HAGPBpID_PAUSE 0x00000000 +#define HC_HAGPBpID_JUMP 0x00000001 +#define HC_HAGPBpID_STOP 0x00000002 +#define HC_HAGPBpH_MASK 0x00ffffff + +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_common.h b/xc/lib/GL/mesa/src/drv/via/via_common.h new file mode 100644 index 000000000..58eafc910 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_common.h @@ -0,0 +1,149 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#ifndef _VIA_DRM_H_ +#define _VIA_DRM_H_ + +/* WARNING: These defines must be the same as what the Xserver uses. + * if you change them, you must change the defines in the Xserver. + */ + +#ifndef _VIA_DEFINES_ +#define _VIA_DEFINES_ + +#define VIA_DMA_BUF_ORDER 12 +#define VIA_DMA_BUF_SZ (1 << VIA_DMA_BUF_ORDER) +#define VIA_DMA_BUF_NR 256 +#define VIA_NR_SAREA_CLIPRECTS 8 + +#define VIA_NR_TEX_REGIONS 64 +#define VIA_LOG_MIN_TEX_REGION_SIZE 16 +#endif + +#define VIA_UPLOAD_TEX0IMAGE 0x1 +#define VIA_UPLOAD_TEX1IMAGE 0x2 +#define VIA_UPLOAD_CTX 0x4 +#define VIA_UPLOAD_BUFFERS 0x8 +#define VIA_UPLOAD_TEX0 0x10 +#define VIA_UPLOAD_TEX1 0x20 +#define VIA_UPLOAD_CLIPRECTS 0x40 +/*#define VIA_UPLOAD_ALL 0xff*/ + +/* VIA specific ioctls */ +#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(0x40, drm_via_mem_t) +#define DRM_IOCTL_VIA_FREEMEM DRM_IOW(0x41, drm_via_mem_t) +#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(0x42, drm_via_agp_t) +#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(0x43, drm_via_fb_t) +#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(0x44, drm_via_init_t) +#define DRM_IOCTL_VIA_FLUSH_AGP DRM_IOW(0x45, drm_via_flush_agp_t) +#define DRM_IOCTL_VIA_FLUSH_SYS DRM_IOW(0x46, drm_via_flush_sys_t) + +#define VIA_TEX_SETUP_SIZE 8 + +#define VIA_FRONT 0x1 +#define VIA_BACK 0x2 +#define VIA_DEPTH 0x4 +#define VIA_STENCIL 0x8 +#define VIDEO 0 +#define AGP 1 +typedef struct { + unsigned int offset; + unsigned int size; +} drm_via_agp_t; + +typedef struct { + unsigned int offset; + unsigned int size; +} drm_via_fb_t; + +typedef struct { + unsigned int context; + unsigned int type; + unsigned int size; + unsigned long index; + unsigned long offset; +} drm_via_mem_t; + +typedef struct _drm_via_init { + enum { + VIA_INIT_MAP = 0x01, + VIA_CLEANUP_MAP = 0x02 + } func; + unsigned long sarea_priv_offset; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long agpAddr; +} drm_via_init_t; + + +typedef struct _drm_via_tex_region { + unsigned char next, prev; + unsigned char inUse; + int age; +} drm_via_tex_region_t; + +typedef struct _drm_via_sarea { + unsigned int dirty; + unsigned int nbox; + drm_clip_rect_t boxes[VIA_NR_SAREA_CLIPRECTS]; + drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1]; + int texAge; + int ctxOwner; + int vertexPrim; +} drm_via_sarea_t; + +typedef struct _drm_via_flush_agp { + unsigned int offset; + unsigned int size; + unsigned int index; + int discard; +} drm_via_flush_agp_t; + +typedef struct _drm_via_flush_sys { + unsigned int offset; + unsigned int size; + unsigned long index; + int discard; +} drm_via_flush_sys_t; + +#ifdef __KERNEL__ +int via_fb_init(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int via_mem_alloc(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int via_mem_free(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int via_agp_init(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int via_dma_alloc(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int via_dma_free(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int via_map_init(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int via_flush_agp(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int via_flush_sys(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +#endif +#endif /* _VIA_DRM_H_ */ diff --git a/xc/lib/GL/mesa/src/drv/via/via_context.c b/xc/lib/GL/mesa/src/drv/via/via_context.c new file mode 100644 index 000000000..22359f133 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_context.c @@ -0,0 +1,1162 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glheader.h" +#include "context.h" +#include "mem.h" +#include "matrix.h" +#include "simple_list.h" +#include "extensions.h" + +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" +#include "tnl/tnl.h" +#include "array_cache/acache.h" + +#include "tnl/t_pipeline.h" + +#include "via_screen.h" +#include "via_dri.h" + +#include "via_state.h" +#include "via_tex.h" +#include "via_span.h" +#include "via_tris.h" +#include "via_vb.h" +#include "via_ioctl.h" +#include "via_fb.h" + +#include <X11/Xlibint.h> +#include <stdio.h> +#include "macros.h" + +viaContextPtr current_mesa; +GLuint VIA_DEBUG = 0; +GLuint DRAW_FRONT = 0; +#define DMA_SIZE 2 +GLuint VIA_PERFORMANCE = 0; +#ifdef PERFORMANCE_MEASURE +GLuint busy = 0; +GLuint idle = 0; +hash_element hash_table[HASH_TABLE_SIZE][HASH_TABLE_DEPTH]; +#endif +/*=* John Sheng [2003.5.31] agp tex *=*/ +extern GLuint agpFullCount; + +static GLboolean +AllocateBuffer(viaContextPtr vmesa) +{ + vmesa->front_base = vmesa->driScreen->pFB; + + if (vmesa->drawType == GLX_PBUFFER_BIT) { + if (vmesa->front.map) + via_free_front_buffer(vmesa); + if (!via_alloc_front_buffer(vmesa)) + return GL_FALSE; + } + + if (vmesa->hasBack) { + if (vmesa->back.map) + via_free_back_buffer(vmesa); + if (!via_alloc_back_buffer(vmesa)) + return GL_FALSE; + } + + if (vmesa->hasDepth || vmesa->hasStencil) { + if (vmesa->depth.map) + via_free_depth_buffer(vmesa); + if (!via_alloc_depth_buffer(vmesa)) { + via_free_depth_buffer(vmesa); + return GL_FALSE; + } + } + + return GL_TRUE; +} + +static const GLubyte *viaGetString(GLcontext *ctx, GLenum name) +{ + switch (name) { + case GL_VENDOR: + return (GLubyte *)"VIA Technology"; + case GL_RENDERER: + return (GLubyte *)"Mesa DRI VIA CLE266 20020221"; + default: + return 0; + } +} + +void viaReAllocateBuffers(GLframebuffer *drawbuffer) +{ + GLcontext *ctx; + viaContextPtr vmesa = current_mesa; + + ctx = vmesa->glCtx; + ctx->DrawBuffer->Width = drawbuffer->Width; + ctx->DrawBuffer->Height = drawbuffer->Height; + +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + ctx->DrawBuffer->Accum = 0; + + vmesa->driDrawable->w = ctx->DrawBuffer->Width; + vmesa->driDrawable->h = ctx->DrawBuffer->Height; + LOCK_HARDWARE(vmesa); + + /* Allocate back & depth buffer */ + { + int w, h, bpp; + w = vmesa->driDrawable->w; + h = vmesa->driDrawable->h; + /* back buffer */ + bpp = vmesa->viaScreen->bitsPerPixel; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "driScreen->fbBPP = %d\n", bpp); +#endif + if (bpp == 32) { + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4 + 8; + vmesa->back.size = w * h * bpp / 8; + vmesa->back.pitch = w << 2; + } + else { + w = BUFFER_ALIGN_WIDTH(w * 2, BUFFER_ALIGNMENT) / 2 + 16; + vmesa->back.size = w * h * bpp / 8; + vmesa->back.pitch = w << 1; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "resizebuffer backbuffer: w = %d h = %d bpp = %d sizs = %d\n", + w, h, bpp, vmesa->back.size); +#endif + /* depth buffer */ + w = vmesa->driDrawable->w; + if (vmesa->hasDepth && vmesa->hasStencil) { + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4 + 8; + vmesa->depth.size = w * h * 4; + vmesa->depth.pitch = w << 2; + vmesa->depth.bpp = 32; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "depthBits = 24\n"); + if (VIA_DEBUG) fprintf(stderr, "StencilBits = 8\n"); +#endif + } + else if (vmesa->hasDepth) { + /*=* John Sheng [2003.6.16] patch viewperf drv-08 draw nothing */ + if(vmesa->viaScreen->bitsPerPixel == 32) + vmesa->depthBits = 32; + + if (vmesa->depthBits == 16) { + w = BUFFER_ALIGN_WIDTH(w * 2, BUFFER_ALIGNMENT) / 2 + 16; + vmesa->depth.size = w * h * 2; + vmesa->depth.pitch = w << 1; + vmesa->depth.bpp = 16; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "depthBits = 16\n"); +#endif + } + else { + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4 + 8; + vmesa->depth.size = w * h * 4; + vmesa->depth.pitch = w << 2; + vmesa->depth.bpp = 32; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "depthBits = 32\n"); +#endif + } + } + else if (vmesa->hasStencil) { + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4 + 8; + vmesa->depth.size = w * h * 4; + vmesa->depth.pitch = w << 2; + vmesa->depth.bpp = 32; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "StencilBits = 8\n"); +#endif + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "resizebuffer depthbuffer: w = %d h = %d bpp = %d sizs = %d\n", + w, h, vmesa->depth.bpp, vmesa->depth.size); +#endif + /*=* John Sheng [2003.5.31] flip *=*/ + { + if(vmesa->viaScreen->width == vmesa->driDrawable->w && + vmesa->viaScreen->height == vmesa->driDrawable->h) { + vmesa->back.pitch = vmesa->front.pitch; + vmesa->back.size = vmesa->front.size; + } + } + + if (!AllocateBuffer(vmesa)) { + FREE(vmesa); + } + } + UNLOCK_HARDWARE(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} +static void viaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height) + +{ + /* MESA5.0 */ + viaContextPtr vmesa = current_mesa; + *width = vmesa->driDrawable->w; + *height = vmesa->driDrawable->h; +} + +static void viaInitExtensions(GLcontext *ctx) +{ + _mesa_enable_imaging_extensions(ctx); + _mesa_enable_extension(ctx, "GL_ARB_multitexture"); + _mesa_enable_extension(ctx, "GL_ARB_texture_env_add"); + _mesa_enable_extension(ctx, "GL_EXT_texture_env_add"); + _mesa_enable_extension(ctx, "GL_EXT_stencil_wrap"); + _mesa_enable_extension(ctx, "GL_EXT_texture_lod_bias"); +} + +extern const struct gl_pipeline_stage _via_fastrender_stage; +extern const struct gl_pipeline_stage _via_render_stage; + +static const struct gl_pipeline_stage *via_pipeline[] = { + &_tnl_vertex_transform_stage, + &_tnl_normal_transform_stage, + &_tnl_lighting_stage, + &_tnl_fog_coordinate_stage, + &_tnl_texgen_stage, + &_tnl_texture_transform_stage, + /* REMOVE: point attenuation stage */ +#if 1 + &_via_fastrender_stage, /* ADD: unclipped rastersetup-to-dma */ + &_via_render_stage, /* ADD: modification from _tnl_render_stage */ +#endif + &_tnl_render_stage, + 0, +}; + + +static GLboolean +AllocateDmaBuffer(const GLvisual *visual, viaContextPtr vmesa) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (vmesa->dma[0].map && vmesa->dma[1].map) + via_free_dma_buffer(vmesa); + + if (!via_alloc_dma_buffer(vmesa)) { + if (vmesa->front.map) + via_free_front_buffer(vmesa); + if (vmesa->back.map) + via_free_back_buffer(vmesa); + if (vmesa->depth.map) + via_free_depth_buffer(vmesa); + + return GL_FALSE; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_TRUE; +} + +static void +InitVertexBuffer(viaContextPtr vmesa) +{ + GLuint *addr; + + addr = (GLuint *)vmesa->dma[0].map; + *addr = 0xF210F110; + *addr = (HC_ParaType_NotTex << 16); + *addr = 0xcccccccc; + *addr = 0xdddddddd; + + addr = (GLuint *)vmesa->dma[1].map; + *addr = 0xF210F110; + *addr = (HC_ParaType_NotTex << 16); + *addr = 0xcccccccc; + *addr = 0xdddddddd; + + vmesa->dmaIndex = 0; + vmesa->dmaLow = DMA_OFFSET; + vmesa->dmaHigh = vmesa->dma[0].size; + vmesa->dmaAddr = (unsigned char *)vmesa->dma[0].map; + vmesa->dmaLastPrim = vmesa->dmaLow; +} + +static void +FreeBuffer(viaContextPtr vmesa) +{ + if (vmesa->front.map) + via_free_front_buffer(vmesa); + + if (vmesa->back.map) + via_free_back_buffer(vmesa); + + if (vmesa->depth.map) + via_free_depth_buffer(vmesa); + + if (vmesa->dma[0].map && vmesa->dma[1].map) + via_free_dma_buffer(vmesa); +} + +GLboolean +viaCreateContext(Display *dpy, const __GLcontextModes *mesaVis, + __DRIcontextPrivate *driContextPriv, + void *sharedContextPrivate) +{ + GLcontext *ctx, *shareCtx; + viaContextPtr vmesa; + __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; + viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private; + drm_via_sarea_t *saPriv = (drm_via_sarea_t *) + (((GLubyte *)sPriv->pSAREA) + viaScreen->sareaPrivOffset); + + /* Allocate via context */ + vmesa = (viaContextPtr) CALLOC_STRUCT(via_context_t); + if (!vmesa) { + return GL_FALSE; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + current_mesa = vmesa; + /* pick back buffer */ + if (mesaVis->doubleBufferMode) { + vmesa->hasBack = GL_TRUE; + } + else { + vmesa->hasBack = GL_FALSE; + } + /* pick z buffer */ + if (mesaVis->haveDepthBuffer) { + vmesa->hasDepth = GL_TRUE; + vmesa->depthBits = mesaVis->depthBits; + } + else { + vmesa->hasDepth = GL_FALSE; + vmesa->depthBits = 0; + } + /* pick stencil buffer */ + if (mesaVis->haveStencilBuffer) { + vmesa->hasStencil = GL_TRUE; + vmesa->stencilBits = mesaVis->stencilBits; + } + else { + vmesa->hasStencil = GL_FALSE; + vmesa->stencilBits = 0; + } + + /* Allocate the Mesa context */ + if (sharedContextPrivate) + shareCtx = ((viaContextPtr) sharedContextPrivate)->glCtx; + else + shareCtx = NULL; + + vmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, vmesa, GL_TRUE); + + vmesa->shareCtx = shareCtx; + + if (!vmesa->glCtx) { + FREE(vmesa); + return GL_FALSE; + } + driContextPriv->driverPrivate = vmesa; + + ctx = vmesa->glCtx; + + /* check */ + if (viaScreen->textureSize < 2 * 1024 * 1024) { + ctx->Const.MaxTextureLevels = 9; + } + else if (viaScreen->textureSize < 8 * 1024 * 1024) { + ctx->Const.MaxTextureLevels = 10; + } + else { + ctx->Const.MaxTextureLevels = 11; + } + ctx->Const.MaxTextureUnits = 2; + + ctx->Const.MinLineWidth = 1.0; + ctx->Const.MinLineWidthAA = 1.0; + ctx->Const.MaxLineWidth = 3.0; + ctx->Const.MaxLineWidthAA = 3.0; + ctx->Const.LineWidthGranularity = 1.0; + + ctx->Const.MinPointSize = 1.0; + ctx->Const.MinPointSizeAA = 1.0; + ctx->Const.MaxPointSize = 3.0; + ctx->Const.MaxPointSizeAA = 3.0; + ctx->Const.PointSizeGranularity = 1.0; + + ctx->Driver.GetBufferSize = viaBufferSize; + ctx->Driver.GetString = viaGetString; + + ctx->DriverCtx = (void *)vmesa; + vmesa->glCtx = ctx; + + /* Initialize the software rasterizer and helper modules. + */ + _swrast_CreateContext(ctx); + _ac_CreateContext(ctx); + _tnl_CreateContext(ctx); + _swsetup_CreateContext(ctx); + + /* Install the customized pipeline: + */ + _tnl_destroy_pipeline(ctx); + _tnl_install_pipeline(ctx, via_pipeline); + + /* Configure swrast to match hardware characteristics: + */ + _swrast_allow_pixel_fog(ctx, GL_FALSE); + _swrast_allow_vertex_fog(ctx, GL_TRUE); + + /*vmesa->display = dpy;*/ + vmesa->display = sPriv->display; + + vmesa->hHWContext = driContextPriv->hHWContext; + vmesa->driFd = sPriv->fd; + vmesa->driHwLock = &sPriv->pSAREA->lock; + + vmesa->viaScreen = viaScreen; + vmesa->driScreen = sPriv; + vmesa->sarea = saPriv; + vmesa->glBuffer = NULL; + + vmesa->texHeap = mmInit(0, viaScreen->textureSize); + vmesa->stippleInHw = 1; + vmesa->renderIndex = ~0; + vmesa->dirty = VIA_UPLOAD_ALL; + vmesa->uploadCliprects = GL_TRUE; + vmesa->needUploadAllState = 1; + + make_empty_list(&vmesa->TexObjList); + make_empty_list(&vmesa->SwappedOut); + + vmesa->CurrentTexObj[0] = 0; + vmesa->CurrentTexObj[1] = 0; + + vmesa->dma[0].size = DMA_SIZE * 1024 * 1024; + vmesa->dma[1].size = DMA_SIZE * 1024 * 1024; + + _math_matrix_ctr(&vmesa->ViewportMatrix); + + viaInitExtensions(ctx); + viaInitStateFuncs(ctx); + viaInitTextureFuncs(ctx); + viaInitTriFuncs(ctx); + viaInitSpanFuncs(ctx); + viaInitIoctlFuncs(ctx); + viaInitVB(ctx); + viaInitState(ctx); + + if (getenv("VIA_DEBUG")) + VIA_DEBUG = 1; + else + VIA_DEBUG = 0; + + if (getenv("DRAW_FRONT")) + DRAW_FRONT = 1; + else + DRAW_FRONT = 0; + +#ifdef PERFORMANCE_MEASURE + if (getenv("VIA_PERFORMANCE")) + VIA_PERFORMANCE = 1; + else + VIA_PERFORMANCE = 0; + + { + int i, j; + for (i = 0; i < HASH_TABLE_SIZE; i++) { + for (j = 0; j < HASH_TABLE_DEPTH; j ++) { + hash_table[i][j].count = 0; + sprintf(hash_table[i][j].func, "%s", "NULL"); + } + } + } +#endif + + if (!AllocateDmaBuffer(mesaVis, vmesa)) { + fprintf(stderr ,"AllocateDmaBuffer fail\n"); + FREE(vmesa); + return GL_FALSE; + } + + InitVertexBuffer(vmesa); + + vmesa->regMMIOBase = (GLuint *)((GLuint)viaScreen->reg); + vmesa->pnGEMode = (GLuint *)((GLuint)viaScreen->reg + 0x4); + vmesa->regEngineStatus = (GLuint *)((GLuint)viaScreen->reg + 0x400); + vmesa->regTranSet = (GLuint *)((GLuint)viaScreen->reg + 0x43C); + vmesa->regTranSpace = (GLuint *)((GLuint)viaScreen->reg + 0x440); + vmesa->agpBase = viaScreen->agpBase; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "regEngineStatus = %x\n", *vmesa->regEngineStatus); + } + + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + { + GLboolean saam; + int count = 0, fbSize; + saam = XineramaIsActive(vmesa->display); + if (saam && vmesa->viaScreen->drixinerama) { + vmesa->xsi = XineramaQueryScreens(vmesa->display, &count); + /* Test RightOf or Down */ + if (vmesa->xsi[0].x_org == 0 && vmesa->xsi[0].y_org == 0) { + if (vmesa->xsi[1].x_org == vmesa->xsi[1].width) { + vmesa->saam = RightOf; + } + else { + vmesa->saam = Down; + } + } + /* Test LeftOf or Up */ + else if (vmesa->xsi[0].x_org == vmesa->xsi[0].width) { + vmesa->saam = LeftOf; + } + else if (vmesa->xsi[0].y_org == vmesa->xsi[0].height) { + vmesa->saam = Up; + } + else + vmesa->saam = 0; + + + fbSize = vmesa->viaScreen->fbSize; + } + else + vmesa->saam = 0; + } + + vmesa->pSaamRects = (XF86DRIClipRectPtr) malloc(sizeof(XF86DRIClipRectRec)); + return GL_TRUE; +} + +void +viaDestroyContext(__DRIcontextPrivate *driContextPriv) +{ + viaContextPtr vmesa = (viaContextPtr)driContextPriv->driverPrivate; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + assert(vmesa); /* should never be null */ + viaFlushPrimsLocked(vmesa); + WAIT_IDLE + if (vmesa) { + /*=* John Sheng [2003.5.31] flip *=*/ + if(vmesa->doPageFlip) { + *((GLuint *)((GLuint)vmesa->regMMIOBase + 0x43c)) = 0x00fe0000; + *((GLuint *)((GLuint)vmesa->regMMIOBase + 0x440)) = 0x00001004; + WAIT_IDLE + *((GLuint *)((GLuint)vmesa->regMMIOBase + 0x214)) = 0; + } + /*=* John Sheng [2003.5.31] agp tex *=*/ + if(VIA_DEBUG) fprintf(stderr, "agpFullCount = %d\n", agpFullCount); + + _swsetup_DestroyContext(vmesa->glCtx); + _tnl_DestroyContext(vmesa->glCtx); + _ac_DestroyContext(vmesa->glCtx); + _swrast_DestroyContext(vmesa->glCtx); + viaFreeVB(vmesa->glCtx); + FreeBuffer(vmesa); + /* free the Mesa context */ + _mesa_destroy_context(vmesa->glCtx); + vmesa->glCtx->DriverCtx = NULL; + Xfree(vmesa); + } + + P_M_R; + +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) fprintf(stderr, "idle = %d\n", idle); + if (VIA_PERFORMANCE) fprintf(stderr, "busy = %d\n", busy); +#endif +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaXMesaSetFrontClipRects(viaContextPtr vmesa) +{ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; + + vmesa->numClipRects = dPriv->numClipRects; + vmesa->pClipRects = dPriv->pClipRects; + vmesa->drawX = dPriv->x; + vmesa->drawY = dPriv->y; + vmesa->drawW = dPriv->w; + vmesa->drawH = dPriv->h; + + viaEmitDrawingRectangle(vmesa); + vmesa->uploadCliprects = GL_TRUE; +} + +void viaXMesaSetBackClipRects(viaContextPtr vmesa) +{ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; +#if 0 + /*=* John Sheng [2003.6.9] fix glxgears dirty screen */ + /*if (vmesa->saam) {*/ + vmesa->numClipRects = dPriv->numClipRects; + vmesa->pClipRects = dPriv->pClipRects; + vmesa->drawX = dPriv->x; + vmesa->drawY = dPriv->y; + vmesa->drawW = dPriv->w; + vmesa->drawH = dPriv->h; + /*} + else { + if (dPriv->numBackClipRects == 0) { + vmesa->numClipRects = dPriv->numClipRects; + vmesa->pClipRects = dPriv->pClipRects; + vmesa->drawX = dPriv->x; + vmesa->drawY = dPriv->y; + vmesa->drawW = dPriv->w; + vmesa->drawH = dPriv->h; + } + else { + vmesa->numClipRects = dPriv->numBackClipRects; + vmesa->pClipRects = dPriv->pBackClipRects; + vmesa->drawX = dPriv->backX; + vmesa->drawY = dPriv->backY; + vmesa->drawW = dPriv->w; + vmesa->drawH = dPriv->h; + } + }*/ +#else + vmesa->numClipRects = dPriv->numBackClipRects; + vmesa->pClipRects = dPriv->pBackClipRects; + vmesa->drawX = dPriv->backX; + vmesa->drawY = dPriv->backY; + vmesa->drawW = dPriv->w; + vmesa->drawH = dPriv->h; +/*FIXME*/ fprintf(stderr, "SetBackClipRects (%d %d %d %d %d)\n", + vmesa->numClipRects, vmesa->drawX, vmesa->drawY, + vmesa->drawW, vmesa->drawH); + +#endif + viaEmitDrawingRectangle(vmesa); + vmesa->uploadCliprects = GL_TRUE; +} + +void viaXMesaWindowMoved(viaContextPtr vmesa) +{ + GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; + GLuint side = 0; + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; + + switch (vmesa->glCtx->Color.DriverDrawBuffer) { + case GL_FRONT_LEFT: + viaXMesaSetFrontClipRects(vmesa); + break; + case GL_BACK_LEFT: + viaXMesaSetBackClipRects(vmesa); + break; + default: + break; + } + + side = vmesa->saam & P_MASK; + + switch (side) { + case RightOf: + /* full in screen 1 */ + if (vmesa->drawX >= vmesa->xsi[0].width) { + vmesa->viaScreen->fbOffset = vmesa->viaScreen->fbSize; + vmesa->drawX = vmesa->drawX - vmesa->xsi[1].width; + vmesa->numClipRects = dPriv->numBackClipRects; + vmesa->pClipRects = dPriv->pBackClipRects; + vmesa->drawX = dPriv->backX; + vmesa->drawY = dPriv->backY; + vmesa->saam &= ~S0; + vmesa->saam |= S1; + } + /* full in screen 0 */ + else if ((vmesa->drawX + vmesa->drawW) <= vmesa->xsi[0].width) { + vmesa->viaScreen->fbOffset = 0; + vmesa->saam &= ~S1; + vmesa->saam |= S0; + } + /* between screen 0 && screen 1 */ + else { + vmesa->numSaamRects = dPriv->numBackClipRects; + vmesa->pSaamRects = dPriv->pBackClipRects; + vmesa->drawXSaam = dPriv->backX; + vmesa->drawYSaam = dPriv->backY; + vmesa->viaScreen->fbOffset = 0; + vmesa->saam |= S0; + vmesa->saam |= S1; + } + break; + case LeftOf: + /* full in screen 1 */ + if (vmesa->drawX + vmesa->drawW <= 0) { + vmesa->viaScreen->fbOffset = vmesa->viaScreen->fbSize; + vmesa->drawX = vmesa->drawX + vmesa->xsi[1].width; + vmesa->numClipRects = dPriv->numBackClipRects; + vmesa->pClipRects = dPriv->pBackClipRects; + vmesa->drawX = dPriv->backX; + vmesa->drawY = dPriv->backY; + vmesa->saam &= ~S0; + vmesa->saam |= S1; + } + /* full in screen 0 */ + else if (vmesa->drawX >= 0) { + vmesa->viaScreen->fbOffset = 0; + vmesa->saam &= ~S1; + vmesa->saam |= S0; + } + /* between screen 0 && screen 1 */ + else { + vmesa->numSaamRects = dPriv->numBackClipRects; + vmesa->pSaamRects = dPriv->pBackClipRects; + vmesa->drawXSaam = dPriv->backX; + vmesa->drawYSaam = dPriv->backY; + vmesa->viaScreen->fbOffset = 0; + vmesa->saam |= S0; + vmesa->saam |= S1; + } + break; + case Down : + /* full in screen 1 */ + if (vmesa->drawY >= vmesa->xsi[0].height) { + vmesa->viaScreen->fbOffset = vmesa->viaScreen->fbSize; + vmesa->drawY = vmesa->drawY - vmesa->xsi[1].height; + vmesa->numClipRects = dPriv->numBackClipRects; + vmesa->pClipRects = dPriv->pBackClipRects; + vmesa->drawX = dPriv->backX; + vmesa->drawY = dPriv->backY; + vmesa->saam &= ~S0; + vmesa->saam |= S1; + } + /* full in screen 0 */ + else if ((vmesa->drawY + vmesa->drawH) <= vmesa->xsi[0].height) { + vmesa->viaScreen->fbOffset = 0; + vmesa->saam &= ~S1; + vmesa->saam |= S0; + } + /* between screen 0 && screen 1 */ + else { + vmesa->numSaamRects = dPriv->numBackClipRects; + vmesa->pSaamRects = dPriv->pBackClipRects; + vmesa->drawXSaam = dPriv->backX; + vmesa->drawYSaam = dPriv->backY; + vmesa->viaScreen->fbOffset = 0; + vmesa->saam |= S0; + vmesa->saam |= S1; + } + break; + case Up : + /* full in screen 1 */ + if ((vmesa->drawY + vmesa->drawH) <= 0) { + vmesa->viaScreen->fbOffset = vmesa->viaScreen->fbSize; + vmesa->drawY = vmesa->drawY + vmesa->xsi[1].height; + vmesa->numClipRects = dPriv->numBackClipRects; + vmesa->pClipRects = dPriv->pBackClipRects; + vmesa->drawX = dPriv->backX; + vmesa->drawY = dPriv->backY; + vmesa->saam &= ~S0; + vmesa->saam |= S1; + } + /* full in screen 0 */ + else if (vmesa->drawY >= 0) { + vmesa->viaScreen->fbOffset = 0; + vmesa->saam &= ~S1; + vmesa->saam |= S0; + } + /* between screen 0 && screen 1 */ + else { + vmesa->numSaamRects = dPriv->numBackClipRects; + vmesa->pSaamRects = dPriv->pBackClipRects; + vmesa->drawXSaam = dPriv->backX; + vmesa->drawYSaam = dPriv->backY; + vmesa->viaScreen->fbOffset = 0; + vmesa->saam |= S0; + vmesa->saam |= S1; + } + break; + default: + vmesa->viaScreen->fbOffset = 0; + } + + { + GLuint pitch, offset; + pitch = vmesa->front.pitch; + offset = vmesa->viaScreen->fbOffset + (vmesa->drawY * pitch + vmesa->drawX * bytePerPixel); + vmesa->drawXoff = (GLuint)((offset & 0x1f) / bytePerPixel); + if (vmesa->saam) { + if (vmesa->pSaamRects) { + offset = vmesa->viaScreen->fbOffset + (vmesa->pSaamRects[0].y1 * pitch + + vmesa->pSaamRects[0].x1 * bytePerPixel); + vmesa->drawXoffSaam = (GLuint)((offset & 0x1f) / bytePerPixel); + } + else + vmesa->drawXoffSaam = 0; + } + else + vmesa->drawXoffSaam = 0; + } + + vmesa->glCtx->Driver.Viewport(vmesa->glCtx,0 ,0 ,0 ,0); +} + +GLboolean +viaUnbindContext(__DRIcontextPrivate *driContextPriv) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_TRUE; +} + +GLboolean +viaMakeCurrent(__DRIcontextPrivate *driContextPriv, + __DRIdrawablePrivate *driDrawPriv, + __DRIdrawablePrivate *driReadPriv) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + + if (VIA_DEBUG) { + fprintf(stderr, "driContextPriv = %08x\n", (GLuint)driContextPriv); + fprintf(stderr, "driContextPriv = %08x\n", (GLuint)driDrawPriv); + fprintf(stderr, "driContextPriv = %08x\n", (GLuint)driReadPriv); + } +#endif + + if (driContextPriv) { + viaContextPtr vmesa = (viaContextPtr)driContextPriv->driverPrivate; + current_mesa = vmesa; + + vmesa->driDrawable = driDrawPriv; + + if (vmesa->drawType == GLX_PBUFFER_BIT) { + int w, h, bpp; + + w = vmesa->driDrawable->w; + h = vmesa->driDrawable->h; + bpp = vmesa->viaScreen->bitsPerPixel; + if (bpp == 32) { + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4; + vmesa->front.size = w * h * bpp / 8; + vmesa->front.pitch = w << 2; + } + else { + w = BUFFER_ALIGN_WIDTH(w * 2, BUFFER_ALIGNMENT) / 2; + vmesa->front.size = w * h * bpp / 8; + vmesa->front.pitch = w << 1; + } + } + else { + GLuint w; + /*=* John Sheng [2003.5.31] flip *=*/ + GLuint h; + h = vmesa->viaScreen->height; + + w = vmesa->viaScreen->width; + w = BUFFER_ALIGN_WIDTH(w, BUFFER_ALIGNMENT); + if (vmesa->viaScreen->bitsPerPixel == 0x20) { + vmesa->front.pitch = w << 2; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaScreen->bitsPerPixel = %d\n", 32); +#endif + } + else if (vmesa->viaScreen->bitsPerPixel == 0x10) { + vmesa->front.pitch = w << 1; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaScreen->bitsPerPixel = %d\n", 16); +#endif + } + /*=* John Sheng [2003.5.31] flip *=*/ + vmesa->front.offset = 0; + vmesa->front.map = (char *) vmesa->driScreen->pFB; + vmesa->front.size = w * h * vmesa->viaScreen->bitsPerPixel /8; + } + + /* Allocate back & depth buffer */ + { + int w, h, bpp; + + w = vmesa->driDrawable->w; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaMakeCurrent: w = %d\n", w); +#endif + h = vmesa->driDrawable->h; + + /* back buffer */ + bpp = vmesa->viaScreen->bitsPerPixel; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "driScreen->fbBPP = %d\n", bpp); +#endif + if (bpp == 32) { + if (vmesa->drawType == GLX_PBUFFER_BIT) + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4; + else + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4 + 8; + + vmesa->back.size = w * h * bpp / 8; + vmesa->back.pitch = w << 2; + } + else { + if (vmesa->drawType == GLX_PBUFFER_BIT) + w = BUFFER_ALIGN_WIDTH(w * 2, BUFFER_ALIGNMENT) / 2; + else + w = BUFFER_ALIGN_WIDTH(w * 2, BUFFER_ALIGNMENT) / 2 + 16; + + vmesa->back.size = w * h * bpp / 8; + vmesa->back.pitch = w << 1; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaMakeCurrent backbuffer: w = %d h = %d bpp = %d sizs = %d\n", + w, h, bpp, vmesa->back.size); +#endif + /* depth buffer */ + w = vmesa->driDrawable->w; + + if (vmesa->hasDepth && vmesa->hasStencil) { + if (vmesa->drawType == GLX_PBUFFER_BIT) + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4; + else + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4 + 8; + + vmesa->depth.size = w * h * 4; + vmesa->depth.pitch = w << 2; + vmesa->depth.bpp = 32; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "depthBits = 24\n"); + if (VIA_DEBUG) fprintf(stderr, "StencilBits = 8\n"); +#endif + } + else if (vmesa->hasDepth) { + + /*=* John Sheng [2003.6.16] patch viewperf drv-08 draw nothing */ + if(vmesa->viaScreen->bitsPerPixel == 32) + vmesa->depthBits = 32; + + if (vmesa->depthBits == 16) { + if (vmesa->drawType == GLX_PBUFFER_BIT) + w = BUFFER_ALIGN_WIDTH(w * 2, BUFFER_ALIGNMENT) / 2; + else + w = BUFFER_ALIGN_WIDTH(w * 2, BUFFER_ALIGNMENT) / 2 + 16; + + vmesa->depth.size = w * h * 2; + vmesa->depth.pitch = w << 1; + vmesa->depth.bpp = 16; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "depthBits = 16\n"); +#endif + } + else { + if (vmesa->drawType == GLX_PBUFFER_BIT) + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4; + else + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4 + 8; + + vmesa->depth.size = w * h * 4; + vmesa->depth.pitch = w << 2; + vmesa->depth.bpp = 32; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "depthBits = 32\n"); +#endif + } + } + else if (vmesa->hasStencil) { + if (vmesa->drawType == GLX_PBUFFER_BIT) + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4; + else + w = BUFFER_ALIGN_WIDTH(w * 4, BUFFER_ALIGNMENT) / 4 + 8; + + vmesa->depth.size = w * h * 4; + vmesa->depth.pitch = w << 2; + vmesa->depth.bpp = 32; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "StencilBits = 8\n"); +#endif + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaMakeCurrent depthbuffer: w = %d h = %d bpp = %d sizs = %d\n", + w, h, vmesa->depth.bpp, vmesa->depth.size); +#endif + /*=* John Sheng [2003.5.31] flip *=*/ + { + viaContextPtr vmesa = (viaContextPtr)driContextPriv->driverPrivate; + if(vmesa->viaScreen->width == vmesa->driDrawable->w && + vmesa->viaScreen->height == vmesa->driDrawable->h) { + vmesa->doPageFlip = GL_FALSE; + vmesa->currentPage = 0; + vmesa->back.pitch = vmesa->front.pitch; + } + } + + if (!AllocateBuffer(vmesa)) { + FREE(vmesa); + return GL_FALSE; + } + } + _mesa_make_current2(vmesa->glCtx, + (GLframebuffer *)driDrawPriv->driverPrivate, + (GLframebuffer *)driReadPriv->driverPrivate); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Context %d MakeCurrent\n", vmesa->hHWContext); +#endif + viaXMesaWindowMoved(vmesa); + if (!vmesa->glCtx->Viewport.Width) + _mesa_set_viewport(vmesa->glCtx, 0, 0, + driDrawPriv->w, driDrawPriv->h); + + } + else { +#ifdef DEBUG + viaContextPtr vmesa = (viaContextPtr)driContextPriv->driverPrivate; + if (VIA_DEBUG) fprintf(stderr, "Context %d LoseCurrent\n", vmesa->hHWContext); +#endif + _mesa_make_current(0,0); + } + +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_TRUE; +} + +void viaGetLock(viaContextPtr vmesa, GLuint flags) +{ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; + __DRIscreenPrivate *sPriv = vmesa->driScreen; + drm_via_sarea_t *sarea = vmesa->sarea; + int me = vmesa->hHWContext; + __DRIdrawablePrivate *pdp; + __DRIscreenPrivate *psp; + pdp = dPriv; + psp = sPriv; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + if (VIA_DEBUG) fprintf(stderr, "drmGetLock - in\n"); +#endif + drmGetLock(vmesa->driFd, vmesa->hHWContext, flags); + + do { + DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, + pdp->driContextPriv->hHWContext); + DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + __driUtilUpdateDrawableInfo(vmesa->display, psp->myNum, dPriv); + DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, + pdp->driContextPriv->hHWContext); + } while (0); + + if (sarea->ctxOwner != me) { + vmesa->uploadCliprects = GL_TRUE; + sarea->ctxOwner = me; + } + + viaXMesaWindowMoved(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaLock(viaContextPtr vmesa, GLuint flags) +{ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; + __DRIscreenPrivate *sPriv = vmesa->driScreen; + + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + + /*=* John Sheng [2003.6.16] for xf43 */ + if(dPriv->pStamp == NULL) + dPriv->pStamp = &dPriv->lastStamp; + + if (*(dPriv->pStamp) != dPriv->lastStamp || vmesa->saam) { + GLuint scrn; + scrn = vmesa->saam & S_MASK; + + DRM_SPINLOCK(&sPriv->pSAREA->drawable_lock, sPriv->drawLockID); + + if (scrn == S1) + __driUtilUpdateDrawableInfo(vmesa->display, scrn, dPriv); + else + DRI_VALIDATE_DRAWABLE_INFO_ONCE(vmesa->display, scrn, dPriv); + + viaXMesaWindowMoved(vmesa); + DRM_SPINUNLOCK(&sPriv->pSAREA->drawable_lock, sPriv->drawLockID); + } + + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); + + return; +} + +void viaUnLock(viaContextPtr vmesa, GLuint flags) +{ + drm_via_sarea_t *sarea = vmesa->sarea; + int me = vmesa->hHWContext; + +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + if (VIA_DEBUG) fprintf(stderr, "sarea->ctxOwner = %d\n", sarea->ctxOwner); + if (VIA_DEBUG) fprintf(stderr, "me = %d\n", me); +#endif + if (sarea->ctxOwner == me) { + sarea->ctxOwner = 0; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void +viaSwapBuffers(Display *dpy, void *drawablePrivate) +{ + __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *)drawablePrivate; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { + viaContextPtr vmesa; + GLcontext *ctx; + + vmesa = (viaContextPtr)dPriv->driContextPriv->driverPrivate; + ctx = vmesa->glCtx; + if (ctx->Visual.doubleBufferMode) { + _mesa_swapbuffers(ctx); + if (vmesa->doPageFlip) { + viaPageFlip(dPriv); + } + else { + viaCopyBuffer(dPriv); + } + } + else + VIA_FIREVERTICES(vmesa); + } + else { + _mesa_problem(NULL, "viaSwapBuffers: drawable has no context!\n"); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} diff --git a/xc/lib/GL/mesa/src/drv/via/via_context.h b/xc/lib/GL/mesa/src/drv/via/via_context.h new file mode 100644 index 000000000..088a0f448 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_context.h @@ -0,0 +1,444 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +#ifndef _VIACONTEXT_H +#define _VIACONTEXT_H + +typedef struct via_context_t viaContext; +typedef struct via_context_t *viaContextPtr; +typedef struct via_texture_object_t *viaTextureObjectPtr; + +#include <X11/Xlibint.h> + +#include "mtypes.h" +#include "drm.h" +#include "mm.h" + +#include "via_screen.h" +#include "via_tex.h" +#include "via_common.h" +#include "xf86drmVIA.h" +#include "../../../../../include/extensions/Xinerama.h" +#define VIA_FALLBACK_TEXTURE 0x1 +#define VIA_FALLBACK_DRAW_BUFFER 0x2 +#define VIA_FALLBACK_READ_BUFFER 0x4 +#define VIA_FALLBACK_COLORMASK 0x8 +#define VIA_FALLBACK_SPECULAR 0x20 +#define VIA_FALLBACK_LOGICOP 0x40 +#define VIA_FALLBACK_RENDERMODE 0x80 +#define VIA_FALLBACK_STENCIL 0x100 +#define VIA_FALLBACK_BLEND_EQ 0x200 +#define VIA_FALLBACK_BLEND_FUNC 0x400 + +#define VIA_UPLOAD_NONE 0x0000 +#define VIA_UPLOAD_ALPHATEST 0x0001 +#define VIA_UPLOAD_BLEND 0x0002 +#define VIA_UPLOAD_FOG 0x0004 +#define VIA_UPLOAD_MASK_ROP 0x0008 +#define VIA_UPLOAD_LINESTIPPLE 0x0010 +#define VIA_UPLOAD_POLYGONSTIPPLE 0x0020 +#define VIA_UPLOAD_DEPTH 0x0040 +#define VIA_UPLOAD_TEXTURE 0x0080 +#define VIA_UPLOAD_STENCIL 0x0100 +#define VIA_UPLOAD_CLIPPING 0x0200 +#define VIA_UPLOAD_DESTBUFFER 0x0400 +#define VIA_UPLOAD_DEPTHBUFFER 0x0800 +#define VIA_UPLOAD_ENABLE 0x0800 +#define VIA_UPLOAD_ALL 0x1000 + +/* Use the templated vertex formats: + */ +#define TAG(x) via##x +#include "tnl_dd/t_dd_vertex.h" +#undef TAG +#define BUFFER_ALIGNMENT 32 +#define BUFFER_ALIGN_WIDTH1(w, a) (((w) + ((a) - 1)) & ~((a) - 1)) +#define BUFFER_ALIGN_WIDTH(w, a) (((w) & ((a) - 1)) ? BUFFER_ALIGN_WIDTH1(w, a) : (w)) +#define BUFFER_ALIGN_ADDRESS(p, a) ((GLvoid *)(((GLint)(p)) + ((a)-1) & ~((a)-1))) +#define RightOf 1 +#define LeftOf 2 +#define Down 4 +#define Up 8 +#define S0 16 +#define S1 32 +#define P_MASK 0x0f; +#define S_MASK 0x30; +typedef void (*via_tri_func)(viaContextPtr, viaVertex *, viaVertex *, + viaVertex *); +typedef void (*via_line_func)(viaContextPtr, viaVertex *, viaVertex *); +typedef void (*via_point_func)(viaContextPtr, viaVertex *); + +typedef struct { + drmHandle handle; + drmSize size; + GLuint offset; + GLuint index; + GLuint pitch; + GLuint bpp; + char *map; +} viaBuffer, *viaBufferPtr; + +typedef struct { + drmHandle handle; + drmSize size; + GLuint offset; + GLuint index; + unsigned char* map; +} viaDmaBuffer, *viaDmaBufferPtr; + +struct via_context_t { + GLint refcount; + GLcontext *glCtx; + GLcontext *shareCtx; + unsigned char* front_base; + viaBuffer front; + viaBuffer back; + viaBuffer depth; + GLboolean hasBack; + GLboolean hasDepth; + GLboolean hasStencil; + GLboolean hasAccum; + GLuint depthBits; + GLuint stencilBits; + viaDmaBuffer dma[2]; + viaRegion tex; + + GLuint isAGP; + + /* Textures + */ + viaTextureObjectPtr CurrentTexObj[2]; + struct via_texture_object_t TexObjList; + struct via_texture_object_t SwappedOut; + memHeap_t *texHeap; + + /* Bit flag to keep 0track of fallbacks. + */ + GLuint Fallback; + + /* Temporaries for translating away float colors: + */ + struct gl_client_array UbyteColor; + struct gl_client_array UbyteSecondaryColor; + + /* State for via_vb.c and via_tris.c. + */ + GLuint newState; /* _NEW_* flags */ + GLuint setupNewInputs; + GLuint setupIndex; + GLuint renderIndex; + GLmatrix ViewportMatrix; + GLenum renderPrimitive; + GLenum reducedPrimitive; + GLuint hwPrimitive; + unsigned char *verts; + + /* drmBufPtr dma_buffer; + */ + unsigned char* dmaAddr; + GLuint dmaIndex; + GLuint dmaLow; + GLuint dmaHigh; + GLuint dmaLastPrim; + GLboolean useAgp; + + GLboolean uploadCliprects; + + GLuint needUploadAllState; + GLuint primitiveRendered; + + + /* Fallback rasterization functions + */ + via_point_func drawPoint; + via_line_func drawLine; + via_tri_func drawTri; + + /* Hardware register + */ + GLuint regCmdA; + GLuint regCmdA_End; + GLuint regCmdB; + + GLuint regEnable; + GLuint regHFBBMSKL; + GLuint regHROP; + + GLuint regHZWTMD; + GLuint regHSTREF; + GLuint regHSTMD; + + GLuint regHATMD; + GLuint regHABLCsat; + GLuint regHABLCop; + GLuint regHABLAsat; + GLuint regHABLAop; + GLuint regHABLRCa; + GLuint regHABLRFCa; + GLuint regHABLRCbias; + GLuint regHABLRCb; + GLuint regHABLRFCb; + GLuint regHABLRAa; + GLuint regHABLRAb; + GLuint regHFogLF; + GLuint regHFogCL; + GLuint regHFogCH; + + GLuint regHLP; + GLuint regHLPRF; + + GLuint regHTXnTB_0; + GLuint regHTXnMPMD_0; + GLuint regHTXnTBLCsat_0; + GLuint regHTXnTBLCop_0; + GLuint regHTXnTBLMPfog_0; + GLuint regHTXnTBLAsat_0; + GLuint regHTXnTBLRCb_0; + GLuint regHTXnTBLRAa_0; + GLuint regHTXnTBLRFog_0; + + GLuint regHTXnTB_1; + GLuint regHTXnMPMD_1; + GLuint regHTXnTBLCsat_1; + GLuint regHTXnTBLCop_1; + GLuint regHTXnTBLMPfog_1; + GLuint regHTXnTBLAsat_1; + GLuint regHTXnTBLRCb_1; + GLuint regHTXnTBLRAa_1; + GLuint regHTXnTBLRFog_1; + + /* Hardware state + */ + GLuint dirty; + int vertexSize; + int vertexStrideShift; + GLint lastStamp; + GLboolean stippleInHw; + + GLenum TexEnvImageFmt[2]; + GLuint ClearColor; + /* DRI stuff + */ + GLuint needClip; + GLframebuffer *glBuffer; + GLboolean doPageFlip; + /*=* John Sheng [2003.5.31] flip *=*/ + GLuint currentPage; + char *drawMap; /* draw buffer address in virtual mem */ + char *readMap; + int drawX; /* origin of drawable in draw buffer */ + int drawY; + + int drawW; + int drawH; + GLuint saam; + XineramaScreenInfo *xsi; + int drawXoffSaam; + XF86DRIClipRectPtr pSaamRects; + int drawXSaam; + int drawYSaam; + GLuint numSaamRects; + + int drawPitch; + int readPitch; + int drawXoff; + GLuint numClipRects; /* cliprects for that buffer */ + XF86DRIClipRectPtr pClipRects; + + int lastSwap; + int texAge; + int ctxAge; + int dirtyAge; + + GLboolean scissor; + drm_clip_rect_t drawRect; + drm_clip_rect_t scissorRect; + + drmContext hHWContext; + drmLock *driHwLock; + int driFd; + Display *display; + + __DRIdrawablePrivate *driDrawable; + __DRIscreenPrivate *driScreen; + viaScreenPrivate *viaScreen; + drm_via_sarea_t *sarea; + GLuint* regMMIOBase; + GLuint* pnGEMode; + GLuint* regEngineStatus; + GLuint* regTranSet; + GLuint* regTranSpace; + GLuint* agpBase; + GLuint drawType; +}; +/*#define DMA_OFFSET 16*/ +#define DMA_OFFSET 32 +/*#define PERFORMANCE_MEASURE*/ + +#define DEBUG +extern GLuint VIA_PERFORMANCE; + +#ifdef PERFORMANCE_MEASURE +#define HASH_TABLE_SIZE 1000 +#define HASH_TABLE_DEPTH 10 +typedef struct { + char func[50]; + GLuint count; +} hash_element; +extern hash_element hash_table[HASH_TABLE_SIZE][HASH_TABLE_DEPTH]; +#define P_M \ + do { \ + GLuint h_index,h_depth; \ + h_index = (GLuint)(((GLuint) __FUNCTION__)%HASH_TABLE_SIZE); \ + for (h_depth = 0; h_depth < HASH_TABLE_DEPTH; h_depth++) { \ + if (!strcmp(hash_table[h_index][h_depth].func, "NULL")) { \ + sprintf(hash_table[h_index][h_depth].func, "%s", __FUNCTION__); \ + hash_table[h_index][h_depth].count++; \ + break; \ + } \ + else if (!strcmp(hash_table[h_index][h_depth].func, __FUNCTION__)) { \ + hash_table[h_index][h_depth].count++; \ + break; \ + } \ + } \ + } while (0) + +#define P_M_X \ + do { \ + GLuint h_index,h_depth; \ + char str[80]; \ + strcpy(str, __FUNCTION__); \ + h_index = (GLuint)(((GLuint) __FUNCTION__)%HASH_TABLE_SIZE); \ + for (h_depth = 0; h_depth < HASH_TABLE_DEPTH; h_depth++) { \ + if (!strcmp(hash_table[h_index][h_depth].func, "NULL")) { \ + sprintf(hash_table[h_index][h_depth].func, "%s_X", __FUNCTION__); \ + hash_table[h_index][h_depth].count++; \ + break; \ + } \ + else if (!strcmp(hash_table[h_index][h_depth].func, strcat(str, "_X"))) { \ + hash_table[h_index][h_depth].count++; \ + break; \ + } \ + } \ + } while (0) + +#define P_M_R \ + do { \ + GLuint h_size, h_depth; \ + for (h_size = 0; h_size < HASH_TABLE_SIZE; h_size++) { \ + for (h_depth = 0; h_depth < HASH_TABLE_DEPTH; h_depth++) { \ + if (hash_table[h_size][h_depth].count) { \ + fprintf(stderr, "func:%s count:%d\n", hash_table[h_size][h_depth].func, hash_table[h_size][h_depth].count); \ + } \ + } \ + } \ + } while (0) +#else /* PERFORMANCE_MEASURE */ +#define P_M {} +#define P_M_X {} +#define P_M_R {} +#endif + +#define VIA_CONTEXT(ctx) ((viaContextPtr)(ctx->DriverCtx)) + +#define GET_DISPATCH_AGE(vmesa) vmesa->sarea->lastDispatch +#define GET_ENQUEUE_AGE(vmesa) vmesa->sarea->lastEnqueue + + +/* Lock the hardware and validate our state. + */ +/* +#define LOCK_HARDWARE(vmesa) \ + do { \ + char __ret = 0; \ + DRM_CAS(vmesa->driHwLock, vmesa->hHWContext, \ + (DRM_LOCK_HELD|vmesa->hHWContext), __ret); \ + if (__ret) \ + viaGetLock(vmesa, 0); \ + } while (0) +*/ +#define LOCK_HARDWARE(vmesa) \ + if(vmesa->saam) \ + do { \ + char __ret = 0; \ + DRM_CAS(vmesa->driHwLock, vmesa->hHWContext, \ + (DRM_LOCK_HELD|vmesa->hHWContext), __ret); \ + if (__ret) \ + viaGetLock(vmesa, 0); \ + } while (0); \ + else \ + viaLock(vmesa, 0) + + +/* +#define LOCK_HARDWARE(vmesa) \ + viaLock(vmesa, 0); +*/ + +/* Release the kernel lock. + */ +/* +#define UNLOCK_HARDWARE(vmesa) \ + DRM_UNLOCK(vmesa->driFd, vmesa->driHwLock, vmesa->hHWContext); +*/ +#define UNLOCK_HARDWARE(vmesa) \ + if(vmesa->saam) \ + DRM_UNLOCK(vmesa->driFd, vmesa->driHwLock, vmesa->hHWContext); \ + else \ + viaUnLock(vmesa, 0); +/* +#define UNLOCK_HARDWARE(vmesa) \ + viaUnLock(vmesa, 0); +*/ +#define WAIT_IDLE \ + while (1) { \ + if ((((GLuint)*vmesa->regEngineStatus) & 0xFFFEFFFF) == 0x00020000) \ + break; \ + } + +#define LOCK_HARDWARE_QUIESCENT(vmesa) \ + do { \ + LOCK_HARDWARE(vmesa); \ + viaRegetLockQuiescent(vmesa); \ + } while (0) + + +extern GLuint VIA_DEBUG; +extern GLuint DRAW_FRONT; +extern void viaGetLock(viaContextPtr vmesa, GLuint flags); +extern void viaLock(viaContextPtr vmesa, GLuint flags); +extern void viaUnLock(viaContextPtr vmesa, GLuint flags); +extern void viaEmitHwStateLocked(viaContextPtr vmesa); +extern void viaEmitScissorValues(viaContextPtr vmesa, int box_nr, int emit); +extern void viaEmitDrawingRectangle(viaContextPtr vmesa); +extern void viaXMesaSetBackClipRects(viaContextPtr vmesa); +extern void viaXMesaSetFrontClipRects(viaContextPtr vmesa); +extern void viaReAllocateBuffers(GLframebuffer *drawbuffer); +extern void viaXMesaWindowMoved(viaContextPtr vmesa); + +#define SUBPIXEL_X -.5 +#define SUBPIXEL_Y -.5 + +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_dd_tritmp.h b/xc/lib/GL/mesa/src/drv/via/via_dd_tritmp.h new file mode 100644 index 000000000..9ff4bb398 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_dd_tritmp.h @@ -0,0 +1,736 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#if HAVE_RGBA +#define VERT_SET_IND(v, c) (void)c +#define VERT_COPY_IND(v0, v1) +#define VERT_SAVE_IND(idx) +#define VERT_RESTORE_IND(idx) +#if HAVE_BACK_COLORS +#define VERT_SET_RGBA(v, c) +#endif +#else +#define VERT_SET_RGBA(v, c) (void)c +#define VERT_COPY_RGBA(v0, v1) +#define VERT_SAVE_RGBA(idx) +#define VERT_RESTORE_RGBA(idx) +#if HAVE_BACK_COLORS +#define VERT_SET_IND(v, c) +#endif +#endif + +#if !HAVE_SPEC +#define VERT_SET_SPEC(v, c) (void)c +#define VERT_COPY_SPEC(v0, v1) +#define VERT_SAVE_SPEC(idx) +#define VERT_RESTORE_SPEC(idx) +#if HAVE_BACK_COLORS +#define VERT_COPY_SPEC1(v) +#endif +#else +#if HAVE_BACK_COLORS +#define VERT_SET_SPEC(v, c) +#endif +#endif + +#if !HAVE_BACK_COLORS +#define VERT_COPY_SPEC1(v) +#define VERT_COPY_IND1(v) +#define VERT_COPY_RGBA1(v) +#endif + +#ifndef INSANE_VERTICES +#define VERT_SET_Z(v, val) VERT_Z(v) = val +#define VERT_Z_ADD(v, val) VERT_Z(v) += val +#endif + +#if DO_TRI +static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + VERTEX *v[3]; + GLfloat offset; + GLfloat z[3]; + GLenum mode = GL_FILL; + GLuint facing; + LOCAL_VARS(3); + +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + + v[0] = (VERTEX *)GET_VERTEX(e0); + v[1] = (VERTEX *)GET_VERTEX(e1); + v[2] = (VERTEX *)GET_VERTEX(e2); + + if (DO_TWOSIDE || DO_OFFSET || DO_UNFILLED) { + GLfloat ex = VERT_X(v[0]) - VERT_X(v[2]); + GLfloat ey = VERT_Y(v[0]) - VERT_Y(v[2]); + GLfloat fx = VERT_X(v[1]) - VERT_X(v[2]); + GLfloat fy = VERT_Y(v[1]) - VERT_Y(v[2]); + GLfloat cc = ex * fy - ey * fx; + + if (DO_TWOSIDE || DO_UNFILLED) { + facing = AREA_IS_CCW(cc) ^ ctx->Polygon._FrontBit; + + if (DO_UNFILLED) { + if (facing) { + mode = ctx->Polygon.BackMode; + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode != GL_FRONT) { + return; + } + } + else { + mode = ctx->Polygon.FrontMode; + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode != GL_BACK) { + return; + } + } + } + + if (DO_TWOSIDE && facing == 1) { + if (HAVE_RGBA) { + if (HAVE_BACK_COLORS) { + if (!DO_FLAT) { + VERT_SAVE_RGBA(0); + VERT_SAVE_RGBA(1); + VERT_COPY_RGBA1(v[0]); + VERT_COPY_RGBA1(v[1]); + } + VERT_SAVE_RGBA(2); + VERT_COPY_RGBA1(v[2]); + if (HAVE_SPEC) { + if (!DO_FLAT) { + VERT_SAVE_SPEC(0); + VERT_SAVE_SPEC(1); + VERT_COPY_SPEC1(v[0]); + VERT_COPY_SPEC1(v[1]); + } + VERT_SAVE_SPEC(2); + VERT_COPY_SPEC1(v[2]); + } + } + else { + GLchan (*vbcolor)[4] = VB->ColorPtr[1]->Ptr; + ASSERT(VB->ColorPtr[1]->Type == CHAN_TYPE); + ASSERT(VB->ColorPtr[1]->StrideB == 4*sizeof(GLchan)); + (void)vbcolor; + + if (!DO_FLAT) { + VERT_SAVE_RGBA(0); + VERT_SAVE_RGBA(1); + VERT_SET_RGBA(v[0], vbcolor[e0]); + VERT_SET_RGBA(v[1], vbcolor[e1]); + } + VERT_SAVE_RGBA(2); + VERT_SET_RGBA(v[2], vbcolor[e2]); + + if (HAVE_SPEC && VB->SecondaryColorPtr[1]) { + GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->Ptr; + + if (!DO_FLAT) { + VERT_SAVE_SPEC(0); + VERT_SAVE_SPEC(1); + VERT_SET_SPEC(v[0], vbspec[e0]); + VERT_SET_SPEC(v[1], vbspec[e1]); + } + VERT_SAVE_SPEC(2); + VERT_SET_SPEC(v[2], vbspec[e2]); + } + } + } + else { + GLuint *vbindex = VB->IndexPtr[1]->data; + if (!DO_FLAT) { + VERT_SET_IND(v[0], vbindex[e0]); + VERT_SET_IND(v[1], vbindex[e1]); + } + VERT_SET_IND(v[2], vbindex[e2]); + } + } + } + + if (DO_OFFSET) { + offset = ctx->Polygon.OffsetUnits * DEPTH_SCALE; + z[0] = VERT_Z(v[0]); + z[1] = VERT_Z(v[1]); + z[2] = VERT_Z(v[2]); + if (cc * cc > 1e-16) { + GLfloat ic = 1.0 / cc; + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey * fz - ez * fy; + GLfloat b = ez * fx - ex * fz; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if (ac < 0.0f) ac = -ac; + if (bc < 0.0f) bc = -bc; + offset += MAX2(ac, bc) * ctx->Polygon.OffsetFactor; + } + offset *= ctx->MRD; + } + } + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_SAVE_RGBA(0); + VERT_SAVE_RGBA(1); + VERT_COPY_RGBA(v[0], v[2]); + VERT_COPY_RGBA(v[1], v[2]); + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_SAVE_SPEC(0); + VERT_SAVE_SPEC(1); + VERT_COPY_SPEC(v[0], v[2]); + VERT_COPY_SPEC(v[1], v[2]); + } + } + else { + VERT_SAVE_IND(0); + VERT_SAVE_IND(1); + VERT_COPY_IND(v[0], v[2]); + VERT_COPY_IND(v[1], v[2]); + } + } + + if (mode == GL_POINT) { + if (DO_OFFSET && ctx->Polygon.OffsetPoint) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + } + UNFILLED_TRI(ctx, GL_POINT, e0, e1, e2); + } + else if (mode == GL_LINE) { + if (DO_OFFSET && ctx->Polygon.OffsetLine) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + } + UNFILLED_TRI(ctx, GL_LINE, e0, e1, e2); + } + else { + if (DO_OFFSET && ctx->Polygon.OffsetFill) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + } + if (DO_UNFILLED) + RASTERIZE(GL_TRIANGLES); + TRI(v[0], v[1], v[2]); + } + + if (DO_OFFSET) { + VERT_SET_Z(v[0], z[0]); + VERT_SET_Z(v[1], z[1]); + VERT_SET_Z(v[2], z[2]); + } + + if (DO_TWOSIDE && facing == 1) { + if (HAVE_RGBA) { + if (!DO_FLAT) { + VERT_RESTORE_RGBA(0); + VERT_RESTORE_RGBA(1); + } + VERT_RESTORE_RGBA(2); + if (HAVE_SPEC) { + if (!DO_FLAT) { + VERT_RESTORE_SPEC(0); + VERT_RESTORE_SPEC(1); + } + VERT_RESTORE_SPEC(2); + } + } + else { + GLuint *vbindex = VB->IndexPtr[0]->data; + if (!DO_FLAT) { + VERT_SET_IND(v[0], vbindex[e0]); + VERT_SET_IND(v[1], vbindex[e1]); + } + VERT_SET_IND(v[2], vbindex[e2]); + } + } + + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_RESTORE_RGBA(0); + VERT_RESTORE_RGBA(1); + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_RESTORE_SPEC(0); + VERT_RESTORE_SPEC(1); + } + } + else { + VERT_RESTORE_IND(0); + VERT_RESTORE_IND(1); + } + } + SET_PRIMITIVE_RENDERED +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} +#endif + +#if DO_QUAD +#if DO_FULL_QUAD +static void TAG(quad)(GLcontext *ctx, + GLuint e0, GLuint e1, GLuint e2, GLuint e3) +{ + struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; + VERTEX *v[4]; + GLfloat offset; + GLfloat z[4]; + GLenum mode = GL_FILL; + GLuint facing; + LOCAL_VARS(4); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + v[0] = (VERTEX *)GET_VERTEX(e0); + v[1] = (VERTEX *)GET_VERTEX(e1); + v[2] = (VERTEX *)GET_VERTEX(e2); + v[3] = (VERTEX *)GET_VERTEX(e3); + + if (DO_TWOSIDE || DO_OFFSET || DO_UNFILLED) { + GLfloat ex = VERT_X(v[2]) - VERT_X(v[0]); + GLfloat ey = VERT_Y(v[2]) - VERT_Y(v[0]); + GLfloat fx = VERT_X(v[3]) - VERT_X(v[1]); + GLfloat fy = VERT_Y(v[3]) - VERT_Y(v[1]); + GLfloat cc = ex * fy - ey * fx; + + if (DO_TWOSIDE || DO_UNFILLED) { + facing = AREA_IS_CCW(cc) ^ ctx->Polygon._FrontBit; + + if (DO_UNFILLED) { + if (facing) { + mode = ctx->Polygon.BackMode; + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode != GL_FRONT) { + return; + } + } + else { + mode = ctx->Polygon.FrontMode; + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode != GL_BACK) { + return; + } + } + } + + if (DO_TWOSIDE && facing == 1) { + if (HAVE_RGBA) { + GLchan (*vbcolor)[4] = VB->ColorPtr[1]->Ptr; + (void)vbcolor; + + if (HAVE_BACK_COLORS) { + if (!DO_FLAT) { + VERT_SAVE_RGBA(0); + VERT_SAVE_RGBA(1); + VERT_SAVE_RGBA(2); + VERT_COPY_RGBA1(v[0]); + VERT_COPY_RGBA1(v[1]); + VERT_COPY_RGBA1(v[2]); + } + VERT_SAVE_RGBA(3); + VERT_COPY_RGBA1(v[3]); + if (HAVE_SPEC) { + if (!DO_FLAT) { + VERT_SAVE_SPEC(0); + VERT_SAVE_SPEC(1); + VERT_SAVE_SPEC(2); + VERT_COPY_SPEC1(v[0]); + VERT_COPY_SPEC1(v[1]); + VERT_COPY_SPEC1(v[2]); + } + VERT_SAVE_SPEC(3); + VERT_COPY_SPEC1(v[3]); + } + } + else { + if (!DO_FLAT) { + VERT_SAVE_RGBA(0); + VERT_SAVE_RGBA(1); + VERT_SAVE_RGBA(2); + VERT_SET_RGBA(v[0], vbcolor[e0]); + VERT_SET_RGBA(v[1], vbcolor[e1]); + VERT_SET_RGBA(v[2], vbcolor[e2]); + } + VERT_SAVE_RGBA(3); + VERT_SET_RGBA(v[3], vbcolor[e3]); + + if (HAVE_SPEC && VB->SecondaryColorPtr[1]) { + GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->Ptr; + ASSERT(VB->SecondaryColorPtr[1]->StrideB == 4 * sizeof(GLchan)); + + if (!DO_FLAT) { + VERT_SAVE_SPEC(0); + VERT_SAVE_SPEC(1); + VERT_SAVE_SPEC(2); + VERT_SET_SPEC(v[0], vbspec[e0]); + VERT_SET_SPEC(v[1], vbspec[e1]); + VERT_SET_SPEC(v[2], vbspec[e2]); + } + VERT_SAVE_SPEC(3); + VERT_SET_SPEC(v[3], vbspec[e3]); + } + } + } + else { + GLuint *vbindex = VB->IndexPtr[1]->data; + if (!DO_FLAT) { + VERT_SET_IND(v[0], vbindex[e0]); + VERT_SET_IND(v[1], vbindex[e1]); + VERT_SET_IND(v[2], vbindex[e2]); + } + VERT_SET_IND(v[3], vbindex[e3]); + } + } + } + + + if (DO_OFFSET) { + offset = ctx->Polygon.OffsetUnits * DEPTH_SCALE; + z[0] = VERT_Z(v[0]); + z[1] = VERT_Z(v[1]); + z[2] = VERT_Z(v[2]); + z[3] = VERT_Z(v[3]); + if (cc * cc > 1e-16) { + GLfloat ez = z[2] - z[0]; + GLfloat fz = z[3] - z[1]; + GLfloat a = ey * fz - ez * fy; + GLfloat b = ez * fx - ex * fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if ( ac < 0.0f ) ac = -ac; + if ( bc < 0.0f ) bc = -bc; + offset += MAX2(ac, bc) * ctx->Polygon.OffsetFactor; + } + offset *= ctx->MRD; + } + } + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_SAVE_RGBA(0); + VERT_SAVE_RGBA(1); + VERT_SAVE_RGBA(2); + VERT_COPY_RGBA(v[0], v[3]); + VERT_COPY_RGBA(v[1], v[3]); + VERT_COPY_RGBA(v[2], v[3]); + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_SAVE_SPEC(0); + VERT_SAVE_SPEC(1); + VERT_SAVE_SPEC(2); + VERT_COPY_SPEC(v[0], v[3]); + VERT_COPY_SPEC(v[1], v[3]); + VERT_COPY_SPEC(v[2], v[3]); + } + } + else { + VERT_SAVE_IND(0); + VERT_SAVE_IND(1); + VERT_SAVE_IND(2); + VERT_COPY_IND(v[0], v[3]); + VERT_COPY_IND(v[1], v[3]); + VERT_COPY_IND(v[2], v[3]); + } + } + + if (mode == GL_POINT) { + if (( DO_OFFSET) && ctx->Polygon.OffsetPoint) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + VERT_Z_ADD(v[3], offset); + } + UNFILLED_QUAD(ctx, GL_POINT, e0, e1, e2, e3); + } + else if (mode == GL_LINE) { + if (DO_OFFSET && ctx->Polygon.OffsetLine) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + VERT_Z_ADD(v[3], offset); + } + UNFILLED_QUAD(ctx, GL_LINE, e0, e1, e2, e3); + } + else { + if (DO_OFFSET && ctx->Polygon.OffsetFill) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + VERT_Z_ADD(v[3], offset); + } + RASTERIZE(GL_TRIANGLES); + QUAD((v[0]), (v[1]), (v[2]), (v[3])); + } + + if (DO_OFFSET) { + VERT_SET_Z(v[0], z[0]); + VERT_SET_Z(v[1], z[1]); + VERT_SET_Z(v[2], z[2]); + VERT_SET_Z(v[3], z[3]); + } + + if (DO_TWOSIDE && facing == 1) { + if (HAVE_RGBA) { + if (!DO_FLAT) { + VERT_RESTORE_RGBA(0); + VERT_RESTORE_RGBA(1); + VERT_RESTORE_RGBA(2); + } + VERT_RESTORE_RGBA(3); + if (HAVE_SPEC) { + if (!DO_FLAT) { + VERT_RESTORE_SPEC(0); + VERT_RESTORE_SPEC(1); + VERT_RESTORE_SPEC(2); + } + VERT_RESTORE_SPEC(3); + } + } + else { + GLuint *vbindex = VB->IndexPtr[0]->data; + if (!DO_FLAT) { + VERT_SET_IND(v[0], vbindex[e0]); + VERT_SET_IND(v[1], vbindex[e1]); + VERT_SET_IND(v[2], vbindex[e2]); + } + VERT_SET_IND(v[3], vbindex[e3]); + } + } + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_RESTORE_RGBA(0); + VERT_RESTORE_RGBA(1); + VERT_RESTORE_RGBA(2); + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_RESTORE_SPEC(0); + VERT_RESTORE_SPEC(1); + VERT_RESTORE_SPEC(2); + } + } + else { + VERT_RESTORE_IND(0); + VERT_RESTORE_IND(1); + VERT_RESTORE_IND(2); + } + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} +#else +static void TAG(quad)(GLcontext *ctx, GLuint e0, + GLuint e1, GLuint e2, GLuint e3) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + if (DO_UNFILLED) { + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte ef1 = VB->EdgeFlag[e1]; + GLubyte ef3 = VB->EdgeFlag[e3]; + VB->EdgeFlag[e1] = 0; + TAG(triangle)(ctx, e0, e1, e3); + VB->EdgeFlag[e1] = ef1; + VB->EdgeFlag[e3] = 0; + TAG(triangle)(ctx, e1, e2, e3); + VB->EdgeFlag[e3] = ef3; + } + else { + TAG(triangle)(ctx, e0, e1, e3); + TAG(triangle)(ctx, e1, e2, e3); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} +#endif +#endif + +#if DO_LINE +static void TAG(line)(GLcontext *ctx, GLuint e0, GLuint e1) +{ + TNLvertexbuffer *VB = &TNL_CONTEXT(ctx)->vb; + VERTEX *v[2]; + LOCAL_VARS(2); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + v[0] = (VERTEX *)GET_VERTEX(e0); + v[1] = (VERTEX *)GET_VERTEX(e1); + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_SAVE_RGBA( 0 ); + VERT_COPY_RGBA( v[0], v[1] ); + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_SAVE_SPEC(0); + VERT_COPY_SPEC(v[0], v[1]); + } + } + else { + VERT_SAVE_IND(0); + VERT_COPY_IND(v[0], v[1]); + } + } + + LINE(v[0], v[1]); + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_RESTORE_RGBA(0); + + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_RESTORE_SPEC(0); + } + } + else { + VERT_RESTORE_IND(0); + } + } + SET_PRIMITIVE_RENDERED +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} +#endif + +#if DO_POINTS +static void TAG(points)(GLcontext *ctx, GLuint first, GLuint last) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + int i; + LOCAL_VARS(1); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + if (VB->Elts == 0) { + for (i = first; i < last; i++) { + if (VB->ClipMask[i] == 0) { + VERTEX *v = (VERTEX *)GET_VERTEX(i); + POINT(v); + SET_PRIMITIVE_RENDERED + } + } + } + else { + for (i = first; i < last; i++) { + GLuint e = VB->Elts[i]; + if (VB->ClipMask[e] == 0) { + VERTEX *v = (VERTEX *)GET_VERTEX(e); + POINT(v); + SET_PRIMITIVE_RENDERED + } + } + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} +#endif + +static void TAG(init)(void) +{ +#if DO_QUAD + TAB[IND].quad = TAG(quad); +#endif +#if DO_TRI + TAB[IND].triangle = TAG(triangle); +#endif +#if DO_LINE + TAB[IND].line = TAG(line); +#endif +#if DO_POINTS + TAB[IND].points = TAG(points); +#endif +} + +#undef IND +#undef TAG + +#if HAVE_RGBA +#undef VERT_SET_IND +#undef VERT_COPY_IND +#undef VERT_SAVE_IND +#undef VERT_RESTORE_IND +#if HAVE_BACK_COLORS +#undef VERT_SET_RGBA +#endif +#else +#undef VERT_SET_RGBA +#undef VERT_COPY_RGBA +#undef VERT_SAVE_RGBA +#undef VERT_RESTORE_RGBA +#if HAVE_BACK_COLORS +#undef VERT_SET_IND +#endif +#endif + +#if !HAVE_SPEC +#undef VERT_SET_SPEC +#undef VERT_COPY_SPEC +#undef VERT_SAVE_SPEC +#undef VERT_RESTORE_SPEC +#if HAVE_BACK_COLORS +#undef VERT_COPY_SPEC1 +#endif +#else +#if HAVE_BACK_COLORS +#undef VERT_SET_SPEC +#endif +#endif + +#if !HAVE_BACK_COLORS +#undef VERT_COPY_SPEC1 +#undef VERT_COPY_IND1 +#undef VERT_COPY_RGBA1 +#endif + +#ifndef INSANE_VERTICES +#undef VERT_SET_Z +#undef VERT_Z_ADD +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_dd_vbtmp.h b/xc/lib/GL/mesa/src/drv/via/via_dd_vbtmp.h new file mode 100644 index 000000000..c5a822e34 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_dd_vbtmp.h @@ -0,0 +1,871 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +/* Unlike the other templates here, this assumes quite a bit about the + * underlying hardware. Specifically it assumes a d3d-like vertex + * format, with a layout more or less constrained to look like the + * following: + * + * union { + * struct { + * float x, y, z, w; + * struct { char r, g, b, a; } color; + * struct { char r, g, b, fog; } spec; + * float u0, v0; + * float u1, v1; + * float u2, v2; + * float u3, v3; + * } v; + * struct { + * float x, y, z, w; + * struct { char r, g, b, a; } color; + * struct { char r, g, b, fog; } spec; + * float u0, v0, q0; + * float u1, v1, q1; + * float u2, v2, q2; + * float u3, v3, q3; + * } pv; + * struct { + * float x, y, z; + * struct { char r, g, b, a; } color; + * } tv; + * float f[16]; + * unsigned int ui[16]; + * unsigned char ub4[4][16]; + * } + * + + * DO_XYZW: Emit xyz and maybe w coordinates. + * DO_RGBA: Emit color. + * DO_SPEC: Emit specular color. + * DO_FOG: Emit fog coordinate in specular alpha. + * DO_TEX0: Emit tex0 u,v coordinates. + * DO_TEX1: Emit tex1 u,v coordinates. + * DO_TEX2: Emit tex2 u,v coordinates. + * DO_TEX3: Emit tex3 u,v coordinates. + * DO_PTEX: Emit tex0,1,2,3 q coordinates where possible. + * + * HAVE_RGBA_COLOR: Hardware takes color in rgba order (else bgra). + * + * HAVE_HW_VIEWPORT: Hardware performs viewport transform. + * HAVE_HW_DIVIDE: Hardware performs perspective divide. + * + * HAVE_TINY_VERTICES: Hardware understands v.tv format. + * HAVE_PTEX_VERTICES: Hardware understands v.pv format. + * HAVE_NOTEX_VERTICES: Hardware understands v.v format with texcount 0. + * + * Additionally, this template assumes it is emitting *transformed* + * vertices; the modifications to emit untransformed vertices (ie. to + * t&l hardware) are probably too great to cooexist with the code + * already in this file. + * + * NOTE: The PTEX vertex format always includes TEX0 and TEX1, even if + * only TEX0 is enabled, in order to maintain a vertex size which is + * an exact number of quadwords. + */ + +#if (HAVE_HW_VIEWPORT) +#define VIEWPORT_X(dst, x) dst = x +#define VIEWPORT_Y(dst, y) dst = y +#define VIEWPORT_Z(dst, z) dst = z +#else +#define VIEWPORT_X(dst, x) dst = s[0] * x + s[12] +#define VIEWPORT_Y(dst, y) dst = s[5] * y + s[13] +#define VIEWPORT_Z(dst, z) dst = s[10] * z + s[14] +#endif + +#if (HAVE_HW_DIVIDE && !HAVE_PTEX_VERTICES) +#error "can't cope with this combination" +#endif + +#ifndef LOCALVARS +#define LOCALVARS +#endif + +#ifndef CHECK_HW_DIVIDE +#define CHECK_HW_DIVIDE 1 +#endif + +#if (HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICES) + +static void TAG(emit)(GLcontext *ctx, + GLuint start, GLuint end, + void *dest, + GLuint stride) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLfloat (*tc0)[4], (*tc1)[4], *fog; + GLfloat (*tc2)[4], (*tc3)[4]; + GLubyte (*col)[4], (*spec)[4]; + GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride; + GLuint tc2_stride, tc3_stride; + GLuint tc0_size, tc1_size; + GLuint tc2_size, tc3_size; + GLfloat (*coord)[4]; + GLuint coord_stride; + VERTEX *v = (VERTEX *)dest; + const GLfloat *s = GET_VIEWPORT_MAT(); + const GLubyte *mask = VB->ClipMask; + int i; + +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "TAG-emit for HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICE\n"); +#endif + + if (HAVE_HW_VIEWPORT && HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) { + (void) s; + coord = VB->ClipPtr->data; + coord_stride = VB->ClipPtr->stride; + } + else { + coord = VB->ProjectedClipPtr->data; + coord_stride = VB->ProjectedClipPtr->stride; + } + + if (DO_TEX3) { + const GLuint t3 = GET_TEXSOURCE(3); + tc3 = VB->TexCoordPtr[t3]->data; + tc3_stride = VB->TexCoordPtr[t3]->stride; + if (DO_PTEX) + tc3_size = VB->TexCoordPtr[t3]->size; + } + + if (DO_TEX2) { + const GLuint t2 = GET_TEXSOURCE(2); + tc2 = VB->TexCoordPtr[t2]->data; + tc2_stride = VB->TexCoordPtr[t2]->stride; + if (DO_PTEX) + tc2_size = VB->TexCoordPtr[t2]->size; + } + + if (DO_TEX1) { + const GLuint t1 = GET_TEXSOURCE(1); + tc1 = VB->TexCoordPtr[t1]->data; + tc1_stride = VB->TexCoordPtr[t1]->stride; + if (DO_PTEX) + tc1_size = VB->TexCoordPtr[t1]->size; + } + + if (DO_TEX0) { + const GLuint t0 = GET_TEXSOURCE(0); + /* test */ + tc0_stride = VB->TexCoordPtr[t0]->stride; + tc0 = VB->TexCoordPtr[t0]->data; + if (DO_PTEX) + tc0_size = VB->TexCoordPtr[t0]->size; + } + + if (DO_RGBA) { + if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) + IMPORT_FLOAT_COLORS( ctx ); + col = (GLubyte (*)[4])VB->ColorPtr[0]->Ptr; + col_stride = VB->ColorPtr[0]->StrideB; + } + + if (DO_SPEC) { + if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE) + IMPORT_FLOAT_SPEC_COLORS( ctx ); + spec = (GLubyte (*)[4])VB->SecondaryColorPtr[0]->Ptr; + spec_stride = VB->SecondaryColorPtr[0]->StrideB; + } + + if (DO_FOG) { + if (VB->FogCoordPtr) { + fog = VB->FogCoordPtr->data; + fog_stride = VB->FogCoordPtr->stride; + } + else { + GLfloat tmp = 0; + fog = &tmp; + fog_stride = 0; + } + } + + if (VB->importable_data) { + /* May have nonstandard strides: + */ + if (start) { + coord = (GLfloat (*)[4])((GLubyte *)coord + start * coord_stride); + if (DO_TEX0) + tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride); + if (DO_TEX1) + tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + start * tc1_stride); + if (DO_TEX2) + tc2 = (GLfloat (*)[4])((GLubyte *)tc2 + start * tc2_stride); + if (DO_TEX3) + tc3 = (GLfloat (*)[4])((GLubyte *)tc3 + start * tc3_stride); + if (DO_RGBA) + STRIDE_4UB(col, start * col_stride); + if (DO_SPEC) + STRIDE_4UB(spec, start * spec_stride); + if (DO_FOG) + STRIDE_F(fog, start * fog_stride); + } + + for (i = start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) { + if (DO_XYZW) { + if (HAVE_HW_VIEWPORT || mask[i] == 0) { + VIEWPORT_X(v->v.x, coord[0][0]); + VIEWPORT_Y(v->v.y, coord[0][1]); + VIEWPORT_Z(v->v.z, coord[0][2]); + } + v->v.w = coord[0][3]; + coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride); + } + if (DO_RGBA) { + if (HAVE_RGBA_COLOR) { + *(GLuint *)&v->v.color = *(GLuint *)&col[0]; + STRIDE_4UB(col, col_stride); + } + else { + v->v.color.blue = col[0][2]; + v->v.color.green = col[0][1]; + v->v.color.red = col[0][0]; + v->v.color.alpha = col[0][3]; + STRIDE_4UB(col, col_stride); + } + } + + if (DO_SPEC) { + v->v.specular.red = spec[0][0]; + v->v.specular.green = spec[0][1]; + v->v.specular.blue = spec[0][2]; + + STRIDE_4UB(spec, spec_stride); + } + else { + v->v.specular.red = 0; + v->v.specular.green = 0; + v->v.specular.blue = 0; + } + + if (DO_FOG) { + v->v.specular.alpha = fog[0] * 255.0; + /*=* [DBG] exy : fix lighting on + fog off error *=*/ + STRIDE_F(fog, fog_stride); + } + else { + v->v.specular.alpha = 0.0; + } + + if (DO_TEX0) { + v->v.u0 = tc0[0][0]; + v->v.v0 = tc0[0][1]; + if (DO_PTEX) { + if (HAVE_PTEX_VERTICES) { + if (tc0_size == 4) + v->pv.q0 = tc0[0][3]; + else + v->pv.q0 = 1.0; + } + else if (tc0_size == 4) { + float rhw = 1.0 / tc0[0][3]; + v->v.w *= tc0[0][3]; + v->v.u0 *= rhw; + v->v.v0 *= rhw; + } + } + + tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride); + } + if (DO_TEX1) { + if (DO_PTEX) { + if (HAVE_PTEX_VERTICES) { + v->pv.u1 = tc1[0][0]; + v->pv.v1 = tc1[0][1]; + if (tc1_size == 4) + v->pv.q1 = tc1[0][3]; + else + v->pv.q1 = 1.0; + } + else { + float rhw = 1.0 / tc1[0][3]; + + v->v.u1 = tc1[0][0]; + v->v.v1 = tc1[0][1]; + v->v.u1 *= rhw; + v->v.v1 *= rhw; + } + } + else { + v->v.u1 = tc1[0][0]; + v->v.v1 = tc1[0][1]; + } + + tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + tc1_stride); + } + else if (DO_PTEX) { + *(GLuint *)&v->pv.q1 = 0; + } + if (DO_TEX2) { + if (DO_PTEX) { + v->pv.u2 = tc2[0][0]; + v->pv.v2 = tc2[0][1]; + if (tc2_size == 4) + v->pv.q2 = tc2[0][3]; + else + v->pv.q2 = 1.0; + } + else { + v->v.u2 = tc2[0][0]; + v->v.v2 = tc2[0][1]; + } + + tc2 = (GLfloat (*)[4])((GLubyte *)tc2 + tc2_stride); + } + if (DO_TEX3) { + if (DO_PTEX) { + v->pv.u3 = tc3[0][0]; + v->pv.v3 = tc3[0][1]; + if (tc3_size == 4) + v->pv.q3 = tc3[0][3]; + else + v->pv.q3 = 1.0; + } + else { + v->v.u3 = tc3[0][0]; + v->v.v3 = tc3[0][1]; + } + + tc3 = (GLfloat (*)[4])((GLubyte *)tc3 + tc3_stride); + } + } + } + else { + for (i = start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) { + if (DO_XYZW) { + if (HAVE_HW_VIEWPORT || mask[i] == 0) { + VIEWPORT_X(v->v.x, coord[i][0]); + VIEWPORT_Y(v->v.y, coord[i][1]); + VIEWPORT_Z(v->v.z, coord[i][2]); + } + v->v.w = coord[i][3]; + } + if (DO_RGBA) { + if (HAVE_RGBA_COLOR) { + *(GLuint *)&v->v.color = *(GLuint *)&col[i]; + } + else { + v->v.color.blue = col[i][2]; + v->v.color.green = col[i][1]; + v->v.color.red = col[i][0]; + v->v.color.alpha = col[i][3]; + } + } + if (DO_SPEC) { + v->v.specular.red = spec[i][0]; + v->v.specular.green = spec[i][1]; + v->v.specular.blue = spec[i][2]; + } + else { + v->v.specular.red = 0.0; + v->v.specular.green = 0.0; + v->v.specular.blue = 0.0; + } + + if (DO_FOG) { + v->v.specular.alpha = fog[i] * 255.0; + } + else { + v->v.specular.alpha = 0.0; + } + + if (DO_TEX0) { + v->v.u0 = tc0[i][0]; + v->v.v0 = tc0[i][1]; + if (DO_PTEX) { + if (HAVE_PTEX_VERTICES) { + if (tc0_size == 4) + v->pv.q0 = tc0[i][3]; + else + v->pv.q0 = 1.0; + + v->pv.q1 = 0; + } + else if (tc0_size == 4) { + float rhw = 1.0 / tc0[i][3]; + v->v.w *= tc0[i][3]; + v->v.u0 *= rhw; + v->v.v0 *= rhw; + } + } + } + if (DO_TEX1) { + if (DO_PTEX) { + if (HAVE_PTEX_VERTICES) { + v->pv.u1 = tc1[i][0]; + v->pv.v1 = tc1[i][1]; + if (tc1_size == 4) + v->pv.q1 = tc1[i][3]; + else + v->pv.q1 = 1.0; + } + else if (tc1_size == 4) { + float rhw = 1.0 / tc1[i][3]; + + v->v.u1 = tc1[i][0]; + v->v.v1 = tc1[i][1]; + v->v.u1 *= rhw; + v->v.v1 *= rhw; + } + } + else { + v->v.u1 = tc1[i][0]; + v->v.v1 = tc1[i][1]; + } + } + } + } +} +#else +#if DO_XYZW + +#if HAVE_HW_DIVIDE +#error "cannot use tiny vertices with hw perspective divide" +#endif + +static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end, + void *dest, GLuint stride) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte (*col)[4]; + GLuint col_stride; + GLfloat (*coord)[4] = VB->ProjectedClipPtr->data; + GLuint coord_stride = VB->ProjectedClipPtr->stride; + GLfloat *v = (GLfloat *)dest; + const GLubyte *mask = VB->ClipMask; + const GLfloat *s = GET_VIEWPORT_MAT(); + int i; + + (void) s; + + ASSERT(stride == 4); +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "TAG-emit for DO_XYZW\n"); + fprintf(stderr, "%s\n", __FUNCTION__); + } +#endif + if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) + IMPORT_FLOAT_COLORS( ctx ); + + col = (GLubyte (*)[4])VB->ColorPtr[0]->Ptr; + col_stride = VB->ColorPtr[0]->StrideB; + ASSERT(VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE); + + if (VB->importable_data) { + if (start) { + coord = (GLfloat (*)[4])((GLubyte *)coord + start * coord_stride); + STRIDE_4UB(col, start * col_stride); + } + + for (i = start; i < end; i++, v += 4) { + if (HAVE_HW_VIEWPORT || mask[i] == 0) { + VIEWPORT_X(v[0], coord[0][0]); + VIEWPORT_Y(v[1], coord[0][1]); + VIEWPORT_Z(v[2], coord[0][2]); + } + coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride); + if (DO_RGBA) { + if (HAVE_RGBA_COLOR) { + *(GLuint *)&v[3] = *(GLuint *)col; + } + else { + GLubyte *b = (GLubyte *)&v[3]; + b[0] = col[0][2]; + b[1] = col[0][1]; + b[2] = col[0][0]; + b[3] = col[0][3]; + } + STRIDE_4UB( col, col_stride ); + } + } + } + else { + for (i = start; i < end; i++, v += 4) { + if (HAVE_HW_VIEWPORT || mask[i] == 0) { + VIEWPORT_X(v[0], coord[i][0]); + VIEWPORT_Y(v[1], coord[i][1]); + VIEWPORT_Z(v[2], coord[i][2]); + } + if (DO_RGBA) { + if (HAVE_RGBA_COLOR) { + *(GLuint *)&v[3] = *(GLuint *)&col[i]; + } + else { + GLubyte *b = (GLubyte *)&v[3]; + b[0] = col[i][2]; + b[1] = col[i][1]; + b[2] = col[i][0]; + b[3] = col[i][3]; + } + } + } + } +} +#else +static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end, + void *dest, GLuint stride) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte (*col)[4]; + GLuint col_stride; + GLfloat *v = (GLfloat *)dest; + int i; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "TAG-emit for No DO_XYZW\n"); + fprintf(stderr, "%s\n", __FUNCTION__); + } +#endif + + if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) + IMPORT_FLOAT_COLORS( ctx ); + + col = VB->ColorPtr[0]->Ptr; + col_stride = VB->ColorPtr[0]->StrideB; + + if (start) + STRIDE_4UB(col, col_stride * start); + + /* Need to figure out where color is: + */ + if (GET_VERTEX_FORMAT() == TINY_VERTEX_FORMAT) + v += 3; + else + v += 4; + + for (i = start; i < end; i++, STRIDE_F(v, stride)) { + if (HAVE_RGBA_COLOR) { + *(GLuint *)v = *(GLuint *)col[0]; + } + else { + GLubyte *b = (GLubyte *)v; + b[0] = col[0][2]; + b[1] = col[0][1]; + b[2] = col[0][0]; + b[3] = col[0][3]; + } + STRIDE_4UB(col, col_stride); + } +} +#endif /* emit */ +#endif /* emit */ + +#if (DO_XYZW) && (DO_RGBA) + +#if (HAVE_PTEX_VERTICES) +static GLboolean TAG(check_tex_sizes)(GLcontext *ctx) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + + /* Force 'missing' texcoords to something valid. + */ +#ifdef DEBUG + fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (DO_TEX3 && VB->TexCoordPtr[2] == 0) + VB->TexCoordPtr[2] = VB->TexCoordPtr[3]; + + if (DO_TEX2 && VB->TexCoordPtr[1] == 0) + VB->TexCoordPtr[1] = VB->TexCoordPtr[2]; + + if (DO_TEX1 && VB->TexCoordPtr[0] == 0) + VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + + if (DO_PTEX) + return GL_TRUE; + + if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) || + (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) || + (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4) || + (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4)) + return GL_FALSE; +#ifdef DEBUG + fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_TRUE; +} +#else +static GLboolean TAG(check_tex_sizes)(GLcontext *ctx) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + + /* Force 'missing' texcoords to something valid. + */ + if (DO_TEX3 && VB->TexCoordPtr[2] == 0) + VB->TexCoordPtr[2] = VB->TexCoordPtr[3]; + + if (DO_TEX2 && VB->TexCoordPtr[1] == 0) + VB->TexCoordPtr[1] = VB->TexCoordPtr[2]; + + if (DO_TEX1 && VB->TexCoordPtr[0] == 0) { + VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + } + + if (DO_PTEX) + return GL_TRUE; + + if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) || + (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) || + (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) { + /*PTEX_FALLBACK();*/ + return GL_FALSE; + } + + if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) { + if (DO_TEX1 || DO_TEX2 || DO_TEX3) { + /*PTEX_FALLBACK();*/ + } + return GL_FALSE; + } + return GL_TRUE; +} +#endif /* ptex */ + + +static void TAG(interp)(GLcontext *ctx, + GLfloat t, + GLuint edst, GLuint eout, GLuint ein, + GLboolean force_boundary) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte *ddverts = GET_VERTEX_STORE(); + GLuint shift = GET_VERTEX_STRIDE_SHIFT(); + const GLfloat *dstclip = VB->ClipPtr->data[edst]; + GLfloat w; + const GLfloat *s = GET_VIEWPORT_MAT(); + + VERTEX *dst = (VERTEX *)(ddverts + (edst << shift)); + VERTEX *in = (VERTEX *)(ddverts + (ein << shift)); + VERTEX *out = (VERTEX *)(ddverts + (eout << shift)); + + (void)s; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) { + VIEWPORT_X(dst->v.x, dstclip[0]); + VIEWPORT_Y(dst->v.y, dstclip[1]); + VIEWPORT_Z(dst->v.z, dstclip[2]); + w = dstclip[3]; + } + else { + w = 1.0 / dstclip[3]; + VIEWPORT_X(dst->v.x, dstclip[0] * w); + VIEWPORT_Y(dst->v.y, dstclip[1] * w); + VIEWPORT_Z(dst->v.z, dstclip[2] * w); + } + + if ((HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) || + DO_FOG || DO_SPEC || DO_TEX0 || DO_TEX1 || + DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES) { + + dst->v.w = w; + + INTERP_UB(t, dst->ub4[4][0], out->ub4[4][0], in->ub4[4][0]); + INTERP_UB(t, dst->ub4[4][1], out->ub4[4][1], in->ub4[4][1]); + INTERP_UB(t, dst->ub4[4][2], out->ub4[4][2], in->ub4[4][2]); + INTERP_UB(t, dst->ub4[4][3], out->ub4[4][3], in->ub4[4][3]); + + if (DO_SPEC) { + INTERP_UB(t, dst->ub4[5][0], out->ub4[5][0], in->ub4[5][0]); + INTERP_UB(t, dst->ub4[5][1], out->ub4[5][1], in->ub4[5][1]); + INTERP_UB(t, dst->ub4[5][2], out->ub4[5][2], in->ub4[5][2]); + } + if (DO_FOG) { + INTERP_UB(t, dst->ub4[5][3], out->ub4[5][3], in->ub4[5][3]); + } + if (DO_TEX0) { + if (DO_PTEX) { + if (HAVE_PTEX_VERTICES) { + INTERP_F(t, dst->pv.u0, out->pv.u0, in->pv.u0); + INTERP_F(t, dst->pv.v0, out->pv.v0, in->pv.v0); + INTERP_F(t, dst->pv.q0, out->pv.q0, in->pv.q0); + } + else { + INTERP_F(t, dst->v.u0, out->v.u0, in->v.u0); + INTERP_F(t, dst->v.v0, out->v.v0, in->v.v0); + } + } + else { + INTERP_F(t, dst->v.u0, out->v.u0, in->v.u0); + INTERP_F(t, dst->v.v0, out->v.v0, in->v.v0); + } + } + if (DO_TEX1) { + if (DO_PTEX) { + if (HAVE_PTEX_VERTICES) { + INTERP_F(t, dst->pv.u1, out->pv.u1, in->pv.u1); + INTERP_F(t, dst->pv.v1, out->pv.v1, in->pv.v1); + INTERP_F(t, dst->pv.q1, out->pv.q1, in->pv.q1); + } + else { + INTERP_F(t, dst->v.u1, out->v.u1, in->v.u1); + INTERP_F(t, dst->v.v1, out->v.v1, in->v.v1); + } + } + else { + INTERP_F(t, dst->v.u1, out->v.u1, in->v.u1); + INTERP_F(t, dst->v.v1, out->v.v1, in->v.v1); + } + } + else if (DO_PTEX) { + dst->pv.q0 = 0.0; /* must be a valid float on radeon */ + } + if (DO_TEX2) { + if (DO_PTEX) { + INTERP_F(t, dst->pv.u2, out->pv.u2, in->pv.u2); + INTERP_F(t, dst->pv.v2, out->pv.v2, in->pv.v2); + INTERP_F(t, dst->pv.q2, out->pv.q2, in->pv.q2); + } + else { + INTERP_F(t, dst->v.u2, out->v.u2, in->v.u2); + INTERP_F(t, dst->v.v2, out->v.v2, in->v.v2); + } + } + if (DO_TEX3) { + if (DO_PTEX) { + INTERP_F(t, dst->pv.u3, out->pv.u3, in->pv.u3); + INTERP_F(t, dst->pv.v3, out->pv.v3, in->pv.v3); + INTERP_F(t, dst->pv.q3, out->pv.q3, in->pv.q3); + } + else { + INTERP_F(t, dst->v.u3, out->v.u3, in->v.u3); + INTERP_F(t, dst->v.v3, out->v.v3, in->v.v3); + } + } + } + else { + /* 4-dword vertex. Color is in v[3] and there is no oow coordinate. + */ + INTERP_UB(t, dst->ub4[3][0], out->ub4[3][0], in->ub4[3][0]); + INTERP_UB(t, dst->ub4[3][1], out->ub4[3][1], in->ub4[3][1]); + INTERP_UB(t, dst->ub4[3][2], out->ub4[3][2], in->ub4[3][2]); + INTERP_UB(t, dst->ub4[3][3], out->ub4[3][3], in->ub4[3][3]); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +#endif /* rgba && xyzw */ + +static void TAG(init)(void) +{ + setup_tab[IND].emit = TAG(emit); + +#if (DO_XYZW && DO_RGBA) + setup_tab[IND].check_tex_sizes = TAG(check_tex_sizes); + setup_tab[IND].interp = TAG(interp); +#endif + + if (DO_SPEC) + setup_tab[IND].copyPv = copy_pv_rgba4_spec5; + else if (HAVE_HW_DIVIDE || DO_SPEC || DO_FOG || DO_TEX0 || DO_TEX1 || + DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES) + setup_tab[IND].copyPv = copy_pv_rgba4; + else + setup_tab[IND].copyPv = copy_pv_rgba3; + + if (DO_TEX3) { + if (DO_PTEX) { + ASSERT(HAVE_PTEX_VERTICES); + setup_tab[IND].vertexFormat = PROJ_TEX3_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 18; + setup_tab[IND].vertexStrideShift = 7; + } + else { + setup_tab[IND].vertexFormat = TEX3_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 14; + setup_tab[IND].vertexStrideShift = 6; + } + } + else if (DO_TEX2) { + if (DO_PTEX) { + ASSERT(HAVE_PTEX_VERTICES); + setup_tab[IND].vertexFormat = PROJ_TEX3_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 18; + setup_tab[IND].vertexStrideShift = 7; + } + else { + setup_tab[IND].vertexFormat = TEX2_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 12; + setup_tab[IND].vertexStrideShift = 6; + } + } + else if (DO_TEX1) { + if (DO_PTEX) { + ASSERT(HAVE_PTEX_VERTICES); + setup_tab[IND].vertexFormat = PROJ_TEX1_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 12; + setup_tab[IND].vertexStrideShift = 6; + } + else { + setup_tab[IND].vertexFormat = TEX1_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 10; + setup_tab[IND].vertexStrideShift = 6; + } + } + else if (DO_TEX0) { + if (DO_PTEX && HAVE_PTEX_VERTICES) { + setup_tab[IND].vertexFormat = PROJ_TEX1_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 12; + setup_tab[IND].vertexStrideShift = 6; + } + else { + setup_tab[IND].vertexFormat = TEX0_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 8; + setup_tab[IND].vertexStrideShift = 5; + } + } + else if (!HAVE_HW_DIVIDE && !DO_SPEC && !DO_FOG && HAVE_TINY_VERTICES) { + setup_tab[IND].vertexFormat = TINY_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 4; + setup_tab[IND].vertexStrideShift = 4; + } + else if (HAVE_NOTEX_VERTICES) { + setup_tab[IND].vertexFormat = NOTEX_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 6; + setup_tab[IND].vertexStrideShift = 5; + } + else { + setup_tab[IND].vertexFormat = TEX0_VERTEX_FORMAT; + setup_tab[IND].vertexSize = 8; + setup_tab[IND].vertexStrideShift = 5; + } + + assert(setup_tab[IND].vertexSize * 4 <= + 1 << setup_tab[IND].vertexStrideShift); +} + +#undef IND +#undef TAG diff --git a/xc/lib/GL/mesa/src/drv/via/via_dmatmp.h b/xc/lib/GL/mesa/src/drv/via/via_dmatmp.h new file mode 100644 index 000000000..458ccea21 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_dmatmp.h @@ -0,0 +1,601 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* Template for render stages which build and emit vertices directly + * to fixed-size dma buffers. Useful for rendering strips and other + * native primitives where clipping and per-vertex tweaks such as + * those in t_dd_tritmp.h are not required. + * + * Produces code for both inline triangles and indexed triangles. + * Where various primitive types are unaccelerated by hardware, the + * code attempts to fallback to other primitive types (quadstrips to + * tristrips, lineloops to linestrips), or to indexed vertices. + * Ultimately, a FALLBACK() macro is invoked if there is no way to + * render the primitive natively. + */ + +#if !defined(HAVE_TRIANGLES) +#error "must have at least triangles to use render template" +#endif + +#if !HAVE_ELTS +#define ELTS_VARS +#define ALLOC_ELTS(nr) +#define EMIT_ELT(offset, elt) +#define EMIT_TWO_ELTS(offset, elt0, elt1) +#define INCR_ELTS(nr) +#define ELT_INIT(prim) +#define GET_CURRENT_VB_MAX_ELTS() 0 +#define GET_SUBSEQUENT_VB_MAX_ELTS() 0 +#define ALLOC_ELTS_NEW_PRIMITIVE(nr) +#define RELEASE_ELT_VERTS() +#define EMIT_INDEXED_VERTS(ctx, start, count) +#endif + +#ifndef EMIT_TWO_ELTS +#define EMIT_TWO_ELTS(offset, elt0, elt1) \ + do { \ + EMIT_ELT(offset, elt0); \ + EMIT_ELT(offset + 1, elt1); \ + } while (0) +#endif + +#ifndef FINISH +#define FINISH +#endif + +/*********************************************************************** + * Render non-indexed primitives. + ***********************************************************************/ + +static void TAG(render_points_verts)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M_X; +#endif +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (HAVE_POINTS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz = GET_CURRENT_VB_MAX_VERTS(); + GLuint j, nr; + + INIT(GL_POINTS); + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr) { + nr = MIN2(currentsz, count - j); + EMIT_VERTS(ctx, j, nr); + currentsz = dmasz; + } + + FINISH; + } + else { + VERT_FALLBACK(ctx, start, count, flags); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +static void TAG(render_lines_verts)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M_X; +#endif +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (HAVE_LINES) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz = GET_CURRENT_VB_MAX_VERTS(); + GLuint j, nr; + + INIT(GL_LINES); + + /* Emit whole number of lines in total and in each buffer: + */ + count -= (count - start) & 1; + currentsz -= currentsz & 1; + dmasz -= dmasz & 1; + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr) { + nr = MIN2(currentsz, count - j); + EMIT_VERTS(ctx, j, nr); + currentsz = dmasz; + } + + FINISH; + } + else { + VERT_FALLBACK(ctx, start, count, flags); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + + +static void TAG(render_line_strip_verts)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M_X; +#endif +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (HAVE_LINE_STRIPS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz = GET_CURRENT_VB_MAX_VERTS(); + GLuint j, nr; + + INIT(GL_LINE_STRIP); + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j + 1 < count; j += nr - 1) { + nr = MIN2(currentsz, count - j); + EMIT_VERTS(ctx, j, nr); + currentsz = dmasz; + } + + FINISH; + } + else { + VERT_FALLBACK(ctx, start, count, flags); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + + +static void TAG(render_line_loop_verts)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M_X; +#endif +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (HAVE_LINE_STRIPS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz = GET_CURRENT_VB_MAX_VERTS(); + GLuint j, nr; + + INIT(GL_LINE_STRIP); + + if (flags & PRIM_BEGIN) + j = start; + else + j = start + 1; + + /* Ensure last vertex won't wrap buffers: + */ + currentsz--; + dmasz--; + + if (currentsz < 8) + currentsz = dmasz; + + for (; j + 1 < count; j += nr - 1) { + nr = MIN2(currentsz, count - j); + EMIT_VERTS(ctx, j, nr); + currentsz = dmasz; + } + + if (start < count - 1 && (flags & PRIM_END)) + EMIT_VERTS(ctx, start, 1); + + FINISH; + } + else { + VERT_FALLBACK(ctx, start, count, flags); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + + +static void TAG(render_triangles_verts)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + LOCAL_VARS; + int dmasz = (GET_SUBSEQUENT_VB_MAX_VERTS() / 3) * 3; + int currentsz = (GET_CURRENT_VB_MAX_VERTS() / 3) * 3; + GLuint j, nr; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M_X; +#endif + INIT(GL_TRIANGLES); + + /* Emit whole number of tris in total. dmasz is already a multiple + * of 3. + */ + count -= (count - start) % 3; + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr) { + nr = MIN2(currentsz, count - j); + EMIT_VERTS(ctx, j, nr); + currentsz = dmasz; + } + FINISH; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +static void TAG(render_tri_strip_verts)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M_X; +#endif +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (HAVE_TRI_STRIPS) { + LOCAL_VARS; + GLuint j, nr; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz = GET_CURRENT_VB_MAX_VERTS(); + + INIT(GL_TRIANGLE_STRIP); + + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + + if ((flags & PRIM_PARITY) && count - start > 2) { + EMIT_VERTS(ctx, start, 1); + currentsz--; + } + + /* From here on emit even numbers of tris when wrapping over buffers: + */ + dmasz -= (dmasz & 1); + currentsz -= (currentsz & 1); + + for (j = start; j + 2 < count; j += nr - 2) { + nr = MIN2(currentsz, count - j); + EMIT_VERTS(ctx, j, nr); + currentsz = dmasz; + } + + FINISH; + } + else { + VERT_FALLBACK(ctx, start, count, flags); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +static void TAG(render_tri_fan_verts)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M_X; +#endif + if (HAVE_TRI_FANS) { + LOCAL_VARS; + GLuint j, nr; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz = GET_CURRENT_VB_MAX_VERTS(); + + INIT(GL_TRIANGLE_FAN); + + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + + for (j = start + 1; j + 1 < count; j += nr - 1) { + nr = MIN2(currentsz, count - j + 1); + EMIT_VERTS(ctx, start, 1); + EMIT_VERTS(ctx, j, nr - 1); + currentsz = dmasz; + } + + FINISH; + } + else { + /* Could write code to emit these as indexed vertices (for the + * g400, for instance). + */ + VERT_FALLBACK(ctx, start, count, flags); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +static void TAG(render_poly_verts)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M_X; +#endif +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (HAVE_POLYGONS) { + LOCAL_VARS; + GLuint j, nr; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz = GET_CURRENT_VB_MAX_VERTS(); + + INIT(GL_POLYGON); + + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + + for (j = start + 1; j + 1 < count; j += nr - 1) { + nr = MIN2(currentsz, count - j + 1); + EMIT_VERTS(ctx, start, 1); + EMIT_VERTS(ctx, j, nr - 1); + currentsz = dmasz; + } + + FINISH; + } + else if (HAVE_TRI_FANS && !(ctx->_TriangleCaps & DD_FLATSHADE)) { + TAG(render_tri_fan_verts)(ctx, start, count, flags); + } + else { + VERT_FALLBACK(ctx, start, count, flags); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +static void TAG(render_quad_strip_verts)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + GLuint j, nr; +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M_X; +#endif +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (HAVE_QUAD_STRIPS) { + LOCAL_VARS; + GLuint j, nr; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + + INIT(GL_QUAD_STRIP); + + currentsz = GET_CURRENT_VB_MAX_VERTS(); + + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + + dmasz -= (dmasz & 2); + currentsz -= (currentsz & 2); + + for (j = start; j + 3 < count; j += nr - 2) { + nr = MIN2(currentsz, count - j); + EMIT_VERTS(ctx, j, nr); + currentsz = dmasz; + } + + FINISH; + } + else if (HAVE_TRI_STRIPS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz = GET_CURRENT_VB_MAX_VERTS(); + + /* Emit smooth-shaded quadstrips as tristrips: + */ + INIT(GL_TRIANGLE_STRIP); + + /* Emit whole number of quads in total, and in each buffer. + */ + dmasz -= dmasz & 1; + currentsz -= currentsz & 1; + count -= (count - start) & 1; + + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + + for (j = start; j + 3 < count; j += nr - 2) { + nr = MIN2(currentsz, count - j); + EMIT_VERTS(ctx, j, nr); + currentsz = dmasz; + } + + FINISH; + } + else { + VERT_FALLBACK(ctx, start, count, flags); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + + +static void TAG(render_quads_verts)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M_X; +#endif + if (HAVE_QUADS) { + LOCAL_VARS; + int dmasz = (GET_SUBSEQUENT_VB_MAX_VERTS() / 4) * 4; + int currentsz = (GET_CURRENT_VB_MAX_VERTS() / 4) * 4; + GLuint j, nr; + + INIT(GL_QUADS); + + /* Emit whole number of quads in total. dmasz is already a multiple + * of 4. + */ + count -= (count - start) % 4; + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr) { + nr = MIN2(currentsz, count - j); + EMIT_VERTS(ctx, j, nr); + currentsz = dmasz; + } + FINISH; + } + else if (HAVE_TRIANGLES) { + /* Hardware doesn't have a quad primitive type -- try to + * simulate it using triangle primitive. + */ + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + GLuint j; + + INIT(GL_TRIANGLES); + + currentsz = GET_CURRENT_VB_MAX_VERTS(); + + /* Emit whole number of quads in total, and in each buffer. + */ + dmasz -= dmasz & 3; + count -= (count - start) & 3; + currentsz -= currentsz & 3; + + /* Adjust for rendering as triangles: + */ + currentsz = currentsz / 6 * 4; + dmasz = dmasz / 6 * 4; + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += 4) { + /* Send v0, v1, v3 + */ + EMIT_VERTS(ctx, j, 2); + EMIT_VERTS(ctx, j + 3, 1); + /* Send v1, v2, v3 + */ + EMIT_VERTS(ctx, j + 1, 3); + } + FINISH; + } + else { + /* Vertices won't fit in a single buffer, fallback. + */ + VERT_FALLBACK(ctx, start, count, flags); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void TAG(render_noop)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ +} + + +static render_func TAG(render_tab_verts)[GL_POLYGON + 2] = +{ + TAG(render_points_verts), + TAG(render_lines_verts), + TAG(render_line_loop_verts), + TAG(render_line_strip_verts), + TAG(render_triangles_verts), + TAG(render_tri_strip_verts), + TAG(render_tri_fan_verts), + TAG(render_quads_verts), + TAG(render_quad_strip_verts), + TAG(render_poly_verts), + TAG(render_noop), +}; + diff --git a/xc/lib/GL/mesa/src/drv/via/via_dri.h b/xc/lib/GL/mesa/src/drv/via/via_dri.h new file mode 100644 index 000000000..8d65831ca --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_dri.h @@ -0,0 +1,59 @@ +#ifndef _VIA_DRI_ +#define _VIA_DRI_ + +#include "xf86drm.h" + +#define VIA_MAX_DRAWABLES 256 + +#define VIA_VERSION_MAJOR 4 +#define VIA_VERSION_MINOR 1 + +typedef struct { + int CtxOwner; +} VIASAREAPriv; + +typedef struct { + drmHandle handle; + drmSize size; + drmAddress map; +} viaRegion, *viaRegionPtr; + +typedef struct { + viaRegion regs, agp; + int deviceID; + int width; + int height; + int mem; + int bytesPerPixel; + int priv1; + int priv2; + int fbOffset; + int fbSize; + Bool drixinerama; + int backOffset; + int depthOffset; + int textureOffset; + int textureSize; + int irqEnabled; + unsigned int scrnX, scrnY; + int sarea_priv_offset; +} VIADRIRec, *VIADRIPtr; + +typedef struct { + int dummy; +} VIAConfigPrivRec, *VIAConfigPrivPtr; + +typedef struct { + int dummy; +} VIADRIContextRec, *VIADRIContextPtr; + +#ifdef XFree86Server + +#include "screenint.h" + +Bool VIADRIScreenInit(ScreenPtr pScreen); +void VIADRICloseScreen(ScreenPtr pScreen); +Bool VIADRIFinishScreenInit(ScreenPtr pScreen); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_fb.c b/xc/lib/GL/mesa/src/drv/via/via_fb.c new file mode 100644 index 000000000..af2f75ec8 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_fb.c @@ -0,0 +1,373 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <assert.h> + +#include "via_context.h" +#include "via_ioctl.h" +#include "via_fb.h" +#include <sys/ioctl.h> + +GLboolean +via_alloc_back_buffer(viaContextPtr vmesa) +{ + drm_via_mem_t fb; + unsigned char *pFB; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + fb.context = vmesa->hHWContext; + fb.size = vmesa->back.size; + fb.type = VIDEO; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "context = %d, size =%d, type = %d\n", fb.context, fb.size, fb.type); +#endif + if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) + return GL_FALSE; + + pFB = vmesa->driScreen->pFB; + + vmesa->back.offset = fb.offset; + vmesa->back.map = (char *)(fb.offset + (GLuint)pFB); + vmesa->back.index = fb.index; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "offset = %08x\n", vmesa->back.offset); + fprintf(stderr, "index = %d\n", vmesa->back.index); + } + + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_TRUE; +} + +GLboolean +via_alloc_front_buffer(viaContextPtr vmesa) +{ + drm_via_mem_t fb; + unsigned char *pFB; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + fb.context = vmesa->hHWContext; + fb.size = vmesa->back.size; + fb.type = VIDEO; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "context = %d, size =%d, type = %d\n", fb.context, fb.size, fb.type); +#endif + if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) + return GL_FALSE; + + pFB = vmesa->driScreen->pFB; + + vmesa->front.offset = fb.offset; + vmesa->front.map = (char *)(fb.offset + (GLuint)pFB); + vmesa->front.index = fb.index; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "offset = %08x\n", vmesa->front.offset); + fprintf(stderr, "index = %d\n", vmesa->front.index); + } + + + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_TRUE; +} + +void +via_free_back_buffer(viaContextPtr vmesa) +{ + drm_via_mem_t fb; + + if (!vmesa) return; + fb.context = vmesa->hHWContext; + fb.index = vmesa->back.index; + fb.type = VIDEO; + ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb); + vmesa->back.map = NULL; +} + +void +via_free_front_buffer(viaContextPtr vmesa) +{ + drm_via_mem_t fb; + + if (!vmesa) return; + fb.context = vmesa->hHWContext; + fb.index = vmesa->front.index; + fb.type = VIDEO; + ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb); + vmesa->front.map = NULL; +} + +GLboolean +via_alloc_depth_buffer(viaContextPtr vmesa) +{ + drm_via_mem_t fb; + unsigned char *pFB; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + fb.context = vmesa->hHWContext; + fb.size = vmesa->depth.size; + fb.type = VIDEO; + + if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) { + return GL_FALSE; + } + + pFB = vmesa->driScreen->pFB; + + vmesa->depth.offset = fb.offset; + vmesa->depth.map = (char *)(fb.offset + (GLuint)pFB); + vmesa->depth.index = fb.index; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "offset = %08x\n", vmesa->depth.offset); + fprintf(stderr, "index = %d\n", vmesa->depth.index); + } + + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_TRUE; +} + +void +via_free_depth_buffer(viaContextPtr vmesa) +{ + drm_via_mem_t fb; + + if (!vmesa) return; + fb.context = vmesa->hHWContext; + fb.index = vmesa->depth.index; + fb.type = VIDEO; + ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb); + vmesa->depth.map = NULL; +} + +GLboolean +via_alloc_dma_buffer(viaContextPtr vmesa) +{ + drm_via_mem_t fb; + drmVIADMABuf dma; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (vmesa->viaScreen->agpLinearStart) { + /* Allocate DMA in AGP memory*/ + fb.context = vmesa->hHWContext; + fb.size = vmesa->dma[0].size; + fb.type = AGP; + if (!ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) { + vmesa->dma[0].offset = fb.offset; + vmesa->dma[0].index = fb.index; + vmesa->dma[0].map = (unsigned char *)((GLuint)vmesa->viaScreen->agpLinearStart + fb.offset); + if (!ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) { + vmesa->dma[1].offset = fb.offset; + vmesa->dma[1].index = fb.index; + vmesa->dma[1].map = (unsigned char *)((GLuint)vmesa->viaScreen->agpLinearStart + fb.offset); + vmesa->useAgp = GL_TRUE; + + return GL_TRUE; + } + else { + /* release dma[0]*/ + return GL_FALSE; + } + } + return GL_FALSE; + } + else { + /* Allocate DMA in System memory */ + dma.size = vmesa->dma[0].size; + + if (drmVIAAllocateDMA(vmesa->driFd,&dma) < 0) { + return GL_FALSE; + } + + vmesa->dma[0].offset = 0; + vmesa->dma[0].map = (unsigned char *)dma.address; + vmesa->dma[0].index = dma.index; + + drmVIAAllocateDMA(vmesa->driFd, &dma); + + vmesa->dma[1].offset = 0; + vmesa->dma[1].map = (unsigned char *)dma.address; + vmesa->dma[1].index = dma.index; + vmesa->useAgp = GL_FALSE; + + return GL_TRUE; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void +via_free_dma_buffer(viaContextPtr vmesa) +{ + drmVIADMABuf dma; + drm_via_mem_t fb; + + + if (!vmesa) return; + + /* Release AGP command buffer */ + if (vmesa->useAgp) { + fb.context = vmesa->hHWContext; + fb.index = vmesa->dma[0].index; + fb.type = AGP; + ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb); + vmesa->dma[0].map = NULL; + fb.index = vmesa->dma[1].index; + ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb); + vmesa->dma[1].map = NULL; + } + /* Release System command buffer */ + else { + + dma.address = (unsigned long *)vmesa->dma[0].offset; + /*=* John Sheng [2003.6.16] fix pci path *=*/ + dma.size = (unsigned int)vmesa->dma[0].size; + drmVIAReleaseDMA(vmesa->driFd, &dma); + + dma.address = (unsigned long *)vmesa->dma[1].offset; + /*=* John Sheng [2003.6.16] fix pci path *=*/ + dma.size = (unsigned int)vmesa->dma[1].size; + drmVIAReleaseDMA(vmesa->driFd, &dma); + vmesa->dma[0].offset = 0; + vmesa->dma[1].offset = 0; + } +} + +GLboolean +via_alloc_texture(viaContextPtr vmesa, viaTextureObjectPtr t) +{ + drm_via_mem_t fb; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + fb.context = vmesa->hHWContext; + fb.size = t->texMem.size; + fb.type = VIDEO; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "texture size = %d\n", fb.size); + fprintf(stderr, "texture type = %d\n", fb.type); + } +#endif + if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) { + fprintf(stderr, "via_alloc_texture fail\n"); + return GL_FALSE; + } + + t->texMem.offset = fb.offset; + t->texMem.index = fb.index; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texture index = %d\n", (GLuint)fb.index); +#endif + + t->bufAddr = (unsigned char *)(fb.offset + (GLuint)vmesa->driScreen->pFB); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_TRUE; +} +/*=* John Sheng [2003.5.31] agp tex *=*/ +GLboolean +via_alloc_texture_agp(viaContextPtr vmesa, viaTextureObjectPtr t) +{ + drm_via_mem_t fb; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + fb.context = vmesa->hHWContext; + fb.size = t->texMem.size; + fb.type = AGP; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "texture_agp size = %d\n", fb.size); + fprintf(stderr, "texture type = %d\n", fb.type); + } +#endif + if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) { + fprintf(stderr, "via_alloc_texture_agp fail\n"); + return GL_FALSE; + } + + t->texMem.offset = fb.offset; + t->texMem.index = fb.index; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texture agp index = %d\n", (GLuint)fb.index); +#endif + + t->bufAddr = (unsigned char *)((GLuint)vmesa->viaScreen->agpLinearStart + fb.offset); + /*=* John Sheng [2003.5.31] agp tex *=*/ + t->inAGP = GL_TRUE; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_TRUE; +} + +void +via_free_texture(viaContextPtr vmesa, viaTextureObjectPtr t) +{ + drm_via_mem_t fb; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "via_free_texture: index = %d\n", + t->texMem.index); + fprintf(stderr, "via_free_texture: size = %d\n", + t->texMem.size); + } +#endif + if (!vmesa) { + fprintf(stderr, "!mesa\n"); + return; + } + + fb.context = vmesa->hHWContext; + fb.index = t->texMem.index; + + /*=* John Sheng [2003.5.31] agp tex *=*/ + if(t->inAGP) + fb.type = AGP; + else + fb.type = VIDEO; + + if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb)) { + if(vmesa->shareCtx) { + fb.context = ((viaContextPtr)((GLcontext *)(vmesa->shareCtx)->DriverCtx))->hHWContext; + if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb)) { + fprintf(stderr, "via_free_texture fail\n"); + } + } + else + fprintf(stderr, "via_free_texture fail\n"); + } + + t->bufAddr = NULL; +} diff --git a/xc/lib/GL/mesa/src/drv/via/via_fb.h b/xc/lib/GL/mesa/src/drv/via/via_fb.h new file mode 100644 index 000000000..c4378c246 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_fb.h @@ -0,0 +1,42 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _VIAFB_INC +#define _VIAFB_INC + +#include "mtypes.h" +#include "swrast/swrast.h" +extern GLboolean via_alloc_front_buffer(viaContextPtr vmesa); +extern GLboolean via_alloc_back_buffer(viaContextPtr vmesa); +extern void via_free_back_buffer(viaContextPtr vmesa); +extern void via_free_front_buffer(viaContextPtr vmesa); +extern GLboolean via_alloc_depth_buffer(viaContextPtr vmesa); +extern void via_free_depth_buffer(viaContextPtr vmesa); +extern GLboolean via_alloc_dma_buffer(viaContextPtr vmesa); +extern void via_free_dma_buffer(viaContextPtr vmesa); +extern GLboolean via_alloc_texture(viaContextPtr vmesa, viaTextureObjectPtr t); +/*=* John Sheng [2003.5.31] agp tex *=*/ +extern GLboolean via_alloc_texture_agp(viaContextPtr vmesa, viaTextureObjectPtr t); +extern void via_free_texture(viaContextPtr vmesa, viaTextureObjectPtr t); +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_ioctl.c b/xc/lib/GL/mesa/src/drv/via/via_ioctl.c new file mode 100644 index 000000000..b88de0b12 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_ioctl.c @@ -0,0 +1,2205 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <stdio.h> +#include <unistd.h> + +#include "glheader.h" +#include "mtypes.h" +#include "macros.h" +#include "dd.h" +#include "swrast/swrast.h" + +#include "mm.h" +#include "via_context.h" +#include "via_ioctl.h" +#include "via_state.h" + +#include "drm.h" +#include <sys/ioctl.h> + +GLuint FrameCount = 0; +GLuint dmaLow = 0; +/*=* John Sheng [2003.5.31] flip *=*/ +GLuint nFirstSwap = GL_TRUE; +GLuint nFirstFlip = GL_TRUE; +#define SetReg2DAGP(nReg, nData) { \ + *((GLuint *)(vb)) = ((nReg) >> 2) | 0xF0000000; \ + *((GLuint *)(vb) + 1) = (nData); \ + vb += 2; \ + vmesa->dmaLow +=8; \ +} + +#define DEPTH_SCALE ((1 << 16) - 1) + +static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all, + GLint cx, GLint cy, GLint cw, GLint ch) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; + const GLuint colorMask = *((GLuint *)&ctx->Color.ColorMask); + int flag = 0; + GLuint scrn = 0, i = 0, side = 0; + scrn = vmesa->saam & S_MASK; + side = vmesa->saam & P_MASK; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + VIA_FIREVERTICES(vmesa); + + if ((mask & DD_FRONT_LEFT_BIT) && colorMask == ~0) { + flag |= VIA_FRONT; + mask &= ~DD_FRONT_LEFT_BIT; + } + + if ((mask & DD_BACK_LEFT_BIT) && colorMask == ~0) { + flag |= VIA_BACK; + mask &= ~DD_BACK_LEFT_BIT; + } + + if (mask & DD_DEPTH_BIT) { + if (ctx->Depth.Mask) + flag |= VIA_DEPTH; + mask &= ~DD_DEPTH_BIT; + } + + if (mask & DD_STENCIL_BIT) { + if (ctx->Stencil.Enabled) + flag |= VIA_STENCIL; + mask &= ~DD_STENCIL_BIT; + } + + /*=* [DBG] make draw to front buffer *=*/ + if(DRAW_FRONT) { + flag |= VIA_FRONT; + flag &= ~VIA_BACK; + } + + if (flag) { + LOCK_HARDWARE(vmesa); + /* flip top to bottom */ + cy = dPriv->h - cy - ch; + cx += vmesa->drawX; + cy += vmesa->drawY; + + if (vmesa->numClipRects) { + int nr = MIN2(i + VIA_NR_SAREA_CLIPRECTS, vmesa->numClipRects); + XF86DRIClipRectRec *box = vmesa->pClipRects; + drm_clip_rect_t *b = vmesa->sarea->boxes; + int n = 0; + + if (!vmesa->saam) { + if (!all) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr,"!all"); +#endif + for (; i < nr; i++) { + GLint x = box[i].x1; + GLint y = box[i].y1; + GLint w = box[i].x2 - x; + GLint h = box[i].y2 - y; + + if (x < cx) w -= cx - x, x = cx; + if (y < cy) h -= cy - y, y = cy; + if (x + w > cx + cw) w = cx + cw - x; + if (y + h > cy + ch) h = cy + ch - y; + if (w <= 0) continue; + if (h <= 0) continue; + + b->x1 = x; + b->y1 = y; + b->x2 = x + w; + b->y2 = y + h; + b++; + n++; + } + } + else { + for (; i < nr; i++) { + *b++ = *(drm_clip_rect_t *)&box[i]; + n++; + } + } + vmesa->sarea->nbox = n; + } + else { + GLuint scrn = 0; + scrn = vmesa->saam & S_MASK; + + if (scrn == S0 || scrn == S1) { + if (!all) { + for (; i < nr; i++) { + GLint x = box[i].x1; + GLint y = box[i].y1; + GLint w = box[i].x2 - x; + GLint h = box[i].y2 - y; + + if (x < cx) w -= cx - x, x = cx; + if (y < cy) h -= cy - y, y = cy; + if (x + w > cx + cw) w = cx + cw - x; + if (y + h > cy + ch) h = cy + ch - y; + if (w <= 0) continue; + if (h <= 0) continue; + + b->x1 = x; + b->y1 = y; + b->x2 = x + w; + b->y2 = y + h; + b++; + n++; + } + } + else { + for (; i < nr; i++) { + *b++ = *(drm_clip_rect_t *)&box[i]; + n++; + } + } + vmesa->sarea->nbox = n; + } + /* between */ + else { + if (!all) { + for (; i < nr; i++) { + GLint x = box[i].x1; + GLint y = box[i].y1; + GLint w = box[i].x2 - x; + GLint h = box[i].y2 - y; + + if (x < cx) w -= cx - x, x = cx; + if (y < cy) h -= cy - y, y = cy; + if (x + w > cx + cw) w = cx + cw - x; + if (y + h > cy + ch) h = cy + ch - y; + if (w <= 0) continue; + if (h <= 0) continue; + + b->x1 = x; + b->y1 = y; + b->x2 = x + w; + b->y2 = y + h; + b++; + n++; + } + + } + else { + for (; i < nr; i++) { + *b++ = *(drm_clip_rect_t *)&box[n]; + n++; + } + } + *b++ = *(drm_clip_rect_t *)vmesa->pSaamRects; + vmesa->sarea->nbox = n; + } + } + + { + if (flag & VIA_FRONT) { + + if (vmesa->drawType == GLX_PBUFFER_BIT) + viaFillFrontPBuffer(vmesa); + else + viaFillFrontBuffer(vmesa); + + if (vmesa->saam && (scrn == (S0 | S1))) { + nr = MIN2(i + VIA_NR_SAREA_CLIPRECTS, vmesa->numSaamRects); + box = vmesa->pSaamRects; + b = vmesa->sarea->boxes; + n = 0; + + for (i = 0; i < nr; i++) { + *b++ = *(drm_clip_rect_t *)&box[n]; + n++; + } + + vmesa->sarea->nbox = n; + viaFillFrontBufferSaam(vmesa); + } + } + + if (flag & VIA_BACK) { + viaFillBackBuffer(vmesa); + } + + if (flag & VIA_DEPTH) { + double depth_clamp, range = 0xffffffff; + if (vmesa->hasStencil == 0) { + if (vmesa->depthBits == 32) { + depth_clamp = ((double)ctx->Depth.Clear)*range; + viaFillDepthBuffer(vmesa, (GLuint)depth_clamp); + } + else { + depth_clamp = ((double)ctx->Depth.Clear)*range; + viaFillDepthBuffer(vmesa, (GLuint)depth_clamp); + } + } + else { + depth_clamp = ((double)ctx->Depth.Clear)*range; + viaFillStencilDepthBuffer(vmesa, (GLuint)depth_clamp); + } + } + /*=* [DBG] Fix tuxracer depth error *=*/ + else if (flag & VIA_STENCIL) { + viaFillStencilBuffer(vmesa, (GLuint)ctx->Stencil.Clear); + } + } + } + UNLOCK_HARDWARE(vmesa); + vmesa->uploadCliprects = GL_TRUE; + } + + if (mask) + _swrast_Clear(ctx, mask, all, cx, cy, cw, ch); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +/* + * Copy the back buffer to the front buffer. + */ +void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) +{ + viaContextPtr vmesa; + XF86DRIClipRectPtr pbox; + int nbox, i; + GLuint scrn = 0, side = 0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + assert(dPriv); + assert(dPriv->driContextPriv); + assert(dPriv->driContextPriv->driverPrivate); + + vmesa = (viaContextPtr)dPriv->driContextPriv->driverPrivate; + + VIA_FIREVERTICES(vmesa); + LOCK_HARDWARE(vmesa); + + scrn = vmesa->saam & S_MASK; + side = vmesa->saam & P_MASK; + + pbox = vmesa->pClipRects; + nbox = vmesa->numClipRects; + +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s %d cliprects (%d), SAAM (%d)\n", + __FUNCTION__, nbox, vmesa->drawType, vmesa->saam); +#endif + + + if (vmesa->drawType == GLX_PBUFFER_BIT) { + viaDoSwapPBuffers(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s SwapPBuffers\n", __FUNCTION__); +#endif /*=* [DBG] for pbuffer *=*/ + /*viaDoSwapBufferSoftFront(vmesa);*/ + } + else { + GLuint scrn = 0; + scrn = vmesa->saam & S_MASK; + if (!vmesa->saam) { + for (i = 0; i < nbox; ) { + int nr = MIN2(i + VIA_NR_SAREA_CLIPRECTS, dPriv->numClipRects); + XF86DRIClipRectRec *b = (XF86DRIClipRectRec *)vmesa->sarea->boxes; + + vmesa->sarea->nbox = nr - i; + + for (; i < nr; i++) + *b++ = pbox[i]; + viaDoSwapBuffers(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s SwapBuffers\n", __FUNCTION__); +#endif + } + } + else if (scrn == S0 || scrn == S1) { + for (i = 0; i < nbox; ) { + int nr = MIN2(i + VIA_NR_SAREA_CLIPRECTS, vmesa->numClipRects); + XF86DRIClipRectRec *b = (XF86DRIClipRectRec *)vmesa->sarea->boxes; + + vmesa->sarea->nbox = nr - i; + + for (; i < nr; i++) { + *b++ = pbox[i]; + } + viaDoSwapBuffers(vmesa); + } + } + /* between */ + else { + for (i = 0; i < nbox; ) { + int nr = MIN2(i + VIA_NR_SAREA_CLIPRECTS, dPriv->numClipRects); + XF86DRIClipRectRec *b = (XF86DRIClipRectRec *)vmesa->sarea->boxes; + + vmesa->sarea->nbox = nr - i; + + for (; i < nr; i++) + *b++ = pbox[i]; + viaDoSwapBuffers(vmesa); + } + + pbox = vmesa->pSaamRects; + nbox = vmesa->numSaamRects; + + for (i = 0; i < nbox; ) { + int nr = MIN2(i + VIA_NR_SAREA_CLIPRECTS, vmesa->numSaamRects); + XF86DRIClipRectRec *b = (XF86DRIClipRectRec *)vmesa->sarea->boxes; + + vmesa->sarea->nbox = nr - i; + + for (; i < nr; i++) + *b++ = pbox[i]; + + viaDoSwapBuffersSaam(vmesa); + } + } + } + UNLOCK_HARDWARE(vmesa); + vmesa->uploadCliprects = GL_TRUE; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +/* + * XXX implement when full-screen extension is done. + */ +void viaPageFlip(const __DRIdrawablePrivate *dPriv) +{ + /*=* John Sheng [2003.5.31] flip *=*/ + viaContextPtr vmesa = (viaContextPtr)dPriv->driContextPriv->driverPrivate; + GLuint *vb = viaCheckDma(vmesa, vmesa->sarea->nbox*56); + GLuint nBackBase; + viaBuffer buffer_tmp; + GLcontext *ctx; + +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + assert(dPriv); + assert(dPriv->driContextPriv); + assert(dPriv->driContextPriv->driverPrivate); + + ctx = vmesa->glCtx; + + /*=* [DBG] make draw to front buffer *=*/ + if(DRAW_FRONT) + return; + + /* Page Flip*/ + if(GL_FALSE) { + viaFlushPrimsLocked(vmesa); + while ((*(GLuint *)((GLuint)vmesa->regMMIOBase + 0x200) & 0x2) != 0x2); + while (*(GLuint *)((GLuint)vmesa->regMMIOBase + 0x200) & 0x2); + nBackBase = vmesa->back.offset >> 1; + + /*if (nFirstFlip) { + *vb++ = HALCYON_HEADER2; + *vb++ = 0x00fe0000; + *vb++ = 0x00001004; + *vb++ = 0x00001004; + vmesa->dmaLow += 16; + + nFirstFlip = GL_FALSE; + } + SetReg2DAGP(0x214, nBackBase); + viaFlushPrimsLocked(vmesa);*/ + if (nFirstFlip) { + *((GLuint *)((GLuint)vmesa->regMMIOBase + 0x43c)) = 0x00fe0000; + *((GLuint *)((GLuint)vmesa->regMMIOBase + 0x440)) = 0x00001004; + nFirstFlip = GL_FALSE; + } + *((GLuint *)((GLuint)vmesa->regMMIOBase + 0x214)) = nBackBase; + } + /* Auto Swap */ + else { + viaFlushPrimsLocked(vmesa); + vb = viaCheckDma(vmesa, vmesa->sarea->nbox*56); + if (nFirstSwap) { + *vb++ = HALCYON_HEADER2; + *vb++ = 0x00fe0000; + *vb++ = 0x0000000e; + *vb++ = 0x0000000e; + vmesa->dmaLow += 16; + + nFirstSwap = GL_FALSE; + } + nBackBase = (vmesa->back.offset << 1); + + *vb++ = HALCYON_HEADER2; + *vb++ = 0x00fe0000; + *vb++ = (HC_SubA_HFBBasL << 24) | (nBackBase & 0xFFFFF8) | 0x2; + *vb++ = (HC_SubA_HFBDrawFirst << 24) | + ((nBackBase & 0xFF000000) >> 24) | 0x0100; + vmesa->dmaLow += 16; + viaFlushPrimsLocked(vmesa); + } + + + memcpy(&buffer_tmp, &vmesa->back, sizeof(viaBuffer)); + memcpy(&vmesa->back, &vmesa->front, sizeof(viaBuffer)); + memcpy(&vmesa->front, &buffer_tmp, sizeof(viaBuffer)); + + if(vmesa->currentPage) { + vmesa->currentPage = 0; + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { + ctx->Driver.SetDrawBuffer(ctx, GL_BACK); + } + else { + ctx->Driver.SetDrawBuffer(ctx, GL_FRONT); + } + } + else { + vmesa->currentPage = 1; + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { + ctx->Driver.SetDrawBuffer(ctx, GL_BACK); + } + else { + ctx->Driver.SetDrawBuffer(ctx, GL_FRONT); + } + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + +} + +/* This waits for *everybody* to finish rendering -- overkill. + */ +void viaDmaFinish(viaContextPtr vmesa) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + VIA_FIREVERTICES(vmesa); + LOCK_HARDWARE(vmesa); + UNLOCK_HARDWARE(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +void viaRegetLockQuiescent(viaContextPtr vmesa) +{ + drmUnlock(vmesa->driFd, vmesa->hHWContext); +} + +static int intersect_rect(drm_clip_rect_t *out, + drm_clip_rect_t *a, + drm_clip_rect_t *b) +{ + *out = *a; + + if (b->x1 > out->x1) out->x1 = b->x1; + if (b->x2 < out->x2) out->x2 = b->x2; + if (out->x1 >= out->x2) return 0; + + if (b->y1 > out->y1) out->y1 = b->y1; + if (b->y2 < out->y2) out->y2 = b->y2; + if (out->y1 >= out->y2) return 0; + + return 1; +} + +void viaFlushPrimsLocked(viaContextPtr vmesa) +{ + drm_clip_rect_t *pbox = (drm_clip_rect_t *)vmesa->pClipRects; + int nbox = vmesa->numClipRects; + drm_via_sarea_t *sarea = vmesa->sarea; + drm_via_flush_agp_t agpCmd; + drm_via_flush_sys_t sysCmd; + GLuint *vb = viaCheckDma(vmesa, 0); + int i; + + if (vmesa->dmaLow == DMA_OFFSET) { + return; + } + if (vmesa->dmaLow > 2097152) + fprintf(stderr, "buffer overflow in Flush Prims = %d\n",vmesa->dmaLow); + + switch (vmesa->dmaLow & 0x1F) { + case 8: + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + vmesa->dmaLow += 24; + break; + case 16: + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + vmesa->dmaLow += 16; + break; + case 24: + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + *vb++ = HC_DUMMY; + vmesa->dmaLow += 40; + break; + case 0: + break; + default: + break; + } + + if (vmesa->useAgp) { + agpCmd.offset = 0x0; + agpCmd.size = vmesa->dmaLow; + agpCmd.index = vmesa->dma[vmesa->dmaIndex].index; + agpCmd.discard = 0; + } + else { + sysCmd.offset = 0x0; + sysCmd.size = vmesa->dmaLow; + sysCmd.index = (GLuint)vmesa->dma[vmesa->dmaIndex].map; + sysCmd.discard = 0; + } + + sarea->vertexPrim = vmesa->hwPrimitive; + + if (!nbox) { + if (vmesa->useAgp) + agpCmd.size = 0; + else + sysCmd.size = 0; + } + else if (nbox > VIA_NR_SAREA_CLIPRECTS) { + vmesa->uploadCliprects = GL_TRUE; + } +/*=* John Sheng [2003.5.31] flip *=*/ +/*#ifdef DEBUG + if (VIA_DEBUG) { + GLuint i; + GLuint *data = (GLuint *)vmesa->dmaAddr; + for (i = 0; i < vmesa->dmaLow; i += 16) { + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x\n", *data++); + } + fprintf(stderr, "******************************************\n"); + } +#endif*/ + if (!nbox || !vmesa->uploadCliprects) { + if (nbox == 1) + sarea->nbox = 0; + else + sarea->nbox = nbox; + + if (vmesa->useAgp) { + agpCmd.discard = 1; + flush_agp(vmesa, &agpCmd); + } + else { + sysCmd.discard = 1; + flush_sys(vmesa, &sysCmd); + } + } + else { + GLuint scrn; + GLuint side; + scrn = vmesa->saam & S_MASK; + side = vmesa->saam & P_MASK; + + for (i = 0; i < nbox; ) { + int nr = MIN2(i + VIA_NR_SAREA_CLIPRECTS, nbox); + drm_clip_rect_t *b = sarea->boxes; + + if (!vmesa->saam) { + if (vmesa->scissor) { + sarea->nbox = 0; + + for (; i < nr; i++) { + b->x1 = pbox[i].x1 - vmesa->drawX; + b->y1 = pbox[i].y1 - vmesa->drawY; + b->x2 = pbox[i].x2 - vmesa->drawX; + b->y2 = pbox[i].y2 - vmesa->drawY; + if (intersect_rect(b, b, &vmesa->scissorRect)) { + sarea->nbox++; + b++; + } + } + if (!sarea->nbox) { + if (nr < nbox) continue; + agpCmd.size = 0; + } + } + else { + sarea->nbox = nr - i; + for (; i < nr; i++, b++) { + b->x1 = pbox[i].x1 - vmesa->drawX; + b->y1 = pbox[i].y1 - vmesa->drawY; + b->x2 = pbox[i].x2 - vmesa->drawX; + b->y2 = pbox[i].y2 - vmesa->drawY; + } + } + } + else if (scrn == S0 || scrn == S1){ + if (vmesa->scissor) { + sarea->nbox = 0; + for (; i < nr; i++) { + b->x1 = pbox[i].x1 - vmesa->drawX; + b->y1 = pbox[i].y1 - vmesa->drawY; + b->x2 = pbox[i].x2 - vmesa->drawX; + b->y2 = pbox[i].y2 - vmesa->drawY; + if (intersect_rect(b, b, &vmesa->scissorRect)) { + sarea->nbox++; + b++; + } + } + if (!sarea->nbox) { + if (nr < nbox) continue; + agpCmd.size = 0; + } + } + else { + sarea->nbox = nr - i; + for (; i < nr; i++, b++) { + b->x1 = pbox[i].x1 - vmesa->drawX; + b->y1 = pbox[i].y1 - vmesa->drawY; + b->x2 = pbox[i].x2 - vmesa->drawX; + b->y2 = pbox[i].y2 - vmesa->drawY; + } + } + + } + /* between */ + else { + if (vmesa->scissor) { + sarea->nbox = 0; + for (; i < nr; i++) { + b->x1 = pbox[i].x1 - vmesa->drawX; + b->y1 = pbox[i].y1 - vmesa->drawY; + b->x2 = pbox[i].x2 - vmesa->drawX; + b->y2 = pbox[i].y2 - vmesa->drawY; + + if (intersect_rect(b, b, &vmesa->scissorRect)) { + sarea->nbox++; + b++; + } + } + if (!sarea->nbox) { + if (nr < nbox) continue; + agpCmd.size = 0; + } + } + else { + sarea->nbox = nr - i; + for (; i < nr; i++, b++) { + b->x1 = pbox[i].x1 - vmesa->drawX; + b->y1 = pbox[i].y1 - vmesa->drawY; + b->x2 = pbox[i].x2 - vmesa->drawX; + b->y2 = pbox[i].y2 - vmesa->drawY; + } + } + } + + if (nr == nbox) { + if (vmesa->useAgp) { + agpCmd.discard = 1; + flush_agp(vmesa, &agpCmd); + } + else { + sysCmd.discard = 1; + flush_sys(vmesa, &sysCmd); + } + } + + if (scrn == (S0 | S1)) { + pbox = (drm_clip_rect_t *)vmesa->pSaamRects; + nbox = vmesa->numSaamRects; + for (i = 0; i < nbox; ) { + int nr = MIN2(i + VIA_NR_SAREA_CLIPRECTS, nbox); + drm_clip_rect_t *b = sarea->boxes; + if (vmesa->scissor) { + sarea->nbox = 0; + for (; i < nr; i++) { + b->x1 = pbox[i].x1 - vmesa->drawXSaam; + b->y1 = pbox[i].y1 - vmesa->drawYSaam; + b->x2 = pbox[i].x2 - vmesa->drawXSaam; + b->y2 = pbox[i].y2 - vmesa->drawYSaam; + + if (intersect_rect(b, b, &vmesa->scissorRect)) { + sarea->nbox++; + b++; + } + } + if (!sarea->nbox) { + if (nr < nbox) continue; + agpCmd.size = 0; + } + } + else { + sarea->nbox = nr - i; + for (; i < nr; i++, b++) { + b->x1 = pbox[i].x1 - vmesa->drawXSaam; + b->y1 = pbox[i].y1 - vmesa->drawYSaam; + b->x2 = pbox[i].x2 - vmesa->drawXSaam; + b->y2 = pbox[i].y2 - vmesa->drawYSaam; + } + } + } + flush_agp_saam(vmesa, &agpCmd); + } + } + } +#ifdef DEBUG + if (VIA_DEBUG) { + GLuint i; + GLuint *data = (GLuint *)vmesa->dmaAddr; + for (i = 0; i < vmesa->dmaLow; i += 16) { + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x\n", *data++); + } + fprintf(stderr, "******************************************\n"); + } +#endif + /* Reset vmesa vars: + */ + vmesa->dmaLow = DMA_OFFSET; + if (vmesa->dmaIndex) { + vmesa->dmaAddr = vmesa->dma[0].map; + vmesa->dmaHigh = vmesa->dma[0].size; + vmesa->dmaLastPrim = DMA_OFFSET; + vmesa->dmaIndex = 0; + } + else { + vmesa->dmaAddr = vmesa->dma[1].map; + vmesa->dmaHigh = vmesa->dma[1].size; + vmesa->dmaLastPrim = DMA_OFFSET; + vmesa->dmaIndex = 1; + } +} + +void viaFlushPrims(viaContextPtr vmesa) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (vmesa->dmaLow) { + LOCK_HARDWARE(vmesa); + viaFlushPrimsLocked(vmesa); + UNLOCK_HARDWARE(vmesa); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif +} + +static void viaFlush(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + VIA_FIREVERTICES(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +static void viaFinish(GLcontext *ctx) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif + return; +} + +static void viaClearStencil(GLcontext *ctx, int s) +{ + return; +} + +void viaInitIoctlFuncs(GLcontext *ctx) +{ + ctx->Driver.Flush = viaFlush; + ctx->Driver.Clear = viaClear; + ctx->Driver.Finish = viaFinish; + ctx->Driver.ClearStencil = viaClearStencil; +} + +void viaFillFrontBuffer(viaContextPtr vmesa) +{ + GLuint nDestBase, nDestPitch, nDestWidth, nDestHeight, offsetX, offset,i; + drm_clip_rect_t *b = vmesa->sarea->boxes; + GLuint *vb = viaCheckDma(vmesa, vmesa->sarea->nbox*48); + GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; + GLuint pixel = (GLuint)vmesa->ClearColor; + + offset = vmesa->viaScreen->fbOffset + (vmesa->drawY * vmesa->front.pitch + vmesa->drawX * bytePerPixel); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Fill Front offset = %08x\n", offset); +#endif + nDestBase = offset & 0xffffffe0; + nDestPitch = vmesa->front.pitch; + + for (i = 0; i < vmesa->sarea->nbox ; i++) { + nDestWidth = b->x2 - b->x1 - 1; + nDestHeight = b->y2 - b->y1 - 1; + + if (bytePerPixel == 4) + offsetX = (b->x1 - vmesa->drawX) + (vmesa->drawX & 7); + else + offsetX = (b->x1 - vmesa->drawX) + (vmesa->drawX & 15); + + + if (GL_TRUE) { + /* GEFGCOLOR*/ + SetReg2DAGP(0x18, pixel | 0x00000000); + /* GEWD*/ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST*/ + SetReg2DAGP(0x0C, (offsetX | ((b->y1 - vmesa->drawY) << 16))); + /* GEDSTBASE*/ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH*/ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT*/ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + } + b++; + } + + viaFlushPrimsLocked(vmesa); +} + +void viaFillFrontBufferSaam(viaContextPtr vmesa) +{ + GLuint nDestBase, nDestPitch, nDestWidth, nDestHeight, offsetX, offset,i; + drm_clip_rect_t *b = vmesa->sarea->boxes; + GLuint *vb = viaCheckDma(vmesa, vmesa->sarea->nbox*48); + GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; + GLuint pixel = (GLuint)vmesa->ClearColor; + + offset = vmesa->viaScreen->fbSize + + (vmesa->drawYSaam * vmesa->front.pitch + vmesa->drawXSaam * bytePerPixel); + nDestBase = offset & 0xffffffe0; + nDestPitch = vmesa->front.pitch; + + for (i = 0; i < vmesa->sarea->nbox ; i++) { + nDestWidth = b->x2 - b->x1 - 1; + nDestHeight = b->y2 - b->y1 - 1; + + if (bytePerPixel == 4) + offsetX = (b->x1 - vmesa->drawXSaam) + (vmesa->drawXSaam & 7); + else + offsetX = (b->x1 - vmesa->drawXSaam) + (vmesa->drawXSaam & 15); + + if (GL_TRUE) { + /* GEFGCOLOR*/ + SetReg2DAGP(0x18, pixel | 0x00000000); + /* GEWD*/ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST*/ + SetReg2DAGP(0x0C, (offsetX | ((b->y1 - vmesa->drawYSaam) << 16))); + /* GEDSTBASE*/ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH*/ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT*/ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + } + b++; + } + + viaFlushPrimsLocked(vmesa); +} + +void viaFillFrontPBuffer(viaContextPtr vmesa) +{ + GLuint nDestBase, nDestPitch, nDestWidth, nDestHeight, offsetX, offset; + GLuint *vb = viaCheckDma(vmesa, vmesa->sarea->nbox*48); + GLuint pixel = (GLuint)vmesa->ClearColor; + + offset = vmesa->front.offset; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Fill PFront offset = %08x\n", offset); +#endif + nDestBase = offset; + nDestPitch = vmesa->front.pitch; + + nDestWidth = vmesa->driDrawable->w - 1; + nDestHeight = vmesa->driDrawable->h - 1; + + offsetX = 0; + + /* GEFGCOLOR*/ + SetReg2DAGP(0x18, pixel | 0x00000000); + /* GEWD*/ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST*/ + SetReg2DAGP(0x0C, (offsetX | (0 << 16))); + /* GEDSTBASE*/ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH*/ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT*/ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + + viaFlushPrimsLocked(vmesa); +} + +void viaFillBackBuffer(viaContextPtr vmesa) +{ + GLuint nDestBase, nDestPitch, nDestWidth, nDestHeight, offsetX, offset; + GLcontext *ctx = vmesa->glCtx; + GLuint *vb = viaCheckDma(vmesa, 48); + GLuint pixel = (GLuint)vmesa->ClearColor; + GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; + + offset = vmesa->back.offset; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Fill Back offset = %08x\n", offset); +#endif + nDestBase = offset; + nDestPitch = vmesa->back.pitch; + offsetX = vmesa->drawXoff; + + { + + if (!ctx->Scissor.Enabled) { + + nDestWidth = (vmesa->back.pitch / vmesa->viaScreen->bitsPerPixel * 8) - 1; + nDestHeight = vmesa->driDrawable->h -1; + + /* GEFGCOLOR */ + SetReg2DAGP(0x18, pixel | 0x00000000); + /* GEWD */ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, (offsetX | (0 << 16))); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + } + else { + int i; + drm_clip_rect_t *b = vmesa->sarea->boxes; + for (i = 0; i < vmesa->sarea->nbox ; i++) { + nDestWidth = b->x2 - b->x1 - 1; + nDestHeight = b->y2 - b->y1 - 1; + + if (bytePerPixel == 4) + offsetX = (b->x1 - vmesa->drawX) + (vmesa->drawX & 7); + else + offsetX = (b->x1 - vmesa->drawX) + (vmesa->drawX & 15); + + /* GEFGCOLOR */ + SetReg2DAGP(0x18, pixel | 0x00000000); + /* GEWD */ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, ((offsetX + (b->x1 - vmesa->drawX)) | ((b->y1 - vmesa->drawY) << 16))); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + b++; + } + } +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr," width = %08x\n", nDestWidth); + fprintf(stderr," height = %08x\n", nDestHeight); + } +#endif + } +} + +void viaFillStencilDepthBuffer(viaContextPtr vmesa, GLuint pixel) +{ + GLuint nDestBase, nDestPitch, nDestWidth, nDestHeight, offsetX, offset; + GLuint *vb = viaCheckDma(vmesa, 80); + GLuint nMask; + + offset = vmesa->depth.offset; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Fill Stencil Depth offset = %08x\n", offset); +#endif + nDestBase = offset; + nDestPitch = vmesa->depth.pitch; + offsetX = vmesa->drawXoff; + pixel = pixel & 0xffffff00; + nMask = 0x10000000; + + { + nDestWidth = (vmesa->depth.pitch / vmesa->depthBits * 8) - 1 - offsetX; + nDestHeight = vmesa->driDrawable->h -1; + + if (vmesa->viaScreen->bitsPerPixel == vmesa->depth.bpp) { + /* GEFGCOLOR */ + SetReg2DAGP(0x18, pixel); + /* GEMASK */ + SetReg2DAGP(0x2C, nMask); + /* GEWD */ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, (offsetX | (0 << 16))); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + /* GEMASK */ + SetReg2DAGP(0x2C, 0x00000000); + } + else { + GLuint EngStatus = *(vmesa->pnGEMode); + /* GEMODE */ + SetReg2DAGP(0x04, (EngStatus & 0xFFFFFCFF) | 0x300); + /* GEFGCOLOR */ + SetReg2DAGP(0x18, pixel); + /* GEMASK */ + SetReg2DAGP(0x2C, nMask); + /* GEWD */ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, (offsetX | (0 << 16))); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + /* GEMODE */ + SetReg2DAGP(0x04, EngStatus); + /* GEMASK */ + SetReg2DAGP(0x2C, 0x00000000); + + WAIT_IDLE + } + } + + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { + viaFlushPrimsLocked(vmesa); + } +} + +void viaFillStencilBuffer(viaContextPtr vmesa, GLuint pixel) +{ + GLuint nDestBase, nDestPitch, nDestWidth, nDestHeight, offsetX, offset; + GLuint *vb = viaCheckDma(vmesa, 80); + GLuint nMask; + + offset = vmesa->depth.offset; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Fill Stencil offset = %08x\n", offset); +#endif + nDestBase = offset; + nDestPitch = vmesa->depth.pitch; + offsetX = vmesa->drawXoff; + pixel = pixel & 0x000000ff; + nMask = 0xe0000000; + + { + nDestWidth = (vmesa->depth.pitch / vmesa->depthBits * 8) - 1 - offsetX; + nDestHeight = vmesa->driDrawable->h -1; + + if (vmesa->viaScreen->bitsPerPixel == vmesa->depth.bpp) { + /* GEFGCOLOR */ + SetReg2DAGP(0x18, pixel); + /* GEMASK */ + SetReg2DAGP(0x2C, nMask); + /* GEWD */ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, (offsetX | (0 << 16))); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + /* GEMASK */ + SetReg2DAGP(0x2C, 0x00000000); + } + else { + GLuint EngStatus = *(vmesa->pnGEMode); + /* GEMODE */ + SetReg2DAGP(0x04, (EngStatus & 0xFFFFFCFF) | 0x300); + /* GEFGCOLOR */ + SetReg2DAGP(0x18, pixel); + /* GEMASK */ + SetReg2DAGP(0x2C, nMask); + /* GEWD */ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, (offsetX | (0 << 16))); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + /* GEMODE */ + SetReg2DAGP(0x04, EngStatus); + /* GEMASK */ + SetReg2DAGP(0x2C, 0x00000000); + } + } + + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { + viaFlushPrimsLocked(vmesa); + } +} + +void viaFillDepthBuffer(viaContextPtr vmesa, GLuint pixel) +{ + GLuint nDestBase, nDestPitch, nDestWidth, nDestHeight, offsetX, offset; + GLuint *vb = viaCheckDma(vmesa, 72); + offset = vmesa->depth.offset; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Fill Depth offset = %08x\n", offset); +#endif + nDestBase = offset; + nDestPitch = vmesa->depth.pitch; + offsetX = vmesa->drawXoff; + + { + nDestWidth = (vmesa->depth.pitch / vmesa->depthBits * 8) - 1 - offsetX; + nDestHeight = vmesa->driDrawable->h -1; + + if (vmesa->viaScreen->bitsPerPixel == vmesa->depth.bpp) { + /* GEFGCOLOR */ + SetReg2DAGP(0x18, pixel); + /* GEMASK */ + SetReg2DAGP(0x2C, 0x0); + /* GEWD */ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, (offsetX | (0 << 16))); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + } + /* depth = 16, color = 32 */ + else if (vmesa->depth.bpp == 16) { + GLuint EngStatus = *(vmesa->pnGEMode); + + /* GEMODE */ + SetReg2DAGP(0x04, (EngStatus & 0xFFFFFCFF) | 0x100); + /* GEMASK */ + SetReg2DAGP(0x2C, 0x0); + /* GEFGCOLOR */ + SetReg2DAGP(0x18, pixel); + /* GEWD */ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, (offsetX | (0 << 16))); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + /* GEMODE */ + SetReg2DAGP(0x04, EngStatus); + } + /* depth = 32, color = 16 */ + else { + GLuint EngStatus = *(vmesa->pnGEMode); + + /* GEMODE */ + SetReg2DAGP(0x04, (EngStatus & 0xFFFFFCFF) | 0x300); + /* GEMASK */ + SetReg2DAGP(0x2C, 0x0); + /* GEFGCOLOR */ + SetReg2DAGP(0x18, pixel); + /* GEWD */ + SetReg2DAGP(0x10, nDestWidth | (nDestHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, (offsetX | (0 << 16))); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nDestBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nDestPitch >> 3) << 16) & 0x7FF0000) | 0x80000000); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xF0000000); + /* GEMODE */ + SetReg2DAGP(0x04, EngStatus); + } + } + + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { + viaFlushPrimsLocked(vmesa); + } +} + +void viaDoSwapBuffers(viaContextPtr vmesa) +{ + GLuint *vb = viaCheckDma(vmesa, vmesa->sarea->nbox*56); + GLuint nFrontPitch; + GLuint nBackPitch; + GLuint nFrontWidth, nFrontHeight, nBackWidth, nBackHeight; + GLuint nFrontBase, nBackBase; + GLuint nFrontOffsetX, nFrontOffsetY, nBackOffsetX, nBackOffsetY; + drm_clip_rect_t *b = vmesa->sarea->boxes; + GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; + GLuint i; + + nFrontPitch = vmesa->front.pitch; + nBackPitch = vmesa->back.pitch; + + /* Caculate Base */ + nFrontBase = vmesa->viaScreen->fbOffset + (vmesa->drawY * nFrontPitch + vmesa->drawX * bytePerPixel); + nBackBase = vmesa->back.offset; + /* 128 bit alignment*/ + nFrontBase = nFrontBase & 0xffffffe0; + + /*=* [DBG] make draw to front buffer *=*/ + if(DRAW_FRONT) + return; + + for (i = 0; i < vmesa->sarea->nbox; i++) { + /* Width, Height */ + nFrontWidth = nBackWidth = b->x2 - b->x1 - 1; + nFrontHeight = nBackHeight = b->y2 - b->y1 - 1; + /* Offset */ + nFrontOffsetX = (b->x1 - vmesa->drawX) + vmesa->drawXoff; + nFrontOffsetY = b->y1 - vmesa->drawY; + + nBackOffsetX = nFrontOffsetX; + nBackOffsetY = nFrontOffsetY; + /* GEWD */ + SetReg2DAGP(0x10, nFrontWidth | (nFrontHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, nFrontOffsetX | (nFrontOffsetY << 16)); + /* GESRC */ + SetReg2DAGP(0x08, nBackOffsetX | (nBackOffsetY << 16)); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nFrontBase >> 3)); + /* GESCRBASE */ + SetReg2DAGP(0x30, (nBackBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nFrontPitch >> 3) << 16) & 0x7FF0000) | 0x80000000 | + ((nBackPitch >> 3) & 0x7FF)); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0xCC000000); + b++; + } + + viaFlushPrimsLocked(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Do Swap Buffer\n"); +#endif +} + +void viaDoSwapBuffersSaam(viaContextPtr vmesa) +{ + GLuint *vb = viaCheckDma(vmesa, vmesa->sarea->nbox*56); + GLuint nFrontPitch; + GLuint nBackPitch; + GLuint nFrontWidth, nFrontHeight, nBackWidth, nBackHeight; + GLuint nFrontBase, nBackBase; + GLuint nFrontOffsetX, nFrontOffsetY, nBackOffsetX, nBackOffsetY; + drm_clip_rect_t *b = vmesa->sarea->boxes; + GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; + GLuint i; + + nFrontPitch = vmesa->front.pitch; + nBackPitch = vmesa->back.pitch; + + /* Caculate Base */ + nFrontBase = vmesa->viaScreen->fbSize + (vmesa->drawYSaam * nFrontPitch + vmesa->drawXSaam * bytePerPixel); + nBackBase = vmesa->back.offset; + /* 128 bit alignment*/ + nFrontBase = nFrontBase & 0xffffffe0; + + /*=* [DBG] make draw to front buffer *=*/ + if(DRAW_FRONT) + return; + + for (i = 0; i < vmesa->sarea->nbox; i++) { + /* Width, Height */ + nFrontWidth = nBackWidth = b->x2 - b->x1 - 1; + nFrontHeight = nBackHeight = b->y2 - b->y1 - 1; + /* Offset */ + nFrontOffsetX = (b->x1 - vmesa->drawXSaam) + vmesa->drawXoff; + nFrontOffsetY = b->y1 - vmesa->drawYSaam; + + nBackOffsetX = nFrontOffsetX; + nBackOffsetY = nFrontOffsetY; + /* GEWD */ + SetReg2DAGP(0x10, nFrontWidth | (nFrontHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, nFrontOffsetX | (nFrontOffsetY << 16)); + /* GESRC */ + SetReg2DAGP(0x08, nBackOffsetX | (nBackOffsetY << 16)); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nFrontBase >> 3)); + /* GESCRBASE */ + SetReg2DAGP(0x30, (nBackBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nFrontPitch >> 3) << 16) & 0x7FF0000) | 0x80000000 | + ((nBackPitch >> 3) & 0x7FF)); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0xCC000000); + b++; + } + + viaFlushPrimsLocked(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Do Swap Buffer\n"); +#endif +} + +void viaDoSwapPBuffers(viaContextPtr vmesa) +{ + GLuint *vb = viaCheckDma(vmesa, vmesa->sarea->nbox*56); + GLuint nFrontPitch; + GLuint nBackPitch; + GLuint nFrontWidth, nFrontHeight; + GLuint nFrontBase, nBackBase; + GLuint nFrontOffsetX, nFrontOffsetY, nBackOffsetX, nBackOffsetY; + GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; + + nFrontPitch = vmesa->front.pitch; + nBackPitch = vmesa->back.pitch; + + /* Caculate Base */ + nFrontBase = vmesa->front.offset; + nBackBase = vmesa->back.offset; + + /* Width, Height */ + nFrontWidth = nFrontPitch / bytePerPixel; + nFrontHeight = nBackPitch / bytePerPixel; + + /* Offset */ + nFrontOffsetX = 0; + nFrontOffsetY = 0; + nBackOffsetX = nFrontOffsetX; + nBackOffsetY = nFrontOffsetY; + /* GEWD */ + SetReg2DAGP(0x10, nFrontWidth | (nFrontHeight << 16)); + /* GEDST */ + SetReg2DAGP(0x0C, nFrontOffsetX | (nFrontOffsetY << 16)); + /* GESRC */ + SetReg2DAGP(0x08, nBackOffsetX | (nBackOffsetY << 16)); + /* GEDSTBASE */ + SetReg2DAGP(0x34, (nFrontBase >> 3)); + /* GESCRBASE */ + SetReg2DAGP(0x30, (nBackBase >> 3)); + /* GEPITCH */ + SetReg2DAGP(0x38, (((nFrontPitch >> 3) << 16) & 0x7FF0000) | 0x80000000 | + ((nBackPitch >> 3) & 0x7FF)); + /* BITBLT */ + SetReg2DAGP(0x0, 0x1 | 0xCC000000); + + viaFlushPrimsLocked(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Do Swap PBuffer\n"); +#endif +} + +void viaDoSwapBufferSoft(viaContextPtr vmesa) +{ + GLuint nFrontPitch; + GLuint nBackPitch; + GLuint nFrontBase, nBackBase; + GLuint i, j; + GLubyte *by, *fy; + GLuint w; + + w = vmesa->viaScreen->width; + w = BUFFER_ALIGN_WIDTH(w, BUFFER_ALIGNMENT); + + if (vmesa->viaScreen->bitsPerPixel == 0x20) + nFrontPitch = w << 2; + else + nFrontPitch = w << 1; + + nBackPitch = vmesa->back.pitch; + + /* Caculate Base */ + nFrontBase = (GLuint) vmesa->driScreen->pFB; + nBackBase = ((GLuint) vmesa->back.offset) + ((GLuint) vmesa->driScreen->pFB); + by = (GLubyte *) nBackBase; + fy = (GLubyte *) nFrontBase; + + viaFlushPrimsLocked(vmesa); + + for (i = 0; i < vmesa->driDrawable->h; i++) { + fy = (GLubyte *)(nFrontBase + i * nFrontPitch); + for (j = 0; j < nBackPitch; j++) { + *((GLubyte*)fy) = *((GLubyte*)by); + fy = fy + 1; + by = by + 1; + } + + } + +} + +void viaDoSwapBufferSoftFront(viaContextPtr vmesa) +{ + GLuint nFrontPitch; + GLuint nBackPitch; + GLuint nFrontBase, nBackBase; + GLuint i, j; + GLubyte *by, *fy; + GLuint w; + + w = vmesa->viaScreen->width; + w = BUFFER_ALIGN_WIDTH(w, BUFFER_ALIGNMENT); + + if (vmesa->viaScreen->bitsPerPixel == 0x20) + nFrontPitch = w << 2; + else + nFrontPitch = w << 1; + + nBackPitch = vmesa->front.pitch; + + /* Caculate Base */ + nFrontBase = (GLuint) vmesa->driScreen->pFB; + nBackBase = ((GLuint) vmesa->front.offset) + ((GLuint) vmesa->driScreen->pFB); + by = (GLubyte *) nBackBase; + fy = (GLubyte *) nFrontBase; + + viaFlushPrimsLocked(vmesa); + + for (i = 0; i < vmesa->driDrawable->h; i++) { + fy = (GLubyte *)(nFrontBase + i * nFrontPitch); + for (j = 0; j < nBackPitch; j++) { + *((GLubyte*)fy) = *((GLubyte*)by); + fy = fy + 1; + by = by + 1; + } + + } + +} +int flush_agp(viaContextPtr vmesa, drm_via_flush_agp_t* agpCmd) +{ + GLuint *pnAGPCurrentPhysStart; + GLuint *pnAGPCurrentPhysEnd; + GLuint *pnAGPCurrentStart; + GLuint *pnAGPCurrentEnd; + GLuint *pnMMIOBase; + GLuint *pnEngBaseTranSet; + GLuint *pnEngBaseTranSpace; + GLuint *agpBase; + GLuint ofs = vmesa->dma[vmesa->dmaIndex].offset; + GLuint *vb = (GLuint *)vmesa->dmaAddr; + GLuint i = 0; + + pnMMIOBase = vmesa->regMMIOBase; + pnEngBaseTranSet = vmesa->regTranSet; + pnEngBaseTranSpace = vmesa->regTranSpace; + *pnEngBaseTranSet = (0x0010 << 16); + agpBase = vmesa->agpBase; + + if (!agpCmd->size) { + return -1; + } + + { + GLuint *pnEngBase = vmesa->regEngineStatus; + int nStatus; + + while (1) { + nStatus = *pnEngBase; + if ((nStatus & 0xFFFEFFFF) == 0x00020000) + break; + i++; + } + } + + pnAGPCurrentStart = (GLuint *)(ofs + agpCmd->offset); + pnAGPCurrentEnd = (GLuint *)((GLuint)pnAGPCurrentStart + vmesa->dmaHigh); + pnAGPCurrentPhysStart = (GLuint *)( (GLuint)pnAGPCurrentStart + (GLuint)agpBase ); + pnAGPCurrentPhysEnd = (GLuint *)( (GLuint)pnAGPCurrentEnd + (GLuint)agpBase ); + + /*=* [DBG] make draw to front buffer *=*/ + if(DRAW_FRONT) + vmesa->glCtx->Color.DriverDrawBuffer = GL_FRONT_LEFT; + + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + if (vmesa->driDrawable->w == 0 || vmesa->driDrawable->h == 0) { + *vb++ = (HC_SubA_HClipTB << 24) | 0x0; + *vb++ = (HC_SubA_HClipLR << 24) | 0x0; + } + else { + *vb++ = ((HC_SubA_HClipTB << 24) | (0x0 << 12) | vmesa->driDrawable->h); + *vb++ = ((HC_SubA_HClipLR << 24) | (vmesa->drawXoff << 12) | (vmesa->driDrawable->w + vmesa->drawXoff)); + } + + { + GLuint pitch, format, offset; + + if (vmesa->viaScreen->bitsPerPixel == 0x20) { + format = HC_HDBFM_ARGB8888; + } + else if (vmesa->viaScreen->bitsPerPixel == 0x10) { + format = HC_HDBFM_RGB565; + } + else + { + return -1; + } + + offset = vmesa->back.offset; + pitch = vmesa->back.pitch; + + *vb++ = ((HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF)); + *vb++ = ((HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000)) >> 24); + *vb++ = ((HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch); + *vb++ = 0xcccccccc; + } + + *pnEngBaseTranSpace = (HC_SubA_HAGPBstL << 24) | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFFFFFF); + *pnEngBaseTranSpace = (HC_SubA_HAGPBendL << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFFFFFF); + *pnEngBaseTranSpace = (HC_SubA_HAGPCMNT << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFF000000) >> 16 | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFF000000) >> 24; + *pnEngBaseTranSpace = (HC_SubA_HAGPBpH << 24) | + ((GLuint)((GLbyte *)pnAGPCurrentPhysStart + agpCmd->size - 4) & 0xFF000000) >> 24; + *pnEngBaseTranSpace = (HC_SubA_HAGPBpL << 24) | + ((GLuint)((GLbyte *)pnAGPCurrentPhysStart + agpCmd->size - 4) & 0xFFFFFF) | + HC_HAGPBpID_STOP; + *pnEngBaseTranSpace = (HC_SubA_HAGPCMNT << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFF000000) >> 16 | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFF000000) >> 24 | + HC_HAGPCMNT_MASK; + } + else { + GLuint *head; + GLuint clipL, clipR, clipT, clipB; + drm_clip_rect_t *b = vmesa->sarea->boxes; + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + head = vb; + + *pnEngBaseTranSpace = (HC_SubA_HAGPBstL << 24) | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFFFFFF); + *pnEngBaseTranSpace = (HC_SubA_HAGPBendL << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFFFFFF); + *pnEngBaseTranSpace = (HC_SubA_HAGPCMNT << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFF000000) >> 16 | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFF000000) >> 24; + *pnEngBaseTranSpace = (HC_SubA_HAGPBpH << 24) | + ((GLuint)((GLbyte *)pnAGPCurrentPhysStart + agpCmd->size - 4) & 0xFF000000) >> 24; + *pnEngBaseTranSpace = (HC_SubA_HAGPBpL << 24) | + ((GLuint)((GLbyte *)pnAGPCurrentPhysStart + agpCmd->size - 4) & 0xFFFFFF) | + HC_HAGPBpID_STOP; + + for (i = 0; i < vmesa->sarea->nbox; i++) { + if (1) { + GLuint *pnEngBase = vmesa->regEngineStatus; + int nStatus; + + while (1) { + nStatus = *pnEngBase; + if ((nStatus & 0xFFFEFFFF) == 0x00020000) + break; + } + } + + clipL = b->x1 + vmesa->drawXoff; + clipR = b->x2; + clipT = b->y1; + clipB = b->y2; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "clip = %d\n", i); +#endif + if (vmesa->driDrawable->w == 0 || vmesa->driDrawable->h == 0) { + + *vb = (HC_SubA_HClipTB << 24) | 0x0; + vb++; + + *vb = (HC_SubA_HClipLR << 24) | 0x0; + vb++; + } + else { + *vb = (HC_SubA_HClipTB << 24) | (clipT << 12) | clipB; + vb++; + + *vb = (HC_SubA_HClipLR << 24) | (clipL << 12) | clipR; + vb++; + } + + { + GLuint pitch, format, offset; + GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; + + if (vmesa->viaScreen->bitsPerPixel == 0x20) { + format = HC_HDBFM_ARGB8888; + } + else if (vmesa->viaScreen->bitsPerPixel == 0x10) { + format = HC_HDBFM_RGB565; + } + else + return -1; + + pitch = vmesa->front.pitch; + offset = vmesa->viaScreen->fbOffset + (vmesa->drawY * pitch + vmesa->drawX * bytePerPixel); + offset = offset & 0xffffffe0; + + *vb++ = ((HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF)); + *vb++ = ((HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000)) >> 24); + *vb++ = ((HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch); + *vb++ = 0xcccccccc; + } + *pnEngBaseTranSpace = (HC_SubA_HAGPCMNT << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFF000000) >> 16 | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFF000000) >> 24 | + HC_HAGPCMNT_MASK; +#ifdef DEBUG + if (VIA_DEBUG) { + GLuint i; + GLuint *data = (GLuint *)vmesa->dmaAddr; + for (i = 0; i < vmesa->dmaLow; i += 16) { + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x\n", *data++); + } + fprintf(stderr, "******************************************\n"); + } +#endif + b++; + vb = head; + } + } + +#ifdef DEBUG + if (VIA_DEBUG) { + GLuint *pnEngBase = (GLuint *)((GLuint)pnMMIOBase + 0x400); + int nStatus; + int i = 0; + + while (1) { + nStatus = *pnEngBase; + if ((nStatus & 0xFFFEFFFF) == 0x00020000) { + break; + } + else { + GLuint j; + GLuint *data; + /* dump current command buffer */ + data = (GLuint *)vmesa->dmaAddr; + + if (i == 500000) { + fprintf(stderr, "current command buffer"); + fprintf(stderr, "i = %d\n", i); + for (j = 0; j < vmesa->dmaLow; j += 16) { + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x\n", *data++); + } + } + /* dump previous command buffer */ + if (vmesa->dmaIndex) { + data = (GLuint *)vmesa->dma[0].map; + } + else { + data = (GLuint *)vmesa->dma[1].map; + } + if (i == 500000) { + fprintf(stderr, "previous command buffer"); + fprintf(stderr, "i = %d\n", i); + for (j = 0; j < dmaLow; j += 16) { + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x\n", *data++); + } + } + } + i++; + } + } +#endif + dmaLow = vmesa->dmaLow; + return 0; +} + +int flush_agp_saam(viaContextPtr vmesa, drm_via_flush_agp_t* agpCmd) +{ + GLuint *pnAGPCurrentPhysStart; + GLuint *pnAGPCurrentPhysEnd; + GLuint *pnAGPCurrentStart; + GLuint *pnAGPCurrentEnd; + GLuint *pnMMIOBase; + GLuint *pnEngBaseTranSet; + GLuint *pnEngBaseTranSpace; + GLuint *agpBase; + GLuint ofs = vmesa->dma[vmesa->dmaIndex].offset; + GLuint *vb = (GLuint *)vmesa->dmaAddr; + GLuint i = 0; + + pnMMIOBase = vmesa->regMMIOBase; + pnEngBaseTranSet = vmesa->regTranSet; + pnEngBaseTranSpace = vmesa->regTranSpace; + *pnEngBaseTranSet = (0x0010 << 16); + agpBase = vmesa->agpBase; + + if (!agpCmd->size) { + return -1; + } + + { + GLuint *pnEngBase = vmesa->regEngineStatus; + int nStatus; + + while (1) { + nStatus = *pnEngBase; + if ((nStatus & 0xFFFEFFFF) == 0x00020000) + break; + i++; + } + } + + pnAGPCurrentStart = (GLuint *)(ofs + agpCmd->offset); + pnAGPCurrentEnd = (GLuint *)((GLuint)pnAGPCurrentStart + vmesa->dmaHigh); + pnAGPCurrentPhysStart = (GLuint *)( (GLuint)pnAGPCurrentStart + (GLuint)agpBase ); + pnAGPCurrentPhysEnd = (GLuint *)( (GLuint)pnAGPCurrentEnd + (GLuint)agpBase ); + + /*=* [DBG] make draw to front buffer *=*/ + if(DRAW_FRONT) + vmesa->glCtx->Color.DriverDrawBuffer = GL_FRONT_LEFT; + + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + if (vmesa->driDrawable->w == 0 || vmesa->driDrawable->h == 0) { + *vb++ = (HC_SubA_HClipTB << 24) | 0x0; + *vb++ = (HC_SubA_HClipLR << 24) | 0x0; + } + else { + *vb++ = ((HC_SubA_HClipTB << 24) | (0x0 << 12) | vmesa->driDrawable->h); + *vb++ = ((HC_SubA_HClipLR << 24) | (vmesa->drawXoff << 12) | (vmesa->driDrawable->w + vmesa->drawXoff)); + } + + { + GLuint pitch, format, offset; + + if (vmesa->viaScreen->bitsPerPixel == 0x20) { + format = HC_HDBFM_ARGB8888; + } + else if (vmesa->viaScreen->bitsPerPixel == 0x10) { + format = HC_HDBFM_RGB565; + } + else + return -1; + + offset = vmesa->back.offset; + pitch = vmesa->back.pitch; + + *vb++ = ((HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF)); + *vb++ = ((HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000)) >> 24); + *vb++ = ((HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch); + *vb++ = 0xcccccccc; + } + + *pnEngBaseTranSpace = (HC_SubA_HAGPBstL << 24) | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFFFFFF); + *pnEngBaseTranSpace = (HC_SubA_HAGPBendL << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFFFFFF); + *pnEngBaseTranSpace = (HC_SubA_HAGPCMNT << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFF000000) >> 16 | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFF000000) >> 24; + *pnEngBaseTranSpace = (HC_SubA_HAGPBpH << 24) | + ((GLuint)((GLbyte *)pnAGPCurrentPhysStart + agpCmd->size - 4) & 0xFF000000) >> 24; + *pnEngBaseTranSpace = (HC_SubA_HAGPBpL << 24) | + ((GLuint)((GLbyte *)pnAGPCurrentPhysStart + agpCmd->size - 4) & 0xFFFFFF) | + HC_HAGPBpID_STOP; + *pnEngBaseTranSpace = (HC_SubA_HAGPCMNT << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFF000000) >> 16 | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFF000000) >> 24 | + HC_HAGPCMNT_MASK; + } + else { + GLuint *head; + GLuint clipL, clipR, clipT, clipB; + drm_clip_rect_t *b = vmesa->sarea->boxes; + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + head = vb; + + *pnEngBaseTranSpace = (HC_SubA_HAGPBstL << 24) | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFFFFFF); + *pnEngBaseTranSpace = (HC_SubA_HAGPBendL << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFFFFFF); + *pnEngBaseTranSpace = (HC_SubA_HAGPCMNT << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFF000000) >> 16 | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFF000000) >> 24; + *pnEngBaseTranSpace = (HC_SubA_HAGPBpH << 24) | + ((GLuint)((GLbyte *)pnAGPCurrentPhysStart + agpCmd->size - 4) & 0xFF000000) >> 24; + *pnEngBaseTranSpace = (HC_SubA_HAGPBpL << 24) | + ((GLuint)((GLbyte *)pnAGPCurrentPhysStart + agpCmd->size - 4) & 0xFFFFFF) | + HC_HAGPBpID_STOP; + + for (i = 0; i < vmesa->sarea->nbox; i++) { + if (1) { + GLuint *pnEngBase = vmesa->regEngineStatus; + int nStatus; + + while (1) { + nStatus = *pnEngBase; + if ((nStatus & 0xFFFEFFFF) == 0x00020000) + break; + } + } + + clipL = b->x1 + vmesa->drawXoff; + clipR = b->x2; + clipT = b->y1; + clipB = b->y2; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "clip = %d\n", i); +#endif + if (vmesa->driDrawable->w == 0 || vmesa->driDrawable->h == 0) { + + *vb = (HC_SubA_HClipTB << 24) | 0x0; + vb++; + + *vb = (HC_SubA_HClipLR << 24) | 0x0; + vb++; + } + else { + *vb = (HC_SubA_HClipTB << 24) | (clipT << 12) | clipB; + vb++; + + *vb = (HC_SubA_HClipLR << 24) | (clipL << 12) | clipR; + vb++; + } + + { + GLuint pitch, format, offset; + GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; + + if (vmesa->viaScreen->bitsPerPixel == 0x20) { + format = HC_HDBFM_ARGB8888; + } + else if (vmesa->viaScreen->bitsPerPixel == 0x10) { + format = HC_HDBFM_RGB565; + } + else + return -1; + + pitch = vmesa->front.pitch; + offset = vmesa->viaScreen->fbOffset + (vmesa->drawY * pitch + vmesa->drawX * bytePerPixel); + offset = offset & 0xffffffe0; + + *vb++ = ((HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF)); + *vb++ = ((HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000)) >> 24); + *vb++ = ((HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch); + *vb++ = 0xcccccccc; + } + *pnEngBaseTranSpace = (HC_SubA_HAGPCMNT << 24) | + ((GLuint)(pnAGPCurrentPhysEnd) & 0xFF000000) >> 16 | + ((GLuint)(pnAGPCurrentPhysStart) & 0xFF000000) >> 24 | + HC_HAGPCMNT_MASK; +#ifdef DEBUG + if (VIA_DEBUG) { + GLuint i; + GLuint *data = (GLuint *)vmesa->dmaAddr; + for (i = 0; i < vmesa->dmaLow; i += 16) { + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x\n", *data++); + } + fprintf(stderr, "******************************************\n"); + } +#endif + b++; + vb = head; + } + } + +#ifdef DEBUG + if (VIA_DEBUG) { + GLuint *pnEngBase = (GLuint *)((GLuint)pnMMIOBase + 0x400); + int nStatus; + int i = 0; + + while (1) { + nStatus = *pnEngBase; + if ((nStatus & 0xFFFEFFFF) == 0x00020000) { + break; + } + else { + GLuint j; + GLuint *data; + /* dump current command buffer */ + data = (GLuint *)vmesa->dmaAddr; + + if (i == 500000) { + fprintf(stderr, "current command buffer"); + fprintf(stderr, "i = %d\n", i); + for (j = 0; j < vmesa->dmaLow; j += 16) { + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x\n", *data++); + } + } + /* dump previous command buffer */ + if (vmesa->dmaIndex) { + data = (GLuint *)vmesa->dma[0].map; + } + else { + data = (GLuint *)vmesa->dma[1].map; + } + if (i == 500000) { + fprintf(stderr, "previous command buffer"); + fprintf(stderr, "i = %d\n", i); + for (j = 0; j < dmaLow; j += 16) { + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x\n", *data++); + } + } + } + i++; + } + } +#endif + dmaLow = vmesa->dmaLow; + return 0; +} + +int flush_sys(viaContextPtr vmesa, drm_via_flush_sys_t* buf) + +{ + GLuint *pnBuf; + GLuint *pnEnd; + GLuint *pnMMIOBase; + GLuint *pnEngBaseTranSet; + GLuint *pnEngBaseTranSpace; + GLuint uCheck2DCmd = GL_TRUE; + GLuint addr; + GLuint *vb = (GLuint *)vmesa->dmaAddr; + GLuint i = 0; + + pnMMIOBase = vmesa->regMMIOBase; + pnEngBaseTranSet = vmesa->regTranSet; + pnEngBaseTranSpace = vmesa->regTranSpace; + + pnBuf = (GLuint *)(buf->index + buf->offset); + pnEnd = (GLuint *)((GLuint)pnBuf + buf->size); + + /*=* [DBG] make draw to front buffer *=*/ + if(DRAW_FRONT) + vmesa->glCtx->Color.DriverDrawBuffer = GL_FRONT_LEFT; + + + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + + if (vmesa->driDrawable->w == 0 || vmesa->driDrawable->h == 0) { + *vb++ = (HC_SubA_HClipTB << 24) | 0x0; + *vb++ = (HC_SubA_HClipLR << 24) | 0x0; + } + else { + *vb++ = ((HC_SubA_HClipTB << 24) | (0x0 << 12) | vmesa->driDrawable->h); + *vb++ = ((HC_SubA_HClipLR << 24) | (vmesa->drawXoff << 12) | (vmesa->driDrawable->w + vmesa->drawXoff)); + } + + /*=* John Sheng [2003.6.16] fix pci path *=*/ + { + GLuint pitch, format, offset; + + if (vmesa->viaScreen->bitsPerPixel == 0x20) { + format = HC_HDBFM_ARGB8888; + } + else if (vmesa->viaScreen->bitsPerPixel == 0x10) { + format = HC_HDBFM_RGB565; + } + else + return -1; + + offset = vmesa->back.offset; + pitch = vmesa->back.pitch; + + *vb++ = ((HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF)); + *vb++ = ((HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000)) >> 24); + *vb++ = ((HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch); + *vb++ = 0xcccccccc; + } + + while (pnBuf != pnEnd) { + if (*pnBuf == HALCYON_HEADER2) { + pnBuf++; + if (*pnBuf == HALCYON_SUB_ADDR0) { + *pnEngBaseTranSet = *pnBuf; + pnBuf++; + uCheck2DCmd = GL_FALSE; + } + else { + *pnEngBaseTranSet = *pnBuf; + pnBuf++; + uCheck2DCmd = GL_TRUE; + } + } + else if (uCheck2DCmd && ((*pnBuf&HALCYON_HEADER1MASK)==HALCYON_HEADER1)) { + addr = ((*pnBuf)&0x0000001f) << 2; + pnBuf++; + *((GLuint*)((GLuint)pnMMIOBase+addr)) = *pnBuf; + pnBuf++; + } + else if ((*pnBuf&HALCYON_FIREMASK) == HALCYON_FIRECMD) { + *pnEngBaseTranSpace = *pnBuf; + pnBuf++; + if ((pnBuf!=pnEnd)&&((*pnBuf&HALCYON_FIREMASK)==HALCYON_FIRECMD)) + pnBuf++; + if ((*pnBuf&HALCYON_CMDBMASK) != HC_ACMD_HCmdB) + uCheck2DCmd = GL_TRUE; + } + else { + *pnEngBaseTranSpace = *pnBuf; + pnBuf++; + } + } + } + else { + GLuint *head; + GLuint clipL, clipR, clipT, clipB; + drm_clip_rect_t *b = vmesa->sarea->boxes; + GLuint *pnTmp; + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + + head = vb; + pnTmp = pnBuf; + + for (i = 0; i < vmesa->sarea->nbox; i++) { + clipL = b->x1 + vmesa->drawXoff; + clipR = b->x2 + vmesa->drawXoff; + clipT = b->y1; + clipB = b->y2; + + if (vmesa->driDrawable->w == 0 || vmesa->driDrawable->h == 0) { + *vb = (HC_SubA_HClipTB << 24) | 0x0; + vb++; + *vb = (HC_SubA_HClipLR << 24) | 0x0; + vb++; + } + else { + *vb = (HC_SubA_HClipTB << 24) | (clipT << 12) | clipB; + vb++; + *vb = (HC_SubA_HClipLR << 24) | (clipL << 12) | clipR; + vb++; + } + + /*=* John Sheng [2003.6.16] fix pci path *=*/ + { + GLuint pitch, format, offset; + GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; + + if (vmesa->viaScreen->bitsPerPixel == 0x20) { + format = HC_HDBFM_ARGB8888; + } + else if (vmesa->viaScreen->bitsPerPixel == 0x10) { + format = HC_HDBFM_RGB565; + } + else + return -1; + + pitch = vmesa->front.pitch; + offset = vmesa->viaScreen->fbOffset + (vmesa->drawY * pitch + vmesa->drawX * bytePerPixel); + offset = offset & 0xffffffe0; + + *vb++ = ((HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF)); + *vb++ = ((HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000)) >> 24); + *vb++ = ((HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch); + *vb++ = 0xcccccccc; + } + + pnBuf = pnTmp; + + while (pnBuf != pnEnd) { + if (*pnBuf == HALCYON_HEADER2) { + pnBuf++; + if (*pnBuf == HALCYON_SUB_ADDR0) { + *pnEngBaseTranSet = *pnBuf; + pnBuf++; + uCheck2DCmd = GL_FALSE; + } + else { + *pnEngBaseTranSet = *pnBuf; + pnBuf++; + uCheck2DCmd = GL_TRUE; + } + } + else if (uCheck2DCmd && ((*pnBuf&HALCYON_HEADER1MASK)==HALCYON_HEADER1)) { + addr = ((*pnBuf)&0x0000001f) << 2; + pnBuf++; + *((GLuint*)((GLuint)pnMMIOBase+addr)) = *pnBuf; + pnBuf++; + } + else if ((*pnBuf&HALCYON_FIREMASK) == HALCYON_FIRECMD) { + *pnEngBaseTranSpace = *pnBuf; + pnBuf++; + if ((pnBuf!=pnEnd)&&((*pnBuf&HALCYON_FIREMASK)==HALCYON_FIRECMD)) + pnBuf++; + if ((*pnBuf&HALCYON_CMDBMASK) != HC_ACMD_HCmdB) + uCheck2DCmd = GL_TRUE; + } + else { + *pnEngBaseTranSpace = *pnBuf; + pnBuf++; + } + } + b++; + vb = head; + } + } + return 0; +} diff --git a/xc/lib/GL/mesa/src/drv/via/via_ioctl.h b/xc/lib/GL/mesa/src/drv/via/via_ioctl.h new file mode 100644 index 000000000..e9030e630 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_ioctl.h @@ -0,0 +1,88 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _VIAIOCTL_H +#define _VIAIOCTL_H + +#include "via_context.h" + + +void viaEmitPrim(viaContextPtr vmesa); +void viaFlushPrims(viaContextPtr vmesa); +void viaFlushPrimsLocked(viaContextPtr vmesa); + +void viaDmaFinish(viaContextPtr vmesa); +void viaRegetLockQuiescent(viaContextPtr vmesa); +void viaInitIoctlFuncs(GLcontext *ctx); +void viaCopyBuffer(const __DRIdrawablePrivate *dpriv); +void viaPageFlip(const __DRIdrawablePrivate *dpriv); +int via_check_copy(int fd); +void viaFillFrontBuffer(viaContextPtr vmesa); +void viaFillFrontBufferSaam(viaContextPtr vmesa); +void viaFillFrontPBuffer(viaContextPtr vmesa); +void viaFillBackBuffer(viaContextPtr vmesa); +void viaFillDepthBuffer(viaContextPtr vmesa, GLuint pixel); +void viaFillStencilBuffer(viaContextPtr vmesa, GLuint pixel); +void viaFillStencilDepthBuffer(viaContextPtr vmesa, GLuint pixel); +void viaDoSwapBuffers(viaContextPtr vmesa); +void viaDoSwapBuffersSaam(viaContextPtr vmesa); +void viaDoSwapBufferSoft(viaContextPtr vmesa); +void viaDoSwapBufferSoftFront(viaContextPtr vmesa); +void viaDoSwapPBuffers(viaContextPtr vmesa); + +int flush_agp(viaContextPtr vmesa, drm_via_flush_agp_t* agpCmd); +int flush_agp_saam(viaContextPtr vmesa, drm_via_flush_agp_t* agpCmd); +int flush_sys(viaContextPtr vmesa, drm_via_flush_sys_t* buf); + +#define VIA_STATECHANGE(vmesa, flag) \ + do { \ + if (vmesa->dmaLow != vmesa->dmaLastPrim) \ + viaFlushPrims(vmesa); \ + vmesa->dirty |= flag; \ + } while (0) \ + + +#define VIA_FIREVERTICES(vmesa) \ + do { \ + if (vmesa->dmaLow) { \ + viaFlushPrims(vmesa); \ + } \ + } while (0) + + +static __inline GLuint *viaCheckDma(viaContextPtr vmesa, int bytes) +{ + if (vmesa->dmaLow + bytes > vmesa->dmaHigh) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "buffer overflow in check dma = %d + %d = %d\n", vmesa->dmaLow, bytes, vmesa->dmaLow + bytes); +#endif + viaFlushPrims(vmesa); + } + + { + GLuint *start = (GLuint *)(vmesa->dmaAddr + vmesa->dmaLow); + return start; + } +} +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_render.c b/xc/lib/GL/mesa/src/drv/via/via_render.c new file mode 100644 index 000000000..52c214e6f --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_render.c @@ -0,0 +1,545 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +/* + * Render unclipped vertex buffers by emitting vertices directly to + * dma buffers. Use strip/fan hardware acceleration where possible. + * + */ +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "mtypes.h" +#include "mmath.h" + +#include "tnl/t_context.h" + +#include "via_context.h" +#include "via_tris.h" +#include "via_state.h" +#include "via_vb.h" +#include "via_ioctl.h" + +/* + * Render unclipped vertex buffers by emitting vertices directly to + * dma buffers. Use strip/fan hardware primitives where possible. + * Try to simulate missing primitives with indexed vertices. + */ +#define HAVE_POINTS 1 +#define HAVE_LINES 1 +#define HAVE_LINE_STRIPS 1 +#define HAVE_LINE_LOOP 1 +#define HAVE_TRIANGLES 1 +#define HAVE_TRI_STRIPS 1 +#define HAVE_TRI_STRIP_1 0 /* has it, template can't use it yet */ +#define HAVE_TRI_FANS 1 +#define HAVE_POLYGONS 1 +#define HAVE_QUADS 0 +#define HAVE_QUAD_STRIPS 0 + +#define HAVE_ELTS 0 + +static const GLenum reducedPrim[GL_POLYGON + 1] = { + GL_POINTS, + GL_LINES, + GL_LINES, + GL_LINES, + GL_TRIANGLES, + GL_TRIANGLES, + GL_TRIANGLES, + GL_TRIANGLES, + GL_TRIANGLES, + GL_TRIANGLES +}; + +/* Fallback to normal rendering. + */ +static void VERT_FALLBACK(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + tnl->Driver.Render.PrimitiveNotify(ctx, flags & PRIM_MODE_MASK); + tnl->Driver.Render.BuildVertices(ctx, start, count, ~0); + tnl->Driver.Render.PrimTabVerts[flags & PRIM_MODE_MASK](ctx, start, + count, flags); + VIA_CONTEXT(ctx)->setupNewInputs = VERT_CLIP; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +#define LOCAL_VARS viaContextPtr vmesa = VIA_CONTEXT(ctx) +/* +#define INIT(prim) \ + do { \ + VIA_STATECHANGE(vmesa, 0); \ + viaRasterPrimitive(ctx, reducedPrim[prim], prim); \ + } while (0) +*/ +#define INIT(prim) \ + do { \ + viaRasterPrimitive(ctx, reducedPrim[prim], prim); \ + } while (0) +#define NEW_PRIMITIVE() VIA_STATECHANGE(vmesa, 0) +#define NEW_BUFFER() VIA_FIREVERTICES(vmesa) +#define GET_CURRENT_VB_MAX_VERTS() \ + (((int)vmesa->dmaHigh - (int)vmesa->dmaLow) / (vmesa->vertexSize * 4)) +#define GET_SUBSEQUENT_VB_MAX_VERTS() \ + (VIA_DMA_BUF_SZ - 4) / (vmesa->vertexSize * 4) + + +#define EMIT_VERTS(ctx, j, nr) \ + via_emit_contiguous_verts(ctx, j, (j) + (nr)) + +#define FINISH \ + do { \ + vmesa->primitiveRendered = GL_TRUE; \ + viaRasterPrimitiveFinish(ctx); \ + } while (0) + + +#define TAG(x) via_fast##x +#include "via_dmatmp.h" +#undef TAG +#undef LOCAL_VARS +#undef INIT + +/**********************************************************************/ +/* Fast Render pipeline stage */ +/**********************************************************************/ +static GLboolean via_run_fastrender(GLcontext *ctx, + struct gl_pipeline_stage *stage) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLuint i, length, flags = 0; + + /* Don't handle clipping or indexed vertices. + */ +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + + if (VB->ClipOrMask || vmesa->renderIndex != 0 || VB->Elts) { +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "slow path\n"); + fprintf(stderr, "ClipOrMask = %08x\n", VB->ClipOrMask); + fprintf(stderr, "renderIndex = %08x\n", vmesa->renderIndex); + fprintf(stderr, "Elts = %08x\n", (GLuint)VB->Elts); + } +#endif + return GL_TRUE; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + vmesa->setupNewInputs = VERT_CLIP; + vmesa->primitiveRendered = GL_TRUE; + + tnl->Driver.Render.Start(ctx); + + for (i = VB->FirstPrimitive; !(flags & PRIM_LAST); i += length) { + flags = VB->Primitive[i]; + length= VB->PrimitiveLength[i]; + if (length) + via_fastrender_tab_verts[flags & PRIM_MODE_MASK](ctx, i, i + length, + flags); + } + + tnl->Driver.Render.Finish(ctx); + + /*=* DBG - viewperf7.0 : fix command buffer overflow *=*/ + if (vmesa->dmaLow > (vmesa->dma[0].size / 2)) + viaFlushPrims(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_FALSE; /* finished the pipe */ +} + + +static void via_check_fastrender(GLcontext *ctx, struct gl_pipeline_stage *stage) +{ + GLuint inputs = VERT_CLIP | VERT_RGBA; + + if (ctx->RenderMode == GL_RENDER) { + if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) + inputs |= VERT_SPEC_RGB; + + if (ctx->Texture.Unit[0]._ReallyEnabled) + inputs |= VERT_TEX(0); + + if (ctx->Texture.Unit[1]._ReallyEnabled) + inputs |= VERT_TEX(1); + + if (ctx->Fog.Enabled) + inputs |= VERT_FOG_COORD; + } + + stage->inputs = inputs; +} + + +static void fastdtr(struct gl_pipeline_stage *stage) +{ + (void)stage; +} + + +const struct gl_pipeline_stage _via_fastrender_stage = +{ + "via fast render", + (_DD_NEW_SEPARATE_SPECULAR | + _NEW_TEXTURE| + _NEW_FOG| + _NEW_RENDERMODE), /* re-check (new inputs) */ + 0, /* re-run (always runs) */ + GL_TRUE, /* active */ + 0, 0, /* inputs (set in check_render), outputs */ + 0, 0, /* changed_inputs, private */ + fastdtr, /* destructor */ + via_check_fastrender, /* check - initially set to alloc data */ + via_run_fastrender /* run */ +}; + + +/* + * Render whole vertex buffers, including projection of vertices from + * clip space and clipping of primitives. + * + * This file makes calls to project vertices and to the point, line + * and triangle rasterizers via the function pointers: + * + * context->Driver.Render.* + * + */ + + +/**********************************************************************/ +/* Clip single primitives */ +/**********************************************************************/ +#if defined(USE_IEEE) +#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1 << 31)) +#define DIFFERENT_SIGNS(x, y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1 << 31)) +#else +#define NEGATIVE(x) (x < 0) +#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0) +/* Could just use (x*y<0) except for the flatshading requirements. + * Maybe there's a better way? + */ +#endif + +#define W(i) coord[i][3] +#define Z(i) coord[i][2] +#define Y(i) coord[i][1] +#define X(i) coord[i][0] +#define SIZE 4 +#define TAG(x) x##_4 +#include "via_vb_cliptmp.h" + + +/**********************************************************************/ +/* Clip and render whole begin/end objects */ +/**********************************************************************/ +#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) +#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] +#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val + + +/* Vertices, with the possibility of clipping. + */ +#define RENDER_POINTS(start, count) \ + tnl->Driver.Render.Points(ctx, start, count) + +#define RENDER_LINE(v1, v2) \ + do { \ + GLubyte c1 = mask[v1], c2 = mask[v2]; \ + GLubyte ormask = c1 | c2; \ + if (!ormask) \ + LineFunc(ctx, v1, v2); \ + else if (!(c1 & c2 & 0x3f)) \ + clip_line_4(ctx, v1, v2, ormask); \ + } while (0) + +#define RENDER_TRI(v1, v2, v3) \ + if (VIA_DEBUG) fprintf(stderr, "RENDER_TRI - clip\n"); \ + do { \ + GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \ + GLubyte ormask = c1 | c2 | c3; \ + if (!ormask) \ + TriangleFunc(ctx, v1, v2, v3); \ + else if (!(c1 & c2 & c3 & 0x3f)) \ + clip_tri_4(ctx, v1, v2, v3, ormask); \ + } while (0) + +#define RENDER_QUAD(v1, v2, v3, v4) \ + do { \ + GLubyte c1 = mask[v1], c2 = mask[v2]; \ + GLubyte c3 = mask[v3], c4 = mask[v4]; \ + GLubyte ormask = c1 | c2 | c3 | c4; \ + if (!ormask) \ + QuadFunc(ctx, v1, v2, v3, v4); \ + else if (!(c1 & c2 & c3 & c4 & 0x3f)) \ + clip_quad_4(ctx, v1, v2, v3, v4, ormask); \ + } while (0) + + +#define LOCAL_VARS \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + struct vertex_buffer *VB = &tnl->vb; \ + const GLuint * const elt = VB->Elts; \ + const GLubyte *mask = VB->ClipMask; \ + const GLuint sz = VB->ClipPtr->size; \ + const line_func LineFunc = tnl->Driver.Render.Line; \ + const triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ + const quad_func QuadFunc = tnl->Driver.Render.Quad; \ + const GLboolean stipple = ctx->Line.StippleFlag; \ + (void) (LineFunc && TriangleFunc && QuadFunc); \ + (void) elt; (void) mask; (void) sz; (void) stipple; + +#define POSTFIX \ + viaRasterPrimitiveFinish(ctx) + +#define TAG(x) clip_##x##_verts +#define INIT(x) tnl->Driver.Render.PrimitiveNotify(ctx, x) +#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple(ctx) +#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE +#define PRESERVE_VB_DEFS +#include "via_vb_rendertmp.h" + + +/* Elts, with the possibility of clipping. + */ +#undef ELT +#undef TAG +#define ELT(x) elt[x] +#define TAG(x) clip_##x##_elts +#include "via_vb_rendertmp.h" + +/* TODO: do this for all primitives, verts and elts: + */ +static void clip_elt_triangles(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES]; + struct vertex_buffer *VB = &tnl->vb; + const GLuint * const elt = VB->Elts; + GLubyte *mask = VB->ClipMask; + GLuint last = count-2; + GLuint j; + (void)flags; +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + tnl->Driver.Render.PrimitiveNotify(ctx, GL_TRIANGLES); + + for (j = start; j < last; j += 3) { + GLubyte c1 = mask[elt[j]]; + GLubyte c2 = mask[elt[j + 1]]; + GLubyte c3 = mask[elt[j + 2]]; + GLubyte ormask = c1 | c2 | c3; + if (ormask) { + if (start < j) + render_tris(ctx, start, j, 0); + if (!(c1 & c2 & c3 & 0x3f)) + clip_tri_4(ctx, elt[j], elt[j + 1], elt[j + 2], ormask); + start = j+3; + } + } + + if (start < j) + render_tris(ctx, start, j, 0); + + viaRasterPrimitiveFinish(ctx); +} + + +/**********************************************************************/ +/* Helper functions for drivers */ +/**********************************************************************/ +/* +void _tnl_RenderClippedPolygon(GLcontext *ctx, const GLuint *elts, GLuint n) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLuint *tmp = VB->Elts; + + VB->Elts = (GLuint *)elts; + tnl->Driver.Render.PrimTabElts[GL_POLYGON](ctx, 0, n, PRIM_BEGIN|PRIM_END); + VB->Elts = tmp; +} + +void _tnl_RenderClippedLine(GLcontext *ctx, GLuint ii, GLuint jj) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl->Driver.Render.Line(ctx, ii, jj); +} +*/ + +/**********************************************************************/ +/* Render pipeline stage */ +/**********************************************************************/ +static GLboolean via_run_render(GLcontext *ctx, + struct gl_pipeline_stage *stage) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + viaContextPtr vmesa = VIA_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + /* DBG */ + GLuint newInputs = stage->changed_inputs; + /*GLuint newInputs = stage->inputs;*/ + + render_func *tab; + GLuint pass = 0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + + tnl->Driver.Render.Start(ctx); + tnl->Driver.Render.BuildVertices(ctx, 0, VB->Count, newInputs); + if (VB->ClipOrMask) { + tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts; + clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles; + } + else { + tab = VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts; + } + + do { + GLuint i, length, flags = 0; + + for (i = VB->FirstPrimitive; !(flags & PRIM_LAST); i += length) { + flags = VB->Primitive[i]; + length= VB->PrimitiveLength[i]; + ASSERT(length || (flags & PRIM_LAST)); + ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON + 1); + if (length) { + tab[flags & PRIM_MODE_MASK](ctx, i, i + length,flags); + } + } + } + while (tnl->Driver.Render.Multipass && tnl->Driver.Render.Multipass(ctx, ++pass)); + tnl->Driver.Render.Finish(ctx); + + /*=* DBG - flush : if hw idel *=*/ + /*{ + GLuint volatile *pnEnginStatus = vmesa->regEngineStatus; + GLuint nStatus; + nStatus = *pnEnginStatus; + if ((nStatus & 0xFFFEFFFF) == 0x00020000) + viaFlushPrims(vmesa); + }*/ + + /*=* DBG viewperf7.0 : fix command buffer overflow *=*/ + if (vmesa->dmaLow > (vmesa->dma[0].size / 2)) + viaFlushPrims(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_FALSE; /* finished the pipe */ +} + +/* Quite a bit of work involved in finding out the inputs for the + * render stage. + */ + +static void via_check_render(GLcontext *ctx, struct gl_pipeline_stage *stage) +{ + GLuint inputs = VERT_CLIP; + + if (ctx->Visual.rgbMode) { + inputs |= VERT_RGBA; + + if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) + inputs |= VERT_SPEC_RGB; + + if (ctx->Texture.Unit[0]._ReallyEnabled) { + inputs |= VERT_TEX(0); + } + + if (ctx->Texture.Unit[1]._ReallyEnabled) { + inputs |= VERT_TEX(1); + } + } + else { + inputs |= VERT_INDEX; + } + + /*if (ctx->Point._Attenuated) + inputs |= VERT_POINT_SIZE;*/ + + if (ctx->Fog.Enabled) + inputs |= VERT_FOG_COORD; + + /*if (ctx->_TriangleCaps & DD_TRI_UNFILLED) + inputs |= VERT_EDGE; + + if (ctx->RenderMode == GL_FEEDBACK) + inputs |= VERT_TEX_ANY;*/ + + stage->inputs = inputs; +} + + +static void dtr(struct gl_pipeline_stage *stage) +{ + (void)stage; +} + + +const struct gl_pipeline_stage _via_render_stage = +{ + "via render", + (_NEW_BUFFERS | + _DD_NEW_SEPARATE_SPECULAR | + _DD_NEW_FLATSHADE | + _NEW_TEXTURE | + _NEW_LIGHT | + _NEW_POINT | + _NEW_FOG | + _DD_NEW_TRI_UNFILLED | + _NEW_RENDERMODE), /* re-check (new inputs) */ + 0, /* re-run (always runs) */ + GL_TRUE, /* active */ + 0, 0, /* inputs (set in check_render), outputs */ + 0, 0, /* changed_inputs, private */ + dtr, /* destructor */ + via_check_render, /* check - initially set to alloc data */ + via_run_render /* run */ +}; diff --git a/xc/lib/GL/mesa/src/drv/via/via_screen.c b/xc/lib/GL/mesa/src/drv/via/via_screen.c new file mode 100644 index 000000000..23e99ca67 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_screen.c @@ -0,0 +1,312 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <X11/Xlibint.h> +#include <stdio.h> + +#include "glheader.h" +#include "context.h" +#include "matrix.h" +#include "simple_list.h" + +#include "via_state.h" +#include "via_tex.h" +#include "via_span.h" +#include "via_tris.h" +#include "via_ioctl.h" +#include "via_screen.h" + +#include "via_dri.h" +extern viaContextPtr current_mesa; + +static drmBufMapPtr via_create_empty_buffers(void) +{ + drmBufMapPtr retval; + + retval = (drmBufMapPtr)Xmalloc(sizeof(drmBufMap)); + if (retval == NULL) return NULL; + memset(retval, 0, sizeof(drmBufMap)); + + retval->list = (drmBufPtr)Xmalloc(sizeof(drmBuf) * VIA_DMA_BUF_NR); + if (retval->list == NULL) { + Xfree(retval); + return NULL; + } + memset(retval->list, 0, sizeof(drmBuf) * VIA_DMA_BUF_NR); + return retval; +} + +static GLboolean +viaInitDriver(__DRIscreenPrivate *sPriv) +{ + viaScreenPrivate *viaScreen; + VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + /* Check the DRI version */ + { + int major, minor, patch; + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 4 || minor < 0) { + __driUtilMessage("Via DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch); + return GL_FALSE; + } + } + } + + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 4 || + sPriv->ddxMinor < 0) { + __driUtilMessage("Via DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor < 1) { + __driUtilMessage("Via DRI driver expected DRM driver version 1.2.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + return GL_FALSE; + } + + /* Allocate the private area */ + viaScreen = (viaScreenPrivate *)Xmalloc(sizeof(viaScreenPrivate)); + if (!viaScreen) { + __driUtilMessage("viaInitDriver: alloc viaScreenPrivate struct failed"); + return GL_FALSE; + } + + viaScreen->driScrnPriv = sPriv; + sPriv->private = (void *)viaScreen; + + viaScreen->deviceID = gDRIPriv->deviceID; + viaScreen->width = gDRIPriv->width; + viaScreen->height = gDRIPriv->height; + viaScreen->mem = gDRIPriv->mem; + viaScreen->bitsPerPixel = gDRIPriv->bytesPerPixel << 3; + viaScreen->bytesPerPixel = gDRIPriv->bytesPerPixel; + viaScreen->fbOffset = 0; + viaScreen->fbSize = gDRIPriv->fbSize; + viaScreen->drixinerama = gDRIPriv->drixinerama; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "deviceID = %08x\n", viaScreen->deviceID); + fprintf(stderr, "width = %08x\n", viaScreen->width); + fprintf(stderr, "height = %08x\n", viaScreen->height); + fprintf(stderr, "cpp = %08x\n", viaScreen->cpp); + fprintf(stderr, "fbOffset = %08x\n", viaScreen->fbOffset); + } +#endif + /* DBG */ + /* + if (gDRIPriv->bitsPerPixel == 15) + viaScreen->fbFormat = DV_PF_555; + else + viaScreen->fbFormat = DV_PF_565; + */ + + viaScreen->bufs = via_create_empty_buffers(); + if (viaScreen->bufs == NULL) { + __driUtilMessage("viaInitDriver: via_create_empty_buffers() failed"); + Xfree(viaScreen); + return GL_FALSE; + } + + if (drmMap(sPriv->fd, + gDRIPriv->regs.handle, + gDRIPriv->regs.size, + (drmAddress *)&viaScreen->reg) != 0) { + Xfree(viaScreen); + sPriv->private = NULL; + __driUtilMessage("viaInitDriver: drmMap regs failed"); + return GL_FALSE; + } + + if (gDRIPriv->agp.size) { + if (drmMap(sPriv->fd, + gDRIPriv->agp.handle, + gDRIPriv->agp.size, + (drmAddress *)&viaScreen->agpLinearStart) != 0) { + Xfree(viaScreen); + drmUnmap(viaScreen->reg, gDRIPriv->agp.size); + sPriv->private = NULL; + __driUtilMessage("viaInitDriver: drmMap agp failed"); + return GL_FALSE; + } + viaScreen->agpBase = (GLuint *)gDRIPriv->agp.handle; + } else + viaScreen->agpLinearStart = 0; + + viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return GL_TRUE; +} + +static void +viaDestroyScreen(__DRIscreenPrivate *sPriv) +{ + viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private; + VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + drmUnmap(viaScreen->reg, gDRIPriv->regs.size); + if (gDRIPriv->agp.size) + drmUnmap(viaScreen->agpLinearStart, gDRIPriv->agp.size); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + Xfree(viaScreen); + sPriv->private = NULL; +} + +static GLboolean +viaCreateBuffer(Display *dpy, __DRIscreenPrivate *driScrnPriv, + __DRIdrawablePrivate *driDrawPriv, + const __GLcontextModes *mesaVis, + GLboolean isPixmap) +{ + viaContextPtr vmesa = current_mesa; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (isPixmap) { + driDrawPriv->driverPrivate = (void *) + _mesa_create_framebuffer(mesaVis, + GL_FALSE, /* software depth buffer? */ + mesaVis->stencilBits > 0, + mesaVis->accumRedBits > 0, + GL_FALSE /* s/w alpha planes */); + + vmesa->drawType = GLX_PBUFFER_BIT; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return (driDrawPriv->driverPrivate != NULL); + } + else { + driDrawPriv->driverPrivate = (void *) + _mesa_create_framebuffer(mesaVis, + GL_FALSE, /* software depth buffer? */ + mesaVis->stencilBits > 0, + mesaVis->accumRedBits > 0, + GL_FALSE /* s/w alpha planes */); + + vmesa->drawType = GLX_WINDOW_BIT; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + return (driDrawPriv->driverPrivate != NULL); + } +} + + +static void +viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + _mesa_destroy_framebuffer((GLframebuffer *)(driDrawPriv->driverPrivate)); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +#if 0 +/* Initialize the fullscreen mode. + */ +GLboolean +XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) +{ + viaContextPtr vmesa = (viaContextPtr)driContextPriv->driverPrivate; + vmesa->doPageFlip = 1; + vmesa->currentPage = 0; + return GL_TRUE; +} + +/* Shut down the fullscreen mode. + */ +GLboolean +XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) +{ + viaContextPtr vmesa = (viaContextPtr)driContextPriv->driverPrivate; + + if (vmesa->currentPage == 1) { + viaPageFlip(vmesa); + vmesa->currentPage = 0; + } + + vmesa->doPageFlip = GL_FALSE; + vmesa->Setup[VIA_DESTREG_DI0] = vmesa->driScreen->front_offset; + return GL_TRUE; +} + +#else + +static GLboolean +viaOpenFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + +static GLboolean +viaCloseFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + +#endif + + +static struct __DriverAPIRec viaAPI = { + viaInitDriver, + viaDestroyScreen, + viaCreateContext, + viaDestroyContext, + viaCreateBuffer, + viaDestroyBuffer, + viaSwapBuffers, + viaMakeCurrent, + viaUnbindContext, + viaOpenFullScreen, + viaCloseFullScreen +}; + + +/* + * This is the bootstrap function for the driver. + * The __driCreateScreen name is the symbol that libGL.so fetches. + * Return: pointer to a __DRIscreenPrivate. + */ +void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, + int numConfigs, __GLXvisualConfig *config) +{ + __DRIscreenPrivate *psp; + psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &viaAPI); + return (void *)psp; +} diff --git a/xc/lib/GL/mesa/src/drv/via/via_screen.h b/xc/lib/GL/mesa/src/drv/via/via_screen.h new file mode 100644 index 000000000..4622a042f --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_screen.h @@ -0,0 +1,88 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _VIAINIT_H +#define _VIAINIT_H + +#include <sys/time.h> +#include "dri_util.h" +#include "via_dri.h" + +typedef struct { + viaRegion regs; + viaRegion agp; + int deviceID; + int width; + int height; + int mem; + + int cpp; + int bitsPerPixel; + int bytesPerPixel; + int fbFormat; + int fbOffset; + int fbSize; + Bool drixinerama; + + int fbStride; + + int backOffset; + int depthOffset; + + int backPitch; + int backPitchBits; + + int textureOffset; + int textureSize; + int logTextureGranularity; + + drmAddress reg; + drmAddress agpLinearStart; + GLuint* agpBase; + + __DRIscreenPrivate *driScrnPriv; + drmBufMapPtr bufs; + unsigned int sareaPrivOffset; +} viaScreenPrivate; + +extern GLboolean +viaCreateContext(Display *dpy, const __GLcontextModes *mesaVis, + __DRIcontextPrivate *driContextPriv, + void *sharedContextPrivate); + +extern void +viaDestroyContext(__DRIcontextPrivate *driContextPriv); + +extern GLboolean +viaUnbindContext(__DRIcontextPrivate *driContextPriv); + +extern GLboolean +viaMakeCurrent(__DRIcontextPrivate *driContextPriv, + __DRIdrawablePrivate *driDrawPriv, + __DRIdrawablePrivate *driReadPriv); + +extern void +viaSwapBuffers(Display *dpy, void *drawablePrivate); + +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_span.c b/xc/lib/GL/mesa/src/drv/via/via_span.c new file mode 100644 index 000000000..67a4792ff --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_span.c @@ -0,0 +1,405 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glheader.h" +#include "macros.h" +#include "mtypes.h" +#include "via_context.h" +#include "via_span.h" +#include "via_ioctl.h" +#include "swrast/swrast.h" + +#define DBG 0 +#if 0 +#define LOCAL_VARS \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + viaScreenPrivate *viaScreen = vmesa->viaScreen; \ + GLuint pitch = vmesa->drawPitch; \ + GLuint height = dPriv->h; \ + GLushort p; \ + char *buf = (char *)(vmesa->drawMap + \ + dPriv->x * viaScreen->bytesPerPixel + \ + dPriv->y * pitch); \ + char *read_buf = (char *)(vmesa->readMap + \ + dPriv->x * viaScreen->bytesPerPixel + \ + dPriv->y * pitch); \ + (void)read_buf; (void)buf; (void)p +#endif + +#define LOCAL_DEPTH_VARS \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + viaScreenPrivate *viaScreen = vmesa->viaScreen; \ + GLuint pitch = viaScreen->backPitch; \ + GLuint height = dPriv->h; \ + char *buf = (char *)(vmesa->depth.map + \ + dPriv->x * 2 + \ + dPriv->y * pitch) + +#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \ + _y >= miny && _y < maxy) + + +#define CLIPSPAN(_x, _y, _n, _x1, _n1, _i) \ + if (_y < miny || _y >= maxy) { \ + _n1 = 0, _x1 = x; \ + } \ + else { \ + _n1 = _n; \ + _x1 = _x; \ + if (_x1 < minx) _i += (minx -_x1), n1 -= (minx -_x1), _x1 = minx; \ + if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx); \ + } + +#define Y_FLIP(_y) (height - _y - 1) + +#define HW_LOCK() \ + viaContextPtr vmesa = VIA_CONTEXT(ctx); \ + LOCK_HARDWARE_QUIESCENT(vmesa); + +/*=* [DBG] csmash saam : bitmap option menu can't be drawn in saam *=*/ +/*#define HW_CLIPLOOP() \ + do { \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + int _nc = dPriv->numClipRects; \ + while (_nc--) { \ + int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \ + int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \ + int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \ + int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;*/ +#define HW_CLIPLOOP() \ + do { \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + int _nc = dPriv->numClipRects; \ + GLuint scrn = vmesa->saam & S_MASK; \ + if(scrn == S1) _nc = 1; \ + while (_nc--) { \ + int minx; \ + int miny; \ + int maxx; \ + int maxy; \ + if (!vmesa->saam) { \ + minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \ + miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \ + maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \ + maxy = dPriv->pClipRects[_nc].y2 - dPriv->y; \ + } \ + else { \ + minx = -10000; \ + miny = -10000; \ + maxx = 10000; \ + maxy = 10000; \ + } + + /*else if (scrn == S0) { \ + minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \ + miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \ + maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \ + maxy = dPriv->pClipRects[_nc].y2 - dPriv->y; \ + } \ + else if (scrn == S1) { \ + drm_clip_rect_t *b = vmesa->sarea->boxes; \ + minx = b->x1; \ + miny = b->y1; \ + maxx = b->x2; \ + maxy = b->y2; \ + } \ + else { \ + drm_clip_rect_t *b = vmesa->sarea->boxes + vmesa->numClipRects;\ + minx = b->x1; \ + miny = b->y1; \ + maxx = b->x2; \ + maxy = b->y2; \ + }*/ + +#define HW_ENDCLIPLOOP() \ + } \ + } while (0) + +#define HW_UNLOCK() \ + UNLOCK_HARDWARE(vmesa); + + +/* 16 bit, 565 rgb color spanline and pixel functions + */ +/*=* [DBG] csmash : fix options worng position *=*/ +/*#define LOCAL_VARS \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + GLuint pitch = vmesa->drawPitch; \ + GLuint height = dPriv->h; \ + GLushort p; \ + char *buf = (char *)(vmesa->drawMap + \ + dPriv->x * 2 + \ + dPriv->y * pitch); \ + char *read_buf = (char *)(vmesa->readMap + \ + dPriv->x * 2 + \ + dPriv->y * pitch); \ + (void)read_buf; (void)buf; (void)p*/ + +#define LOCAL_VARS \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + GLuint pitch = vmesa->drawPitch; \ + GLuint height = dPriv->h; \ + GLushort p; \ + char *buf, *read_buf; \ + p = 0; \ + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { \ + buf = (char *)(vmesa->drawMap); \ + read_buf = (char *)(vmesa->readMap); \ + } \ + else { \ + buf = (char *)(vmesa->drawMap + \ + dPriv->x * 2 + \ + dPriv->y * pitch); \ + read_buf = (char *)(vmesa->readMap + \ + dPriv->x * 2 + \ + dPriv->y * pitch); \ + } + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_565(color[0], color[1], color[2]) + +#define WRITE_RGBA(_x, _y, r, g, b, a) \ + *(GLushort *)(buf + _x * 2 + _y * pitch) = ((((int)r & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)b & 0xf8) >> 3)) + +#define WRITE_PIXEL(_x, _y, p) \ + *(GLushort *)(buf + _x * 2 + _y * pitch) = p + +#define READ_RGBA(rgba, _x, _y) \ + do { \ + GLushort p = *(GLushort *)(read_buf + _x * 2 + _y * pitch); \ + rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \ + rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \ + rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \ + rgba[3] = 255; \ + } while (0) + +#define TAG(x) via##x##_565 +#include "spantmp.h" + +/* 32 bit, 8888 argb color spanline and pixel functions + */ +#undef LOCAL_VARS +#undef LOCAL_DEPTH_VARS + +/*=* [DBG] csmash : fix options worng position *=*/ +/*#define LOCAL_VARS \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + GLuint pitch = vmesa->drawPitch; \ + GLuint height = dPriv->h; \ + GLuint p; \ + char *buf = (char *)(vmesa->drawMap + \ + dPriv->x * 4 + \ + dPriv->y * pitch); \ + char *read_buf = (char *)(vmesa->readMap + \ + dPriv->x * 4 + \ + dPriv->y * pitch); \ + (void)read_buf; (void)buf; (void)p*/ +#define LOCAL_VARS \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + GLuint pitch = vmesa->drawPitch; \ + GLuint height = dPriv->h; \ + GLuint p; \ + char *buf, *read_buf; \ + p = 0; \ + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { \ + buf = (char *)(vmesa->drawMap); \ + read_buf = (char *)(vmesa->readMap); \ + } \ + else { \ + buf = (char *)(vmesa->drawMap + \ + dPriv->x * 4 + \ + dPriv->y * pitch); \ + read_buf = (char *)(vmesa->readMap + \ + dPriv->x * 4 + \ + dPriv->y * pitch); \ + } + + +#undef INIT_MONO_PIXEL +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_8888(color[3], color[0], color[1], color[2]) + +#define WRITE_RGBA(_x, _y, r, g, b, a) \ + *(GLuint *)(buf + _x * 4 + _y * pitch) = ((r << 16) | \ + (g << 8) | \ + (b << 0) | \ + (a << 24)); + +#define WRITE_PIXEL(_x, _y, p) \ + *(GLuint *)(buf + _x * 4 + _y * pitch) = p + +#define READ_RGBA(rgba, _x, _y) \ + do { \ + GLuint p = *(GLuint *)(read_buf + _x * 4 + _y * pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = 255; \ + } while (0) + +#define TAG(x) via##x##_8888 +#include "spantmp.h" +/*#include "via_spantmp.h"*/ + +/* 16 bit depthbuffer functions. + */ +/*=* John Sheng [2003.6.16] fix exy press 'i' dirty screen *=*/ +/*#define LOCAL_DEPTH_VARS \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + GLuint pitch = vmesa->depth.pitch; \ + GLuint height = dPriv->h; \ + char *buf = (char *)(vmesa->depth.map + \ + dPriv->x * 2 + \ + dPriv->y * pitch) */ +#define LOCAL_DEPTH_VARS \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + /*viaScreenPrivate *viaScreen = vmesa->viaScreen;*/ \ + GLuint pitch = vmesa->depth.pitch; \ + GLuint height = dPriv->h; \ + char *buf = (char *)(vmesa->depth.map) + + +#define WRITE_DEPTH(_x, _y, d) \ + *(GLushort *)(buf + _x * 2 + _y * pitch) = d; + +#define READ_DEPTH(d, _x, _y) \ + d = *(GLushort *)(buf + _x * 2 + _y * pitch); + +#define TAG(x) via##x##_16 +#include "depthtmp.h" + +/* 32 bit depthbuffer functions. + */ +#define WRITE_DEPTH(_x, _y, d) \ + *(GLuint *)(buf + _x * 4 + _y * pitch) = d; + +#define READ_DEPTH(d, _x, _y) \ + d = *(GLuint *)(buf + _x * 4 + _y * pitch); + +#define TAG(x) via##x##_32 +#include "depthtmp.h" + +/* 24/8 bit depthbuffer functions. + */ +/* +#define WRITE_DEPTH(_x, _y, d) { \ + GLuint tmp = *(GLuint *)(buf + _x * 4 + y * pitch); \ + tmp &= 0xff; \ + tmp |= (d) & 0xffffff00; \ + *(GLuint *)(buf + _x * 4 + _y * pitch) = tmp; \ + +#define READ_DEPTH(d, _x, _y) \ + d = (*(GLuint *)(buf + _x * 4 + _y * pitch) & ~0xff) >> 8; + +#define TAG(x) via##x##_24_8 +#include "depthtmp.h" +*/ + + +static void viaSetReadBuffer(GLcontext *ctx, GLframebuffer *colorBuffer, + GLenum mode ) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (mode == GL_FRONT_LEFT) { + vmesa->drawMap = (char *)vmesa->driScreen->pFB; + vmesa->readMap = (char *)vmesa->driScreen->pFB; + vmesa->drawPitch = vmesa->front.pitch; + vmesa->readPitch = vmesa->front.pitch; + } + else if (mode == GL_BACK_LEFT) { + vmesa->drawMap = vmesa->back.map; + vmesa->readMap = vmesa->back.map; + vmesa->drawPitch = vmesa->back.pitch; + vmesa->readPitch = vmesa->back.pitch; + } + else { + ASSERT(0); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s (%08X %08X)\n", __FUNCTION__, vmesa->drawMap, vmesa->readMap); + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + + +void viaInitSpanFuncs(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); + + swdd->SetReadBuffer = viaSetReadBuffer; + +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (vmesa->viaScreen->bitsPerPixel == 0x10) { + swdd->WriteRGBASpan = viaWriteRGBASpan_565; + swdd->WriteRGBSpan = viaWriteRGBSpan_565; + swdd->WriteMonoRGBASpan = viaWriteMonoRGBASpan_565; + swdd->WriteRGBAPixels = viaWriteRGBAPixels_565; + swdd->WriteMonoRGBAPixels = viaWriteMonoRGBAPixels_565; + swdd->ReadRGBASpan = viaReadRGBASpan_565; + swdd->ReadRGBAPixels = viaReadRGBAPixels_565; + } + else if (vmesa->viaScreen->bitsPerPixel == 0x20) { + swdd->WriteRGBASpan = viaWriteRGBASpan_8888; + swdd->WriteRGBSpan = viaWriteRGBSpan_8888; + swdd->WriteMonoRGBASpan = viaWriteMonoRGBASpan_8888; + swdd->WriteRGBAPixels = viaWriteRGBAPixels_8888; + swdd->WriteMonoRGBAPixels = viaWriteMonoRGBAPixels_8888; + swdd->ReadRGBASpan = viaReadRGBASpan_8888; + swdd->ReadRGBAPixels = viaReadRGBAPixels_8888; + } + else + ASSERT(0); + + if (vmesa->glCtx->Visual.depthBits == 0x10) { + swdd->ReadDepthSpan = viaReadDepthSpan_16; + swdd->WriteDepthSpan = viaWriteDepthSpan_16; + swdd->ReadDepthPixels = viaReadDepthPixels_16; + swdd->WriteDepthPixels = viaWriteDepthPixels_16; + } + else if (vmesa->glCtx->Visual.depthBits == 0x20) { + swdd->ReadDepthSpan = viaReadDepthSpan_32; + swdd->WriteDepthSpan = viaWriteDepthSpan_32; + swdd->ReadDepthPixels = viaReadDepthPixels_32; + swdd->WriteDepthPixels = viaWriteDepthPixels_32; + } + + swdd->WriteCI8Span = NULL; + swdd->WriteCI32Span = NULL; + swdd->WriteMonoCISpan = NULL; + swdd->WriteCI32Pixels = NULL; + swdd->WriteMonoCIPixels = NULL; + swdd->ReadCI32Span = NULL; + swdd->ReadCI32Pixels = NULL; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} diff --git a/xc/lib/GL/mesa/src/drv/via/via_span.h b/xc/lib/GL/mesa/src/drv/via/via_span.h new file mode 100644 index 000000000..6045f2ce7 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_span.h @@ -0,0 +1,30 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _VIA_SPAN_H +#define _VIA_SPAN_H + +extern void viaInitSpanFuncs(GLcontext *ctx); + +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_state.c b/xc/lib/GL/mesa/src/drv/via/via_state.c new file mode 100644 index 000000000..2dbcf573e --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_state.c @@ -0,0 +1,3519 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "enums.h" +#include "dd.h" + +#include "mm.h" +#include "via_context.h" +#include "via_state.h" +#include "via_tex.h" +#include "via_vb.h" +#include "via_tris.h" +#include "via_ioctl.h" + +#include "swrast/swrast.h" +#include "array_cache/acache.h" +#include "tnl/tnl.h" +#include "swrast_setup/swrast_setup.h" + +#include "tnl/t_pipeline.h" + +static GLuint ROP[16] = { + HC_HROP_BLACK, /* GL_CLEAR 0 */ + HC_HROP_DPa, /* GL_AND s & d */ + HC_HROP_PDna, /* GL_AND_REVERSE s & ~d */ + HC_HROP_P, /* GL_COPY s */ + HC_HROP_DPna, /* GL_AND_INVERTED ~s & d */ + HC_HROP_D, /* GL_NOOP d */ + HC_HROP_DPx, /* GL_XOR s ^ d */ + HC_HROP_DPo, /* GL_OR s | d */ + HC_HROP_DPon, /* GL_NOR ~(s | d) */ + HC_HROP_DPxn, /* GL_EQUIV ~(s ^ d) */ + HC_HROP_Dn, /* GL_INVERT ~d */ + HC_HROP_PDno, /* GL_OR_REVERSE s | ~d */ + HC_HROP_Pn, /* GL_COPY_INVERTED ~s */ + HC_HROP_DPno, /* GL_OR_INVERTED ~s | d */ + HC_HROP_DPan, /* GL_NAND ~(s & d) */ + HC_HROP_WHITE /* GL_SET 1 */ +}; + +static __inline__ GLuint viaPackColor(GLuint format, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a) +{ + switch (format) { + case 0x10: + return PACK_COLOR_565(r, g, b); + case 0x20: + return PACK_COLOR_8888(a, r, g, b); + default: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "unknown format %d\n", (int)format); +#endif + return PACK_COLOR_8888(a, r, g, b); + } +} + +static void viaAlphaFunc(GLcontext *ctx, GLenum func, GLchan ref) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +static void viaBlendEquation(GLcontext *ctx, GLenum mode) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + /* Can only do GL_ADD equation in hardware */ + FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_BLEND_EQ, mode != GL_FUNC_ADD_EXT); + + /* BlendEquation sets ColorLogicOpEnabled in an unexpected + * manner. + */ + FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_LOGICOP, + (ctx->Color.ColorLogicOpEnabled && + ctx->Color.LogicOp != GL_COPY)); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLboolean fallback = GL_FALSE; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + switch (ctx->Color.BlendSrcRGB) { + case GL_ZERO: break; + case GL_SRC_ALPHA: break; + case GL_ONE: break; + case GL_DST_COLOR: break; + case GL_ONE_MINUS_DST_COLOR: break; + case GL_ONE_MINUS_SRC_ALPHA: break; + case GL_DST_ALPHA: break; + case GL_ONE_MINUS_DST_ALPHA: break; + case GL_SRC_ALPHA_SATURATE: /*a |= SDM_SRC_SRC_ALPHA; break;*/ + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + fallback = GL_TRUE; + break; + default: + return; + } + + switch (ctx->Color.BlendDstRGB) { + case GL_SRC_ALPHA: break; + case GL_ONE_MINUS_SRC_ALPHA: break; + case GL_ZERO: break; + case GL_ONE: break; + case GL_SRC_COLOR: break; + case GL_ONE_MINUS_SRC_COLOR: break; + case GL_DST_ALPHA: break; + case GL_ONE_MINUS_DST_ALPHA: break; + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + fallback = GL_TRUE; + break; + default: + return; + } + + FALLBACK(vmesa, VIA_FALLBACK_BLEND_FUNC, fallback); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +/* Shouldn't be called as the extension is disabled. + */ +static void viaBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, + GLenum dfactorRGB, GLenum sfactorA, + GLenum dfactorA) +{ + if (dfactorRGB != dfactorA || sfactorRGB != sfactorA) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBlendEquation (disabled)"); + } + + viaBlendFunc(ctx, sfactorRGB, dfactorRGB); +} + + +static void viaDepthFunc(GLcontext *ctx, GLenum func) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +static void viaDepthMask(GLcontext *ctx, GLboolean flag) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +static void viaPolygonStipple(GLcontext *ctx, const GLubyte *mask) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + + +/* ============================================================= + * Hardware clipping + */ +static void viaScissor(GLcontext *ctx, GLint x, GLint y, + GLsizei w, GLsizei h) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (ctx->Scissor.Enabled) { + VIA_FIREVERTICES(vmesa); /* don't pipeline cliprect changes */ + vmesa->uploadCliprects = GL_TRUE; + } + + vmesa->scissorRect.x1 = x; + vmesa->scissorRect.y1 = vmesa->driDrawable->h - (y + h); + vmesa->scissorRect.x2 = x + w; + vmesa->scissorRect.y2 = vmesa->driDrawable->h - y; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + + +static void viaLogicOp(GLcontext *ctx, GLenum opcode) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); + if (VIA_DEBUG) fprintf(stderr, "opcode = %x\n", opcode); + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +/* Fallback to swrast for select and feedback. + */ +static void viaRenderMode(GLcontext *ctx, GLenum mode) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + FALLBACK(vmesa, VIA_FALLBACK_RENDERMODE, (mode != GL_RENDER)); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + + +static void viaSetDrawBuffer(GLcontext *ctx, GLenum mode) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); +#endif + if (mode == GL_FRONT) { + VIA_FIREVERTICES(vmesa); + VIA_STATECHANGE(vmesa, VIA_UPLOAD_BUFFERS); + vmesa->drawMap = (char *)vmesa->driScreen->pFB; + vmesa->readMap = (char *)vmesa->driScreen->pFB; + vmesa->drawPitch = vmesa->front.pitch; + vmesa->readPitch = vmesa->front.pitch; + viaXMesaSetFrontClipRects(vmesa); + FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE); + return; + } + else if (mode == GL_BACK) { + VIA_FIREVERTICES(vmesa); + VIA_STATECHANGE(vmesa, VIA_UPLOAD_BUFFERS); + vmesa->drawMap = vmesa->back.map; + vmesa->readMap = vmesa->back.map; + vmesa->drawPitch = vmesa->back.pitch; + vmesa->readPitch = vmesa->back.pitch; + viaXMesaSetBackClipRects(vmesa); + FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE); + return; + } + else { + FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_TRUE); + return; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); +#endif +} + +static void viaClearColor(GLcontext *ctx, const GLchan color[4]) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLubyte pcolor[4]; + pcolor[0] = (GLubyte) (255 * color[0]); + pcolor[1] = (GLubyte) (255 * color[1]); + pcolor[2] = (GLubyte) (255 * color[2]); + pcolor[3] = (GLubyte) (255 * color[3]); + vmesa->ClearColor = viaPackColor(vmesa->viaScreen->bitsPerPixel, + pcolor[0], pcolor[1], + pcolor[2], pcolor[3]); + +} + +/* ============================================================= + * Culling - the via isn't quite as clean here as the rest of + * its interfaces, but it's not bad. + */ +static void viaCullFaceFrontFace(GLcontext *ctx, GLenum unused) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +static void viaLineWidth(GLcontext *ctx, GLfloat widthf) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +static void viaPointSize(GLcontext *ctx, GLfloat sz) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +static void viaBitmap( GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + + /*=* [DBG] csmash : fix background overlap option menu *=*/ + LOCK_HARDWARE(vmesa); + viaFlushPrimsLocked(vmesa); + UNLOCK_HARDWARE(vmesa); + + WAIT_IDLE + /*=* [DBG] csmash : fix segmentation fault *=*/ + if (!vmesa->drawMap && !vmesa->readMap) { + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { + viaSetDrawBuffer(ctx, GL_BACK); + } + else { + viaSetDrawBuffer(ctx, GL_FRONT); + } + } + /*=* [DBG] csmash : white option words become brown *=*/ + /*_swrast_Bitmap(ctx, px, py, width, height, unpack, bitmap );*/ + { + GLboolean fog; + fog = ctx->Fog.Enabled; + ctx->Fog.Enabled = GL_FALSE; + _swrast_Bitmap(ctx, px, py, width, height, unpack, bitmap ); + ctx->Fog.Enabled = fog; + } +} + +/* ============================================================= + * Color masks + */ +static void viaColorMask(GLcontext *ctx, + GLboolean r, GLboolean g, + GLboolean b, GLboolean a) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +/* Seperate specular not fully implemented on the via. + */ +static void viaLightModelfv(GLcontext *ctx, GLenum pname, + const GLfloat *param) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + + +/* In Mesa 3.5 we can reliably do native flatshading. + */ +static void viaShadeModel(GLcontext *ctx, GLenum mode) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +/* ============================================================= + * Fog + */ +static void viaFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +/* ============================================================= + */ +static void viaEnable(GLcontext *ctx, GLenum cap, GLboolean state) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +/* ============================================================= + */ +void viaEmitDrawingRectangle(viaContextPtr vmesa) +{ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; + viaScreenPrivate *viaScreen = vmesa->viaScreen; + int x0 = vmesa->drawX; + int y0 = vmesa->drawY; + int x1 = x0 + dPriv->w; + int y1 = y0 + dPriv->h; +/* GLuint dr2, dr3, dr4; +*/ + + /* Coordinate origin of the window - may be offscreen. + */ +/* dr4 = vmesa->BufferSetup[VIA_DESTREG_DR4] = ((y0 << 16) | + (((unsigned)x0) & 0xFFFF)); +*/ + + /* Clip to screen. + */ + if (x0 < 0) x0 = 0; + if (y0 < 0) y0 = 0; + if (x1 > viaScreen->width - 1) x1 = viaScreen->width - 1; + if (y1 > viaScreen->height - 1) y1 = viaScreen->height - 1; + + /* Onscreen drawing rectangle. + */ +/* dr2 = vmesa->BufferSetup[VIA_DESTREG_DR2] = ((y0 << 16) | x0); + dr3 = vmesa->BufferSetup[VIA_DESTREG_DR3] = (((y1 + 1) << 16) | (x1 + 1)); +*/ + + vmesa->dirty |= VIA_UPLOAD_BUFFERS; +} + + +static void viaCalcViewport(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + const GLfloat *v = ctx->Viewport._WindowMap.m; + GLfloat *m = vmesa->ViewportMatrix.m; + + /* See also via_translate_vertex. SUBPIXEL adjustments can be done + * via state vars, too. + */ + m[MAT_SX] = v[MAT_SX]; + m[MAT_TX] = v[MAT_TX] + vmesa->drawXoff; + m[MAT_SY] = - v[MAT_SY]; + m[MAT_TY] = - v[MAT_TY] + vmesa->driDrawable->h; + m[MAT_SZ] = v[MAT_SZ] * (1.0 / 0xffff); + m[MAT_TZ] = v[MAT_TZ] * (1.0 / 0xffff); +} + +static void viaViewport(GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height) +{ + viaCalcViewport(ctx); +} + +static void viaDepthRange(GLcontext *ctx, + GLclampd nearval, GLclampd farval) +{ + viaCalcViewport(ctx); +} + +void viaPrintDirty(const char *msg, GLuint state) +{ +#ifdef DEBUG + if (VIA_DEBUG) + fprintf(stderr, "%s (0x%x): %s%s%s%s\n", + msg, + (unsigned int) state, + (state & VIA_UPLOAD_TEX0) ? "upload-tex0, " : "", + (state & VIA_UPLOAD_TEX1) ? "upload-tex1, " : "", + (state & VIA_UPLOAD_CTX) ? "upload-ctx, " : "", + (state & VIA_UPLOAD_BUFFERS) ? "upload-bufs, " : "" + ); +#endif +} + + +void viaInitState(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + + vmesa->regCmdA = HC_ACMD_HCmdA; + vmesa->regCmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Z; + vmesa->regEnable = HC_HenCW_MASK; + + if (vmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) { + vmesa->drawMap = vmesa->back.map; + vmesa->readMap = vmesa->back.map; + } + else { + vmesa->drawMap = (char *)vmesa->driScreen->pFB; + vmesa->readMap = (char *)vmesa->driScreen->pFB; + } +} + +void viaChooseTextureState(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0]; + struct gl_texture_unit *texUnit1 = &ctx->Texture.Unit[1]; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (texUnit0->_ReallyEnabled || texUnit1->_ReallyEnabled) { +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "Texture._ReallyEnabled - in\n"); + fprintf(stderr, "texUnit0->_ReallyEnabled = %x\n",texUnit0->_ReallyEnabled); + } +#endif + + if (texUnit0->_ReallyEnabled) { + struct gl_texture_object *texObj = texUnit0->_Current; + struct gl_texture_image *texImage = texObj->Image[0]; + GLint r = 0, g = 0, b = 0, a = 0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->_ReallyEnabled\n"); +#endif + if (texImage->Border) { + FALLBACK(vmesa, VIA_FALLBACK_TEXTURE, GL_TRUE); + return; + } + vmesa->regCmdB |= HC_HVPMSK_S | HC_HVPMSK_T | HC_HVPMSK_W | HC_HVPMSK_Cs; + vmesa->regEnable |= HC_HenTXMP_MASK | HC_HenTXCH_MASK | HC_HenTXPP_MASK; + + switch (texObj->MinFilter) { + case GL_NEAREST: + vmesa->regHTXnTB_0 = HC_HTXnFLSs_Nearest | + HC_HTXnFLTs_Nearest; + break; + case GL_LINEAR: + vmesa->regHTXnTB_0 = HC_HTXnFLSs_Linear | + HC_HTXnFLTs_Linear; + break; + case GL_NEAREST_MIPMAP_NEAREST: + vmesa->regHTXnTB_0 = HC_HTXnFLSs_Nearest | + HC_HTXnFLTs_Nearest; + vmesa->regHTXnTB_0 |= HC_HTXnFLDs_Nearest; + break; + case GL_LINEAR_MIPMAP_NEAREST: + vmesa->regHTXnTB_0 = HC_HTXnFLSs_Linear | + HC_HTXnFLTs_Linear; + vmesa->regHTXnTB_0 |= HC_HTXnFLDs_Nearest; + break; + case GL_NEAREST_MIPMAP_LINEAR: + vmesa->regHTXnTB_0 = HC_HTXnFLSs_Nearest | + HC_HTXnFLTs_Nearest; + vmesa->regHTXnTB_0 |= HC_HTXnFLDs_Linear; + break; + case GL_LINEAR_MIPMAP_LINEAR: + vmesa->regHTXnTB_0 = HC_HTXnFLSs_Linear | + HC_HTXnFLTs_Linear; + vmesa->regHTXnTB_0 |= HC_HTXnFLDs_Linear; + break; + default: + break; + } + + if (texObj->MagFilter) { + vmesa->regHTXnTB_0 |= HC_HTXnFLSe_Linear | + HC_HTXnFLTe_Linear; + } + else { + vmesa->regHTXnTB_0 |= HC_HTXnFLSe_Nearest | + HC_HTXnFLTe_Nearest; + } + + if (texObj->WrapS == GL_REPEAT) + vmesa->regHTXnMPMD_0 = HC_HTXnMPMD_Srepeat; + else + vmesa->regHTXnMPMD_0 = HC_HTXnMPMD_Sclamp; + + if (GL_TRUE) { + if (texObj->WrapT == GL_REPEAT) + vmesa->regHTXnMPMD_0 |= HC_HTXnMPMD_Trepeat; + else + vmesa->regHTXnMPMD_0 |= HC_HTXnMPMD_Tclamp; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode %x\n",texUnit0->EnvMode); +#endif + switch (texUnit0->EnvMode) { + case GL_MODULATE: + switch (texImage->Format) { + case GL_ALPHA: + /* C = Cf, A = At*Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_0 | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Adif | HC_HTXnTBLAb_TOPA | + HC_HTXnTBLAb_Atex | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; + break; + case GL_LUMINANCE: + /* C = Lt*Cf, A = Af + * RGB part. + * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + /* C = Lt*Cf, A = At*Af + * RGB part. + * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; + break; + case GL_INTENSITY: + /* C = It*Cf, A = It*Af + * RGB part. + * Ca = It, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = It, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; + break; + case GL_RGB: + /* C = Ct*Cf, A = Af + * RGB part. + * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_MODULATE: GL_RGB\n"); +#endif + break; + case GL_RGBA: + /* C = Ct*Cf, A = At*Af + * RGB part. + * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias + | HC_HTXnTBLAshift_No; + + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_MODULATE: GL_RGBA\n"); +#endif + break; + case GL_COLOR_INDEX: + switch (texObj->Palette.Format) { + case GL_ALPHA: + /* C = Cf, A = At*Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_0 | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | HC_HTXnTBLAb_TOPA | + HC_HTXnTBLAb_Adif | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; + break; + case GL_LUMINANCE: + /* C = Lt*Cf, A = Af + * RGB part. + * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + /* C = Lt*Cf, A = At*Af + * RGB part. + * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; + break; + case GL_INTENSITY: + /* C = It*Cf, A = It*Af + * RGB part. + * Ca = It, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = It, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; + break; + case GL_RGB: + /* C = Ct*Cf, A = Af + * RGB part. + * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_RGBA: + /* C = Ct*Cf, A = At*Af + * RGB part. + * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; + break; + } + break; + } + break; + case GL_DECAL: + switch (texImage->Format) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + /* Undefined. + */ + break; + case GL_RGB: + /* C = Ct, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_DECAL: GL_RGB\n"); +#endif + break; + case GL_RGBA: + /* C = (1-At)*Cf+At*Ct, A = Af --> At*(Ct-Cf)+Cf + * RGB part. + * Ca = At, Cb = Ct, Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Atex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_Tex | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_DECAL: GL_RGBA\n"); +#endif + break; + case GL_COLOR_INDEX: + switch (texObj->Palette.Format) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + /* Undefined. + */ + break; + case GL_RGB: + /* C = Ct, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_COLOR_INDEX: GL_RGB\n"); +#endif + break; + case GL_RGBA: + /* C = (1-At)*Cf+At*Ct, A = Af --> At*(Ct-Cf)+Cf + * RGB part. + * Ca = At, Cb = Ct, Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Atex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_Tex | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_COLOR_INDEX: GL_RGBA\n"); +#endif + break; + } + break; + } + break; + case GL_BLEND: + switch (texImage->Format) { + case GL_ALPHA: + /* C = Cf, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_LUMINANCE: + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b); + /* C = (1-Lt)*Cf+Lt*Cc, A = Af --> Lt*(Cc-Cf)+Cf + * RGB part. + * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b); + /* C = (1-Lt)*Cf+Lt*Cc, A = At*Af --> Lt*(Cc-Cf)+Cf + * RGB part. + * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; + break; + case GL_INTENSITY: + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a); + /* C = (1-It)*Cf+It*Cc, A = (1-It)*Af+It*Ac + * --> It*(Cc-Cf)+Cf, It*(Ac-Af)+Af + * RGB part. + * Ca = It, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = It, Ab = Ac(Reg), Cop = -, Ac = Af, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Adif; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = (a << 8); + break; + case GL_RGB: + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a); + /* C = (1-Ct)*Cf+Ct*Cc, A = Af --> Ct*(Cc-Cf)+Cf + * RGB part. + * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_BLEND: GL_RGB\n"); +#endif + break; + case GL_RGBA: + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a); + /* C = (1-Ct)*Cf+Ct*Cc, A = At*Af --> Ct*(Cc-Cf)+Cf + * RGB part. + * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_BLEND: GL_RGBA\n"); +#endif + break; + case GL_COLOR_INDEX: + switch (texObj->Palette.Format) { + case GL_ALPHA: + /* C = Cf, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_LUMINANCE: + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b); + /* C = (1-Lt)*Cf+Lt*Cc, A = Af --> Lt*(Cc-Cf)+Cf + * RGB part. + * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b); + /* C = (1-Lt)*Cf+Lt*Cc, A = At*Af --> Lt*(Cc-Cf)+Cf + * RGB part. + * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; + break; + case GL_INTENSITY: + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a); + /* C = (1-It)*Cf+It*Cc, A = (1-It)*Af+It*Ac + * --> It*(Cc-Cf)+Cf, It*(Ac-Af)+Af + * RGB part. + * Ca = It, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = It, Ab = Ac(Reg), Cop = -, Ac = Af, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Adif; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = (a << 8); + break; + case GL_RGB: + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a); + /* C = (1-Ct)*Cf+Ct*Cc, A = Af --> Ct*(Cc-Cf)+Cf + * RGB part. + * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_RGBA: + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a); + /* C = (1-Ct)*Cf+Ct*Cc, A = At*Af --> Ct*(Cc-Cf)+Cf + * RGB part. + * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + vmesa->regHTXnTBLRFog_0 = 0x0; + break; + } + break; + } + break; + case GL_REPLACE: + switch (texImage->Format) { + case GL_ALPHA: + /* C = Cf, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_LUMINANCE: + /* C = Lt, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + /* C = Lt, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_INTENSITY: + /* C = It, A = It + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = It, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = It, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_RGB: + /* C = Ct, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_REPLACE: GL_RGB\n"); +#endif + break; + case GL_RGBA: + /* C = Ct, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_REPLACE: GL_RGBA\n"); +#endif + break; + case GL_COLOR_INDEX: + switch (texObj->Palette.Format) { + case GL_ALPHA: + /* C = Cf, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_LUMINANCE: + /* C = Lt, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + /* C = Lt, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_INTENSITY: + /* C = It, A = It + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = It, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = It, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_RGB: + /* C = Ct, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + case GL_RGBA: + /* C = Ct, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_0 = 0x0; + break; + } + break; + } + break; + default: + break; + } + } + else { + /* Should turn Cs off if actually no Cs */ + } + + if (texUnit1->_ReallyEnabled) { + struct gl_texture_object *texObj = texUnit1->_Current; + struct gl_texture_image *texImage = texObj->Image[0]; + GLint r = 0, g = 0, b = 0, a = 0; + + if (texImage->Border) { + FALLBACK(vmesa, VIA_FALLBACK_TEXTURE, GL_TRUE); + return; + } + + switch (texObj->MinFilter) { + case GL_NEAREST: + vmesa->regHTXnTB_1 = HC_HTXnFLSs_Nearest | + HC_HTXnFLTs_Nearest; + break; + case GL_LINEAR: + vmesa->regHTXnTB_1 = HC_HTXnFLSs_Linear | + HC_HTXnFLTs_Linear; + break; + case GL_NEAREST_MIPMAP_NEAREST: + vmesa->regHTXnTB_1 = HC_HTXnFLSs_Nearest | + HC_HTXnFLTs_Nearest; + vmesa->regHTXnTB_1 |= HC_HTXnFLDs_Nearest; + break ; + case GL_LINEAR_MIPMAP_NEAREST: + vmesa->regHTXnTB_1 = HC_HTXnFLSs_Linear | + HC_HTXnFLTs_Linear; + vmesa->regHTXnTB_1 |= HC_HTXnFLDs_Nearest; + break ; + case GL_NEAREST_MIPMAP_LINEAR: + vmesa->regHTXnTB_1 = HC_HTXnFLSs_Nearest | + HC_HTXnFLTs_Nearest; + vmesa->regHTXnTB_1 |= HC_HTXnFLDs_Linear; + break ; + case GL_LINEAR_MIPMAP_LINEAR: + vmesa->regHTXnTB_1 = HC_HTXnFLSs_Linear | + HC_HTXnFLTs_Linear; + vmesa->regHTXnTB_1 |= HC_HTXnFLDs_Linear; + break ; + default: + break; + } + + switch(texObj->MagFilter) { + case GL_NEAREST: + vmesa->regHTXnTB_1 |= HC_HTXnFLSs_Nearest | + HC_HTXnFLTs_Nearest; + break; + case GL_LINEAR: + vmesa->regHTXnTB_1 |= HC_HTXnFLSs_Linear | + HC_HTXnFLTs_Linear; + break; + } + + if (texObj->WrapS == GL_REPEAT) + vmesa->regHTXnMPMD_1 = HC_HTXnMPMD_Srepeat; + else + vmesa->regHTXnMPMD_1 = HC_HTXnMPMD_Sclamp; + + if (GL_TRUE) { + if (texObj->WrapT == GL_REPEAT) + vmesa->regHTXnMPMD_1 |= HC_HTXnMPMD_Trepeat; + else + vmesa->regHTXnMPMD_1 |= HC_HTXnMPMD_Tclamp; + } + + switch (texUnit1->EnvMode) { + case GL_MODULATE: + switch (texImage->Format) { + case GL_ALPHA: + /* C = Cf, A = At*Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_0 | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | HC_HTXnTBLAb_TOPA | + HC_HTXnTBLAb_Acur | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + case GL_LUMINANCE: + /* C = Lt*Cf, A = Af + * RGB part. + * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + /* C = Lt*Cf, A = At*Af + * RGB part. + * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + case GL_INTENSITY: + /* C = It*Cf, A = It*Af + * RGB part. + * Ca = It, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = It, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + case GL_RGB: + /* C = Ct*Cf, A = Af + * RGB part. + * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_RGBA: + /* C = Ct*Cf, A = At*Af + * RGB part. + * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias + | HC_HTXnTBLAshift_No; + + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + case GL_COLOR_INDEX: + switch (texObj->Palette.Format) { + case GL_ALPHA: + /* C = Cf, A = At*Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_0 | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | HC_HTXnTBLAb_TOPA | + HC_HTXnTBLAb_Acur | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + case GL_LUMINANCE: + /* C = Lt*Cf, A = Af + * RGB part. + * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + /* C = Lt*Cf, A = At*Af + * RGB part. + * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + case GL_INTENSITY: + /* C = It*Cf, A = It*Af + * RGB part. + * Ca = It, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = It, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + case GL_RGB: + /* C = Ct*Cf, A = Af + * RGB part. + * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_RGBA: + /* C = Ct*Cf, A = At*Af + * RGB part. + * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC | + HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + } + break; + } + break; + case GL_DECAL: + switch (texImage->Format) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + /* Undefined. + */ + break; + case GL_RGB: + /* C = Ct, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_RGBA: + /* C = (1-At)*Cf+At*Ct, A = Af --> At*(Ct-Cf)+Cf + * RGB part. + * Ca = At, Cb = Ct, Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Atex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_Tex | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_COLOR_INDEX: + switch (texObj->Palette.Format) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + /* Undefined. + */ + break; + case GL_RGB: + /* C = Ct, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_RGBA: + /* C = (1-At)*Cf+At*Ct, A = Af --> At*(Ct-Cf)+Cf + * RGB part. + * Ca = At, Cb = Ct, Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Atex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_Tex | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + } + break; + } + break; + case GL_BLEND: + switch (texImage->Format) { + case GL_ALPHA: + /* C = Cf, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_LUMINANCE: + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b); + /* C = (1-Lt)*Cf+Lt*Cc, A = Af --> Lt*(Cc-Cf)+Cf + * RGB part. + * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b); + /* C = (1-Lt)*Cf+Lt*Cc, A = At*Af --> Lt*(Cc-Cf)+Cf + * RGB part. + * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + case GL_INTENSITY: + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a); + /* C = (1-It)*Cf+It*Cc, A = (1-It)*Af+It*Ac + * --> It*(Cc-Cf)+Cf, It*(Ac-Af)+Af + * RGB part. + * Ca = It, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = It, Ab = Ac(Reg), Cop = -, Ac = Af, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Acur; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Sub | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = (a << 8); + break; + case GL_RGB: + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a); + /* C = (1-Ct)*Cf+Ct*Cc, A = Af --> Ct*(Cc-Cf)+Cf + * RGB part. + * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_RGBA: + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a); + /* C = (1-Ct)*Cf+Ct*Cc, A = At*Af --> Ct*(Cc-Cf)+Cf + * RGB part. + * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + case GL_COLOR_INDEX: + switch (texObj->Palette.Format) { + case GL_ALPHA: + /* C = Cf, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_LUMINANCE: + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b); + /* C = (1-Lt)*Cf+Lt*Cc, A = Af --> Lt*(Cc-Cf)+Cf + * RGB part. + * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b); + /* C = (1-Lt)*Cf+Lt*Cc, A = At*Af --> Lt*(Cc-Cf)+Cf + * RGB part. + * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + case GL_INTENSITY: + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a); + /* C = (1-It)*Cf+It*Cc, A = (1-It)*Af+It*Ac + * --> It*(Cc-Cf)+Cf, It*(Ac-Af)+Af + * RGB part. + * Ca = It, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = It, Ab = Ac(Reg), Cop = -, Ac = Af, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Acur; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Sub | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = (a << 8); + break; + case GL_RGB: + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a); + /* C = (1-Ct)*Cf+Ct*Cc, A = Af --> Ct*(Cc-Cf)+Cf + * RGB part. + * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_RGBA: + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b); + CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a); + /* C = (1-Ct)*Cf+Ct*Cc, A = At*Af --> Ct*(Cc-Cf)+Cf + * RGB part. + * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b; + /* Alpha part. + * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + vmesa->regHTXnTBLRFog_1 = 0x0; + break; + } + break; + } + break; + case GL_REPLACE: + switch (texImage->Format) { + case GL_ALPHA: + /* C = Cf, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_LUMINANCE: + /* C = Lt, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + /* C = Lt, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_INTENSITY: + /* C = It, A = It + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = It, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = It, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_RGB: + /* C = Ct, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_RGBA: + /* C = Ct, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_COLOR_INDEX: + switch (texObj->Palette.Format) { + case GL_ALPHA: + /* C = Cf, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_LUMINANCE: + /* C = Lt, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_LUMINANCE_ALPHA: + /* C = Lt, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_INTENSITY: + /* C = It, A = It + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = It, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = It, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_RGB: + /* C = Ct, A = Af + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + case GL_RGBA: + /* C = Ct, A = At + * RGB part. + * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No. + */ + vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK | + HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | + HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 | + HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0; + vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add | + HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex | + HC_HTXnTBLCshift_No; + vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog; + /* Alpha part. + * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No. + */ + vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK | + HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA | + HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA | + HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA; + vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add | + HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No; + vmesa->regHTXnTBLRAa_1 = 0x0; + break; + } + break; + } + break; + default: + break; + } + + /* If both texture are color index format, then we claim that the second + * need to be converted to ARGB8 format. + */ + /*if ((current0->format->internalFormat == __GL_FORMAT_COLOR_INDEX8) && + (current1->format->internalFormat == __GL_FORMAT_COLOR_INDEX8)) { + ddtex->regNeedConvertPalette = GL_TRUE; + } + */ + } + vmesa->dirty |= VIA_UPLOAD_TEXTURE; + } + else { + if (ctx->Fog.Enabled) + vmesa->regCmdB &= (~(HC_HVPMSK_S | HC_HVPMSK_T)); + else + vmesa->regCmdB &= (~(HC_HVPMSK_S | HC_HVPMSK_T | HC_HVPMSK_W)); + vmesa->regEnable &= (~(HC_HenTXMP_MASK | HC_HenTXCH_MASK | HC_HenTXPP_MASK)); + vmesa->dirty |= VIA_UPLOAD_ENABLE; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + +} + +void viaChooseColorState(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLenum s = ctx->Color.BlendSrcRGB; + GLenum d = ctx->Color.BlendDstRGB; + + /* The HW's blending equation is: + * (Ca * FCa + Cbias + Cb * FCb) << Cshift + */ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + + if (ctx->Color.BlendEnabled) { + vmesa->regEnable |= HC_HenABL_MASK; + /* Ca -- always from source color. + */ + vmesa->regHABLCsat = HC_HABLCsat_MASK | HC_HABLCa_OPC | + HC_HABLCa_Csrc; + /* Aa -- always from source alpha. + */ + vmesa->regHABLAsat = HC_HABLAsat_MASK | HC_HABLAa_OPA | + HC_HABLAa_Asrc; + /* FCa -- depend on following condition. + * FAa -- depend on following condition. + */ + switch (s) { + case GL_ZERO: + /* (0, 0, 0, 0) + */ + vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa; + vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_HABLFRA; + vmesa->regHABLRFCa = 0x0; + vmesa->regHABLRAa = 0x0; + break; + case GL_ONE: + /* (1, 1, 1, 1) + */ + vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_HABLRCa; + vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA; + vmesa->regHABLRFCa = 0x0; + vmesa->regHABLRAa = 0x0; + break; + case GL_SRC_COLOR: + /* (Rs, Gs, Bs, As) + */ + vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Csrc; + vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Asrc; + break; + case GL_ONE_MINUS_SRC_COLOR: + /* (1, 1, 1, 1) - (Rs, Gs, Bs, As) + */ + vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Csrc; + vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Asrc; + break; + case GL_DST_COLOR: + /* (Rd, Gd, Bd, Ad) + */ + vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Cdst; + vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Adst; + break; + case GL_ONE_MINUS_DST_COLOR: + /* (1, 1, 1, 1) - (Rd, Gd, Bd, Ad) + */ + vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Cdst; + vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Adst; + break; + case GL_SRC_ALPHA: + /* (As, As, As, As) + */ + vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Asrc; + vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Asrc; + break; + case GL_ONE_MINUS_SRC_ALPHA: + /* (1, 1, 1, 1) - (As, As, As, As) + */ + vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Asrc; + vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Asrc; + break; + case GL_DST_ALPHA: + { + if (vmesa->viaScreen->bitsPerPixel == 16) { + /* (1, 1, 1, 1) + */ + vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_HABLRCa; + vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA; + vmesa->regHABLRFCa = 0x0; + vmesa->regHABLRAa = 0x0; + } + else { + /* (Ad, Ad, Ad, Ad) + */ + vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Adst; + vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Adst; + } + } + break; + case GL_ONE_MINUS_DST_ALPHA: + { + if (vmesa->viaScreen->bitsPerPixel == 16) { + /* (1, 1, 1, 1) - (1, 1, 1, 1) = (0, 0, 0, 0) + */ + vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa; + vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_HABLFRA; + vmesa->regHABLRFCa = 0x0; + vmesa->regHABLRAa = 0x0; + } + else { + /* (1, 1, 1, 1) - (Ad, Ad, Ad, Ad) + */ + vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Adst; + vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Adst; + } + } + break; + case GL_SRC_ALPHA_SATURATE: + { + if (vmesa->viaScreen->bitsPerPixel == 16) { + /* (f, f, f, 1), f = min(As, 1 - Ad) = min(As, 1 - 1) = 0 + * So (f, f, f, 1) = (0, 0, 0, 1) + */ + vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa; + vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA; + vmesa->regHABLRFCa = 0x0; + vmesa->regHABLRAa = 0x0; + } + else { + /* (f, f, f, 1), f = min(As, 1 - Ad) + */ + vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_mimAsrcInvAdst; + vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA; + vmesa->regHABLRFCa = 0x0; + vmesa->regHABLRAa = 0x0; + } + } + break; + } + + /* Op is add. + */ + + /* bias is 0. + */ + vmesa->regHABLCsat |= HC_HABLCbias_HABLRCbias; + vmesa->regHABLAsat |= HC_HABLAbias_HABLRAbias; + + /* Cb -- always from destination color. + */ + vmesa->regHABLCop = HC_HABLCb_OPC | HC_HABLCb_Cdst; + /* Ab -- always from destination alpha. + */ + vmesa->regHABLAop = HC_HABLAb_OPA | HC_HABLAb_Adst; + /* FCb -- depend on following condition. + */ + switch (d) { + case GL_ZERO: + /* (0, 0, 0, 0) + */ + vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb; + vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA; + vmesa->regHABLRFCb = 0x0; + vmesa->regHABLRAb = 0x0; + break; + case GL_ONE: + /* (1, 1, 1, 1) + */ + vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_HABLRCb; + vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_HABLFRA; + vmesa->regHABLRFCb = 0x0; + vmesa->regHABLRAb = 0x0; + break; + case GL_SRC_COLOR: + /* (Rs, Gs, Bs, As) + */ + vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Csrc; + vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Asrc; + break; + case GL_ONE_MINUS_SRC_COLOR: + /* (1, 1, 1, 1) - (Rs, Gs, Bs, As) + */ + vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Csrc; + vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Asrc; + break; + case GL_DST_COLOR: + /* (Rd, Gd, Bd, Ad) + */ + vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Cdst; + vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Adst; + break; + case GL_ONE_MINUS_DST_COLOR: + /* (1, 1, 1, 1) - (Rd, Gd, Bd, Ad) + */ + vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Cdst; + vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Adst; + break; + case GL_SRC_ALPHA: + /* (As, As, As, As) + */ + vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Asrc; + vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Asrc; + break; + case GL_ONE_MINUS_SRC_ALPHA: + /* (1, 1, 1, 1) - (As, As, As, As) + */ + vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Asrc; + vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Asrc; + break; + case GL_DST_ALPHA: + { + if (vmesa->viaScreen->bitsPerPixel == 16) { + /* (1, 1, 1, 1) + */ + vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_HABLRCb; + vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_HABLFRA; + vmesa->regHABLRFCb = 0x0; + vmesa->regHABLRAb = 0x0; + } + else { + /* (Ad, Ad, Ad, Ad) + */ + vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Adst; + vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Adst; + } + } + break; + case GL_ONE_MINUS_DST_ALPHA: + { + if (vmesa->viaScreen->bitsPerPixel == 16) { + /* (1, 1, 1, 1) - (1, 1, 1, 1) = (0, 0, 0, 0) + */ + vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb; + vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA; + vmesa->regHABLRFCb = 0x0; + vmesa->regHABLRAb = 0x0; + } + else { + /* (1, 1, 1, 1) - (Ad, Ad, Ad, Ad) + */ + vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Adst; + vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Adst; + } + } + break; + default: + vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb; + vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA; + vmesa->regHABLRFCb = 0x0; + vmesa->regHABLRAb = 0x0; + break; + } + + if (vmesa->viaScreen->bitsPerPixel <= 16) + vmesa->regEnable &= ~HC_HenDT_MASK; + + vmesa->dirty |= (VIA_UPLOAD_BLEND | VIA_UPLOAD_ENABLE); + } + else { + vmesa->regEnable &= (~HC_HenABL_MASK); + vmesa->dirty |= VIA_UPLOAD_ENABLE; + } + + if (ctx->Color.AlphaEnabled) { + vmesa->regEnable |= HC_HenAT_MASK; + vmesa->regHATMD = (((GLchan)ctx->Color.AlphaRef) & 0xFF) | + ((ctx->Color.AlphaFunc - GL_NEVER) << 8); + vmesa->dirty |= (VIA_UPLOAD_ALPHATEST | VIA_UPLOAD_ENABLE); + } + else { + vmesa->regEnable &= (~HC_HenAT_MASK); + vmesa->dirty |= VIA_UPLOAD_ENABLE; + } + + if (ctx->Color.DitherFlag && (vmesa->viaScreen->bitsPerPixel < 32)) { + if (ctx->Color.BlendEnabled) { + vmesa->regEnable &= ~HC_HenDT_MASK; + } + else { + vmesa->regEnable |= HC_HenDT_MASK; + } + vmesa->dirty |= VIA_UPLOAD_ENABLE; + } + + if (ctx->Color.ColorLogicOpEnabled) + vmesa->regHROP = ROP[ctx->Color.LogicOp & 0xF]; + else + vmesa->regHROP = HC_HROP_P; + + vmesa->regHFBBMSKL = (*(GLuint *)&ctx->Color.ColorMask[0]) & 0xFFFFFF; + vmesa->regHROP |= ((*(GLuint *)&ctx->Color.ColorMask[0]) >> 24) & 0xFF; + vmesa->dirty |= VIA_UPLOAD_MASK_ROP; + + if ((GLuint)((GLuint *)&ctx->Color.ColorMask[0]) & 0xFF000000) + vmesa->regEnable |= HC_HenAW_MASK; + else + vmesa->regEnable &= (~HC_HenAW_MASK); + vmesa->dirty |= VIA_UPLOAD_ENABLE; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaChooseFogState(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + + if (ctx->Fog.Enabled) { + GLubyte r, g, b, a; + + vmesa->regCmdB |= (HC_HVPMSK_Cd | HC_HVPMSK_Cs | HC_HVPMSK_W); + vmesa->regEnable |= HC_HenFOG_MASK; + + /* Use fog equation 0 (OpenGL's default) & local fog. + */ + vmesa->regHFogLF = 0x0; + + r = (GLubyte)(ctx->Fog.Color[0] * 255.0F); + g = (GLubyte)(ctx->Fog.Color[1] * 255.0F); + b = (GLubyte)(ctx->Fog.Color[2] * 255.0F); + a = (GLubyte)(ctx->Fog.Color[3] * 255.0F); + vmesa->regHFogCL = (r << 16) | (g << 8) | b; + vmesa->regHFogCH = a; + vmesa->dirty |= (VIA_UPLOAD_FOG | VIA_UPLOAD_ENABLE); + } + else { + if((!ctx->Texture.Unit[0]._ReallyEnabled) && + (!ctx->Texture.Unit[1]._ReallyEnabled)) { + vmesa->regCmdB &= ~ HC_HVPMSK_W; + vmesa->regCmdB &= ~ HC_HVPMSK_Cs; + } + vmesa->regEnable &= ~HC_HenFOG_MASK; + vmesa->dirty |= VIA_UPLOAD_ENABLE; + } +} + +void viaChooseDepthState(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + + if (ctx->Depth.Test) { + vmesa->regCmdB |= HC_HVPMSK_Z; + vmesa->regEnable |= HC_HenZT_MASK; + if (ctx->Depth.Mask) + vmesa->regEnable |= HC_HenZW_MASK; + else + vmesa->regEnable &= (~HC_HenZW_MASK); + vmesa->regHZWTMD = (ctx->Depth.Func - GL_NEVER) << 16; + vmesa->dirty |= (VIA_UPLOAD_DEPTH | VIA_UPLOAD_ENABLE); + + } + else { + /* Still need to send parameter Z. + */ + + vmesa->regCmdB |= HC_HVPMSK_Z; + vmesa->regEnable &= ~HC_HenZT_MASK; + + /*=* [DBG] racer : can't display cars in car selection menu *=*/ + /*if (ctx->Depth.Mask) + vmesa->regEnable |= HC_HenZW_MASK; + else + vmesa->regEnable &= (~HC_HenZW_MASK);*/ + vmesa->regEnable &= (~HC_HenZW_MASK); + + vmesa->dirty |= VIA_UPLOAD_ENABLE; + } +} + +void viaChooseLightState(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + + if (ctx->Light.ShadeModel == GL_SMOOTH) { + vmesa->regCmdA |= HC_HShading_Gouraud; + vmesa->regCmdB |= HC_HVPMSK_Cd; + } + else { + vmesa->regCmdA &= ~HC_HShading_Gouraud; + vmesa->regCmdB |= HC_HVPMSK_Cd; + } +} + +void viaChooseLineState(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + + if (ctx->Line.SmoothFlag) { + vmesa->regEnable |= HC_HenAA_MASK; + } + else { + if (!ctx->Polygon.SmoothFlag) { + vmesa->regEnable &= ~HC_HenAA_MASK; + } + } + + if (ctx->Line.StippleFlag) { + vmesa->regEnable |= HC_HenLP_MASK; + vmesa->regHLP = ctx->Line.StipplePattern; + vmesa->regHLPRF = ctx->Line.StippleFactor; + vmesa->dirty |= VIA_UPLOAD_LINESTIPPLE; + } + else { + vmesa->regEnable &= ~HC_HenLP_MASK; + } + vmesa->dirty |= VIA_UPLOAD_ENABLE; +} + +void viaChoosePolygonState(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + + if (ctx->Polygon.SmoothFlag) { + vmesa->regEnable |= HC_HenAA_MASK; + } + else { + if (!ctx->Line.SmoothFlag) { + vmesa->regEnable &= ~HC_HenAA_MASK; + } + } + + if (ctx->Polygon.StippleFlag) { + vmesa->regEnable |= HC_HenSP_MASK; + vmesa->dirty |= VIA_UPLOAD_POLYGONSTIPPLE; + } + else { + vmesa->regEnable &= ~HC_HenSP_MASK; + } + + if (ctx->Polygon.CullFlag) { + vmesa->regEnable |= HC_HenFBCull_MASK; + } + else { + vmesa->regEnable &= ~HC_HenFBCull_MASK; + } + vmesa->dirty |= VIA_UPLOAD_ENABLE; +} + +void viaChooseStencilState(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + + if (ctx->Stencil.Enabled) { + GLuint temp; + + vmesa->regEnable |= HC_HenST_MASK; + temp = (ctx->Stencil.Ref & 0xFF) << HC_HSTREF_SHIFT; + temp |= 0xFF << HC_HSTOPMSK_SHIFT; + temp |= (ctx->Stencil.ValueMask & 0xFF); + vmesa->regHSTREF = temp; + + temp = (ctx->Stencil.Function - GL_NEVER) << 16; + + switch (ctx->Stencil.FailFunc) { + case GL_KEEP: + temp |= HC_HSTOPSF_KEEP; + break; + case GL_ZERO: + temp |= HC_HSTOPSF_ZERO; + break; + case GL_REPLACE: + temp |= HC_HSTOPSF_REPLACE; + break; + case GL_INVERT: + temp |= HC_HSTOPSF_INVERT; + break; + case GL_INCR: + temp |= HC_HSTOPSF_INCR; + break; + case GL_DECR: + temp |= HC_HSTOPSF_DECR; + break; + } + + switch (ctx->Stencil.ZFailFunc) { + case GL_KEEP: + temp |= HC_HSTOPSPZF_KEEP; + break; + case GL_ZERO: + temp |= HC_HSTOPSPZF_ZERO; + break; + case GL_REPLACE: + temp |= HC_HSTOPSPZF_REPLACE; + break; + case GL_INVERT: + temp |= HC_HSTOPSPZF_INVERT; + break; + case GL_INCR: + temp |= HC_HSTOPSPZF_INCR; + break; + case GL_DECR: + temp |= HC_HSTOPSPZF_DECR; + break; + } + + switch (ctx->Stencil.ZPassFunc) { + case GL_KEEP: + temp |= HC_HSTOPSPZP_KEEP; + break; + case GL_ZERO: + temp |= HC_HSTOPSPZP_ZERO; + break; + case GL_REPLACE: + temp |= HC_HSTOPSPZP_REPLACE; + break; + case GL_INVERT: + temp |= HC_HSTOPSPZP_INVERT; + break; + case GL_INCR: + temp |= HC_HSTOPSPZP_INCR; + break; + case GL_DECR: + temp |= HC_HSTOPSPZP_DECR; + break; + } + vmesa->regHSTMD = temp; + + vmesa->dirty |= (VIA_UPLOAD_STENCIL | VIA_UPLOAD_STENCIL); + } + else { + vmesa->regEnable &= ~HC_HenST_MASK; + vmesa->dirty |= VIA_UPLOAD_ENABLE; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaChoosePoint(GLcontext *ctx) +{ + ctx = ctx; +} + +void viaChooseLine(GLcontext *ctx) +{ + ctx = ctx; +} + +void viaChooseTriangle(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + + if (VIA_DEBUG) fprintf(stderr, "GL_CULL_FACE = %x\n", GL_CULL_FACE); + if (VIA_DEBUG) fprintf(stderr, "ctx->Polygon.CullFlag = %x\n", ctx->Polygon.CullFlag); + + if (VIA_DEBUG) fprintf(stderr, "GL_FRONT = %x\n", GL_FRONT); + if (VIA_DEBUG) fprintf(stderr, "ctx->Polygon.CullFaceMode = %x\n", ctx->Polygon.CullFaceMode); + if (VIA_DEBUG) fprintf(stderr, "GL_CCW = %x\n", GL_CCW); + if (VIA_DEBUG) fprintf(stderr, "ctx->Polygon.FrontFace = %x\n", ctx->Polygon.FrontFace); +#endif + if (ctx->Polygon.CullFlag == GL_TRUE) { + switch (ctx->Polygon.CullFaceMode) { + case GL_FRONT: + if (ctx->Polygon.FrontFace == GL_CCW) + vmesa->regCmdB |= HC_HBFace_MASK; + else + vmesa->regCmdB &= ~HC_HBFace_MASK; + break; + case GL_BACK: + if (ctx->Polygon.FrontFace == GL_CW) + vmesa->regCmdB |= HC_HBFace_MASK; + else + vmesa->regCmdB &= ~HC_HBFace_MASK; + break; + case GL_FRONT_AND_BACK: + return; + } + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void viaChooseState(GLcontext *ctx, GLuint newState) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0]; + struct gl_texture_unit *texUnit1 = &ctx->Texture.Unit[1]; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + + if (VIA_DEBUG) fprintf(stderr, "newState = %x\n", newState); +#endif + if (!(newState & (_NEW_COLOR | + _NEW_TEXTURE | + _NEW_DEPTH | + _NEW_FOG | + _NEW_LIGHT | + _NEW_LINE | + _NEW_POLYGON | + _NEW_POLYGONSTIPPLE | + _NEW_STENCIL))) + return; + + vmesa->dirty = 0; + vmesa->newState = newState; + + if (texUnit0->_ReallyEnabled || texUnit1->_ReallyEnabled || ctx->Fog.Enabled) { + vmesa->regCmdB |= HC_HVPMSK_Cs; + } + else { + vmesa->regCmdB &= ~ HC_HVPMSK_Cs; + } + + if (newState & _NEW_TEXTURE) + viaChooseTextureState(ctx); + + if (newState & _NEW_COLOR) + viaChooseColorState(ctx); + + if (newState & _NEW_DEPTH) + viaChooseDepthState(ctx); + + if (newState & _NEW_FOG) + viaChooseFogState(ctx); + + if (newState & _NEW_LIGHT) + viaChooseLightState(ctx); + + if (newState & _NEW_LINE) + viaChooseLineState(ctx); + + if (newState & (_NEW_POLYGON | _NEW_POLYGONSTIPPLE)) + viaChoosePolygonState(ctx); + + if (newState & _NEW_STENCIL) + viaChooseStencilState(ctx); + + viaChooseTriangle(ctx); + +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void viaInvalidateState(GLcontext *ctx, GLuint newState) +{ + _swrast_InvalidateState(ctx, newState); + _swsetup_InvalidateState(ctx, newState); + _ac_InvalidateState(ctx, newState); + _tnl_InvalidateState(ctx, newState); + viaChooseState(ctx, newState); +} + +void viaInitStateFuncs(GLcontext *ctx) +{ + /* Callbacks for internal Mesa events. + */ + ctx->Driver.UpdateState = viaInvalidateState; + + /* API callbacks + */ + ctx->Driver.AlphaFunc = viaAlphaFunc; + ctx->Driver.BlendEquation = viaBlendEquation; + ctx->Driver.BlendFunc = viaBlendFunc; + ctx->Driver.BlendFuncSeparate = viaBlendFuncSeparate; + ctx->Driver.ClearColor = viaClearColor; + ctx->Driver.ColorMask = viaColorMask; + ctx->Driver.CullFace = viaCullFaceFrontFace; + ctx->Driver.DepthFunc = viaDepthFunc; + ctx->Driver.DepthMask = viaDepthMask; + ctx->Driver.Enable = viaEnable; + ctx->Driver.Fogfv = viaFogfv; + ctx->Driver.FrontFace = viaCullFaceFrontFace; + ctx->Driver.LineWidth = viaLineWidth; + ctx->Driver.LogicOpcode = viaLogicOp; + ctx->Driver.PolygonStipple = viaPolygonStipple; + ctx->Driver.RenderMode = viaRenderMode; + ctx->Driver.Scissor = viaScissor; + ctx->Driver.SetDrawBuffer = viaSetDrawBuffer; + ctx->Driver.ShadeModel = viaShadeModel; + ctx->Driver.DepthRange = viaDepthRange; + ctx->Driver.Viewport = viaViewport; + ctx->Driver.PointSize = viaPointSize; + ctx->Driver.LightModelfv = viaLightModelfv; + + /* Pixel path fallbacks. + */ + ctx->Driver.Accum = _swrast_Accum; + ctx->Driver.Bitmap = viaBitmap; + + ctx->Driver.CopyPixels = _swrast_CopyPixels; + ctx->Driver.DrawPixels = _swrast_DrawPixels; + ctx->Driver.ReadPixels = _swrast_ReadPixels; + ctx->Driver.ResizeBuffers = viaReAllocateBuffers; + + /* Swrast hooks for imaging extensions: + */ + ctx->Driver.CopyColorTable = _swrast_CopyColorTable; + ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; + ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; + ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; +} diff --git a/xc/lib/GL/mesa/src/drv/via/via_state.h b/xc/lib/GL/mesa/src/drv/via/via_state.h new file mode 100644 index 000000000..76d81c2cf --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_state.h @@ -0,0 +1,48 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _VIA_STATE_H +#define _VIA_STATE_H + +#include "via_context.h" + +extern void viaInitState(GLcontext *ctx); +extern void viaInitStateFuncs(GLcontext *ctx); +extern void viaPrintDirty(const char *msg, GLuint state); +extern void viaChooseTextureState(GLcontext *ctx); +extern void viaChooseColorState(GLcontext *ctx); +extern void viaChooseDepthState(GLcontext *ctx); +extern void viaChoosePolygonState(GLcontext *ctx); +extern void viaChoosePoint(GLcontext *ctx); +extern void viaChooseLine(GLcontext *ctx); +extern void viaChooseTriangle(GLcontext *ctx); +extern void viaChooseFogState(GLcontext *ctx); +extern void viaChooseStencilState(GLcontext *ctx); +extern void viaChooseLightState(GLcontext *ctx); +extern void viaChooseLineState(GLcontext *ctx); + +extern void viaFallback(viaContextPtr vmesa, GLuint bit, GLboolean mode); +#define FALLBACK(vmesa, bit, mode) viaFallback(vmesa, bit, mode) + +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_tex.c b/xc/lib/GL/mesa/src/drv/via/via_tex.c new file mode 100644 index 000000000..a76f6c164 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_tex.c @@ -0,0 +1,422 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +#include <stdlib.h> +#include <stdio.h> + +#include "glheader.h" +#include "mem.h" +#include "mtypes.h" +#include "simple_list.h" +#include "enums.h" +#include "texstore.h" +#include "texformat.h" +#include "swrast/swrast.h" +#include "context.h" +#include "via_context.h" +#include "via_tex.h" +#include "via_state.h" +#include "via_ioctl.h" + + +/* + * Compute the 'S2.4' lod bias factor from the floating point OpenGL bias. + */ +/* +static GLuint viaComputeLodBias(GLfloat bias) +{ + int b = (int)(bias * 16.0) + 12; + if (b > 63) + b = 63; + else if (b < -64) + b = -64; + return (GLuint)(b & MLC_LOD_BIAS_MASK); +} +*/ + +viaTextureObjectPtr viaAllocTextureObject(struct gl_texture_object *texObj) +{ + viaTextureObjectPtr t; + + t = (viaTextureObjectPtr)CALLOC_STRUCT(via_texture_object_t); + if (!t) + return NULL; + + /* Initialize non-image-dependent parts of the state: + */ + t->bufAddr = NULL; + t->dirtyImages = ~0; + t->actualLevel = 0; + t->globj = texObj; + make_empty_list(t); + + return t; +} + +static void viaTexParameter(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj, + GLenum pname, const GLfloat *params) +{ + viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; + if (!t) + return; + + if (target != GL_TEXTURE_2D) + return; +} + +static void viaTexEnv(GLcontext *ctx, GLenum target, + GLenum pname, const GLfloat *param) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + vmesa = vmesa; +} + +static void viaTexImage1D(GLcontext *ctx, GLenum target, GLint level, + GLint internalFormat, + GLint width, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaTexImage1D - in\n"); +#endif + if (t) { + if (level == 0) { + viaSwapOutTexObj(VIA_CONTEXT(ctx), t); + t->actualLevel = 0; + } + else + t->actualLevel++; + } + else { + t = viaAllocTextureObject(texObj); + if (!t) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "viaTexImage1D"); + return; + } + texObj->DriverData = t; + } + _mesa_store_teximage1d(ctx, target, level, internalFormat, + width, border, format, type, + pixels, packing, texObj, texImage); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaTexImage1D - out\n"); +#endif +} +static void viaTexSubImage1D(GLcontext *ctx, + GLenum target, + GLint level, + GLint xoffset, + GLsizei width, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) + +{ + viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; + + if (t) { + viaSwapOutTexObj(VIA_CONTEXT(ctx), t); + } + _mesa_store_texsubimage1d(ctx, target, level, xoffset, width, + format, type, pixels, packing, texObj, + texImage); + +} + + +static void viaTexImage2D(GLcontext *ctx, GLenum target, GLint level, + GLint internalFormat, + GLint width, GLint height, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaTexImage2D - in\n"); +#endif + if (t) { + if (level == 0) { + viaSwapOutTexObj(VIA_CONTEXT(ctx), t); + t->actualLevel = 0; + } + else + t->actualLevel++; + } + else { + t = viaAllocTextureObject(texObj); + if (!t) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "viaTexImage2D"); + return; + } + texObj->DriverData = t; + } + _mesa_store_teximage2d(ctx, target, level, internalFormat, + width, height, border, format, type, + pixels, packing, texObj, texImage); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaTexImage2D - out\n"); +#endif +} + +static void viaTexSubImage2D(GLcontext *ctx, + GLenum target, + GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + + viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; + + if (t) { + viaSwapOutTexObj(VIA_CONTEXT(ctx), t); + } + _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width, + height, format, type, pixels, packing, texObj, + texImage); + + if(vmesa->shareCtx) + vmesa->shareCtx->NewState |= _NEW_TEXTURE; + +} + +static void viaBindTexture(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaBindTexture - in\n"); +#endif + if (target == GL_TEXTURE_2D) { + viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; + + if (!t) { + + t = viaAllocTextureObject(texObj); + if (!t) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "viaBindTexture"); + return; + } + texObj->DriverData = t; + } + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaBindTexture - out\n"); +#endif +} + +static void viaDeleteTexture(GLcontext *ctx, struct gl_texture_object *texObj) +{ + viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaDeleteTexture - in\n"); +#endif + if (t) { + viaContextPtr vmesa = VIA_CONTEXT(ctx); + if (vmesa) { + VIA_FIREVERTICES(vmesa); + viaDestroyTexObj(vmesa, t); + } + texObj->DriverData = 0; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaDeleteTexture - out\n"); +#endif +} + +static GLboolean viaIsTextureResident(GLcontext *ctx, + struct gl_texture_object *texObj) +{ + viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; + + return t && t->bufAddr; +} + +static const struct gl_texture_format * +viaChooseTexFormat(GLcontext *ctx, GLint internalFormat, + GLenum format, GLenum type) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + (void)format; + (void)type; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); + if (VIA_DEBUG) fprintf(stderr, "internalFormat:%d format:%d\n", internalFormat, format); +#endif + switch (internalFormat) { + case 1: + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + return &_mesa_texformat_l8; + case 2: + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + return &_mesa_texformat_al88; + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "2 &_mesa_texformat_arg565\n"); +#endif + return &_mesa_texformat_rgb565; + case 3: + case GL_RGB: + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + if (vmesa->viaScreen->bitsPerPixel == 0x20) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr,"3 argb8888\n"); +#endif + return &_mesa_texformat_argb8888; + } + else { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr,"3 rgb565\n"); +#endif + return &_mesa_texformat_rgb565; + } + case 4: + if (vmesa->viaScreen->bitsPerPixel == 0x20) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "4 &_mesa_texformat_argb8888\n"); +#endif + return &_mesa_texformat_argb8888; + } + else { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "4 &_mesa_texformat_argb4444\n"); +#endif + return &_mesa_texformat_argb4444; + } + case GL_RGBA2: + case GL_RGBA4: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "GL_RGBA4 &_mesa_texformat_argb4444\n"); +#endif + return &_mesa_texformat_argb4444; + + case GL_RGB5_A1: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "GL_RGB5_A1 &_mesa_texformat_argb1555\n"); +#endif + return &_mesa_texformat_argb1555; + case GL_RGBA: + case GL_RGBA8: + case GL_RGBA12: + case GL_RGBA16: + case GL_RGB10_A2: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "GL_RGBA &_mesa_texformat_argb8888\n"); +#endif + return &_mesa_texformat_argb8888; + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + return &_mesa_texformat_a8; + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + return &_mesa_texformat_i8; + case GL_COLOR_INDEX: + case GL_COLOR_INDEX1_EXT: + case GL_COLOR_INDEX2_EXT: + case GL_COLOR_INDEX4_EXT: + case GL_COLOR_INDEX8_EXT: + case GL_COLOR_INDEX12_EXT: + case GL_COLOR_INDEX16_EXT: + return &_mesa_texformat_ci8; + default: + _mesa_problem(ctx, "unexpected format in viaChooseTextureFormat"); + return NULL; + } +} + +void viaInitTextureFuncs(GLcontext *ctx) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaInitTextureFuncs - in\n"); +#endif + ctx->Driver.TexEnv = viaTexEnv; + ctx->Driver.ChooseTextureFormat = viaChooseTexFormat; + ctx->Driver.TexImage1D = viaTexImage1D; + ctx->Driver.TexImage2D = viaTexImage2D; + ctx->Driver.TexImage3D = _mesa_store_teximage3d; + ctx->Driver.TexSubImage1D = viaTexSubImage1D; + ctx->Driver.TexSubImage2D = viaTexSubImage2D; + ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; + ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; + ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; + ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; + ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; + ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; + ctx->Driver.BindTexture = viaBindTexture; + ctx->Driver.DeleteTexture = viaDeleteTexture; + ctx->Driver.TexParameter = viaTexParameter; + ctx->Driver.UpdateTexturePalette = 0; + ctx->Driver.IsTextureResident = viaIsTextureResident; + ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; + + { + GLuint tmp = ctx->Texture.CurrentUnit; + ctx->Texture.CurrentUnit = 0; + viaBindTexture(ctx, GL_TEXTURE_1D, ctx->Texture.Unit[0].Current1D); + viaBindTexture(ctx, GL_TEXTURE_2D, ctx->Texture.Unit[0].Current2D); + ctx->Texture.CurrentUnit = 1; + viaBindTexture(ctx, GL_TEXTURE_1D, ctx->Texture.Unit[1].Current1D); + viaBindTexture(ctx, GL_TEXTURE_2D, ctx->Texture.Unit[1].Current2D); + ctx->Texture.CurrentUnit = tmp; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "viaInitTextureFuncs - out\n"); +#endif +} diff --git a/xc/lib/GL/mesa/src/drv/via/via_tex.h b/xc/lib/GL/mesa/src/drv/via/via_tex.h new file mode 100644 index 000000000..c2b46c902 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_tex.h @@ -0,0 +1,112 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +#ifndef _VIATEX_H +#define _VIATEX_H + +#include "mtypes.h" +#include "mmath.h" +#include "mm.h" + +#include "via_context.h" +#include "via_3d_reg.h" + +#define VIA_TEX_MAXLEVELS 10 + + +/* For shared texture space managment, these texture objects may also + * be used as proxies for regions of texture memory containing other + * client's textures. Such proxy textures (not to be confused with GL + * proxy textures) are subject to the same LRU aging we use for our + * own private textures, and thus we have a mechanism where we can + * fairly decide between kicking out our own textures and those of + * other clients. + * + * Non-local texture objects have a valid MemBlock to describe the + * region managed by the other client, and can be identified by + * 't->globj == 0' + */ +struct via_texture_object_t { + struct via_texture_object_t *next, *prev; + + GLuint age; + struct gl_texture_object *globj; + + int texelBytes; + int totalSize; + + struct { + GLuint index; + GLuint offset; + GLuint size; + } texMem; + unsigned char* bufAddr; + + GLuint inAGP; + GLuint needClearCache; + GLuint actualLevel; + + GLuint maxLevel; + GLuint dirtyImages; + + struct { + const struct gl_texture_image *image; + int offset; /* into bufAddr */ + int height; + int internalFormat; + } image[VIA_TEX_MAXLEVELS]; + + GLuint dirty; + + GLuint regTexFM; + GLuint regTexWidthLog2[2]; + GLuint regTexHeightLog2[2]; + GLuint regTexBaseH[4]; + struct { + GLuint baseL; + GLuint pitchLog2; + } regTexBaseAndPitch[12]; + + GLint firstLevel, lastLevel; /* upload tObj->Image[first .. lastLevel] */ +}; + +viaTextureObjectPtr viaAllocTextureObject(struct gl_texture_object *texObj); +void viaUpdateTextureState(GLcontext *ctx); +void viaInitTextureFuncs(GLcontext *ctx); + +void viaDestroyTexObj(viaContextPtr vmesa, viaTextureObjectPtr t); +void viaSwapOutTexObj(viaContextPtr vmesa, viaTextureObjectPtr t); +void viaUploadTexImages(viaContextPtr vmesa, viaTextureObjectPtr t); + +void viaResetGlobalLRU(viaContextPtr vmesa); +void viaTexturesGone(viaContextPtr vmesa, + GLuint start, GLuint end, + GLuint in_use); + +void viaPrintLocalLRU(viaContextPtr vmesa); +void viaPrintGlobalLRU(viaContextPtr vmesa); +void viaUpdateTexLRU(viaContextPtr vmesa, viaTextureObjectPtr t); + +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_texmem.c b/xc/lib/GL/mesa/src/drv/via/via_texmem.c new file mode 100644 index 000000000..b1e79bc90 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_texmem.c @@ -0,0 +1,499 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +#include <stdlib.h> +#include <stdio.h> + +#include "glheader.h" +#include "macros.h" +#include "mtypes.h" +#include "simple_list.h" +#include "enums.h" +#include "texformat.h" + +#include "mm.h" +#include "via_context.h" +#include "via_tex.h" +#include "via_state.h" +#include "via_ioctl.h" +#include "via_fb.h" +/*=* John Sheng [2003.5.31] agp tex *=*/ +GLuint agpFullCount = 0; + +void viaDestroyTexObj(viaContextPtr vmesa, viaTextureObjectPtr t) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (!t) + return; + + /* This is sad - need to sync *in case* we upload a texture + * to this newly free memory... + */ + if (t->bufAddr) { + via_free_texture(vmesa, t); + + if (vmesa && t->age > vmesa->dirtyAge) + vmesa->dirtyAge = t->age; + } + + if (t->globj) + t->globj->DriverData = 0; + + if (vmesa) { + if (vmesa->CurrentTexObj[0] == t) { + vmesa->CurrentTexObj[0] = 0; + vmesa->dirty &= ~VIA_UPLOAD_TEX0; + } + + if (vmesa->CurrentTexObj[1] == t) { + vmesa->CurrentTexObj[1] = 0; + vmesa->dirty &= ~VIA_UPLOAD_TEX1; + } + } + + remove_from_list(t); + free(t); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaSwapOutTexObj(viaContextPtr vmesa, viaTextureObjectPtr t) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (t->bufAddr) { + via_free_texture(vmesa, t); + + if (t->age > vmesa->dirtyAge) + vmesa->dirtyAge = t->age; + } + + t->dirtyImages = ~0; + move_to_tail(&(vmesa->SwappedOut), t); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +/* Upload an image from mesa's internal copy. + */ +static void viaUploadTexLevel(viaTextureObjectPtr t, int level) +{ + const struct gl_texture_image *image = t->image[level].image; + int i, j; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "%s - in\n", __FUNCTION__); + fprintf(stderr, "width = %d, height = %d \n", image->Width, image->Height); + } +#endif + switch (t->image[level].internalFormat) { + case GL_RGB: + { + if (image->TexFormat->MesaFormat == MESA_FORMAT_ARGB8888) { + GLuint *dst = (GLuint *)(t->bufAddr + t->image[level].offset); + GLuint *src = (GLuint *)image->Data; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "GL_RGB MESA_FORMAT_ARGB8888\n"); +#endif + if (image->Width < 8) { + for (i = 0; i < image->Height ; i++) { + for (j = 0; j < image->Width ; j++) { + dst[j] = *src; + src++; + } + dst += 8; + } + } + else { + for (j = 0; j < image->Height * image->Width; j++) { + *dst = *src; + dst++; + src++; + } + } + /*memcpy(dst, src, image->Height * image->Width * sizeof(GLuint));*/ + } + else { + GLushort *dst = (GLushort *)(t->bufAddr + t->image[level].offset); + GLushort *src = (GLushort *)image->Data; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "GL_RGB !MESA_FORMAT_ARGB8888\n"); +#endif + if (image->Width < 16) { + for (i = 0; i < image->Height ; i++) { + for (j = 0; j < image->Width ; j++) { + dst[j] = *src; + src++; + } + dst += 16; + } + } + else { + for (j = 0; j < image->Height * image->Width; j++) { + *dst = *src; + dst++; + src++; + } + } + /*memcpy(dst, src, image->Height * image->Width * sizeof(GLushort));*/ + } + } + break; + + case GL_RGBA: + { + if (image->TexFormat->MesaFormat == MESA_FORMAT_ARGB4444) { + + GLushort *dst = (GLushort *)(t->bufAddr + t->image[level].offset); + GLushort *src = (GLushort *)image->Data; + if (image->Width < 16) { + for (i = 0; i < image->Height ; i++) { + for (j = 0; j < image->Width ; j++) { + dst[j] = *src; + src++; + } + dst += 16; + } + } + else { + for (j = 0; j < image->Height * image->Width; j++) { + *dst = *src; + src++; + dst++; + } + } + /*memcpy(dst, src, image->Height * image->Width * sizeof(GLushort));*/ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "GL_RGBA MESA_FORMAT_ARGB4444\n"); +#endif + } + else if(image->TexFormat->MesaFormat == MESA_FORMAT_ARGB8888) { + GLuint *dst = (GLuint *)(t->bufAddr + t->image[level].offset); + GLuint *src = (GLuint *)image->Data; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "GL_RGBA !MESA_FORMAT_ARGB4444\n"); +#endif + if (image->Width < 8) { + for (i = 0; i < image->Height ; i++) { + for (j = 0; j < image->Width ; j++) { + dst[j] = *src; + src++; + } + dst += 8; + } + } + else { + for (j = 0; j < image->Height * image->Width; j++) { + *dst = *src; + dst++; + src++; + } + } + /*memcpy(dst, src, image->Height * image->Width * sizeof(GLuint));*/ + } + else if(image->TexFormat->MesaFormat == MESA_FORMAT_ARGB1555) { + GLushort *dst = (GLushort *)(t->bufAddr + t->image[level].offset); + GLushort *src = (GLushort *)image->Data; + if (image->Width < 16) { + for (i = 0; i < image->Height ; i++) { + for (j = 0; j < image->Width ; j++) { + dst[j] = *src; + src++; + } + dst += 16; + } + } + else { + for (j = 0; j < image->Height * image->Width; j++) { + *dst = *src; + src++; + dst++; + } + } + /*memcpy(dst, src, image->Height * image->Width * sizeof(GLushort));*/ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "GL_RGBA MESA_FORMAT_ARGB1555\n"); +#endif + } + } + break; + + case GL_LUMINANCE: + { + GLubyte *dst = (GLubyte *)(t->bufAddr + t->image[level].offset); + GLubyte *src = (GLubyte *)image->Data; + + for (j = 0; j < image->Height * image->Width; j++) { + *dst = *src; + dst++; + src++; + } + } + break; + + case GL_INTENSITY: + { + GLubyte *dst = (GLubyte *)(t->bufAddr + t->image[level].offset); + GLubyte *src = (GLubyte *)image->Data; + + for (j = 0; j < image->Height * image->Width; j++) { + *dst = *src; + dst++; + src++; + } + } + break; + + case GL_LUMINANCE_ALPHA: + { + GLushort *dst = (GLushort *)(t->bufAddr + t->image[level].offset); + GLushort *src = (GLushort *)image->Data; + + for (j = 0; j < image->Height * image->Width; j++) { + *dst = *src; + dst++; + src++; + } + } + break; + + case GL_ALPHA: + { + GLubyte *dst = (GLubyte *)(t->bufAddr + t->image[level].offset); + GLubyte *src = (GLubyte *)image->Data; + + for (j = 0; j < image->Height * image->Width; j++) { + *dst = *src; + dst++; + src++; + } + } + break; + + /* TODO: Translate color indices *now*: + */ + case GL_COLOR_INDEX: + { + GLubyte *dst = (GLubyte *)(t->bufAddr + t->image[level].offset); + GLubyte *src = (GLubyte *)image->Data; + + for (j = 0; j < image->Height * image->Width; j++) { + *dst = *src; + dst++; + src++; + } + } + break; + + default: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Not supported texture format %s\n", + _mesa_lookup_enum_by_nr(image->Format)); +#endif + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaPrintLocalLRU(viaContextPtr vmesa) +{ + viaTextureObjectPtr t; + + foreach (t, &vmesa->TexObjList) { + if (!t->globj) { +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "offset = %x, index = %x, size = %x\n", + t->texMem.offset, + t->texMem.index, + t->texMem.size); + } + else { + if (VIA_DEBUG) { + fprintf(stderr, "offset = %x, siez = %x\n", + t->texMem.offset, + t->texMem.size); + } + } +#endif + } + } +} + +void viaPrintGlobalLRU(viaContextPtr vmesa) +{ + int i, j; + drm_via_tex_region_t *list = vmesa->sarea->texList; + + for (i = 0, j = VIA_NR_TEX_REGIONS; i < VIA_NR_TEX_REGIONS; i++) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "list[%d] age %d next %d prev %d\n", + j, list[j].age, list[j].next, list[j].prev); +#endif + j = list[j].next; + if (j == VIA_NR_TEX_REGIONS) break; + } +#ifdef DEBUG + if (j != VIA_NR_TEX_REGIONS) + if (VIA_DEBUG) fprintf(stderr, "Loop detected in global LRU\n"); +#endif +} + +void viaResetGlobalLRU(viaContextPtr vmesa) +{ + drm_via_tex_region_t *list = vmesa->sarea->texList; + int sz = 1 << vmesa->viaScreen->logTextureGranularity; + int i; + + /* (Re)initialize the global circular LRU list. The last element + * in the array (VIA_NR_TEX_REGIONS) is the sentinal. Keeping it + * at the end of the array allows it to be addressed rationally + * when looking up objects at a particular location in texture + * memory. + */ + for (i = 0; (i + 1) * sz <= vmesa->viaScreen->textureSize; i++) { + list[i].prev = i - 1; + list[i].next = i + 1; + list[i].age = 0; + } + + i--; + list[0].prev = VIA_NR_TEX_REGIONS; + list[i].prev = i - 1; + list[i].next = VIA_NR_TEX_REGIONS; + list[VIA_NR_TEX_REGIONS].prev = i; + list[VIA_NR_TEX_REGIONS].next = 0; + vmesa->sarea->texAge = 0; +} + +void viaUpdateTexLRU(viaContextPtr vmesa, viaTextureObjectPtr t) +{ + vmesa->texAge = ++vmesa->sarea->texAge; + move_to_head(&(vmesa->TexObjList), t); +} + +/* Called for every shared texture region which has increased in age + * since we last held the lock. + * + * Figures out which of our textures have been ejected by other clients, + * and pushes a placeholder texture onto the LRU list to represent + * the other client's textures. + */ +void viaTexturesGone(viaContextPtr vmesa, + GLuint offset, + GLuint size, + GLuint inUse) +{ + viaTextureObjectPtr t, tmp; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + foreach_s (t, tmp, &vmesa->TexObjList) { + viaSwapOutTexObj(vmesa, t); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +/* This is called with the lock held. May have to eject our own and/or + * other client's texture objects to make room for the upload. + */ +void viaUploadTexImages(viaContextPtr vmesa, viaTextureObjectPtr t) +{ + int i, j; + int numLevels; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + LOCK_HARDWARE(vmesa); + + j = 0; + if (!t->bufAddr) { + while (1) { + + /*=* John Sheng [2003.5.31] agp tex *=*/ + via_alloc_texture(vmesa, t); + /*via_alloc_texture_agp(vmesa, t);*/ + + if (t->texMem.offset) + break; + else + agpFullCount++; + + if (vmesa->TexObjList.prev == vmesa->CurrentTexObj[0] || + vmesa->TexObjList.prev == vmesa->CurrentTexObj[1]) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Hit bound texture in upload\n"); +#endif + viaPrintLocalLRU(vmesa); + UNLOCK_HARDWARE(vmesa); + return; + } + + if (vmesa->TexObjList.prev == &(vmesa->TexObjList)) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Failed to upload texture, sz %d\n", t->totalSize); +#endif + mmDumpMemInfo(vmesa->texHeap); + UNLOCK_HARDWARE(vmesa); + return; + } + + viaSwapOutTexObj(vmesa, vmesa->TexObjList.prev); + } + /*=* John Sheng [2003.5.31] agp tex *=*/ + /*t->bufAddr = (char *)((GLuint)vmesa->driScreen->pFB + t->texMem.offset);*/ + + if (t == vmesa->CurrentTexObj[0]) + VIA_STATECHANGE(vmesa, VIA_UPLOAD_TEX0); + + if (t == vmesa->CurrentTexObj[1]) + VIA_STATECHANGE(vmesa, VIA_UPLOAD_TEX1); + + viaUpdateTexLRU(vmesa, t); + + j++; + } + + numLevels = t->lastLevel - t->firstLevel + 1; + + for (i = 0; i < numLevels; i++) + if (t->dirtyImages & (1 << i)) + viaUploadTexLevel(t, i); + + t->dirtyImages = 0; + + UNLOCK_HARDWARE(vmesa); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} diff --git a/xc/lib/GL/mesa/src/drv/via/via_texstate.c b/xc/lib/GL/mesa/src/drv/via/via_texstate.c new file mode 100644 index 000000000..dfb17eecd --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_texstate.c @@ -0,0 +1,721 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +#include <stdlib.h> +#include <stdio.h> + +#include "glheader.h" +#include "macros.h" +#include "mtypes.h" +#include "simple_list.h" +#include "enums.h" +#include "context.h" +#include "texformat.h" + +#include "mm.h" +#include "via_context.h" +#include "via_tex.h" +#include "via_state.h" +#include "via_ioctl.h" + +GLint texSize8bpp[12][12] = { + {32,32,32,32,32,32,64,128,256,512,1024,2048}, + {64,64,64,64,64,64,128,256,512,1024,2048,4096}, + {128,128,128,128,128,128,256,512,1024,2048,4096,8192}, + {256,256,256,256,256,256,512,1024,2048,4096,8192,16384}, + {512,512,512,512,512,512,1024,2048,4096,8192,16384,32768}, + {1024,1024,1024,1024,1024,1024,2048,4096,8192,16384,32768,65536}, + {2048,2048,2048,2048,2048,2048,4096,8192,16384,32768,65536,131072}, + {4096,4096,4096,4096,4096,4096,8192,16384,32768,65536,131072,262144}, + {8192,8192,8192,8192,8192,8192,16384,32768,65536,131072,262144,524288}, + {16384,16384,16384,16384,16384,16384,32768,65536,131072,262144,524288,1048576}, + {32768,32768,32768,32768,32768,32768,65536,131072,262144,524288,1048576,2097152}, + {65536,65536,65536,65536,65536,65536,131072,262144,524288,1048576,2097152,4194304 +} +}; + +GLint texSize16bpp[12][12] = { + {32,32,32,32,32,64,128,256,512,1024,2048,4096}, + {64,64,64,64,64,128,256,512,1024,2048,4096,8192}, + {128,128,128,128,128,256,512,1024,2048,4096,8192,16384}, + {256,256,256,256,256,512,1024,2048,4096,8192,16384,32768}, + {512,512,512,512,512,1024,2048,4096,8192,16384,32768,65536}, + {1024,1024,1024,1024,1024,2048,4096,8192,16384,32768,65536,131072}, + {2048,2048,2048,2048,2048,4096,8192,16384,32768,65536,131072,262144}, + {4096,4096,4096,4096,4096,8192,16384,32768,65536,131072,262144,524288}, + {8192,8192,8192,8192,8192,16384,32768,65536,131072,262144,524288,1048576}, + {16384,16384,16384,16384,16384,32768,65536,131072,262144,524288,1048576,2097152}, + {32768,32768,32768,32768,32768,65536,131072,262144,524288,1048576,2097152,4194304}, + {65536,65536,65536,65536,65536,131072,262144,524288,1048576,2097152,4194304,8388608} +}; + +GLint texSize32bpp[12][12] = { + {32,32,32,32,64,128,256,512,1024,2048,4096,8192}, + {64,64,64,64,128,256,512,1024,2048,4096,8192,16384}, + {128,128,128,128,256,512,1024,2048,4096,8192,16384,32768}, + {256,256,256,256,512,1024,2048,4096,8192,16384,32768,65536}, + {512,512,512,512,1024,2048,4096,8192,16384,32768,65536,131072}, + {1024,1024,1024,1024,2048,4096,8192,16384,32768,65536,131072,262144}, + {2048,2048,2048,2048,4096,8192,16384,32768,65536,131072,262144,524288}, + {4096,4096,4096,4096,8192,16384,32768,65536,131072,262144,524288,1048576}, + {8192,8192,8192,8192,16384,32768,65536,131072,262144,524288,1048576,2097152}, + {16384,16384,16384,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304}, + {32768,32768,32768,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608}, + {65536,65536,65536,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216} +}; + +GLint mipmapTexSize8bpp[12][12] = { + {32,64,96,128,160,192,256,384,640,1152,2176,4224}, + {96,96,128,160,192,224,320,512,896,1664,3200,6272}, + {224,224,224,256,288,320,480,832,1536,2944,5760,11392}, + {480,480,480,480,512,544,832,1504,2880,5632,11136,22144}, + {992,992,992,992,992,1024,1568,2880,5600,11072,22016,43904}, + {2016,2016,2016,2016,2016,2016,3072,5664,11072,21984,43840,87552}, + {4064,4064,4064,4064,4064,4064,6112,11264,22048,43840,87520,174912}, + {8160,8160,8160,8160,8160,8160,12256,22496,44032,87584,174912,349664}, + {16352,16352,16352,16352,16352,16352,24544,45024,88032,175104,349728,699200}, + {32736,32736,32736,32736,32736,32736,49120,90080,176096,350176,699392,1398304}, + {65504,65504,65504,65504,65504,65504,98272,180192,352224,700384,1398752,2796544}, + {131040,131040,131040,131040,131040,131040,196576,360416,704480,1400800,2797536,5593056 +} +}; + +GLint mipmapTexSize16bpp[12][12] = { + {32,64,96,128,160,224,352,608,1120,2144,4192,8288}, + {96,96,128,160,192,288,480,864,1632,3168,6240,12384}, + {224,224,224,256,288,448,800,1504,2912,5728,11360,22624}, + {480,480,480,480,512,800,1472,2848,5600,11104,22112,44128}, + {992,992,992,992,992,1536,2848,5568,11040,21984,43872,87648}, + {2016,2016,2016,2016,2016,3040,5632,11040,21952,43808,87520,174944}, + {4064,4064,4064,4064,4064,6112,11232,22016,43808,87488,174880,349664}, + {8160,8160,8160,8160,8160,12256,22496,44000,87552,174880,349632,699168}, + {16352,16352,16352,16352,16352,24544,45024,88032,175072,349696,699168,1398208}, + {32736,32736,32736,32736,32736,49120,90080,176096,350176,699360,1398272,2796320}, + {65504,65504,65504,65504,65504,98272,180192,352224,700384,1398752,2796512,5592576}, + {131040,131040,131040,131040,131040,196576,360416,704480,1400800,2797536,5593056,11185120} +}; + +GLint mipmapTexSize32bpp[12][12] = { + {32,64,96,128,192,320,576,1088,2112,4160,8256,16448}, + {96,96,128,160,256,448,832,1600,3136,6208,12352,24640}, + {224,224,224,256,416,768,1472,2880,5696,11328,22592,45120}, + {480,480,480,480,768,1440,2816,5568,11072,22080,44096,88128}, + {992,992,992,992,1504,2816,5536,11008,21952,43840,87616,175168}, + {2016,2016,2016,2016,3040,5600,11008,21920,43776,87488,174912,349760}, + {4064,4064,4064,4064,6112,11232,21984,43776,87456,174848,349632,699200}, + {8160,8160,8160,8160,12256,22496,44000,87520,174848,349600,699136,1398208}, + {16352,16352,16352,16352,24544,45024,88032,175072,349664,699136,1398176,2796288}, + {32736,32736,32736,32736,49120,90080,176096,350176,699360,1398240,2796288,5592480}, + {65504,65504,65504,65504,98272,180192,352224,700384,1398752,2796512,5592544,11184896}, + {131040,131040,131040,131040,196576,360416,704480,1400800,2797536,5593056,11185120,22369760} +}; + +static int logbase2(int n) +{ + GLint i = 1; + GLint log2 = 0; + + if (n < 0) { + return -1; + } + + while (n > i) { + i *= 2; + log2++; + } + + if (i != n) { + return -1; + } + else { + return log2; + } +} + +static void viaSetTexImages(viaContextPtr vmesa, + struct gl_texture_object *tObj) +{ + GLuint texFormat; + viaTextureObjectPtr t = (viaTextureObjectPtr)tObj->DriverData; + const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel]; + GLint firstLevel, lastLevel, numLevels; + GLint log2Width, log2Height, log2Pitch; + GLint (*texSize)[12][12]; + GLint w, h, p; + GLint i, j, k, l, m; + GLint mipmapSize; + GLuint texBase; + GLuint basH = 0; + GLuint widthExp = 0; + GLuint heightExp = 0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + switch (baseImage->TexFormat->MesaFormat) { + case MESA_FORMAT_ARGB8888: + if (t->image[tObj->BaseLevel].internalFormat == GL_RGB) + texFormat = HC_HTXnFM_ARGB0888; + else + texFormat = HC_HTXnFM_ARGB8888; + break; + case MESA_FORMAT_ARGB4444: + texFormat = HC_HTXnFM_ARGB4444; + break; + case MESA_FORMAT_RGB565: + texFormat = HC_HTXnFM_RGB565; + break; + case MESA_FORMAT_ARGB1555: + texFormat = HC_HTXnFM_ARGB1555; + break; + case MESA_FORMAT_L8: + texFormat = HC_HTXnFM_L8; + break; + case MESA_FORMAT_I8: + texFormat = HC_HTXnFM_T8; + break; + case MESA_FORMAT_CI8: + texFormat = HC_HTXnFM_Index8; + break; + case MESA_FORMAT_AL88: + texFormat = HC_HTXnFM_AL88; + break; + default: + _mesa_problem(vmesa->glCtx, "Bad texture format in viaSetTexImages"); + fprintf(stderr, "-- TexFormat = %d\n",baseImage->TexFormat->MesaFormat); + }; + + /* Compute which mipmap levels we really want to send to the hardware. + * This depends on the base image size, GL_TEXTURE_MIN_LOD, + * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. + * Yes, this looks overly complicated, but it's all needed. + */ + if (tObj->MinFilter == GL_LINEAR || tObj->MinFilter == GL_NEAREST) { + firstLevel = lastLevel = tObj->BaseLevel; + } + else { + firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5); + firstLevel = MAX2(firstLevel, tObj->BaseLevel); + lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); + lastLevel = MAX2(lastLevel, tObj->BaseLevel); + lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2); + lastLevel = MIN2(lastLevel, tObj->MaxLevel); + lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ + } + + /* save these values */ + t->firstLevel = firstLevel; + t->lastLevel = lastLevel; + + numLevels = lastLevel - firstLevel + 1; + + /*=* [DBG] fgfs : fix mipmap level 11 over hw limitations and result in segmentation fault *=*/ + if(numLevels > 10) { + numLevels = 10; + t->lastLevel = firstLevel + 9; + } + + log2Width = tObj->Image[firstLevel]->WidthLog2; + log2Height = tObj->Image[firstLevel]->HeightLog2; + log2Pitch = logbase2(tObj->Image[firstLevel]->Width * baseImage->TexFormat->TexelBytes); + + + for (i = 0; i < numLevels; i++) { + t->image[i].image = tObj->Image[i]; + t->image[i].internalFormat = baseImage->Format; + } + + if (baseImage->TexFormat->TexelBytes == 1) { + if (numLevels > 1) + texSize = &mipmapTexSize8bpp; + else + texSize = &texSize8bpp; + } + else if (baseImage->TexFormat->TexelBytes == 2) { + if (numLevels > 1) + texSize = &mipmapTexSize16bpp; + else + texSize = &texSize16bpp; + } + else { + if (numLevels > 1) + texSize = &mipmapTexSize32bpp; + else + texSize = &texSize32bpp; + } + t->totalSize = (*texSize)[log2Height][log2Width]; + t->texMem.size = t->totalSize; + t->maxLevel = i - 1; + t->dirty = VIA_UPLOAD_TEX0 | VIA_UPLOAD_TEX1; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "log2Width = %d\n", log2Width); + fprintf(stderr, "log2Height = %d\n", log2Height); + fprintf(stderr, "log2Pitch = %d\n", log2Pitch); + fprintf(stderr, "bytePerTexel = %d\n", baseImage->TexFormat->TexelBytes); + fprintf(stderr, "total size = %d\n", t->totalSize); + fprintf(stderr, "actual level = %d\n", t->actualLevel); + fprintf(stderr, "numlevel = %d\n", numLevels); + } +#endif + + { + w = log2Width; + h = log2Height; + for (i = 0; i < numLevels; i++) { + t->image[i].offset = t->totalSize - (*texSize)[h][w]; + if (w) w--; + if (h) h--; + } + } + + viaUploadTexImages(vmesa, t); + + if (t->bufAddr) { + if (t->inAGP) + t->regTexFM = (HC_SubA_HTXnFM << 24) | HC_HTXnLoc_AGP | texFormat; + else + t->regTexFM = (HC_SubA_HTXnFM << 24) | HC_HTXnLoc_Local | texFormat; + + w = log2Width; + h = log2Height; + p = log2Pitch; + mipmapSize = 0; + + for (i = 0; i < numLevels; i++) { + if (i == (numLevels - 1)) + mipmapSize = 0; + else + mipmapSize = (*texSize)[h][w]; + + /*=* John Sheng [2003.5.31] agp tex *=*/ + if (t->inAGP) + texBase = (GLuint)vmesa->agpBase + t->texMem.offset + t->image[i].offset; + else + texBase = t->texMem.offset + t->image[i].offset; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "texmem offset = %x\n", t->texMem.offset); + fprintf(stderr, "mipmap%d addr = %x\n", i, t->image[i].offset); + fprintf(stderr, "mipmap%d size = %d, h = %d, w = %d\n", i, (*texSize)[h][w], h, w); + fprintf(stderr, "texBase%d = %x\n", i, texBase); + } +#endif + t->regTexBaseAndPitch[i].baseL = ((HC_SubA_HTXnL0BasL + i) << 24) | (texBase & 0xFFFFFF); + + if (p < 5) { + t->regTexBaseAndPitch[i].pitchLog2 = ((HC_SubA_HTXnL0Pit + i) << 24) | + (0x5 << 20); + } + else { + t->regTexBaseAndPitch[i].pitchLog2 = ((HC_SubA_HTXnL0Pit + i) << 24) | + ((GLuint)p << 20); + } + j = i / 3; + k = 3 - (i % 3); + basH |= ((texBase & 0xFF000000) >> (k << 3)); + if (k == 1) { + t->regTexBaseH[j] = ((j + HC_SubA_HTXnL012BasH) << 24) | basH; + basH = 0; + } + + l = i / 6; + m = i % 6; + widthExp |= (((GLuint)w & 0xF) << (m << 2)); + heightExp |= (((GLuint)h & 0xF) << (m << 2)); + if (m == 5) { + t->regTexWidthLog2[l] = ((l + HC_SubA_HTXnL0_5WE) << 24 | widthExp); + t->regTexHeightLog2[l] = ((l + HC_SubA_HTXnL0_5HE) << 24 | heightExp); + widthExp = 0; + heightExp = 0; + } + if (w) w--; + if (h) h--; + if (p) p--; + } + + if (k != 1) { + t->regTexBaseH[j] = ((j + HC_SubA_HTXnL012BasH) << 24) | basH; + } + if (m != 5) { + t->regTexWidthLog2[l] = ((l + HC_SubA_HTXnL0_5WE) << 24 | widthExp); + t->regTexHeightLog2[l] = ((l + HC_SubA_HTXnL0_5HE) << 24 | heightExp); + } + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +/* ================================================================ + * Texture combine functions + */ +#define VIA_DISABLE 0 +#define VIA_PASSTHRU 1 +#define VIA_REPLACE 2 +#define VIA_MODULATE 3 +#define VIA_DECAL 4 +#define VIA_BLEND 5 +#define VIA_ALPHA_BLEND 6 +#define VIA_ADD 7 +#define VIA_MAX_COMBFUNC 8 + +static GLuint via_color_combine[][VIA_MAX_COMBFUNC] = +{ + /* Unit 0: + */ + { + /* Disable combiner stage + */ + 0, + + /* Passthru + */ + 1, + + /* GL_REPLACE + */ + 2, + + /* GL_MODULATE + */ + 3, + + /* GL_DECAL + */ + 4, + + /* GL_BLEND + */ + 5, + + /* GL_BLEND according to alpha + */ + 6, + + /* GL_ADD + */ + 7, + }, + + /* Unit 1: + */ + { + /* Disable combiner stage (Note: disables all subsequent stages) + */ + 0, + + /* Passthru + */ + 1, + + /* GL_REPLACE + */ + 2, + + /* GL_MODULATE + */ + 3, + + /* GL_DECAL + */ + 4, + + /* GL_BLEND + */ + 5, + + /* GL_BLEND according to alpha + */ + 6, + + /* GL_ADD + */ + 7, + } +}; + +static GLuint via_alpha_combine[][VIA_MAX_COMBFUNC] = +{ + /* Unit 0: + */ + { + /* Disable combiner stage + */ + 0, + + /* Passthru + */ + 1, + + /* GL_REPLACE + */ + 2, + + /* GL_MODULATE + */ + 3, + + /* GL_DECAL + */ + 4, + + /* GL_BLEND + */ + 5, + + /* GL_BLEND according to alpha (same as above) + */ + 6, + + /* GL_ADD + */ + 7, + }, + + /* Unit 1: + */ + { + /* Disable combiner stage + */ + 0, + + /* Passthru + */ + 1, + + /* GL_REPLACE + */ + 2, + + /* GL_MODULATE + */ + 3, + + /* GL_DECAL + */ + 4, + + /* GL_BLEND + */ + 5, + + /* GL_BLEND according to alpha (same as above) + */ + 6, + + /* GL_ADD + */ + 7, + } +}; + +static void viaUpdateTexEnv(GLcontext *ctx, GLuint unit) +{ + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + const struct gl_texture_object *tObj = texUnit->_Current; + const GLuint format = tObj->Image[tObj->BaseLevel]->Format; + GLuint color_combine, alpha_combine; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + switch (texUnit->EnvMode) { + case GL_REPLACE: + if (format == GL_ALPHA) { + color_combine = via_color_combine[unit][VIA_PASSTHRU]; + alpha_combine = via_alpha_combine[unit][VIA_REPLACE]; + } + else if (format == GL_LUMINANCE || format == GL_RGB) { + color_combine = via_color_combine[unit][VIA_REPLACE]; + alpha_combine = via_alpha_combine[unit][VIA_PASSTHRU]; + } + else { + color_combine = via_color_combine[unit][VIA_REPLACE]; + alpha_combine = via_alpha_combine[unit][VIA_REPLACE]; + } + break; + + case GL_MODULATE: + if (format == GL_ALPHA) { + color_combine = via_color_combine[unit][VIA_PASSTHRU]; + alpha_combine = via_alpha_combine[unit][VIA_MODULATE]; + } + else { + color_combine = via_color_combine[unit][VIA_MODULATE]; + alpha_combine = via_alpha_combine[unit][VIA_MODULATE]; + } + break; + + case GL_DECAL: + switch (format) { + case GL_RGBA: + color_combine = via_color_combine[unit][VIA_ALPHA_BLEND]; + alpha_combine = via_alpha_combine[unit][VIA_PASSTHRU]; + break; + case GL_RGB: + color_combine = via_color_combine[unit][VIA_REPLACE]; + alpha_combine = via_alpha_combine[unit][VIA_PASSTHRU]; + break; + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + color_combine = via_color_combine[unit][VIA_PASSTHRU]; + alpha_combine = via_alpha_combine[unit][VIA_PASSTHRU]; + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_BLEND: + switch (format) { + case GL_RGB: + case GL_LUMINANCE: + color_combine = via_color_combine[unit][VIA_BLEND]; + alpha_combine = via_alpha_combine[unit][VIA_PASSTHRU]; + break; + case GL_RGBA: + case GL_LUMINANCE_ALPHA: + color_combine = via_color_combine[unit][VIA_BLEND]; + alpha_combine = via_alpha_combine[unit][VIA_MODULATE]; + break; + case GL_ALPHA: + color_combine = via_color_combine[unit][VIA_PASSTHRU]; + alpha_combine = via_alpha_combine[unit][VIA_MODULATE]; + break; + case GL_INTENSITY: + color_combine = via_color_combine[unit][VIA_BLEND]; + alpha_combine = via_alpha_combine[unit][VIA_BLEND]; + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_ADD: + switch (format) { + case GL_RGB: + case GL_LUMINANCE: + color_combine = via_color_combine[unit][VIA_ADD]; + alpha_combine = via_alpha_combine[unit][VIA_PASSTHRU]; + break; + case GL_RGBA: + case GL_LUMINANCE_ALPHA: + color_combine = via_color_combine[unit][VIA_ADD]; + alpha_combine = via_alpha_combine[unit][VIA_MODULATE]; + break; + case GL_ALPHA: + color_combine = via_color_combine[unit][VIA_PASSTHRU]; + alpha_combine = via_alpha_combine[unit][VIA_MODULATE]; + break; + case GL_INTENSITY: + color_combine = via_color_combine[unit][VIA_ADD]; + alpha_combine = via_alpha_combine[unit][VIA_ADD]; + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + default: + return; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void viaUpdateTexUnit(GLcontext *ctx, GLuint unit) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (texUnit->_ReallyEnabled) { + struct gl_texture_object *tObj = texUnit->_Current; + viaTextureObjectPtr t = (viaTextureObjectPtr)tObj->DriverData; + + /* Upload teximages (not pipelined) + */ + if (t->dirtyImages) { + VIA_FIREVERTICES(vmesa); + viaSetTexImages(vmesa, tObj); + if (!t->bufAddr) { + FALLBACK(vmesa, VIA_FALLBACK_TEXTURE, GL_TRUE); + return; + } + } + + if (tObj->Image[tObj->BaseLevel]->Border > 0) { + FALLBACK(vmesa, VIA_FALLBACK_TEXTURE, GL_TRUE); + return; + } + + /* Update state if this is a different texture object to last + * time. + */ + if (vmesa->CurrentTexObj[unit] != t) { + VIA_STATECHANGE(vmesa, (VIA_UPLOAD_TEX0 << unit)); + vmesa->CurrentTexObj[unit] = t; + viaUpdateTexLRU(vmesa, t); /* done too often */ + } + + /* Update texture environment if texture object image format or + * texture environment state has changed. + */ + if (tObj->Image[tObj->BaseLevel]->Format != vmesa->TexEnvImageFmt[unit]) { + vmesa->TexEnvImageFmt[unit] = tObj->Image[tObj->BaseLevel]->Format; + viaUpdateTexEnv(ctx, unit); + } + } + else { + vmesa->CurrentTexObj[unit] = 0; + vmesa->TexEnvImageFmt[unit] = 0; + vmesa->dirty &= ~(VIA_UPLOAD_TEX0 << unit); + VIA_STATECHANGE(vmesa, VIA_UPLOAD_CTX); + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaUpdateTextureState(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + FALLBACK(vmesa, VIA_FALLBACK_TEXTURE, GL_FALSE); + viaUpdateTexUnit(ctx, 0); + viaUpdateTexUnit(ctx, 1); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + diff --git a/xc/lib/GL/mesa/src/drv/via/via_tris.c b/xc/lib/GL/mesa/src/drv/via/via_tris.c new file mode 100644 index 000000000..670518ffc --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_tris.c @@ -0,0 +1,1704 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> +#include <math.h> + +#include "glheader.h" +#include "context.h" +#include "mtypes.h" +#include "macros.h" +#include "colormac.h" + +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" +#include "tnl/t_context.h" +#include "tnl/t_pipeline.h" + +#include "via_context.h" +#include "via_tris.h" +#include "via_state.h" +#include "via_vb.h" +#include "via_ioctl.h" + +static void viaRenderPrimitive(GLcontext *ctx, GLenum prim); +GLuint RasterCounter = 0; +extern GLuint idle; +extern GLuint busy; +/*********************************************************************** + * Emit primitives as inline vertices * + ***********************************************************************/ + +#if defined(USE_X86_ASM) +#define COPY_DWORDS(j, vb, vertsize, v) \ + do { \ + int __tmp; \ + __asm__ __volatile__("rep ; movsl" \ + : "=%c" (j), "=D" (vb), "=S" (__tmp) \ + : "0" (vertsize), \ + "D" ((long)vb), \ + "S" ((long)v)); \ + } while (0) +#else +#define COPY_DWORDS(j, vb, vertsize, v) \ + do { \ + for (j = 0; j < vertsize; j++) \ + vb[j] = ((GLuint *)v)[j]; \ + vb += vertsize; \ + } while (0) +#endif + +static void __inline__ via_draw_triangle(viaContextPtr vmesa, + viaVertexPtr v0, + viaVertexPtr v1, + viaVertexPtr v2) +{ + GLuint vertsize = vmesa->vertexSize; + GLuint *vb = viaCheckDma(vmesa, 3 * 4 * vertsize); + int j; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + COPY_DWORDS(j, vb, vertsize, v0); + COPY_DWORDS(j, vb, vertsize, v1); + COPY_DWORDS(j, vb, vertsize, v2); + vmesa->dmaLow += 3 * 4 * vertsize; + vmesa->primitiveRendered = GL_TRUE; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +static void __inline__ via_draw_quad(viaContextPtr vmesa, + viaVertexPtr v0, + viaVertexPtr v1, + viaVertexPtr v2, + viaVertexPtr v3) +{ + GLuint vertsize = vmesa->vertexSize; + GLuint *vb = viaCheckDma(vmesa, 6 * 4 * vertsize); + int j; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + COPY_DWORDS(j, vb, vertsize, v0); + COPY_DWORDS(j, vb, vertsize, v1); + COPY_DWORDS(j, vb, vertsize, v3); + COPY_DWORDS(j, vb, vertsize, v1); + COPY_DWORDS(j, vb, vertsize, v2); + COPY_DWORDS(j, vb, vertsize, v3); + vmesa->dmaLow += 6 * 4 * vertsize; + vmesa->primitiveRendered = GL_TRUE; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +static __inline__ void via_draw_point(viaContextPtr vmesa, + viaVertexPtr v0) +{ + /*GLfloat sz = vmesa->glCtx->Point._Size * .5;*/ + int vertsize = vmesa->vertexSize; + /*GLuint *vb = viaCheckDma(vmesa, 2 * 4 * vertsize);*/ + GLuint *vb = viaCheckDma(vmesa, 4 * vertsize); + int j; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + COPY_DWORDS(j, vb, vertsize, v0); + vmesa->dmaLow += 4 * vertsize; + vmesa->primitiveRendered = GL_TRUE; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +static __inline__ void via_draw_line(viaContextPtr vmesa, + viaVertexPtr v0, + viaVertexPtr v1) +{ + GLuint vertsize = vmesa->vertexSize; + GLuint *vb = viaCheckDma(vmesa, 2 * 4 * vertsize); + int j; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + COPY_DWORDS(j, vb, vertsize, v0); + COPY_DWORDS(j, vb, vertsize, v1); + vmesa->dmaLow += 2 * 4 * vertsize; + vmesa->primitiveRendered = GL_TRUE; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +/*********************************************************************** + * Macros for via_dd_tritmp.h to draw basic primitives * + ***********************************************************************/ + +#define TRI(a, b, c) \ + do { \ + if (VIA_DEBUG) fprintf(stderr, "hw TRI\n"); \ + if (DO_FALLBACK) \ + vmesa->drawTri(vmesa, a, b, c); \ + else \ + via_draw_triangle(vmesa, a, b, c); \ + } while (0) + +#define QUAD(a, b, c, d) \ + do { \ + if (VIA_DEBUG) fprintf(stderr, "hw QUAD\n");\ + if (DO_FALLBACK) { \ + vmesa->drawTri(vmesa, a, b, d); \ + vmesa->drawTri(vmesa, b, c, d); \ + } \ + else \ + via_draw_quad(vmesa, a, b, c, d); \ + } while (0) + +#define LINE(v0, v1) \ + do { \ + if (VIA_DEBUG) fprintf(stderr, "hw LINE\n");\ + if (DO_FALLBACK) \ + vmesa->drawLine(vmesa, v0, v1); \ + else \ + via_draw_line(vmesa, v0, v1); \ + } while (0) + +#define POINT(v0) \ + do { \ + if (VIA_DEBUG) fprintf(stderr, "hw POINT\n");\ + if (DO_FALLBACK) \ + vmesa->drawPoint(vmesa, v0); \ + else \ + via_draw_point(vmesa, v0); \ + } while (0) + + +/*********************************************************************** + * Build render functions from dd templates * + ***********************************************************************/ + +#define VIA_OFFSET_BIT 0x01 +#define VIA_TWOSIDE_BIT 0x02 +#define VIA_UNFILLED_BIT 0x04 +#define VIA_FALLBACK_BIT 0x08 +#define VIA_MAX_TRIFUNC 0x10 + + +static struct { + points_func points; + line_func line; + triangle_func triangle; + quad_func quad; +} rast_tab[VIA_MAX_TRIFUNC]; + + +#define DO_FALLBACK (IND & VIA_FALLBACK_BIT) +#define DO_OFFSET (IND & VIA_OFFSET_BIT) +#define DO_UNFILLED (IND & VIA_UNFILLED_BIT) +#define DO_TWOSIDE (IND & VIA_TWOSIDE_BIT) +#define DO_FLAT 0 +#define DO_TRI 1 +#define DO_QUAD 1 +#define DO_LINE 1 +#define DO_POINTS 1 +#define DO_FULL_QUAD 1 + +#define HAVE_RGBA 1 +#define HAVE_SPEC 1 +#define HAVE_BACK_COLORS 0 +#define HAVE_HW_FLATSHADE 1 +#define VERTEX viaVertex +#define TAB rast_tab + +/* Only used to pull back colors into vertices (ie, we know color is + * floating point). + */ +#define VIA_COLOR(dst, src) \ + do { \ + dst[0] = src[2]; \ + dst[1] = src[1]; \ + dst[2] = src[0]; \ + dst[3] = src[3]; \ + } while (0) + +#define VIA_SPEC(dst, src) \ + do { \ + dst[0] = src[2]; \ + dst[1] = src[1]; \ + dst[2] = src[0]; \ + } while (0) + + +#define DEPTH_SCALE (1.0 / 0xffff) +#define UNFILLED_TRI unfilled_tri +#define UNFILLED_QUAD unfilled_quad +#define VERT_X(_v) _v->v.x +#define VERT_Y(_v) _v->v.y +#define VERT_Z(_v) _v->v.z +#define AREA_IS_CCW(a) (a > 0) +#define GET_VERTEX(e) (vmesa->verts + (e<<vmesa->vertexStrideShift)) + +#define VERT_SET_RGBA(v, c) VIA_COLOR(v->ub4[coloroffset], c) +#define VERT_COPY_RGBA(v0, v1) v0->ui[coloroffset] = v1->ui[coloroffset] +#define VERT_SAVE_RGBA(idx) color[idx] = v[idx]->ui[coloroffset] +#define VERT_RESTORE_RGBA(idx) v[idx]->ui[coloroffset] = color[idx] +#define VERT_SET_SPEC(v, c) if (havespec) VIA_SPEC(v->ub4[5], c) +#define VERT_COPY_SPEC(v0, v1) if (havespec) COPY_3V(v0->ub4[5], v1->ub4[5]) +#define VERT_SAVE_SPEC(idx) if (havespec) spec[idx] = v[idx]->ui[5] +#define VERT_RESTORE_SPEC(idx) if (havespec) v[idx]->ui[5] = spec[idx] + +#define SET_PRIMITIVE_RENDERED vmesa->primitiveRendered = GL_TRUE; + +#define LOCAL_VARS(n) \ + viaContextPtr vmesa = VIA_CONTEXT(ctx); \ + GLuint color[n], spec[n]; \ + GLuint coloroffset = (vmesa->vertexSize == 4 ? 3 : 4); \ + GLboolean havespec = (vmesa->vertexSize > 4); \ + (void)color; (void)spec; (void)coloroffset; (void)havespec; + + +/*********************************************************************** + * Helpers for rendering unfilled primitives * + ***********************************************************************/ +/* +static const GLuint hwPrim[GL_POLYGON + 1] = { + PR_LINES, + PR_LINES, + PR_LINES, + PR_LINES, + PR_TRIANGLES, + PR_TRIANGLES, + PR_TRIANGLES, + PR_TRIANGLES, + PR_TRIANGLES, + PR_TRIANGLES +}; +*/ + +#define RASTERIZE(x) \ + if (vmesa->hwPrimitive != x) { \ + viaRasterPrimitiveFinish(ctx); \ + viaRasterPrimitive(ctx, x, x); \ + } + +#define RENDER_PRIMITIVE vmesa->renderPrimitive +#define TAG(x) x +#define IND VIA_FALLBACK_BIT +#include "tnl_dd/t_dd_unfilled.h" +#undef IND +#undef RASTERIZE + +/*********************************************************************** + * Generate GL render functions * + ***********************************************************************/ +#define RASTERIZE(x) + +#define IND (0) +#define TAG(x) x +#include "via_dd_tritmp.h" + +#define IND (VIA_OFFSET_BIT) +#define TAG(x) x##_offset +#include "via_dd_tritmp.h" + +#define IND (VIA_TWOSIDE_BIT) +#define TAG(x) x##_twoside +#include "via_dd_tritmp.h" + +#define IND (VIA_TWOSIDE_BIT|VIA_OFFSET_BIT) +#define TAG(x) x##_twoside_offset +#include "via_dd_tritmp.h" + +#define IND (VIA_UNFILLED_BIT) +#define TAG(x) x##_unfilled +#include "via_dd_tritmp.h" + +#define IND (VIA_OFFSET_BIT|VIA_UNFILLED_BIT) +#define TAG(x) x##_offset_unfilled +#include "via_dd_tritmp.h" + +#define IND (VIA_TWOSIDE_BIT|VIA_UNFILLED_BIT) +#define TAG(x) x##_twoside_unfilled +#include "via_dd_tritmp.h" + +#define IND (VIA_TWOSIDE_BIT|VIA_OFFSET_BIT|VIA_UNFILLED_BIT) +#define TAG(x) x##_twoside_offset_unfilled +#include "via_dd_tritmp.h" + +#define IND (VIA_FALLBACK_BIT) +#define TAG(x) x##_fallback +#include "via_dd_tritmp.h" + +#define IND (VIA_OFFSET_BIT|VIA_FALLBACK_BIT) +#define TAG(x) x##_offset_fallback +#include "via_dd_tritmp.h" + +#define IND (VIA_TWOSIDE_BIT|VIA_FALLBACK_BIT) +#define TAG(x) x##_twoside_fallback +#include "via_dd_tritmp.h" + +#define IND (VIA_TWOSIDE_BIT|VIA_OFFSET_BIT|VIA_FALLBACK_BIT) +#define TAG(x) x##_twoside_offset_fallback +#include "via_dd_tritmp.h" + +#define IND (VIA_UNFILLED_BIT|VIA_FALLBACK_BIT) +#define TAG(x) x##_unfilled_fallback +#include "via_dd_tritmp.h" + +#define IND (VIA_OFFSET_BIT|VIA_UNFILLED_BIT|VIA_FALLBACK_BIT) +#define TAG(x) x##_offset_unfilled_fallback +#include "via_dd_tritmp.h" + +#define IND (VIA_TWOSIDE_BIT|VIA_UNFILLED_BIT|VIA_FALLBACK_BIT) +#define TAG(x) x##_twoside_unfilled_fallback +#include "via_dd_tritmp.h" + +#define IND (VIA_TWOSIDE_BIT|VIA_OFFSET_BIT|VIA_UNFILLED_BIT| \ + VIA_FALLBACK_BIT) +#define TAG(x) x##_twoside_offset_unfilled_fallback +#include "via_dd_tritmp.h" + + +static void init_rast_tab(void) +{ + init(); + init_offset(); + init_twoside(); + init_twoside_offset(); + init_unfilled(); + init_offset_unfilled(); + init_twoside_unfilled(); + init_twoside_offset_unfilled(); + init_fallback(); + init_offset_fallback(); + init_twoside_fallback(); + init_twoside_offset_fallback(); + init_unfilled_fallback(); + init_offset_unfilled_fallback(); + init_twoside_unfilled_fallback(); + init_twoside_offset_unfilled_fallback(); +} + + +/*********************************************************************** + * Rasterization fallback helpers * + ***********************************************************************/ + + +/* This code is hit only when a mix of accelerated and unaccelerated + * primitives are being drawn, and only for the unaccelerated + * primitives. + */ +static void +via_fallback_tri(viaContextPtr vmesa, + viaVertex *v0, + viaVertex *v1, + viaVertex *v2) +{ + GLcontext *ctx = vmesa->glCtx; + SWvertex v[3]; +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + via_translate_vertex(ctx, v0, &v[0]); + via_translate_vertex(ctx, v1, &v[1]); + via_translate_vertex(ctx, v2, &v[2]); + _swrast_Triangle(ctx, &v[0], &v[1], &v[2]); +} + + +static void +via_fallback_line(viaContextPtr vmesa, + viaVertex *v0, + viaVertex *v1) +{ + GLcontext *ctx = vmesa->glCtx; + SWvertex v[2]; +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + via_translate_vertex(ctx, v0, &v[0]); + via_translate_vertex(ctx, v1, &v[1]); + _swrast_Line(ctx, &v[0], &v[1]); +} + + +static void +via_fallback_point(viaContextPtr vmesa, + viaVertex *v0) +{ + GLcontext *ctx = vmesa->glCtx; + SWvertex v[1]; +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + via_translate_vertex(ctx, v0, &v[0]); + _swrast_Point(ctx, &v[0]); +} + +/**********************************************************************/ +/* Render unclipped begin/end objects */ +/* (No Twoside / Offset / Unfilled) */ +/**********************************************************************/ +#define IND 0 +#define V(x) (viaVertex *)(vertptr + ((x) << vertshift)) +#define RENDER_POINTS(start, count) \ + for (; start < count; start++) POINT(V(ELT(start))); +#define RENDER_LINE(v0, v1) LINE(V(v0), V(v1)) + +#define RENDER_TRI( v0, v1, v2) \ + if (VIA_DEBUG) fprintf(stderr, "RENDER_TRI - simple\n"); \ + TRI( V(v0), V(v1), V(v2)) + +#define RENDER_QUAD(v0, v1, v2, v3) QUAD(V(v0), V(v1), V(v2), V(v3)) + +#define INIT(x) viaRasterPrimitive(ctx, x, x) + +#undef LOCAL_VARS +#define LOCAL_VARS \ + viaContextPtr vmesa = VIA_CONTEXT(ctx); \ + GLubyte *vertptr = (GLubyte *)vmesa->verts; \ + const GLuint vertshift = vmesa->vertexStrideShift; \ + const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \ + (void)elt; +#define POSTFIX \ + viaRasterPrimitiveFinish(ctx) +#define RESET_STIPPLE +#define RESET_OCCLUSION +#define PRESERVE_VB_DEFS +#define ELT(x) x +#define TAG(x) via_fast##x##_verts +#include "via_vb_rendertmp.h" +#undef ELT +#undef TAG +#define TAG(x) via_fast##x##_elts +#define ELT(x) elt[x] +#include "via_vb_rendertmp.h" +#undef ELT +#undef TAG +#undef NEED_EDGEFLAG_SETUP +#undef EDGEFLAG_GET +#undef EDGEFLAG_SET +#undef RESET_OCCLUSION + +/**********************************************************************/ +/* Render unclipped begin/end objects */ +/* (Can handle Twoside / Offset / Unfilled */ +/**********************************************************************/ +#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) +#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] +#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val + +#define RENDER_POINTS(start, count) \ + tnl->Driver.Render.Points(ctx, start, count) + +#define RENDER_LINE(v1, v2) \ + LineFunc(ctx, v1, v2) + +#define RENDER_TRI(v1, v2, v3) \ + if (VIA_DEBUG) fprintf(stderr, "RENDER_TRI - complex\n"); \ + if (VIA_DEBUG) fprintf(stderr, "TriangleFunc = %x\n", (unsigned int)TriangleFunc); \ + TriangleFunc(ctx, v1, v2, v3) + +#define RENDER_QUAD(v1, v2, v3, v4) \ + QuadFunc(ctx, v1, v2, v3, v4) + +#define LOCAL_VARS \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + struct vertex_buffer *VB = &tnl->vb; \ + const GLuint * const elt = VB->Elts; \ + const line_func LineFunc = tnl->Driver.Render.Line; \ + const triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ + const quad_func QuadFunc = tnl->Driver.Render.Quad; \ + const GLboolean stipple = ctx->Line.StippleFlag; \ + (void) (LineFunc && TriangleFunc && QuadFunc); \ + (void) elt; (void) stipple; + +#define POSTFIX \ + viaRasterPrimitiveFinish(ctx) +#define ELT(x) x +#define TAG(x) via_##x##_verts +/*#define INIT(x) tnl->Driver.Render.PrimitiveNotify(ctx, x)*/ +#define INIT(x) viaRasterPrimitive(ctx, x, x) +#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple(ctx) +#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE +#define PRESERVE_VB_DEFS +#include "via_vb_rendertmp.h" +#undef ELT +#undef TAG +#define ELT(x) elt[x] +#define TAG(x) via_##x##_elts +#include "via_vb_rendertmp.h" + +/**********************************************************************/ +/* Render clipped primitives */ +/**********************************************************************/ + + + +static void viaRenderClippedPoly(GLcontext *ctx, const GLuint *elts, + GLuint n) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + /* Render the new vertices as an unclipped polygon. + */ + { + GLuint *tmp = VB->Elts; + VB->Elts = (GLuint *)elts; + tnl->Driver.Render.PrimTabElts[GL_POLYGON](ctx, 0, n, + PRIM_BEGIN|PRIM_END); + VB->Elts = tmp; + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void viaRenderClippedLine(GLcontext *ctx, GLuint ii, GLuint jj) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + vmesa->primitiveRendered = GL_TRUE; + + tnl->Driver.Render.Line(ctx, ii, jj); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts, + GLuint n) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLuint vertsize = vmesa->vertexSize; + GLuint *vb = viaCheckDma(vmesa, (n - 2) * 3 * 4 * vertsize); + GLubyte *vertptr = (GLubyte *)vmesa->verts; + const GLuint vertshift = vmesa->vertexStrideShift; + const GLuint *start = (const GLuint *)V(elts[0]); + GLuint *temp1; + GLuint *temp2; + int i,j; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + vmesa->primitiveRendered = GL_TRUE; + + for (i = 2; i < n; i++) { + /*=* [DBG] exy : fix flat-shading + clipping error *=*/ + /*COPY_DWORDS(j, vb, vertsize, start); + COPY_DWORDS(j, vb, vertsize, V(elts[i - 1])); + temp1 = (GLuint *)V(elts[i - 1]); + COPY_DWORDS(j, vb, vertsize, V(elts[i])); + temp2 = (GLuint *)V(elts[i]);*/ + COPY_DWORDS(j, vb, vertsize, V(elts[i - 1])); + COPY_DWORDS(j, vb, vertsize, V(elts[i])); + temp1 = (GLuint *)V(elts[i - 1]); + COPY_DWORDS(j, vb, vertsize, start); + temp2 = (GLuint *)V(elts[i]); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "start = %d - x = %f, y = %f, z = %f, w = %f, u = %f, v = %f\n", elts[0], *(GLfloat *)&start[0], *(GLfloat *)&start[1], *(GLfloat *)&start[2], *(GLfloat *)&start[3], *(GLfloat *)&start[6], *(GLfloat *)&start[7]); + if (VIA_DEBUG) fprintf(stderr, "%d - x = %f, y = %f, z = %f, w = %f, u = %f, v = %f\n", elts[i - 1], *(GLfloat *)&temp1[0], *(GLfloat *)&temp1[1], *(GLfloat *)&temp1[2], *(GLfloat *)&temp1[3], *(GLfloat *)&temp1[6], *(GLfloat *)&temp1[7]); + if (VIA_DEBUG) fprintf(stderr, "%d - x = %f, y = %f, z = %f, w = %f, u = %f, v = %f\n", elts[i], *(GLfloat *)&temp2[0], *(GLfloat *)&temp2[1], *(GLfloat *)&temp2[2], *(GLfloat *)&temp2[3], *(GLfloat *)&temp2[6], *(GLfloat *)&temp2[7]); +#endif + } + vmesa->dmaLow += (n - 2) * 3 * 4 * vertsize; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +/**********************************************************************/ +/* Choose render functions */ +/**********************************************************************/ + + + +#define _VIA_NEW_RENDERSTATE (_DD_NEW_LINE_STIPPLE | \ + _DD_NEW_TRI_UNFILLED | \ + _DD_NEW_TRI_LIGHT_TWOSIDE | \ + _DD_NEW_TRI_OFFSET | \ + _DD_NEW_TRI_STIPPLE | \ + _NEW_POLYGONSTIPPLE) + +#define POINT_FALLBACK (0) +/*#define LINE_FALLBACK (DD_LINE_STIPPLE) +*/ +#define LINE_FALLBACK (0) +#define TRI_FALLBACK (0) +#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK) +#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) + +static void viaChooseRenderState(GLcontext *ctx) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLuint flags = ctx->_TriangleCaps; + GLuint index = 0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + + if (VIA_DEBUG) fprintf(stderr, "_TriangleCaps = %x\n", flags); +#endif + if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) { + if (flags & ANY_RASTER_FLAGS) { + if (flags & DD_TRI_LIGHT_TWOSIDE) index |= VIA_TWOSIDE_BIT; + if (flags & DD_TRI_OFFSET) index |= VIA_OFFSET_BIT; + if (flags & DD_TRI_UNFILLED) index |= VIA_UNFILLED_BIT; + } + + vmesa->drawPoint = via_draw_point; + vmesa->drawLine = via_draw_line; + vmesa->drawTri = via_draw_triangle; + + /* Hook in fallbacks for specific primitives. + */ + if (flags & ANY_FALLBACK_FLAGS) { + if (flags & POINT_FALLBACK) + vmesa->drawPoint = via_fallback_point; + + if (flags & LINE_FALLBACK) + vmesa->drawLine = via_fallback_line; + + if (flags & TRI_FALLBACK) + vmesa->drawTri = via_fallback_tri; + + index |= VIA_FALLBACK_BIT; + } + } +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "index = %x\n", index); + fprintf(stderr, "renderIndex = %x\n", vmesa->renderIndex); + } +#endif + if (vmesa->renderIndex != index) { + vmesa->renderIndex = index; + + tnl->Driver.Render.Points = rast_tab[index].points; + tnl->Driver.Render.Line = rast_tab[index].line; + tnl->Driver.Render.Triangle = rast_tab[index].triangle; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "tnl->Driver.Render.xxx = rast_tab[index].xxx = %x\n", (unsigned int)tnl->Driver.Render.Triangle); +#endif + tnl->Driver.Render.Quad = rast_tab[index].quad; + + if (index == 0) { + tnl->Driver.Render.PrimTabVerts = via_fastrender_tab_verts; + tnl->Driver.Render.PrimTabElts = via_fastrender_tab_elts; + tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */ + tnl->Driver.Render.ClippedPolygon = viaFastRenderClippedPoly; + } + else { + tnl->Driver.Render.PrimTabVerts = via_render_tab_verts; + tnl->Driver.Render.PrimTabElts = via_render_tab_elts; + tnl->Driver.Render.ClippedLine = viaRenderClippedLine; + tnl->Driver.Render.ClippedPolygon = viaRenderClippedPoly; + } + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static const GLenum reducedPrim[GL_POLYGON + 1] = { + GL_POINTS, + GL_LINES, + GL_LINES, + GL_LINES, + GL_TRIANGLES, + GL_TRIANGLES, + GL_TRIANGLES, + GL_TRIANGLES, + GL_TRIANGLES, + GL_TRIANGLES +}; + + +static void emit_all_state(viaContextPtr vmesa) +{ + GLcontext *ctx = vmesa->glCtx; + GLuint *vb = viaCheckDma(vmesa, 0x110); + GLuint i = 0; + GLuint j = 0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + *vb++ = ((HC_SubA_HEnable << 24) | vmesa->regEnable); + *vb++ = ((HC_SubA_HFBBMSKL << 24) | vmesa->regHFBBMSKL); + *vb++ = ((HC_SubA_HROP << 24) | vmesa->regHROP); + i += 5; + + if (vmesa->hasDepth && vmesa->hasStencil) { + GLuint pitch, format, offset; + + format = HC_HZWBFM_24; + + offset = vmesa->depth.offset; + pitch = vmesa->depth.pitch; + + *vb++ = ((HC_SubA_HZWBBasL << 24) | (offset & 0xFFFFFF)); + + *vb++ = ((HC_SubA_HZWBBasH << 24) | ((offset & 0xFF000000) >> 24)); + *vb++ = ((HC_SubA_HZWBType << 24) | HC_HDBLoc_Local | HC_HZONEasFF_MASK | + format | pitch); + *vb++ = ((HC_SubA_HZWTMD << 24) | vmesa->regHZWTMD); + /* set stencil */ + *vb++ = ((HC_SubA_HSTREF << 24) | vmesa->regHSTREF); + *vb++ = ((HC_SubA_HSTMD << 24) | vmesa->regHSTMD); + + i += 6; + } + else if (vmesa->hasDepth) { + GLuint pitch, format, offset; + + if (vmesa->depthBits == 16) { + /* We haven't support 16bit depth yet */ + format = HC_HZWBFM_16; + /*format = HC_HZWBFM_32;*/ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "z format = 16\n"); +#endif + } + else { + format = HC_HZWBFM_32; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "z format = 32\n"); +#endif + } + + + offset = vmesa->depth.offset; + pitch = vmesa->depth.pitch; + + *vb++ = ((HC_SubA_HZWBBasL << 24) | (offset & 0xFFFFFF)); + + *vb++ = ((HC_SubA_HZWBBasH << 24) | ((offset & 0xFF000000) >> 24)); + *vb++ = ((HC_SubA_HZWBType << 24) | HC_HDBLoc_Local | HC_HZONEasFF_MASK | + format | pitch); + *vb++ = ((HC_SubA_HZWTMD << 24) | vmesa->regHZWTMD); + i += 4; + } + else if (vmesa->hasStencil) { + GLuint pitch, format, offset; + + format = HC_HZWBFM_24; + + offset = vmesa->depth.offset; + pitch = vmesa->depth.pitch; + + *vb++ = ((HC_SubA_HZWBBasL << 24) | (offset & 0xFFFFFF)); + + *vb++ = ((HC_SubA_HZWBBasH << 24) | ((offset & 0xFF000000) >> 24)); + *vb++ = ((HC_SubA_HZWBType << 24) | HC_HDBLoc_Local | HC_HZONEasFF_MASK | + format | pitch); + *vb++ = ((HC_SubA_HZWTMD << 24) | vmesa->regHZWTMD); + /* set stencil */ + *vb++ = ((HC_SubA_HSTREF << 24) | vmesa->regHSTREF); + *vb++ = ((HC_SubA_HSTMD << 24) | vmesa->regHSTMD); + + i += 6; + } + + if (ctx->Color.AlphaEnabled) { + *vb++ = ((HC_SubA_HATMD << 24) | vmesa->regHATMD); + i++; + } + + if (ctx->Color.BlendEnabled) { + *vb++ = ((HC_SubA_HABLCsat << 24) | vmesa->regHABLCsat); + *vb++ = ((HC_SubA_HABLCop << 24) | vmesa->regHABLCop); + *vb++ = ((HC_SubA_HABLAsat << 24) | vmesa->regHABLAsat); + *vb++ = ((HC_SubA_HABLAop << 24) | vmesa->regHABLAop); + *vb++ = ((HC_SubA_HABLRCa << 24) | vmesa->regHABLRCa); + *vb++ = ((HC_SubA_HABLRFCa << 24) | vmesa->regHABLRFCa); + *vb++ = ((HC_SubA_HABLRCbias << 24) | vmesa->regHABLRCbias); + *vb++ = ((HC_SubA_HABLRCb << 24) | vmesa->regHABLRCb); + *vb++ = ((HC_SubA_HABLRFCb << 24) | vmesa->regHABLRFCb); + *vb++ = ((HC_SubA_HABLRAa << 24) | vmesa->regHABLRAa); + *vb++ = ((HC_SubA_HABLRAb << 24) | vmesa->regHABLRAb); + i += 11; + } + + if (ctx->Fog.Enabled) { + *vb++ = ((HC_SubA_HFogLF << 24) | vmesa->regHFogLF); + *vb++ = ((HC_SubA_HFogCL << 24) | vmesa->regHFogCL); + *vb++ = ((HC_SubA_HFogCH << 24) | vmesa->regHFogCH); + i += 3; + } + + if (ctx->Line.StippleFlag) { + *vb++ = ((HC_SubA_HLP << 24) | ctx->Line.StipplePattern); + *vb++ = ((HC_SubA_HLPRF << 24) | ctx->Line.StippleFactor); + } + else { + *vb++ = ((HC_SubA_HLP << 24) | 0xFFFF); + *vb++ = ((HC_SubA_HLPRF << 24) | 0x1); + } + + i += 2; + + *vb++ = ((HC_SubA_HPixGC << 24) | 0x0); + i++; + + if (i & 0x1) { + *vb++ = HC_DUMMY; + i++; + } + + if (ctx->Texture.Unit[0]._ReallyEnabled) { + + struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0]; + struct gl_texture_unit *texUnit1 = &ctx->Texture.Unit[1]; + + { + viaTextureObjectPtr t = (viaTextureObjectPtr)texUnit0->_Current->DriverData; + GLuint nDummyValue = 0; + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_Tex << 16) | (HC_SubType_TexGeneral << 24); + + if (ctx->Texture.Unit[1]._ReallyEnabled) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "multi texture\n"); +#endif + nDummyValue = (HC_SubA_HTXSMD << 24) | (1 << 3); + + if (t && t->needClearCache) { + *vb++ = nDummyValue | HC_HTXCHCLR_MASK; + *vb++ = nDummyValue; + } + else { + *vb++ = nDummyValue; + *vb++ = nDummyValue; + } + } + else { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "single texture\n"); +#endif + nDummyValue = (HC_SubA_HTXSMD << 24) | 0; + + if (t && t->needClearCache) { + *vb++ = nDummyValue | HC_HTXCHCLR_MASK; + *vb++ = nDummyValue; + } + else { + *vb++ = nDummyValue; + *vb++ = nDummyValue; + } + } + *vb++ = HC_HEADER2; + *vb++ = HC_ParaType_NotTex << 16; + *vb++ = (HC_SubA_HEnable << 24) | vmesa->regEnable; + *vb++ = (HC_SubA_HEnable << 24) | vmesa->regEnable; + i += 8; + } + + if (texUnit0->Enabled) { + struct gl_texture_object *texObj = texUnit0->_Current; + viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; + GLuint numLevels = t->lastLevel - t->firstLevel + 1; + GLuint nDummyValue = 0; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "texture0 enabled\n"); + fprintf(stderr, "texture level %d\n", t->actualLevel); + } +#endif + if (numLevels == 8) { + nDummyValue = t->regTexFM; + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_Tex << 16) | (0 << 24); + *vb++ = t->regTexFM; + *vb++ = (HC_SubA_HTXnL0OS << 24) | + ((t->actualLevel) << HC_HTXnLVmax_SHIFT); + *vb++ = t->regTexWidthLog2[0]; + *vb++ = t->regTexWidthLog2[1]; + *vb++ = t->regTexHeightLog2[0]; + *vb++ = t->regTexHeightLog2[1]; + *vb++ = t->regTexBaseH[0]; + *vb++ = t->regTexBaseH[1]; + *vb++ = t->regTexBaseH[2]; + + *vb++ = t->regTexBaseAndPitch[0].baseL; + *vb++ = t->regTexBaseAndPitch[0].pitchLog2; + *vb++ = t->regTexBaseAndPitch[1].baseL; + *vb++ = t->regTexBaseAndPitch[1].pitchLog2; + *vb++ = t->regTexBaseAndPitch[2].baseL; + *vb++ = t->regTexBaseAndPitch[2].pitchLog2; + *vb++ = t->regTexBaseAndPitch[3].baseL; + *vb++ = t->regTexBaseAndPitch[3].pitchLog2; + *vb++ = t->regTexBaseAndPitch[4].baseL; + *vb++ = t->regTexBaseAndPitch[4].pitchLog2; + *vb++ = t->regTexBaseAndPitch[5].baseL; + *vb++ = t->regTexBaseAndPitch[5].pitchLog2; + *vb++ = t->regTexBaseAndPitch[6].baseL; + *vb++ = t->regTexBaseAndPitch[6].pitchLog2; + *vb++ = t->regTexBaseAndPitch[7].baseL; + *vb++ = t->regTexBaseAndPitch[7].pitchLog2; + i += 27; + } + else if (numLevels > 1) { + nDummyValue = t->regTexFM; + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_Tex << 16) | (0 << 24); + *vb++ = t->regTexFM; + *vb++ = (HC_SubA_HTXnL0OS << 24) | + ((t->actualLevel) << HC_HTXnLVmax_SHIFT); + *vb++ = t->regTexWidthLog2[0]; + *vb++ = t->regTexHeightLog2[0]; + + if (numLevels > 6) { + *vb++ = t->regTexWidthLog2[1]; + *vb++ = t->regTexHeightLog2[1]; + i += 2; + } + + *vb++ = t->regTexBaseH[0]; + + if (numLevels > 3) { + *vb++ = t->regTexBaseH[1]; + i++; + } + if (numLevels > 6) { + *vb++ = t->regTexBaseH[2]; + i++; + } + if (numLevels > 9) { + *vb++ = t->regTexBaseH[3]; + i++; + } + + i += 7; + + for (j = 0; j < numLevels; j++) { + *vb++ = t->regTexBaseAndPitch[j].baseL; + *vb++ = t->regTexBaseAndPitch[j].pitchLog2; + i += 2; + } + } + else { + nDummyValue = t->regTexFM; + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_Tex << 16) | (0 << 24); + *vb++ = t->regTexFM; + *vb++ = (HC_SubA_HTXnL0OS << 24) | + ((t->actualLevel) << HC_HTXnLVmax_SHIFT); + *vb++ = t->regTexWidthLog2[0]; + *vb++ = t->regTexHeightLog2[0]; + *vb++ = t->regTexBaseH[0]; + *vb++ = t->regTexBaseAndPitch[0].baseL; + *vb++ = t->regTexBaseAndPitch[0].pitchLog2; + i += 9; + } + + *vb++ = (HC_SubA_HTXnTB << 24) | vmesa->regHTXnTB_0; + *vb++ = (HC_SubA_HTXnMPMD << 24) | vmesa->regHTXnMPMD_0; + *vb++ = (HC_SubA_HTXnTBLCsat << 24) | vmesa->regHTXnTBLCsat_0; + *vb++ = (HC_SubA_HTXnTBLCop << 24) | vmesa->regHTXnTBLCop_0; + *vb++ = (HC_SubA_HTXnTBLMPfog << 24) | vmesa->regHTXnTBLMPfog_0; + *vb++ = (HC_SubA_HTXnTBLAsat << 24) | vmesa->regHTXnTBLAsat_0; + *vb++ = (HC_SubA_HTXnTBLRCb << 24) | vmesa->regHTXnTBLRCb_0; + *vb++ = (HC_SubA_HTXnTBLRAa << 24) | vmesa->regHTXnTBLRAa_0; + *vb++ = (HC_SubA_HTXnTBLRFog << 24) | vmesa->regHTXnTBLRFog_0; + i += 9; + + if (t->regTexFM == HC_HTXnFM_Index8) { + struct gl_color_table *table = &texObj->Palette; + GLfloat *tableF = (GLfloat *)table->Table; + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_Palette << 16) | (0 << 24); + i += 2; + for (j = 0; j < table->Size; j++) { + *vb++ = tableF[j]; + i++; + } + } + if (i & 0x1) { + *vb++ = HC_DUMMY; + i++; + } + } + + if (texUnit1->Enabled) { + struct gl_texture_object *texObj = texUnit1->_Current; + viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; + GLuint numLevels = t->lastLevel - t->firstLevel + 1; + GLuint nDummyValue = 0; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "texture1 enabled\n"); + fprintf(stderr, "texture level %d\n", t->actualLevel); + } +#endif + if (numLevels == 8) { + nDummyValue = t->regTexFM; + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_Tex << 16) | (1 << 24); + *vb++ = t->regTexFM; + *vb++ = (HC_SubA_HTXnL0OS << 24) | + ((t->actualLevel) << HC_HTXnLVmax_SHIFT); + *vb++ = t->regTexWidthLog2[0]; + *vb++ = t->regTexWidthLog2[1]; + *vb++ = t->regTexHeightLog2[0]; + *vb++ = t->regTexHeightLog2[1]; + *vb++ = t->regTexBaseH[0]; + *vb++ = t->regTexBaseH[1]; + *vb++ = t->regTexBaseH[2]; + + *vb++ = t->regTexBaseAndPitch[0].baseL; + *vb++ = t->regTexBaseAndPitch[0].pitchLog2; + *vb++ = t->regTexBaseAndPitch[1].baseL; + *vb++ = t->regTexBaseAndPitch[1].pitchLog2; + *vb++ = t->regTexBaseAndPitch[2].baseL; + *vb++ = t->regTexBaseAndPitch[2].pitchLog2; + *vb++ = t->regTexBaseAndPitch[3].baseL; + *vb++ = t->regTexBaseAndPitch[3].pitchLog2; + *vb++ = t->regTexBaseAndPitch[4].baseL; + *vb++ = t->regTexBaseAndPitch[4].pitchLog2; + *vb++ = t->regTexBaseAndPitch[5].baseL; + *vb++ = t->regTexBaseAndPitch[5].pitchLog2; + *vb++ = t->regTexBaseAndPitch[6].baseL; + *vb++ = t->regTexBaseAndPitch[6].pitchLog2; + *vb++ = t->regTexBaseAndPitch[7].baseL; + *vb++ = t->regTexBaseAndPitch[7].pitchLog2; + i += 27; + } + else if (numLevels > 1) { + nDummyValue = t->regTexFM; + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_Tex << 16) | (1 << 24); + *vb++ = t->regTexFM; + *vb++ = (HC_SubA_HTXnL0OS << 24) | + ((t->actualLevel) << HC_HTXnLVmax_SHIFT); + *vb++ = t->regTexWidthLog2[0]; + *vb++ = t->regTexHeightLog2[0]; + + if (numLevels > 6) { + *vb++ = t->regTexWidthLog2[1]; + *vb++ = t->regTexHeightLog2[1]; + i += 2; + } + + *vb++ = t->regTexBaseH[0]; + + if (numLevels > 3) { + *vb++ = t->regTexBaseH[1]; + i++; + } + if (numLevels > 6) { + *vb++ = t->regTexBaseH[2]; + i++; + } + if (numLevels > 9) { + *vb++ = t->regTexBaseH[3]; + i++; + } + + i += 7; + + for (j = 0; j < numLevels; j++) { + *vb++ = t->regTexBaseAndPitch[j].baseL; + *vb++ = t->regTexBaseAndPitch[j].pitchLog2; + i += 2; + } + } + else { + nDummyValue = t->regTexFM; + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_Tex << 16) | (1 << 24); + *vb++ = t->regTexFM; + *vb++ = (HC_SubA_HTXnL0OS << 24) | + ((t->actualLevel) << HC_HTXnLVmax_SHIFT); + *vb++ = t->regTexWidthLog2[0]; + *vb++ = t->regTexHeightLog2[0]; + *vb++ = t->regTexBaseH[0]; + *vb++ = t->regTexBaseAndPitch[0].baseL; + *vb++ = t->regTexBaseAndPitch[0].pitchLog2; + i += 9; + } + + *vb++ = (HC_SubA_HTXnTB << 24) | vmesa->regHTXnTB_1; + *vb++ = (HC_SubA_HTXnMPMD << 24) | vmesa->regHTXnMPMD_1; + *vb++ = (HC_SubA_HTXnTBLCsat << 24) | vmesa->regHTXnTBLCsat_1; + *vb++ = (HC_SubA_HTXnTBLCop << 24) | vmesa->regHTXnTBLCop_1; + *vb++ = (HC_SubA_HTXnTBLMPfog << 24) | vmesa->regHTXnTBLMPfog_1; + *vb++ = (HC_SubA_HTXnTBLAsat << 24) | vmesa->regHTXnTBLAsat_1; + *vb++ = (HC_SubA_HTXnTBLRCb << 24) | vmesa->regHTXnTBLRCb_1; + *vb++ = (HC_SubA_HTXnTBLRAa << 24) | vmesa->regHTXnTBLRAa_1; + *vb++ = (HC_SubA_HTXnTBLRFog << 24) | vmesa->regHTXnTBLRFog_1; + i += 9; + + if (t->regTexFM == HC_HTXnFM_Index8) { + struct gl_color_table *table = &texObj->Palette; + GLfloat *tableF = (GLfloat *)table->Table; + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_Palette << 16) | (1 << 24); + i += 2; + for (j = 0; j < table->Size; j++) { + *vb++ = tableF[j]; + i++; + } + } + if (i & 0x1) { + *vb++ = HC_DUMMY; + i++; + } + } + } + + + if (ctx->Polygon.StippleFlag) { + GLuint *stipple = &ctx->PolygonStipple[0]; + + *vb++ = HC_HEADER2; + *vb++ = ((HC_ParaType_Palette << 16) | (HC_SubType_Stipple << 24)); + + *vb++ = stipple[31]; + *vb++ = stipple[30]; + *vb++ = stipple[29]; + *vb++ = stipple[28]; + *vb++ = stipple[27]; + *vb++ = stipple[26]; + *vb++ = stipple[25]; + *vb++ = stipple[24]; + *vb++ = stipple[23]; + *vb++ = stipple[22]; + *vb++ = stipple[21]; + *vb++ = stipple[20]; + *vb++ = stipple[19]; + *vb++ = stipple[18]; + *vb++ = stipple[17]; + *vb++ = stipple[16]; + *vb++ = stipple[15]; + *vb++ = stipple[14]; + *vb++ = stipple[13]; + *vb++ = stipple[12]; + *vb++ = stipple[11]; + *vb++ = stipple[10]; + *vb++ = stipple[9]; + *vb++ = stipple[8]; + *vb++ = stipple[7]; + *vb++ = stipple[6]; + *vb++ = stipple[5]; + *vb++ = stipple[4]; + *vb++ = stipple[3]; + *vb++ = stipple[2]; + *vb++ = stipple[1]; + *vb++ = stipple[0]; + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + *vb++ = ((HC_SubA_HSPXYOS << 24) | (0x20 - (vmesa->driDrawable->h & 0x1F))); + *vb++ = ((HC_SubA_HSPXYOS << 24) | (0x20 - (vmesa->driDrawable->h & 0x1F))); + i += 38; + } + + vmesa->dmaLow += (i << 2); + + vmesa->dirty = 0; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +static void emit_partial_state(viaContextPtr vmesa) +{ + GLcontext *ctx = vmesa->glCtx; + GLuint dirty = vmesa->dirty; + GLuint *vb = viaCheckDma(vmesa, 0x110); + GLuint i = 0; + + fprintf(stderr, "%s - in\n", __FUNCTION__); + +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + vb = vb; + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + *vb++ = ((HC_SubA_HEnable << 24) | vmesa->regEnable); + *vb++ = ((HC_SubA_HFBBMSKL << 24) | vmesa->regHFBBMSKL); + *vb++ = ((HC_SubA_HROP << 24) | vmesa->regHROP); + i += 5; + + if (dirty & VIA_UPLOAD_DESTBUFFER) { + } + + if (dirty & VIA_UPLOAD_DEPTHBUFFER) { + } + + if (dirty * VIA_UPLOAD_DEPTH) { + *vb++ = ((HC_SubA_HZWTMD << 24) | vmesa->regHZWTMD); + i++; + } + + if (dirty * VIA_UPLOAD_ALPHATEST) { + *vb++ = ((HC_SubA_HATMD << 24) | vmesa->regHATMD); + i++; + } + + + if (dirty & VIA_UPLOAD_BLEND) { + *vb++ = ((HC_SubA_HABLCsat << 24) | vmesa->regHABLCsat); + *vb++ = ((HC_SubA_HABLCop << 24) | vmesa->regHABLCop); + *vb++ = ((HC_SubA_HABLAsat << 24) | vmesa->regHABLAsat); + *vb++ = ((HC_SubA_HABLAop << 24) | vmesa->regHABLAop); + *vb++ = ((HC_SubA_HABLRCa << 24) | vmesa->regHABLRCa); + *vb++ = ((HC_SubA_HABLRFCa << 24) | vmesa->regHABLRFCa); + *vb++ = ((HC_SubA_HABLRCbias << 24) | vmesa->regHABLRCbias); + *vb++ = ((HC_SubA_HABLRCb << 24) | vmesa->regHABLRCb); + *vb++ = ((HC_SubA_HABLRFCb << 24) | vmesa->regHABLRFCb); + *vb++ = ((HC_SubA_HABLRAa << 24) | vmesa->regHABLRAa); + *vb++ = ((HC_SubA_HABLRAb << 24) | vmesa->regHABLRAb); + i += 11; + } + + if (dirty & VIA_UPLOAD_FOG) { + *vb++ = ((HC_SubA_HFogLF << 24) | vmesa->regHFogLF); + *vb++ = ((HC_SubA_HFogCL << 24) | vmesa->regHFogCL); + *vb++ = ((HC_SubA_HFogCH << 24) | vmesa->regHFogCH); + i += 3; + } + + if (dirty & VIA_UPLOAD_LINESTIPPLE) { + *vb++ = ((HC_SubA_HLP << 24) | ctx->Line.StipplePattern); + *vb++ = ((HC_SubA_HLPRF << 24) | ctx->Line.StippleFactor); + } + else { + *vb++ = ((HC_SubA_HLP << 24) | 0xFFFF); + *vb++ = ((HC_SubA_HLPRF << 24) | 0x1); + } + i += 2; + + *vb++ = ((HC_SubA_HPixGC << 24) | 0x0); + i++; + + if (i & 0x1) { + *vb++ = HC_DUMMY; + i++; + } + + if (dirty & VIA_UPLOAD_TEXTURE) { + + } + + if (dirty & VIA_UPLOAD_POLYGONSTIPPLE) { + + } + + vmesa->dmaLow += (i << 2); + + vmesa->dirty = 0; + + fprintf(stderr, "%s - out\n", __FUNCTION__); +} + +/**********************************************************************/ +/* High level hooks for t_vb_render.c */ +/**********************************************************************/ + +/* Determine the rasterized primitive when not drawing unfilled + * polygons. + * + * Used only for the default render stage which always decomposes + * primitives to trianges/lines/points. For the accelerated stage, + * which renders strips as strips, the equivalent calculations are + * performed in via_render.c. + */ +static void viaRenderPrimitive(GLcontext *ctx, GLenum prim) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLuint rprim = reducedPrim[prim]; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + vmesa->renderPrimitive = prim; + viaRasterPrimitive(ctx, rprim, rprim); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void viaRunPipeline(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + + if (VIA_DEBUG) fprintf(stderr, "newState = %x\n", vmesa->newState); +#endif + + if (vmesa->newState) { + if (vmesa->newState & _NEW_TEXTURE) + viaUpdateTextureState(ctx); /* may modify vmesa->newState */ + + viaChooseVertexState(ctx); + viaChooseRenderState(ctx); + vmesa->newState = 0; + } + + if (vmesa->needUploadAllState) + emit_all_state(vmesa); + else + emit_partial_state(vmesa); + + _tnl_run_pipeline(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void viaRenderStart(GLcontext *ctx) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + + /* Check for projective textureing. Make sure all texcoord + * pointers point to something. (fix in mesa?) + */ + viaCheckTexSizes(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void viaRenderFinish(GLcontext *ctx) +{ +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (VIA_CONTEXT(ctx)->renderIndex & VIA_FALLBACK_BIT) + _swrast_flush(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +/* System to flush dma and emit state changes based on the rasterized + * primitive. + */ +void viaRasterPrimitive(GLcontext *ctx, + GLenum rprim, + GLuint hwprim) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLuint *vb = viaCheckDma(vmesa, 32); + GLuint regCmdB; +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "%s - in\n", __FUNCTION__); + fprintf(stderr, "hwprim = %x\n", hwprim); + } +#endif + /*=* [DBG] exy : fix wireframe + clipping error *=*/ + if (((rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED)))) { + hwprim = GL_LINES; + } + + if (RasterCounter > 0) { + +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "enter twice:%d\n",RasterCounter); +#endif + RasterCounter++; + return; + } + RasterCounter++; + + vmesa->primitiveRendered = GL_FALSE; + regCmdB = vmesa->regCmdB; + + switch (hwprim) { + case GL_POINTS: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Points\n"); +#endif + vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Point | HC_HVCycle_Full; + if (ctx->Light.ShadeModel == GL_FLAT) + vmesa->regCmdA_End |= HC_HShading_FlatA; + break; + case GL_LINES: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Lines\n"); +#endif + vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Line | HC_HVCycle_Full; + if (ctx->Light.ShadeModel == GL_FLAT) + vmesa->regCmdA_End |= HC_HShading_FlatB; + break; + case GL_LINE_LOOP: + case GL_LINE_STRIP: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Line Loop / Line Strip\n"); +#endif + vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Line | HC_HVCycle_AFP | + HC_HVCycle_AB | HC_HVCycle_NewB; + regCmdB |= HC_HVCycle_AB | HC_HVCycle_NewB | HC_HLPrst_MASK; + if (ctx->Light.ShadeModel == GL_FLAT) + vmesa->regCmdA_End |= HC_HShading_FlatB; + break; + case GL_TRIANGLES: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Triangles\n"); +#endif + vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_Full; + if (ctx->Light.ShadeModel == GL_FLAT) + vmesa->regCmdA_End |= HC_HShading_FlatC; + break; + case GL_TRIANGLE_STRIP: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Triangle Strip\n"); +#endif + vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_AFP | + HC_HVCycle_AC | HC_HVCycle_BB | HC_HVCycle_NewC; + regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; + if (ctx->Light.ShadeModel == GL_FLAT) + vmesa->regCmdA_End |= HC_HShading_FlatB; + break; + case GL_TRIANGLE_FAN: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Triangle Fan\n"); +#endif + vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_AFP | + HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; + regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; + if (ctx->Light.ShadeModel == GL_FLAT) + vmesa->regCmdA_End |= HC_HShading_FlatC; + break; + case GL_QUADS: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "No HW Quads\n"); +#endif + return; + case GL_QUAD_STRIP: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "No HW Quad Strip\n"); +#endif + return; + case GL_POLYGON: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Polygon\n"); +#endif + vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_AFP | + HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; + regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; + if (ctx->Light.ShadeModel == GL_FLAT) + vmesa->regCmdA_End |= HC_HShading_FlatC; + break; + default: +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "Unknow\n"); +#endif + return; + } + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_NotTex << 16); + *vb++ = 0xCCCCCCCC; + *vb++ = 0xDDDDDDDD; + + *vb++ = HC_HEADER2; + *vb++ = (HC_ParaType_CmdVdata << 16); + *vb++ = regCmdB; + *vb++ = vmesa->regCmdA_End; + vmesa->dmaLow += 32; + + vmesa->reducedPrimitive = rprim; + vmesa->hwPrimitive = rprim; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaRasterPrimitiveFinish(GLcontext *ctx) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + + if (VIA_DEBUG) fprintf(stderr, "primitiveRendered = %x\n", vmesa->primitiveRendered); +#endif + if (RasterCounter > 1) { + RasterCounter--; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "finish enter twice: %d\n",RasterCounter); +#endif + return; + } + RasterCounter = 0; + + + if (vmesa->primitiveRendered) { + GLuint *vb = viaCheckDma(vmesa, 0); + GLuint cmdA = vmesa->regCmdA_End | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK; + + if (vmesa->dmaLow & 0x1) { + *vb++ = cmdA ; + vmesa->dmaLow += 4; + } + else { + *vb++ = cmdA; + *vb++ = cmdA; + vmesa->dmaLow += 8; + } + } + else { + if (vmesa->dmaLow >= (32 + DMA_OFFSET)) + vmesa->dmaLow -= 32; + } + + if (0) viaFlushPrimsLocked(vmesa); + if (0) { + GLuint *pnMMIOBase = vmesa->regMMIOBase; + GLuint *pnEngBase = (GLuint *)((GLuint)pnMMIOBase + 0x400); + int nStatus = *pnEngBase; + if (((nStatus & 0xFFFEFFFF) == 0x00020000)) { +#ifdef PERFORMANCE_MEASURE + idle++; +#endif + viaFlushPrims(vmesa); + } +#ifdef PERFORMANCE_MEASURE + else { + busy++; + } +#endif + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +/**********************************************************************/ +/* Transition to/from hardware rasterization. */ +/**********************************************************************/ + + +void viaFallback(viaContextPtr vmesa, GLuint bit, GLboolean mode) +{ + GLcontext *ctx = vmesa->glCtx; + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint oldfallback = vmesa->Fallback; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s old %x bit %x mode %d\n", __FUNCTION__, + vmesa->Fallback, bit, mode); +#endif + + if (mode) { + vmesa->Fallback |= bit; + if (oldfallback == 0) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "ENTER FALLBACK\n"); +#endif + VIA_FIREVERTICES(vmesa); + _swsetup_Wakeup(ctx); + vmesa->renderIndex = ~0; + } + } + else { + vmesa->Fallback &= ~bit; + if (oldfallback == bit) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "LEAVE FALLBACK\n"); +#endif + tnl->Driver.Render.Start = viaRenderStart; + tnl->Driver.Render.PrimitiveNotify = viaRenderPrimitive; + tnl->Driver.Render.Finish = viaRenderFinish; + tnl->Driver.Render.BuildVertices = viaBuildVertices; + vmesa->newState |= (_VIA_NEW_RENDERSTATE|_VIA_NEW_VERTEX); + } + } + +} + + +/**********************************************************************/ +/* Initialization. */ +/**********************************************************************/ + + +void viaInitTriFuncs(GLcontext *ctx) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + static int firsttime = 1; + + if (firsttime) { + init_rast_tab(); + firsttime = 0; + } + + tnl->Driver.RunPipeline = viaRunPipeline; + tnl->Driver.Render.Start = viaRenderStart; + tnl->Driver.Render.Finish = viaRenderFinish; + tnl->Driver.Render.PrimitiveNotify = viaRenderPrimitive; + tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple; + tnl->Driver.Render.BuildVertices = viaBuildVertices; +} diff --git a/xc/lib/GL/mesa/src/drv/via/via_tris.h b/xc/lib/GL/mesa/src/drv/via/via_tris.h new file mode 100644 index 000000000..b4f0880a7 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_tris.h @@ -0,0 +1,35 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _VIATRIS_H +#define _VIATRIS_H + +#include "mtypes.h" + +extern void viaPrintRenderState(const char *msg, GLuint state); +extern void viaInitTriFuncs(GLcontext *ctx); +extern void viaRasterPrimitive(GLcontext *ctx, GLenum rPrim, GLuint hwPrim); +extern void viaRasterPrimitiveFinish(GLcontext *ctx); + +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_vb.c b/xc/lib/GL/mesa/src/drv/via/via_vb.c new file mode 100644 index 000000000..b080be31c --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_vb.c @@ -0,0 +1,412 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glheader.h" +#include "mtypes.h" +#include "macros.h" +#include "colormac.h" +#include "mmath.h" +#include "mem.h" + +#include "swrast_setup/swrast_setup.h" +#include "tnl/t_context.h" + +#include "via_context.h" +#include "via_vb.h" +#include "via_ioctl.h" +#include "via_tris.h" +#include "via_state.h" + +static struct { + void (*emit)(GLcontext *, GLuint, GLuint, void *, GLuint); + interp_func interp; + copy_pv_func copyPv; + GLboolean (*check_tex_sizes)(GLcontext *ctx); + GLuint vertexSize; + GLuint vertexStrideShift; + GLuint vertexFormat; +} setup_tab[VIA_MAX_SETUP]; + +#define TINY_VERTEX_FORMAT 1 +#define NOTEX_VERTEX_FORMAT 2 +#define TEX0_VERTEX_FORMAT 3 +#define TEX1_VERTEX_FORMAT 4 + +#define PROJ_TEX1_VERTEX_FORMAT 0 +#define TEX2_VERTEX_FORMAT 0 +#define TEX3_VERTEX_FORMAT 0 +#define PROJ_TEX3_VERTEX_FORMAT 0 + +#define DO_XYZW (IND & VIA_XYZW_BIT) +#define DO_RGBA (IND & VIA_RGBA_BIT) +#define DO_SPEC (IND & VIA_SPEC_BIT) +#define DO_FOG (IND & VIA_FOG_BIT) +#define DO_TEX0 (IND & VIA_TEX0_BIT) +#define DO_TEX1 (IND & VIA_TEX1_BIT) +#define DO_TEX2 0 +#define DO_TEX3 0 +#define DO_PTEX (IND & VIA_PTEX_BIT) + +#define VERTEX viaVertex +#define GET_VIEWPORT_MAT() VIA_CONTEXT(ctx)->ViewportMatrix.m +#define GET_TEXSOURCE(n) n +#define GET_VERTEX_FORMAT() VIA_CONTEXT(ctx)->vertexSize +#define GET_VERTEX_STORE() VIA_CONTEXT(ctx)->verts +#define GET_VERTEX_STRIDE_SHIFT() VIA_CONTEXT(ctx)->vertexStrideShift +#define GET_UBYTE_COLOR_STORE() &VIA_CONTEXT(ctx)->UbyteColor +#define GET_UBYTE_SPEC_COLOR_STORE() &VIA_CONTEXT(ctx)->UbyteSecondaryColor +#define INVALIDATE_STORED_VERTICES() + +#define HAVE_HW_VIEWPORT 0 +#define HAVE_HW_DIVIDE 0 +#define HAVE_RGBA_COLOR 0 +#define HAVE_TINY_VERTICES 1 +#define HAVE_NOTEX_VERTICES 1 +#define HAVE_TEX0_VERTICES 1 +#define HAVE_TEX1_VERTICES 1 +#define HAVE_TEX2_VERTICES 0 +#define HAVE_TEX3_VERTICES 0 +#define HAVE_PTEX_VERTICES 0 + +#define UNVIEWPORT_VARS GLfloat h = VIA_CONTEXT(ctx)->driDrawable->h +#define UNVIEWPORT_X(x) x - SUBPIXEL_X +#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y +#define UNVIEWPORT_Z(z) z * (float)0xffff + +#define PTEX_FALLBACK() FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_TEXTURE, 1) + +#define IMPORT_FLOAT_COLORS via_import_float_colors +#define IMPORT_FLOAT_SPEC_COLORS via_import_float_spec_colors + +#define INTERP_VERTEX setup_tab[VIA_CONTEXT(ctx)->setupIndex].interp +#define COPY_PV_VERTEX setup_tab[VIA_CONTEXT(ctx)->setupIndex].copyPv + + +/*********************************************************************** + * Generate pv-copying and translation functions * + ***********************************************************************/ + +#define TAG(x) via_##x +#include "tnl_dd/t_dd_vb.c" + +/*********************************************************************** + * Generate vertex emit and interp functions * + ***********************************************************************/ +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT) +#define TAG(x) x##_wg +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_SPEC_BIT) +#define TAG(x) x##_wgs +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_TEX0_BIT) +#define TAG(x) x##_wgt0 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_TEX0_BIT | VIA_TEX1_BIT) +#define TAG(x) x##_wgt0t1 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_TEX0_BIT | VIA_PTEX_BIT) +#define TAG(x) x##_wgpt0 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_TEX0_BIT | VIA_TEX1_BIT |\ + VIA_PTEX_BIT) +#define TAG(x) x##_wgpt0t1 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_SPEC_BIT | VIA_TEX0_BIT) +#define TAG(x) x##_wgst0 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_SPEC_BIT | VIA_TEX0_BIT |\ + VIA_TEX1_BIT) +#define TAG(x) x##_wgst0t1 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_SPEC_BIT | VIA_TEX0_BIT |\ + VIA_PTEX_BIT) +#define TAG(x) x##_wgspt0 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_SPEC_BIT | VIA_TEX0_BIT |\ + VIA_TEX1_BIT | VIA_PTEX_BIT) +#define TAG(x) x##_wgspt0t1 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_FOG_BIT) +#define TAG(x) x##_wgf +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_FOG_BIT | VIA_SPEC_BIT) +#define TAG(x) x##_wgfs +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_FOG_BIT | VIA_TEX0_BIT) +#define TAG(x) x##_wgft0 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_FOG_BIT | VIA_TEX0_BIT |\ + VIA_TEX1_BIT) +#define TAG(x) x##_wgft0t1 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_FOG_BIT | VIA_TEX0_BIT |\ + VIA_PTEX_BIT) +#define TAG(x) x##_wgfpt0 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_FOG_BIT | VIA_TEX0_BIT |\ + VIA_TEX1_BIT | VIA_PTEX_BIT) +#define TAG(x) x##_wgfpt0t1 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_FOG_BIT | VIA_SPEC_BIT |\ + VIA_TEX0_BIT) +#define TAG(x) x##_wgfst0 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_FOG_BIT | VIA_SPEC_BIT |\ + VIA_TEX0_BIT | VIA_TEX1_BIT) +#define TAG(x) x##_wgfst0t1 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_FOG_BIT | VIA_SPEC_BIT |\ + VIA_TEX0_BIT | VIA_PTEX_BIT) +#define TAG(x) x##_wgfspt0 +#include "via_dd_vbtmp.h" + +#define IND (VIA_XYZW_BIT | VIA_RGBA_BIT | VIA_FOG_BIT | VIA_SPEC_BIT |\ + VIA_TEX0_BIT | VIA_TEX1_BIT | VIA_PTEX_BIT) +#define TAG(x) x##_wgfspt0t1 +#include "via_dd_vbtmp.h" + +static void init_setup_tab(void) { + + init_wg(); + init_wgs(); + init_wgt0(); + init_wgt0t1(); + init_wgpt0(); + init_wgpt0t1(); + init_wgst0(); + init_wgst0t1(); + init_wgspt0(); + init_wgspt0t1(); + init_wgf(); + init_wgfs(); + init_wgft0(); + init_wgft0t1(); + init_wgfpt0(); + init_wgfpt0t1(); + init_wgfst0(); + init_wgfst0t1(); + init_wgfspt0(); + init_wgfspt0t1(); +} + +void viaPrintSetupFlags(char *msg, GLuint flags) { +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n", + msg, + (int)flags, + (flags & VIA_XYZW_BIT) ? " xyzw," : "", + (flags & VIA_RGBA_BIT) ? " rgba," : "", + (flags & VIA_SPEC_BIT) ? " spec," : "", + (flags & VIA_FOG_BIT) ? " fog," : "", + (flags & VIA_TEX0_BIT) ? " tex-0," : "", + (flags & VIA_TEX1_BIT) ? " tex-1," : ""); +#endif +} + +void viaCheckTexSizes(GLcontext *ctx) { + TNLcontext *tnl = TNL_CONTEXT(ctx); + viaContextPtr vmesa = VIA_CONTEXT(ctx); +#ifdef DEBUG + if (VIA_DEBUG) { + fprintf(stderr, "%s - in\n", __FUNCTION__); + fprintf(stderr, "setupIndex = %x\n", vmesa->setupIndex); + } +#endif + if (!setup_tab[vmesa->setupIndex].check_tex_sizes(ctx)) { + /* Invalidate stored verts + */ + vmesa->setupNewInputs = ~0; + vmesa->setupIndex |= VIA_PTEX_BIT; + + if (!vmesa->Fallback && + !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) { + tnl->Driver.Render.Interp = setup_tab[vmesa->setupIndex].interp; + tnl->Driver.Render.CopyPV = setup_tab[vmesa->setupIndex].copyPv; + } + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaBuildVertices(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint newinputs) +{ + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLubyte *v = ((GLubyte *)vmesa->verts + (start << vmesa->vertexStrideShift)); + GLuint stride = 1 << vmesa->vertexStrideShift; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + newinputs |= vmesa->setupNewInputs; + vmesa->setupNewInputs = 0; + if (!newinputs) + return; + if (newinputs & VERT_CLIP) { + setup_tab[vmesa->setupIndex].emit(ctx, start, count, v, stride); + } + else { + GLuint ind = 0; + + if (newinputs & VERT_RGBA) + ind |= VIA_RGBA_BIT; + + if (newinputs & VERT_SPEC_RGB) + ind |= VIA_SPEC_BIT; + + if (newinputs & VERT_TEX(0)) + ind |= VIA_TEX0_BIT; + + if (newinputs & VERT_TEX(1)) + ind |= VIA_TEX1_BIT; + + if (newinputs & VERT_FOG_COORD) + ind |= VIA_FOG_BIT; + + if (vmesa->setupIndex & VIA_PTEX_BIT) + ind = ~0; + + ind &= vmesa->setupIndex; + ind |= VIA_XYZW_BIT; + + if (ind) { + setup_tab[ind].emit(ctx, start, count, v, stride); + } + } +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaChooseVertexState(GLcontext *ctx) { + TNLcontext *tnl = TNL_CONTEXT(ctx); + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLuint ind = VIA_XYZW_BIT | VIA_RGBA_BIT; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif + if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) + ind |= VIA_SPEC_BIT; + + if (ctx->Fog.Enabled) + ind |= VIA_FOG_BIT; + + if (ctx->Texture.Unit[1]._ReallyEnabled) + ind |= VIA_TEX1_BIT | VIA_TEX0_BIT; + else if (ctx->Texture.Unit[0]._ReallyEnabled) + ind |= VIA_TEX0_BIT; + + vmesa->setupIndex = ind; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "setupIndex = %x\n", vmesa->setupIndex); +#endif + + if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) { + tnl->Driver.Render.Interp = via_interp_extras; + tnl->Driver.Render.CopyPV = via_copy_pv_extras; + } + else { + tnl->Driver.Render.Interp = setup_tab[ind].interp; + tnl->Driver.Render.CopyPV = setup_tab[ind].copyPv; + } + + vmesa->vertexSize = setup_tab[ind].vertexSize; + vmesa->vertexStrideShift = setup_tab[ind].vertexStrideShift; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif + +} + +void via_emit_contiguous_verts(GLcontext *ctx, + GLuint start, + GLuint count) { + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLuint vertexSize = vmesa->vertexSize * 4; + GLuint *dest = viaCheckDma(vmesa, (count - start) * vertexSize); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); + + if (VIA_DEBUG) fprintf(stderr, "choose setup_tab[0x%x]\n", vmesa->setupIndex); +#endif + setup_tab[vmesa->setupIndex].emit(ctx, start, count, dest, vertexSize); + vmesa->dmaLow += (count - start) * vertexSize; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +void viaInitVB(GLcontext *ctx) { + viaContextPtr vmesa = VIA_CONTEXT(ctx); + GLuint size = TNL_CONTEXT(ctx)->vb.Size; + + vmesa->verts = ALIGN_MALLOC(size * 4 * 16, 32); + + { + static int firsttime = 1; + if (firsttime) { + init_setup_tab(); + firsttime = 0; + } + } +} + +void viaFreeVB(GLcontext *ctx) { + viaContextPtr vmesa = VIA_CONTEXT(ctx); + + if (vmesa->verts) { + ALIGN_FREE(vmesa->verts); + vmesa->verts = 0; + } + + if (vmesa->UbyteSecondaryColor.Ptr) { + ALIGN_FREE(vmesa->UbyteSecondaryColor.Ptr); + vmesa->UbyteSecondaryColor.Ptr = 0; + } + + if (vmesa->UbyteColor.Ptr) { + ALIGN_FREE(vmesa->UbyteColor.Ptr); + vmesa->UbyteColor.Ptr = 0; + } +} diff --git a/xc/lib/GL/mesa/src/drv/via/via_vb.h b/xc/lib/GL/mesa/src/drv/via/via_vb.h new file mode 100644 index 000000000..63d8c0474 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_vb.h @@ -0,0 +1,69 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _VIAVB_H +#define _VIAVB_H + +#include "mtypes.h" +#include "swrast/swrast.h" + +#define VIA_TEX1_BIT 0x0001 +#define VIA_TEX0_BIT 0x0002 +#define VIA_RGBA_BIT 0x0004 +#define VIA_SPEC_BIT 0x0008 +#define VIA_FOG_BIT 0x0010 +#define VIA_XYZW_BIT 0x0020 +#define VIA_PTEX_BIT 0x0040 +#define VIA_MAX_SETUP 0x0080 + +#define _VIA_NEW_VERTEX (_NEW_TEXTURE | \ + _DD_NEW_SEPARATE_SPECULAR | \ + _DD_NEW_TRI_UNFILLED | \ + _DD_NEW_TRI_LIGHT_TWOSIDE | \ + _NEW_FOG) + + +extern void viaChooseVertexState(GLcontext *ctx); +extern void viaCheckTexSizes(GLcontext *ctx); +extern void viaBuildVertices(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint newinputs); + + +extern void via_emit_contiguous_verts(GLcontext *ctx, + GLuint start, + GLuint count); + +extern void via_translate_vertex(GLcontext *ctx, + const viaVertex *src, + SWvertex *dst); + +extern void viaInitVB(GLcontext *ctx); +extern void viaFreeVB(GLcontext *ctx); + +extern void via_print_vertex(GLcontext *ctx, const viaVertex *v); +extern void viaPrintSetupFlags(char *msg, GLuint flags); + +#endif diff --git a/xc/lib/GL/mesa/src/drv/via/via_vb_cliptmp.h b/xc/lib/GL/mesa/src/drv/via/via_vb_cliptmp.h new file mode 100644 index 000000000..2e3a08c2a --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_vb_cliptmp.h @@ -0,0 +1,292 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +#define CLIP_DOTPROD(K, A, B, C, D) X(K) * A + Y(K) * B + Z(K) * C + W(K) * D + +#define POLY_CLIP(PLANE, A, B, C, D) \ +do { \ + if (mask & PLANE) { \ + GLuint idxPrev = inlist[0]; \ + GLfloat dpPrev = CLIP_DOTPROD(idxPrev, A, B, C, D); \ + GLuint outcount = 0; \ + GLuint i; \ + \ + inlist[n] = inlist[0]; /* prevent rotation of vertices */ \ + for (i = 1; i <= n; i++) { \ + GLuint idx = inlist[i]; \ + GLfloat dp = CLIP_DOTPROD(idx, A, B, C, D); \ + \ + clipmask[idxPrev] |= PLANE; \ + if (!NEGATIVE(dpPrev)) { \ + outlist[outcount++] = idxPrev; \ + clipmask[idxPrev] &= ~PLANE; \ + } \ + \ + if (DIFFERENT_SIGNS(dp, dpPrev)) { \ + GLuint newvert = VB->LastClipped++; \ + VB->ClipMask[newvert] = 0; \ + outlist[outcount++] = newvert; \ + if (NEGATIVE(dp)) { \ + /* Going out of bounds. Avoid division by zero as we \ + * know dp != dpPrev from DIFFERENT_SIGNS, above. \ + */ \ + GLfloat t = dp / (dp - dpPrev); \ + INTERP_4F(t, coord[newvert], coord[idx], coord[idxPrev]); \ + interp(ctx, t, newvert, idx, idxPrev, GL_TRUE); \ + } \ + else { \ + /* Coming back in. \ + */ \ + GLfloat t = dpPrev / (dpPrev - dp); \ + INTERP_4F(t, coord[newvert], coord[idxPrev], coord[idx]); \ + interp(ctx, t, newvert, idxPrev, idx, GL_FALSE); \ + } \ + } \ + \ + idxPrev = idx; \ + dpPrev = dp; \ + } \ + \ + if (outcount < 3) \ + return; \ + \ + { \ + GLuint *tmp = inlist; \ + inlist = outlist; \ + outlist = tmp; \ + n = outcount; \ + } \ + } \ +} while (0) + + +#define LINE_CLIP(PLANE, A, B, C, D) \ +do { \ + if (mask & PLANE) { \ + GLfloat dpI = CLIP_DOTPROD(ii, A, B, C, D); \ + GLfloat dpJ = CLIP_DOTPROD(jj, A, B, C, D); \ + \ + if (DIFFERENT_SIGNS(dpI, dpJ)) { \ + GLuint newvert = VB->LastClipped++; \ + VB->ClipMask[newvert] = 0; \ + if (NEGATIVE(dpJ)) { \ + GLfloat t = dpI / (dpI - dpJ); \ + VB->ClipMask[jj] |= PLANE; \ + INTERP_4F(t, coord[newvert], coord[ii], coord[jj]); \ + interp(ctx, t, newvert, ii, jj, GL_FALSE); \ + jj = newvert; \ + } \ + else { \ + GLfloat t = dpJ / (dpJ - dpI); \ + VB->ClipMask[ii] |= PLANE; \ + INTERP_4F(t, coord[newvert], coord[jj], coord[ii]); \ + interp(ctx, t, newvert, jj, ii, GL_FALSE); \ + ii = newvert; \ + } \ + } \ + else if (NEGATIVE(dpI)) \ + return; \ + } \ +} while (0) + + +/* Clip a line against the viewport and user clip planes. + */ +static INLINE void +TAG(clip_line)(GLcontext *ctx, GLuint i, GLuint j, GLubyte mask) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + interp_func interp = tnl->Driver.Render.Interp; + GLfloat (*coord)[4] = VB->ClipPtr->data; + GLuint ii = i, jj = j, p; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + VB->LastClipped = VB->FirstClipped; + + if (mask & 0x3f) { + LINE_CLIP(CLIP_RIGHT_BIT, -1, 0, 0, 1); + LINE_CLIP(CLIP_LEFT_BIT, 1, 0, 0, 1); + LINE_CLIP(CLIP_TOP_BIT, 0, -1, 0, 1); + LINE_CLIP(CLIP_BOTTOM_BIT, 0, 1, 0, 1); + LINE_CLIP(CLIP_FAR_BIT, 0, 0, -1, 1); + LINE_CLIP(CLIP_NEAR_BIT, 0, 0, 1, 1); + } + + if (mask & CLIP_USER_BIT) { +#ifdef FIXME + for (p = 0; p < MAX_CLIP_PLANES; p++) { + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + LINE_CLIP(CLIP_USER_BIT, a, b, c, d); + } + } +#endif + } + + if ((ctx->_TriangleCaps & DD_FLATSHADE) && j != jj) + tnl->Driver.Render.CopyPV(ctx, jj, j); + + tnl->Driver.Render.ClippedLine(ctx, ii, jj); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + + +/* Clip a triangle against the viewport and user clip planes. + */ +static INLINE void +TAG(clip_tri)(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + interp_func interp = tnl->Driver.Render.Interp; + GLfloat (*coord)[4] = VB->ClipPtr->data; + GLuint pv = v2; + GLuint vlist[2][MAX_CLIPPED_VERTICES]; + GLuint *inlist = vlist[0], *outlist = vlist[1]; + GLuint p; + GLubyte *clipmask = VB->ClipMask; + GLuint n = 3; + +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + ASSIGN_3V(inlist, v2, v0, v1); /* pv rotated to slot zero */ + + VB->LastClipped = VB->FirstClipped; + + if (mask & 0x3f) { + POLY_CLIP(CLIP_RIGHT_BIT, -1, 0, 0, 1); + POLY_CLIP(CLIP_LEFT_BIT, 1, 0, 0, 1); + POLY_CLIP(CLIP_TOP_BIT, 0, -1, 0, 1); + POLY_CLIP(CLIP_BOTTOM_BIT, 0, 1, 0, 1); + POLY_CLIP(CLIP_FAR_BIT, 0, 0, -1, 1); + POLY_CLIP(CLIP_NEAR_BIT, 0, 0, 1, 1); + } + + if (mask & CLIP_USER_BIT) { +#ifdef FIXME + for (p = 0; p < MAX_CLIP_PLANES; p++) { + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + POLY_CLIP(CLIP_USER_BIT, a, b, c, d); + } + } +#endif + } + + if (ctx->_TriangleCaps & DD_FLATSHADE) { + if (pv != inlist[0]) { + ASSERT(inlist[0] >= VB->FirstClipped); + tnl->Driver.Render.CopyPV(ctx, inlist[0], pv); + } + } + + tnl->Driver.Render.ClippedPolygon(ctx, inlist, n); +} + + +/* Clip a quad against the viewport and user clip planes. + */ +static INLINE void +TAG(clip_quad)(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, + GLubyte mask) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + interp_func interp = tnl->Driver.Render.Interp; + GLfloat (*coord)[4] = VB->ClipPtr->data; + GLuint pv = v3; + GLuint vlist[2][MAX_CLIPPED_VERTICES]; + GLuint *inlist = vlist[0], *outlist = vlist[1]; + GLuint p; + GLubyte *clipmask = VB->ClipMask; + GLuint n = 4; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + ASSIGN_4V(inlist, v3, v0, v1, v2); /* pv rotated to slot zero */ + + VB->LastClipped = VB->FirstClipped; + + if (mask & 0x3f) { + POLY_CLIP(CLIP_RIGHT_BIT, -1, 0, 0, 1); + POLY_CLIP(CLIP_LEFT_BIT, 1, 0, 0, 1); + POLY_CLIP(CLIP_TOP_BIT, 0, -1, 0, 1); + POLY_CLIP(CLIP_BOTTOM_BIT, 0, 1, 0, 1); + POLY_CLIP(CLIP_FAR_BIT, 0, 0, -1, 1); + POLY_CLIP(CLIP_NEAR_BIT, 0, 0, 1, 1); + } + + if (mask & CLIP_USER_BIT) { +#ifdef FIXME + for (p = 0; p < MAX_CLIP_PLANES; p++) { + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + POLY_CLIP(CLIP_USER_BIT, a, b, c, d); + } + } +#endif + } + + if (ctx->_TriangleCaps & DD_FLATSHADE) { + if (pv != inlist[0]) { + ASSERT(inlist[0] >= VB->FirstClipped); + tnl->Driver.Render.CopyPV(ctx, inlist[0], pv); + } + } + + tnl->Driver.Render.ClippedPolygon(ctx, inlist, n); +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +#undef W +#undef Z +#undef Y +#undef X +#undef SIZE +#undef TAG +#undef POLY_CLIP +#undef LINE_CLIP diff --git a/xc/lib/GL/mesa/src/drv/via/via_vb_rendertmp.h b/xc/lib/GL/mesa/src/drv/via/via_vb_rendertmp.h new file mode 100644 index 000000000..aa130f960 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/via_vb_rendertmp.h @@ -0,0 +1,509 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +#ifndef POSTFIX +#define POSTFIX +#endif + +#ifndef INIT +#define INIT(x) +#endif + +#ifndef NEED_EDGEFLAG_SETUP +#define NEED_EDGEFLAG_SETUP 0 +#define EDGEFLAG_GET(a) 0 +#define EDGEFLAG_SET(a,b) (void)b +#endif + +#ifndef RESET_STIPPLE +#define RESET_STIPPLE +#endif + +#ifndef RESET_OCCLUSION +#define RESET_OCCLUSION +#endif + +#ifndef TEST_PRIM_END +#define TEST_PRIM_END(flags) (flags & PRIM_END) +#define TEST_PRIM_BEGIN(flags) (flags & PRIM_BEGIN) +#define TEST_PRIM_PARITY(flags) (flags & PRIM_PARITY) +#endif + +#ifndef ELT +#define ELT(x) x +#endif + +#ifndef RENDER_TAB_QUALIFIER +#define RENDER_TAB_QUALIFIER static +#endif + +static void TAG(render_points)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + LOCAL_VARS; + (void)flags; +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + + RESET_OCCLUSION; + INIT(GL_POINTS); + RENDER_POINTS(start, count); + POSTFIX; +} + +static void TAG(render_lines)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + GLuint j; + LOCAL_VARS; + (void)flags; + +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + RESET_OCCLUSION; + INIT(GL_LINES); + for (j = start + 1; j < count; j += 2) { + RESET_STIPPLE; + RENDER_LINE(ELT(j - 1), ELT(j)); + } + POSTFIX; +} + +static void TAG(render_line_strip)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + GLuint j; + LOCAL_VARS; + (void)flags; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + RESET_OCCLUSION; + INIT(GL_LINES); + + if (TEST_PRIM_BEGIN(flags)) { + RESET_STIPPLE; + } + + for (j = start + 1; j < count; j++) + RENDER_LINE(ELT(j - 1), ELT(j)); + + POSTFIX; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void TAG(render_line_loop)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + GLuint i; + LOCAL_VARS; + (void)flags; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + RESET_OCCLUSION; + INIT(GL_LINES); + + if (start + 1 < count) { + if (TEST_PRIM_BEGIN(flags)) { + RESET_STIPPLE; + RENDER_LINE(ELT(start), ELT(start + 1)); + } + + for (i = start + 2 ; i < count ; i++) { + RENDER_LINE(ELT(i - 1), ELT(i)); + } + + if (TEST_PRIM_END(flags)) { + RENDER_LINE(ELT(count - 1), ELT(start)); + } + } + + POSTFIX; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void TAG(render_triangles)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + GLuint j; + LOCAL_VARS; + (void)flags; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + INIT(GL_TRIANGLES); + if (NEED_EDGEFLAG_SETUP) { + for (j = start + 2; j < count; j += 3) { + /* Leave the edgeflags as supplied by the user. + */ + RESET_STIPPLE; + RENDER_TRI(ELT(j - 2), ELT(j - 1), ELT(j)); + } + } + else { + for (j = start + 2; j < count; j += 3) { + RENDER_TRI(ELT(j - 2), ELT(j - 1), ELT(j)); + } + } + POSTFIX; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void TAG(render_tri_strip)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + GLuint j; + GLuint parity = 0; + LOCAL_VARS; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + if (TEST_PRIM_PARITY(flags)) + parity = 1; + + INIT(GL_TRIANGLES); + + if (NEED_EDGEFLAG_SETUP) { + for (j = start + 2; j < count; j++, parity ^= 1) { + GLuint ej2 = ELT(j - 2 + parity); + GLuint ej1 = ELT(j - 1 - parity); + GLuint ej = ELT(j); + GLboolean ef2 = EDGEFLAG_GET(ej2); + GLboolean ef1 = EDGEFLAG_GET(ej1); + GLboolean ef = EDGEFLAG_GET(ej); + if (TEST_PRIM_BEGIN(flags)) { + RESET_STIPPLE; + } + EDGEFLAG_SET(ej2, GL_TRUE); + EDGEFLAG_SET(ej1, GL_TRUE); + EDGEFLAG_SET(ej, GL_TRUE); + RENDER_TRI(ej2, ej1, ej); + EDGEFLAG_SET(ej2, ef2); + EDGEFLAG_SET(ej1, ef1); + EDGEFLAG_SET(ej, ef); + } + } + else { + for (j = start + 2; j < count; j++, parity ^= 1) { + RENDER_TRI(ELT(j - 2 + parity), ELT(j - 1 - parity), ELT(j)); + } + } + POSTFIX; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void TAG(render_tri_fan)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + GLuint j; + LOCAL_VARS; + (void)flags; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + INIT(GL_TRIANGLES); + if (NEED_EDGEFLAG_SETUP) { + for (j = start + 2; j < count; j++) { + /* For trifans, all edges are boundary. + */ + GLuint ejs = ELT(start); + GLuint ej1 = ELT(j - 1); + GLuint ej = ELT(j); + GLboolean efs = EDGEFLAG_GET(ejs); + GLboolean ef1 = EDGEFLAG_GET(ej1); + GLboolean ef = EDGEFLAG_GET(ej); + if (TEST_PRIM_BEGIN(flags)) { + RESET_STIPPLE; + } + EDGEFLAG_SET(ejs, GL_TRUE); + EDGEFLAG_SET(ej1, GL_TRUE); + EDGEFLAG_SET(ej, GL_TRUE); + RENDER_TRI(ejs, ej1, ej); + EDGEFLAG_SET(ejs, efs); + EDGEFLAG_SET(ej1, ef1); + EDGEFLAG_SET(ej, ef); + } + } + else { + for (j = start + 2; j < count; j++) { + RENDER_TRI(ELT(start), ELT(j - 1), ELT(j)); + } + } + + POSTFIX; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void TAG(render_poly)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + GLuint j = start + 2; + LOCAL_VARS; + (void)flags; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + INIT(GL_TRIANGLES); + + if (NEED_EDGEFLAG_SETUP) { + GLboolean efstart = EDGEFLAG_GET(ELT(start)); + GLboolean efcount = EDGEFLAG_GET(ELT(count - 1)); + + /* If the primitive does not begin here, the first edge + * is non-boundary. + */ + if (!TEST_PRIM_BEGIN(flags)) { + EDGEFLAG_SET(ELT(start), GL_FALSE); + } + else { + RESET_STIPPLE; + } + + /* If the primitive does not end here, the final edge is + * non-boundary. + */ + if (!TEST_PRIM_END(flags)) { + EDGEFLAG_SET(ELT(count - 1), GL_FALSE); + } + + /* Draw the first triangles (possibly zero) + */ + if (j+1<count) { + GLboolean ef = EDGEFLAG_GET(ELT(j)); + EDGEFLAG_SET(ELT(j), GL_FALSE); + RENDER_TRI(ELT(j - 1), ELT(j), ELT(start)); + EDGEFLAG_SET(ELT(j), ef); + j++; + + /* Don't render the first edge again: + */ + EDGEFLAG_SET(ELT(start), GL_FALSE); + + for (;j+1<count;j++) { + GLboolean efj = EDGEFLAG_GET(ELT(j)); + EDGEFLAG_SET(ELT(j), GL_FALSE); + RENDER_TRI(ELT(j - 1), ELT(j), ELT(start)); + EDGEFLAG_SET(ELT(j), efj); + } + } + + /* Draw the last or only triangle + */ + if (j < count) { + RENDER_TRI(ELT(j-1), ELT(j), ELT(start)); + } + + /* Restore the first and last edgeflags: + */ + EDGEFLAG_SET(ELT(count - 1), efcount); + EDGEFLAG_SET(ELT(start), efstart); + } + else { + for (j = start + 2; j < count; j++) { + RENDER_TRI(ELT(j - 1), ELT(j), ELT(start)); + } + } + POSTFIX; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void TAG(render_quads)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + GLuint j; + LOCAL_VARS; + (void)flags; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + INIT(GL_TRIANGLES); + if (NEED_EDGEFLAG_SETUP) { + for (j = start + 3; j < count; j += 4) { + /* Use user-specified edgeflags for quads. + */ + RESET_STIPPLE; + RENDER_QUAD(ELT(j - 3), ELT(j - 2), ELT(j - 1), ELT(j)); + } + } + else { + for (j = start + 3; j < count; j += 4) { + RENDER_QUAD(ELT(j - 3), ELT(j - 2), ELT(j - 1), ELT(j)); + } + } + POSTFIX; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void TAG(render_quad_strip)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + GLuint j; + LOCAL_VARS; + (void)flags; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); +#endif +#ifdef PERFORMANCE_MEASURE + if (VIA_PERFORMANCE) P_M; +#endif + INIT(GL_TRIANGLES); + if (NEED_EDGEFLAG_SETUP) { + for (j = start + 3; j < count; j += 2) { + /* All edges are boundary. Set edgeflags to 1, draw the + * quad, and restore them to the original values. + */ + GLboolean ef3 = EDGEFLAG_GET(ELT(j - 3)); + GLboolean ef2 = EDGEFLAG_GET(ELT(j - 2)); + GLboolean ef1 = EDGEFLAG_GET(ELT(j - 1)); + GLboolean ef = EDGEFLAG_GET(ELT(j)); + if (TEST_PRIM_BEGIN(flags)) { + RESET_STIPPLE; + } + EDGEFLAG_SET(ELT(j - 3), GL_TRUE); + EDGEFLAG_SET(ELT(j - 2), GL_TRUE); + EDGEFLAG_SET(ELT(j - 1), GL_TRUE); + EDGEFLAG_SET(ELT(j), GL_TRUE); + RENDER_QUAD(ELT(j - 1), ELT(j - 3), ELT(j - 2), ELT(j)); + EDGEFLAG_SET(ELT(j - 3), ef3); + EDGEFLAG_SET(ELT(j - 2), ef2); + EDGEFLAG_SET(ELT(j - 1), ef1); + EDGEFLAG_SET(ELT(j), ef); + } + } + else { + for (j = start + 3; j < count; j += 2) { + RENDER_QUAD(ELT(j - 1), ELT(j - 3), ELT(j - 2), ELT(j)); + } + } + POSTFIX; +#ifdef DEBUG + if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); +#endif +} + +static void TAG(render_noop)(GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags) +{ + (void)(ctx && start && count && flags); +} + +RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON + 2])(GLcontext *, + GLuint, + GLuint, + GLuint) = +{ + TAG(render_points), + TAG(render_lines), + TAG(render_line_loop), + TAG(render_line_strip), + TAG(render_triangles), + TAG(render_tri_strip), + TAG(render_tri_fan), + TAG(render_quads), + TAG(render_quad_strip), + TAG(render_poly), + TAG(render_noop), +}; + +#ifndef PRESERVE_VB_DEFS +#undef RENDER_TRI +#undef RENDER_QUAD +#undef RENDER_LINE +#undef RENDER_POINTS +#undef LOCAL_VARS +#undef INIT +#undef POSTFIX +#undef RESET_STIPPLE +#undef DBG +#undef ELT +#undef RENDER_TAB_QUALIFIER +#endif + +#ifndef PRESERVE_TAG +#undef TAG +#endif + +#undef PRESERVE_VB_DEFS +#undef PRESERVE_TAG diff --git a/xc/lib/GL/mesa/src/drv/via/xf86drmVIA.c b/xc/lib/GL/mesa/src/drv/via/xf86drmVIA.c new file mode 100644 index 000000000..e39bdf745 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/xf86drmVIA.c @@ -0,0 +1,140 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifdef XFree86Server +# include "xf86.h" +# include "xf86_OSproc.h" +# include "xf86_ansic.h" +# define _DRM_MALLOC xalloc +# define _DRM_FREE xfree +# ifndef XFree86LOADER +# include <sys/mman.h> +# endif +#else +# include <stdio.h> +# include <stdlib.h> +# include <unistd.h> +# include <string.h> +# include <ctype.h> +# include <fcntl.h> +# include <errno.h> +# include <signal.h> +# include <sys/types.h> +# include <sys/ioctl.h> +# include <sys/mman.h> +# include <sys/time.h> +# ifdef DRM_USE_MALLOC +# define _DRM_MALLOC malloc +# define _DRM_FREE free +extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); +extern int xf86RemoveSIGIOHandler(int fd); +# else +# include <X11/Xlibint.h> +# define _DRM_MALLOC Xmalloc +# define _DRM_FREE Xfree +# endif +#endif + +/* Not all systems have MAP_FAILED defined */ +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +#ifdef __linux__ +#include <sys/sysmacros.h> /* for makedev() */ +#endif +#include "xf86drm.h" +#include "xf86drmVIA.h" +#include "drm.h" +#include "via_common.h" +int drmVIAAgpInit(int fd, int offset, int size) +{ + drm_via_agp_t agp; + agp.offset = offset; + agp.size = size; + + if (ioctl(fd, DRM_IOCTL_VIA_AGP_INIT, &agp) < 0) { + return -errno; + } + else { + return 0; + } +} + +int drmVIAFBInit(int fd, int offset, int size) +{ + drm_via_fb_t fb; + fb.offset = offset; + fb.size = size; + + if (ioctl(fd, DRM_IOCTL_VIA_FB_INIT, &fb) < 0) { + return -errno; + } + else + return 0; +} + +int drmVIAInitMAP(int fd, drmVIAInit *info) +{ + drm_via_init_t init; + + memset(&init, 0, sizeof(drm_via_init_t)); + init.func = VIA_INIT_MAP; + init.sarea_priv_offset = info->sarea_priv_offset; + init.fb_offset = info->fb_offset; + init.mmio_offset = info->mmio_offset; + init.agpAddr = info->agpAddr; + + if (ioctl(fd, DRM_IOCTL_VIA_MAP_INIT, &init ) < 0) { + return -errno; + } + else + return 0; +} + +int drmVIAAllocateDMA(int fd, drmVIADMABuf *buf) +{ + if (drmAddMap(fd, 0, buf->size, + DRM_SHM, 0, + &buf->index) < 0) { + return -errno; + } + + if (drmMap(fd,(drmHandle)buf->index, + buf->size,(drmAddressPtr)(&buf->address)) < 0) { + return -errno; + } + + memset(buf->address, 0, buf->size); + + return 0; +} + +int drmVIAReleaseDMA(int fd, drmVIADMABuf *buf) +{ + if (drmUnmap((drmAddress)(buf->address), buf->size) < 0) + return -errno; + + return 0; +} diff --git a/xc/lib/GL/mesa/src/drv/via/xf86drmVIA.h b/xc/lib/GL/mesa/src/drv/via/xf86drmVIA.h new file mode 100644 index 000000000..4b6457933 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/via/xf86drmVIA.h @@ -0,0 +1,54 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __XF86DRI_VIA_H__ +#define __XF86DRI_VIA_H__ + +typedef struct { + unsigned long sarea_priv_offset; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long agpAddr; +} drmVIAInit; + +typedef struct { + unsigned int offset; + unsigned int size; + unsigned int index; +} drmVIAAGPBuf; + +typedef struct { + unsigned int offset; + unsigned int size; + unsigned long index; + unsigned long *address; +} drmVIADMABuf; + +extern int drmVIAAgpInit(int fd, int offset, int size); +extern int drmVIAFBInit(int fd, int offset, int size); +extern int drmVIAInitMAP(int fd, drmVIAInit *info); +extern int drmVIAAllocateDMA(int fd, drmVIADMABuf *buf); +extern int drmVIAReleaseDMA(int fd, drmVIADMABuf *buf); + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/HWDiff.c b/xc/programs/Xserver/hw/xfree86/drivers/via/HWDiff.c new file mode 100644 index 000000000..db61e4f59 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/HWDiff.c @@ -0,0 +1,161 @@ +/*************************************************************************
+ *
+ * HWDiff.c
+ *
+ * Implement all Video Function for the Driver
+ *
+ * DATE 04/07/2003
+ *
+ *************************************************************************/
+
+#include "via_driver.h"
+#include "HWDiff.h"
+/*#include "debug.h"*/
+
+
+/**************************************************************************
+//Global Variable for Video function
+**************************************************************************/
+VIDHWDIFFERENCE VideoHWDifference;
+
+/**************************************************************************
+//Extern Variable for Video function
+**************************************************************************/
+
+
+/**************************************************************************
+//Extern function for Video function
+**************************************************************************/
+
+
+/**************************************************************************
+//Defination for Video function
+************************************************************************/
+
+
+/**************************************************************************
+//Structure defination for Video function
+**************************************************************************/
+
+
+/**************************************************************************
+//function defination for Video Driver
+**************************************************************************/
+
+
+/**************************************************************************
+//function implement for Video Driver
+**************************************************************************/
+void vfInitHWDiff( VIAPtr pVia )
+{
+ LPVIDHWDIFFERENCE lpVideoHWDifference = &VideoHWDifference;
+ /*LPWaitHWINFO lpWaitHWInfo;
+
+ //lpVideoHWDifference = (LPVIDHWDIFFERENCE) (ppdev->lpVideoHWDifference);
+ //lpWaitHWInfo = (LPWaitHWINFO) ppdev->lpWaitHWInfo;*/
+
+ /*switch(ppdev->dwDeviceID)
+ {
+ case DEVICE_VT3204:
+ //HW Difference Flag
+ lpVideoHWDifference->dwThreeHQVBuffer = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwV3SrcHeightSetting = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwSupportExtendFIFO = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwHQVFetchByteUnit = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwHQVInitPatch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwSupportV3Gamma=VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwUpdFlip = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwHQVDisablePatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwSUBFlip = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwNeedV3Prefetch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwNeedV4Prefetch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwUseSystemMemory = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwExpandVerPatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwExpandVerHorPatch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwV3ExpireNumTune = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwV3FIFOThresholdTune = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwCheckHQVFIFOEmpty = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwUseMPEGAGP = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwV3FIFOPatch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwSupportTwoColorKey = VID_HWDIFF_FALSE;
+ break;
+ case DEVICE_VT3205:
+ //HW Difference Flag
+ lpVideoHWDifference->dwThreeHQVBuffer = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwV3SrcHeightSetting = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwSupportExtendFIFO = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwHQVFetchByteUnit = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwHQVInitPatch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwSupportV3Gamma=VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwUpdFlip = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwHQVDisablePatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwSUBFlip = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwNeedV3Prefetch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwNeedV4Prefetch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwUseSystemMemory = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwExpandVerPatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwExpandVerHorPatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwV3ExpireNumTune = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwV3FIFOThresholdTune = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwCheckHQVFIFOEmpty = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwUseMPEGAGP = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwV3FIFOPatch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwSupportTwoColorKey = VID_HWDIFF_FALSE;
+ break;
+ case VIA_DEVICE_CLE1:
+ case VIA_DEVICE_CLE2:*/
+ switch (pVia->ChipRev)
+ {
+ case VIA_REVISION_CLEC0:
+ case VIA_REVISION_CLEC1:
+ /*HW Difference Flag*/
+ lpVideoHWDifference->dwThreeHQVBuffer = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwV3SrcHeightSetting = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwSupportExtendFIFO = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwHQVFetchByteUnit = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwHQVInitPatch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwSupportV3Gamma=VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwUpdFlip = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwHQVDisablePatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwSUBFlip = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwNeedV3Prefetch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwNeedV4Prefetch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwUseSystemMemory = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwExpandVerPatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwExpandVerHorPatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwV3ExpireNumTune = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwV3FIFOThresholdTune = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwCheckHQVFIFOEmpty = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwUseMPEGAGP = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwV3FIFOPatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwSupportTwoColorKey = VID_HWDIFF_TRUE;
+ /*lpVideoHWDifference->dwCxColorSpace = VID_HWDIFF_TRUE;*/
+ break;
+ default:
+ /*HW Difference Flag*/
+ lpVideoHWDifference->dwThreeHQVBuffer = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwV3SrcHeightSetting = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwSupportExtendFIFO = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwHQVFetchByteUnit = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwHQVInitPatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwSupportV3Gamma=VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwUpdFlip = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwHQVDisablePatch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwSUBFlip = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwNeedV3Prefetch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwNeedV4Prefetch = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwUseSystemMemory = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwExpandVerPatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwExpandVerHorPatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwV3ExpireNumTune = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwV3FIFOThresholdTune = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwCheckHQVFIFOEmpty = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwUseMPEGAGP = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwV3FIFOPatch = VID_HWDIFF_TRUE;
+ lpVideoHWDifference->dwSupportTwoColorKey = VID_HWDIFF_FALSE;
+ lpVideoHWDifference->dwCxColorSpace = VID_HWDIFF_FALSE;
+ break;
+ }/*CLEC0 Switch*/
+/* break;
+ } */
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/HWDiff.h b/xc/programs/Xserver/hw/xfree86/drivers/via/HWDiff.h new file mode 100644 index 000000000..7f46a7e54 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/HWDiff.h @@ -0,0 +1,82 @@ +/******************************Module*Header*******************************
+* Module Name: HWDiff.h
+*
+* Put all video function and parameters.
+*
+* Copyright (c) 2003 VIA Technologies, Inc. All rights reserved.
+**************************************************************************/
+
+#ifndef _VIDEOFUN_H
+#define _VIDEOFUN_H
+
+/*#include "precomp.h"
+#include "wlknmpg.h"
+#include "Hwvid.h"*/
+
+/**************************************************************************
+//Global Variable for Video function
+**************************************************************************/
+
+
+/**************************************************************************
+//Extern Variable for Video function
+**************************************************************************/
+
+
+/**************************************************************************
+//Extern function for Video function
+**************************************************************************/
+
+
+/**************************************************************************
+//Defination for Video HW Difference
+**************************************************************************/
+/*For Video HW Difference */
+#define VIA_REVISION_CLEC0 0x10
+#define VIA_REVISION_CLEC1 0x11
+#define VIA_REVISION_CLECX 0x10
+
+#define VID_HWDIFF_TRUE 0x00000001
+#define VID_HWDIFF_FALSE 0x00000000
+
+/**************************************************************************
+//Structure defination for Video function
+**************************************************************************/
+/*Video HW Difference Structure*/
+typedef struct _VIDHWDIFFERENCE
+{
+ unsigned long dwThreeHQVBuffer; /*Use Three HQV Buffers*/
+ unsigned long dwV3SrcHeightSetting; /*Set Video Source Width and Height*/
+ unsigned long dwSupportExtendFIFO; /*Support Extand FIFO*/
+ unsigned long dwHQVFetchByteUnit; /*HQV Fetch Count unit is byte*/
+ unsigned long dwHQVInitPatch; /*Initialize HQV Engine 2 times*/
+ unsigned long dwSupportV3Gamma; /*Support V3 Gamma */
+ unsigned long dwUpdFlip; /*Set HQV3D0[15] to flip video*/
+ unsigned long dwHQVDisablePatch; /*Change Video Engine Clock setting for HQV disable bug*/
+ unsigned long dwSUBFlip; /*Set HQV3D0[15] to flip video for sub-picture blending*/
+ unsigned long dwNeedV3Prefetch; /*V3 pre-fetch function for K8*/
+ unsigned long dwNeedV4Prefetch; /*V4 pre-fetch function for K8*/
+ unsigned long dwUseSystemMemory; /*Use system memory for DXVA compressed data buffers*/
+ unsigned long dwExpandVerPatch; /*Patch video HW bug in expand SIM mode or same display path*/
+ unsigned long dwExpandVerHorPatch; /*Patch video HW bug in expand SAMM mode or same display path*/
+ unsigned long dwV3ExpireNumTune; /*Change V3 expire number setting for V3 bandwidth issue*/
+ unsigned long dwV3FIFOThresholdTune; /*Change V3 FIFO, Threshold and Pre-threshold setting for V3 bandwidth issue*/
+ unsigned long dwCheckHQVFIFOEmpty; /*HW Flip path, need to check HQV FIFO status */
+ unsigned long dwUseMPEGAGP; /*Use MPEG AGP function*/
+ unsigned long dwV3FIFOPatch; /*For CLE V3 FIFO Bug (srcWidth <= 8)*/
+ unsigned long dwSupportTwoColorKey; /*Support two color key*/
+ unsigned long dwCxColorSpace; /*CLE_Cx ColorSpace*/
+}VIDHWDIFFERENCE, * LPVIDHWDIFFERENCE;
+
+
+/*Wait Function Structure and Flag*/
+typedef struct _WaitHWINFO
+{
+ unsigned char* pjVideo; /*MMIO Address Info*/
+ unsigned long dwVideoFlag; /*Video Flag*/
+}WaitHWINFO, * LPWaitHWINFO;
+
+
+
+#endif
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/via/Imakefile new file mode 100644 index 000000000..70a8ed888 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/Imakefile @@ -0,0 +1,112 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/Imakefile,v 1.2 2000/12/02 15:30:48 tsi Exp $ +/* + * + * Copyright 1995-1998 The XFree86 Project, Inc. + * + */ + +#define IHaveModules +#include <Server.tmpl> + +#if BuildXF86DRI +DRISRCS = via_dri.c xf86drmVIA.c +DRIOBJS = via_dri.o xf86drmVIA.o +DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri \ + -I$(XF86OSSRC)/linux/drm/kernel -I$(TOP)/include +DRIDEFINES = $(GLX_DEFINES) +#endif + +SRCS = via_driver.c \ + via_accel.c \ + via_cursor.c \ + via_shadow.c \ + via_bios.c \ + via_dga.c \ + via_video.c \ + via_i2c.c \ + via_gpioi2c.c \ + via_utility.c \ + via_swov.c \ + via_memmgr.c \ + regrec.c \ + HWDiff.c \ + ddover.c $(DRISRCS) + +OBJS = via_driver.o \ + via_accel.o \ + via_cursor.o \ + via_shadow.o \ + via_bios.o \ + via_dga.o \ + via_video.o \ + via_i2c.o \ + via_gpioi2c.o \ + via_utility.o \ + via_swov.o \ + via_memmgr.o \ + regrec.o \ + HWDiff.o \ + ddover.o $(DRIOBJS) + + +DEFINES = -DPSZ=8 + +#if defined(XF86DriverSDK) +INCLUDES = -I. -I../../include +#else +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ + -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \ + -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ + -I$(XF86SRC)/xf24_32bpp -I$(SERVERSRC)/Xext \ + -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ + -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ + -I$(XF86SRC)/rac -I$(XF86SRC)/int10 -I$(SERVERSRC)/render \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \ + -I$(EXTINCSRC) -I$(XF86OSSRC)/vbe -I$(XF86SRC)/shadowfb \ + -I$(SERVERSRC)/fb \ + $(DRIINCLUDES) +#endif +DEFINES = $(DRIDEFINES) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +NormalAsmObjectRule() + +ModuleObjectRule() +ObjectModuleTarget(via, $(OBJS)) + +InstallObjectModule(via,$(MODULEDIR),drivers) + +#if !defined(XF86DriverSDK) +CppManTarget(via,) +InstallModuleManPage(via) +#endif + +DependTarget() + +InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_accel.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_bios.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_bios.h,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_cursor.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_dga.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_driver.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_driver.h,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_i2c.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_gpioi2c.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_gpioi2c.h,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_regs.h,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_shadow.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_mode.h,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_utility.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_utility.h,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_video.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_video.h,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_xvpriv.c,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via_xvpriv.h,$(DRIVERSDKDIR)/drivers/via) +InstallDriverSDKNonExecFile(via.cpp,$(DRIVERSDKDIR)/drivers/via) + +InstallDriverSDKObjectModule(via,$(DRIVERSDKMODULEDIR),drivers) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/capture.h b/xc/programs/Xserver/hw/xfree86/drivers/via/capture.h new file mode 100644 index 000000000..50c10ba9a --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/capture.h @@ -0,0 +1,165 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __LINUX_VIACAP_H
+#define __LINUX_VIACAP_H
+
+/*Definition for CapturePortID*/
+#define PORT0 0 /* Capture Port 0*/
+#define PORT1 1 /* Capture Port 1*/
+
+typedef struct _VIAVIDCTRL{
+ unsigned short PORTID;
+ unsigned long dwCompose;
+ unsigned long dwHighQVDO;
+ unsigned long VideoStatus;
+ unsigned long dwAction;
+ Bool Cap0OnScreen1; /* True: Capture0 On Screen1 ; False: Capture0 On Screen0 */
+ Bool Cap1OnScreen1; /* True: Capture1 On Screen1 ; False: Capture1 On Screen0 */
+ Bool MPEGOnScreen1; /* True: MPEG On Screen1 ; False: MPEG On Screen0 */
+} VIAVIDCTRL;
+typedef VIAVIDCTRL * LPVIAVIDCTRL;
+
+#define ACTION_SET_PORTID 0
+#define ACTION_SET_COMPOSE 1
+#define ACTION_SET_HQV 2
+#define ACTION_SET_BOB 4
+#define ACTION_SET_VIDEOSTATUS 8
+
+
+typedef struct _VIACAPINFO{
+ unsigned long dwDeinterlaceMode;
+ unsigned long VideoDecoder;
+ unsigned long Tuner;
+ unsigned long TVEncoder;
+ int Vdec_Slave_Write;
+ int Vdec_Slave_Read;
+ int Tuner_Slave_Write;
+ int Tuner_Slave_Read;
+ int TVEncoder_Slave_Write;
+ int TVEncoder_Slave_Read;
+} VIACAPINFO;
+typedef VIACAPINFO * LPVIACAPINFO;
+
+
+typedef struct _VIAAUDCTRL{
+ unsigned long dwAudioMode ; /* Audio Mode */
+ int nVolume ; /* Volume */
+} VIAAUDCTRL ;
+typedef VIAAUDCTRL * LPVIAAUDCTRL;
+
+
+/* Definition for dwFlags */
+
+#define DDOVER_KEYDEST 0x00000004
+
+
+/*
+ * structure of Set Port Attribute
+ */
+typedef struct _VIASETPORTATTR {
+ int attribute;
+ int value;
+} VIASETPORTATTR ;
+typedef VIASETPORTATTR * LPVIASETPORTATTR;
+
+
+/*
+ * structure of Set Tuner
+ */
+typedef struct _VIASETTUNERDATA {
+ int divider;
+ int control;
+} VIASETTUNERDATA ;
+typedef VIASETTUNERDATA * LPVIASETTUNERDATA;
+
+
+/*Definition for LPVIAGETPORTATTR->attribute*/
+#define ATTR_ENCODING 0 /* XV_ENCODING */
+#define ATTR_INIT_AUDIO ATTR_ENCODING+50 /* XV_MUTE */
+#define ATTR_MUTE_ON ATTR_ENCODING+51 /* XV_MUTE */
+#define ATTR_MUTE_OFF ATTR_ENCODING+52 /* XV_MUTE */
+#define ATTR_VOLUME ATTR_ENCODING+53 /* XV_VOLUME */
+#define ATTR_STEREO ATTR_ENCODING+54 /* XV_VOLUME */
+#define ATTR_SAP ATTR_ENCODING+55 /* XV_SAP */
+#define ATTR_TUNER_AUDIO_SWITCH ATTR_ENCODING+56 /* XV_TUNER_AUDIO*/
+#define ATTR_AUDIO_CONTROLByAP ATTR_ENCODING+57 /* XV_AUDIOCTRL */
+
+
+void VIAStopVideo(void);
+
+#define DEV_TV1 0
+#define DEV_TV2 1
+
+typedef struct _CAPDEVICE
+{
+ unsigned char * lpCAPOverlaySurface[3]; /* Max 3 Pointers to CAP Overlay Surface*/
+ unsigned long dwCAPPhysicalAddr[3]; /*Max 3 Physical address to CAP Overlay Surface*/
+ unsigned long dwHQVAddr[2]; /*Max 2 Physical address to CAP HQV Overlay Surface*/
+ unsigned long dwWidth; /*CAP Source Width, not changed*/
+ unsigned long dwHeight; /*CAP Source Height, not changed*/
+ unsigned long dwPitch; /*CAP frame buffer pitch*/
+ unsigned char byDeviceType; /*Device type. Such as DEV_TV1 and DEV_TV2*/
+ unsigned long gdwCAPSrcWidth; /*CAP Source Width, changed if window is out of screen*/
+ unsigned long gdwCAPSrcHeight; /*CAP Source Height, changed if window is out of screen*/
+ unsigned long gdwCAPDstWidth; /*CAP Destination Width*/
+ unsigned long gdwCAPDstHeight; /*CAP Destination Height*/
+ unsigned long gdwCAPDstLeft; /*CAP Position : Left*/
+ unsigned long gdwCAPDstTop; /*CAP Position : Top*/
+ unsigned long dwDeinterlaceMode; /*BOB / WEAVE*/
+}CAPDEVICE;
+typedef CAPDEVICE * LPCAPDEVICE;
+
+int VIA_CAPSetFrameBuffer( LPCAPDEVICE lpDevice);
+
+typedef struct _ALPHADEVICE
+{
+ unsigned char * lpALPOverlaySurface;
+ unsigned long dwALPPhysicalAddr;
+ unsigned long dwPitch;
+ unsigned long gdwALPSrcWidth;
+ unsigned long gdwALPSrcHeight;
+ unsigned long gdwALPDstWidth;
+ unsigned long gdwALPDstHeight;
+ unsigned long gdwALPDstLeft;
+ unsigned long gdwALPDstTop;
+}ALPHADEVICE;
+typedef ALPHADEVICE * LPALPHADEVICE;
+
+typedef struct{
+ unsigned char type;
+ unsigned char ConstantFactor; /* only valid in bit0 - bit3 */
+ Bool AlphaEnable;
+} ALPHACTRL ,*LPALPHACTRL;
+
+#define ALPHA_CONSTANT 0x01
+#define ALPHA_STREAM 0x02
+#define ALPHA_DISABLE 0x03
+#define ALPHA_GRAPHIC 0x04
+#define ALPHA_COMBINE 0x05
+
+
+int VIA_ALPSetFrameBuffer(LPALPHADEVICE lpDevice);
+#endif
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/compose.h b/xc/programs/Xserver/hw/xfree86/drivers/via/compose.h new file mode 100644 index 000000000..992b44410 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/compose.h @@ -0,0 +1,67 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/* Definition of APs Distribution */
+#ifndef __COMPOSE_H
+#define __COMPOSE_H
+
+ /* Video Control definition */
+ #define VW_DVD_ONLY 0x00000001 /* ????????????????? */
+ #define VW_TV_ONLY 0x00000002 /* ????????????????? */
+/*#define VW_INTERNAL_OPAQUE 0x00000008 */ /* ????????????????? */
+
+ #define VW_DVD_TOP 0x00000010 /* ATOM("XV_COMPOSE") */
+ #define VW_TV_TOP 0x00000020 /* ATOM("XV_COMPOSE") */
+ #define VW_TV1_TOP 0x00000100 /* ATOM("XV_COMPOSE") */
+ #define VW_TV2_TOP 0x00000200 /* ATOM("XV_COMPOSE") */
+/*#define VW_TV_FULL 0x00000400 */ /*Not recommended*/
+
+ #define VW_BOB_TV1 0x00010000 /* ATOM("XV_BOB") */
+ #define VW_BOB_TV2 0x00020000 /* ATOM("XV_BOB") */
+/*#define VW_WEAVE_TV1 0x00040000 */ /* ATOM("XV_BOB") */
+/*#define VW_WEAVE_TV2 0x00080000 */ /* ATOM("XV_BOB") */
+
+ #define VW_HIGHQVDO_OFF 0x00000000 /* ATOM("XV_HIGHQVDO") */
+ #define VW_HIGHQVDO_DVD 0x00000001 /* ATOM("XV_HIGHQVDO") */
+ #define VW_HIGHQVDO_TV1 0x00000002 /* ATOM("XV_HIGHQVDO") */
+ #define VW_HIGHQVDO_TV2 0x00000004 /* ATOM("XV_HIGHQVDO") */
+
+ /* Audio Control definition */
+ /* Quality */
+ #define AUDIO_STEREO 0x00000001 /* ATOM("XV_AUDIOCTRL") */
+ #define AUDIO_SAP 0x00000002 /* ATOM("XV_AUDIOCTRL") */
+ #define AUDIO_DUAL 0x00000004 /* ATOM("XV_AUDIOCTRL") */
+
+ /* Mute */
+ #define AUDIO_ON 0x00000010 /* ATOM("XV_AUDIOCTRL") */
+ #define AUDIO_OFF 0x00000020 /* ATOM("XV_AUDIOCTRL") */
+
+ /* Source */
+ #define AUDIO_TV1 0x00000100 /* ATOM("XV_AUDIOCTRL") */
+ #define AUDIO_TV2 0x00000200 /* ATOM("XV_AUDIOCTRL") */
+ #define AUDIO_SVIDEO 0x00000400 /* not available now */
+ #define AUDIO_COMPOSE 0x00000800 /* */
+
+#endif /*end of __COMPOSE_H*/
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/ddmpeg.h b/xc/programs/Xserver/hw/xfree86/drivers/via/ddmpeg.h new file mode 100644 index 000000000..c53b9e68d --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/ddmpeg.h @@ -0,0 +1,468 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _LINUX_VIDEO_H
+#define _LINUX_VIDEO_H
+
+#include "capture.h"
+#include "via_privIoctl.h" /* for VIAGRAPHICINFO & custom ioctl command */
+
+/*
+ * Overlay surfaces ( frame buffers ) we use
+ */
+#define NUM_FRAME_BUFFERS 4
+
+/*
+ * Alignment macro functions
+ */
+#define ALIGN_TO_32_BYTES(f) (((f) + 31) & ~31)
+#define ALIGN_TO_16_BYTES(f) (((f) + 15) & ~15)
+#define ALIGN_TO_256_BITS(f) (((f) + 255) & ~255)
+#define ALIGN_TO_8_BYTES(f) (((f) + 7) & ~7)
+#define ALIGN_TO_64_BITS(f) (((f) + 63) & ~63)
+#define ENG_ALIGN_BYTE ALIGN_TO_32_BYTES
+#define ENG_ALIGN_BIT ALIGN_TO_256_BITS
+
+/*
+ * FOURCC definitions
+ */
+
+#define FOURCC_VIA 0x4E4B4C57 /*VIA*/
+#define FOURCC_SUBP 0x50425553 /*SUBP*/
+#define FOURCC_TV1 0x00315654 /*TV1*/
+#define FOURCC_TV2 0x00325654 /*TV2*/
+#define FOURCC_ALPHA 0x48504C41 /*ALPH*/
+#define FOURCC_YUY2 0x32595559 /*YUY2*/
+#define FOURCC_YV12 0x32315659 /*YV12*/
+#define FOURCC_Y211 0x31313259
+#define FOURCC_UYVY 0x59565955
+#define FOURCC_YVYU 0x55595659
+#define FOURCC_IYUV 0x56555949 /* #define FOURCC_IYUV 'VUYI'*/
+
+#define FOURCC_HQVMPEG 0x31565148 /*HQV1*/
+#define FOURCC_HQVTV1 0x32565148 /*HQV2*/
+#define FOURCC_HQVTV2 0x33565148 /*HQV3*/
+#define FOURCC_HQVSW 0x34565148 /*HQV4*/
+
+
+
+/*
+ * Actions for MPEG functions
+ */
+
+#define CREATEDRIVER 0x00
+#define DESTROYDRIVER CREATEDRIVER +1
+#define CREATESURFACE CREATEDRIVER +2
+#define DESTROYSURFACE CREATEDRIVER +3
+#define LOCKSURFACE CREATEDRIVER +4
+#define UNLOCKSURFACE CREATEDRIVER +5
+#define UPDATEOVERLAY CREATEDRIVER +6
+#define FLIP CREATEDRIVER +7
+#define SETALPHAWIN CREATEDRIVER +8
+#define BEGINPICTRE CREATEDRIVER +9
+#define BEGINPICTURE CREATEDRIVER +9
+#define ENDPICTURE CREATEDRIVER +10
+#define SLICERECEIVEDATA CREATEDRIVER +11
+#define DRIVERPROC CREATEDRIVER +12
+#define DISPLAYCONTROL CREATEDRIVER +13
+#define SUBPICTURE CREATEDRIVER +14
+#define SETDEINTERLACEMODE CREATEDRIVER +15
+#define MPEGENABLE CREATEDRIVER +16
+#define MPEGGETPICTYPE CREATEDRIVER +17
+
+/*
+ * Actions for Capture functions / XV standard functions
+ */
+
+#define PUTVIDEO CREATEDRIVER +100
+#define PUTSTILL CREATEDRIVER +101
+#define GETVIDEO CREATEDRIVER +102
+#define GETSTILL CREATEDRIVER +103
+#define STOPVIDEO CREATEDRIVER +104
+#define SETPORTATTRIBUTE CREATEDRIVER +105
+#define GETPORTATTRIBUTE CREATEDRIVER +106
+#define SELECTCAPTUREPORT CREATEDRIVER +107
+#define VIDEOCONTROL CREATEDRIVER +108
+#define HQVCONTROL CREATEDRIVER +109
+#define PUTIMAGE CREATEDRIVER +110
+
+#define VDEC_DETECT CREATEDRIVER +150
+#define VDEC_INIT CREATEDRIVER +151
+#define TUNER_DETECT CREATEDRIVER +152
+#define TUNER_INIT CREATEDRIVER +153
+#define TUNER_SETTVBAND_CABLE CREATEDRIVER +154
+#define TUNER_SETCHANNEL CREATEDRIVER +155
+
+#define AUDIOCONTROL CREATEDRIVER +170
+
+/*
+ * Define for Utility functions using XvPutImage.
+ */
+/* Primary ID */
+#define UT_XV_FUNC_BIOS 0x11 /* Primary ID */
+#define UT_XV_FUNC_DRIVER 0x12
+#define UT_XV_FUNC_DEVICE 0x13
+#define UT_XV_FUNC_PANEL 0x14
+#define UT_XV_FUNC_TV 0x15
+#define UT_XV_FUNC_GAMMA 0x16
+/* Secondary ID */
+#define UT_XV_FUNC_BIOS_GetChipID 0x01 /* Get Chip ID */
+#define UT_XV_FUNC_BIOS_GetVersion 0x02 /* Get the version of the BIOS */
+#define UT_XV_FUNC_BIOS_GetDate 0x03 /* Get the date (year, month, day) of the BIOS. */
+#define UT_XV_FUNC_BIOS_GetVideoMemSizeMB 0x04 /* Get the video memory size, in MB */
+
+#define UT_XV_FUNC_DRIVER_GetFileName 0x01
+#define UT_XV_FUNC_DRIVER_GetFileVersion 0x02
+/* Return value */
+#define UT_RESULT_OK 1 /* Return value */
+#define UT_RESULT_FAIL 0
+#define UT_RESULT_NO_FUNC -1
+
+
+/*
+ * Structures for create surface
+ */
+typedef struct _DDSURFACEDESC
+{
+ unsigned long dwSize; /* size of the DDSURFACEDESC structure*/
+ unsigned long dwFlags; /* determines what fields are valid*/
+ unsigned long dwHeight; /* height of surface to be created*/
+ unsigned long dwWidth; /* width of input surface*/
+ unsigned long lPitch; /* distance to start of next line(return value)*/
+ unsigned long dwBackBufferCount; /* number of back buffers requested*/
+ void * lpSurface; /* pointer to the surface memory*/
+ unsigned long dwColorSpaceLowValue; /* low boundary of color space that is to*/
+ /* be treated as Color Key, inclusive*/
+ unsigned long dwColorSpaceHighValue; /* high boundary of color space that is*/
+ /* to be treated as Color Key, inclusive*/
+ unsigned long dwFourCC; /* (FOURCC code)*/
+} DDSURFACEDESC;
+typedef DDSURFACEDESC * LPDDSURFACEDESC;
+
+
+/*
+ * Structures for SubPicture
+ */
+typedef struct _SUBDEVICE
+{
+ unsigned char * lpSUBOverlaySurface[2]; /*Max 2 Pointers to SUB Overlay Surface*/
+ unsigned long dwSUBPhysicalAddr[2]; /*Max 2 Physical address to SUB Overlay Surface*/
+ unsigned long dwPitch; /*SUB frame buffer pitch*/
+ unsigned long gdwSUBSrcWidth; /*SUB Source Width*/
+ unsigned long gdwSUBSrcHeight; /*SUB Source Height*/
+ unsigned long gdwSUBDstWidth; /*SUB Destination Width*/
+ unsigned long gdwSUBDstHeight; /*SUB Destination Height*/
+ unsigned long gdwSUBDstLeft; /*SUB Position : Left*/
+ unsigned long gdwSUBDstTop; /*SUB Position : Top*/
+}SUBDEVICE;
+typedef SUBDEVICE * LPSUBDEVICE;
+
+
+/*
+ * Structures for H/W mpeg decode
+ */
+typedef struct _MPGDEVICE
+{
+ unsigned char * lpVideoMemIO; /* Pointer to Video Memory MAP IO */
+ unsigned char * lpMPEGOverlaySurface[NUM_FRAME_BUFFERS];/* Max 4 Pointers to MPEG Overlay Surface */
+ unsigned long dwMPEGPhysicalAddr[NUM_FRAME_BUFFERS]; /* Max 4 Physical address to MPEG Overlay Surface */
+ unsigned long dwWidth; /* MPEG coded_picture_width */
+ unsigned long dwHeight; /* MPEG coded_picture_height */
+ unsigned long dwPitch; /* MPEG frame buffer pitch */
+ unsigned long dwPageNum; /* Frame buffer Number */
+ unsigned char byDeviceType; /* Device type. Such as DEV_MPEG and DEV_SUBP */
+ unsigned long gdwSetBufferIndex; /* Used to assigned buffer pointer in SetOverlayBuffer() */
+ unsigned long gdwMPGState; /* MPG states */
+ unsigned long gdwSUBPState; /* Sub Picture states */
+ unsigned long dwSubpPageNum; /* SubPicture Frame buffer Number */
+ unsigned long dwSUBPPitch; /* SubPicture Pitch */
+ unsigned long gdwSUBPSrcLeft; /* SubPicture Position : Left */
+ unsigned long gdwSUBPSrcTop; /* SubPicture Position : Top */
+ unsigned long gdwSUBPSrcWidth; /* SubPicture Source Width */
+ unsigned long gdwSUBPSrcHeight; /* SubPicture Source Height */
+ unsigned long gdwSUBPDisplayIndex; /* Subpicture Display Index */
+ unsigned long gdwMPGSrcWidth; /* MPEG Source Width */
+ unsigned long gdwMPGSrcHeight; /* MPEG Source Height */
+ unsigned long gdwMPGDstWidth; /* MPEG Destination Width */
+ unsigned long gdwMPGDstHeight; /* MPEG Destination Height */
+ unsigned long gdwMPGDstLeft; /* MPEG Position : Left */
+ unsigned long gdwMPGDstTop; /* MPEG Position : Top */
+ unsigned long dwDeinterlaceMode; /* BOB / WEAVE */
+ unsigned long gdwSUBP_NotVisible;
+ unsigned long dwMPEGYPhysicalAddr[NUM_FRAME_BUFFERS]; /* Physical address to MPEG Y Overlay Surface */
+ unsigned long dwMPEGCbPhysicalAddr[NUM_FRAME_BUFFERS]; /* Physical address to MPEG Cb Overlay Surface */
+ unsigned long dwMPEGCrPhysicalAddr[NUM_FRAME_BUFFERS]; /* Physical address to MPEG Cr Overlay Surface */
+ unsigned long dwMPEGDisplayIndex ; /* Currently display index */
+ unsigned long dwHQVAddr[3]; /* Physical address to HQV surface -- CLE_C0 */
+ /*unsigned long dwHQVAddr[2];*/ /* Physical address to HQV surface */
+ unsigned long dwEnableErrorConcealment; /* For MPEG ErrorConcealment */
+ /* Chip Info */
+ unsigned long dwVendorID;
+ unsigned long dwDeviceID;
+ unsigned long dwRevisionID;
+ unsigned long dwSubVendorID;
+ unsigned long dwSubDeviceID;
+}MPGDEVICE, * LPMPGDEVICE;
+
+
+/*
+ * Structures for S/W mpeg decode
+ */
+typedef struct _SWDEVICE
+{
+ unsigned char * lpSWOverlaySurface[2]; /* Max 2 Pointers to SW Overlay Surface*/
+ unsigned long dwSWPhysicalAddr[2]; /*Max 2 Physical address to SW Overlay Surface */
+ unsigned long dwSWCbPhysicalAddr[2]; /* Physical address to SW Cb Overlay Surface, for YV12 format use */
+ unsigned long dwSWCrPhysicalAddr[2]; /* Physical address to SW Cr Overlay Surface, for YV12 format use */
+ unsigned long dwHQVAddr[3]; /* Physical address to HQV surface -- CLE_C0 */
+ /*unsigned long dwHQVAddr[2];*/ /*Max 2 Physical address to SW HQV Overlay Surface*/
+ unsigned long dwWidth; /*SW Source Width, not changed*/
+ unsigned long dwHeight; /*SW Source Height, not changed*/
+ unsigned long dwPitch; /*SW frame buffer pitch*/
+ unsigned long gdwSWSrcWidth; /*SW Source Width, changed if window is out of screen*/
+ unsigned long gdwSWSrcHeight; /*SW Source Height, changed if window is out of screen*/
+ unsigned long gdwSWDstWidth; /*SW Destination Width*/
+ unsigned long gdwSWDstHeight; /*SW Destination Height*/
+ unsigned long gdwSWDstLeft; /*SW Position : Left*/
+ unsigned long gdwSWDstTop; /*SW Position : Top*/
+ unsigned long dwDeinterlaceMode; /*BOB / WEAVE*/
+}SWDEVICE;
+typedef SWDEVICE * LPSWDEVICE;
+
+
+/* Device Type of MPGDEVICE */
+#define DEV_MPEG 0
+#define DEV_SUBP 1
+
+/* dwDecodePictStruct and dwDisplayPictStruct of VIAMPGSURFACE */
+#define VIA_PICT_STRUCT_TOP 0x00000001
+#define VIA_PICT_STRUCT_BOTTOM 0x00000002
+#define VIA_PICT_STRUCT_FRAME 0x00000003
+
+/*
+ * Structures for LOCK surface
+ */
+
+typedef struct _DDLOCK
+{
+ unsigned long dwVersion;
+ unsigned long dwFourCC;
+ unsigned long dwPhysicalBase;
+ SUBDEVICE SubDev;
+ CAPDEVICE Capdev_TV1;
+ CAPDEVICE Capdev_TV2;
+ ALPHADEVICE Alphadev;
+ MPGDEVICE MPGDev;
+ SWDEVICE SWDevice;
+} DDLOCK;
+typedef DDLOCK * LPDDLOCK;
+
+
+/*
+ * structure for passing information to DDHAL UpdateOverlay fn
+ */
+typedef struct _RECTL
+{
+ unsigned long left;
+ unsigned long top;
+ unsigned long right;
+ unsigned long bottom;
+} RECTL;
+
+typedef struct _DDUPDATEOVERLAY
+{
+ RECTL rDest; /* dest rect */
+ RECTL rSrc; /* src rect */
+ unsigned long dwFlags; /* flags */
+ unsigned long dwColorSpaceLowValue;
+ unsigned long dwColorSpaceHighValue;
+ unsigned long dwFourcc;
+} DDUPDATEOVERLAY;
+typedef DDUPDATEOVERLAY * LPDDUPDATEOVERLAY;
+
+typedef struct _ADJUSTFRAME
+{
+ int x;
+ int y;
+} ADJUSTFRAME;
+typedef ADJUSTFRAME * LPADJUSTFRAME;
+
+/* Definition for dwFlags */
+#define DDOVER_HIDE 0x00000001
+#define DDOVER_SHOW 0x00000002
+#define DDOVER_KEYDEST 0x00000004
+#define DDOVER_ENABLE 0x00000008
+#define DDOVER_CLIP 0x00000010
+/*
+ * Display each field of video port data individually without
+ * causing any jittery artifacts
+ */
+#define DDOVER_BOB 0x00200000l
+
+/*
+ * Indicates that bob/weave decisions should not be overridden by other
+ * interfaces.
+ */
+#define DDOVER_OVERRIDEBOBWEAVE 0x00400000l
+
+/*
+ * Indicates that the surface memory is composed of interleaved fields.
+ */
+#define DDOVER_INTERLEAVED 0x00800000l
+
+/*
+ * Indicates that bob will be performed using hardware rather than
+ * software or emulated.
+ */
+#define DDOVER_BOBHARDWARE 0x01000000l
+
+typedef struct _DDFLIP
+{
+ unsigned long dwBuffIndex;
+ unsigned long dwFlags;
+} DDFLIP;
+typedef DDFLIP * LPDDFLIP;
+
+typedef struct
+{
+ unsigned long dwWidth;
+ unsigned long dwHeight;
+ unsigned long dwOffset;
+ unsigned long dwUVoffset;
+ unsigned long dwFlipTime;
+ unsigned long dwFlipTag;
+ unsigned long dwStartAddr;
+ unsigned long dwV1OriWidth;
+ unsigned long dwV1OriHeight;
+ unsigned long dwV1OriPitch;
+ unsigned long dwV1SrcWidth;
+ unsigned long dwV1SrcHeight;
+ unsigned long dwV1SrcLeft;
+ unsigned long dwV1SrcRight;
+ unsigned long dwV1SrcTop;
+ unsigned long dwV1SrcBot;
+ unsigned long dwSPWidth;
+ unsigned long dwSPHeight;
+ unsigned long dwSPLeft;
+ unsigned long dwSPRight;
+ unsigned long dwSPTop;
+ unsigned long dwSPBot;
+ unsigned long dwSPOffset;
+ unsigned long dwSPstartAddr;
+ unsigned long dwDisplayPictStruct;
+ unsigned long dwDisplayBuffIndex; /* Display buffer Index. 0 to ( dwBufferNumber -1) */
+ unsigned long dwFetchAlignment;
+ unsigned long dwSPPitch;
+ unsigned long dwHQVAddr[3]; /* CLE_C0 */
+ /*unsigned long dwHQVAddr[2];*/
+ unsigned long dwMPEGDeinterlaceMode; /* default value : VIA_DEINTERLACE_WEAVE */
+ unsigned long dwMPEGProgressiveMode; /* default value : VIA_PROGRESSIVE */
+ unsigned long dwHQVheapInfo; /* video memory heap of the HQV buffer */
+ unsigned long dwVideoControl; /* video control flag */
+ unsigned long dwminifyH; /* Horizontal minify factor */
+ unsigned long dwminifyV; /* Vertical minify factor */
+ unsigned long dwMpegDecoded;
+} OVERLAYRECORD;
+
+/* DeinterLace Mode */
+#define VIA_DEINTERLACE_WEAVE 0x00000000
+#define VIA_DEINTERLACE_BOB 0x00000001
+#define VIA_NON_PROGRESSIVE 0x00000000
+#define VIA_PROGRESSIVE 0x00000010
+
+/*
+ * DDPIXELFORMAT
+ */
+typedef struct _DDPIXELFORMAT
+{
+ unsigned long dwSize; /* size of structure */
+ unsigned long dwFlags; /* pixel format flags */
+ unsigned long dwFourCC; /* (FOURCC code) */
+
+ unsigned long dwRGBBitCount; /* how many bits per pixel */
+ unsigned long dwYUVBitCount; /* how many bits per pixel */
+ unsigned long dwZBufferBitDepth; /* how many bits for z buffers */
+ unsigned long dwAlphaBitDepth; /* how many bits for alpha channels */
+
+ unsigned long dwRBitMask; /* mask for red bit */
+ unsigned long dwYBitMask; /* mask for Y bits */
+
+ unsigned long dwGBitMask; /* mask for green bits */
+ unsigned long dwUBitMask; /* mask for U bits */
+
+ unsigned long dwBBitMask; /* mask for blue bits */
+ unsigned long dwVBitMask; /* mask for V bits */
+
+ unsigned long dwRGBAlphaBitMask; /* mask for alpha channel */
+ unsigned long dwYUVAlphaBitMask; /* mask for alpha channel */
+ unsigned long dwRGBZBitMask; /* mask for Z channel */
+ unsigned long dwYUVZBitMask; /* mask for Z channel */
+} DDPIXELFORMAT;
+typedef DDPIXELFORMAT * LPDDPIXELFORMAT;
+
+/****************************************************************************
+ *
+ * PIXELFORMAT FLAGS
+ *
+ ****************************************************************************/
+
+/*
+ * The FourCC code is valid.
+ */
+#define DDPF_FOURCC 0x00000004l
+
+/*
+ * The RGB data in the pixel format structure is valid.
+ */
+#define DDPF_RGB 0x00000040l
+
+
+
+/*
+ * Return value of Proprietary Interface
+ */
+
+#define PI_OK 0x00
+#define PI_ERR 0x01
+#define PI_ERR_NO_X_WINDOW PI_ERR +1
+#define PI_ERR_CANNOT_OPEN_VIDEO_DEVICE PI_ERR +2
+#define PI_ERR_CANNOT_USE_IOCTL PI_ERR +3
+#define PI_ERR_CANNOT_CREATE_SURFACE PI_ERR +4
+
+
+/*
+ * Exported Driver functions
+ */
+
+unsigned long VIADriverProc(unsigned long wAction, void * lpParam);
+unsigned long VIABeginPicture(void * lpMPGSurface);
+unsigned long VIAEndPicture(void * lpMPGSurface);
+unsigned long VIASliceReceiveData(unsigned long dwByteCount, unsigned char * lpData);
+unsigned long VIADisplayControl(unsigned long devType, void * lpData);
+unsigned long VIASUBPicture(void * lpSubp);
+unsigned long VIASetDeInterlaceMode(unsigned long dwMode);
+int PrivPutImage(unsigned char* buf);
+unsigned long GetVGARevisionID(VIAGRAPHICINFO gVIAGraphicInfo);
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/ddover.c b/xc/programs/Xserver/hw/xfree86/drivers/via/ddover.c new file mode 100644 index 000000000..7c3a818b8 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/ddover.c @@ -0,0 +1,917 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/* I N C L U D E S ---------------------------------------------------------*/
+
+#include "xf86.h"
+
+#include "via.h"
+#include "ddmpeg.h"
+#include "via_privIoctl.h" /* for VIAGRAPHICINFO & custom ioctl command */
+#include "HWDiff.h"
+
+#include "ddover.h"
+
+OVERLAYRECORD overlayRecordV1;
+OVERLAYRECORD overlayRecordV3;
+
+/* E X T E R N G L O B A L S--------------------------------------------------------------*/
+
+extern MPGDEVICE MPGDevice;
+extern VIAGRAPHICINFO gVIAGraphicInfo; /*2D information*/
+
+/* F U N C T I O N ----------------------------------------------------------*/
+
+void DDOver_GetV1Format(unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF, unsigned long * lpdwVidCtl,unsigned long * lpdwHQVCtl )
+{
+
+ if (lpDPF->dwFlags & DDPF_FOURCC)
+ {
+ *lpdwVidCtl |= V1_COLORSPACE_SIGN;
+ switch (lpDPF->dwFourCC) {
+ case FOURCC_YV12:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpdwVidCtl |= (V1_YUV422 | V1_SWAP_HW_HQV );
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_YUV420|HQV_ENABLE|HQV_SW_FLIP;
+ }
+ else
+ {
+ *lpdwVidCtl |= V1_YCbCr420;
+ }
+ break;
+ case FOURCC_IYUV:
+ case FOURCC_VIA:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ if ((overlayRecordV1.dwDisplayPictStruct == VIA_PICT_STRUCT_TOP)||
+ (overlayRecordV1.dwDisplayPictStruct == VIA_PICT_STRUCT_BOTTOM)||
+ (overlayRecordV1.dwMPEGDeinterlaceMode == VIA_DEINTERLACE_BOB))
+ {
+ /*Field Display*/
+ *lpdwVidCtl |= (V1_YUV422 | V1_SWAP_HW_HQV );
+ if (dwVideoFlag&MPEG_USE_HW_FLIP)
+ {
+ *lpdwHQVCtl |= HQV_SRC_MC|HQV_YUV420|HQV_ENABLE |HQV_DEINTERLACE|HQV_FIELD_2_FRAME|HQV_FRAME_2_FIELD;
+ if (overlayRecordV1.dwMPEGProgressiveMode == VIA_NON_PROGRESSIVE)
+ {
+ *lpdwHQVCtl |= HQV_FIELD_UV;
+ }
+ }
+ else
+ {
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_YUV420|HQV_ENABLE|HQV_SW_FLIP|HQV_DEINTERLACE|HQV_FIELD_2_FRAME|HQV_FRAME_2_FIELD;
+ if (overlayRecordV1.dwMPEGProgressiveMode == VIA_NON_PROGRESSIVE)
+ {
+ *lpdwHQVCtl |= HQV_FIELD_UV;
+ }
+ }
+ }
+ else
+ {
+ /*Frame Display*/
+ *lpdwVidCtl |= (V1_YUV422 | V1_SWAP_HW_HQV );
+ if (dwVideoFlag&MPEG_USE_HW_FLIP)
+ {
+ *lpdwHQVCtl |= HQV_SRC_MC|HQV_YUV420|HQV_ENABLE;
+ }
+ else
+ {
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_YUV420|HQV_ENABLE|HQV_SW_FLIP;
+ }
+ }
+ }
+ else
+ {
+ /*Without HQV engine*/
+ if (dwVideoFlag&MPEG_USE_HW_FLIP)
+ {
+ *lpdwVidCtl |= (V1_YCbCr420 | V1_SWAP_HW_MC );
+ if (((overlayRecordV1.dwDisplayPictStruct == VIA_PICT_STRUCT_TOP )||
+ (overlayRecordV1.dwDisplayPictStruct == VIA_PICT_STRUCT_BOTTOM)||
+ (overlayRecordV1.dwMPEGDeinterlaceMode == VIA_DEINTERLACE_BOB ))&&
+ (overlayRecordV1.dwMPEGProgressiveMode == VIA_NON_PROGRESSIVE))
+ {
+ /* CLE bug
+ *lpdwVidCtl |= V1_SRC_IS_FIELD_PIC;*/
+ }
+ }
+ else
+ {
+ if ((overlayRecordV1.dwDisplayPictStruct == VIA_PICT_STRUCT_TOP)||
+ (overlayRecordV1.dwDisplayPictStruct == VIA_PICT_STRUCT_BOTTOM)||
+ (overlayRecordV1.dwMPEGDeinterlaceMode == VIA_DEINTERLACE_BOB))
+ {
+ *lpdwVidCtl |= (V1_YCbCr420 |V1_SWAP_SW | V1_BOB_ENABLE | V1_FRAME_BASE);
+ if (overlayRecordV1.dwMPEGProgressiveMode == VIA_NON_PROGRESSIVE)
+ {
+ /* CLE bug
+ *lpdwVidCtl |= V1_SRC_IS_FIELD_PIC;*/
+ }
+ }
+ else
+ {
+ *lpdwVidCtl |= (V1_YCbCr420 | V1_SWAP_SW );
+ }
+ }
+ }
+ break;
+
+ case FOURCC_YUY2:
+ DBG_DD(ErrorF("DDOver_GetV1Format : FOURCC_YUY2\n"));
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpdwVidCtl |= (V1_YUV422 | V1_SWAP_HW_HQV );
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_YUV422|HQV_ENABLE|HQV_SW_FLIP;
+ }
+ else
+ {
+ *lpdwVidCtl |= V1_YUV422;
+ }
+ break;
+
+ default :
+ DBG_DD(ErrorF("DDOver_GetV1Format : Invalid FOURCC format :(0x%lx)in V1!\n", lpDPF->dwFourCC));
+ *lpdwVidCtl |= V1_YUV422;
+ break;
+ }
+ }
+ else if (lpDPF->dwFlags & DDPF_RGB)
+ {
+ switch (lpDPF->dwRGBBitCount) {
+ case 16:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpdwVidCtl |= (V1_RGB16 | V1_SWAP_HW_HQV );
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_ENABLE|HQV_SW_FLIP;
+ *lpdwHQVCtl |= (lpDPF->dwGBitMask==0x07E0 ?
+ HQV_RGB16 : HQV_RGB15);
+ }
+ else
+ {
+ *lpdwVidCtl |= (lpDPF->dwGBitMask==0x07E0 ?
+ V1_RGB16 : V1_RGB15);
+ }
+ break;
+ case 32:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpdwVidCtl |= (V1_RGB32 | V1_SWAP_HW_HQV );
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_RGB32|HQV_ENABLE|HQV_SW_FLIP;
+ }
+ else
+ {
+ *lpdwVidCtl |= V1_RGB32;
+ }
+ break;
+
+ default :
+ DBG_DD(ErrorF("DDOver_GetV1Format : invalid RGB format %ld bits\n",lpDPF->dwRGBBitCount));
+ break;
+ }
+ }
+}
+
+void DDOver_GetV3Format(unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF, unsigned long * lpdwVidCtl,unsigned long * lpdwHQVCtl )
+{
+
+ if (lpDPF->dwFlags & DDPF_FOURCC)
+ {
+ *lpdwVidCtl |= V3_COLORSPACE_SIGN;
+ switch (lpDPF->dwFourCC) {
+ case FOURCC_YV12:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpdwVidCtl |= (V3_YUV422 | V3_SWAP_HW_HQV );
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_YUV420|HQV_ENABLE|HQV_SW_FLIP;
+ }
+ else
+ {
+ /* *lpdwVidCtl |= V3_YCbCr420;*/
+ DBG_DD(ErrorF("DDOver_GetV3Format : Invalid FOURCC format :(0x%lx)in V3!\n", lpDPF->dwFourCC));
+ }
+ break;
+ case FOURCC_IYUV:
+ case FOURCC_VIA:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ if ((overlayRecordV1.dwDisplayPictStruct == VIA_PICT_STRUCT_TOP)||
+ (overlayRecordV1.dwDisplayPictStruct == VIA_PICT_STRUCT_BOTTOM)||
+ (overlayRecordV1.dwMPEGDeinterlaceMode == VIA_DEINTERLACE_BOB))
+ {
+ /*Field Display*/
+ *lpdwVidCtl |= (V3_YUV422 | V3_SWAP_HW_HQV );
+ if (dwVideoFlag&MPEG_USE_HW_FLIP)
+ {
+ *lpdwHQVCtl |= HQV_SRC_MC|HQV_YUV420|HQV_ENABLE |HQV_DEINTERLACE|HQV_FIELD_2_FRAME|HQV_FRAME_2_FIELD;
+ if (overlayRecordV1.dwMPEGProgressiveMode == VIA_NON_PROGRESSIVE)
+ {
+ *lpdwHQVCtl |= HQV_FIELD_UV;
+ }
+ }
+ else
+ {
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_YUV420|HQV_ENABLE|HQV_SW_FLIP;
+ if (overlayRecordV1.dwMPEGProgressiveMode == VIA_NON_PROGRESSIVE)
+ {
+ *lpdwHQVCtl |= HQV_FIELD_UV;
+ }
+ }
+ }
+ else
+ {
+ /*Frame Display*/
+ *lpdwVidCtl |= (V3_YUV422 | V3_SWAP_HW_HQV );
+ if (dwVideoFlag&MPEG_USE_HW_FLIP)
+ {
+ *lpdwHQVCtl |= HQV_SRC_MC|HQV_YUV420|HQV_ENABLE;
+ }
+ else
+ {
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_YUV420|HQV_ENABLE|HQV_SW_FLIP;
+ }
+ }
+ }
+ else
+ {
+ DBG_DD(ErrorF("DDOver_GetV3Format : Invalid FOURCC format :(0x%lx)in V3!\n", lpDPF->dwFourCC));
+ }
+ break;
+
+ case FOURCC_YUY2:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpdwVidCtl |= (V3_YUV422 | V3_SWAP_HW_HQV );
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_YUV422|HQV_ENABLE|HQV_SW_FLIP;
+ }
+ else
+ {
+ *lpdwVidCtl |= V3_YUV422;
+ }
+ break;
+
+ default :
+ DBG_DD(ErrorF("DDOver_GetV3Format : Invalid FOURCC format :(0x%lx)in V3!\n", lpDPF->dwFourCC));
+ *lpdwVidCtl |= V3_YUV422;
+ break;
+ }
+ }
+ else if (lpDPF->dwFlags & DDPF_RGB) {
+ switch (lpDPF->dwRGBBitCount) {
+ case 16:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpdwVidCtl |= (V3_RGB16 | V3_SWAP_HW_HQV );
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_ENABLE|HQV_SW_FLIP;
+ *lpdwHQVCtl |= (lpDPF->dwGBitMask==0x07E0 ?
+ HQV_RGB16 : HQV_RGB15);
+ }
+ else
+ {
+ *lpdwVidCtl |= (lpDPF->dwGBitMask==0x07E0 ?
+ V3_RGB16 : V3_RGB15);
+ }
+ break;
+ case 32:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpdwVidCtl |= (V3_RGB32 | V3_SWAP_HW_HQV );
+ *lpdwHQVCtl |= HQV_SRC_SW|HQV_RGB32|HQV_ENABLE|HQV_SW_FLIP;
+ }
+ else
+ {
+ *lpdwVidCtl |= V3_RGB32;
+ }
+ break;
+
+ default :
+ DBG_DD(ErrorF("DDOver_GetV3Format : invalid RGB format %ld bits\n",lpDPF->dwRGBBitCount));
+ break;
+ }
+ }
+}
+
+unsigned long DDOver_GetSrcStartAddress (unsigned long dwVideoFlag,RECTL rSrc,RECTL rDest, unsigned long dwSrcPitch,LPDDPIXELFORMAT lpDPF,unsigned long * lpHQVoffset )
+{
+ unsigned long dwOffset=0;
+ unsigned long dwHQVsrcWidth=0,dwHQVdstWidth=0;
+ unsigned long dwHQVsrcHeight=0,dwHQVdstHeight=0;
+ unsigned long dwHQVSrcTopOffset=0,dwHQVSrcLeftOffset=0;
+
+ dwHQVsrcWidth = (unsigned long)(rSrc.right - rSrc.left);
+ dwHQVdstWidth = (unsigned long)(rDest.right - rDest.left);
+ dwHQVsrcHeight = (unsigned long)(rSrc.bottom - rSrc.top);
+ dwHQVdstHeight = (unsigned long)(rDest.bottom - rDest.top);
+
+ if ( (rSrc.left != 0) || (rSrc.top != 0) )
+ {
+
+ if (lpDPF->dwFlags & DDPF_FOURCC)
+ {
+ switch (lpDPF->dwFourCC)
+ {
+ case FOURCC_YUY2:
+ case FOURCC_UYVY:
+ case FOURCC_YVYU:
+ DBG_DD(ErrorF("GetSrcStartAddress : FOURCC format :(0x%lx)\n", lpDPF->dwFourCC));
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ dwOffset = (((rSrc.top&~3) * (dwSrcPitch)) +
+ ((rSrc.left << 1)&~31));
+ if (dwHQVsrcHeight>dwHQVdstHeight)
+ {
+ dwHQVSrcTopOffset = ((rSrc.top&~3) * dwHQVdstHeight / dwHQVsrcHeight)* dwSrcPitch;
+ }
+ else
+ {
+ dwHQVSrcTopOffset = (rSrc.top&~3) * (dwSrcPitch);
+ }
+
+ if (dwHQVsrcWidth>dwHQVdstWidth)
+ {
+ dwHQVSrcLeftOffset = ((rSrc.left << 1)&~31) * dwHQVdstWidth / dwHQVsrcWidth;
+ }
+ else
+ {
+ dwHQVSrcLeftOffset = (rSrc.left << 1)&~31 ;
+ }
+ *lpHQVoffset = dwHQVSrcTopOffset+dwHQVSrcLeftOffset;
+ }
+ else
+ {
+ dwOffset = ((rSrc.top * dwSrcPitch) +
+ ((rSrc.left << 1)&~15));
+ }
+ break;
+
+ case FOURCC_IYUV:
+ case FOURCC_VIA:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ unsigned long dwDstTop=0, dwDstLeft=0;
+
+ dwDstTop = ((rSrc.top * MPGDevice.gdwMPGDstHeight) + (MPGDevice.dwHeight>>1))/MPGDevice.dwHeight;
+ dwDstLeft = ((rSrc.left * MPGDevice.gdwMPGDstWidth) + (MPGDevice.dwWidth>>1))/MPGDevice.dwWidth;
+
+ if (MPGDevice.gdwMPGDstHeight < MPGDevice.dwHeight)
+ dwOffset = dwDstTop * (MPGDevice.dwPitch <<1);
+ else
+ dwOffset = rSrc.top * (MPGDevice.dwPitch <<1);
+
+ if (MPGDevice.gdwMPGDstWidth < MPGDevice.dwWidth)
+ dwOffset += (dwDstLeft<<1)&~31;
+ else
+ dwOffset += (rSrc.left<<1)&~31;
+ }
+ else
+ {
+ dwOffset = ((((rSrc.top&~3) * dwSrcPitch) +
+ rSrc.left)&~31) ;
+ if (rSrc.top >0)
+ {
+ overlayRecordV1.dwUVoffset = (((((rSrc.top&~3)>>1) * dwSrcPitch) +
+ rSrc.left)&~31) >>1;
+ }
+ else
+ {
+ overlayRecordV1.dwUVoffset = dwOffset >>1 ;
+ }
+ }
+ break;
+ case FOURCC_YV12:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ dwOffset = (((rSrc.top&~3) * (dwSrcPitch<<1)) +
+ ((rSrc.left << 1)&~31));
+ }
+ else
+ {
+ dwOffset = ((((rSrc.top&~3) * dwSrcPitch) +
+ rSrc.left)&~31) ;
+ if (rSrc.top >0)
+ {
+ overlayRecordV1.dwUVoffset = (((((rSrc.top&~3)>>1) * dwSrcPitch) +
+ rSrc.left)&~31) >>1;
+ }
+ else
+ {
+ overlayRecordV1.dwUVoffset = dwOffset >>1 ;
+ }
+ }
+ break;
+
+ default:
+ DBG_DD(ErrorF("DDOver_GetSrcStartAddress : Invalid FOURCC format :(0x%lx)in V3!\n", lpDPF->dwFourCC));
+ break;
+ }
+ }
+ else if (lpDPF->dwFlags & DDPF_RGB)
+ {
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ dwOffset = (((rSrc.top&~3) * (dwSrcPitch<<1)) +
+ ((rSrc.left << 1)&~31));
+
+ if (dwHQVsrcHeight>dwHQVdstHeight)
+ {
+ dwHQVSrcTopOffset = ((rSrc.top&~3) * dwHQVdstHeight / dwHQVsrcHeight)* dwSrcPitch;
+ }
+ else
+ {
+ dwHQVSrcTopOffset = (rSrc.top&~3) * (dwSrcPitch);
+ }
+
+ if (dwHQVsrcWidth>dwHQVdstWidth)
+ {
+ dwHQVSrcLeftOffset = ((rSrc.left << 1)&~31) * dwHQVdstWidth / dwHQVsrcWidth;
+ }
+ else
+ {
+ dwHQVSrcLeftOffset = (rSrc.left << 1)&~31 ;
+ }
+ *lpHQVoffset = dwHQVSrcTopOffset+dwHQVSrcLeftOffset;
+
+ }
+ else
+ {
+ dwOffset = (rSrc.top * dwSrcPitch) +
+ ((rSrc.left * lpDPF->dwRGBBitCount) >> 3);
+ }
+ }
+ }
+ else
+ {
+ overlayRecordV1.dwUVoffset = dwOffset = 0;
+ }
+
+ return dwOffset;
+}
+
+YCBCRREC DDOVer_GetYCbCrStartAddress(unsigned long dwVideoFlag,unsigned long dwStartAddr, unsigned long dwOffset,unsigned long dwUVoffset,unsigned long dwSrcPitch/*lpGbl->lPitch*/,unsigned long dwSrcHeight/*lpGbl->wHeight*/)
+{
+ YCBCRREC YCbCr;
+
+ /*dwStartAddr = (unsigned long)lpGbl->fpVidMem - VideoBase;*/
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ YCbCr.dwY = dwStartAddr;
+ YCbCr.dwCB = dwStartAddr + dwSrcPitch * dwSrcHeight ;
+ YCbCr.dwCR = dwStartAddr + dwSrcPitch * dwSrcHeight
+ + dwSrcPitch * (dwSrcHeight >>2);
+ }
+ else
+ {
+ YCbCr.dwY = dwStartAddr+dwOffset;
+ YCbCr.dwCB = dwStartAddr + dwSrcPitch * dwSrcHeight
+ + dwUVoffset;
+ YCbCr.dwCR = dwStartAddr + dwSrcPitch * dwSrcHeight
+ + dwSrcPitch * (dwSrcHeight >>2)
+ + dwUVoffset;
+ }
+ return YCbCr;
+}
+
+
+unsigned long DDOVER_HQVCalcZoomWidth(unsigned long dwVideoFlag, unsigned long srcWidth , unsigned long dstWidth,
+ unsigned long * lpzoomCtl, unsigned long * lpminiCtl, unsigned long * lpHQVfilterCtl, unsigned long * lpHQVminiCtl,unsigned long * lpHQVzoomflag)
+{
+ unsigned long dwTmp;
+
+ if (srcWidth == dstWidth)
+ {
+ *lpHQVfilterCtl |= HQV_H_FILTER_DEFAULT;
+ }
+ else
+ {
+
+ if (srcWidth < dstWidth) {
+ /* zoom in*/
+ *lpzoomCtl = srcWidth*0x0800 / dstWidth;
+ *lpzoomCtl = (((*lpzoomCtl) & 0x7FF) << 16) | V1_X_ZOOM_ENABLE;
+ *lpminiCtl |= ( V1_X_INTERPOLY ); /* set up interpolation*/
+ *lpHQVzoomflag = 1;
+ *lpHQVfilterCtl |= HQV_H_FILTER_DEFAULT ;
+ } else if (srcWidth > dstWidth) {
+ /* zoom out*/
+ unsigned long srcWidth1;
+
+ /*HQV rounding patch
+ //dwTmp = dstWidth*0x0800 / srcWidth;*/
+ dwTmp = dstWidth*0x0800*0x400 / srcWidth;
+ dwTmp = dwTmp / 0x400 + ((dwTmp & 0x3ff)?1:0);
+
+ *lpHQVminiCtl = (dwTmp & 0x7FF)| HQV_H_MINIFY_ENABLE;
+
+
+ srcWidth1 = srcWidth >> 1;
+ if (srcWidth1 <= dstWidth) {
+ *lpminiCtl |= V1_X_DIV_2+V1_X_INTERPOLY;
+ if (dwVideoFlag&VIDEO_1_INUSE)
+ {
+ overlayRecordV1.dwFetchAlignment = 3;
+ overlayRecordV1.dwminifyH = 2;
+ }
+ else
+ {
+ overlayRecordV3.dwFetchAlignment = 3;
+ overlayRecordV3.dwminifyH = 2;
+ }
+ *lpHQVfilterCtl |= HQV_H_TAP4_121;
+ /* *lpHQVminiCtl = 0x00000c00;*/
+ }
+ else {
+ srcWidth1 >>= 1;
+
+ if (srcWidth1 <= dstWidth) {
+ *lpminiCtl |= V1_X_DIV_4+V1_X_INTERPOLY;
+ if (dwVideoFlag&VIDEO_1_INUSE)
+ {
+ overlayRecordV1.dwFetchAlignment = 7;
+ overlayRecordV1.dwminifyH = 4;
+ }
+ else
+ {
+ overlayRecordV3.dwFetchAlignment = 7;
+ overlayRecordV3.dwminifyH = 4;
+ }
+ *lpHQVfilterCtl |= HQV_H_TAP4_121;
+ /* *lpHQVminiCtl = 0x00000a00;*/
+ }
+ else {
+ srcWidth1 >>= 1;
+
+ if (srcWidth1 <= dstWidth) {
+ *lpminiCtl |= V1_X_DIV_8+V1_X_INTERPOLY;
+ if (dwVideoFlag&VIDEO_1_INUSE)
+ {
+ overlayRecordV1.dwFetchAlignment = 15;
+ overlayRecordV1.dwminifyH = 8;
+ }
+ else
+ {
+ overlayRecordV3.dwFetchAlignment = 15;
+ overlayRecordV3.dwminifyH = 8;
+ }
+ *lpHQVfilterCtl |= HQV_H_TAP8_12221;
+ /* *lpHQVminiCtl = 0x00000900;*/
+ }
+ else {
+ srcWidth1 >>= 1;
+
+ if (srcWidth1 <= dstWidth) {
+ *lpminiCtl |= V1_X_DIV_16+V1_X_INTERPOLY;
+ if (dwVideoFlag&VIDEO_1_INUSE)
+ {
+ overlayRecordV1.dwFetchAlignment = 15;
+ overlayRecordV1.dwminifyH = 16;
+ }
+ else
+ {
+ overlayRecordV3.dwFetchAlignment = 15;
+ overlayRecordV3.dwminifyH = 16;
+ }
+ *lpHQVfilterCtl |= HQV_H_TAP8_12221;
+ /* *lpHQVminiCtl = 0x00000880;*/
+ }
+ else {
+ /* too small to handle
+ //VIDOutD(V_COMPOSE_MODE, dwCompose);
+ //lpUO->ddRVal = PI_OK;
+ //return DDHAL_DRIVER_NOTHANDLED;*/
+ *lpminiCtl |= V1_X_DIV_16+V1_X_INTERPOLY;
+ if (dwVideoFlag&VIDEO_1_INUSE)
+ {
+ overlayRecordV1.dwFetchAlignment = 15;
+ overlayRecordV1.dwminifyH = 16;
+ }
+ else
+ {
+ overlayRecordV3.dwFetchAlignment = 15;
+ overlayRecordV3.dwminifyH = 16;
+ }
+ *lpHQVfilterCtl |= HQV_H_TAP8_12221;
+ }
+ }
+ }
+ }
+
+ *lpHQVminiCtl |= HQV_HDEBLOCK_FILTER;
+
+ if (srcWidth1 < dstWidth) {
+ /* CLE bug
+ *lpzoomCtl = srcWidth1*0x0800 / dstWidth;*/
+ *lpzoomCtl = (srcWidth1-2)*0x0800 / dstWidth;
+ *lpzoomCtl = ((*lpzoomCtl & 0x7FF) << 16) | V1_X_ZOOM_ENABLE;
+ }
+ }
+ }
+
+ return ~PI_ERR;
+}
+
+unsigned long DDOVER_HQVCalcZoomHeight (unsigned long srcHeight,unsigned long dstHeight,
+ unsigned long * lpzoomCtl, unsigned long * lpminiCtl, unsigned long * lpHQVfilterCtl, unsigned long * lpHQVminiCtl,unsigned long * lpHQVzoomflag)
+{
+ unsigned long dwTmp;
+ if (gVIAGraphicInfo.dwExpand)
+ {
+ dstHeight = dstHeight + 1;
+ }
+
+ if (srcHeight < dstHeight)
+ {
+ /* zoom in*/
+ dwTmp = srcHeight * 0x0400 / dstHeight;
+ *lpzoomCtl |= ((dwTmp & 0x3FF) | V1_Y_ZOOM_ENABLE);
+ *lpminiCtl |= (V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY);
+ *lpHQVzoomflag = 1;
+ *lpHQVfilterCtl |= HQV_V_TAP4_121;
+ }
+ else if (srcHeight == dstHeight)
+ {
+ *lpHQVfilterCtl |= HQV_V_TAP4_121;
+ }
+ else if (srcHeight > dstHeight)
+ {
+ /* zoom out*/
+ unsigned long srcHeight1;
+
+ /*HQV rounding patch
+ //dwTmp = dstHeight*0x0800 / srcHeight;*/
+ dwTmp = dstHeight*0x0800*0x400 / srcHeight;
+ dwTmp = dwTmp / 0x400 + ((dwTmp & 0x3ff)?1:0);
+
+ *lpHQVminiCtl |= ((dwTmp& 0x7FF)<<16)|HQV_V_MINIFY_ENABLE;
+
+ srcHeight1 = srcHeight >> 1;
+ if (srcHeight1 <= dstHeight)
+ {
+ *lpminiCtl |= V1_Y_DIV_2;
+ *lpHQVfilterCtl |= HQV_V_TAP4_121 ;
+ /* *lpHQVminiCtl |= 0x0c000000;*/
+ }
+ else
+ {
+ srcHeight1 >>= 1;
+ if (srcHeight1 <= dstHeight)
+ {
+ *lpminiCtl |= V1_Y_DIV_4;
+ *lpHQVfilterCtl |= HQV_V_TAP4_121 ;
+ /* *lpHQVminiCtl |= 0x0a000000;*/
+ }
+ else
+ {
+ srcHeight1 >>= 1;
+
+ if (srcHeight1 <= dstHeight)
+ {
+ *lpminiCtl |= V1_Y_DIV_8;
+ *lpHQVfilterCtl |= HQV_V_TAP8_12221;
+ /* *lpHQVminiCtl |= 0x09000000;*/
+ }
+ else
+ {
+ srcHeight1 >>= 1;
+
+ if (srcHeight1 <= dstHeight)
+ {
+ *lpminiCtl |= V1_Y_DIV_16;
+ *lpHQVfilterCtl |= HQV_V_TAP8_12221;
+ /* *lpHQVminiCtl |= 0x08800000;*/
+ }
+ else
+ {
+ /* too small to handle
+ //VIDOutD(V_COMPOSE_MODE, dwCompose);
+ //lpUO->ddRVal = PI_OK;
+ //Fixed QAW91013
+ //return DDHAL_DRIVER_NOTHANDLED;*/
+ *lpminiCtl |= V1_Y_DIV_16;
+ *lpHQVfilterCtl |= HQV_V_TAP8_12221;
+ }
+ }
+ }
+ }
+
+ *lpHQVminiCtl |= HQV_VDEBLOCK_FILTER;
+
+ if (srcHeight1 < dstHeight)
+ {
+ dwTmp = srcHeight1 * 0x0400 / dstHeight;
+ *lpzoomCtl |= ((dwTmp & 0x3FF) | V1_Y_ZOOM_ENABLE);
+ *lpminiCtl |= ( V1_Y_INTERPOLY|V1_YCBCR_INTERPOLY);
+ }
+ }
+
+ return ~PI_ERR;
+}
+
+
+unsigned long DDOver_GetFetch(unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF,unsigned long dwSrcWidth,unsigned long dwDstWidth,unsigned long dwOriSrcWidth,unsigned long * lpHQVsrcFetch)
+{
+ unsigned long dwFetch=0;
+
+ if (lpDPF->dwFlags & DDPF_FOURCC)
+ {
+ DBG_DD(ErrorF("DDOver_GetFetch : FourCC= 0x%lx\n", lpDPF->dwFourCC));
+ switch (lpDPF->dwFourCC) {
+ case FOURCC_YV12:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpHQVsrcFetch = dwOriSrcWidth;
+ if (dwDstWidth >= dwSrcWidth)
+ dwFetch = ((((dwSrcWidth<<1)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ else
+ dwFetch = ((((dwDstWidth<<1)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ }
+ else
+ {
+ /* we fetch one more quadword to avoid get less video data
+ //dwFetch = (((dwSrcWidth +V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT)>> V1_FETCHCOUNT_UNIT) +1;*/
+ dwFetch = (((dwSrcWidth + 0x1F)&~0x1f)>> V1_FETCHCOUNT_UNIT);
+ }
+ break;
+ case FOURCC_IYUV:
+ case FOURCC_VIA:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ if (dwDstWidth >= dwSrcWidth)
+ dwFetch = ((((dwSrcWidth<<1)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ else
+ dwFetch = ((((dwDstWidth<<1)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+
+ }
+ else
+ {
+ /*Comment by Vinecnt ,we fetch one more quadword to avoid get less video data*/
+ dwFetch = (((dwSrcWidth +V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT)>> V1_FETCHCOUNT_UNIT) +1;
+ }
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YVYU:
+ case FOURCC_YUY2:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpHQVsrcFetch = dwOriSrcWidth<<1;
+ if (dwDstWidth >= dwSrcWidth)
+ dwFetch = ((((dwSrcWidth<<1)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ else
+ dwFetch = ((((dwDstWidth<<1)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ }
+ else
+ {
+ /*Comment by Vinecnt ,we fetch one more quadword to avoid get less video data*/
+ dwFetch = ((((dwSrcWidth<<1)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ }
+ break;
+ default :
+ DBG_DD(ErrorF("DDOver_GetFetch : Invalid FOURCC format :(0x%lx)in V1!\n", lpDPF->dwFourCC));
+ break;
+ }
+ }
+ else if (lpDPF->dwFlags & DDPF_RGB) {
+ switch (lpDPF->dwRGBBitCount) {
+ case 16:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpHQVsrcFetch = dwOriSrcWidth<<1;
+ if (dwDstWidth >= dwSrcWidth)
+ dwFetch = ((((dwSrcWidth<<1)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ else
+ dwFetch = ((((dwDstWidth<<1)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ }
+ else
+ {
+ /*Comment by Vinecnt ,we fetch one more quadword to avoid get less video data*/
+ dwFetch = ((((dwSrcWidth<<1)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ }
+ break;
+ case 32:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpHQVsrcFetch = dwOriSrcWidth<<2;
+ if (dwDstWidth >= dwSrcWidth)
+ dwFetch = ((((dwSrcWidth<<2)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ else
+ dwFetch = ((((dwDstWidth<<2)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ }
+ else
+ {
+ /*Comment by Vinecnt ,we fetch one more quadword to avoid get less video data*/
+ dwFetch = ((((dwSrcWidth<<2)+V1_FETCHCOUNT_ALIGNMENT)&~V1_FETCHCOUNT_ALIGNMENT) >> V1_FETCHCOUNT_UNIT)+1;
+ }
+ break;
+
+ default :
+ DBG_DD(ErrorF("DDOver_GetFetch : invalid RGB format %ld bits\n",lpDPF->dwRGBBitCount));
+ break;
+ }
+ }
+
+ /*Fix plannar mode problem*/
+ if (dwFetch <4)
+ {
+ dwFetch = 4;
+ }
+ return dwFetch;
+}
+
+void DDOver_GetDisplayCount(unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF,unsigned long dwSrcWidth,unsigned long * lpDisplayCountW)
+{
+
+ /*unsigned long dwFetch=0;*/
+
+ if (lpDPF->dwFlags & DDPF_FOURCC)
+ {
+ switch (lpDPF->dwFourCC) {
+ case FOURCC_YV12:
+ case FOURCC_UYVY:
+ case FOURCC_YVYU:
+ case FOURCC_YUY2:
+ case FOURCC_IYUV:
+ case FOURCC_VIA:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpDisplayCountW = dwSrcWidth - 1;
+ }
+ else
+ {
+ /* *lpDisplayCountW = dwSrcWidth - 2*overlayRecordV1.dwminifyH;*/
+ *lpDisplayCountW = dwSrcWidth - overlayRecordV1.dwminifyH;
+ }
+ break;
+ default :
+ DBG_DD(ErrorF("DDOver_GetDisplayCount : Invalid FOURCC format :(0x%lx)in V1!\n", lpDPF->dwFourCC));
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpDisplayCountW = dwSrcWidth - 1;
+ }
+ else
+ {
+ /* *lpDisplayCountW = dwSrcWidth - 2*overlayRecordV1.dwminifyH;*/
+ *lpDisplayCountW = dwSrcWidth - overlayRecordV1.dwminifyH;
+ }
+ break;
+ }
+ }
+ else if (lpDPF->dwFlags & DDPF_RGB) {
+ switch (lpDPF->dwRGBBitCount) {
+ case 16:
+ case 32:
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpDisplayCountW = dwSrcWidth - 1;
+ }
+ else
+ {
+ *lpDisplayCountW = dwSrcWidth - overlayRecordV1.dwminifyH;
+ }
+ break;
+
+ default :
+ DBG_DD(ErrorF("DDOver_GetDisplayCount : invalid RGB format %ld bits\n",lpDPF->dwRGBBitCount));
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ *lpDisplayCountW = dwSrcWidth - 1;
+ }
+ else
+ {
+ *lpDisplayCountW = dwSrcWidth - overlayRecordV1.dwminifyH;
+ }
+ break;
+ }
+ }
+}
+
+unsigned long DispatchVGARevisionID(VIAGRAPHICINFO gVIAGraphicInfo)
+{
+ if ( gVIAGraphicInfo.RevisionID >= VIA_REVISION_CLECX )
+ {
+ return VIA_REVISION_CLECX;
+ }
+ else
+ {
+ return gVIAGraphicInfo.RevisionID;
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/ddover.h b/xc/programs/Xserver/hw/xfree86/drivers/via/ddover.h new file mode 100644 index 000000000..6f78340f6 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/ddover.h @@ -0,0 +1,72 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __DDOVER
+#define __DDOVER
+
+/*#define XV_DEBUG 1*/ /* write log msg to /var/log/XFree86.0.log */
+
+#ifdef XV_DEBUG
+ #define DBG_DD(x) (x)
+#else
+ #define DBG_DD(x)
+#endif
+
+/*#include <ddrawi.h>
+//#include <ddraw.h>
+//#include "ddvia.h" // include this to get GLOBALDATA struct definition
+//#include "/include/drivers/ddmpeg.h"
+//#include "/include/drivers/debug.h"
+*/
+#include "via_privIoctl.h" /* for VIAGRAPHICINFO & custom ioctl command */
+
+#define PLUS_HEIGHT 1 /*V003*/
+
+typedef struct _YCBCRREC {
+ unsigned long dwY ;
+ unsigned long dwCB;
+ unsigned long dwCR;
+} YCBCRREC;
+
+/*
+void DDOver_GetColorKey(LPDDHAL_UPDATEOVERLAYDATA lpUO, LPDDOVERLAYFX lpFX,
+ LPDDRAWI_DDRAWSURFACE_LCL lpDestSurf,
+ LPDDRAWI_DDRAWSURFACE_LCL lpSrcSurf,
+ unsigned long * lpColorKey,unsigned long * lpChromaKey,
+ unsigned long * lpKeyLow ,unsigned long * lpKeyHigh,
+ unsigned long * lpChromaLow ,unsigned long * lpChromaHigh);
+*/
+
+void DDOver_GetV1Format(unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF, unsigned long * lpdwVidCtl,unsigned long * lpdwHQVCtl );
+void DDOver_GetV3Format(unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF, unsigned long * lpdwVidCtl,unsigned long * lpdwHQVCtl );
+unsigned long DDOverHQV_GetFormat(LPDDPIXELFORMAT lpDPF, unsigned long dwVidCtl,unsigned long * lpdwHQVCtl );
+unsigned long DDOver_GetSrcStartAddress (unsigned long dwVideoFlag,RECTL rSrc,RECTL rDest, unsigned long dwSrcPitch,LPDDPIXELFORMAT lpDPF,unsigned long * lpHQVoffset );
+YCBCRREC DDOVer_GetYCbCrStartAddress(unsigned long dwVideoFlag,unsigned long dwStartAddr, unsigned long dwOffset,unsigned long dwUVoffset,unsigned long dwSrcPitch/*lpGbl->lPitch*/,unsigned long dwSrcHeight/*lpGbl->wHeight*/);
+unsigned long DDOVER_HQVCalcZoomWidth(unsigned long dwVideoFlag, unsigned long srcWidth , unsigned long dstWidth,
+ unsigned long * lpzoomCtl, unsigned long * lpminiCtl, unsigned long * lpHQVfilterCtl, unsigned long * lpHQVminiCtl,unsigned long * lpHQVzoomflag);
+unsigned long DDOVER_HQVCalcZoomHeight (unsigned long srcHeight,unsigned long dstHeight,
+ unsigned long * lpzoomCtl, unsigned long * lpminiCtl, unsigned long * lpHQVfilterCtl, unsigned long * lpHQVminiCtl,unsigned long * lpHQVzoomflag);
+unsigned long DDOver_GetFetch(unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF,unsigned long dwSrcWidth,unsigned long dwDstWidth,unsigned long dwOriSrcWidth,unsigned long * lpHQVsrcFetch);
+void DDOver_GetDisplayCount(unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF,unsigned long dwSrcWidth,unsigned long * lpDisplayCountW);
+#endif /*End of __DDOVER*/
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/regrec.c b/xc/programs/Xserver/hw/xfree86/drivers/via/regrec.c new file mode 100644 index 000000000..df43139ca --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/regrec.c @@ -0,0 +1,176 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*#include <stdlib.h>
+#include <string.h>*/
+#include "xf86.h"
+
+#include "via.h"
+#include "regrec.h"
+
+extern volatile unsigned char * lpVidMEMIO;
+/*extern unsigned long gdwVideoOn;*/
+extern Bool MPEG_ON;
+
+static VIDEOREGISTER VidReg[VIDEO_REG_NUM];
+static unsigned long gdwVidRegCounter;
+
+
+/* I N L I N E --------------------------------------------------------------*/
+
+__inline void WaitHQVIdle(void)
+{
+ while (!IN_HQV_FIRE);
+}
+
+__inline void WaitVideoCommandFire(void)
+{
+ /*while (IN_VIDEO_FIRE);*/
+ unsigned long volatile *pdwState = (unsigned long volatile *) (lpVidMEMIO+V_COMPOSE_MODE);
+ /*pdwState = (unsigned long volatile *) (lpVidMEMIO+V_COMPOSE_MODE);*/
+ while ((*pdwState & V1_COMMAND_FIRE)||(*pdwState & V3_COMMAND_FIRE));
+}
+
+__inline void WaitHQVFlip(void)
+{
+ unsigned long volatile *pdwState = (unsigned long volatile *) lpVidMEMIO;
+ pdwState = (unsigned long volatile *) (lpVidMEMIO+HQV_CONTROL);
+ while (!(*pdwState & HQV_FLIP_STATUS) );
+/*
+ while (!((*pdwState & 0xc0)== 0xc0) );
+ while (!((*pdwState & 0xc0)!= 0xc0) );
+*/
+}
+
+__inline void WaitHQVFlipClear(unsigned long dwData)
+{
+ unsigned long volatile *pdwState = (unsigned long volatile *) (lpVidMEMIO+HQV_CONTROL);
+ *pdwState =dwData;
+
+ while ((*pdwState & HQV_FLIP_STATUS) )
+ {
+ VIDOutD(HQV_CONTROL, *pdwState|HQV_FLIP_STATUS);
+ }
+}
+
+__inline void WaitVBI()
+{
+ while (IN_VIDEO_DISPLAY);
+}
+
+__inline void WaitHQVDone()
+{
+ unsigned long volatile *pdwState = (unsigned long volatile *) (lpVidMEMIO+HQV_CONTROL);
+ /*pdwState = (unsigned long volatile *) (GEAddr+HQV_CONTROL);*/
+
+ /*if (*pdwState & HQV_ENABLE)*/
+ if (MPEG_ON)
+ {
+ while ((*pdwState & HQV_SW_FLIP) );
+ }
+}
+
+__inline void Macro_VidREGFlush(void)
+{
+ unsigned long i;
+
+ WaitVideoCommandFire();
+
+ for (i=0; i< gdwVidRegCounter; i++ )
+ {
+ VIDOutD(VidReg[i].dwIndex, VidReg[i].dwData);
+ /*DBG_DD("Macro_VidREGFlush:%08lx %08lx\n",VidReg[i].dwIndex+0x200,VidReg[i].dwData);*/
+ DBG_DD(ErrorF("Macro_VidREGFlush:%08lx %08lx\n",VidReg[i].dwIndex+0x200,VidReg[i].dwData));
+ }
+}
+
+__inline void Macro_VidREGRec(unsigned long dwAction, unsigned long dwIndex, unsigned long dwData)
+{
+
+ switch (dwAction)
+ {
+ case VIDREGREC_RESET_COUNTER :
+ gdwVidRegCounter = 0;
+ break;
+
+ case VIDREGREC_SAVE_REGISTER:
+ VidReg[gdwVidRegCounter].dwIndex = dwIndex;
+ VidReg[gdwVidRegCounter].dwData = dwData;
+ gdwVidRegCounter++;
+ if ( gdwVidRegCounter > VIDEO_REG_NUM){
+ /*DBG_DD("Macro_VidREGRec:Out of Video register space");*/
+ DBG_DD(ErrorF("Macro_VidREGRec:Out of Video register space"));
+ }
+
+ break;
+
+ default :
+ /*DBG_DD("Macro_VidREGRec:Unknow action");*/
+ DBG_DD(ErrorF("Macro_VidREGRec:Unknow action"));
+ break;
+ }
+}
+
+__inline void Macro_VidREGFlushVPE(void)
+/*void Macro_VidREGFlushVPE(LPVIATHKINFO sData)*/
+{
+ unsigned long i;
+ unsigned long volatile *pdwState = (unsigned long volatile *) lpVidMEMIO;
+ pdwState = (unsigned long volatile *) (lpVidMEMIO+V_COMPOSE_MODE);
+
+ while ((*pdwState & V1_COMMAND_FIRE)||(*pdwState & V3_COMMAND_FIRE));
+
+ for (i=0; i< gdwVidRegCounter; i++ )
+ {
+ VIDOutD(VidReg[i].dwIndex, VidReg[i].dwData);
+ /*DBG_DD("Macro_VidREGFlush V3:%08lx %08lx\n",VidReg[i].dwIndex+0x200,VidReg[i].dwData);*/
+ DBG_DD(ErrorF("Macro_VidREGFlush V3:%08lx %08lx\n",VidReg[i].dwIndex+0x200,VidReg[i].dwData));
+ }
+}
+
+__inline void Macro_VidREGRecVPE(unsigned long dwAction, unsigned long dwIndex, unsigned long dwData)
+/*void Macro_VidREGRecVPE(unsigned long dwAction, unsigned long dwIndex, unsigned long dwData)*/
+{
+
+ switch (dwAction)
+ {
+ case VIDREGREC_RESET_COUNTER :
+ gdwVidRegCounter = 0;
+ break;
+
+ case VIDREGREC_SAVE_REGISTER:
+ VidReg[gdwVidRegCounter].dwIndex = dwIndex;
+ VidReg[gdwVidRegCounter].dwData = dwData;
+ gdwVidRegCounter++;
+ if ( gdwVidRegCounter > VIDEO_REG_NUM){
+ /*TOINT3;*/
+ }
+
+ break;
+
+ default :
+ /*TOINT3;*/
+ break;
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/regrec.h b/xc/programs/Xserver/hw/xfree86/drivers/via/regrec.h new file mode 100644 index 000000000..6a74b57e7 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/regrec.h @@ -0,0 +1,65 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __REGREC
+#define __REGREC
+
+/*#define XV_DEBUG 1*/ /* write log msg to /var/log/XFree86.0.log */
+
+#ifdef XV_DEBUG
+ #define DBG_DD(x) (x)
+#else
+ #define DBG_DD(x)
+#endif
+
+#define VIDREGREC_RESET_COUNTER 0
+#define VIDREGREC_SAVE_REGISTER VIDREGREC_RESET_COUNTER +1
+#define VIDREGREC_FLUSH_REGISTER VIDREGREC_RESET_COUNTER +2
+#define VIDEO_REG_NUM 100
+
+#define IN_HQV_FIRE (*((unsigned long volatile *)(lpVidMEMIO+HQV_CONTROL))&HQV_IDLE)
+#define IN_VIDEO_FIRE (*((unsigned long volatile *)(lpVidMEMIO+V_COMPOSE_MODE))&V1_COMMAND_FIRE)
+#define IN_HQV_FLIP (*((unsigned long volatile *)(lpVidMEMIO+HQV_CONTROL))&HQV_FLIP_STATUS)
+#define IN_VIDEO_DISPLAY (*((unsigned long volatile *)(lpVidMEMIO+V_FLAGS))&VBI_STATUS)
+
+/*#define IN_DISPLAY (VIDInD(V_FLAGS) & 0x200)
+//#define IN_VBLANK (!IN_DISPLAY)
+*/
+typedef struct
+{
+ unsigned long dwIndex;
+ unsigned long dwData;
+}VIDEOREGISTER;
+
+__inline void WaitHQVIdle(void);
+__inline void WaitVideoCommandFire(void);
+__inline void WaitHQVFlip(void);
+__inline void WaitHQVFlipClear(unsigned long dwData);
+__inline void WaitVBI(void);
+__inline void WaitHQVDone(void);
+__inline void Macro_VidREGFlush(void);
+__inline void Macro_VidREGRec(unsigned long dwAction, unsigned long dwIndex, unsigned long dwData);
+__inline void Macro_VidREGFlushVPE(void);
+__inline void Macro_VidREGRecVPE(unsigned long dwAction, unsigned long dwIndex, unsigned long dwData);
+#endif /*end of __REGREC*/
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via.cpp b/xc/programs/Xserver/hw/xfree86/drivers/via/via.cpp new file mode 100644 index 000000000..29132253c --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via.cpp @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via.cpp,v 1.5 2000/12/11 20:18:26 dawes Exp $
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH Via __drivermansuffix__ "Version 4.0.2" "XFree86"
+.SH NAME
+via \- Via video driver
+.SH SYNOPSIS
+.nf
+.B "Section \*qDevice\*q"
+.BI " Identifier \*q" devname \*q
+.B " Driver \*qvia\*q"
+\ \ ...
+.B EndSection
+.fi
+.SH DESCRIPTION
+.B via
+is an XFree86 driver for Via video cards.
+THIS MAN PAGE NEEDS TO BE FILLED IN.
+.SH SUPPORTED HARDWARE
+The
+.B via
+driver supports...
+.SH CONFIGURATION DETAILS
+Please refer to XF86Config(__filemansuffix__) for general configuration
+details. This section only covers configuration details specific to this
+driver.
+.SH "SEE ALSO"
+XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
+.SH AUTHORS
+Authors include: ...
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via.h new file mode 100644 index 000000000..6e26d5cdc --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via.h @@ -0,0 +1,572 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/* Video status flag */
+
+#define VIDEO_SHOW 0x80000000 /*Video on*/
+#define VIDEO_HIDE 0x00000000 /*Video off*/
+#define VIDEO_MPEG_INUSE 0x08000000 /*Video is used with MPEG */
+#define VIDEO_HQV_INUSE 0x04000000 /*Video is used with HQV*/
+#define VIDEO_CAPTURE0_INUSE 0x02000000 /*Video is used with CAPTURE 0*/
+#define VIDEO_CAPTURE1_INUSE 0x00000000 /*Video is used with CAPTURE 1*/
+#define VIDEO_1_INUSE 0x01000000 /*Video 1 is used with software flip*/
+#define VIDEO_3_INUSE 0x00000000 /*Video 3 is used with software flip*/
+#define MPEG_USE_V1 0x00010000 /*[16] : 1:MPEG use V1, 0:MPEG use V3*/
+#define MPEG_USE_V3 0x00000000 /*[16] : 1:MPEG use V1, 0:MPEG use V3*/
+#define MPEG_USE_HQV 0x00020000 /*[17] : 1:MPEG use HQV,0:MPEG not use HQV*/
+#define MPEG_USE_HW_FLIP 0x00040000 /*[18] : 1:MPEG use H/W flip,0:MPEG use S/W flip*/
+#define MPEG_USE_SW_FLIP 0x00000000 /*[18] : 1:MPEG use H/W flip,0:MPEG use S/W flip*/
+#define CAP0_USE_V1 0x00001000 /*[12] : 1:Capture 0 use V1, 0:Capture 0 use V3*/
+#define CAP0_USE_V3 0x00000000 /*[12] : 1:Capture 0 use V1, 0:Capture 0 use V3*/
+#define CAP0_USE_HQV 0x00002000 /*[13] : 1:Capture 0 use HQV,0:Capture 0 not use HQV*/
+#define CAP0_USE_HW_FLIP 0x00004000 /*[14] : 1:Capture 0 use H/W flip,0:Capture 0 use S/W flip*/
+#define CAP0_USE_CCIR656 0x00008000 /*[15] : 1:Capture 0 use CCIR656,0:Capture 0 CCIR601*/
+#define CAP1_USE_V1 0x00000100 /*[ 8] : 1:Capture 1 use V1, 0:Capture 1 use V3*/
+#define CAP1_USE_V3 0x00000000 /*[ 8] : 1:Capture 1 use V1, 0:Capture 1 use V3*/
+#define CAP1_USE_HQV 0x00000200 /*[ 9] : 1:Capture 1 use HQV,0:Capture 1 not use HQV*/
+#define CAP1_USE_HW_FLIP 0x00000400 /*[10] : 1:Capture 1 use H/W flip,0:Capture 1 use S/W flip */
+#define SW_USE_V1 0x00000010 /*[ 4] : 1:Capture 1 use V1, 0:Capture 1 use V3 */
+#define SW_USE_V3 0x00000000 /*[ 4] : 1:Capture 1 use V1, 0:Capture 1 use V3 */
+#define SW_USE_HQV 0x00000020 /*[ 5] : 1:Capture 1 use HQV,0:Capture 1 not use HQV */
+
+/*
+#define VIDEO1_INUSE 0x00000010 //[ 4] : 1:Video 1 is used with S/W flip
+#define VIDEO1_USE_HQV 0x00000020 //[ 5] : 1:Video 1 use HQV with S/W flip
+#define VIDEO3_INUSE 0x00000001 //[ 0] : 1:Video 3 is used with S/W flip
+#define VIDEO3_USE_HQV 0x00000002 //[ 1] : 1:Video 3 use HQV with S/W flip
+*/
+
+/* H/W registers for Video Engine */
+
+/*
+ * bus master
+ */
+#define PCI_MASTER_ENABLE 0x01
+#define PCI_MASTER_SCATTER 0x00
+#define PCI_MASTER_SINGLE 0x02
+#define PCI_MASTER_GUI 0x00
+#define PCI_MASTER_VIDEO 0x04
+#define PCI_MASTER_INPUT 0x00
+#define PCI_MASTER_OUTPUT 0x08
+
+/*
+ * video registers
+ */
+#define V_FLAGS 0x00
+#define V_CAP_STATUS 0x04
+#define V_FLIP_STATUS 0x04
+#define V_ALPHA_WIN_START 0x08
+#define V_ALPHA_WIN_END 0x0C
+#define V_ALPHA_CONTROL 0x10
+#define V_CRT_STARTADDR 0x14
+#define V_CRT_STARTADDR_2 0x18
+#define V_ALPHA_STRIDE 0x1C
+#define V_COLOR_KEY 0x20
+#define V_ALPHA_STARTADDR 0x24
+#define V_CHROMAKEY_LOW 0x28
+#define V_CHROMAKEY_HIGH 0x2C
+#define V1_CONTROL 0x30
+#define V12_QWORD_PER_LINE 0x34
+#define V1_STARTADDR_1 0x38
+#define V1_STARTADDR_Y1 V1_STARTADDR_1
+#define V1_STRIDE 0x3C
+#define V1_WIN_START_Y 0x40
+#define V1_WIN_START_X 0x42
+#define V1_WIN_END_Y 0x44
+#define V1_WIN_END_X 0x46
+#define V1_STARTADDR_2 0x48
+#define V1_STARTADDR_Y2 V1_STARTADDR_2
+#define V1_ZOOM_CONTROL 0x4C
+#define V1_MINI_CONTROL 0x50
+#define V1_STARTADDR_0 0x54
+#define V1_STARTADDR_Y0 V1_STARTADDR_0
+#define V_FIFO_CONTROL 0x58
+#define V1_STARTADDR_3 0x5C
+#define V1_STARTADDR_Y3 V1_STARTADDR_3
+#define HI_CONTROL 0x60
+#define SND_COLOR_KEY 0x64
+#define ALPHA_V3_PREFIFO_CONTROL 0x68
+#define V1_SOURCE_HEIGHT 0x6C
+#define HI_TRANSPARENT_COLOR 0x70
+#define V_DISPLAY_TEMP 0x74 /* No use */
+#define ALPHA_V3_FIFO_CONTROL 0x78
+#define V3_SOURCE_WIDTH 0x7C
+#define V3_COLOR_KEY 0x80
+#define V1_ColorSpaceReg_1 0x84
+#define V1_ColorSpaceReg_2 0x88
+#define V1_STARTADDR_CB0 0x8C
+#define V1_OPAQUE_CONTROL 0x90 /* To be deleted */
+#define V3_OPAQUE_CONTROL 0x94 /* To be deleted */
+#define V_COMPOSE_MODE 0x98
+#define V3_STARTADDR_2 0x9C
+#define V3_CONTROL 0xA0
+#define V3_STARTADDR_0 0xA4
+#define V3_STARTADDR_1 0xA8
+#define V3_STRIDE 0xAC
+#define V3_WIN_START_Y 0xB0
+#define V3_WIN_START_X 0xB2
+#define V3_WIN_END_Y 0xB4
+#define V3_WIN_END_X 0xB6
+#define V3_ALPHA_QWORD_PER_LINE 0xB8
+#define V3_ZOOM_CONTROL 0xBC
+#define V3_MINI_CONTROL 0xC0
+#define V3_ColorSpaceReg_1 0xC4
+#define V3_ColorSpaceReg_2 0xC8
+#define V3_DISPLAY_TEMP 0xCC /* No use */
+#define V1_STARTADDR_CB1 0xE4
+#define V1_STARTADDR_CB2 0xE8
+#define V1_STARTADDR_CB3 0xEC
+#define V1_STARTADDR_CR0 0xF0
+#define V1_STARTADDR_CR1 0xF4
+#define V1_STARTADDR_CR2 0xF8
+#define V1_STARTADDR_CR3 0xFC
+
+/* Video Capture Engine Registers
+ * Capture Port 1
+ */
+#define CAP0_MASKS 0x100
+#define CAP1_MASKS 0x104
+#define CAP0_CONTROL 0x110
+#define CAP0_H_RANGE 0x114
+#define CAP0_V_RANGE 0x118
+#define CAP0_SCAL_CONTROL 0x11C
+#define CAP0_VBI_H_RANGE 0x120
+#define CAP0_VBI_V_RANGE 0x124
+#define CAP0_VBI_STARTADDR 0x128
+#define CAP0_VBI_STRIDE 0x12C
+#define CAP0_ANCIL_COUNT 0x130
+#define CAP0_MAXCOUNT 0x134
+#define CAP0_VBIMAX_COUNT 0x138
+#define CAP0_DATA_COUNT 0x13C
+#define CAP0_FB_STARTADDR0 0x140
+#define CAP0_FB_STARTADDR1 0x144
+#define CAP0_FB_STARTADDR2 0x148
+#define CAP0_STRIDE 0x150
+/* Capture Port 2 */
+#define CAP1_CONTROL 0x154
+#define CAP1_SCAL_CONTROL 0x160
+#define CAP1_VBI_H_RANGE 0x164 /*To be deleted*/
+#define CAP1_VBI_V_RANGE 0x168 /*To be deleted*/
+#define CAP1_VBI_STARTADDR 0x16C /*To be deleted*/
+#define CAP1_VBI_STRIDE 0x170 /*To be deleted*/
+#define CAP1_ANCIL_COUNT 0x174 /*To be deleted*/
+#define CAP1_MAXCOUNT 0x178
+#define CAP1_VBIMAX_COUNT 0x17C /*To be deleted*/
+#define CAP1_DATA_COUNT 0x180
+#define CAP1_FB_STARTADDR0 0x184
+#define CAP1_FB_STARTADDR1 0x188
+#define CAP1_STRIDE 0x18C
+
+/* SUBPICTURE Registers */
+#define SUBP_CONTROL_STRIDE 0x1C0
+#define SUBP_STARTADDR 0x1C4
+#define RAM_TABLE_CONTROL 0x1C8
+#define RAM_TABLE_READ 0x1CC
+
+/* HQV Registers */
+#define HQV_CONTROL 0x1D0
+#define HQV_SRC_STARTADDR_Y 0x1D4
+#define HQV_SRC_STARTADDR_U 0x1D8
+#define HQV_SRC_STARTADDR_V 0x1DC
+#define HQV_SRC_FETCH_LINE 0x1E0
+#define HQV_FILTER_CONTROL 0x1E4
+#define HQV_MINIFY_CONTROL 0x1E8
+#define HQV_DST_STARTADDR0 0x1EC
+#define HQV_DST_STARTADDR1 0x1F0
+#define HQV_DST_STARTADDR2 0x1FC
+#define HQV_DST_STRIDE 0x1F4
+#define HQV_SRC_STRIDE 0x1F8
+
+
+/*
+ * Video command definition
+ */
+/* #define V_ALPHA_CONTROL 0x210 */
+#define ALPHA_WIN_EXPIRENUMBER_4 0x00040000
+#define ALPHA_WIN_CONSTANT_FACTOR_4 0x00004000
+#define ALPHA_WIN_CONSTANT_FACTOR_12 0x0000c000
+#define ALPHA_WIN_BLENDING_CONSTANT 0x00000000
+#define ALPHA_WIN_BLENDING_ALPHA 0x00000001
+#define ALPHA_WIN_BLENDING_GRAPHIC 0x00000002
+#define ALPHA_WIN_PREFIFO_THRESHOLD_12 0x000c0000
+#define ALPHA_WIN_FIFO_THRESHOLD_8 0x000c0000
+#define ALPHA_WIN_FIFO_DEPTH_16 0x00100000
+
+/* V_CHROMAKEY_LOW 0x228 */
+#define V_CHROMAKEY_V3 0x80000000
+
+/* V1_CONTROL 0x230 */
+#define V1_ENABLE 0x00000001
+#define V1_FULL_SCREEN 0x00000002
+#define V1_YUV422 0x00000000
+#define V1_RGB32 0x00000004
+#define V1_RGB15 0x00000008
+#define V1_RGB16 0x0000000C
+#define V1_YCbCr420 0x00000010
+#define V1_COLORSPACE_SIGN 0x00000080
+#define V1_SRC_IS_FIELD_PIC 0x00000200
+#define V1_SRC_IS_FRAME_PIC 0x00000000
+#define V1_BOB_ENABLE 0x00400000
+#define V1_FIELD_BASE 0x00000000
+#define V1_FRAME_BASE 0x01000000
+#define V1_SWAP_SW 0x00000000
+#define V1_SWAP_HW_HQV 0x02000000
+#define V1_SWAP_HW_CAPTURE 0x04000000
+#define V1_SWAP_HW_MC 0x06000000
+/* #define V1_DOUBLE_BUFFERS 0x00000000 */
+/* #define V1_QUADRUPLE_BUFFERS 0x18000000 */
+#define V1_EXPIRE_NUM 0x00050000
+#define V1_EXPIRE_NUM_A 0x000a0000
+#define V1_EXPIRE_NUM_F 0x000f0000 /* jason */
+#define V1_FIFO_EXTENDED 0x00200000
+#define V1_ON_CRT 0x00000000
+#define V1_ON_SND_DISPLAY 0x80000000
+#define V1_FIFO_32V1_32V2 0x00000000
+#define V1_FIFO_48V1_32V2 0x00200000
+
+/* V12_QWORD_PER_LINE 0x234 */
+#define V1_FETCH_COUNT 0x3ff00000
+#define V1_FETCHCOUNT_ALIGNMENT 0x0000000f
+#define V1_FETCHCOUNT_UNIT 0x00000004 /* Doubld QWORD */
+
+/* V1_STRIDE */
+#define V1_STRIDE_YMASK 0x00001fff
+#define V1_STRIDE_UVMASK 0x1ff00000
+
+/* V1_ZOOM_CONTROL 0x24C */
+#define V1_X_ZOOM_ENABLE 0x80000000
+#define V1_Y_ZOOM_ENABLE 0x00008000
+
+/* V1_MINI_CONTROL 0x250 */
+#define V1_X_INTERPOLY 0x00000002 /* X interpolation */
+#define V1_Y_INTERPOLY 0x00000001 /* Y interpolation */
+#define V1_YCBCR_INTERPOLY 0x00000004 /* Y, Cb, Cr all interpolation */
+#define V1_X_DIV_2 0x01000000
+#define V1_X_DIV_4 0x03000000
+#define V1_X_DIV_8 0x05000000
+#define V1_X_DIV_16 0x07000000
+#define V1_Y_DIV_2 0x00010000
+#define V1_Y_DIV_4 0x00030000
+#define V1_Y_DIV_8 0x00050000
+#define V1_Y_DIV_16 0x00070000
+
+/* V1_STARTADDR0 0x254 */
+#define SW_FLIP_ODD 0x08000000
+
+/* V_FIFO_CONTROL 0x258
+ * IA2 has 32 level FIFO for packet mode video format
+ * 32 level FIFO for planar mode video YV12. with extension reg 230 bit 21 enable
+ * 16 level FIFO for planar mode video YV12. with extension reg 230 bit 21 disable
+ * BCos of 128 bits. 1 level in IA2 = 2 level in VT3122
+ */
+#define V1_FIFO_DEPTH12 0x0000000B
+#define V1_FIFO_DEPTH16 0x0000000F
+#define V1_FIFO_DEPTH32 0x0000001F
+#define V1_FIFO_DEPTH48 0x0000002F
+#define V1_FIFO_DEPTH64 0x0000003F
+#define V1_FIFO_THRESHOLD6 0x00000600
+#define V1_FIFO_THRESHOLD8 0x00000800
+#define V1_FIFO_THRESHOLD12 0x00000C00
+#define V1_FIFO_THRESHOLD16 0x00001000
+#define V1_FIFO_THRESHOLD24 0x00001800
+#define V1_FIFO_THRESHOLD32 0x00002000
+#define V1_FIFO_THRESHOLD40 0x00002800
+#define V1_FIFO_THRESHOLD48 0x00003000
+#define V1_FIFO_THRESHOLD56 0x00003800
+#define V1_FIFO_THRESHOLD61 0x00003D00
+#define V1_FIFO_PRETHRESHOLD10 0x0A000000
+#define V1_FIFO_PRETHRESHOLD12 0x0C000000
+#define V1_FIFO_PRETHRESHOLD29 0x1d000000
+#define V1_FIFO_PRETHRESHOLD40 0x28000000
+#define V1_FIFO_PRETHRESHOLD44 0x2c000000
+#define V1_FIFO_PRETHRESHOLD56 0x38000000
+#define V1_FIFO_PRETHRESHOLD61 0x3D000000
+
+/* ALPHA_V3_FIFO_CONTROL 0x278
+ * IA2 has 32 level FIFO for packet mode video format
+ * 32 level FIFO for planar mode video YV12. with extension reg 230 bit 21 enable
+ * 16 level FIFO for planar mode video YV12. with extension reg 230 bit 21 disable
+ * 8 level FIFO for ALPHA
+ * BCos of 128 bits. 1 level in IA2 = 2 level in VT3122
+ */
+#define V3_FIFO_DEPTH16 0x0000000F
+#define V3_FIFO_DEPTH24 0x00000017
+#define V3_FIFO_DEPTH32 0x0000001F
+#define V3_FIFO_DEPTH48 0x0000002F
+#define V3_FIFO_DEPTH64 0x0000003F
+#define V3_FIFO_THRESHOLD8 0x00000800
+#define V3_FIFO_THRESHOLD12 0x00000C00
+#define V3_FIFO_THRESHOLD16 0x00001000
+#define V3_FIFO_THRESHOLD24 0x00001800
+#define V3_FIFO_THRESHOLD32 0x00002000
+#define V3_FIFO_THRESHOLD40 0x00002800
+#define V3_FIFO_THRESHOLD48 0x00003000
+#define V3_FIFO_THRESHOLD61 0x00003D00
+#define V3_FIFO_PRETHRESHOLD10 0x0000000A
+#define V3_FIFO_PRETHRESHOLD12 0x0000000C
+#define V3_FIFO_PRETHRESHOLD29 0x0000001d
+#define V3_FIFO_PRETHRESHOLD40 0x00000028
+#define V3_FIFO_PRETHRESHOLD44 0x0000002c
+#define V3_FIFO_PRETHRESHOLD56 0x00000038
+#define V3_FIFO_PRETHRESHOLD61 0x0000003D
+#define V3_FIFO_MASK 0x0000007F
+#define ALPHA_FIFO_DEPTH8 0x00070000
+#define ALPHA_FIFO_THRESHOLD4 0x04000000
+#define ALPHA_FIFO_MASK 0xffff0000
+#define ALPHA_FIFO_PRETHRESHOLD4 0x00040000
+
+/* IA2 */
+#define ColorSpaceValue_1 0x140020f2
+#define ColorSpaceValue_2 0x0a0a2c00
+
+#define ColorSpaceValue_1_3123C0 0x13000DED
+#define ColorSpaceValue_2_3123C0 0x13171000
+
+/* For TV setting */
+#define ColorSpaceValue_1TV 0x140020f2
+#define ColorSpaceValue_2TV 0x0a0a2c00
+
+/* V_COMPOSE_MODE 0x298 */
+#define SELECT_VIDEO_IF_COLOR_KEY 0x00000001 /* select video if (color key),otherwise select graphics */
+#define SELECT_VIDEO3_IF_COLOR_KEY 0x00000020 /* For 3123C0, select video3 if (color key),otherwise select graphics */
+#define SELECT_VIDEO_IF_CHROMA_KEY 0x00000002 /* 0x0000000a //select video if (chroma key ),otherwise select graphics */
+#define ALWAYS_SELECT_VIDEO 0x00000000 /* always select video,Chroma key and Color key disable */
+#define COMPOSE_V1_V3 0x00000000 /* V1 on top of V3 */
+#define COMPOSE_V3_V1 0x00100000 /* V3 on top of V1 */
+#define COMPOSE_V1_TOP 0x00000000
+#define COMPOSE_V3_TOP 0x00100000
+#define V1_COMMAND_FIRE 0x80000000 /* V1 commands fire */
+#define V3_COMMAND_FIRE 0x40000000 /* V3 commands fire */
+#define V_COMMAND_LOAD 0x20000000 /* Video register always loaded */
+#define V_COMMAND_LOAD_VBI 0x10000000 /* Video register always loaded at vbi without waiting source flip */
+#define V3_COMMAND_LOAD 0x08000000 /* CLE_C0 Video3 register always loaded */
+#define V3_COMMAND_LOAD_VBI 0x00000100 /* CLE_C0 Video3 register always loaded at vbi without waiting source flip */
+#define SECOND_DISPLAY_COLOR_KEY_ENABLE 0x00010000
+
+/* V3_ZOOM_CONTROL 0x2bc */
+#define V3_X_ZOOM_ENABLE 0x80000000
+#define V3_Y_ZOOM_ENABLE 0x00008000
+
+/* V3_MINI_CONTROL 0x2c0 */
+#define V3_X_INTERPOLY 0x00000002 /* X interpolation */
+#define V3_Y_INTERPOLY 0x00000001 /* Y interpolation */
+#define V3_YCBCR_INTERPOLY 0x00000004 /* Y, Cb, Cr all interpolation */
+#define V3_X_DIV_2 0x01000000
+#define V3_X_DIV_4 0x03000000
+#define V3_X_DIV_8 0x05000000
+#define V3_X_DIV_16 0x07000000
+#define V3_Y_DIV_2 0x00010000
+#define V3_Y_DIV_4 0x00030000
+#define V3_Y_DIV_8 0x00050000
+#define V3_Y_DIV_16 0x00070000
+
+/* SUBP_CONTROL_STRIDE 0x3c0 */
+#define SUBP_HQV_ENABLE 0x00010000
+#define SUBP_IA44 0x00020000
+#define SUBP_AI44 0x00000000
+#define SUBP_STRIDE_MASK 0x00001fff
+#define SUBP_CONTROL_MASK 0x00070000
+
+/* RAM_TABLE_CONTROL 0x3c8 */
+#define RAM_TABLE_RGB_ENABLE 0x00000007
+
+/* CAPTURE0_CONTROL 0x310 */
+#define C0_ENABLE 0x00000001
+#define BUFFER_2_MODE 0x00000000
+#define BUFFER_3_MODE 0x00000004
+#define BUFFER_4_MODE 0x00000006
+#define SWAP_YUYV 0x00000000
+#define SWAP_UYVY 0x00000100
+#define SWAP_YVYU 0x00000200
+#define SWAP_VYUY 0x00000300
+#define IN_601_8 0x00000000
+#define IN_656_8 0x00000010
+#define IN_601_16 0x00000020
+#define IN_656_16 0x00000030
+#define DEINTER_ODD 0x00000000
+#define DEINTER_EVEN 0x00001000
+#define DEINTER_ODD_EVEN 0x00002000
+#define DEINTER_FRAME 0x00003000
+#define VIP_1 0x00000000
+#define VIP_2 0x00000400
+#define H_FILTER_2 0x00010000
+#define H_FILTER_4 0x00020000
+#define H_FILTER_8_1331 0x00030000
+#define H_FILTER_8_12221 0x00040000
+#define VIP_ENABLE 0x00000008
+#define EN_FIELD_SIG 0x00000800
+#define VREF_INVERT 0x00100000
+#define FIELD_INPUT_INVERSE 0x00400000
+#define FIELD_INVERSE 0x40000000
+
+#define C1_H_MINI_EN 0x00000800
+#define C0_H_MINI_EN 0x00000800
+#define C1_V_MINI_EN 0x04000000
+#define C0_V_MINI_EN 0x04000000
+#define C1_H_MINI_2 0x00000400
+
+/* CAPTURE1_CONTROL 0x354 */
+#define C1_ENABLE 0x00000001
+
+/* V3_CONTROL 0x2A0 */
+#define V3_ENABLE 0x00000001
+#define V3_FULL_SCREEN 0x00000002
+#define V3_YUV422 0x00000000
+#define V3_RGB32 0x00000004
+#define V3_RGB15 0x00000008
+#define V3_RGB16 0x0000000C
+#define V3_COLORSPACE_SIGN 0x00000080
+#define V3_EXPIRE_NUM 0x00040000
+#define V3_EXPIRE_NUM_F 0x000f0000
+#define V3_BOB_ENABLE 0x00400000
+#define V3_FIELD_BASE 0x00000000
+#define V3_FRAME_BASE 0x01000000
+#define V3_SWAP_SW 0x00000000
+#define V3_SWAP_HW_HQV 0x02000000
+#define V3_FLIP_HW_CAPTURE0 0x04000000
+#define V3_FLIP_HW_CAPTURE1 0x06000000
+
+/* V3_ALPHA_FETCH_COUNT 0x2B8 */
+#define V3_FETCH_COUNT 0x3ff00000
+#define ALPHA_FETCH_COUNT 0x000003ff
+
+/* HQV_CONTROL 0x3D0 */
+#define HQV_RGB32 0x00000000
+#define HQV_RGB16 0x20000000
+#define HQV_RGB15 0x30000000
+#define HQV_YUV422 0x80000000
+#define HQV_YUV420 0xC0000000
+#define HQV_ENABLE 0x08000000
+#define HQV_SRC_SW 0x00000000
+#define HQV_SRC_MC 0x01000000
+#define HQV_SRC_CAPTURE0 0x02000000
+#define HQV_SRC_CAPTURE1 0x03000000
+#define HQV_FLIP_EVEN 0x00000000
+#define HQV_FLIP_ODD 0x00000020
+#define HQV_SW_FLIP 0x00000010 /* Write 1 to flip HQV buffer */
+#define HQV_DEINTERLACE 0x00010000 /* First line of odd field will be repeated 3 times */
+#define HQV_FIELD_2_FRAME 0x00020000 /* Src is field. Display each line 2 times */
+#define HQV_FRAME_2_FIELD 0x00040000 /* Src is field. Display field */
+#define HQV_FRAME_UV 0x00000000 /* Src is Non-interleaved */
+#define HQV_FIELD_UV 0x00100000 /* Src is interleaved */
+#define HQV_IDLE 0x00000008
+#define HQV_FLIP_STATUS 0x00000001
+#define HQV_DOUBLE_BUFF 0x00000000
+#define HQV_TRIPLE_BUFF 0x04000000
+#define HQV_SUBPIC_FLIP 0x00008000
+#define HQV_FIFO_STATUS 0x00001000
+
+/* HQV_FILTER_CONTROL 0x3E4 */
+#define HQV_H_LOWPASS_2TAP 0x00000001
+#define HQV_H_LOWPASS_4TAP 0x00000002
+#define HQV_H_LOWPASS_8TAP1 0x00000003 /* To be deleted */
+#define HQV_H_LOWPASS_8TAP2 0x00000004 /* To be deleted */
+#define HQV_H_HIGH_PASS 0x00000008
+#define HQV_H_LOW_PASS 0x00000000
+#define HQV_V_LOWPASS_2TAP 0x00010000
+#define HQV_V_LOWPASS_4TAP 0x00020000
+#define HQV_V_LOWPASS_8TAP1 0x00030000
+#define HQV_V_LOWPASS_8TAP2 0x00040000
+#define HQV_V_HIGH_PASS 0x00080000
+#define HQV_V_LOW_PASS 0x00000000
+#define HQV_H_HIPASS_F1_DEFAULT 0x00000040
+#define HQV_H_HIPASS_F2_DEFAULT 0x00000000
+#define HQV_V_HIPASS_F1_DEFAULT 0x00400000
+#define HQV_V_HIPASS_F2_DEFAULT 0x00000000
+#define HQV_H_HIPASS_F1_2TAP 0x00000050
+#define HQV_H_HIPASS_F2_2TAP 0x00000100
+#define HQV_V_HIPASS_F1_2TAP 0x00500000
+#define HQV_V_HIPASS_F2_2TAP 0x01000000
+#define HQV_H_HIPASS_F1_4TAP 0x00000060
+#define HQV_H_HIPASS_F2_4TAP 0x00000200
+#define HQV_V_HIPASS_F1_4TAP 0x00600000
+#define HQV_V_HIPASS_F2_4TAP 0x02000000
+#define HQV_H_HIPASS_F1_8TAP 0x00000080
+#define HQV_H_HIPASS_F2_8TAP 0x00000400
+#define HQV_V_HIPASS_F1_8TAP 0x00800000
+#define HQV_V_HIPASS_F2_8TAP 0x04000000
+/* IA2 NEW */
+#define HQV_V_FILTER2 0x00080000
+#define HQV_H_FILTER2 0x00000008
+#define HQV_H_TAP2_11 0x00000041
+#define HQV_H_TAP4_121 0x00000042
+#define HQV_H_TAP4_1111 0x00000401
+#define HQV_H_TAP8_1331 0x00000221
+#define HQV_H_TAP8_12221 0x00000402
+#define HQV_H_TAP16_1991 0x00000159
+#define HQV_H_TAP16_141041 0x0000026A
+#define HQV_H_TAP32 0x0000015A
+#define HQV_V_TAP2_11 0x00410000
+#define HQV_V_TAP4_121 0x00420000
+#define HQV_V_TAP4_1111 0x04010000
+#define HQV_V_TAP8_1331 0x02210000
+#define HQV_V_TAP8_12221 0x04020000
+#define HQV_V_TAP16_1991 0x01590000
+#define HQV_V_TAP16_141041 0x026A0000
+#define HQV_V_TAP32 0x015A0000
+#define HQV_V_FILTER_DEFAULT 0x00420000
+#define HQV_H_FILTER_DEFAULT 0x00000040
+
+
+
+
+/* HQV_MINI_CONTROL 0x3E8 */
+#define HQV_H_MINIFY_ENABLE 0x00000800
+#define HQV_V_MINIFY_ENABLE 0x08000000
+#define HQV_VDEBLOCK_FILTER 0x80000000
+#define HQV_HDEBLOCK_FILTER 0x00008000
+
+
+#define CHROMA_KEY_LOW 0x00FFFFFF
+#define CHROMA_KEY_HIGH 0x00FFFFFF
+
+/* V_CAP_STATUS */
+#define V_ST_UPDATE_NOT_YET 0x00000003
+#define V1_ST_UPDATE_NOT_YET 0x00000001
+#define V3_ST_UPDATE_NOT_YET 0x00000008
+
+#define VBI_STATUS 0x00000002
+
+/*
+ * Macros for Video MMIO
+ */
+#ifndef V4L2
+#define VIDInB(port) *((volatile unsigned char *)(lpVidMEMIO + (port)))
+#define VIDInW(port) *((volatile unsigned short *)(lpVidMEMIO + (port)))
+#define VIDInD(port) *((volatile unsigned long *)(lpVidMEMIO + (port)))
+#define VIDOutB(port, data) *((volatile unsigned char *)(lpVidMEMIO + (port))) = (data)
+#define VIDOutW(port, data) *((volatile unsigned short *)(lpVidMEMIO + (port))) = (data)
+#define VIDOutD(port, data) *((volatile unsigned long *)(lpVidMEMIO + (port))) = (data)
+#define MPGOutD(port, data) *((volatile unsigned long *)(lpMPEGMMIO +(port))) = (data)
+#define MPGInD(port) *((volatile unsigned long *)(lpMPEGMMIO +(port)))
+#endif
+
+/*
+ * Macros for GE MMIO
+ */
+#define GEInW(port) *((volatile unsigned short *)(lpGEMMIO + (port)))
+#define GEInD(port) *((volatile unsigned long *)(lpGEMMIO + (port)))
+#define GEOutW(port, data) *((volatile unsigned short *)(lpGEMMIO + (port))) = (data)
+#define GEOutD(port, data) *((volatile unsigned long *)(lpGEMMIO + (port))) = (data)
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via.man b/xc/programs/Xserver/hw/xfree86/drivers/via/via.man new file mode 100644 index 000000000..4bd6617cd --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via.man @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via.man,v 1.1 2001/01/24 00:06:28 dawes Exp $
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH VIA __drivermansuffix__ __vendorversion__
+.SH NAME
+via \- VIA video driver
+.SH SYNOPSIS
+.nf
+.B "Section \*qDevice\*q"
+.BI " Identifier \*q" devname \*q
+.B " Driver \*qvia\*q"
+\ \ ...
+.B EndSection
+.fi
+.SH DESCRIPTION
+.B via
+is an XFree86 driver for VIA video cards.
+THIS MAN PAGE NEEDS TO BE FILLED IN.
+.SH SUPPORTED HARDWARE
+The
+.B via
+driver supports...
+.SH CONFIGURATION DETAILS
+Please refer to XF86Config(__filemansuffix__) for general configuration
+details. This section only covers configuration details specific to this
+driver.
+.SH "SEE ALSO"
+XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
+.SH AUTHORS
+Authors include: ...
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_accel.c new file mode 100644 index 000000000..d19c3ee5c --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_accel.c @@ -0,0 +1,1213 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*************************************************************************
+ *
+ * File: via_accel.c
+ * Content: 2D acceleration function for VIA/S3G UniChrom
+ *
+ ************************************************************************/
+
+#include "Xarch.h"
+#include "xaalocal.h"
+#include "xaarop.h"
+#include "miline.h"
+
+#include "via_driver.h"
+#include "via_regs.h"
+
+/* Forward declaration of functions used in the driver */
+
+static void VIASetupForScreenToScreenCopy(
+ ScrnInfoPtr pScrn,
+ int xdir,
+ int ydir,
+ int rop,
+ unsigned planemask,
+ int trans_color);
+
+static void VIASubsequentScreenToScreenCopy(
+ ScrnInfoPtr pScrn,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ int w,
+ int h);
+
+static void VIASetupForSolidFill(
+ ScrnInfoPtr pScrn,
+ int color,
+ int rop,
+ unsigned planemask);
+
+static void VIASubsequentSolidFillRect(
+ ScrnInfoPtr pScrn,
+ int x,
+ int y,
+ int w,
+ int h);
+
+static void VIASetupForMono8x8PatternFill(
+ ScrnInfoPtr pScrn,
+ int pattern0,
+ int pattern1,
+ int fg,
+ int bg,
+ int rop,
+ unsigned planemask);
+
+static void VIASubsequentMono8x8PatternFillRect(
+ ScrnInfoPtr pScrn,
+ int patOffx,
+ int patOffy,
+ int x,
+ int y,
+ int w,
+ int h);
+
+static void VIASetupForColor8x8PatternFill(
+ ScrnInfoPtr pScrn,
+ int patternx,
+ int patterny,
+ int rop,
+ unsigned planemask,
+ int trans_color);
+
+static void VIASubsequentColor8x8PatternFillRect(
+ ScrnInfoPtr pScrn,
+ int patOffx,
+ int patOffy,
+ int x,
+ int y,
+ int w,
+ int h);
+
+static void VIASetupForCPUToScreenColorExpandFill(
+ ScrnInfoPtr pScrn,
+ int fg,
+ int bg,
+ int rop,
+ unsigned planemask);
+
+static void VIASubsequentScanlineCPUToScreenColorExpandFill(
+ ScrnInfoPtr pScrn,
+ int x,
+ int y,
+ int w,
+ int h,
+ int skipleft);
+
+static void VIASetupForScreenToScreenColorExpand(
+ ScrnInfoPtr pScrn,
+ int bg,
+ int fg,
+ int rop,
+ unsigned planemask);
+
+static void VIASubsequentScreenToScreenColorExpand(
+ ScrnInfoPtr pScrn,
+ int x,
+ int y,
+ int w,
+ int h,
+ int srcx,
+ int srcy,
+ int offset);
+
+static void VIASetupForImageWrite(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned planemask,
+ int trans_color,
+ int bpp,
+ int depth);
+
+static void VIASubsequentImageWriteRect(
+ ScrnInfoPtr pScrn,
+ int x,
+ int y,
+ int w,
+ int h,
+ int skipleft);
+
+static void
+VIASetupForSolidLine(
+ ScrnInfoPtr pScrn,
+ int color,
+ int rop,
+ unsigned int planemask);
+
+static void
+VIASubsequentSolidTwoPointLine(
+ ScrnInfoPtr pScrn,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ int flags);
+
+static void
+VIASubsequentSolidHorVertLine(
+ ScrnInfoPtr pScrn,
+ int x,
+ int y,
+ int len,
+ int dir);
+
+static void
+VIASetupForDashedLine(
+ ScrnInfoPtr pScrn,
+ int fg,
+ int bg,
+ int rop,
+ unsigned int planemask,
+ int length,
+ unsigned char *pattern);
+
+static void
+VIASubsequentDashedTwoPointLine(
+ ScrnInfoPtr pScrn,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ int flags,
+ int phase);
+
+static void VIASetClippingRectangle(
+ ScrnInfoPtr pScrn,
+ int x1,
+ int y1,
+ int x2,
+ int y2);
+
+static void VIADisableClipping( ScrnInfoPtr );
+
+
+void
+VIAInitialize2DEngine(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ CARD32 dwVQStartAddr, dwVQEndAddr;
+ CARD32 dwVQLen, dwVQStartL, dwVQEndL, dwVQStartEndH;
+ CARD32 dwGEMode;
+
+ /* init 2D engine regs to reset 2D engine */
+ VIASETREG(0x04, 0x0);
+ VIASETREG(0x08, 0x0);
+ VIASETREG(0x0c, 0x0);
+ VIASETREG(0x10, 0x0);
+ VIASETREG(0x14, 0x0);
+ VIASETREG(0x18, 0x0);
+ VIASETREG(0x1c, 0x0);
+ VIASETREG(0x20, 0x0);
+ VIASETREG(0x24, 0x0);
+ VIASETREG(0x28, 0x0);
+ VIASETREG(0x2c, 0x0);
+ VIASETREG(0x30, 0x0);
+ VIASETREG(0x34, 0x0);
+ VIASETREG(0x38, 0x0);
+ VIASETREG(0x3c, 0x0);
+ VIASETREG(0x40, 0x0);
+
+ /* Init AGP and VQ regs */
+ VIASETREG(0x43c, 0x00100000);
+ VIASETREG(0x440, 0x00000000);
+ VIASETREG(0x440, 0x00333004);
+ VIASETREG(0x440, 0x60000000);
+ VIASETREG(0x440, 0x61000000);
+ VIASETREG(0x440, 0x62000000);
+ VIASETREG(0x440, 0x63000000);
+ VIASETREG(0x440, 0x64000000);
+ VIASETREG(0x440, 0x7D000000);
+
+ VIASETREG(0x43c, 0xfe020000);
+ VIASETREG(0x440, 0x00000000);
+
+ if (pVia->VQStart != 0) {
+ /* Enable VQ */
+ dwVQStartAddr = pVia->VQStart;
+ dwVQEndAddr = pVia->VQEnd;
+ dwVQStartL = 0x50000000 | (dwVQStartAddr & 0xFFFFFF);
+ dwVQEndL = 0x51000000 | (dwVQEndAddr & 0xFFFFFF);
+ dwVQStartEndH = 0x52000000 | ((dwVQStartAddr & 0xFF000000) >> 24) |
+ ((dwVQEndAddr & 0xFF000000) >> 16);
+ dwVQLen = 0x53000000 | (VIA_VQ_SIZE >> 3);
+
+ VIASETREG(0x43c, 0x00fe0000);
+ VIASETREG(0x440, 0x080003fe);
+ VIASETREG(0x440, 0x0a00027c);
+ VIASETREG(0x440, 0x0b000260);
+ VIASETREG(0x440, 0x0c000274);
+ VIASETREG(0x440, 0x0d000264);
+ VIASETREG(0x440, 0x0e000000);
+ VIASETREG(0x440, 0x0f000020);
+ VIASETREG(0x440, 0x1000027e);
+ VIASETREG(0x440, 0x110002fe);
+ VIASETREG(0x440, 0x200f0060);
+
+ VIASETREG(0x440, 0x00000006);
+ VIASETREG(0x440, 0x40008c0f);
+ VIASETREG(0x440, 0x44000000);
+ VIASETREG(0x440, 0x45080c04);
+ VIASETREG(0x440, 0x46800408);
+
+ VIASETREG(0x440, dwVQStartEndH);
+ VIASETREG(0x440, dwVQStartL);
+ VIASETREG(0x440, dwVQEndL);
+ VIASETREG(0x440, dwVQLen);
+ }
+ else {
+ /* Diable VQ */
+ VIASETREG(0x43c, 0x00fe0000);
+ VIASETREG(0x440, 0x00000004);
+ VIASETREG(0x440, 0x40008c0f);
+ VIASETREG(0x440, 0x44000000);
+ VIASETREG(0x440, 0x45080c04);
+ VIASETREG(0x440, 0x46800408);
+ }
+
+ dwGEMode = 0;
+
+ switch (pScrn->bitsPerPixel) {
+ case 16:
+ dwGEMode |= VIA_GEM_16bpp;
+ break;
+ case 32:
+ dwGEMode |= VIA_GEM_32bpp;
+ default:
+ dwGEMode |= VIA_GEM_8bpp;
+ break;
+ }
+
+#if 0
+ switch (pScrn->displayWidth) {
+ case 800:
+ dwGEMode |= VIA_GEM_800;
+ break;
+ case 1024:
+ dwGEMode |= VIA_GEM_1024;
+ break;
+ case 1280:
+ dwGEMode |= VIA_GEM_1280;
+ break;
+ case 1600:
+ dwGEMode |= VIA_GEM_1600;
+ break;
+ case 2048:
+ dwGEMode |= VIA_GEM_2048;
+ break;
+ default:
+ dwGEMode |= VIA_GEM_640;
+ break;
+ }
+#endif
+
+ /* Set BPP and Pitch */
+ VIASETREG(VIA_REG_GEMODE, dwGEMode);
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+}
+
+
+
+/* Acceleration init function, sets up pointers to our accelerated functions */
+Bool
+VIAInitAccel(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+ XAAInfoRecPtr xaaptr;
+ BoxRec AvailFBArea;
+
+ pVia->VQStart = 0;
+ if (((pVia->FBFreeEnd - pVia->FBFreeStart) >= VIA_VQ_SIZE) &&
+ pVia->VQEnable) {
+ /* Reserved space for VQ */
+ pVia->VQStart = pVia->FBFreeEnd - VIA_VQ_SIZE;
+ pVia->VQEnd = pVia->VQStart + VIA_VQ_SIZE - 1;
+ pVia->FBFreeEnd -= VIA_VQ_SIZE;
+ }
+ if (pVia->hwcursor) {
+ pVia->FBFreeEnd -= VIA_CURSOR_SIZE;
+ }
+
+ VIAInitialize2DEngine(pScrn);
+
+ if (pScrn->depth == 8) {
+ pVia->PlaneMask = 0xFF;
+ }
+ else if (pScrn->depth == 15) {
+ pVia->PlaneMask = 0x7FFF;
+ }
+ else if (pScrn->depth == 16) {
+ pVia->PlaneMask = 0xFFFF;
+ }
+ else if (pScrn->depth == 24) {
+ pVia->PlaneMask = 0xFFFFFF;
+ }
+
+ /* General acceleration flags */
+ if (!(xaaptr = pVia->AccelInfoRec = XAACreateInfoRec()))
+ return FALSE;
+
+ xaaptr->Flags = PIXMAP_CACHE |
+ OFFSCREEN_PIXMAPS |
+ LINEAR_FRAMEBUFFER |
+ MICROSOFT_ZERO_LINE_BIAS |
+ 0;
+
+ if (pScrn->bitsPerPixel == 8)
+ xaaptr->CachePixelGranularity = 128;
+
+ /* Clipping */
+ xaaptr->SetClippingRectangle = VIASetClippingRectangle;
+ xaaptr->DisableClipping = VIADisableClipping;
+ xaaptr->ClippingFlags = HARDWARE_CLIP_SOLID_FILL |
+ /*HARDWARE_CLIP_SOLID_LINE |*/
+ /*HARDWARE_CLIP_DASHED_LINE |*/
+ HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY |
+ HARDWARE_CLIP_MONO_8x8_FILL |
+ HARDWARE_CLIP_COLOR_8x8_FILL |
+ HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND |
+ 0;
+
+ xaaptr->Sync = VIAAccelSync;
+
+ /* ScreenToScreen copies */
+ xaaptr->SetupForScreenToScreenCopy = VIASetupForScreenToScreenCopy;
+ xaaptr->SubsequentScreenToScreenCopy = VIASubsequentScreenToScreenCopy;
+ xaaptr->ScreenToScreenCopyFlags = NO_PLANEMASK;
+
+ /* Solid filled rectangles */
+ xaaptr->SetupForSolidFill = VIASetupForSolidFill;
+ xaaptr->SubsequentSolidFillRect = VIASubsequentSolidFillRect;
+ xaaptr->SolidFillFlags = NO_PLANEMASK;
+
+ /* Mono 8x8 pattern fills */
+ xaaptr->SetupForMono8x8PatternFill = VIASetupForMono8x8PatternFill;
+ xaaptr->SubsequentMono8x8PatternFillRect =
+ VIASubsequentMono8x8PatternFillRect;
+ xaaptr->Mono8x8PatternFillFlags = NO_PLANEMASK |
+ HARDWARE_PATTERN_PROGRAMMED_BITS |
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
+ BIT_ORDER_IN_BYTE_MSBFIRST |
+ 0;
+
+ /* Color 8x8 pattern fills */
+ xaaptr->SetupForColor8x8PatternFill = VIASetupForColor8x8PatternFill;
+ xaaptr->SubsequentColor8x8PatternFillRect =
+ VIASubsequentColor8x8PatternFillRect;
+ xaaptr->Color8x8PatternFillFlags = NO_PLANEMASK |
+ NO_TRANSPARENCY |
+ HARDWARE_PATTERN_PROGRAMMED_BITS |
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
+ 0;
+
+ /*=* This function is only used in drawing check box when use RedHat 7.2
+ * Raleigh Theme. The behavior is a little strange, so we temporarily
+ * disable this function. *=*/
+ /* Screen to Screen color expansion. */
+ xaaptr->SetupForScreenToScreenColorExpandFill =
+ VIASetupForScreenToScreenColorExpand;
+ xaaptr->SubsequentScreenToScreenColorExpandFill =
+ VIASubsequentScreenToScreenColorExpand;
+ xaaptr->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK |
+ BIT_ORDER_IN_BYTE_MSBFIRST |
+ 0;
+
+ /* Solid lines */
+ xaaptr->SetupForSolidLine = VIASetupForSolidLine;
+ xaaptr->SubsequentSolidTwoPointLine = VIASubsequentSolidTwoPointLine;
+ xaaptr->SubsequentSolidHorVertLine = VIASubsequentSolidHorVertLine;
+ xaaptr->SolidBresenhamLineErrorTermBits = 14;
+ xaaptr->SolidLineFlags = NO_PLANEMASK;
+
+ /* dashed line */
+ xaaptr->SetupForDashedLine = VIASetupForDashedLine;
+ xaaptr->SubsequentDashedTwoPointLine = VIASubsequentDashedTwoPointLine;
+ xaaptr->DashPatternMaxLength = 8;
+ xaaptr->DashedLineFlags = NO_PLANEMASK |
+ LINE_PATTERN_POWER_OF_2_ONLY |
+ LINE_PATTERN_MSBFIRST_LSBJUSTIFIED |
+ 0;
+
+ /* CPU to Screen color expansion */
+ xaaptr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK |
+ CPU_TRANSFER_PAD_DWORD |
+ SCANLINE_PAD_DWORD |
+ BIT_ORDER_IN_BYTE_MSBFIRST |
+ LEFT_EDGE_CLIPPING |
+ 0;
+
+ xaaptr->SetupForScanlineCPUToScreenColorExpandFill =
+ VIASetupForCPUToScreenColorExpandFill;
+ xaaptr->SubsequentScanlineCPUToScreenColorExpandFill =
+ VIASubsequentScanlineCPUToScreenColorExpandFill;
+ xaaptr->ColorExpandBase = pVia->BltBase;
+ xaaptr->ColorExpandRange = VIA_MMIO_BLTSIZE;
+
+ /* ImageWrite */
+ xaaptr->ImageWriteFlags = NO_PLANEMASK |
+ CPU_TRANSFER_PAD_DWORD |
+ SCANLINE_PAD_DWORD |
+ BIT_ORDER_IN_BYTE_MSBFIRST |
+ LEFT_EDGE_CLIPPING |
+ /*NO_GXCOPY |*/
+ /*SYNC_AFTER_IMAGE_WRITE |*/
+ 0;
+
+ xaaptr->SetupForImageWrite = VIASetupForImageWrite;
+ xaaptr->SubsequentImageWriteRect = VIASubsequentImageWriteRect;
+ xaaptr->ImageWriteBase = pVia->BltBase;
+ xaaptr->ImageWriteRange = VIA_MMIO_BLTSIZE;
+
+ /* Set up screen parameters. */
+ pVia->Bpp = pScrn->bitsPerPixel >> 3;
+ pVia->Bpl = pScrn->displayWidth * pVia->Bpp;
+
+ /* We reserve space for pixel cache */
+ pVia->ScissB = (pVia->FBFreeStart + VIA_PIXMAP_CACHE_SIZE) / pVia->Bpl;
+ pVia->FBFreeStart += VIA_PIXMAP_CACHE_SIZE;
+
+ if (pVia->ScissB > 2047)
+ pVia->ScissB = 2047;
+
+ /*
+ * Finally, we set up the video memory space available to the pixmap
+ * cache. In this case, all memory from the end of the virtual screen
+ * to the end of the command overflow buffer can be used. If you haven't
+ * enabled the PIXMAP_CACHE flag, then these lines can be omitted.
+ */
+
+ AvailFBArea.x1 = 0;
+ AvailFBArea.y1 = 0;
+ AvailFBArea.x2 = pScrn->displayWidth;
+ if (pVia->V4LEnabled) {
+ AvailFBArea.y2 = pVia->ScissB;
+ }
+ else {
+ AvailFBArea.y2 = (pVia->FBFreeEnd) / pVia->Bpl;
+ }
+ xf86InitFBManager(pScreen, &AvailFBArea);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %d lines for offscreen memory.\n",
+ AvailFBArea.y2 - pScrn->virtualY ));
+
+ return XAAInit(pScreen, xaaptr);
+}
+
+
+/* The sync function for the GE */
+void VIAAccelSync(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ WaitIdle();
+}
+
+
+/* These are the ScreenToScreen bitblt functions. We support all ROPs, all
+ * directions.
+ *
+ */
+
+static void
+VIASetupForScreenToScreenCopy(
+ ScrnInfoPtr pScrn,
+ int xdir,
+ int ydir,
+ int rop,
+ unsigned planemask,
+ int trans_color)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int cmd;
+
+ cmd = VIA_GEC_BLT | (XAACopyROP[rop] << 24);
+
+ if (xdir < 0)
+ cmd |= VIA_GEC_DECX;
+
+ if (ydir < 0)
+ cmd |= VIA_GEC_DECY;
+
+ pVia->SavedCmd = cmd;
+
+ if (trans_color != -1) {
+ /* Transparent Bitblt */
+ VIASETREG(VIA_REG_SRCCOLORKEY, trans_color);
+ VIASETREG(VIA_REG_KEYCONTROL, 0x4000);
+ }
+ else {
+ /* Disable Transparent Bitblt */
+ VIASETREG(VIA_REG_KEYCONTROL, 0x0);
+ }
+}
+
+
+static void
+VIASubsequentScreenToScreenCopy(
+ ScrnInfoPtr pScrn,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ int w,
+ int h)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ if (!w || !h)
+ return;
+
+ if (pVia->SavedCmd & VIA_GEC_DECX) {
+ x1 += (w - 1);
+ x2 += (w - 1);
+ }
+
+ if (pVia->SavedCmd & VIA_GEC_DECY) {
+ y1 += (h - 1);
+ y2 += (h - 1);
+ }
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+
+ VIASETREG(VIA_REG_SRCPOS, ((y1 << 16) | x1));
+ VIASETREG(VIA_REG_DSTPOS, ((y2 << 16) | x2));
+ VIASETREG(VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)));
+ VIASETREG(VIA_REG_GECMD, pVia->SavedCmd);
+}
+
+
+/*
+ * SetupForSolidFill is also called to set up for lines.
+ */
+
+static void
+VIASetupForSolidFill(
+ ScrnInfoPtr pScrn,
+ int color,
+ int rop,
+ unsigned planemask)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int cmd;
+
+ cmd = VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT | (XAAPatternROP[rop] << 24);
+
+ pVia->SavedCmd = cmd;
+ pVia->SavedFgColor = color;
+}
+
+
+static void
+VIASubsequentSolidFillRect(
+ ScrnInfoPtr pScrn,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ if (!w || !h)
+ return;
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+
+ VIASETREG(VIA_REG_DSTPOS, ((y << 16) | x));
+ VIASETREG(VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)));
+ VIASETREG(VIA_REG_FGCOLOR, pVia->SavedFgColor);
+ VIASETREG(VIA_REG_GECMD, pVia->SavedCmd);
+}
+
+
+/*
+ * The meaning of the two pattern paremeters to Setup & Subsequent for
+ * Mono8x8Patterns varies depending on the flag bits. We specify
+ * HW_PROGRAMMED_BITS, which means our hardware can handle 8x8 patterns
+ * without caching in the frame buffer. Thus, Setup gets the pattern bits.
+ * There is no way with BCI to rotate an 8x8 pattern, so we do NOT specify
+ * HW_PROGRAMMED_ORIGIN. XAA wil rotate it for us and pass the rotated
+ * pattern to both Setup and Subsequent. If we DID specify PROGRAMMED_ORIGIN,
+ * then Setup would get the unrotated pattern, and Subsequent gets the
+ * origin values.
+ */
+
+static void
+VIASetupForMono8x8PatternFill(
+ ScrnInfoPtr pScrn,
+ int pattern0,
+ int pattern1,
+ int fg,
+ int bg,
+ int rop,
+ unsigned planemask)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int cmd;
+
+ cmd = VIA_GEC_BLT | VIA_GEC_PAT_REG | VIA_GEC_PAT_MONO |
+ (XAAPatternROP[rop] << 24);
+
+ if (bg == -1) {
+ /* transparent mono pattern */
+ cmd |= VIA_GEC_MPAT_TRANS;
+ }
+
+ pVia->SavedCmd = cmd;
+ pVia->SavedFgColor = fg;
+ pVia->SavedBgColor = bg;
+ pVia->SavedPattern0 = pattern0;
+ pVia->SavedPattern1 = pattern1;
+}
+
+
+static void
+VIASubsequentMono8x8PatternFillRect(
+ ScrnInfoPtr pScrn,
+ int patOffx,
+ int patOffy,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ CARD32 dwPatOffset;
+
+ if (!w || !h)
+ return;
+
+ dwPatOffset = ((patOffy & 0x7) << 29) | ((patOffx & 0x7) << 26);
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+
+ VIASETREG(VIA_REG_DSTPOS, ((y << 16) | x));
+ VIASETREG(VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)));
+ VIASETREG(VIA_REG_PATADDR, dwPatOffset);
+ VIASETREG(VIA_REG_FGCOLOR, pVia->SavedFgColor);
+ VIASETREG(VIA_REG_BGCOLOR, pVia->SavedBgColor);
+ VIASETREG(VIA_REG_MONOPAT0, pVia->SavedPattern0);
+ VIASETREG(VIA_REG_MONOPAT1, pVia->SavedPattern1);
+ VIASETREG(VIA_REG_GECMD, pVia->SavedCmd);
+}
+
+static void
+VIASetupForColor8x8PatternFill(
+ ScrnInfoPtr pScrn,
+ int patternx,
+ int patterny,
+ int rop,
+ unsigned planemask,
+ int trans_color)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int cmd;
+
+ cmd = VIA_GEC_BLT | (XAAPatternROP[rop] << 24);
+
+ pVia->SavedCmd = cmd;
+ pVia->SavedPatternAddr = (patternx * pVia->Bpp + patterny * pVia->Bpl);
+}
+
+
+static void
+VIASubsequentColor8x8PatternFillRect(
+ ScrnInfoPtr pScrn,
+ int patOffx,
+ int patOffy,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ CARD32 dwPatAddr;
+
+ if (!w || !h)
+ return;
+
+ dwPatAddr = (pVia->SavedPatternAddr >> 3) |
+ ((patOffy & 0x7) << 29) | ((patOffx & 0x7) << 26);
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+
+ VIASETREG(VIA_REG_DSTPOS, ((y << 16) | x));
+ VIASETREG(VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)));
+ VIASETREG(VIA_REG_PATADDR, dwPatAddr);
+ VIASETREG(VIA_REG_GECMD, pVia->SavedCmd);
+}
+
+static void
+VIASetupForCPUToScreenColorExpandFill(
+ ScrnInfoPtr pScrn,
+ int fg,
+ int bg,
+ int rop,
+ unsigned planemask)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int cmd;
+
+ cmd = VIA_GEC_BLT | VIA_GEC_SRC_SYS | VIA_GEC_SRC_MONO |
+ (XAACopyROP[rop] << 24);
+
+ if (bg == -1) {
+ cmd |= VIA_GEC_MSRC_TRANS;
+ }
+
+ pVia->SavedCmd = cmd;
+ pVia->SavedFgColor = fg;
+ pVia->SavedBgColor = bg;
+
+ /* Disable Transparent Bitblt */
+ VIASETREG(VIA_REG_KEYCONTROL, 0x0);
+}
+
+
+static void
+VIASubsequentScanlineCPUToScreenColorExpandFill(
+ ScrnInfoPtr pScrn,
+ int x,
+ int y,
+ int w,
+ int h,
+ int skipleft)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ /* XAA will be sending bitmap data next. */
+ /* We should probably wait for empty/idle here. */
+
+ if (skipleft) {
+ VIASetClippingRectangle(pScrn, (x + skipleft), y, (x + w - 1), (y + h -1));
+ }
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+
+ VIASETREG(VIA_REG_SRCPOS, 0);
+ VIASETREG(VIA_REG_DSTPOS, ((y << 16) | x));
+ VIASETREG(VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)));
+ VIASETREG(VIA_REG_FGCOLOR, pVia->SavedFgColor);
+ VIASETREG(VIA_REG_BGCOLOR, pVia->SavedBgColor);
+ VIASETREG(VIA_REG_GECMD, pVia->SavedCmd);
+}
+
+
+static void
+VIASetupForScreenToScreenColorExpand(
+ ScrnInfoPtr pScrn,
+ int fg,
+ int bg,
+ int rop,
+ unsigned int planemask)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int cmd;
+
+ cmd = VIA_GEC_BLT | VIA_GEC_SRC_MONO | (XAACopyROP[rop] << 24);
+
+ if (bg == -1) {
+ cmd |= VIA_GEC_MSRC_TRANS;
+ }
+
+ pVia->SavedCmd = cmd;
+ pVia->SavedFgColor = fg;
+ pVia->SavedBgColor = bg;
+
+ /* Disable Transparent Bitblt */
+ VIASETREG(VIA_REG_KEYCONTROL, 0x0);
+}
+
+
+static void
+VIASubsequentScreenToScreenColorExpand(
+ ScrnInfoPtr pScrn,
+ int x,
+ int y,
+ int w,
+ int h,
+ int srcx,
+ int srcy,
+ int offset)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+
+ VIASETREG(VIA_REG_SRCBASE, ((((srcy * pScrn->displayWidth) + srcx) *
+ (pScrn->bitsPerPixel >> 3)) >> 3));
+ srcy = 0;
+ srcx = 0;
+
+ VIASETREG(VIA_REG_SRCPOS, ((srcy << 16) |
+ (srcx * pScrn->bitsPerPixel + offset)));
+ VIASETREG(VIA_REG_DSTPOS, ((y << 16) | x));
+ VIASETREG(VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)));
+ VIASETREG(VIA_REG_FGCOLOR, pVia->SavedFgColor);
+ VIASETREG(VIA_REG_BGCOLOR, pVia->SavedBgColor);
+ VIASETREG(VIA_REG_GECMD, pVia->SavedCmd);
+
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+}
+
+static void
+VIASetupForImageWrite(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned planemask,
+ int trans_color,
+ int bpp,
+ int depth)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int cmd;
+
+ /* We don't record bpp and depth because we assume bpp is equal to
+ bpp of screen. Is this assume correct ? */
+
+ cmd = VIA_GEC_BLT | VIA_GEC_SRC_SYS | (XAACopyROP[rop] << 24);
+
+ pVia->SavedCmd = cmd;
+
+ if (trans_color != -1) {
+ /* Transparent Bitblt */
+ VIASETREG(VIA_REG_SRCCOLORKEY, trans_color);
+ VIASETREG(VIA_REG_KEYCONTROL, 0x4000);
+ }
+ else {
+ /* Disable Transparent Bitblt */
+ VIASETREG(VIA_REG_KEYCONTROL, 0x0);
+ }
+
+}
+
+
+static void
+VIASubsequentImageWriteRect(
+ ScrnInfoPtr pScrn,
+ int x,
+ int y,
+ int w,
+ int h,
+ int skipleft)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ if (skipleft) {
+ VIASetClippingRectangle(pScrn, (x + skipleft), y, (x + w - 1), (y + h -1));
+ }
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+
+ VIASETREG(VIA_REG_SRCPOS, 0);
+ VIASETREG(VIA_REG_DSTPOS, ((y << 16) | x));
+ VIASETREG(VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)));
+ VIASETREG(VIA_REG_GECMD, pVia->SavedCmd);
+}
+
+
+/* Setup for XAA solid lines. */
+static void
+VIASetupForSolidLine(
+ ScrnInfoPtr pScrn,
+ int color,
+ int rop,
+ unsigned int planemask)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int cmd;
+
+ /* we move VIA_GEC_LINE from here to the place firing command */
+ cmd = VIA_GEC_FIXCOLOR_PAT | (XAAPatternROP[rop] << 24);
+
+ pVia->SavedCmd = cmd;
+ pVia->SavedFgColor = color;
+
+ /* set solid line pattern */
+ VIASETREG(VIA_REG_MONOPAT0, 0xFF);
+ VIASETREG(VIA_REG_FGCOLOR, pVia->SavedFgColor);
+}
+
+
+static void
+VIASubsequentSolidTwoPointLine(
+ ScrnInfoPtr pScrn,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ int flags)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int dx, dy, cmd, tmp, error = 1;
+
+ cmd = pVia->SavedCmd | VIA_GEC_LINE;
+
+ dx = x2 - x1;
+ if (dx < 0) {
+ dx = -dx;
+ cmd |= VIA_GEC_DECX; /* line will be drawn from right */
+ error = 0;
+ }
+
+ dy = y2 - y1;
+ if (dy < 0) {
+ dy = -dy;
+ cmd |= VIA_GEC_DECY; /* line will be drawn from bottom */
+ }
+
+ if (dy > dx) {
+ tmp = dy;
+ dy = dx;
+ dx = tmp; /* Swap 'dx' and 'dy' */
+ cmd |= VIA_GEC_Y_MAJOR; /* Y major line */
+ }
+
+ if (flags & OMIT_LAST) {
+ cmd |= VIA_GEC_LASTPIXEL_OFF;
+ }
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+
+ /* major = 2*dmaj, minor = 2*dmin, err = -dmaj - ((bias >> octant) & 1) */
+ /* K1 = 2*dmin K2 = 2*(dmin - dmax) */
+ /* Error Term = (StartX<EndX) ? (2*dmin - dmax - 1) : (2*(dmin - dmax)) */
+ VIASETREG(VIA_REG_LINE_K1K2, ((((dy << 1) & 0x3fff) << 16)|
+ (((dy - dx) << 1) & 0x3fff)));
+ VIASETREG(VIA_REG_LINE_XY, ((y1 << 16) | x1));
+ VIASETREG(VIA_REG_DIMENSION, dx);
+ VIASETREG(VIA_REG_LINE_ERROR, (((dy << 1) - dx - error) & 0x3fff));
+ VIASETREG(VIA_REG_GECMD, cmd);
+
+}
+
+
+/* Subsequent XAA solid horizontal and vertical lines */
+static void
+VIASubsequentSolidHorVertLine(
+ ScrnInfoPtr pScrn,
+ int x,
+ int y,
+ int len,
+ int dir)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+
+ if (dir == DEGREES_0) {
+ VIASETREG(VIA_REG_DSTPOS, ((y << 16) | x));
+ VIASETREG(VIA_REG_DIMENSION, (len - 1));
+ VIASETREG(VIA_REG_GECMD, pVia->SavedCmd | VIA_GEC_BLT);
+ }
+ else {
+ VIASETREG(VIA_REG_DSTPOS, ((y << 16) | x));
+ VIASETREG(VIA_REG_DIMENSION, ((len - 1) << 16));
+ VIASETREG(VIA_REG_GECMD, pVia->SavedCmd | VIA_GEC_BLT);
+ }
+}
+
+static void
+VIASetupForDashedLine(
+ ScrnInfoPtr pScrn,
+ int fg,
+ int bg,
+ int rop,
+ unsigned int planemask,
+ int length,
+ unsigned char *pattern)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int cmd;
+ CARD32 pat = *(CARD32 *)pattern;
+
+ cmd = VIA_GEC_LINE | VIA_GEC_FIXCOLOR_PAT | (XAAPatternROP[rop] << 24);
+
+ if (bg == -1) {
+ /* transparent mono pattern */
+ cmd |= VIA_GEC_MPAT_TRANS;
+ }
+
+ pVia->SavedCmd = cmd;
+ pVia->SavedFgColor = fg;
+ pVia->SavedBgColor = bg;
+
+ switch (length) {
+ case 2: pat |= pat << 2; /* fall through */
+ case 4: pat |= pat << 4; /* fall through */
+ case 8: pat |= pat << 8; /* fall through */
+ case 16: pat |= pat << 16;
+ }
+
+ pVia->SavedPattern0 = pat;
+
+ VIASETREG(VIA_REG_FGCOLOR, pVia->SavedFgColor);
+ VIASETREG(VIA_REG_BGCOLOR, pVia->SavedBgColor);
+ VIASETREG(VIA_REG_MONOPAT0, pVia->SavedPattern0);
+}
+
+
+static void
+VIASubsequentDashedTwoPointLine(
+ ScrnInfoPtr pScrn,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ int flags,
+ int phase)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int dx, dy, cmd, tmp, error = 1;
+
+ cmd = pVia->SavedCmd;
+
+ dx = x2 - x1;
+ if (dx < 0) {
+ dx = -dx;
+ cmd |= VIA_GEC_DECX; /* line will be drawn from right */
+ error = 0;
+ }
+
+ dy = y2 - y1;
+ if (dy < 0) {
+ dy = -dy;
+ cmd |= VIA_GEC_DECY; /* line will be drawn from bottom */
+ }
+
+ if (dy > dx) {
+ tmp = dy;
+ dy = dx;
+ dx = tmp; /* Swap 'dx' and 'dy' */
+ cmd |= VIA_GEC_Y_MAJOR; /* Y major line */
+ }
+
+ if (flags & OMIT_LAST) {
+ cmd |= VIA_GEC_LASTPIXEL_OFF;
+ }
+
+ /* Set Src and Dst base address and pitch, pitch is qword */
+ VIASETREG(VIA_REG_SRCBASE, 0x0);
+ VIASETREG(VIA_REG_DSTBASE, 0x0);
+ VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) |
+ (((pScrn->displayWidth * pScrn->bitsPerPixel >> 3) >> 3) << 16));
+
+ /* major = 2*dmaj, minor = 2*dmin, err = -dmaj - ((bias >> octant) & 1) */
+ /* K1 = 2*dmin K2 = 2*(dmin - dmax) */
+ /* Error Term = (StartX<EndX) ? (2*dmin - dmax - 1) : (2*(dmin - dmax)) */
+ VIASETREG(VIA_REG_LINE_K1K2, ((((dy << 1) & 0x3fff) << 16)|
+ (((dy - dx) << 1) & 0x3fff)));
+ VIASETREG(VIA_REG_LINE_XY, ((y1 << 16) | x1));
+ VIASETREG(VIA_REG_DIMENSION, dx);
+ VIASETREG(VIA_REG_LINE_ERROR, (((dy << 1) - dx - error) & 0x3fff) | 0xFF0000);
+ VIASETREG(VIA_REG_GECMD, cmd);
+}
+
+
+static void
+VIASetClippingRectangle(
+ ScrnInfoPtr pScrn,
+ int x1,
+ int y1,
+ int x2,
+ int y2)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+#ifdef DEBUG_EXTRA
+ ErrorF("ClipRect, (%4d,%4d)-(%4d,%4d) \n", x1, y1, x2, y2 );
+#endif
+
+ VIASETREG(VIA_REG_CLIPTL, ((y1 << 16) | x1));
+ VIASETREG(VIA_REG_CLIPBR, ((y2 << 16) | x2));
+ pVia->SavedCmd |= VIA_GEC_CLIP_ENABLE;
+}
+
+
+static void VIADisableClipping(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+#ifdef DEBUG_EXTRA
+ ErrorF("Kill ClipRect\n");
+#endif
+
+ pVia->SavedCmd &= ~VIA_GEC_CLIP_ENABLE;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_bios.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_bios.c index 69c6af988..3822b7db4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/via/via_bios.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_bios.c @@ -1,12466 +1,11938 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_bios.c,v 1.4 2003/09/08 14:25:29 eich Exp $ */ -/* - * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. - * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sub license, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/************************************************************************* - * - * File: via_bios.c - * Content: Get the mode table from VGA BIOS and set mode by this table - * - ************************************************************************/ - -/* -#define CREATE_MODETABLE_HEADERFILE -#define CREATE_TV2_HEADERFILE -#define CREATE_TV3_HEADERFILE -#define CREATE_SAA7108_HEADERFILE -#define CREATE_CH7019_HEADERFILE -#define CREATE_FS454_HEADERFILE -*/ - -#include "via_driver.h" -#ifndef CREATE_MODETABLE_HEADERFILE -#include "via_mode.h" -#endif -#ifndef CREATE_TV2_HEADERFILE -#include "via_tv2.h" -#endif -#ifndef CREATE_TV3_HEADERFILE -#include "via_tv3.h" -#endif -#ifndef CREATE_VT1622A_HEADERFILE -#include "via_vt1622a.h" -#endif -#ifndef CREATE_SAA7108_HEADERFILE -#include "via_saa7108.h" -#endif -#ifndef CREATE_CH7019_HEADERFILE -#include "via_ch7019.h" -#endif -#ifndef CREATE_FS454_HEADERFILE -#include "via_fs454.h" -#endif -#include "via_refresh.h" - - -/*=* - * - * int VIACheckTVExist(VIABIOSInfoPtr) - Check TV Endcoder - * - * Return Type: int - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * 0 - None - * 1 - VIA VT1621 - * 2 - VIA VT1622 - * 3 - Chrontel 7009 - * 4 - Chrontel 7019 - * 5 - Philips SAA7108 - *=*/ - -int VIACheckTVExist(VIABIOSInfoPtr pBIOSInfo) -{ - I2CDevPtr dev; - unsigned char W_Buffer[1]; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIACheckTVExist\n")); - /* Check For TV2/TV3 */ - if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0x40)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "TV"; - dev->SlaveAddr = 0x40; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x1B; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - xf86DestroyI2CDevRec(dev,TRUE); - switch (R_Buffer[0]) { - case 2: - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found TVEncoder VT1621!\n")); - pBIOSInfo->TVEncoder = VIA_TV2PLUS; - pBIOSInfo->TVI2CAdd = 0x40; - break; - case 3: - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found TVEncoder VT1622!\n")); - pBIOSInfo->TVEncoder = VIA_TV3; - pBIOSInfo->TVI2CAdd = 0x40; - break; - case 16: - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found TVEncoder VT1622A!\n")); - pBIOSInfo->TVEncoder = VIA_VT1622A; - pBIOSInfo->TVI2CAdd = 0x40; - break; - default: - pBIOSInfo->TVEncoder = VIA_NONETV; - break; - } - } - else - xf86DestroyI2CDevRec(dev,TRUE); - } - else - pBIOSInfo->TVEncoder = VIA_NONETV; - - /* Check For SAA7108 */ - if (!pBIOSInfo->TVEncoder) { - if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0x88)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "SAA7108"; - dev->SlaveAddr = 0x88; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x1C; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - xf86DestroyI2CDevRec(dev,TRUE); - if (R_Buffer[0] == 0x04) { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found TVEncoder Philips SAA7108!\n")); - pBIOSInfo->TVEncoder = VIA_SAA7108; - pBIOSInfo->TVI2CAdd = 0x88; - } - else - pBIOSInfo->TVEncoder = VIA_NONETV; - } - else - xf86DestroyI2CDevRec(dev,TRUE); - } - else - pBIOSInfo->TVEncoder = VIA_NONETV; - } - - /* Check For FS454 */ - if (!pBIOSInfo->TVEncoder) { - if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0xD4)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "FS454"; - dev->SlaveAddr = 0xD4; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x7F; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - xf86DestroyI2CDevRec(dev,TRUE); - if (R_Buffer[0] == 0x20) { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found TVEncoder FOCUS 453/454!\n")); - pBIOSInfo->TVEncoder = VIA_FS454; - pBIOSInfo->TVI2CAdd = 0xD4; - } - else - pBIOSInfo->TVEncoder = VIA_NONETV; - } - else - xf86DestroyI2CDevRec(dev,TRUE); - } - else - pBIOSInfo->TVEncoder = VIA_NONETV; - } - - /* Check For CH7019 */ - if (!pBIOSInfo->TVEncoder) { - if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0xEA)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "CH7019"; - dev->SlaveAddr = 0xEA; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x4B; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - xf86DestroyI2CDevRec(dev,TRUE); - if (R_Buffer[0] == 0x19) { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found TVEncoder Chrontel 7019!\n")); - pBIOSInfo->TVEncoder = VIA_CH7019; - pBIOSInfo->TVI2CAdd = 0xEA; - } - else - pBIOSInfo->TVEncoder = VIA_NONETV; - } - else - xf86DestroyI2CDevRec(dev,TRUE); - } - else - pBIOSInfo->TVEncoder = VIA_NONETV; - } - - if (pBIOSInfo->TVEncoder == VIA_NONETV) { - if (VIAGPIOI2C_Initial(pBIOSInfo, 0x40)) { - VIAGPIOI2C_Read(pBIOSInfo, 0x1B, R_Buffer, 1); - switch (R_Buffer[0]) { - case 16: - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found TVEncoder VT1623!\n")); - pBIOSInfo->TVEncoder = VIA_VT1623; - break; - default: - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Unknow TVEncoder Type:%d!\n", R_Buffer[0])); - break; - } - } - } - return pBIOSInfo->TVEncoder; -} - - -/*=* - * - * log VIAQueryChipInfo(VIABIOSInfoPtr) - Query Chip Infomation - * - * Return Type: log - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * [31:24] Major BIOS Version Number - * [31:24] Minor BIOS Version Number - * [15:8] Type of External TV Encoder - * 0 - None - * 1 - VIA VT1621 - * 2 - VIA VT1622 - * 3 - Chrontel 7009 - * 4 - Chrontel 7019 - * 5 - Philips SAA7108 - * [7:6] Reserved - * [5] DVI Display Supported - * [4] Reserved - * [3] PAL TV Display Supported - * [2] NTSC TV Display Supported - * [1] LCD Display Supported - * [0] CRT Display Supported - *=*/ - -long VIAQueryChipInfo(VIABIOSInfoPtr pBIOSInfo) -{ - VIAModeTablePtr pViaModeTable; - long tmp; - unsigned char support = 0; - - pViaModeTable = pBIOSInfo->pModeTable; - - tmp = ((long)(pViaModeTable->BIOSVer)) << 16; - tmp |= ((long)(VIACheckTVExist(pBIOSInfo))) << 8; - - if (VIA_CRT_SUPPORT) - support |= VIA_CRT_SUPPORT_BIT; - if (VIA_LCD_SUPPORT) - support |= VIA_LCD_SUPPORT_BIT; - if (VIA_NTSC_SUPPORT) - support |= VIA_NTSC_SUPPORT_BIT; - if (VIA_PAL_SUPPORT) - support |= VIA_PAL_SUPPORT_BIT; - if (VIA_DVI_SUPPORT) - support |= VIA_DVI_SUPPORT_BIT; - - tmp |= (long)(support); - - return tmp; -} - - -/*=* - * - * char* VIAGetBIOSInfo(VIABIOSInfoPtr) - Get BIOS Release Date - * - * Return Type: string pointer - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * BIOS release date string pointer - *=*/ - -char* VIAGetBIOSInfo(VIABIOSInfoPtr pBIOSInfo) -{ - return pBIOSInfo->pModeTable->BIOSDate; -} - - -/*=* - * - * Bool VIASetActiveDisplay(VIABIOSInfoPtr, unsigned char) - * - * - Set Active Display Device - * - * Return Type: Bool - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * Bit[7] 2nd Path - * Bit[6] 1/0 MHS Enable/Disable - * Bit[5] 0 = Bypass Callback, 1 = Enable Callback - * Bit[4] 0 = Hot-Key Sequence Control (OEM Specific) - * Bit[3] LCD - * Bit[2] TV - * Bit[1] CRT - * Bit[0] DVI - * - * The Definition of Return Value: - * - * Success - TRUE - * Not Success - FALSE - *=*/ - -Bool VIASetActiveDisplay(VIABIOSInfoPtr pBIOSInfo, unsigned char display) -{ - VIABIOSInfoPtr pVia; - unsigned char tmp; - - pVia = pBIOSInfo; - - switch (display & 0x0F) { - case 0x07: /* WCRTON + WTVON + WDVION */ - case 0x0E: /* WCRTON + WTVON + WLCDON */ - return FALSE; - default: - break; - } - - VGAOUT8(0x3D4, 0x3E); - tmp = VGAIN8(0x3D5) & 0xF0; - tmp |= (display & 0x0F); - VGAOUT8(0x3D5, tmp); - - if ((display & 0xC0) == 0x80) - return FALSE; - - VGAOUT8(0x3D4, 0x3B); - tmp = VGAIN8(0x3D5) & 0xE7; - tmp |= ((display & 0xC0) >> 3); - VGAOUT8(0x3D5, tmp); - - return TRUE; -} - - -/*=* - * - * unsigned char VIAGetActiveDisplay(VIABIOSInfoPtr, unsigned char) - * - * - Get Active Display Device - * - * Return Type: unsigned char - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * Bit[7] 2nd Path - * Bit[6] 1/0 MHS Enable/Disable - * Bit[5] 0 = Bypass Callback, 1 = Enable Callback - * Bit[4] 0 = Hot-Key Sequence Control (OEM Specific) - * Bit[3] LCD - * Bit[2] TV - * Bit[1] CRT - * Bit[0] DVI - *=*/ - -unsigned char VIAGetActiveDisplay(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - unsigned char tmp; - - pVia = pBIOSInfo; - - VGAOUT8(0x3D4, 0x3E); - tmp = (VGAIN8(0x3D5) & 0xF0) >> 4; - - VGAOUT8(0x3D4, 0x3B); - tmp |= ((VGAIN8(0x3D5) & 0x18) << 3); - - return tmp; -} - -/*=* - * - * unsigned char VIASensorCH7019(VIABIOSInfoPtr pBIOSInfo) - * - * - Sense Chrontel 7019 Encoder - * - * Return Type: unsigned char - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * 00h No Connected - * 02h Composite - * 04h S_VIDEO - * 06h Composite + S_VIDEO - * FFh Undefine - *=*/ - -unsigned char VIASensorCH7019(VIABIOSInfoPtr pBIOSInfo) -{ - unsigned char tv20, tmp = 0, ret = 0x06; - I2CDevPtr dev; - unsigned char W_Buffer[2]; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASensorCH7019\n")); - dev = xf86CreateI2CDevRec(); - dev->DevName = "CH7019"; - dev->SlaveAddr = 0xEA; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - /* turn all DACPD on */ - W_Buffer[0] = 0x49; - W_Buffer[1] = 0X40; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - /* set connection detect rgister (0x20) SENSE bit (BIT0) to 1 */ - W_Buffer[0] = 0x20; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - tv20 = R_Buffer[0]; - W_Buffer[1] = (tv20 | 0x01); - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - usleep(1); - /* reset the SENSE bit to 0 */ - W_Buffer[1] = (tv20 & (~0x01)); - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - /* read the status bits */ - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - tmp = R_Buffer[0]; - xf86DestroyI2CDevRec(dev,TRUE); - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - /* Always return 0x06 */ - return ret; -} - -/*=* - * - * unsigned char VIASensorSAA7108(VIABIOSInfoPtr pBIOSInfo) - * - * - Sense Philips SAA7108 Encoder - * - * Return Type: unsigned char - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * 0 No Connected - * BIT0=1 Composite - * BIT1=1 S_VIDEO - * BIT2=1 RGB - * BIT3=1 YCbCr - * FF Undefine - *=*/ - -unsigned char VIASensorSAA7108(VIABIOSInfoPtr pBIOSInfo) -{ - unsigned char tv2d, tv61, tmp = 0, ret = 0; - I2CDevPtr dev; - unsigned char W_Buffer[2]; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASensorSAA7108\n")); - dev = xf86CreateI2CDevRec(); - dev->DevName = "SAA7108"; - dev->SlaveAddr = 0x88; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - - /* Encoder On */ - W_Buffer[0] = 0x2D; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - tv2d = R_Buffer[0]; - W_Buffer[1] = 0XB4; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - - /* Power Control */ - W_Buffer[0] = 0x61; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - tv61 = R_Buffer[0]; - W_Buffer[1] = (tv61 & (~0x60)); - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - - /* Monitor Sense Mode Threshold */ - W_Buffer[0] = 0x1A; - W_Buffer[1] = 0X46; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - - /* Monitor Sense On */ - W_Buffer[0] = 0x1B; - W_Buffer[1] = 0X80; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - usleep(1); - - /* Monitor Sense Off */ - W_Buffer[1] = 0; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - - /* Monitor Sense Result */ - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - tmp = R_Buffer[0] & 0x07; - - /* Restore Power Control & Encoder On/Off Status */ - W_Buffer[0] = 0x61; - W_Buffer[1] = tv61; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x2D; - W_Buffer[1] = tv2d; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - xf86DestroyI2CDevRec(dev,TRUE); - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - - switch (tmp) { - case 0: /* YCbCr */ - ret = 0x08; - break; - case 1: /* S_VIDEO */ - ret = 0x02; - break; - case 6: /* Composite */ - ret = 0x01; - break; - case 7: /* No Connected */ - ret = 0; - break; - default: /* Undefine */ - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "Sense Result :%d\n", tmp)); - ret = 0xFF; - break; - } - return ret; -} - -/*=* - * - * unsigned char VIASensorTV2(VIABIOSInfoPtr pBIOSInfo) - * - * - Sense TV2+ Encoder - * - * Return Type: unsigned char - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * Bit[2] Bit[0] - * 0 0 - Composite + S-Video - * 0 1 - S-Video - * 1 0 - Composite - * 1 1 - None - *=*/ - -unsigned char VIASensorTV2(VIABIOSInfoPtr pBIOSInfo) -{ - I2CDevPtr dev; - unsigned char save, tmp = 0x05; - unsigned char W_Buffer[2]; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASensorTV2\n")); - dev = xf86CreateI2CDevRec(); - dev->DevName = "VT1621"; - dev->SlaveAddr = 0x40; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x0E; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - save = R_Buffer[0]; - W_Buffer[1] = 0x08; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[1] = 0; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x0F; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - tmp = R_Buffer[0] & 0x0F; - W_Buffer[0] = 0x0E; - W_Buffer[1] = save; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - xf86DestroyI2CDevRec(dev,TRUE); - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - - return tmp; -} - - -/*=* - * - * unsigned char VIASensorTV3(VIABIOSInfoPtr pBIOSInfo) - * - * - Sense TV3 Encoder - * - * Return Type: unsigned char - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * Bit[3] Bit[2] Bit[1] Bit[0] - * 1 1 1 1 - None - * 0 1 1 1 - Composite - * 1 1 1 0 - Composite - * - Others: S-Video - *=*/ - -unsigned char VIASensorTV3(VIABIOSInfoPtr pBIOSInfo) -{ - I2CDevPtr dev; - unsigned char save, tmp = 0; - unsigned char W_Buffer[2]; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASensorTV3\n")); - if (pBIOSInfo->TVEncoder == VIA_VT1623) { - VIAGPIOI2C_Initial(pBIOSInfo, 0x40); - VIAGPIOI2C_Read(pBIOSInfo, 0x0E, R_Buffer, 1); - save = R_Buffer[0]; - W_Buffer[0] = 0; - VIAGPIOI2C_Write(pBIOSInfo, 0x0E, W_Buffer[0]); - W_Buffer[0] = 0x80; - VIAGPIOI2C_Write(pBIOSInfo, 0x0E, W_Buffer[0]); - W_Buffer[0] = 0; - VIAGPIOI2C_Write(pBIOSInfo, 0x0E, W_Buffer[0]); - VIAGPIOI2C_Read(pBIOSInfo, 0x0F, R_Buffer, 1); - tmp = R_Buffer[0] & 0x0F; - W_Buffer[0] = save; - VIAGPIOI2C_Write(pBIOSInfo, 0x0E, W_Buffer[0]); - } - else { - dev = xf86CreateI2CDevRec(); - dev->DevName = "VT1622"; - dev->SlaveAddr = 0x40; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x0E; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - save = R_Buffer[0]; - W_Buffer[1] = 0; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[1] = 0x80; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[1] = 0; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x0F; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - tmp = R_Buffer[0] & 0x0F; - W_Buffer[0] = 0x0E; - W_Buffer[1] = save; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - xf86DestroyI2CDevRec(dev,TRUE); - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - return tmp; -} - - -/*=* - * - * Bool VIASensorDVI(pBIOSInfo) - * - * - Sense DVI Connector - * - * Return Type: Bool - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * DVI Attached - TRUE - * DVI Not Attached - FALSE - *=*/ - -Bool VIASensorDVI(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia = pBIOSInfo; - unsigned char SlaveAddr, cr6c, cr93; - Bool ret = FALSE; - I2CDevPtr dev; - unsigned char W_Buffer[1]; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASensorDVI\n")); - - /* Enable DI0, DI1 */ - VGAOUT8(0x3d4, 0x6C); - cr6c = VGAIN8(0x3d5); - VGAOUT8(0x3d5, cr6c | 0x21); - VGAOUT8(0x3d4, 0x93); - cr93 = VGAIN8(0x3d5); - if (pBIOSInfo->ChipRev > 15) { - VGAOUT8(0x3d5, 0xA3); - } - else { - VGAOUT8(0x3d5, 0xBF); - } - - /* Enable LCD */ - VIAEnableLCD(pBIOSInfo); - - switch (pBIOSInfo->TMDS) { - case VIA_SIL164: - SlaveAddr = 0x70; - break; - case VIA_VT3192: - SlaveAddr = 0x10; - break; - default: - return ret; - break; - } - - if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, SlaveAddr)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "TMDS"; - dev->SlaveAddr = SlaveAddr; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x09; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - xf86DestroyI2CDevRec(dev,TRUE); - if (R_Buffer[0] & 0x04) - ret = TRUE; - } - else - xf86DestroyI2CDevRec(dev,TRUE); - } - - if (pBIOSInfo->Chipset != VIA_CLE266) { - VIAGPIOI2C_Initial(pBIOSInfo, SlaveAddr); - VIAGPIOI2C_Read(pBIOSInfo, 0x09, R_Buffer, 1); - if (R_Buffer[0] & 0x04) - ret = TRUE; - } - - /* Disable LCD */ - VIADisableLCD(pBIOSInfo); - - /* Restore DI0, DI1 status */ - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, cr6c); - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, cr93); - - return ret; -} - -Bool VIAPostDVI(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia = pBIOSInfo; - unsigned char cr6c, cr93; - Bool ret = FALSE; - I2CDevPtr dev; - unsigned char W_Buffer[2]; - unsigned char R_Buffer[4]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostDVI\n")); - - /* Enable DI0, DI1 */ - VGAOUT8(0x3d4, 0x6C); - cr6c = VGAIN8(0x3d5); - VGAOUT8(0x3d5, cr6c | 0x21); - VGAOUT8(0x3d4, 0x93); - cr93 = VGAIN8(0x3d5); - if (pBIOSInfo->ChipRev > 15) { - VGAOUT8(0x3d5, 0xA3); - } - else { - VGAOUT8(0x3d5, 0xBF); - } - - /* Enable LCD */ - VIAEnableLCD(pBIOSInfo); - - if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0x70)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "TMDS"; - dev->SlaveAddr = 0x70; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x00; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,4); - if (R_Buffer[0] == 0x06 && R_Buffer[1] == 0x11) { /* This is VT3191 */ - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found VIA LVDS Transmiter!\n")); - if (R_Buffer[2] == 0x91 && R_Buffer[3] == 0x31) { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "VIA: VT1631!\n")); - pBIOSInfo->LVDS = VIA_VT3191; - W_Buffer[0] = 0x08; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT && pBIOSInfo->LCDDualEdge) - W_Buffer[1] = 0x0D; - else - W_Buffer[1] = 0x09; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - xf86DestroyI2CDevRec(dev,TRUE); - ret = TRUE; - } - else { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "VIA: Unknow Chip!!\n")); - xf86DestroyI2CDevRec(dev,TRUE); - } - } - else if (R_Buffer[0] == 0x01 && R_Buffer[1] == 0x00) { /* This is Sil164 */ - W_Buffer[0] = 0x02; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,2); - if (R_Buffer[0] && R_Buffer[1]) { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found TMDS Transmiter Silicon164.\n")); - pBIOSInfo->TMDS = VIA_SIL164; - W_Buffer[0] = 0x08; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT) { - if (pBIOSInfo->LCDDualEdge) - W_Buffer[1] = 0x3F; - else - W_Buffer[1] = 0x37; - } - else /* 12Bit Only has Single Mode */ - W_Buffer[1] = 0x3B; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x0C; - W_Buffer[1] = 0x09; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - xf86DestroyI2CDevRec(dev,TRUE); - ret = TRUE; - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - - /* Check VT3192 TMDS Exist or not?*/ - if (!pBIOSInfo->TMDS) { - if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0x10)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "TMDS"; - dev->SlaveAddr = 0x10; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x00; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,4); - - if (R_Buffer[0] == 0x06 && R_Buffer[1] == 0x11) { /* This is VT3192 */ - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found VIA TMDS Transmiter!\n")); - pBIOSInfo->TMDS = VIA_VT3192; - if (R_Buffer[2] == 0x92 && R_Buffer[3] == 0x31) { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "VIA: VT1632!\n")); - pBIOSInfo->TMDS = VIA_VT3192; - W_Buffer[0] = 0x08; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT) { - if (pBIOSInfo->LCDDualEdge) - W_Buffer[1] = 0x3F; - else - W_Buffer[1] = 0x37; - } - else - W_Buffer[1] = 0x3B; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - xf86DestroyI2CDevRec(dev,TRUE); - ret = TRUE; - } - else { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "VIA: Unknow Chip!!\n")); - xf86DestroyI2CDevRec(dev,TRUE); - } - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - } - - /* Check CH7019 LVDS Exist or not?*/ - if (!pBIOSInfo->LVDS) { - if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0xEA)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "LVDS"; - dev->SlaveAddr = 0xEA; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x4B; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - /* Load CH7019 LVDS init table */ - if (pBIOSInfo->LCDDualEdge || R_Buffer[0] == 0x3B) { /* DUAL_INIT Table */ - W_Buffer[0] = 0x64; - W_Buffer[1] = 0x14; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x71; - W_Buffer[1] = 0xE3; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x73; - W_Buffer[1] = 0xDB; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x74; - W_Buffer[1] = 0xF6; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x76; - W_Buffer[1] = 0xAF; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - } - else if (R_Buffer[0] == 0x19 || R_Buffer[0] == 0x1B || - R_Buffer[0] == 0x3A){ /* SINGLE_INIT Table */ - W_Buffer[0] = 0x64; - W_Buffer[1] = 0x04; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x71; - W_Buffer[1] = 0xAD; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x73; - W_Buffer[1] = 0xC8; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x74; - W_Buffer[1] = 0xF3; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x76; - W_Buffer[1] = 0xAD; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - } - /* COMMON_INIT Table */ - W_Buffer[0] = 0x63; - W_Buffer[1] = 0x4B; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x1C; - W_Buffer[1] = 0x40; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x6F; - W_Buffer[1] = 0x00; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x21; - W_Buffer[1] = 0x84; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x70; - W_Buffer[1] = 0xC0; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x72; - W_Buffer[1] = 0xAD; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x78; - W_Buffer[1] = 0x20; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x15; - W_Buffer[1] = 0x00; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - /* 2.set panel power sequence timing */ - W_Buffer[0] = 0x67; - W_Buffer[1] = 0x01; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x68; - W_Buffer[1] = 0x6E; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x69; - W_Buffer[1] = 0x01; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x6A; - W_Buffer[1] = 0x01; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x6B; - W_Buffer[1] = 0x09; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x66; - W_Buffer[1] = 0x20; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - - /* CH7017 support 24Bit panel */ - if (R_Buffer[0] == 0x1B || pBIOSInfo->BusWidth == VIA_DI_24BIT) { - /* Set LVDS output 24 bits mode*/ - W_Buffer[0] = 0x64; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - W_Buffer[1] = R_Buffer[0] | 0x20; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - } -#if 0 - for (i = 0; i < 10; i++) { - W_Buffer[0] = 0x63; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - W_Buffer[1] = (R_Buffer[0] | 0x40); - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - usleep(1); - W_Buffer[1] &= ~0x40; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - - usleep(100); - W_Buffer[0] = 0x66; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - if (((R_Buffer[0] & 0x44) == 0x44) || (i >= 9)) { /* PLL lock OK, Turn on VDD */ - if (i >= 9) { - usleep(500); - } - W_Buffer[1] = R_Buffer[0] | 0x01; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "CH7019 PLL lock ok!\n")); - break; - } - } -#endif - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "Found Chrontel LVDS Transmiter!\n")); - pBIOSInfo->LVDS = VIA_CH7019LVDS; - /*pBIOSInfo->BusWidth = VIA_DI_12BIT;*/ - ret = TRUE; - - xf86DestroyI2CDevRec(dev,TRUE); - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - } - - /* GPIO Sense */ - if (pBIOSInfo->Chipset != VIA_CLE266) { - VIAGPIOI2C_Initial(pBIOSInfo, 0x70); - VIAGPIOI2C_Read(pBIOSInfo, 0, R_Buffer, 2); - if (R_Buffer[0] == 0x06 && R_Buffer[1] == 0x11) { /* VIA LVDS */ - VIAGPIOI2C_Read(pBIOSInfo, 2, R_Buffer, 2); - if (R_Buffer[0] == 0x91 && R_Buffer[1] == 0x31) { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found LVDS Transmiter VT1631.\n")); - pBIOSInfo->LVDS = VIA_VT3191; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT && pBIOSInfo->LCDDualEdge) - VIAGPIOI2C_Write(pBIOSInfo, 0x08, 0x0D); - else - VIAGPIOI2C_Write(pBIOSInfo, 0x08, 0x09); - ret = TRUE; - } - } - else if (R_Buffer[0] == 0x01 && R_Buffer[1] == 0x0) {/* Silicon TMDS */ - VIAGPIOI2C_Read(pBIOSInfo, 2, R_Buffer, 2); - if (R_Buffer[0] && R_Buffer[1]) { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found TMDS Transmiter Silicon164.\n")); - pBIOSInfo->TMDS = VIA_SIL164; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT) { - if (pBIOSInfo->LCDDualEdge) - VIAGPIOI2C_Write(pBIOSInfo, 0x08, 0x3F); - else - VIAGPIOI2C_Write(pBIOSInfo, 0x08, 0x37); - } - else { - VIAGPIOI2C_Write(pBIOSInfo, 0x08, 0x3B); - } - VIAGPIOI2C_Write(pBIOSInfo, 0x0C, 0x09); - ret = TRUE; - } - } - - VIAGPIOI2C_Initial(pBIOSInfo, 0x10); - VIAGPIOI2C_Read(pBIOSInfo, 0, R_Buffer, 2); - if (R_Buffer[0] == 0x06 && R_Buffer[1] == 0x11) { /* VIA TMDS */ - VIAGPIOI2C_Read(pBIOSInfo, 2, R_Buffer, 2); - if (R_Buffer[0] == 0x92 && R_Buffer[1] == 0x31) { - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, - "Found TMDS Transmiter VT1632.\n")); - pBIOSInfo->TMDS = VIA_VT3192; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT) { - if (pBIOSInfo->LCDDualEdge) - VIAGPIOI2C_Write(pBIOSInfo, 0x08, 0x3F); - else - VIAGPIOI2C_Write(pBIOSInfo, 0x08, 0x37); - } - else { - VIAGPIOI2C_Write(pBIOSInfo, 0x08, 0x3B); - } - ret = TRUE; - } - } - } - /* Disable LCD */ - VIADisableLCD(pBIOSInfo); - - /* Restore DI0, DI1 status */ - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, cr6c); - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, cr93); - - if (pBIOSInfo->LVDS && pBIOSInfo->PanelSize == VIA_PANEL_INVALID) { - VGAOUT8(0x3d4, 0x3F); - pBIOSInfo->PanelSize = (int)(VGAIN8(0x3d5) >> 4); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, - "Get PanelID From Scratch Pad is %d\n", pBIOSInfo->PanelSize)); - } - - return ret; -} - -/*=* - * - * unsigned char VIAGetDeviceDetect(VIABIOSInfoPtr) - * - * - Get Display Device Attched - * - * Return Type: unsigned char - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * Bit[7] Reserved ------------ 2nd TV Connector - * Bit[6] Reserved ------------ 1st TV Connector - * Bit[5] Reserved - * Bit[4] CRT2 - * Bit[3] DFP - * Bit[2] TV - * Bit[1] LCD - * Bit[0] CRT - *=*/ - -unsigned char VIAGetDeviceDetect(VIABIOSInfoPtr pBIOSInfo) -{ - unsigned char tmp, sense; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetDeviceDetect\n")); - - tmp = VIA_DEVICE_CRT1; /* Default assume color CRT attached */ -/* - if (VIA_LCD_SUPPORT) { - if (VIA_UNCOVERD_LCD_PANEL) - tmp |= 0x08; - } -*/ - if (pBIOSInfo->LVDS) { - pBIOSInfo->LCDAttach = TRUE; - tmp |= VIA_DEVICE_LCD; - } - - switch (pBIOSInfo->TVEncoder) { - case VIA_NONETV: - pBIOSInfo->TVAttach = FALSE; - break; - case VIA_TV2PLUS: - sense = VIASensorTV2(pBIOSInfo); - if (sense == 0x05) { - pBIOSInfo->TVAttach = FALSE; /* No TV Output Attached */ - } - else { - tmp |= VIA_DEVICE_TV; - pBIOSInfo->TVAttach = TRUE; - if (!pBIOSInfo->TVOutput) { - if (sense == 0) { - /*tmp |= 0xC0; Connect S_Video + Composite */ - pBIOSInfo->TVOutput = TVOUTPUT_SC; - } - if (sense == 0x01) { - /*tmp |= 0x80; Connect S_Video */ - pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO; - } - else { - /*tmp |= 0x40; Connect Composite */ - pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE; - } - } - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "TV2 sense = %d ,TVOutput = %d\n", sense, pBIOSInfo->TVOutput)); - } - break; - case VIA_TV3: - case VIA_VT1622A: - case VIA_VT1623: - sense = VIASensorTV3(pBIOSInfo); - if (sense == 0x0F) { - pBIOSInfo->TVAttach = FALSE; /* No TV Output Attached */ - } - else { - tmp |= VIA_DEVICE_TV; - pBIOSInfo->TVAttach = TRUE; - if (!pBIOSInfo->TVOutput) { - if (sense == 0x07 || sense == 0x0E) { - /*tmp |= 0x40; Connect Composite */ - pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE; - } - else { - /*tmp |= 0x80; Connect S_Video */ - pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO; - } - } - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "TV3 sense = %d ,TVOutput = %d\n", sense, pBIOSInfo->TVOutput)); - } - break; - case VIA_CH7009: - case VIA_CH7019: - sense = VIASensorCH7019(pBIOSInfo); - if (!sense) { - pBIOSInfo->TVAttach = FALSE; /* No TV Output Attached */ - } - else { - tmp |= VIA_DEVICE_TV; - pBIOSInfo->TVAttach = TRUE; - if (!pBIOSInfo->TVOutput) { - if (sense == 0x02) { - pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE; - } - else { - pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO; - } - } - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "CH7019 sense = %d ,TVOutput = %d\n", sense, pBIOSInfo->TVOutput)); - } - break; - case VIA_SAA7108: - sense = VIASensorSAA7108(pBIOSInfo); - if (!sense) { - pBIOSInfo->TVAttach = FALSE; /* No TV Output Attached */ - } - else { - tmp |= VIA_DEVICE_TV; - pBIOSInfo->TVAttach = TRUE; - if (!pBIOSInfo->TVOutput) { - switch (sense) { - case 0x01: - pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE; - break; - case 0x02: - pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO; - break; - case 0x04: - pBIOSInfo->TVOutput = TVOUTPUT_RGB; - break; - case 0x08: - pBIOSInfo->TVOutput = TVOUTPUT_YCBCR; - break; - default: - pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE; - break; - } - } - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "SAA7108 sense = %d ,TVOutput = %d\n", sense, pBIOSInfo->TVOutput)); - } - break; - case VIA_FS454: - tmp |= VIA_DEVICE_TV; - pBIOSInfo->TVAttach = TRUE; - break; - default: - break; - } - - if (pBIOSInfo->TMDS) { - if (VIASensorDVI(pBIOSInfo)) { - tmp |= VIA_DEVICE_DFP; - pBIOSInfo->DVIAttach = TRUE; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "DVI has Attachment.\n")); - if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID) - VIAGetPanelInfo(pBIOSInfo); - } - else { - pBIOSInfo->DVIAttach = FALSE; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "DVI hasn't Attachment.\n")); - } - } - - return tmp; -} - - -/*=* - * - * Bool VIASetPanelState(VIABIOSInfoPtr, unsigned char) - * - * - Set Flat Panel Expaension/Centering State - * - * Return Type: Bool - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * Bit[7:1] Reserved - * Bit[0] 0/1 = Centering/Expansion - * - * The Definition of Return Value: - * - * Success - TRUE - * Not Success - FALSE - *=*/ - -Bool VIASetPanelState(VIABIOSInfoPtr pBIOSInfo, unsigned char state) -{ - VIABIOSInfoPtr pVia; - unsigned char tmp; - - pVia = pBIOSInfo; - - tmp = state & 0x01; - VGAOUT8(0x3D4, 0x3B); - tmp |= (VGAIN8(0x3D5) & 0xFE); - VGAOUT8(0x3D5, tmp); - - return TRUE; -} - - -/*=* - * - * unsigned char VIAGetPanelState(VIABIOSInfoPtr) - * - * - Get Flat Panel Expaension/Centering State - * - * Return Type: unsigend char - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * Bit[7:1] Reserved - * Bit[0] 0/1 = Centering/Expansion - * - * The Definition of Return Value: - * - * Bit[7:1] Reserved - * Bit[0] 0/1 = Centering/Expansion - *=*/ - -unsigned char VIAGetPanelState(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - unsigned char tmp; - - pVia = pBIOSInfo; - - VGAOUT8(0x3D4, 0x3B); - tmp = VGAIN8(0x3D5) & 0x01; - - return tmp; -} - - -/*=* - * - * int VIAQueryDVIEDID(void) - * - * - Query Flat Panel's EDID Table Version Through DVI Connector - * - * Return Type: int - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * 0 - Found No EDID Table - * 1 - Found EDID1 Table - * 2 - Found EDID2 Table - *=*/ - -int VIAQueryDVIEDID(VIABIOSInfoPtr pBIOSInfo) -{ - I2CDevPtr dev; - unsigned char W_Buffer[1]; - unsigned char R_Buffer[2]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAQueryDVIEDID\n")); - if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0xA0)) { - pBIOSInfo->dev = xf86CreateI2CDevRec(); - dev = pBIOSInfo->dev; - dev->DevName = "EDID1"; - dev->SlaveAddr = 0xA0; - dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */ - dev->StartTimeout = 550; - dev->BitTimeout = 40; - dev->ByteTimeout = 40; - dev->AcknTimeout = 40; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,2); - if ((R_Buffer[0] == 0) && (R_Buffer[1] == 0xFF)) - return 1; /* Found EDID1 Table */ - else - xf86DestroyI2CDevRec(dev,TRUE); - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - - if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0xA2)) { - pBIOSInfo->dev = xf86CreateI2CDevRec(); - dev = pBIOSInfo->dev; - dev->DevName = "EDID2"; - dev->SlaveAddr = 0xA2; - dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */ - dev->StartTimeout = 550; - dev->BitTimeout = 40; - dev->ByteTimeout = 40; - dev->AcknTimeout = 40; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - if (R_Buffer[0] == 0x20) - return 2; /* Found EDID2 Table */ - else { - xf86DestroyI2CDevRec(dev,TRUE); - return 0; /* Found No EDID Table */ - } - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - return 0; /* Found No EDID Table */ - } - } - - if (pBIOSInfo->Chipset != VIA_CLE266) { - VIAGPIOI2C_Initial(pBIOSInfo, 0xA0); - VIAGPIOI2C_Read(pBIOSInfo, 0, R_Buffer, 2); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "R_Buffer[0]=%d\n", R_Buffer[0])); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "R_Buffer[1]=%d\n", R_Buffer[1])); - if ((R_Buffer[0] == 0) && (R_Buffer[1] == 0xFF)) - return 1; /* Found EDID1 Table */ - else { - VIAGPIOI2C_Initial(pBIOSInfo, 0xA2); - VIAGPIOI2C_Read(pBIOSInfo, 0, R_Buffer, 1); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "R_Buffer[0]=%d\n", R_Buffer[0])); - if (R_Buffer[0] == 0x20) - return 2; /* Found EDID2 Table */ - else - return 0; /* Found No EDID Table */ - } - } - - return 0; -} - - -/*=* - * - * unsigned char VIAGetPanelSizeFromDDCv1(VIABIOSInfoPtr pBIOSInfo) - * - * - Get Panel Size Using EDID1 Table - * - * Return Type: unsigned char - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * 0 - 640x480 - * 1 - 800x600 - * 2 - 1024x768 - * 3 - 1280x768 - * 4 - 1280x1024 - * 5 - 1400x1050 - * 6 - 1600x1200 - * 0xFF - Not Supported Panel Size - *=*/ - -unsigned char VIAGetPanelSizeFromDDCv1(VIABIOSInfoPtr pBIOSInfo) -{ - ScrnInfoPtr pScrn = xf86Screens[pBIOSInfo->scrnIndex]; - xf86MonPtr pMon; - int i, max = 0; - unsigned char W_Buffer[1]; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetPanelSizeFromDDCv1\n")); - for (i = 0x23; i < 0x35; i++) { - switch (i) { - case 0x23: - if (pBIOSInfo->Chipset == VIA_CLE266) { - W_Buffer[0] = i; - xf86I2CWriteRead(pBIOSInfo->dev, W_Buffer,1, R_Buffer,1); - } - else { - VIAGPIOI2C_Read(pBIOSInfo, i, R_Buffer, 1); - } - if (R_Buffer[0] & 0x3C) - max = 640; - if (R_Buffer[0] & 0xC0) - max = 720; - if (R_Buffer[0] & 0x03) - max = 800; - break; - case 0x24: - if (pBIOSInfo->Chipset == VIA_CLE266) { - W_Buffer[0] = i; - xf86I2CWriteRead(pBIOSInfo->dev, W_Buffer,1, R_Buffer,1); - } - else { - VIAGPIOI2C_Read(pBIOSInfo, i, R_Buffer, 1); - } - if (R_Buffer[0] & 0xC0) - max = 800; - if (R_Buffer[0] & 0x1E) - max = 1024; - if (R_Buffer[0] & 0x01) - max = 1280; - break; - case 0x26: - case 0x28: - case 0x2A: - case 0x2C: - case 0x2E: - case 0x30: - case 0x32: - case 0x34: - if (pBIOSInfo->Chipset == VIA_CLE266) { - W_Buffer[0] = i; - xf86I2CWriteRead(pBIOSInfo->dev, W_Buffer,1, R_Buffer,1); - } - else { - VIAGPIOI2C_Read(pBIOSInfo, i, R_Buffer, 1); - } - if (R_Buffer[0] == 1) - break; - R_Buffer[0] += 31; - R_Buffer[0] = R_Buffer[0] << 3; /* data = (data + 31) * 8 */ - if (R_Buffer[0] > max) - max = R_Buffer[0]; - break; - default: - break; - } - } - - if (pBIOSInfo->Chipset == VIA_CLE266) { - xf86DestroyI2CDevRec(pBIOSInfo->dev,TRUE); - - pMon = xf86DoEDID_DDC2(pScrn->scrnIndex, pBIOSInfo->I2C_Port2); - if (pMon) { - pBIOSInfo->DDC2 = pMon; - xf86PrintEDID(pMon); - xf86SetDDCproperties(pScrn, pMon); - for (i = 0; i < 8; i++) { - if (pMon->timings2[i].hsize > max) { - max = pMon->timings2[i].hsize; - } - } - if (pBIOSInfo->DDC1) { - xf86SetDDCproperties(pScrn, pBIOSInfo->DDC1); - } - } - } - - switch (max) { - case 640: - pBIOSInfo->PanelSize = VIA_PANEL6X4; - break; - case 800: - pBIOSInfo->PanelSize = VIA_PANEL8X6; - break; - case 1024: - pBIOSInfo->PanelSize = VIA_PANEL10X7; - break; - case 1280: - pBIOSInfo->PanelSize = VIA_PANEL12X10; - break; - case 1400: - pBIOSInfo->PanelSize = VIA_PANEL14X10; - break; - case 1600: - pBIOSInfo->PanelSize = VIA_PANEL16X12; - break; - default: - pBIOSInfo->PanelSize = VIA_PANEL_INVALID; - break; - } - return pBIOSInfo->PanelSize; -} - - -/*=* - * - * unsigned char VIAGetPanelSizeFromDDCv2(VIABIOSInfoPtr pBIOSInfo) - * - * - Get Panel Size Using EDID2 Table - * - * Return Type: unsigned char - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * 0 - 640x480 - * 1 - 800x600 - * 2 - 1024x768 - * 3 - 1280x768 - * 4 - 1280x1024 - * 5 - 1400x1050 - * 6 - 1600x1200 - * 0xFF - Not Supported Panel Size - *=*/ - -unsigned char VIAGetPanelSizeFromDDCv2(VIABIOSInfoPtr pBIOSInfo) -{ - int data = 0; - unsigned char W_Buffer[1]; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetPanelSizeFromDDCv2\n")); - if (pBIOSInfo->Chipset == VIA_CLE266) { - W_Buffer[0] = 0x77; - xf86I2CWriteRead(pBIOSInfo->dev, W_Buffer,1, R_Buffer,1); - data = R_Buffer[0]; - data = data << 8; - W_Buffer[0] = 0x76; - xf86I2CWriteRead(pBIOSInfo->dev, W_Buffer,1, R_Buffer,1); - data |= R_Buffer[0]; - - xf86DestroyI2CDevRec(pBIOSInfo->dev,TRUE); - } - else { - VIAGPIOI2C_Read(pBIOSInfo, 0x76, R_Buffer, 2); - data = R_Buffer[0]; - data += R_Buffer[1] << 8; - } - - switch (data) { - case 640: - pBIOSInfo->PanelSize = VIA_PANEL6X4; - break; - case 800: - pBIOSInfo->PanelSize = VIA_PANEL8X6; - break; - case 1024: - pBIOSInfo->PanelSize = VIA_PANEL10X7; - break; - case 1280: - pBIOSInfo->PanelSize = VIA_PANEL12X10; - break; - case 1400: - pBIOSInfo->PanelSize = VIA_PANEL14X10; - break; - case 1600: - pBIOSInfo->PanelSize = VIA_PANEL16X12; - break; - default: - pBIOSInfo->PanelSize = VIA_PANEL_INVALID; - break; - } - return pBIOSInfo->PanelSize; -} - -/*=* - * - * unsigned char VIAGetPanelInfo(VIABIOSInfoPtr pBIOSInfo) - * - * - Get Panel Size - * - * Return Type: unsigned char - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * 0 - 640x480 - * 1 - 800x600 - * 2 - 1024x768 - * 3 - 1280x768 - * 4 - 1280x1024 - * 5 - 1400x1050 - * 6 - 1600x1200 - * 0xFF - Not Supported Panel Size - *=*/ - -unsigned char VIAGetPanelInfo(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia = pBIOSInfo; - unsigned char cr6c, cr93; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetPanelInfo\n")); - - if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID) { - - /* Enable DI0, DI1 */ - VGAOUT8(0x3d4, 0x6C); - cr6c = VGAIN8(0x3d5); - VGAOUT8(0x3d5, cr6c | 0x21); - VGAOUT8(0x3d4, 0x93); - cr93 = VGAIN8(0x3d5); - if (pBIOSInfo->ChipRev > 15) { - VGAOUT8(0x3d5, 0xA3); - } - else { - VGAOUT8(0x3d5, 0xBF); - } - - /* Enable LCD */ - VIAEnableLCD(pBIOSInfo); - - switch (VIAQueryDVIEDID(pBIOSInfo)) { - case 1: - VIAGetPanelSizeFromDDCv1(pBIOSInfo); - break; - case 2: - VIAGetPanelSizeFromDDCv2(pBIOSInfo); - break; - default: - break; - } - - /* Disable LCD */ - VIADisableLCD(pBIOSInfo); - - /* Restore DI0, DI1 status */ - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, cr6c); - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, cr93); - } - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "PanelSize = %d\n", pBIOSInfo->PanelSize)); - return (unsigned char)(pBIOSInfo->PanelSize); -} - -#ifdef CREATE_MODETABLE_HEADERFILE -Bool VIACreateHeaderFile(VIAModeTablePtr pViaModeTable) -{ - int i, j, k, m; - int numMPatch; - VIALCDMPatchEntryPtr MPatch; - FILE *pFile; - - - if ((pFile = fopen("via_mode.h", "w+")) == NULL) { - ErrorF("Can't open \"via_mode.h\" file!!\n"); - return FALSE; - } - - fprintf(pFile, "#ifndef _VIA_MODETABLE_H\n"); - fprintf(pFile, "#define _VIA_MODETABLE_H\n"); - fprintf(pFile, "\n"); - - fprintf(pFile, "static const unsigned short BIOSVer = %#X;\n\n", pViaModeTable->BIOSVer); - fprintf(pFile, "static char BIOSDate[] = { "); - for (i = 0; i < 9; i++) { - if (i == 8) - fprintf(pFile, "%#X };\n\n", pViaModeTable->BIOSDate[i]); - else - fprintf(pFile, "%#X, ", pViaModeTable->BIOSDate[i]); - } - fprintf(pFile, "static const unsigned short NumModes = %d;\n\n", pViaModeTable->NumModes); - fprintf(pFile, "static const int NumPowerOn = %d;\n\n", pViaModeTable->NumPowerOn); - fprintf(pFile, "static const int NumPowerOff = %d;\n\n", pViaModeTable->NumPowerOff); - fprintf(pFile, "static VIAModeEntry Modes[] = {\n"); - for (i = 0; i < pViaModeTable->NumModes; i++) { - fprintf(pFile, " { %d, %d, %d, %#X, %d, %#X, %#X, ", - pViaModeTable->Modes[i].Width, - pViaModeTable->Modes[i].Height, - pViaModeTable->Modes[i].Bpp, - pViaModeTable->Modes[i].Mode, - pViaModeTable->Modes[i].MemNeed, - pViaModeTable->Modes[i].MClk, - pViaModeTable->Modes[i].VClk); - fprintf(pFile, "{ %d, %d, %d, %#X, ", /* stdVgaTable */ - pViaModeTable->Modes[i].stdVgaTable.columns, - pViaModeTable->Modes[i].stdVgaTable.rows, - pViaModeTable->Modes[i].stdVgaTable.fontHeight, - pViaModeTable->Modes[i].stdVgaTable.pageSize); - fprintf(pFile, "{ "); /* SR[] */ - for (j = 0; j < 5; j++) { - if (j == 4) - fprintf(pFile, "%#X }, ", /* SR[] */ - pViaModeTable->Modes[i].stdVgaTable.SR[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->Modes[i].stdVgaTable.SR[j]); - } - fprintf(pFile, "%#X, ", - pViaModeTable->Modes[i].stdVgaTable.misc); - fprintf(pFile, "{ "); /* CR[] */ - for (j = 0; j < 25; j++) { - if (j == 24) - fprintf(pFile, "%#X }, ", /* CR[] */ - pViaModeTable->Modes[i].stdVgaTable.CR[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->Modes[i].stdVgaTable.CR[j]); - } - fprintf(pFile, "{ "); /* AR[] */ - for (j = 0; j < 20; j++) { - if (j == 19) - fprintf(pFile, "%#X }, ", /* AR[] */ - pViaModeTable->Modes[i].stdVgaTable.AR[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->Modes[i].stdVgaTable.AR[j]); - } - fprintf(pFile, "{ "); /* GR[] */ - for (j = 0; j < 9; j++) { - if (j == 8) - fprintf(pFile, "%#X } ", /* GR[] */ - pViaModeTable->Modes[i].stdVgaTable.GR[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->Modes[i].stdVgaTable.GR[j]); - } - fprintf(pFile, "}, "); /* stdVgaTable */ - fprintf(pFile, "{ "); /* extModeExtTable */ - fprintf(pFile, "{ "); /* extModeExtTable.port[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* extModeExtTable.port[] */ - pViaModeTable->Modes[i].extModeExtTable.port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->Modes[i].extModeExtTable.port[j]); - } - fprintf(pFile, "{ "); /* extModeExtTable.offset[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* extModeExtTable.offset[] */ - pViaModeTable->Modes[i].extModeExtTable.offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->Modes[i].extModeExtTable.offset[j]); - } - fprintf(pFile, "{ "); /* extModeExtTable.mask[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* extModeExtTable.mask[] */ - pViaModeTable->Modes[i].extModeExtTable.mask[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->Modes[i].extModeExtTable.mask[j]); - } - fprintf(pFile, "{ "); /* extModeExtTable.data[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* extModeExtTable.data[] */ - pViaModeTable->Modes[i].extModeExtTable.data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->Modes[i].extModeExtTable.data[j]); - } - fprintf(pFile, "%d ", - pViaModeTable->Modes[i].extModeExtTable.numEntry); - fprintf(pFile, "} "); /* extModeExtTable */ - if (i == (pViaModeTable->NumModes - 1)) - fprintf(pFile, "}\n"); - else - fprintf(pFile, "},\n"); - } - fprintf(pFile, "};\n\n"); - - fprintf(pFile, "static const VIABIOSRegTableRec commExtTable = {\n"); /* commExtTable */ - fprintf(pFile, " { "); /* commExtTable.port[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* commExtTable.port[] */ - pViaModeTable->commExtTable.port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->commExtTable.port[j]); - } - fprintf(pFile, "{ "); /* commExtTable.offset[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* commExtTable.offset[] */ - pViaModeTable->commExtTable.offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->commExtTable.offset[j]); - } - fprintf(pFile, "{ "); /* commExtTable.mask[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* commExtTable.mask[] */ - pViaModeTable->commExtTable.mask[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->commExtTable.mask[j]); - } - fprintf(pFile, "{ "); /* commExtTable.data[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* commExtTable.data[] */ - pViaModeTable->commExtTable.data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->commExtTable.data[j]); - } - fprintf(pFile, "%d ", - pViaModeTable->commExtTable.numEntry); - fprintf(pFile, "};\n\n"); /* commExtTable */ - - fprintf(pFile, "static const VIABIOSRegTableRec stdModeExtTable = {\n"); /* stdModeExtTable */ - fprintf(pFile, " { "); /* stdModeExtTable.port[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* stdModeExtTable.port[] */ - pViaModeTable->stdModeExtTable.port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->stdModeExtTable.port[j]); - } - fprintf(pFile, "{ "); /* stdModeExtTable.offset[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* stdModeExtTable.offset[] */ - pViaModeTable->stdModeExtTable.offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->stdModeExtTable.offset[j]); - } - fprintf(pFile, "{ "); /* stdModeExtTable.mask[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* stdModeExtTable.mask[] */ - pViaModeTable->stdModeExtTable.mask[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->stdModeExtTable.mask[j]); - } - fprintf(pFile, "{ "); /* stdModeExtTable.data[] */ - for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* stdModeExtTable.data[] */ - pViaModeTable->stdModeExtTable.data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->stdModeExtTable.data[j]); - } - fprintf(pFile, "%d ", - pViaModeTable->stdModeExtTable.numEntry); - fprintf(pFile, "};\n\n"); /* stdModeExtTable */ - - fprintf(pFile, "static const VIABIOSRefreshTableRec refreshTable[%d][%d] = {\n", - VIA_BIOS_NUM_RES, VIA_BIOS_NUM_REFRESH); /* refreshTable */ - for (i = 0; i < VIA_BIOS_NUM_RES; i++) { - fprintf(pFile, " {\n"); - for (j = 0; j < VIA_BIOS_NUM_REFRESH; j++) { - fprintf(pFile, " { %d, %#X, ", - pViaModeTable->refreshTable[i][j].refresh, - pViaModeTable->refreshTable[i][j].VClk); - fprintf(pFile, "{ "); /* refreshTable.CR[] */ - for (k = 0; k < 14; k++) { - if (k == 13) - fprintf(pFile, "%#X } ", /* refreshTable.CR[] */ - pViaModeTable->refreshTable[i][j].CR[k]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->refreshTable[i][j].CR[k]); - } - if (j == (VIA_BIOS_NUM_REFRESH - 1)) { - if (i == (VIA_BIOS_NUM_RES - 1)) - fprintf(pFile, "}\n"); - else - fprintf(pFile, "},\n"); - } - else - fprintf(pFile, "},\n"); - } - if (i == (VIA_BIOS_NUM_RES - 1)) { - fprintf(pFile, " }\n"); - fprintf(pFile, "};\n\n"); - } - else - fprintf(pFile, " },\n"); - } - - fprintf(pFile, "static const VIALCDModeTableRec lcdTable[] = {\n"); /* lcdTable */ - for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) { - fprintf(pFile, " { %#X, %#X, %#X, %d, %d, %d, %d, \n", - pViaModeTable->lcdTable[i].fpIndex, - pViaModeTable->lcdTable[i].fpSize, - pViaModeTable->lcdTable[i].powerSeq, - pViaModeTable->lcdTable[i].numMPatchDP2Ctr, - pViaModeTable->lcdTable[i].numMPatchDP2Exp, - pViaModeTable->lcdTable[i].numMPatchDP1Ctr, - pViaModeTable->lcdTable[i].numMPatchDP1Exp); - - fprintf(pFile, " { "); /* SuptMode */ - for (j = 0; j < VIA_BIOS_NUM_LCD_SUPPORT_MASK; j++) { - if (j == (VIA_BIOS_NUM_LCD_SUPPORT_MASK - 1)) - fprintf(pFile, "%#X }, \n", /* SuptMode */ - pViaModeTable->lcdTable[i].SuptMode[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].SuptMode[j]); - } - - fprintf(pFile, " { %#X, %#X, %#X, %#X, ", /* FPconfigTb */ - pViaModeTable->lcdTable[i].FPconfigTb.LCDClk, - pViaModeTable->lcdTable[i].FPconfigTb.VClk, - pViaModeTable->lcdTable[i].FPconfigTb.LCDClk_12Bit, - pViaModeTable->lcdTable[i].FPconfigTb.VClk_12Bit); - fprintf(pFile, "{ "); /* FPconfigTb.port[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* FPconfigTb.port[] */ - pViaModeTable->lcdTable[i].FPconfigTb.port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].FPconfigTb.port[j]); - } - fprintf(pFile, "{ "); /* FPconfigTb.offset[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* FPconfigTb.offset[] */ - pViaModeTable->lcdTable[i].FPconfigTb.offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].FPconfigTb.offset[j]); - } - fprintf(pFile, "{ "); /* FPconfigTb.data[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* FPconfigTb.data[] */ - pViaModeTable->lcdTable[i].FPconfigTb.data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].FPconfigTb.data[j]); - } - fprintf(pFile, "%d }, \n", /* FPconfigTb */ - pViaModeTable->lcdTable[i].FPconfigTb.numEntry); - - fprintf(pFile, " { %#X, %#X, %#X, %#X, ", /* InitTb */ - pViaModeTable->lcdTable[i].InitTb.LCDClk, - pViaModeTable->lcdTable[i].InitTb.VClk, - pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit, - pViaModeTable->lcdTable[i].InitTb.VClk_12Bit); - fprintf(pFile, "{ "); /* InitTb.port[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* InitTb.port[] */ - pViaModeTable->lcdTable[i].InitTb.port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].InitTb.port[j]); - } - fprintf(pFile, "{ "); /* InitTb.offset[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* InitTb.offset[] */ - pViaModeTable->lcdTable[i].InitTb.offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].InitTb.offset[j]); - } - fprintf(pFile, "{ "); /* InitTb.data[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* InitTb.data[] */ - pViaModeTable->lcdTable[i].InitTb.data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].InitTb.data[j]); - } - fprintf(pFile, "%d }, \n", /* InitTb */ - pViaModeTable->lcdTable[i].InitTb.numEntry); - - /* MPatch Table */ - for (m = 0; m < 4; m++) { - switch (m) { - case 0: /* MPatchDP2Ctr */ - MPatch = pViaModeTable->lcdTable[i].MPatchDP2Ctr; - numMPatch = VIA_BIOS_MAX_NUM_MPATCH2; - break; - case 1: /* MPatchDP2Exp */ - MPatch = pViaModeTable->lcdTable[i].MPatchDP2Exp; - numMPatch = VIA_BIOS_MAX_NUM_MPATCH2; - break; - case 2: /* MPatchDP1Ctr */ - MPatch = pViaModeTable->lcdTable[i].MPatchDP1Ctr; - numMPatch = VIA_BIOS_MAX_NUM_MPATCH1; - break; - case 3: /* MPatchDP1Exp */ - MPatch = pViaModeTable->lcdTable[i].MPatchDP1Exp; - numMPatch = VIA_BIOS_MAX_NUM_MPATCH1; - break; - } - - fprintf(pFile, " { \n"); - for (k = 0; k < numMPatch; k++) { - fprintf(pFile, " { %#X, %#X, %#X, %#X, %#X, ", - MPatch[k].Mode, - MPatch[k].LCDClk, - MPatch[k].VClk, - MPatch[k].LCDClk_12Bit, - MPatch[k].VClk_12Bit); - fprintf(pFile, "{ "); /* port[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* port[] */ - MPatch[k].port[j]); - else - fprintf(pFile, "%#X, ", - MPatch[k].port[j]); - } - fprintf(pFile, "{ "); /* offset[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* offset[] */ - MPatch[k].offset[j]); - else - fprintf(pFile, "%#X, ", - MPatch[k].offset[j]); - } - fprintf(pFile, "{ "); /* data[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* data[] */ - MPatch[k].data[j]); - else - fprintf(pFile, "%#X, ", - MPatch[k].data[j]); - } - if (k == (numMPatch - 1)) - fprintf(pFile, "%d }\n }, \n", - MPatch[k].numEntry); - else - fprintf(pFile, "%d }, \n", - MPatch[k].numEntry); - } - } - - fprintf(pFile, " { %#X, %#X, %#X, %#X, ", /* LowResCtr */ - pViaModeTable->lcdTable[i].LowResCtr.LCDClk, - pViaModeTable->lcdTable[i].LowResCtr.VClk, - pViaModeTable->lcdTable[i].LowResCtr.LCDClk_12Bit, - pViaModeTable->lcdTable[i].LowResCtr.VClk_12Bit); - fprintf(pFile, "{ "); /* LowResCtr.port[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* LowResCtr.port[] */ - pViaModeTable->lcdTable[i].LowResCtr.port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].LowResCtr.port[j]); - } - fprintf(pFile, "{ "); /* LowResCtr.offset[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* LowResCtr.offset[] */ - pViaModeTable->lcdTable[i].LowResCtr.offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].LowResCtr.offset[j]); - } - fprintf(pFile, "{ "); /* LowResCtr.data[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* LowResCtr.data[] */ - pViaModeTable->lcdTable[i].LowResCtr.data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].LowResCtr.data[j]); - } - fprintf(pFile, "%d }, \n", /* LowResCtr */ - pViaModeTable->lcdTable[i].LowResCtr.numEntry); - - fprintf(pFile, " { %#X, %#X, %#X, %#X, ", /* LowResExp */ - pViaModeTable->lcdTable[i].LowResExp.LCDClk, - pViaModeTable->lcdTable[i].LowResExp.VClk, - pViaModeTable->lcdTable[i].LowResExp.LCDClk_12Bit, - pViaModeTable->lcdTable[i].LowResExp.VClk_12Bit); - fprintf(pFile, "{ "); /* LowResExp.port[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* LowResExp.port[] */ - pViaModeTable->lcdTable[i].LowResExp.port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].LowResExp.port[j]); - } - fprintf(pFile, "{ "); /* LowResExp.offset[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* LowResExp.offset[] */ - pViaModeTable->lcdTable[i].LowResExp.offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].LowResExp.offset[j]); - } - fprintf(pFile, "{ "); /* LowResExp.data[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* LowResExp.data[] */ - pViaModeTable->lcdTable[i].LowResExp.data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].LowResExp.data[j]); - } - fprintf(pFile, "%d }, \n", /* LowResExp */ - pViaModeTable->lcdTable[i].LowResExp.numEntry); - - fprintf(pFile, " { \n"); /* MCtr */ - for (k = 0; k < VIA_BIOS_MAX_NUM_CTREXP; k++) { - fprintf(pFile, " { %#X, %#X, %#X, %#X, ", - pViaModeTable->lcdTable[i].MCtr[k].LCDClk, - pViaModeTable->lcdTable[i].MCtr[k].VClk, - pViaModeTable->lcdTable[i].MCtr[k].LCDClk_12Bit, - pViaModeTable->lcdTable[i].MCtr[k].VClk_12Bit); - fprintf(pFile, "{ "); /* port[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* port[] */ - pViaModeTable->lcdTable[i].MCtr[k].port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].MCtr[k].port[j]); - } - fprintf(pFile, "{ "); /* offset[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* offset[] */ - pViaModeTable->lcdTable[i].MCtr[k].offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].MCtr[k].offset[j]); - } - fprintf(pFile, "{ "); /* data[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* data[] */ - pViaModeTable->lcdTable[i].MCtr[k].data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].MCtr[k].data[j]); - } - if (k == (VIA_BIOS_MAX_NUM_CTREXP - 1)) - fprintf(pFile, "%d }\n }, \n", - pViaModeTable->lcdTable[i].MCtr[k].numEntry); - else - fprintf(pFile, "%d }, \n", - pViaModeTable->lcdTable[i].MCtr[k].numEntry); - } - - fprintf(pFile, " { \n"); /* MExp */ - for (k = 0; k < VIA_BIOS_MAX_NUM_CTREXP; k++) { - fprintf(pFile, " { %#X, %#X, %#X, %#X, ", - pViaModeTable->lcdTable[i].MExp[k].LCDClk, - pViaModeTable->lcdTable[i].MExp[k].VClk, - pViaModeTable->lcdTable[i].MExp[k].LCDClk_12Bit, - pViaModeTable->lcdTable[i].MExp[k].VClk_12Bit); - fprintf(pFile, "{ "); /* port[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* port[] */ - pViaModeTable->lcdTable[i].MExp[k].port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].MExp[k].port[j]); - } - fprintf(pFile, "{ "); /* offset[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* offset[] */ - pViaModeTable->lcdTable[i].MExp[k].offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].MExp[k].offset[j]); - } - fprintf(pFile, "{ "); /* data[] */ - for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) { - if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1)) - fprintf(pFile, "%#X }, ", /* data[] */ - pViaModeTable->lcdTable[i].MExp[k].data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->lcdTable[i].MExp[k].data[j]); - } - if (k == (VIA_BIOS_MAX_NUM_CTREXP - 1)) - fprintf(pFile, "%d }\n }\n", - pViaModeTable->lcdTable[i].MExp[k].numEntry); - else - fprintf(pFile, "%d }, \n", - pViaModeTable->lcdTable[i].MExp[k].numEntry); - } - if (i == (VIA_BIOS_NUM_PANEL - 1)) - fprintf(pFile, " }\n};\n\n"); - else - fprintf(pFile, " },\n"); - } - - /* powerOn */ - fprintf(pFile, "static const VIALCDPowerSeqRec powerOn[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_LCD_POWER_SEQ; i++) { - fprintf(pFile, " { %d, ", - pViaModeTable->powerOn[i].powerSeq); - fprintf(pFile, "{ "); /* port[] */ - for (j = 0; j < 4; j++) { - if (j == 3) - fprintf(pFile, "%#X }, ", /* port[] */ - pViaModeTable->powerOn[i].port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->powerOn[i].port[j]); - } - fprintf(pFile, "{ "); /* offset[] */ - for (j = 0; j < 4; j++) { - if (j == 3) - fprintf(pFile, "%#X }, ", /* offset[] */ - pViaModeTable->powerOn[i].offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->powerOn[i].offset[j]); - } - fprintf(pFile, "{ "); /* mask[] */ - for (j = 0; j < 4; j++) { - if (j == 3) - fprintf(pFile, "%#X }, ", /* mask[] */ - pViaModeTable->powerOn[i].mask[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->powerOn[i].mask[j]); - } - fprintf(pFile, "{ "); /* data[] */ - for (j = 0; j < 4; j++) { - if (j == 3) - fprintf(pFile, "%#X }, ", /* data[] */ - pViaModeTable->powerOn[i].data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->powerOn[i].data[j]); - } - fprintf(pFile, "{ "); /* delay[] */ - for (j = 0; j < 4; j++) { - if (j == 3) - fprintf(pFile, "%#X }, ", /* delay[] */ - pViaModeTable->powerOn[i].delay[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->powerOn[i].delay[j]); - } - if (i == (VIA_BIOS_NUM_LCD_POWER_SEQ - 1)) { - fprintf(pFile, "%d }\n}; \n\n", - pViaModeTable->powerOn[i].numEntry); - } - else - fprintf(pFile, "%d }, \n", - pViaModeTable->powerOn[i].numEntry); - } - - /* powerOff */ - fprintf(pFile, "static const VIALCDPowerSeqRec powerOff[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_LCD_POWER_SEQ; i++) { - fprintf(pFile, " { %d, ", - pViaModeTable->powerOff[i].powerSeq); - fprintf(pFile, "{ "); /* port[] */ - for (j = 0; j < 4; j++) { - if (j == 3) - fprintf(pFile, "%#X }, ", /* port[] */ - pViaModeTable->powerOff[i].port[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->powerOff[i].port[j]); - } - fprintf(pFile, "{ "); /* offset[] */ - for (j = 0; j < 4; j++) { - if (j == 3) - fprintf(pFile, "%#X }, ", /* offset[] */ - pViaModeTable->powerOff[i].offset[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->powerOff[i].offset[j]); - } - fprintf(pFile, "{ "); /* mask[] */ - for (j = 0; j < 4; j++) { - if (j == 3) - fprintf(pFile, "%#X }, ", /* mask[] */ - pViaModeTable->powerOff[i].mask[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->powerOff[i].mask[j]); - } - fprintf(pFile, "{ "); /* data[] */ - for (j = 0; j < 4; j++) { - if (j == 3) - fprintf(pFile, "%#X }, ", /* data[] */ - pViaModeTable->powerOff[i].data[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->powerOff[i].data[j]); - } - fprintf(pFile, "{ "); /* delay[] */ - for (j = 0; j < 4; j++) { - if (j == 3) - fprintf(pFile, "%#X }, ", /* delay[] */ - pViaModeTable->powerOff[i].delay[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->powerOff[i].delay[j]); - } - if (i == (VIA_BIOS_NUM_LCD_POWER_SEQ - 1)) { - fprintf(pFile, "%d }\n}; \n\n", - pViaModeTable->powerOff[i].numEntry); - } - else - fprintf(pFile, "%d }, \n", - pViaModeTable->powerOff[i].numEntry); - } - - /* ModeFix */ - fprintf(pFile, "static const VIALCDModeFixRec modeFix = {\n"); - fprintf(pFile, " { "); /* modeFix.reqMode[] */ - for (i = 0; i < 32; i++) { - if (i == 31) - fprintf(pFile, "%#X }, ", /* ModeFix.reqMode[] */ - pViaModeTable->modeFix.reqMode[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->modeFix.reqMode[i]); - } - fprintf(pFile, "{ "); /* modeFix.fixMode[] */ - for (i = 0; i < 32; i++) { - if (i == 31) - fprintf(pFile, "%#X }, ", /* modeFix.fixMode[] */ - pViaModeTable->modeFix.fixMode[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->modeFix.fixMode[i]); - } - fprintf(pFile, "%d }; \n\n", - pViaModeTable->modeFix.numEntry); - - fprintf(pFile, "\n"); - fprintf(pFile, "#endif\n"); - - if (fclose(pFile) != 0) { - ErrorF("Error closing file!!\n"); - return FALSE; - } - else - return TRUE; -} -#endif /* CREATE_MODETABLE_HEADERFILE */ - -#ifdef CREATE_FS454_HEADERFILE -Bool VIACreateFS454(VIAModeTablePtr pViaModeTable) -{ - int i, j; - FILE *pFile; - - if ((pFile = fopen("via_fs454.h", "w+")) == NULL) { - ErrorF("Can't open \"via_fs454.h\" file!!\n"); - return FALSE; - } - - fprintf(pFile, "#ifndef _VIA_FS454MODETABLE_H\n"); - fprintf(pFile, "#define _VIA_FS454MODETABLE_H\n"); - fprintf(pFile, "\n"); - - /* fs454MaskTable */ - fprintf(pFile, "static const VIABIOSFS454TVMASKTableRec fs454MaskTable = {\n"); - fprintf(pFile, " { "); - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* fs454MaskTable.CRTC1[] */ - pViaModeTable->fs454MaskTable.CRTC1[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454MaskTable.CRTC1[i]); - } - - fprintf(pFile, " { "); /* fs454MaskTable.CRTC2[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* fs454MaskTable.CRTC2[] */ - pViaModeTable->fs454MaskTable.CRTC2[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454MaskTable.CRTC2[i]); - } - - fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n", - pViaModeTable->fs454MaskTable.misc1, - pViaModeTable->fs454MaskTable.misc2, - pViaModeTable->fs454MaskTable.numCRTC1, - pViaModeTable->fs454MaskTable.numCRTC2); - - /* fs454Table */ - fprintf(pFile, "static const VIABIOSFS454TableRec fs454Table[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_FS454; i++) { - fprintf(pFile, " {\n"); - - fprintf(pFile, " { "); /* fs454Table.TVNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_FS454_TV_REG; j++) { - if (j == (VIA_BIOS_NUM_FS454_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* fs454Table.TVNTSC[] */ - pViaModeTable->fs454Table[i].TVNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454Table[i].TVNTSC[j]); - } - - fprintf(pFile, " { "); /* fs454Table.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* fs454Table.CRTCNTSC1[] */ - pViaModeTable->fs454Table[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454Table[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* fs454Table.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* fs454Table.MiscNTSC1[] */ - pViaModeTable->fs454Table[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454Table[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* fs454Table.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* fs454Table.MiscNTSC2[] */ - pViaModeTable->fs454Table[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454Table[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* fs454Table.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* fs454Table.CRTCNTSC2_8BPP[] */ - pViaModeTable->fs454Table[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454Table[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* fs454Table.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* fs454Table.CRTCNTSC2_16BPP[] */ - pViaModeTable->fs454Table[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454Table[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* fs454Table.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* fs454Table.CRTCNTSC2_32BPP[] */ - pViaModeTable->fs454Table[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454Table[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* fs454Table.RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* fs454Table.RGBNTSC[] */ - pViaModeTable->fs454Table[i].RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454Table[i].RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* fs454Table.YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* fs454Table.YCbCrNTSC[] */ - pViaModeTable->fs454Table[i].YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454Table[i].YCbCrNTSC[j]); - } - - fprintf(pFile, " { "); /* fs454Table.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* fs454Table.DotCrawlNTSC[] */ - pViaModeTable->fs454Table[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454Table[i].DotCrawlNTSC[j]); - } - - if (i == (VIA_BIOS_NUM_FS454 - 1)) - fprintf(pFile, " }\n};\n\n"); - else - fprintf(pFile, " }, \n"); - } - - /* fs454OverTable */ - fprintf(pFile, "static const VIABIOSFS454TableRec fs454OverTable[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_FS454; i++) { - fprintf(pFile, " {\n"); - - fprintf(pFile, " { "); - for (j = 0; j < VIA_BIOS_NUM_FS454_TV_REG; j++) { - if (j == (VIA_BIOS_NUM_FS454_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* fs454OverTable.TVNTSC[] */ - pViaModeTable->fs454OverTable[i].TVNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454OverTable[i].TVNTSC[j]); - } - - fprintf(pFile, " { "); /* fs454OverTable.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* fs454OverTable.CRTCNTSC1[] */ - pViaModeTable->fs454OverTable[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454OverTable[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* fs454OverTable.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* fs454OverTable.MiscNTSC1[] */ - pViaModeTable->fs454OverTable[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454OverTable[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* fs454OverTable.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* fs454OverTable.MiscNTSC2[] */ - pViaModeTable->fs454OverTable[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454OverTable[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* fs454OverTable.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* fs454OverTable.CRTCNTSC2_8BPP[] */ - pViaModeTable->fs454OverTable[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454OverTable[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* fs454OverTable.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* fs454OverTable.CRTCNTSC2_16BPP[] */ - pViaModeTable->fs454OverTable[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454OverTable[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* fs454OverTable.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* fs454OverTable.CRTCNTSC2_32BPP[] */ - pViaModeTable->fs454OverTable[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454OverTable[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* fs454OverTable.RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* fs454OverTable.RGBNTSC[] */ - pViaModeTable->fs454OverTable[i].RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454OverTable[i].RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* fs454OverTable.YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* fs454OverTable.YCbCrNTSC[] */ - pViaModeTable->fs454OverTable[i].YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454OverTable[i].YCbCrNTSC[j]); - } - - fprintf(pFile, " { "); /* fs454OverTable.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* fs454OverTable.DotCrawlNTSC[] */ - pViaModeTable->fs454OverTable[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->fs454OverTable[i].DotCrawlNTSC[j]); - } - - if (i == (VIA_BIOS_NUM_FS454 - 1)) - fprintf(pFile, " }\n};\n"); - else - fprintf(pFile, " }, \n"); - } - - fprintf(pFile, "\n"); - fprintf(pFile, "#endif\n"); - - return TRUE; -} -#endif /* CREATE_FS454_HEADERFILE */ - -#ifdef CREATE_TV2_HEADERFILE -Bool VIACreateTV2(VIAModeTablePtr pViaModeTable) -{ - int i, j; - FILE *pFile; - - - if ((pFile = fopen("via_tv2.h", "w+")) == NULL) { - ErrorF("Can't open \"via_tv2.h\" file!!\n"); - return FALSE; - } - - fprintf(pFile, "#ifndef _VIA_TV2MODETABLE_H\n"); - fprintf(pFile, "#define _VIA_TV2MODETABLE_H\n"); - fprintf(pFile, "\n"); - - /* tv2MaskTable */ - fprintf(pFile, "static const VIABIOSTVMASKTableRec tv2MaskTable = {\n"); - fprintf(pFile, " { "); /* tv2MaskTable.TV[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2MaskTable.TV[] */ - pViaModeTable->tv2MaskTable.TV[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2MaskTable.TV[i]); - } - - fprintf(pFile, " { "); /* tv2MaskTable.CRTC1[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2MaskTable.CRTC1[] */ - pViaModeTable->tv2MaskTable.CRTC1[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2MaskTable.CRTC1[i]); - } - - fprintf(pFile, " { "); /* tv2MaskTable.CRTC2[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2MaskTable.CRTC2[] */ - pViaModeTable->tv2MaskTable.CRTC2[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2MaskTable.CRTC2[i]); - } - - fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n", - pViaModeTable->tv2MaskTable.misc1, - pViaModeTable->tv2MaskTable.misc2, - pViaModeTable->tv2MaskTable.numTV, - pViaModeTable->tv2MaskTable.numCRTC1, - pViaModeTable->tv2MaskTable.numCRTC2); - - fprintf(pFile, "static const VIABIOSTV2TableRec tv2Table[] = {\n"); /* tv2Table */ - for (i = 0; i < VIA_BIOS_NUM_TV2; i++) { - fprintf(pFile, " {\n"); - fprintf(pFile, " { "); /* tv2Table.TVNTSCC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.TVNTSCC[] */ - pViaModeTable->tv2Table[i].TVNTSCC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].TVNTSCC[j]); - } - - fprintf(pFile, " { "); /* tv2Table.TVNTSCS[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.TVNTSCS[] */ - pViaModeTable->tv2Table[i].TVNTSCS[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].TVNTSCS[j]); - } - - fprintf(pFile, " { "); /* tv2Table.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.CRTCNTSC1[] */ - pViaModeTable->tv2Table[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* tv2Table.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.MiscNTSC1[] */ - pViaModeTable->tv2Table[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* tv2Table.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.MiscNTSC2[] */ - pViaModeTable->tv2Table[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* tv2Table.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.CRTCNTSC2_8BPP[] */ - pViaModeTable->tv2Table[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* tv2Table.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.CRTCNTSC2_16BPP[] */ - pViaModeTable->tv2Table[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* tv2Table.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.CRTCNTSC2_32BPP[] */ - pViaModeTable->tv2Table[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* tv2Table.PatchNTSC2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.PatchNTSC[] */ - pViaModeTable->tv2Table[i].PatchNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].PatchNTSC2[j]); - } - - fprintf(pFile, " { "); /* tv2Table.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.DotCrawlNTSC[] */ - pViaModeTable->tv2Table[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].DotCrawlNTSC[j]); - } - - fprintf(pFile, " { "); /* tv2Table.TVPALC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.TVPALC[] */ - pViaModeTable->tv2Table[i].TVPALC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].TVPALC[j]); - } - - fprintf(pFile, " { "); /* tv2Table.TVPALS[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.TVPALS[] */ - pViaModeTable->tv2Table[i].TVPALS[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].TVPALS[j]); - } - - fprintf(pFile, " { "); /* tv2Table.CRTCPAL1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.CRTCPAL1[] */ - pViaModeTable->tv2Table[i].CRTCPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].CRTCPAL1[j]); - } - - fprintf(pFile, " { "); /* tv2Table.MiscPAL1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.MiscPAL1[] */ - pViaModeTable->tv2Table[i].MiscPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].MiscPAL1[j]); - } - - fprintf(pFile, " { "); /* tv2Table.MiscPAL2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.MiscPAL2[] */ - pViaModeTable->tv2Table[i].MiscPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].MiscPAL2[j]); - } - - fprintf(pFile, " { "); /* tv2Table.CRTCPAL2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.CRTCPAL2_8BPP[] */ - pViaModeTable->tv2Table[i].CRTCPAL2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].CRTCPAL2_8BPP[j]); - } - - fprintf(pFile, " { "); /* tv2Table.CRTCPAL2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.CRTCPAL2_16BPP[] */ - pViaModeTable->tv2Table[i].CRTCPAL2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].CRTCPAL2_16BPP[j]); - } - - fprintf(pFile, " { "); /* tv2Table.CRTCPAL2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2Table.CRTCPAL2_32BPP[] */ - pViaModeTable->tv2Table[i].CRTCPAL2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].CRTCPAL2_32BPP[j]); - } - - fprintf(pFile, " { "); /* tv2Table.PatchPAL2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X }\n", /* tv2Table.PatchPAL2[] */ - pViaModeTable->tv2Table[i].PatchPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2Table[i].PatchPAL2[j]); - } - - if (i == (VIA_BIOS_NUM_TV2 - 1)) - fprintf(pFile, " }\n};\n\n"); - else - fprintf(pFile, " }, \n"); - } - - /* tv2OverTable */ - fprintf(pFile, "static const VIABIOSTV2TableRec tv2OverTable[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_TV2; i++) { - fprintf(pFile, " {\n"); - fprintf(pFile, " { "); /* tv2OverTable.TVNTSCC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.TVNTSCC[] */ - pViaModeTable->tv2OverTable[i].TVNTSCC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].TVNTSCC[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.TVNTSCS[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.TVNTSCS[] */ - pViaModeTable->tv2OverTable[i].TVNTSCS[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].TVNTSCS[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCNTSC1[] */ - pViaModeTable->tv2OverTable[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.MiscNTSC1[] */ - pViaModeTable->tv2OverTable[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.MiscNTSC2[] */ - pViaModeTable->tv2OverTable[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCNTSC2_8BPP[] */ - pViaModeTable->tv2OverTable[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCNTSC2_16BPP[] */ - pViaModeTable->tv2OverTable[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCNTSC2_32BPP[] */ - pViaModeTable->tv2OverTable[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.PatchNTSC2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.PatchNTSC[] */ - pViaModeTable->tv2OverTable[i].PatchNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].PatchNTSC2[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.DotCrawlNTSC[] */ - pViaModeTable->tv2OverTable[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].DotCrawlNTSC[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.TVPALC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.TVPALC[] */ - pViaModeTable->tv2OverTable[i].TVPALC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].TVPALC[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.TVPALS[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.TVPALS[] */ - pViaModeTable->tv2OverTable[i].TVPALS[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].TVPALS[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.CRTCPAL1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCPAL1[] */ - pViaModeTable->tv2OverTable[i].CRTCPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].CRTCPAL1[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.MiscPAL1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.MiscPAL1[] */ - pViaModeTable->tv2OverTable[i].MiscPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].MiscPAL1[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.MiscPAL2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.MiscPAL2[] */ - pViaModeTable->tv2OverTable[i].MiscPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].MiscPAL2[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.CRTCPAL2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCPAL2_8BPP[] */ - pViaModeTable->tv2OverTable[i].CRTCPAL2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].CRTCPAL2_8BPP[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.CRTCPAL2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCPAL2_16BPP[] */ - pViaModeTable->tv2OverTable[i].CRTCPAL2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].CRTCPAL2_16BPP[j]); - } - - fprintf(pFile, " { "); /* tv2OverTable.CRTCPAL2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCPAL2_32BPP[] */ - pViaModeTable->tv2OverTable[i].CRTCPAL2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].CRTCPAL2_32BPP[j]); - } - - fprintf(pFile, " { "); /* tv2Table.PatchPAL2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X }\n", /* tv2Table.PatchPAL2[] */ - pViaModeTable->tv2OverTable[i].PatchPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv2OverTable[i].PatchPAL2[j]); - } - - if (i == (VIA_BIOS_NUM_TV2 - 1)) - fprintf(pFile, " }\n};\n"); - else - fprintf(pFile, " }, \n"); - } - - fprintf(pFile, "\n"); - fprintf(pFile, "#endif\n"); - - return TRUE; -} -#endif /* CREATE_TV2_HEADERFILE */ -#ifdef CREATE_TV3_HEADERFILE -Bool VIACreateTV3(VIAModeTablePtr pViaModeTable) -{ - int i, j; - FILE *pFile; - - if ((pFile = fopen("via_tv3.h", "w+")) == NULL) { - ErrorF("Can't open \"via_tv3.h\" file!!\n"); - return FALSE; - } - - fprintf(pFile, "#ifndef _VIA_TV3MODETABLE_H\n"); - fprintf(pFile, "#define _VIA_TV3MODETABLE_H\n"); - fprintf(pFile, "\n"); - - /* tv3MaskTable */ - fprintf(pFile, "static const VIABIOSTVMASKTableRec tv3MaskTable = {\n"); - fprintf(pFile, " { "); /* tv3MaskTable.TV[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3MaskTable.TV[] */ - pViaModeTable->tv3MaskTable.TV[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3MaskTable.TV[i]); - } - - fprintf(pFile, " { "); /* tv3MaskTable.CRTC1[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3MaskTable.CRTC1[] */ - pViaModeTable->tv3MaskTable.CRTC1[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3MaskTable.CRTC1[i]); - } - - fprintf(pFile, " { "); /* tv3MaskTable.CRTC2[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3MaskTable.CRTC2[] */ - pViaModeTable->tv3MaskTable.CRTC2[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3MaskTable.CRTC2[i]); - } - - fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n", - pViaModeTable->tv3MaskTable.misc1, - pViaModeTable->tv3MaskTable.misc2, - pViaModeTable->tv3MaskTable.numTV, - pViaModeTable->tv3MaskTable.numCRTC1, - pViaModeTable->tv3MaskTable.numCRTC2); - - /* tv3Table */ - fprintf(pFile, "static const VIABIOSTV3TableRec tv3Table[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_TV3; i++) { - fprintf(pFile, " {\n"); - fprintf(pFile, " { "); /* tv3Table.TVNTSC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.TVNTSC[] */ - pViaModeTable->tv3Table[i].TVNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].TVNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3Table.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.CRTCNTSC1[] */ - pViaModeTable->tv3Table[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* tv3Table.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.MiscNTSC1[] */ - pViaModeTable->tv3Table[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* tv3Table.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.MiscNTSC2[] */ - pViaModeTable->tv3Table[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* tv3Table.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.CRTCNTSC2_8BPP[] */ - pViaModeTable->tv3Table[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* tv3Table.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.CRTCNTSC2_16BPP[] */ - pViaModeTable->tv3Table[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* tv3Table.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.CRTCNTSC2_32BPP[] */ - pViaModeTable->tv3Table[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* tv3Table.PatchNTSC2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.PatchNTSC2[] */ - pViaModeTable->tv3Table[i].PatchNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].PatchNTSC2[j]); - } - - fprintf(pFile, " { "); /* tv3Table.RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.RGBNTSC[] */ - pViaModeTable->tv3Table[i].RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3Table.YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.YCbCrNTSC[] */ - pViaModeTable->tv3Table[i].YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].YCbCrNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3Table.SDTV_RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.SDTV_RGBNTSC[] */ - pViaModeTable->tv3Table[i].SDTV_RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].SDTV_RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3Table.SDTV_YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.SDTV_YCbCrNTSC[] */ - pViaModeTable->tv3Table[i].SDTV_YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].SDTV_YCbCrNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3Table.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.DotCrawlNTSC[] */ - pViaModeTable->tv3Table[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].DotCrawlNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3Table.TVPAL[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.TVPAL[] */ - pViaModeTable->tv3Table[i].TVPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].TVPAL[j]); - } - - fprintf(pFile, " { "); /* tv3Table.CRTCPAL1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.CRTCPAL1[] */ - pViaModeTable->tv3Table[i].CRTCPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].CRTCPAL1[j]); - } - - fprintf(pFile, " { "); /* tv3Table.MiscPAL1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.MiscPAL1[] */ - pViaModeTable->tv3Table[i].MiscPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].MiscPAL1[j]); - } - - fprintf(pFile, " { "); /* tv3Table.MiscPAL2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.MiscPAL2[] */ - pViaModeTable->tv3Table[i].MiscPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].MiscPAL2[j]); - } - - fprintf(pFile, " { "); /* tv3Table.CRTCPAL2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.CRTCPAL2_8BPP[] */ - pViaModeTable->tv3Table[i].CRTCPAL2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].CRTCPAL2_8BPP[j]); - } - - fprintf(pFile, " { "); /* tv3Table.CRTCPAL2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.CRTCPAL2_16BPP[] */ - pViaModeTable->tv3Table[i].CRTCPAL2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].CRTCPAL2_16BPP[j]); - } - - fprintf(pFile, " { "); /* tv3Table.CRTCPAL2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.CRTCPAL2_32BPP[] */ - pViaModeTable->tv3Table[i].CRTCPAL2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].CRTCPAL2_32BPP[j]); - } - - fprintf(pFile, " { "); /* tv3Table.PatchPAL2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.PatchPAL2[] */ - pViaModeTable->tv3Table[i].PatchPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].PatchPAL2[j]); - } - - fprintf(pFile, " { "); /* tv3Table.RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.RGBPAL[] */ - pViaModeTable->tv3Table[i].RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].RGBPAL[j]); - } - - fprintf(pFile, " { "); /* tv3Table.YCbCrPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.YCbCrPAL[] */ - pViaModeTable->tv3Table[i].YCbCrPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].YCbCrPAL[j]); - } - - fprintf(pFile, " { "); /* tv3Table.SDTV_RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3Table.SDTV_RGBPAL[] */ - pViaModeTable->tv3Table[i].SDTV_RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].SDTV_RGBPAL[j]); - } - - fprintf(pFile, " { "); /* tv3Table.SDTV_YCbCrPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X }\n", /* tv3Table.SDTV_YCbCrPAL[] */ - pViaModeTable->tv3Table[i].SDTV_YCbCrPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3Table[i].SDTV_YCbCrPAL[j]); - } - - if (i == (VIA_BIOS_NUM_TV3 - 1)) - fprintf(pFile, " }\n};\n\n"); - else - fprintf(pFile, " }, \n"); - } - - /* tv3OverTable */ - fprintf(pFile, "static const VIABIOSTV3TableRec tv3OverTable[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_TV3; i++) { - fprintf(pFile, " {\n"); - fprintf(pFile, " { "); /* tv3OverTable.TVNTSC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.TVNTSC[] */ - pViaModeTable->tv3OverTable[i].TVNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].TVNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCNTSC1[] */ - pViaModeTable->tv3OverTable[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.MiscNTSC1[] */ - pViaModeTable->tv3OverTable[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.MiscNTSC2[] */ - pViaModeTable->tv3OverTable[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCNTSC2_8BPP[] */ - pViaModeTable->tv3OverTable[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCNTSC2_16BPP[] */ - pViaModeTable->tv3OverTable[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCNTSC2_32BPP[] */ - pViaModeTable->tv3OverTable[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.PatchNTSC2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.PatchNTSC2[] */ - pViaModeTable->tv3OverTable[i].PatchNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].PatchNTSC2[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.RGBNTSC[] */ - pViaModeTable->tv3OverTable[i].RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.YCbCrNTSC[] */ - pViaModeTable->tv3OverTable[i].YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].YCbCrNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.SDTV_RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.SDTV_RGBNTSC[] */ - pViaModeTable->tv3OverTable[i].SDTV_RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].SDTV_RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.SDTV_YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.SDTV_YCbCrNTSC[] */ - pViaModeTable->tv3OverTable[i].SDTV_YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].SDTV_YCbCrNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.DotCrawlNTSC[] */ - pViaModeTable->tv3OverTable[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].DotCrawlNTSC[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.TVPAL[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.TVPAL[] */ - pViaModeTable->tv3OverTable[i].TVPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].TVPAL[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.CRTCPAL1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCPAL1[] */ - pViaModeTable->tv3OverTable[i].CRTCPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].CRTCPAL1[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.MiscPAL1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.MiscPAL1[] */ - pViaModeTable->tv3OverTable[i].MiscPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].MiscPAL1[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.MiscPAL2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.MiscPAL2[] */ - pViaModeTable->tv3OverTable[i].MiscPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].MiscPAL2[j]); - } - - fprintf(pFile, " { "); /* tv3Over.CRTCPAL2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCPAL2_8BPP[] */ - pViaModeTable->tv3OverTable[i].CRTCPAL2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].CRTCPAL2_8BPP[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.CRTCPAL2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCPAL2_16BPP[] */ - pViaModeTable->tv3OverTable[i].CRTCPAL2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].CRTCPAL2_16BPP[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.CRTCPAL2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCPAL2_32BPP[] */ - pViaModeTable->tv3OverTable[i].CRTCPAL2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].CRTCPAL2_32BPP[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.PatchPAL2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.PatchPAL2[] */ - pViaModeTable->tv3OverTable[i].PatchPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].PatchPAL2[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.RGBPAL[] */ - pViaModeTable->tv3OverTable[i].RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].RGBPAL[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.YCbCrPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.YCbCrPAL[] */ - pViaModeTable->tv3OverTable[i].YCbCrPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].YCbCrPAL[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.SDTV_RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* tv3OverTable.SDTV_RGBPAL[] */ - pViaModeTable->tv3OverTable[i].SDTV_RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].SDTV_RGBPAL[j]); - } - - fprintf(pFile, " { "); /* tv3OverTable.SDTV_YCbCrPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X }\n", /* tv3OverTable.SDTV_YCbCrPAL[] */ - pViaModeTable->tv3OverTable[i].SDTV_YCbCrPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->tv3OverTable[i].SDTV_YCbCrPAL[j]); - } - - if (i == (VIA_BIOS_NUM_TV3 - 1)) - fprintf(pFile, " }\n};\n"); - else - fprintf(pFile, " }, \n"); - } - - fprintf(pFile, "\n"); - fprintf(pFile, "#endif\n"); - - return TRUE; -} -#endif /* CREATE_TV3_HEADERFILE */ - -#ifdef CREATE_VT1622A_HEADERFILE -Bool VIACreateVT1622A(VIAModeTablePtr pViaModeTable) -{ - int i, j; - FILE *pFile; - - if ((pFile = fopen("via_vt1622a.h", "w+")) == NULL) { - ErrorF("Can't open \"via_vt1622a.h\" file!!\n"); - return FALSE; - } - - fprintf(pFile, "#ifndef _VIA_VT1622AMODETABLE_H\n"); - fprintf(pFile, "#define _VIA_VT1622AMODETABLE_H\n"); - fprintf(pFile, "\n"); - - /* tv3MaskTable */ - fprintf(pFile, "static const VIABIOSTVMASKTableRec vt1622aMaskTable = {\n"); - fprintf(pFile, " { "); /* vt1622aMaskTable.TV[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aMaskTable.TV[] */ - pViaModeTable->vt1622aMaskTable.TV[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aMaskTable.TV[i]); - } - - fprintf(pFile, " { "); /* vt1622aMaskTable.CRTC1[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aMaskTable.CRTC1[] */ - pViaModeTable->vt1622aMaskTable.CRTC1[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aMaskTable.CRTC1[i]); - } - - fprintf(pFile, " { "); /* vt1622aMaskTable.CRTC2[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aMaskTable.CRTC2[] */ - pViaModeTable->vt1622aMaskTable.CRTC2[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aMaskTable.CRTC2[i]); - } - - fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n", - pViaModeTable->vt1622aMaskTable.misc1, - pViaModeTable->vt1622aMaskTable.misc2, - pViaModeTable->vt1622aMaskTable.numTV, - pViaModeTable->vt1622aMaskTable.numCRTC1, - pViaModeTable->vt1622aMaskTable.numCRTC2); - - /* tv3Table */ - fprintf(pFile, "static const VIABIOSTV3TableRec vt1622aTable[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_TV3; i++) { - fprintf(pFile, " {\n"); - fprintf(pFile, " { "); /* vt1622aTable.TVNTSC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.TVNTSC[] */ - pViaModeTable->vt1622aTable[i].TVNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].TVNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCNTSC1[] */ - pViaModeTable->vt1622aTable[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.MiscNTSC1[] */ - pViaModeTable->vt1622aTable[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.MiscNTSC2[] */ - pViaModeTable->vt1622aTable[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCNTSC2_8BPP[] */ - pViaModeTable->vt1622aTable[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCNTSC2_16BPP[] */ - pViaModeTable->vt1622aTable[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCNTSC2_32BPP[] */ - pViaModeTable->vt1622aTable[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.PatchNTSC2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.PatchNTSC2[] */ - pViaModeTable->vt1622aTable[i].PatchNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].PatchNTSC2[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.RGBNTSC[] */ - pViaModeTable->vt1622aTable[i].RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.YCbCrNTSC[] */ - pViaModeTable->vt1622aTable[i].YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].YCbCrNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.SDTV_RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.SDTV_RGBNTSC[] */ - pViaModeTable->vt1622aTable[i].SDTV_RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].SDTV_RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.SDTV_YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.SDTV_YCbCrNTSC[] */ - pViaModeTable->vt1622aTable[i].SDTV_YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].SDTV_YCbCrNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.DotCrawlNTSC[] */ - pViaModeTable->vt1622aTable[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].DotCrawlNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.TVPAL[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.TVPAL[] */ - pViaModeTable->vt1622aTable[i].TVPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].TVPAL[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.CRTCPAL1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCPAL1[] */ - pViaModeTable->vt1622aTable[i].CRTCPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].CRTCPAL1[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.MiscPAL1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.MiscPAL1[] */ - pViaModeTable->vt1622aTable[i].MiscPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].MiscPAL1[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.MiscPAL2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.MiscPAL2[] */ - pViaModeTable->vt1622aTable[i].MiscPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].MiscPAL2[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.CRTCPAL2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCPAL2_8BPP[] */ - pViaModeTable->vt1622aTable[i].CRTCPAL2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].CRTCPAL2_8BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.CRTCPAL2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCPAL2_16BPP[] */ - pViaModeTable->vt1622aTable[i].CRTCPAL2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].CRTCPAL2_16BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.CRTCPAL2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCPAL2_32BPP[] */ - pViaModeTable->vt1622aTable[i].CRTCPAL2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].CRTCPAL2_32BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.PatchPAL2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.PatchPAL2[] */ - pViaModeTable->vt1622aTable[i].PatchPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].PatchPAL2[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.RGBPAL[] */ - pViaModeTable->vt1622aTable[i].RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].RGBPAL[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.YCbCrPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.YCbCrPAL[] */ - pViaModeTable->vt1622aTable[i].YCbCrPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].YCbCrPAL[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.SDTV_RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aTable.SDTV_RGBPAL[] */ - pViaModeTable->vt1622aTable[i].SDTV_RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].SDTV_RGBPAL[j]); - } - - fprintf(pFile, " { "); /* vt1622aTable.SDTV_YCbCrPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X }\n", /* vt1622aTable.SDTV_YCbCrPAL[] */ - pViaModeTable->vt1622aTable[i].SDTV_YCbCrPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aTable[i].SDTV_YCbCrPAL[j]); - } - - if (i == (VIA_BIOS_NUM_TV3 - 1)) - fprintf(pFile, " }\n};\n\n"); - else - fprintf(pFile, " }, \n"); - } - - /* tv3OverTable */ - fprintf(pFile, "static const VIABIOSTV3TableRec vt1622aOverTable[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_TV3; i++) { - fprintf(pFile, " {\n"); - fprintf(pFile, " { "); /* vt1622aOverTable.TVNTSC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.TVNTSC[] */ - pViaModeTable->vt1622aOverTable[i].TVNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].TVNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCNTSC1[] */ - pViaModeTable->vt1622aOverTable[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.MiscNTSC1[] */ - pViaModeTable->vt1622aOverTable[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.MiscNTSC2[] */ - pViaModeTable->vt1622aOverTable[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCNTSC2_8BPP[] */ - pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCNTSC2_16BPP[] */ - pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCNTSC2_32BPP[] */ - pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.PatchNTSC2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.PatchNTSC2[] */ - pViaModeTable->vt1622aOverTable[i].PatchNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].PatchNTSC2[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.RGBNTSC[] */ - pViaModeTable->vt1622aOverTable[i].RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.YCbCrNTSC[] */ - pViaModeTable->vt1622aOverTable[i].YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].YCbCrNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.SDTV_RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.SDTV_RGBNTSC[] */ - pViaModeTable->vt1622aOverTable[i].SDTV_RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].SDTV_RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.SDTV_YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.SDTV_YCbCrNTSC[] */ - pViaModeTable->vt1622aOverTable[i].SDTV_YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].SDTV_YCbCrNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.DotCrawlNTSC[] */ - pViaModeTable->vt1622aOverTable[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].DotCrawlNTSC[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.TVPAL[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.TVPAL[] */ - pViaModeTable->vt1622aOverTable[i].TVPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].TVPAL[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.CRTCPAL1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCPAL1[] */ - pViaModeTable->vt1622aOverTable[i].CRTCPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].CRTCPAL1[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.MiscPAL1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.MiscPAL1[] */ - pViaModeTable->vt1622aOverTable[i].MiscPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].MiscPAL1[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.MiscPAL2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.MiscPAL2[] */ - pViaModeTable->vt1622aOverTable[i].MiscPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].MiscPAL2[j]); - } - - fprintf(pFile, " { "); /* vt1622aOver.CRTCPAL2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCPAL2_8BPP[] */ - pViaModeTable->vt1622aOverTable[i].CRTCPAL2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].CRTCPAL2_8BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.CRTCPAL2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCPAL2_16BPP[] */ - pViaModeTable->vt1622aOverTable[i].CRTCPAL2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].CRTCPAL2_16BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.CRTCPAL2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCPAL2_32BPP[] */ - pViaModeTable->vt1622aOverTable[i].CRTCPAL2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].CRTCPAL2_32BPP[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.PatchPAL2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.PatchPAL2[] */ - pViaModeTable->vt1622aOverTable[i].PatchPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].PatchPAL2[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.RGBPAL[] */ - pViaModeTable->vt1622aOverTable[i].RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].RGBPAL[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.YCbCrPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.YCbCrPAL[] */ - pViaModeTable->vt1622aOverTable[i].YCbCrPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].YCbCrPAL[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.SDTV_RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* vt1622aOverTable.SDTV_RGBPAL[] */ - pViaModeTable->vt1622aOverTable[i].SDTV_RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].SDTV_RGBPAL[j]); - } - - fprintf(pFile, " { "); /* vt1622aOverTable.SDTV_YCbCrPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X }\n", /* vt1622aOverTable.SDTV_YCbCrPAL[] */ - pViaModeTable->vt1622aOverTable[i].SDTV_YCbCrPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->vt1622aOverTable[i].SDTV_YCbCrPAL[j]); - } - - if (i == (VIA_BIOS_NUM_TV3 - 1)) - fprintf(pFile, " }\n};\n"); - else - fprintf(pFile, " }, \n"); - } - - fprintf(pFile, "\n"); - fprintf(pFile, "#endif\n"); - - return TRUE; -} -#endif /* CREATE_VT1622A_HEADERFILE */ - -#ifdef CREATE_SAA7108_HEADERFILE -Bool VIACreateSAA7108(VIAModeTablePtr pViaModeTable) -{ - int i, j; - FILE *pFile; - - if ((pFile = fopen("via_saa7108.h", "w+")) == NULL) { - ErrorF("Can't open \"via_saa7108.h\" file!!\n"); - return FALSE; - } - - fprintf(pFile, "#ifndef _VIA_SAA7108MODETABLE_H\n"); - fprintf(pFile, "#define _VIA_SAA7108MODETABLE_H\n"); - fprintf(pFile, "\n"); - - /* saa7108MaskTable */ - fprintf(pFile, "static const VIABIOSSAA7108TVMASKTableRec saa7108MaskTable = {\n"); - fprintf(pFile, " { "); /* saa7108MaskTable.TV[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; i++) { - if (i == (VIA_BIOS_MAX_NUM_SAA7108_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108MaskTable.TV[] */ - pViaModeTable->saa7108MaskTable.TV[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108MaskTable.TV[i]); - } - - fprintf(pFile, " { "); /* saa7108MaskTable.CRTC1[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108MaskTable.CRTC1[] */ - pViaModeTable->saa7108MaskTable.CRTC1[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108MaskTable.CRTC1[i]); - } - - fprintf(pFile, " { "); /* saa7108MaskTable.CRTC2[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108MaskTable.CRTC2[] */ - pViaModeTable->saa7108MaskTable.CRTC2[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108MaskTable.CRTC2[i]); - } - - fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n", - pViaModeTable->saa7108MaskTable.misc1, - pViaModeTable->saa7108MaskTable.misc2, - pViaModeTable->saa7108MaskTable.numTV, - pViaModeTable->saa7108MaskTable.numCRTC1, - pViaModeTable->saa7108MaskTable.numCRTC2); - - /* saa7108Table */ - fprintf(pFile, "static const VIABIOSSAA7108TableRec saa7108Table[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_SAA7108; i++) { - fprintf(pFile, " {\n"); - fprintf(pFile, " { "); /* saa7108Table.TVNTSC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_SAA7108_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.TVNTSC[] */ - pViaModeTable->saa7108Table[i].TVNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].TVNTSC[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCNTSC1[] */ - pViaModeTable->saa7108Table[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.MiscNTSC1[] */ - pViaModeTable->saa7108Table[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.MiscNTSC2[] */ - pViaModeTable->saa7108Table[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCNTSC2_8BPP[] */ - pViaModeTable->saa7108Table[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCNTSC2_16BPP[] */ - pViaModeTable->saa7108Table[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCNTSC2_32BPP[] */ - pViaModeTable->saa7108Table[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.PatchNTSC2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.PatchNTSC2[] */ - pViaModeTable->saa7108Table[i].PatchNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].PatchNTSC2[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.RGBNTSC[] */ - pViaModeTable->saa7108Table[i].RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.YCbCrNTSC[] */ - pViaModeTable->saa7108Table[i].YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].YCbCrNTSC[j]); - } -#if 0 - fprintf(pFile, " { "); /* saa7108Table.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.DotCrawlNTSC[] */ - pViaModeTable->saa7108Table[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].DotCrawlNTSC[j]); - } -#endif - fprintf(pFile, " { "); /* saa7108Table.TVPAL[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_SAA7108_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.TVPAL[] */ - pViaModeTable->saa7108Table[i].TVPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].TVPAL[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.CRTCPAL1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCPAL1[] */ - pViaModeTable->saa7108Table[i].CRTCPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].CRTCPAL1[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.MiscPAL1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.MiscPAL1[] */ - pViaModeTable->saa7108Table[i].MiscPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].MiscPAL1[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.MiscPAL2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.MiscPAL2[] */ - pViaModeTable->saa7108Table[i].MiscPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].MiscPAL2[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.CRTCPAL2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCPAL2_8BPP[] */ - pViaModeTable->saa7108Table[i].CRTCPAL2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].CRTCPAL2_8BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.CRTCPAL2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCPAL2_16BPP[] */ - pViaModeTable->saa7108Table[i].CRTCPAL2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].CRTCPAL2_16BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.CRTCPAL2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCPAL2_32BPP[] */ - pViaModeTable->saa7108Table[i].CRTCPAL2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].CRTCPAL2_32BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.PatchPAL2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.PatchPAL2[] */ - pViaModeTable->saa7108Table[i].PatchPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].PatchPAL2[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.RGBPAL[] */ - pViaModeTable->saa7108Table[i].RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].RGBPAL[j]); - } - - fprintf(pFile, " { "); /* saa7108Table.YCbCrPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* saa7108Table.YCbCrPAL[] */ - pViaModeTable->saa7108Table[i].YCbCrPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108Table[i].YCbCrPAL[j]); - } - - if (i == (VIA_BIOS_NUM_SAA7108 - 1)) - fprintf(pFile, " }\n};\n\n"); - else - fprintf(pFile, " }, \n"); - } - - /* saa7108OverTable */ - fprintf(pFile, "static const VIABIOSSAA7108TableRec saa7108OverTable[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_SAA7108; i++) { - fprintf(pFile, " {\n"); - fprintf(pFile, " { "); /* saa7108OverTable.TVNTSC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_SAA7108_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.TVNTSC[] */ - pViaModeTable->saa7108OverTable[i].TVNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].TVNTSC[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCNTSC1[] */ - pViaModeTable->saa7108OverTable[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.MiscNTSC1[] */ - pViaModeTable->saa7108OverTable[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.MiscNTSC2[] */ - pViaModeTable->saa7108OverTable[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCNTSC2_8BPP[] */ - pViaModeTable->saa7108OverTable[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCNTSC2_16BPP[] */ - pViaModeTable->saa7108OverTable[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCNTSC2_32BPP[] */ - pViaModeTable->saa7108OverTable[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.PatchNTSC2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.PatchNTSC2[] */ - pViaModeTable->saa7108OverTable[i].PatchNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].PatchNTSC2[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.RGBNTSC[] */ - pViaModeTable->saa7108OverTable[i].RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].RGBNTSC[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.YCbCrNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.YCbCrNTSC[] */ - pViaModeTable->saa7108OverTable[i].YCbCrNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].YCbCrNTSC[j]); - } -#if 0 - fprintf(pFile, " { "); /* saa7108OverTable.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.DotCrawlNTSC[] */ - pViaModeTable->saa7108OverTable[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].DotCrawlNTSC[j]); - } -#endif - fprintf(pFile, " { "); /* saa7108OverTable.TVPAL[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_SAA7108_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.TVPAL[] */ - pViaModeTable->saa7108OverTable[i].TVPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].TVPAL[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.CRTCPAL1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCPAL1[] */ - pViaModeTable->saa7108OverTable[i].CRTCPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].CRTCPAL1[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.MiscPAL1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.MiscPAL1[] */ - pViaModeTable->saa7108OverTable[i].MiscPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].MiscPAL1[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.MiscPAL2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.MiscPAL2[] */ - pViaModeTable->saa7108OverTable[i].MiscPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].MiscPAL2[j]); - } - - fprintf(pFile, " { "); /* tv3Over.CRTCPAL2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCPAL2_8BPP[] */ - pViaModeTable->saa7108OverTable[i].CRTCPAL2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].CRTCPAL2_8BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.CRTCPAL2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCPAL2_16BPP[] */ - pViaModeTable->saa7108OverTable[i].CRTCPAL2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].CRTCPAL2_16BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.CRTCPAL2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCPAL2_32BPP[] */ - pViaModeTable->saa7108OverTable[i].CRTCPAL2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].CRTCPAL2_32BPP[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.PatchPAL2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.PatchPAL2[] */ - pViaModeTable->saa7108OverTable[i].PatchPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].PatchPAL2[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.RGBPAL[] */ - pViaModeTable->saa7108OverTable[i].RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].RGBPAL[j]); - } - - fprintf(pFile, " { "); /* saa7108OverTable.YCbCrPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* saa7108OverTable.YCbCrPAL[] */ - pViaModeTable->saa7108OverTable[i].YCbCrPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->saa7108OverTable[i].YCbCrPAL[j]); - } - - if (i == (VIA_BIOS_NUM_SAA7108 - 1)) - fprintf(pFile, " }\n};\n"); - else - fprintf(pFile, " }, \n"); - } - - fprintf(pFile, "\n"); - fprintf(pFile, "#endif\n"); - - return TRUE; -} -#endif /* CREATE_SAA7108_HEADERFILE */ - -#ifdef CREATE_CH7019_HEADERFILE -Bool VIACreateCH7019(VIAModeTablePtr pViaModeTable) -{ - int i, j; - FILE *pFile; - - if ((pFile = fopen("via_ch7019.h", "w+")) == NULL) { - ErrorF("Can't open \"via_ch7019.h\" file!!\n"); - return FALSE; - } - - fprintf(pFile, "#ifndef _VIA_CH7019MODETABLE_H\n"); - fprintf(pFile, "#define _VIA_CH7019MODETABLE_H\n"); - fprintf(pFile, "\n"); - - /* ch7019MaskTable */ - fprintf(pFile, "static const VIABIOSTVMASKTableRec ch7019MaskTable = {\n"); - fprintf(pFile, " { "); /* ch7019MaskTable.TV[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019MaskTable.TV[] */ - pViaModeTable->ch7019MaskTable.TV[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019MaskTable.TV[i]); - } - - fprintf(pFile, " { "); /* ch7019MaskTable.CRTC1[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019MaskTable.CRTC1[] */ - pViaModeTable->ch7019MaskTable.CRTC1[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019MaskTable.CRTC1[i]); - } - - fprintf(pFile, " { "); /* ch7019MaskTable.CRTC2[] */ - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) { - if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019MaskTable.CRTC2[] */ - pViaModeTable->ch7019MaskTable.CRTC2[i]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019MaskTable.CRTC2[i]); - } - - fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n", - pViaModeTable->ch7019MaskTable.misc1, - pViaModeTable->ch7019MaskTable.misc2, - pViaModeTable->ch7019MaskTable.numTV, - pViaModeTable->ch7019MaskTable.numCRTC1, - pViaModeTable->ch7019MaskTable.numCRTC2); - - /* ch7019Table */ - fprintf(pFile, "static const VIABIOSCH7019TableRec ch7019Table[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_CH7019; i++) { - fprintf(pFile, " {\n"); - fprintf(pFile, " { "); /* ch7019Table.TVNTSC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.TVNTSC[] */ - pViaModeTable->ch7019Table[i].TVNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].TVNTSC[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCNTSC1[] */ - pViaModeTable->ch7019Table[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.MiscNTSC1[] */ - pViaModeTable->ch7019Table[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.MiscNTSC2[] */ - pViaModeTable->ch7019Table[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCNTSC2_8BPP[] */ - pViaModeTable->ch7019Table[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCNTSC2_16BPP[] */ - pViaModeTable->ch7019Table[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCNTSC2_32BPP[] */ - pViaModeTable->ch7019Table[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.PatchNTSC2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.PatchNTSC2[] */ - pViaModeTable->ch7019Table[i].PatchNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].PatchNTSC2[j]); - } -#if 0 - fprintf(pFile, " { "); /* ch7019Table.RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.RGBNTSC[] */ - pViaModeTable->ch7019Table[i].RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].RGBNTSC[j]); - } -#endif - fprintf(pFile, " { "); /* ch7019Table.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.DotCrawlNTSC[] */ - pViaModeTable->ch7019Table[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].DotCrawlNTSC[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.TVPAL[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.TVPAL[] */ - pViaModeTable->ch7019Table[i].TVPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].TVPAL[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.CRTCPAL1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCPAL1[] */ - pViaModeTable->ch7019Table[i].CRTCPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].CRTCPAL1[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.MiscPAL1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.MiscPAL1[] */ - pViaModeTable->ch7019Table[i].MiscPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].MiscPAL1[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.MiscPAL2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.MiscPAL2[] */ - pViaModeTable->ch7019Table[i].MiscPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].MiscPAL2[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.CRTCPAL2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCPAL2_8BPP[] */ - pViaModeTable->ch7019Table[i].CRTCPAL2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].CRTCPAL2_8BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.CRTCPAL2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCPAL2_16BPP[] */ - pViaModeTable->ch7019Table[i].CRTCPAL2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].CRTCPAL2_16BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.CRTCPAL2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCPAL2_32BPP[] */ - pViaModeTable->ch7019Table[i].CRTCPAL2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].CRTCPAL2_32BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019Table.PatchPAL2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.PatchPAL2[] */ - pViaModeTable->ch7019Table[i].PatchPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].PatchPAL2[j]); - } -#if 0 - fprintf(pFile, " { "); /* ch7019Table.RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* ch7019Table.RGBPAL[] */ - pViaModeTable->ch7019Table[i].RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019Table[i].RGBPAL[j]); - } -#endif - if (i == (VIA_BIOS_NUM_CH7019 - 1)) - fprintf(pFile, " }\n};\n\n"); - else - fprintf(pFile, " }, \n"); - } - - /* ch7019OverTable */ - fprintf(pFile, "static const VIABIOSCH7019TableRec ch7019OverTable[] = {\n"); - for (i = 0; i < VIA_BIOS_NUM_CH7019; i++) { - fprintf(pFile, " {\n"); - fprintf(pFile, " { "); /* ch7019OverTable.TVNTSC[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.TVNTSC[] */ - pViaModeTable->ch7019OverTable[i].TVNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].TVNTSC[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.CRTCNTSC1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCNTSC1[] */ - pViaModeTable->ch7019OverTable[i].CRTCNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].CRTCNTSC1[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.MiscNTSC1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.MiscNTSC1[] */ - pViaModeTable->ch7019OverTable[i].MiscNTSC1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].MiscNTSC1[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.MiscNTSC2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.MiscNTSC2[] */ - pViaModeTable->ch7019OverTable[i].MiscNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].MiscNTSC2[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.CRTCNTSC2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCNTSC2_8BPP[] */ - pViaModeTable->ch7019OverTable[i].CRTCNTSC2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].CRTCNTSC2_8BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.CRTCNTSC2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCNTSC2_16BPP[] */ - pViaModeTable->ch7019OverTable[i].CRTCNTSC2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].CRTCNTSC2_16BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.CRTCNTSC2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCNTSC2_32BPP[] */ - pViaModeTable->ch7019OverTable[i].CRTCNTSC2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].CRTCNTSC2_32BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.PatchNTSC2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.PatchNTSC2[] */ - pViaModeTable->ch7019OverTable[i].PatchNTSC2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].PatchNTSC2[j]); - } -#if 0 - fprintf(pFile, " { "); /* ch7019OverTable.RGBNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.RGBNTSC[] */ - pViaModeTable->ch7019OverTable[i].RGBNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].RGBNTSC[j]); - } -#endif - fprintf(pFile, " { "); /* ch7019OverTable.DotCrawlNTSC[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.DotCrawlNTSC[] */ - pViaModeTable->ch7019OverTable[i].DotCrawlNTSC[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].DotCrawlNTSC[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.TVPAL[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.TVPAL[] */ - pViaModeTable->ch7019OverTable[i].TVPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].TVPAL[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.CRTCPAL1[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCPAL1[] */ - pViaModeTable->ch7019OverTable[i].CRTCPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].CRTCPAL1[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.MiscPAL1[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.MiscPAL1[] */ - pViaModeTable->ch7019OverTable[i].MiscPAL1[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].MiscPAL1[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.MiscPAL2[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) { - if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.MiscPAL2[] */ - pViaModeTable->ch7019OverTable[i].MiscPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].MiscPAL2[j]); - } - - fprintf(pFile, " { "); /* tv3Over.CRTCPAL2_8BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCPAL2_8BPP[] */ - pViaModeTable->ch7019OverTable[i].CRTCPAL2_8BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].CRTCPAL2_8BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.CRTCPAL2_16BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCPAL2_16BPP[] */ - pViaModeTable->ch7019OverTable[i].CRTCPAL2_16BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].CRTCPAL2_16BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.CRTCPAL2_32BPP[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCPAL2_32BPP[] */ - pViaModeTable->ch7019OverTable[i].CRTCPAL2_32BPP[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].CRTCPAL2_32BPP[j]); - } - - fprintf(pFile, " { "); /* ch7019OverTable.PatchPAL2[] */ - for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) { - if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.PatchPAL2[] */ - pViaModeTable->ch7019OverTable[i].PatchPAL2[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].PatchPAL2[j]); - } -#if 0 - fprintf(pFile, " { "); /* ch7019OverTable.RGBPAL[] */ - for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) { - if (j == (VIA_BIOS_NUM_TV_OTHER - 1)) - fprintf(pFile, "%#X },\n", /* ch7019OverTable.RGBPAL[] */ - pViaModeTable->ch7019OverTable[i].RGBPAL[j]); - else - fprintf(pFile, "%#X, ", - pViaModeTable->ch7019OverTable[i].RGBPAL[j]); - } -#endif - if (i == (VIA_BIOS_NUM_CH7019 - 1)) - fprintf(pFile, " }\n};\n"); - else - fprintf(pFile, " }, \n"); - } - - fprintf(pFile, "\n"); - fprintf(pFile, "#endif\n"); - - return TRUE; -} -#endif /* CREATE_CH7019_HEADERFILE */ - -void VIAGetCH7019Mask(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - unsigned char *pRom; - int i, j, k, m; - CARD16 tmp; - - DEBUG(xf86Msg(X_INFO, "VIAGetCH7019Mask\n")); - /* Get start of TV Mask Table */ - pRom = pTable + VIA_BIOS_TVMASKTAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVMaskTbl: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0, k = 0; i < 9; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->ch7019MaskTable.TV[j] = 0xFF; - k++; - } - else { - pViaModeTable->ch7019MaskTable.TV[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->ch7019MaskTable.numTV = k; - - for (i = 0, j = 0, k = 0; i < 2; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->ch7019MaskTable.CRTC1[j] = 0xFF; - k++; - } - else { - pViaModeTable->ch7019MaskTable.CRTC1[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->ch7019MaskTable.numCRTC1 = k; - - pViaModeTable->ch7019MaskTable.misc1 = *pRom++; - - for (i = 0, j = 0, k = 0; i < 2; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->ch7019MaskTable.CRTC2[j] = 0xFF; - k++; - } - else { - pViaModeTable->ch7019MaskTable.CRTC2[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->ch7019MaskTable.numCRTC2 = k; - - pViaModeTable->ch7019MaskTable.misc2 = *pRom++; - -} - -void VIAGetCH7019NTSC(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - VIABIOSCH7019TablePtr pCH7019Tab; - unsigned char *pRom, *pNTSC; - unsigned char *pTVTable; - unsigned char numCRTC; - unsigned char numPatch, numReg; - int vScan, offset; - int i, j, k, n; - - pCH7019Tab = NULL; - pTVTable = NULL; - - DEBUG(xf86Msg(X_INFO, "VIAGetCH7019NTSC\n")); - for (vScan = 0; vScan < 2; vScan++) { - switch (vScan) { - case VIA_TVNORMAL: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_TVMODETAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVModeTbl: %X\n", *((CARD16 *)pRom))); - pTVTable = pBIOS + *((CARD16 *)pRom); - - pCH7019Tab = pViaModeTable->ch7019Table; - /* HSoffset = 2; */ - break; - case VIA_TVOVER: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_MODEOVERTAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVModeOverTbl: %X\n", *((CARD16 *)pRom))); - pTVTable = pBIOS + *((CARD16 *)pRom); - - pCH7019Tab = pViaModeTable->ch7019OverTable; - /* HSoffset = 38; */ - break; - } - - /* offset: skip MODE3, MODE13 */ - for (offset = 11, n = 0; n < VIA_BIOS_NUM_CH7019; offset += 5, n++) { - - /* Get pointer table of each mode */ - pRom = pTVTable + offset; - - if ((*((CARD16 *)pRom)) != 0) { - pNTSC = pBIOS + *((CARD16 *)pRom); - - /* Get start of TV Table */ - pRom = pNTSC + 1; - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0; i < pViaModeTable->ch7019MaskTable.numTV; j++) { - if (pViaModeTable->ch7019MaskTable.TV[j] == 0xFF) { - pCH7019Tab[n].TVNTSC[j] = *pRom++; - i++; - } - } - - numCRTC = *pRom++; - - for (i = 0, j = 0, k = 0; i < numCRTC; j++) { - if (pViaModeTable->ch7019MaskTable.CRTC1[j] == 0xFF) { - if (i >= pViaModeTable->ch7019MaskTable.numCRTC1) { - pCH7019Tab[n].MiscNTSC1[k++] = *pRom++; - i++; - } - else { - pCH7019Tab[n].CRTCNTSC1[j] = *pRom++; - i++; - } - } - } - - for (i = 0, j = 0, k = 0; i < pViaModeTable->ch7019MaskTable.numCRTC2; j++) { - if (pViaModeTable->ch7019MaskTable.CRTC2[j] == 0xFF) { - /* CRTC 65-57 8bpp, 16bpp, 32bpp */ - if (j == 0x15) { - pCH7019Tab[n].CRTCNTSC2_8BPP[j] = *pRom++; - pCH7019Tab[n].CRTCNTSC2_8BPP[j+1] = *pRom++; - pCH7019Tab[n].CRTCNTSC2_8BPP[j+2] = *pRom++; - pCH7019Tab[n].CRTCNTSC2_16BPP[j] = *pRom++; - pCH7019Tab[n].CRTCNTSC2_16BPP[j+1] = *pRom++; - pCH7019Tab[n].CRTCNTSC2_16BPP[j+2] = *pRom++; - pCH7019Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++; - pCH7019Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++; - pCH7019Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i += 3; - } - else { - /* For CRTC 6A-6C */ - if (i >= (pViaModeTable->ch7019MaskTable.numCRTC2 - 3)) { - pCH7019Tab[n].CRTCNTSC2_8BPP[j] = *pRom; - pCH7019Tab[n].CRTCNTSC2_16BPP[j] = *pRom; - pCH7019Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i++; - } - else { - pCH7019Tab[n].CRTCNTSC2_8BPP[j] = *pRom; - pCH7019Tab[n].CRTCNTSC2_16BPP[j] = *pRom; - pCH7019Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i++; - } - } - } - } - - k = 3; - /* LCK 3c5.44-45 */ - if (pViaModeTable->ch7019MaskTable.misc2 & 0x18) { - pCH7019Tab[n].MiscNTSC2[k++] = *pRom++; - pCH7019Tab[n].MiscNTSC2[k++] = *pRom++; - } - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->ch7019MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - pCH7019Tab[n].PatchNTSC2[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get DotCrawl Table */ - pRom = pNTSC + 4; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pCH7019Tab[n].DotCrawlNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pCH7019Tab[n].DotCrawlNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - } - } - } -} - -void VIAGetCH7019PAL(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - VIABIOSCH7019TablePtr pCH7019Tab; - unsigned char *pRom, *pPAL; - unsigned char *pTVTable; - unsigned char numCRTC; - unsigned char numPatch; - int vScan, offset; - int i, j, k, n; - - pCH7019Tab = NULL; - pTVTable = NULL; - - DEBUG(xf86Msg(X_INFO, "VIAGetSAA7108PAL\n")); - for (vScan = 0; vScan < 2; vScan++) { - switch (vScan) { - case VIA_TVNORMAL: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_TVMODETAB_POS; - pTVTable = pBIOS + *((CARD16 *)pRom); - - pCH7019Tab = pViaModeTable->ch7019Table; - /* HSoffset = 4; */ - break; - case VIA_TVOVER: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_MODEOVERTAB_POS; - pTVTable = pBIOS + *((CARD16 *)pRom); - - pCH7019Tab = pViaModeTable->ch7019OverTable; - /* HSoffset = 40; */ - break; - } - - /* offset: skip MODE3, MODE13 */ - for (offset = 13, n = 0; n < VIA_BIOS_NUM_CH7019; offset += 5, n++) { - - /* Get pointer table of each mode */ - pRom = pTVTable + offset; - - if (*((CARD16 *)pRom) != 0) { - pPAL = pBIOS + *((CARD16 *)pRom); - - /* Get start of TV Table */ - pRom = pPAL + 1; - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0; i < pViaModeTable->ch7019MaskTable.numTV; j++) { - if (pViaModeTable->ch7019MaskTable.TV[j] == 0xFF) { - pCH7019Tab[n].TVPAL[j] = *pRom++; - i++; - } - } - - numCRTC = *pRom++; - - for (i = 0, j = 0, k = 0; i < numCRTC; j++) { - if (pViaModeTable->ch7019MaskTable.CRTC1[j] == 0xFF) { - if (i >= pViaModeTable->ch7019MaskTable.numCRTC1) { - pCH7019Tab[n].MiscPAL1[k++] = *pRom++; - i++; - } - else { - pCH7019Tab[n].CRTCPAL1[j] = *pRom++; - i++; - } - } - } - - for (i = 0, j = 0, k = 0; i < pViaModeTable->ch7019MaskTable.numCRTC2; j++) { - if (pViaModeTable->ch7019MaskTable.CRTC2[j] == 0xFF) { - if (j == 0x15) { - pCH7019Tab[n].CRTCPAL2_8BPP[j] = *pRom++; - pCH7019Tab[n].CRTCPAL2_8BPP[j+1] = *pRom++; - pCH7019Tab[n].CRTCPAL2_8BPP[j+2] = *pRom++; - pCH7019Tab[n].CRTCPAL2_16BPP[j] = *pRom++; - pCH7019Tab[n].CRTCPAL2_16BPP[j+1] = *pRom++; - pCH7019Tab[n].CRTCPAL2_16BPP[j+2] = *pRom++; - pCH7019Tab[n].CRTCPAL2_32BPP[j++] = *pRom++; - pCH7019Tab[n].CRTCPAL2_32BPP[j++] = *pRom++; - pCH7019Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i += 3; - } - else { - /* For CRTC 6A-6C */ - if (i >= (pViaModeTable->ch7019MaskTable.numCRTC2 - 3)) { - pCH7019Tab[n].CRTCPAL2_8BPP[j] = *pRom; - pCH7019Tab[n].CRTCPAL2_16BPP[j] = *pRom; - pCH7019Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i++; - } - else { - pCH7019Tab[n].CRTCPAL2_8BPP[j] = *pRom; - pCH7019Tab[n].CRTCPAL2_16BPP[j] = *pRom; - pCH7019Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i++; - } - } - } - } - - k = 3; - /* LCK 3c5.44-45 */ - if (pViaModeTable->ch7019MaskTable.misc2 & 0x18) { - pCH7019Tab[n].MiscPAL2[k++] = *pRom++; - pCH7019Tab[n].MiscPAL2[k++] = *pRom++; - } - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->ch7019MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - pCH7019Tab[n].PatchPAL2[i] = *((CARD16 *)pRom); - pRom += 2; - } - } - } - } -} - -void VIAGetSAA7108Mask(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - unsigned char *pRom; - int i, j, k, m; - CARD16 tmp; - - DEBUG(xf86Msg(X_INFO, "VIAGetSAA7108Mask\n")); - /* Get start of TV Mask Table */ - pRom = pTable + VIA_BIOS_TVMASKTAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVMaskTbl: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0, k = 0; i < 11; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->saa7108MaskTable.TV[j] = 0xFF; - k++; - } - else { - pViaModeTable->saa7108MaskTable.TV[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->saa7108MaskTable.numTV = k; - - for (i = 0, j = 0, k = 0; i < 2; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->saa7108MaskTable.CRTC1[j] = 0xFF; - k++; - } - else { - pViaModeTable->saa7108MaskTable.CRTC1[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->saa7108MaskTable.numCRTC1 = k; - - pViaModeTable->saa7108MaskTable.misc1 = *pRom++; - - for (i = 0, j = 0, k = 0; i < 2; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->saa7108MaskTable.CRTC2[j] = 0xFF; - k++; - } - else { - pViaModeTable->saa7108MaskTable.CRTC2[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->saa7108MaskTable.numCRTC2 = k; - - pViaModeTable->saa7108MaskTable.misc2 = *pRom++; - -} - -void VIAGetSAA7108NTSC(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - VIABIOSSAA7108TablePtr pSAA7108Tab; - unsigned char *pRom, *pNTSC; - unsigned char *pTVTable; - unsigned char numCRTC; - unsigned char numPatch, numReg; - int vScan, offset; - int i, j, k, n; - - pSAA7108Tab = NULL; - pTVTable = NULL; - - DEBUG(xf86Msg(X_INFO, "VIAGetSAA7108NTSC\n")); - for (vScan = 0; vScan < 2; vScan++) { - switch (vScan) { - case VIA_TVNORMAL: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_TVMODETAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVModeTbl: %X\n", *((CARD16 *)pRom))); - pTVTable = pBIOS + *((CARD16 *)pRom); - - pSAA7108Tab = pViaModeTable->saa7108Table; - /* HSoffset = 2; */ - break; - case VIA_TVOVER: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_MODEOVERTAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVModeOverTbl: %X\n", *((CARD16 *)pRom))); - pTVTable = pBIOS + *((CARD16 *)pRom); - - pSAA7108Tab = pViaModeTable->saa7108OverTable; - /* HSoffset = 38; */ - break; - } - - /* offset: skip MODE3, MODE13 */ - for (offset = 11, n = 0; n < VIA_BIOS_NUM_SAA7108; offset += 5, n++) { - - /* Get pointer table of each mode */ - pRom = pTVTable + offset; - - if ((*((CARD16 *)pRom)) != 0) { - pNTSC = pBIOS + *((CARD16 *)pRom); - - /* Get start of TV Table */ - pRom = pNTSC + 1; - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0; i < pViaModeTable->saa7108MaskTable.numTV; j++) { - if (pViaModeTable->saa7108MaskTable.TV[j] == 0xFF) { - pSAA7108Tab[n].TVNTSC[j] = *pRom++; - i++; - } - } - - numCRTC = *pRom++; - - for (i = 0, j = 0, k = 0; i < numCRTC; j++) { - if (pViaModeTable->saa7108MaskTable.CRTC1[j] == 0xFF) { - if (i >= pViaModeTable->saa7108MaskTable.numCRTC1) { - pSAA7108Tab[n].MiscNTSC1[k++] = *pRom++; - i++; - } - else { - pSAA7108Tab[n].CRTCNTSC1[j] = *pRom++; - i++; - } - } - } - - for (i = 0, j = 0, k = 0; i < pViaModeTable->saa7108MaskTable.numCRTC2; j++) { - if (pViaModeTable->saa7108MaskTable.CRTC2[j] == 0xFF) { - /* CRTC 65-57 8bpp, 16bpp, 32bpp */ - if (j == 0x15) { - pSAA7108Tab[n].CRTCNTSC2_8BPP[j] = *pRom++; - pSAA7108Tab[n].CRTCNTSC2_8BPP[j+1] = *pRom++; - pSAA7108Tab[n].CRTCNTSC2_8BPP[j+2] = *pRom++; - pSAA7108Tab[n].CRTCNTSC2_16BPP[j] = *pRom++; - pSAA7108Tab[n].CRTCNTSC2_16BPP[j+1] = *pRom++; - pSAA7108Tab[n].CRTCNTSC2_16BPP[j+2] = *pRom++; - pSAA7108Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++; - pSAA7108Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++; - pSAA7108Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i += 3; - } - else { - /* For CRTC 6A-6C */ - if (i >= (pViaModeTable->saa7108MaskTable.numCRTC2 - 3)) { - pSAA7108Tab[n].CRTCNTSC2_8BPP[j] = *pRom; - pSAA7108Tab[n].CRTCNTSC2_16BPP[j] = *pRom; - pSAA7108Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i++; - } - else { - pSAA7108Tab[n].CRTCNTSC2_8BPP[j] = *pRom; - pSAA7108Tab[n].CRTCNTSC2_16BPP[j] = *pRom; - pSAA7108Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i++; - } - } - } - } - - k = 3; - /* LCK 3c5.44-45 */ - if (pViaModeTable->saa7108MaskTable.misc2 & 0x18) { - pSAA7108Tab[n].MiscNTSC2[k++] = *pRom++; - pSAA7108Tab[n].MiscNTSC2[k++] = *pRom++; - } - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->saa7108MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - pSAA7108Tab[n].PatchNTSC2[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get RGB Table */ - pRom = pNTSC + 4; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pSAA7108Tab[n].RGBNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pSAA7108Tab[n].RGBNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get YCbCr Table */ - pRom = pNTSC + 7; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pSAA7108Tab[n].YCbCrNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pSAA7108Tab[n].YCbCrNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - } - } - } -} - -void VIAGetSAA7108PAL(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - VIABIOSSAA7108TablePtr pSAA7108Tab; - unsigned char *pRom, *pPAL; - unsigned char *pTVTable; - unsigned char numCRTC; - unsigned char numPatch, numReg; - int vScan, offset; - int i, j, k, n; - - pSAA7108Tab = NULL; - pTVTable = NULL; - - DEBUG(xf86Msg(X_INFO, "VIAGetSAA7108PAL\n")); - for (vScan = 0; vScan < 2; vScan++) { - switch (vScan) { - case VIA_TVNORMAL: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_TVMODETAB_POS; - pTVTable = pBIOS + *((CARD16 *)pRom); - - pSAA7108Tab = pViaModeTable->saa7108Table; - /* HSoffset = 4; */ - break; - case VIA_TVOVER: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_MODEOVERTAB_POS; - pTVTable = pBIOS + *((CARD16 *)pRom); - - pSAA7108Tab = pViaModeTable->saa7108OverTable; - /* HSoffset = 40; */ - break; - } - - /* offset: skip MODE3, MODE13 */ - for (offset = 13, n = 0; n < VIA_BIOS_NUM_SAA7108; offset += 5, n++) { - - /* Get pointer table of each mode */ - pRom = pTVTable + offset; - - if (*((CARD16 *)pRom) != 0) { - pPAL = pBIOS + *((CARD16 *)pRom); - - /* Get start of TV Table */ - pRom = pPAL + 1; - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0; i < pViaModeTable->saa7108MaskTable.numTV; j++) { - if (pViaModeTable->saa7108MaskTable.TV[j] == 0xFF) { - pSAA7108Tab[n].TVPAL[j] = *pRom++; - i++; - } - } - - numCRTC = *pRom++; - - for (i = 0, j = 0, k = 0; i < numCRTC; j++) { - if (pViaModeTable->saa7108MaskTable.CRTC1[j] == 0xFF) { - if (i >= pViaModeTable->saa7108MaskTable.numCRTC1) { - pSAA7108Tab[n].MiscPAL1[k++] = *pRom++; - i++; - } - else { - pSAA7108Tab[n].CRTCPAL1[j] = *pRom++; - i++; - } - } - } - - for (i = 0, j = 0, k = 0; i < pViaModeTable->saa7108MaskTable.numCRTC2; j++) { - if (pViaModeTable->saa7108MaskTable.CRTC2[j] == 0xFF) { - if (j == 0x15) { - pSAA7108Tab[n].CRTCPAL2_8BPP[j] = *pRom++; - pSAA7108Tab[n].CRTCPAL2_8BPP[j+1] = *pRom++; - pSAA7108Tab[n].CRTCPAL2_8BPP[j+2] = *pRom++; - pSAA7108Tab[n].CRTCPAL2_16BPP[j] = *pRom++; - pSAA7108Tab[n].CRTCPAL2_16BPP[j+1] = *pRom++; - pSAA7108Tab[n].CRTCPAL2_16BPP[j+2] = *pRom++; - pSAA7108Tab[n].CRTCPAL2_32BPP[j++] = *pRom++; - pSAA7108Tab[n].CRTCPAL2_32BPP[j++] = *pRom++; - pSAA7108Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i += 3; - } - else { - /* For CRTC 6A-6C */ - if (i >= (pViaModeTable->saa7108MaskTable.numCRTC2 - 3)) { - pSAA7108Tab[n].CRTCPAL2_8BPP[j] = *pRom; - pSAA7108Tab[n].CRTCPAL2_16BPP[j] = *pRom; - pSAA7108Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i++; - } - else { - pSAA7108Tab[n].CRTCPAL2_8BPP[j] = *pRom; - pSAA7108Tab[n].CRTCPAL2_16BPP[j] = *pRom; - pSAA7108Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i++; - } - } - } - } - - k = 3; - /* LCK 3c5.44-45 */ - if (pViaModeTable->saa7108MaskTable.misc2 & 0x18) { - pSAA7108Tab[n].MiscPAL2[k++] = *pRom++; - pSAA7108Tab[n].MiscPAL2[k++] = *pRom++; - } - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->saa7108MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - pSAA7108Tab[n].PatchPAL2[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get RGB Table */ - pRom = pPAL + 4; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pSAA7108Tab[n].RGBPAL[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pSAA7108Tab[n].RGBPAL[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get YCbCr Table */ - pRom = pPAL + 7; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pSAA7108Tab[n].YCbCrPAL[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pSAA7108Tab[n].YCbCrPAL[i] = *((CARD16 *)pRom); - pRom += 2; - } - } - } - } -} - -void VIAGetTV2Mask(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - unsigned char *pRom; - int i, j, k, m; - CARD16 tmp; - - DEBUG(xf86Msg(X_INFO, "VIAGetTV2Mask\n")); - /* Get start of TV Mask Table */ - pRom = pTable + VIA_BIOS_TVMASKTAB_POS; - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0, k = 0; i < 9; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->tv2MaskTable.TV[j] = 0xFF; - k++; - } - else { - pViaModeTable->tv2MaskTable.TV[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->tv2MaskTable.numTV = k; - - for (i = 0, j = 0, k = 0; i < 2; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->tv2MaskTable.CRTC1[j] = 0xFF; - k++; - } - else { - pViaModeTable->tv2MaskTable.CRTC1[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->tv2MaskTable.numCRTC1 = k; - - pViaModeTable->tv2MaskTable.misc1 = *pRom++; - - for (i = 0, j = 0, k = 0; i < 2; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->tv2MaskTable.CRTC2[j] = 0xFF; - k++; - } - else { - pViaModeTable->tv2MaskTable.CRTC2[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->tv2MaskTable.numCRTC2 = k; - - pViaModeTable->tv2MaskTable.misc2 = *pRom++; -} - - -void VIAGetTV3Mask(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - unsigned char *pRom; - int i, j, k, m; - CARD16 tmp; - - DEBUG(xf86Msg(X_INFO, "VIAGetTV3Mask\n")); - /* Get start of TV Mask Table */ - pRom = pTable + VIA_BIOS_TVMASKTAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVMaskTbl: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0, k = 0; i < 9; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->tv3MaskTable.TV[j] = 0xFF; - k++; - } - else { - pViaModeTable->tv3MaskTable.TV[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->tv3MaskTable.numTV = k; - - for (i = 0, j = 0, k = 0; i < 2; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->tv3MaskTable.CRTC1[j] = 0xFF; - k++; - } - else { - pViaModeTable->tv3MaskTable.CRTC1[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->tv3MaskTable.numCRTC1 = k; - - pViaModeTable->tv3MaskTable.misc1 = *pRom++; - - for (i = 0, j = 0, k = 0; i < 2; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->tv3MaskTable.CRTC2[j] = 0xFF; - k++; - } - else { - pViaModeTable->tv3MaskTable.CRTC2[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->tv3MaskTable.numCRTC2 = k; - - pViaModeTable->tv3MaskTable.misc2 = *pRom++; - -} - - -void VIAGetTV2NTSC(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - VIABIOSTV2TablePtr pTV2Tab; - unsigned char *pRom, *pNTSC; - unsigned char *pTVTable; - unsigned char numCRTC; - unsigned char numPatch, numReg; - int vScan, offset; - int i, j, k, n; - - pTV2Tab = NULL; - pTVTable = NULL; - - DEBUG(xf86Msg(X_INFO, "VIAGetTV2NTSC\n")); - for (vScan = 0; vScan < 2; vScan++) { - switch (vScan) { - case VIA_TVNORMAL: - /* Get start of TV Table */ - pRom = pTable + VIA_BIOS_TVMODETAB_POS; - pTVTable = pBIOS + *((CARD16 *)pRom); - - pTV2Tab = pViaModeTable->tv2Table; - break; - case VIA_TVOVER: - /* Get start of TV Table */ - pRom = pTable + VIA_BIOS_MODEOVERTAB_POS; - pTVTable = pBIOS + *((CARD16 *)pRom); - - pTV2Tab = pViaModeTable->tv2OverTable; - break; - } - - for (offset = 16, n = 0; n < VIA_BIOS_NUM_TV2; offset += 5, n++) { - - pRom = pTVTable + offset; - pNTSC = pBIOS + *((CARD16 *)pRom); - - pRom = pNTSC + 1; - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numTV; j++) { - if (pViaModeTable->tv2MaskTable.TV[j] == 0xFF) { - pTV2Tab[n].TVNTSCC[j] = *pRom++; - i++; - } - } - - for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numTV; j++) { - if (pViaModeTable->tv2MaskTable.TV[j] == 0xFF) { - if (j >= 0x53) { - pTV2Tab[n].TVNTSCS[j] = *pRom++; - i++; - } - else { - pTV2Tab[n].TVNTSCS[j] = - pTV2Tab[n].TVNTSCC[j]; - i++; - } - } - } - - numCRTC = *pRom++; - - for (i = 0, j = 0, k = 0; i < numCRTC; j++) { - if (pViaModeTable->tv2MaskTable.CRTC1[j] == 0xFF) { - if (i >= pViaModeTable->tv2MaskTable.numCRTC1) { - pTV2Tab[n].MiscNTSC1[k++] = *pRom++; - i++; - } - else { - pTV2Tab[n].CRTCNTSC1[j] = *pRom++; - i++; - } - } - } - - for (i = 0, j = 0, k = 0; i < pViaModeTable->tv2MaskTable.numCRTC2; j++) { - if (pViaModeTable->tv2MaskTable.CRTC2[j] == 0xFF) { - /* CRTC 65-57 8bpp, 16bpp, 32bpp */ - if (j == 0x15) { - pTV2Tab[n].CRTCNTSC2_8BPP[j] = *pRom++; - pTV2Tab[n].CRTCNTSC2_8BPP[j+1] = *pRom++; - pTV2Tab[n].CRTCNTSC2_8BPP[j+2] = *pRom++; - pTV2Tab[n].CRTCNTSC2_16BPP[j] = *pRom++; - pTV2Tab[n].CRTCNTSC2_16BPP[j+1] = *pRom++; - pTV2Tab[n].CRTCNTSC2_16BPP[j+2] = *pRom++; - pTV2Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++; - pTV2Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++; - pTV2Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i += 3; - } - else { - /* For CRTC 6A-6C */ - if (i >= (pViaModeTable->tv2MaskTable.numCRTC2 - 3)) { - pTV2Tab[n].CRTCNTSC2_8BPP[j] = *pRom; - pTV2Tab[n].CRTCNTSC2_16BPP[j] = *pRom; - pTV2Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i++; - } - else { - pTV2Tab[n].CRTCNTSC2_8BPP[j] = *pRom; - pTV2Tab[n].CRTCNTSC2_16BPP[j] = *pRom; - pTV2Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i++; - } - } - } - } - - k = 3; - /* LCK 3c5.44-45 */ - if (pViaModeTable->tv2MaskTable.misc2 & 0x18) { - pTV2Tab[n].MiscNTSC2[k++] = *pRom++; - pTV2Tab[n].MiscNTSC2[k++] = *pRom++; - } - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->tv2MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - pTV2Tab[n].PatchNTSC2[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get DotCrawl Table */ - pRom = pNTSC + 4; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pTV2Tab[n].DotCrawlNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pTV2Tab[n].DotCrawlNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - } - } -} - -void VIAGetTV2PAL(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - VIABIOSTV2TablePtr pTV2Tab; - unsigned char *pRom, *pPAL; - unsigned char *pTVTable; - unsigned char numCRTC; - int vScan, offset; - int numPatch; - int i, j, k, n; - - pTV2Tab = NULL; - pTVTable = NULL; - - DEBUG(xf86Msg(X_INFO, "VIAGetTV2PAL\n")); - for (vScan = 0; vScan < 2; vScan++) { - switch (vScan) { - case VIA_TVNORMAL: - /* Get start of TV Table */ - pRom = pTable + VIA_BIOS_TVMODETAB_POS; - pTVTable = pBIOS + *((CARD16 *)pRom); - - pTV2Tab = pViaModeTable->tv2Table; - break; - case VIA_TVOVER: - /* Get start of TV Table */ - pRom = pTable + VIA_BIOS_MODEOVERTAB_POS; - pTVTable = pBIOS + *((CARD16 *)pRom); - - pTV2Tab = pViaModeTable->tv2OverTable; - break; - } - - for (offset = 18, n = 0; n < VIA_BIOS_NUM_TV2; offset += 5, n++) { - - pRom = pTVTable + offset; - pPAL = pBIOS + *((CARD16 *)pRom); - - pRom = pPAL + 1; - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numTV; j++) { - if (pViaModeTable->tv2MaskTable.TV[j] == 0xFF) { - pTV2Tab[n].TVPALC[j] = *pRom++; - i++; - } - } - - for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numTV; j++) { - if (pViaModeTable->tv2MaskTable.TV[j] == 0xFF) { - if (j >= 0x53) { - pTV2Tab[n].TVPALS[j] = *pRom++; - i++; - } - else { - pTV2Tab[n].TVPALS[j] = - pTV2Tab[n].TVPALC[j]; - i++; - } - } - } - - numCRTC = *pRom++; - - for (i = 0, j = 0, k = 0; i < numCRTC; j++) { - if (pViaModeTable->tv2MaskTable.CRTC1[j] == 0xFF) { - if (i >= pViaModeTable->tv2MaskTable.numCRTC1) { - pTV2Tab[n].MiscPAL1[k++] = *pRom++; - i++; - } - else { - pTV2Tab[n].CRTCPAL1[j] = *pRom++; - i++; - } - } - } - - for (i = 0, j = 0, k = 0; i < pViaModeTable->tv2MaskTable.numCRTC2; j++) { - if (pViaModeTable->tv2MaskTable.CRTC2[j] == 0xFF) { - /* CRTC 65-57 8bpp, 16bpp, 32bpp */ - if (j == 0x15) { - pTV2Tab[n].CRTCPAL2_8BPP[j] = *pRom++; - pTV2Tab[n].CRTCPAL2_8BPP[j+1] = *pRom++; - pTV2Tab[n].CRTCPAL2_8BPP[j+2] = *pRom++; - pTV2Tab[n].CRTCPAL2_16BPP[j] = *pRom++; - pTV2Tab[n].CRTCPAL2_16BPP[j+1] = *pRom++; - pTV2Tab[n].CRTCPAL2_16BPP[j+2] = *pRom++; - pTV2Tab[n].CRTCPAL2_32BPP[j++] = *pRom++; - pTV2Tab[n].CRTCPAL2_32BPP[j++] = *pRom++; - pTV2Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i += 3; - } - else { - /* For CRTC 6A-6C */ - if (i >= (pViaModeTable->tv2MaskTable.numCRTC2 - 3)) { - pTV2Tab[n].CRTCPAL2_8BPP[j] = *pRom; - pTV2Tab[n].CRTCPAL2_16BPP[j] = *pRom; - pTV2Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i++; - } - else { - pTV2Tab[n].CRTCPAL2_8BPP[j] = *pRom; - pTV2Tab[n].CRTCPAL2_16BPP[j] = *pRom; - pTV2Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i++; - } - } - } - } - - k = 3; - /* LCK 3c5.44-45 */ - if (pViaModeTable->tv2MaskTable.misc2 & 0x18) { - pTV2Tab[n].MiscPAL2[k++] = *pRom++; - pTV2Tab[n].MiscPAL2[k++] = *pRom++; - } - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->tv2MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - pTV2Tab[n].PatchPAL2[i] = *((CARD16 *)pRom); - pRom += 2; - } - } - } -} - -void VIAGetTV3NTSC(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - VIABIOSTV3TablePtr pTV3Tab; - unsigned char *pRom, *pNTSC; - unsigned char *pTVTable; - unsigned char numCRTC; - unsigned char numPatch, numReg; - int vScan, offset; - int i, j, k, n; - - pTV3Tab = NULL; - pTVTable = NULL; - - DEBUG(xf86Msg(X_INFO, "VIAGetTV3NTSC\n")); - for (vScan = 0; vScan < 2; vScan++) { - switch (vScan) { - case VIA_TVNORMAL: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_TVMODETAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVModeTbl: %X\n", *((CARD16 *)pRom))); - pTVTable = pBIOS + *((CARD16 *)pRom); - - pTV3Tab = pViaModeTable->tv3Table; - /* HSoffset = 2; */ - break; - case VIA_TVOVER: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_MODEOVERTAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVModeOverTbl: %X\n", *((CARD16 *)pRom))); - pTVTable = pBIOS + *((CARD16 *)pRom); - - pTV3Tab = pViaModeTable->tv3OverTable; - /* HSoffset = 38; */ - break; - } - - /* offset: skip MODE3, MODE13 */ - for (offset = 11, n = 0; n < VIA_BIOS_NUM_TV3; offset += 5, n++) { - - /* Get pointer table of each mode */ - pRom = pTVTable + offset; - - if ((*((CARD16 *)pRom)) != 0) { - - pNTSC = pBIOS + *((CARD16 *)pRom); - - /* Get start of TV Table */ - pRom = pNTSC + 1; - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0; i < pViaModeTable->tv3MaskTable.numTV; j++) { - if (pViaModeTable->tv3MaskTable.TV[j] == 0xFF) { - pTV3Tab[n].TVNTSC[j] = *pRom++; - i++; - } - } - - numCRTC = *pRom++; - - for (i = 0, j = 0, k = 0; i < numCRTC; j++) { - if (pViaModeTable->tv3MaskTable.CRTC1[j] == 0xFF) { - if (i >= pViaModeTable->tv3MaskTable.numCRTC1) { - pTV3Tab[n].MiscNTSC1[k++] = *pRom++; - i++; - } - else { - pTV3Tab[n].CRTCNTSC1[j] = *pRom++; - i++; - } - } - } - - for (i = 0, j = 0, k = 0; i < pViaModeTable->tv3MaskTable.numCRTC2; j++) { - if (pViaModeTable->tv3MaskTable.CRTC2[j] == 0xFF) { - /* CRTC 65-57 8bpp, 16bpp, 32bpp */ - if (j == 0x15) { - pTV3Tab[n].CRTCNTSC2_8BPP[j] = *pRom++; - pTV3Tab[n].CRTCNTSC2_8BPP[j+1] = *pRom++; - pTV3Tab[n].CRTCNTSC2_8BPP[j+2] = *pRom++; - pTV3Tab[n].CRTCNTSC2_16BPP[j] = *pRom++; - pTV3Tab[n].CRTCNTSC2_16BPP[j+1] = *pRom++; - pTV3Tab[n].CRTCNTSC2_16BPP[j+2] = *pRom++; - pTV3Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++; - pTV3Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++; - pTV3Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i += 3; - } - else { - /* For CRTC 6A-6C */ - if (i >= (pViaModeTable->tv3MaskTable.numCRTC2 - 3)) { - pTV3Tab[n].CRTCNTSC2_8BPP[j] = *pRom; - pTV3Tab[n].CRTCNTSC2_16BPP[j] = *pRom; - pTV3Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i++; - } - else { - pTV3Tab[n].CRTCNTSC2_8BPP[j] = *pRom; - pTV3Tab[n].CRTCNTSC2_16BPP[j] = *pRom; - pTV3Tab[n].CRTCNTSC2_32BPP[j] = *pRom++; - i++; - } - } - } - } - - k = 3; - /* LCK 3c5.44-45 */ - if (pViaModeTable->tv3MaskTable.misc2 & 0x18) { - pTV3Tab[n].MiscNTSC2[k++] = *pRom++; - pTV3Tab[n].MiscNTSC2[k++] = *pRom++; - } - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->tv3MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - pTV3Tab[n].PatchNTSC2[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get RGB Table */ - pRom = pNTSC + 4; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pTV3Tab[n].RGBNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pTV3Tab[n].RGBNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get YCbCr Table */ - pRom = pNTSC + 7; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pTV3Tab[n].YCbCrNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pTV3Tab[n].YCbCrNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - -#if 0 - /* Get SDTV_RGB Table */ - pRom = pNTSC + 10; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pTV3Tab[n].SDTV_RGBNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pTV3Tab[n].SDTV_RGBNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get SDTV_YCbCr Table */ - pRom = pNTSC + 13; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pTV3Tab[n].SDTV_YCbCrNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pTV3Tab[n].SDTV_YCbCrNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get DotCrawl Table */ - pRom = pNTSC + 16; - pRom = pBIOS + *((CARD16 *)pRom); -#endif - - /* Get DotCrawl Table */ - pRom = pNTSC + 10; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pTV3Tab[n].DotCrawlNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pTV3Tab[n].DotCrawlNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - } - } - } -} - -void VIAGetFS454Mask(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - unsigned char *pRom; - int i, j, k, m; - CARD16 tmp; - - DEBUG(xf86Msg(X_INFO, "VIAGetFS454Mask\n")); - /* Get start of TV Mask Table */ - pRom = pTable + VIA_BIOS_TVMASKTAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVMaskTbl: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - /* Skip Zero TV Register Mask Table */ - pRom += (9*2); - - for (i = 0, j = 0, k = 0; i < 2; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->fs454MaskTable.CRTC1[j] = 0xFF; - k++; - } - else { - pViaModeTable->fs454MaskTable.CRTC1[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->fs454MaskTable.numCRTC1 = k; - - pViaModeTable->fs454MaskTable.misc1 = *pRom++; - - for (i = 0, j = 0, k = 0; i < 2; i++) { - tmp = *((CARD16 *)pRom); - for (m = 0; m < 16; m++, j++) { - if ((tmp >> m) & 0x01) { - pViaModeTable->fs454MaskTable.CRTC2[j] = 0xFF; - k++; - } - else { - pViaModeTable->fs454MaskTable.CRTC2[j] = 0; - } - } - pRom += 2; - } - pViaModeTable->fs454MaskTable.numCRTC2 = k; - - pViaModeTable->fs454MaskTable.misc2 = *pRom++; - -} - -void VIAGetFS454NTSC(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - VIABIOSFS454TablePtr pFS454Tbl; - unsigned char *pRom, *pNTSC; - unsigned char *pTVTable; - unsigned char numCRTC, numReg; - int vScan, offset; - int i, j, k, n; - - pFS454Tbl = NULL; - pTVTable = NULL; - - DEBUG(xf86Msg(X_INFO, "VIAGetFS454NTSC\n")); - for (vScan = 0; vScan < 2; vScan++) { - switch (vScan) { - case VIA_TVNORMAL: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_TVMODETAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVModeTbl: %X\n", *((CARD16 *)pRom))); - pTVTable = pBIOS + *((CARD16 *)pRom); - - pFS454Tbl = pViaModeTable->fs454Table; - /* HSoffset = 2; */ - break; - case VIA_TVOVER: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_MODEOVERTAB_POS; - DEBUG(xf86Msg(X_INFO, "csTVModeOverTbl: %X\n", *((CARD16 *)pRom))); - pTVTable = pBIOS + *((CARD16 *)pRom); - - pFS454Tbl = pViaModeTable->fs454OverTable; - /* HSoffset = 38; */ - break; - } - - /* offset: skip MODE3, MODE13 */ - for (offset = 11, n = 0; n < VIA_BIOS_NUM_FS454; offset += 5, n++) { - - /* Get pointer table of each mode */ - pRom = pTVTable + offset; - - if ((*((CARD16 *)pRom)) != 0) { - - pNTSC = pBIOS + *((CARD16 *)pRom); - - /* Get start of TV Table */ - pRom = pNTSC + 1; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pFS454Tbl[n].TVNTSC[0] = numReg; - for (i = 1; i < (numReg + 1); i++) { - pFS454Tbl[n].TVNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - - numCRTC = *pRom++; - - for (i = 0, j = 0, k = 0; i < numCRTC; j++) { - if (pViaModeTable->fs454MaskTable.CRTC1[j] == 0xFF) { - if (i >= pViaModeTable->fs454MaskTable.numCRTC1) { - pFS454Tbl[n].MiscNTSC1[k++] = *pRom++; - i++; - } - else { - pFS454Tbl[n].CRTCNTSC1[j] = *pRom++; - i++; - } - } - } - - for (i = 0, j = 0, k = 0; i < pViaModeTable->fs454MaskTable.numCRTC2; j++) { - if (pViaModeTable->fs454MaskTable.CRTC2[j] == 0xFF) { - /* CRTC 65-57 8bpp, 16bpp, 32bpp */ - if (j == 0x15) { - pFS454Tbl[n].CRTCNTSC2_8BPP[j] = *pRom++; - pFS454Tbl[n].CRTCNTSC2_8BPP[j+1] = *pRom++; - pFS454Tbl[n].CRTCNTSC2_8BPP[j+2] = *pRom++; - pFS454Tbl[n].CRTCNTSC2_16BPP[j] = *pRom++; - pFS454Tbl[n].CRTCNTSC2_16BPP[j+1] = *pRom++; - pFS454Tbl[n].CRTCNTSC2_16BPP[j+2] = *pRom++; - pFS454Tbl[n].CRTCNTSC2_32BPP[j++] = *pRom++; - pFS454Tbl[n].CRTCNTSC2_32BPP[j++] = *pRom++; - pFS454Tbl[n].CRTCNTSC2_32BPP[j] = *pRom++; - i += 3; - } - else { - /* For CRTC 6A-6C */ - if (i >= (pViaModeTable->fs454MaskTable.numCRTC2 - 3)) { - pFS454Tbl[n].CRTCNTSC2_8BPP[j] = *pRom; - pFS454Tbl[n].CRTCNTSC2_16BPP[j] = *pRom; - pFS454Tbl[n].CRTCNTSC2_32BPP[j] = *pRom++; - i++; - } - else { - pFS454Tbl[n].CRTCNTSC2_8BPP[j] = *pRom; - pFS454Tbl[n].CRTCNTSC2_16BPP[j] = *pRom; - pFS454Tbl[n].CRTCNTSC2_32BPP[j] = *pRom++; - i++; - } - } - } - } - - k = 3; - /* LCK 3c5.44-45 */ - if (pViaModeTable->fs454MaskTable.misc2 & 0x18) { - pFS454Tbl[n].MiscNTSC2[k++] = *pRom++; - pFS454Tbl[n].MiscNTSC2[k++] = *pRom++; - } - - /* Get RGB Table */ - pRom = pNTSC + 4; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pFS454Tbl[n].RGBNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pFS454Tbl[n].RGBNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get YCbCr Table */ - pRom = pNTSC + 7; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pFS454Tbl[n].YCbCrNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pFS454Tbl[n].YCbCrNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get DotCrawl Table */ - pRom = pNTSC + 10; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pFS454Tbl[n].DotCrawlNTSC[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pFS454Tbl[n].DotCrawlNTSC[i] = *((CARD16 *)pRom); - pRom += 2; - } - } - } - } -} - -void VIAGetTV3PAL(VIAModeTablePtr pViaModeTable, - unsigned char *pBIOS, - unsigned char *pTable) -{ - VIABIOSTV3TablePtr pTV3Tab; - unsigned char *pRom, *pPAL; - unsigned char *pTVTable; - unsigned char numCRTC; - unsigned char numPatch, numReg; - int vScan, offset; - int i, j, k, n; - - pTV3Tab = NULL; - pTVTable = NULL; - - DEBUG(xf86Msg(X_INFO, "VIAGetTV3PAL\n")); - for (vScan = 0; vScan < 2; vScan++) { - switch (vScan) { - case VIA_TVNORMAL: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_TVMODETAB_POS; - pTVTable = pBIOS + *((CARD16 *)pRom); - - pTV3Tab = pViaModeTable->tv3Table; - /* HSoffset = 4; */ - break; - case VIA_TVOVER: - /* Get pointer table of all mode */ - pRom = pTable + VIA_BIOS_MODEOVERTAB_POS; - pTVTable = pBIOS + *((CARD16 *)pRom); - - pTV3Tab = pViaModeTable->tv3OverTable; - /* HSoffset = 40; */ - break; - } - - /* offset: skip MODE3, MODE13 */ - for (offset = 13, n = 0; n < VIA_BIOS_NUM_TV3; offset += 5, n++) { - - /* Get pointer table of each mode */ - pRom = pTVTable + offset; - - if (*((CARD16 *)pRom) != 0) { - - pPAL = pBIOS + *((CARD16 *)pRom); - - /* Get start of TV Table */ - pRom = pPAL + 1; - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0, j = 0; i < pViaModeTable->tv3MaskTable.numTV; j++) { - if (pViaModeTable->tv3MaskTable.TV[j] == 0xFF) { - pTV3Tab[n].TVPAL[j] = *pRom++; - i++; - } - } - - numCRTC = *pRom++; - - for (i = 0, j = 0, k = 0; i < numCRTC; j++) { - if (pViaModeTable->tv3MaskTable.CRTC1[j] == 0xFF) { - if (i >= pViaModeTable->tv3MaskTable.numCRTC1) { - pTV3Tab[n].MiscPAL1[k++] = *pRom++; - i++; - } - else { - pTV3Tab[n].CRTCPAL1[j] = *pRom++; - i++; - } - } - } - - for (i = 0, j = 0, k = 0; i < pViaModeTable->tv3MaskTable.numCRTC2; j++) { - if (pViaModeTable->tv3MaskTable.CRTC2[j] == 0xFF) { - if (j == 0x15) { - pTV3Tab[n].CRTCPAL2_8BPP[j] = *pRom++; - pTV3Tab[n].CRTCPAL2_8BPP[j+1] = *pRom++; - pTV3Tab[n].CRTCPAL2_8BPP[j+2] = *pRom++; - pTV3Tab[n].CRTCPAL2_16BPP[j] = *pRom++; - pTV3Tab[n].CRTCPAL2_16BPP[j+1] = *pRom++; - pTV3Tab[n].CRTCPAL2_16BPP[j+2] = *pRom++; - pTV3Tab[n].CRTCPAL2_32BPP[j++] = *pRom++; - pTV3Tab[n].CRTCPAL2_32BPP[j++] = *pRom++; - pTV3Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i += 3; - } - else { - /* For CRTC 6A-6C */ - if (i >= (pViaModeTable->tv3MaskTable.numCRTC2 - 3)) { - pTV3Tab[n].CRTCPAL2_8BPP[j] = *pRom; - pTV3Tab[n].CRTCPAL2_16BPP[j] = *pRom; - pTV3Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i++; - } - else { - pTV3Tab[n].CRTCPAL2_8BPP[j] = *pRom; - pTV3Tab[n].CRTCPAL2_16BPP[j] = *pRom; - pTV3Tab[n].CRTCPAL2_32BPP[j] = *pRom++; - i++; - } - } - } - } - - k = 3; - /* LCK 3c5.44-45 */ - if (pViaModeTable->tv3MaskTable.misc2 & 0x18) { - pTV3Tab[n].MiscPAL2[k++] = *pRom++; - pTV3Tab[n].MiscPAL2[k++] = *pRom++; - } - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->tv3MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - pTV3Tab[n].PatchPAL2[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get RGB Table */ - pRom = pPAL + 4; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pTV3Tab[n].RGBPAL[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pTV3Tab[n].RGBPAL[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get YCbCr Table */ - pRom = pPAL + 7; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pTV3Tab[n].YCbCrPAL[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pTV3Tab[n].YCbCrPAL[i] = *((CARD16 *)pRom); - pRom += 2; - } - -#if 0 - /* Get SDTV_RGB Table */ - pRom = pPAL + 10; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pTV3Tab[n].SDTV_RGBPAL[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pTV3Tab[n].SDTV_RGBPAL[i] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get SDTV_YCbCr Table */ - pRom = pPAL + 13; - pRom = pBIOS + *((CARD16 *)pRom); - - numReg = *pRom++; - pTV3Tab[n].SDTV_YCbCrPAL[0] = numReg; - for ( i = 1; i < (numReg + 1); i++) { - pTV3Tab[n].SDTV_YCbCrPAL[i] = *((CARD16 *)pRom); - pRom += 2; - } -#endif - } - } - } -} - - -/* Check TV mode table is TV2+ or TV3 */ -int VIAGetTVTabVer(VIABIOSInfoPtr pBIOSInfo, - unsigned char *pBIOS) -{ - unsigned char *pRom, *pTable; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetTVTabVer\n")); - /* Get the start of Table */ - pRom = pBIOS + VIA_BIOS_OFFSET_POS; - pTable = pBIOS + *((CARD16 *)pRom); - - /* Get start of TV Mask Table */ - pRom = pTable + VIA_BIOS_TVMASKTAB_POS; - pRom = pBIOS + *((CARD16 *)pRom); - - pRom += 12; - if (*((CARD16 *)pRom) == 0x03) { - pBIOSInfo->BIOSTVTabVer = 2; - return 2; - } - else { - pBIOSInfo->BIOSTVTabVer = 3; - return 3; - } -} - - -Bool VIAGetBIOSTable(VIABIOSInfoPtr pBIOSInfo) -{ - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - unsigned char *pBIOS = NULL, *pRom, *pTable, *pFPanel, *pLCDTable, *pSuptTable; - unsigned char *pRefreshTableStart; - unsigned char *pRefreshIndexTable; - unsigned char *pRefreshTable; - unsigned char numSuptPanel, numEntry; - unsigned short tableSize; - int romSize; - int i = 0, j, k, m, sum; - - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetBIOSTable\n")); - - if (!(pBIOS=xcalloc(1, 0x10000))) { - ErrorF("Allocate memory fail !!\n"); - return FALSE; - } - - if (xf86ReadBIOS(0xC0000, 0, pBIOS, 0x10000) != 0x10000) { - pBIOSInfo->UseBIOS = FALSE; - xfree(pBIOS); - ErrorF("Read VGA BIOS image fail !!\n"); - } - else { - if (*((CARD16 *) pBIOS) != 0xAA55) { - pBIOSInfo->UseBIOS = FALSE; - xfree(pBIOS); - ErrorF("VGA BIOS image is wrong!!\n"); - } - else { - romSize = *((CARD8 *) (pBIOS + VIA_BIOS_SIZE_POS)) * 512; - pRom = pBIOS; - sum = 0; - - for (i = 0; i < romSize; i++) { - sum += *pRom++; - } - - if (((CARD8) sum) != 0) { - pBIOSInfo->UseBIOS = FALSE; - xfree(pBIOS); - ErrorF("VGA BIOS image is wrong!! CheckSum = %x\n", sum); - } - } - } - - /* To check is TV Encoder match with BIOS TV mode table */ - if (pBIOSInfo->UseBIOS) { - int TVEncoder = pBIOSInfo->TVEncoder; - if (TVEncoder && (VIAGetTVTabVer(pBIOSInfo, pBIOS) != (TVEncoder+1))) { - pBIOSInfo->UseBIOS = FALSE; - xfree(pBIOS); - } - } - - /* Get the start of Table */ - pRom = pBIOS + VIA_BIOS_OFFSET_POS; - pTable = pBIOS + *((CARD16 *)pRom); - -#ifdef CREATE_CH7019_HEADERFILE - VIAGetCH7019Mask(pViaModeTable, pBIOS, pTable); - VIAGetCH7019NTSC(pViaModeTable, pBIOS, pTable); - VIAGetCH7019PAL(pViaModeTable, pBIOS, pTable); - VIACreateCH7019(pViaModeTable); -#else - pViaModeTable->ch7019MaskTable = ch7019MaskTable; - for (i = 0; i < VIA_BIOS_NUM_CH7019; i++) { - pViaModeTable->ch7019Table[i] = ch7019Table[i]; - pViaModeTable->ch7019OverTable[i] = ch7019OverTable[i]; - } -#endif -#ifdef CREATE_FS454_HEADERFILE - VIAGetFS454Mask(pViaModeTable, pBIOS, pTable); - VIAGetFS454NTSC(pViaModeTable, pBIOS, pTable); - /*VIAGetFS454PAL(pViaModeTable, pBIOS, pTable);*/ - VIACreateFS454(pViaModeTable); -#else - pViaModeTable->fs454MaskTable = fs454MaskTable; - for (i = 0; i < VIA_BIOS_NUM_FS454; i++) { - pViaModeTable->fs454Table[i] = fs454Table[i]; - pViaModeTable->fs454OverTable[i] = fs454OverTable[i]; - } -#endif -#ifdef CREATE_SAA7108_HEADERFILE - VIAGetSAA7108Mask(pViaModeTable, pBIOS, pTable); - VIAGetSAA7108NTSC(pViaModeTable, pBIOS, pTable); - VIAGetSAA7108PAL(pViaModeTable, pBIOS, pTable); - VIACreateSAA7108(pViaModeTable); -#else - pViaModeTable->saa7108MaskTable = saa7108MaskTable; - for (i = 0; i < VIA_BIOS_NUM_SAA7108; i++) { - pViaModeTable->saa7108Table[i] = saa7108Table[i]; - pViaModeTable->saa7108OverTable[i] = saa7108OverTable[i]; - } -#endif -#ifdef CREATE_TV2_HEADERFILE - VIAGetTV2Mask(pViaModeTable, pBIOS, pTable); - VIAGetTV2NTSC(pViaModeTable, pBIOS, pTable); - VIAGetTV2PAL(pViaModeTable, pBIOS, pTable); - VIACreateTV2(pViaModeTable); -#else - pViaModeTable->tv2MaskTable = tv2MaskTable; - for (i = 0; i < VIA_BIOS_NUM_TV2; i++) { - pViaModeTable->tv2Table[i] = tv2Table[i]; - pViaModeTable->tv2OverTable[i] = tv2OverTable[i]; - } -#endif -#ifdef CREATE_TV3_HEADERFILE - VIAGetTV3Mask(pViaModeTable, pBIOS, pTable); - VIAGetTV3NTSC(pViaModeTable, pBIOS, pTable); - VIAGetTV3PAL(pViaModeTable, pBIOS, pTable); - VIACreateTV3(pViaModeTable); -#else - pViaModeTable->tv3MaskTable = tv3MaskTable; - for (i = 0; i < VIA_BIOS_NUM_TV3; i++) { - pViaModeTable->tv3Table[i] = tv3Table[i]; - pViaModeTable->tv3OverTable[i] = tv3OverTable[i]; - } -#endif -#ifdef CREATE_VT1622A_HEADERFILE - VIAGetTV3Mask(pViaModeTable, pBIOS, pTable); - VIAGetTV3NTSC(pViaModeTable, pBIOS, pTable); - VIAGetTV3PAL(pViaModeTable, pBIOS, pTable); - VIACreateVT1622A(pViaModeTable); -#else - pViaModeTable->vt1622aMaskTable = vt1622aMaskTable; - for (i = 0; i < VIA_BIOS_NUM_TV3; i++) { - pViaModeTable->vt1622aTable[i] = vt1622aTable[i]; - pViaModeTable->vt1622aOverTable[i] = vt1622aOverTable[i]; - } -#endif -#ifndef CREATE_MODETABLE_HEADERFILE - if (!pBIOSInfo->UseBIOS) { - pViaModeTable->BIOSVer = BIOSVer; - pViaModeTable->BIOSDate = BIOSDate; - pViaModeTable->NumModes = NumModes; - pViaModeTable->NumPowerOn = NumPowerOn; - pViaModeTable->NumPowerOff = NumPowerOff; - pViaModeTable->Modes = Modes; - pViaModeTable->commExtTable = commExtTable; - pViaModeTable->stdModeExtTable = stdModeExtTable; - for (i = 0; i < VIA_BIOS_NUM_RES; i++) { - for (j = 0; j < VIA_BIOS_NUM_REFRESH; j++) { - pViaModeTable->refreshTable[i][j] = refreshTable[i][j]; - } - } - for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) { - pViaModeTable->lcdTable[i] = lcdTable[i]; - } - for (i = 0; i < VIA_BIOS_NUM_LCD_POWER_SEQ; i++) { - pViaModeTable->powerOn[i] = powerOn[i]; - pViaModeTable->powerOff[i] = powerOff[i]; - } - pViaModeTable->modeFix = modeFix; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "BIOS Version: %x.%x\n", - (pViaModeTable->BIOSVer >> 8), (pViaModeTable->BIOSVer & 0xFF))); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "BIOS Release Date: %s\n", pViaModeTable->BIOSDate)); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "Get mode table from via_mode.h\n")); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "-- VIAGetBIOSTable Done!\n")); - xfree(pBIOS); - return TRUE; - } -#else - pBIOSInfo->UseBIOS = TRUE; -#endif /* #ifndef CREATE_MODETABLE_HEADERFILE */ - - /* Get the start of biosver structure */ - pRom = pTable + VIA_BIOS_BIOSVER_POS; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "bcpPost: %X\n", i, *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - /* The offset should be 44, but the actual image is less three char. */ - /* pRom += 44; */ - pRom += 41; - pViaModeTable->BIOSVer = *pRom++; - pViaModeTable->BIOSVer = (pViaModeTable->BIOSVer << 8) | *pRom; - xf86DrvMsg(pBIOSInfo->scrnIndex, X_DEFAULT, "BIOS Version: %x.%x\n", - (pViaModeTable->BIOSVer >> 8), (pViaModeTable->BIOSVer & 0xFF)); - - /* Get the start of bcpPost structure */ - pRom = pTable + VIA_BIOS_BCPPOST_POS; - pRom = pBIOS + *((CARD16 *)pRom); - - pViaModeTable->BIOSDate = (char *) xcalloc(9, sizeof(char)); - - pRom += 10; - for (i = 0; i < 8; i++) { - pViaModeTable->BIOSDate[i] = *pRom; - pRom++; - } - xf86DrvMsg(pBIOSInfo->scrnIndex, X_DEFAULT, "BIOS Release Date: %s\n", pViaModeTable->BIOSDate); - - /* Get CSTAB Tables */ - pRom = pTable + VIA_BIOS_CSTAB_POS; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "cstabExtendEnd: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - pViaModeTable->NumModes = *pRom; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "BIOS Support Mode Numbers: %hu\n", pViaModeTable->NumModes)); - pViaModeTable->Modes = (VIAModeEntryPtr) xcalloc(pViaModeTable->NumModes, - sizeof(VIAModeEntry)); - - for (i = 0, j = pViaModeTable->NumModes - 1; i < pViaModeTable->NumModes; i++, j--) { - pRom -= 8; - pViaModeTable->Modes[j].Mode = *pRom; - pViaModeTable->Modes[j].Bpp = *(pRom + 2); - pViaModeTable->Modes[j].extModeExtTable.numEntry = 0; - pViaModeTable->Modes[j].MClk = 0; - pViaModeTable->Modes[j].VClk = 0; - - /* Using Mode Number To Set Resolution */ - switch (pViaModeTable->Modes[j].Mode) { - case 0x14: - case 0x15: - case 0x16: - pViaModeTable->Modes[j].Height = 1024; - pViaModeTable->Modes[j].Width = 576; - break; - case 0x22: - case 0x23: - case 0x24: - pViaModeTable->Modes[j].Height = 300; - pViaModeTable->Modes[j].Width = 400; - break; - case 0x25: - case 0x26: - case 0x27: - pViaModeTable->Modes[j].Height = 384; - pViaModeTable->Modes[j].Width = 512; - break; - case 0x2E: - case 0x2F: - case 0x30: - pViaModeTable->Modes[j].Height = 400; - pViaModeTable->Modes[j].Width = 640; - break; - case 0x31: - case 0x32: - case 0x33: - case 0x34: - pViaModeTable->Modes[j].Height = 480; - pViaModeTable->Modes[j].Width = 640; - break; - case 0x35: - case 0x36: - case 0x37: - case 0x38: - case 0x39: - pViaModeTable->Modes[j].Height = 600; - pViaModeTable->Modes[j].Width = 800; - break; - case 0x3A: - case 0x3B: - case 0x3C: - case 0x3D: - case 0x3E: - pViaModeTable->Modes[j].Height = 768; - pViaModeTable->Modes[j].Width = 1024; - break; - case 0x3F: - case 0x40: - case 0x41: - case 0x42: - case 0x43: - pViaModeTable->Modes[j].Height = 864; - pViaModeTable->Modes[j].Width = 1152; - break; - case 0x44: - case 0x45: - case 0x46: - case 0x47: - case 0x48: - pViaModeTable->Modes[j].Height = 1024; - pViaModeTable->Modes[j].Width = 1280; - break; - case 0x49: - case 0x4A: - case 0x4B: - case 0x4C: - case 0x4D: - pViaModeTable->Modes[j].Height = 1200; - pViaModeTable->Modes[j].Width = 1600; - break; - case 0x50: - case 0x51: - case 0x52: - case 0x53: - pViaModeTable->Modes[j].Height = 1050; - pViaModeTable->Modes[j].Width = 1440; - break; - case 0x54: - case 0x55: - case 0x56: - case 0x57: - pViaModeTable->Modes[j].Height = 768; - pViaModeTable->Modes[j].Width = 1280; - break; - case 0x58: - case 0x59: - case 0x5A: - case 0x5B: - pViaModeTable->Modes[j].Height = 960; - pViaModeTable->Modes[j].Width = 1280; - break; -#if 0 - case 0x60: - case 0x61: - case 0x62: - pViaModeTable->Modes[j].Height = 1440; - pViaModeTable->Modes[j].Width = 1920; - break; -#endif - case 0x63: - case 0x64: - case 0x65: - pViaModeTable->Modes[j].Height = 480; - pViaModeTable->Modes[j].Width = 848; - break; - case 0x66: - case 0x67: - case 0x68: - pViaModeTable->Modes[j].Height = 1050; - pViaModeTable->Modes[j].Width = 1400; - break; - case 0x70: - case 0x71: - case 0x72: - pViaModeTable->Modes[j].Height = 480; - pViaModeTable->Modes[j].Width = 720; - break; - case 0x73: - case 0x74: - case 0x75: - pViaModeTable->Modes[j].Height = 576; - pViaModeTable->Modes[j].Width = 720; - break; - case 0x76: - case 0x77: - case 0x78: - pViaModeTable->Modes[j].Height = 512; - pViaModeTable->Modes[j].Width = 1024; - break; - case 0x79: - case 0x7A: - case 0x7B: - pViaModeTable->Modes[j].Height = 480; - pViaModeTable->Modes[j].Width = 856; - break; - case 0x5C: - case 0x5D: - case 0x5E: - pViaModeTable->Modes[j].Height = 200; - pViaModeTable->Modes[j].Width = 320; - break; - case 0x7C: - case 0x7D: - case 0x7E: - pViaModeTable->Modes[j].Height = 240; - pViaModeTable->Modes[j].Width = 320; - break; - default: - pViaModeTable->Modes[j].Height = 0; - pViaModeTable->Modes[j].Width = 0; - break; - } - } - - /* Get Set Mode Regs. Init. (Standard VGA) */ - pRom = pTable + VIA_BIOS_STDVGAREGTAB_POS; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "csVidParams: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0; i < pViaModeTable->NumModes; i++) { - pViaModeTable->Modes[i].stdVgaTable.columns = *pRom++; - pViaModeTable->Modes[i].stdVgaTable.rows = *pRom++; - pViaModeTable->Modes[i].stdVgaTable.fontHeight = *pRom++; - pViaModeTable->Modes[i].stdVgaTable.pageSize = *((CARD16 *)pRom++); - - pRom++; - - for (j = 1; j < 5; j++) { - pViaModeTable->Modes[i].stdVgaTable.SR[j] = *pRom++; - } - - pViaModeTable->Modes[i].stdVgaTable.misc = *pRom++; - - for (j = 0; j < 25; j++) { - pViaModeTable->Modes[i].stdVgaTable.CR[j] = *pRom++; - } - - for (j = 0; j < 20; j++) { - pViaModeTable->Modes[i].stdVgaTable.AR[j] = *pRom++; - } - - for (j = 0; j < 9; j++) { - pViaModeTable->Modes[i].stdVgaTable.GR[j] = *pRom++; - } - } - - /* Get Commmon Ext. Regs */ - pRom = pTable + VIA_BIOS_COMMEXTREGTAB_POS; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "Mode_XRegs: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - for (j = 0; *pRom != 0xFF; j++) { - switch (*pRom++) { - case ZCR: - pViaModeTable->commExtTable.port[j] = 0xD4; - break; - case ZSR: - pViaModeTable->commExtTable.port[j] = 0xC4; - break; - case ZGR: - pViaModeTable->commExtTable.port[j] = 0xCE; - break; - default: - pViaModeTable->commExtTable.port[j] = *pRom; - break; - } - /*pViaModeTable->commExtTable.port[j] = *pRom++;*/ - pViaModeTable->commExtTable.offset[j] = *pRom++; - pViaModeTable->commExtTable.mask[j] = *pRom++; - pViaModeTable->commExtTable.data[j] = *pRom++; - } - - pViaModeTable->commExtTable.numEntry = j; - - /* Get Standard Mode-Spec. Extend Regs */ - pRom = pTable + VIA_BIOS_STDMODEXTREGTAB_POS; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "StdMode_XRegs: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - for (j = 0; *pRom != 0xFF; j++) { - switch (*pRom++) { - case ZCR: - pViaModeTable->stdModeExtTable.port[j] = 0xD4; - break; - case ZSR: - pViaModeTable->stdModeExtTable.port[j] = 0xC4; - break; - case ZGR: - pViaModeTable->stdModeExtTable.port[j] = 0xCE; - break; - default: - pViaModeTable->stdModeExtTable.port[j] = *pRom; - break; - } - /*pViaModeTable->stdModeExtTable.port[j] = *pRom++;*/ - pViaModeTable->stdModeExtTable.offset[j] = *pRom++; - pViaModeTable->stdModeExtTable.mask[j] = *pRom++; - pViaModeTable->stdModeExtTable.data[j] = *pRom++; - } - - pViaModeTable->stdModeExtTable.numEntry = j; - - /* Get Extended Mode-Spec. Extend Regs */ - pRom = pTable + VIA_BIOS_EXTMODEREGTAB_POS; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "csextModeTbl: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - while (*pRom != 0xFF) { - unsigned char *pExtModeExtTable; - CARD16 mode = *pRom; - - for (i = 0; i < pViaModeTable->NumModes; i++) { - if (pViaModeTable->Modes[i].Mode == mode) - break; - } - - if (i == pViaModeTable->NumModes) { - /* Cannot find a match mode, skip this mode information */ - pRom += 11; - continue; - } - - pViaModeTable->Modes[i].MemNeed = *(pRom + 1); - pViaModeTable->Modes[i].VClk = *((CARD16 *)(pRom + 2)); - pViaModeTable->Modes[i].MClk = *((CARD16 *)(pRom + 4)); - - pExtModeExtTable = pBIOS + *((CARD16 *)(pRom + 6)); - - for (j = 0; *pExtModeExtTable != 0xFF; j++) { - switch (*pExtModeExtTable++) { - case ZCR: - pViaModeTable->Modes[i].extModeExtTable.port[j] = 0xD4; - break; - case ZSR: - pViaModeTable->Modes[i].extModeExtTable.port[j] = 0xC4; - break; - case ZGR: - pViaModeTable->Modes[i].extModeExtTable.port[j] = 0xCE; - break; - default: - pViaModeTable->Modes[i].extModeExtTable.port[j] = *pExtModeExtTable; - break; - } - /*pViaModeTable->Modes[i].extModeExtTable.port[j] = *pExtModeExtTable++;*/ - pViaModeTable->Modes[i].extModeExtTable.offset[j] = *pExtModeExtTable++; - pViaModeTable->Modes[i].extModeExtTable.mask[j] = *pExtModeExtTable++; - pViaModeTable->Modes[i].extModeExtTable.data[j] = *pExtModeExtTable++; - } - - pViaModeTable->Modes[i].extModeExtTable.numEntry = j; - - pRom += 11; - } - - /* Get Refresh Rate Table */ - pRom = pTable + VIA_BIOS_REFRESHMODETAB_POS; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "csModeRateTbl: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - for (i = 0; i < VIA_BIOS_NUM_RES; i++) { - for (j = 0; j < VIA_BIOS_NUM_REFRESH; j++) { - /* Set all modes is invalid */ - pViaModeTable->refreshTable[i][j].refresh = 0; - } - } - - i = 0; - - while (*((CARD16 *)pRom) != 0xFFFF) { - if (i >= VIA_BIOS_NUM_RES) { - xfree(pBIOS); - xfree(pViaModeTable->BIOSDate); - xfree(pViaModeTable->Modes); - ErrorF("Too much modes for Refresh Table!!\n"); - return FALSE; - } - - pRefreshTableStart = pBIOS + *((CARD16 *)pRom); - pRefreshIndexTable = pRefreshTableStart + 3; - j = 0; - - while (*pRefreshIndexTable != 0xFF) { - if (j >= VIA_BIOS_NUM_REFRESH) { - xfree(pBIOS); - xfree(pViaModeTable->BIOSDate); - xfree(pViaModeTable->Modes); - ErrorF("Too much refresh modes for Refresh Table!!\n"); - return FALSE; - } - - switch (*pRefreshIndexTable) { - case 0: - pViaModeTable->refreshTable[i][j].refresh = 60; - break; - case 1: - pViaModeTable->refreshTable[i][j].refresh = 56; - break; - case 2: - pViaModeTable->refreshTable[i][j].refresh = 65; - break; - case 3: - pViaModeTable->refreshTable[i][j].refresh = 70; - break; - case 4: - pViaModeTable->refreshTable[i][j].refresh = 72; - break; - case 5: - pViaModeTable->refreshTable[i][j].refresh = 75; - break; - case 6: - pViaModeTable->refreshTable[i][j].refresh = 80; - break; - case 7: - pViaModeTable->refreshTable[i][j].refresh = 85; - break; - case 8: - pViaModeTable->refreshTable[i][j].refresh = 90; - break; - case 9: - pViaModeTable->refreshTable[i][j].refresh = 100; - break; - case 10: - pViaModeTable->refreshTable[i][j].refresh = 120; - break; - default: - pViaModeTable->refreshTable[i][j].refresh = 255; - break; - } - - pRefreshTable = pRefreshTableStart + *(pRefreshIndexTable + 1); - - pViaModeTable->refreshTable[i][j].VClk = *((CARD16 *) pRefreshTable); - pRefreshTable += 2; - - for (k = 0; k < 11; k++) { - pViaModeTable->refreshTable[i][j].CR[k] = *pRefreshTable++; - } - - pRefreshIndexTable += 3; - j++; - } - - pRom += 2; - - /* Skip Mode table, we don't need it */ - while (*pRom++ != 0x0) - ; - - i++; - } - - /* Get BIOS LCD Mode Table */ - /* Get start of LCD Table */ - pRom = pTable + VIA_BIOS_LCDMODETAB_POS; - pRom = pBIOS + *((CARD16 *)pRom); - - /* No. of Support Panels */ - pRom += 6; /* Skip six char. - "FPANEL" */ - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "numSuptPanel: %X\n", *pRom)); - numSuptPanel = *pRom; - - /* Point to LCD 640x480 Table */ - pRom += 3; - pFPanel = pRom; - - for (i = 0; i < numSuptPanel; i++) { - - /* Get fpIndex */ - pViaModeTable->lcdTable[i].fpIndex = *pRom++; - - /* Get fpSize */ - pViaModeTable->lcdTable[i].fpSize = *pRom++; - - /* Get No. of Entry */ - numEntry = *pRom++; - - /* vidMemAdjust skip */ - pRom++; - - /* Get Table Size */ - tableSize = *((CARD16 *)pRom); - - /* Get Support Mode Table */ - pRom += 2; - pSuptTable = pRom; - - /* Get Power Seqence Index */ - pRom += 2; - pViaModeTable->lcdTable[i].powerSeq = *pRom++; - - pLCDTable = pRom; - - pRom = pSuptTable; - pRom = pBIOS + *((CARD16 *)pRom); - - for (j = 0; j < VIA_BIOS_NUM_LCD_SUPPORT_MASK; j++) { - pViaModeTable->lcdTable[i].SuptMode[j] = *((CARD16 *)pRom); - pRom += 2; - } - - /* Get FPconfig Table */ - pRom = pLCDTable; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "FPconfigTbl000%d: %X\n", i, *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - - for (j = 0; *pRom != 0xFF; j++) { - switch (*pRom++) { - case ZCR: - pViaModeTable->lcdTable[i].FPconfigTb.port[j] = 0xD4; - break; - case ZSR: - pViaModeTable->lcdTable[i].FPconfigTb.port[j] = 0xC4; - break; - case ZGR: - pViaModeTable->lcdTable[i].FPconfigTb.port[j] = 0xCE; - break; - default: - pViaModeTable->lcdTable[i].FPconfigTb.port[j] = *pRom; - break; - } - /*pViaModeTable->lcdTable[i].FPconfigTb.port[j] = *pRom++;*/ - pViaModeTable->lcdTable[i].FPconfigTb.offset[j] = *pRom++; - pViaModeTable->lcdTable[i].FPconfigTb.data[j] = *pRom++; - } - pViaModeTable->lcdTable[i].FPconfigTb.numEntry = j; - - /* Get Init Table */ - pRom = pLCDTable + 2; - pRom = pBIOS + *((CARD16 *)pRom); - - pViaModeTable->lcdTable[i].InitTb.LCDClk = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].InitTb.VClk = *((CARD16 *)(pRom+2)); - pRom += 4; - - pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].InitTb.VClk_12Bit = *((CARD16 *)(pRom+2)); - pRom += 4; - - for (j = 0; *pRom != 0xFF; j++) { - /*pViaModeTable->lcdTable[i].InitTb.port[j] = *pRom++;*/ - pViaModeTable->lcdTable[i].InitTb.port[j] = 0xD4; - pViaModeTable->lcdTable[i].InitTb.offset[j] = *pRom++; - pViaModeTable->lcdTable[i].InitTb.data[j] = *pRom++; - } - pViaModeTable->lcdTable[i].InitTb.numEntry = j; - - /* Get MPatchDP2Ctr Table */ - pRom = pLCDTable + 4; - pRom = pBIOS + *((CARD16 *)pRom); - - for (j = 0; *pRom != 0xFF; j++) { - pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].Mode = *pRom; - pRom++; - - pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk = *((CARD16 *)(pRom+2)); - pRom += 4; - - pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk_12Bit = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk_12Bit = *((CARD16 *)(pRom+2)); - pRom += 4; - for (k = 0; *pRom != 0xFF; k++) { - pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].port[k] = 0xD4; - pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].offset[k] = *pRom++; - pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].data[k] = *pRom++; - } - pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].numEntry = k; - pRom++; - } - pViaModeTable->lcdTable[i].numMPatchDP2Ctr = j; - - /* Get MPatchDP2Exp Table */ - pRom = pLCDTable + 6; - pRom = pBIOS + *((CARD16 *)pRom); - - for (j = 0; *pRom != 0xFF; j++) { - pViaModeTable->lcdTable[i].MPatchDP2Exp[j].Mode = *pRom; - pRom++; - - pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk = *((CARD16 *)(pRom+2)); - pRom += 4; - - pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk_12Bit = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk_12Bit = *((CARD16 *)(pRom+2)); - pRom += 4; - for (k = 0; *pRom != 0xFF; k++) { - pViaModeTable->lcdTable[i].MPatchDP2Exp[j].port[k] = 0xD4; - pViaModeTable->lcdTable[i].MPatchDP2Exp[j].offset[k] = *pRom++; - pViaModeTable->lcdTable[i].MPatchDP2Exp[j].data[k] = *pRom++; - } - pViaModeTable->lcdTable[i].MPatchDP2Exp[j].numEntry = k; - pRom++; - } - pViaModeTable->lcdTable[i].numMPatchDP2Exp = j; - - /* Get MPatchDP1Ctr Table */ - pRom = pLCDTable + 8; - pRom = pBIOS + *((CARD16 *)pRom); - - for (j = 0; *pRom != 0xFF; j++) { - pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].Mode = *pRom; - pRom++; - - for (k = 0; *pRom != 0xFF; k++) { - switch (*pRom++) { - case ZCR: - pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].port[k] = 0xD4; - break; - case ZSR: - pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].port[k] = 0xC4; - break; - case ZGR: - pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].port[k] = 0xCE; - break; - default: - pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].port[k] = *pRom; - break; - } - /*pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].port[k] = *pRom++;*/ - pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].offset[k] = *pRom++; - pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].data[k] = *pRom++; - } - pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].numEntry = k; - pRom++; - } - pViaModeTable->lcdTable[i].numMPatchDP1Ctr = j; - - /* Get MPatchDP1Exp Table */ - pRom = pLCDTable + 10; - pRom = pBIOS + *((CARD16 *)pRom); - - for (j = 0; *pRom != 0xFF; j++) { - pViaModeTable->lcdTable[i].MPatchDP1Exp[j].Mode = *pRom; - pRom++; - - for (k = 0; *pRom != 0xFF; k++) { - switch (*pRom++) { - case ZCR: - pViaModeTable->lcdTable[i].MPatchDP1Exp[j].port[k] = 0xD4; - break; - case ZSR: - pViaModeTable->lcdTable[i].MPatchDP1Exp[j].port[k] = 0xC4; - break; - case ZGR: - pViaModeTable->lcdTable[i].MPatchDP1Exp[j].port[k] = 0xCE; - break; - default: - pViaModeTable->lcdTable[i].MPatchDP1Exp[j].port[k] = *pRom; - break; - } - /*pViaModeTable->lcdTable[i].MPatchDP1Exp[j].port[k] = *pRom++;*/ - pViaModeTable->lcdTable[i].MPatchDP1Exp[j].offset[k] = *pRom++; - pViaModeTable->lcdTable[i].MPatchDP1Exp[j].data[k] = *pRom++; - } - pViaModeTable->lcdTable[i].MPatchDP1Exp[j].numEntry = k; - pRom++; - } - pViaModeTable->lcdTable[i].numMPatchDP1Exp = j; - - /* Get LowResCtr Table */ - pRom = pLCDTable + 12; - pRom = pBIOS + *((CARD16 *)pRom); - - pViaModeTable->lcdTable[i].LowResCtr.LCDClk = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].LowResCtr.VClk = *((CARD16 *)(pRom+2)); - pRom += 4; - - pViaModeTable->lcdTable[i].LowResCtr.LCDClk_12Bit = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].LowResCtr.VClk_12Bit = *((CARD16 *)(pRom+2)); - pRom += 4; - - for (j = 0; *pRom != 0xFF; j++) { - /*pViaModeTable->lcdTable[i].LowResCtr.port[j] = *pRom++;*/ - pViaModeTable->lcdTable[i].LowResCtr.port[j] = 0xD4; - pViaModeTable->lcdTable[i].LowResCtr.offset[j] = *pRom++; - pViaModeTable->lcdTable[i].LowResCtr.data[j] = *pRom++; - } - pViaModeTable->lcdTable[i].LowResCtr.numEntry = j; - - /* Get LowResExp Table */ - pRom = pLCDTable + 14; - pRom = pBIOS + *((CARD16 *)pRom); - - pViaModeTable->lcdTable[i].LowResExp.LCDClk = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].LowResExp.VClk = *((CARD16 *)(pRom+2)); - pRom += 4; - - pViaModeTable->lcdTable[i].LowResExp.LCDClk_12Bit = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].LowResExp.VClk_12Bit = *((CARD16 *)(pRom+2)); - pRom += 4; - - for (j = 0; *pRom != 0xFF; j++) { - /*pViaModeTable->lcdTable[i].LowResExp.port[j] = *pRom++;*/ - pViaModeTable->lcdTable[i].LowResExp.port[j] = 0xD4; - pViaModeTable->lcdTable[i].LowResExp.offset[j] = *pRom++; - pViaModeTable->lcdTable[i].LowResExp.data[j] = *pRom++; - } - pViaModeTable->lcdTable[i].LowResExp.numEntry = j; - - /* No. of Mxxx */ - numEntry = (numEntry - 8) / 2; - - /* Get MxxxCtr & MxxxExp Table */ - for (j = 0, m = 8; j < numEntry; j++, m++) { - pRom = pLCDTable + (m * 2); - pRom = pBIOS + *((CARD16 *)pRom); - - if (*pRom == 0xFF) { - k = 0; - } - else { - pViaModeTable->lcdTable[i].MCtr[j].LCDClk = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].MCtr[j].VClk = *((CARD16 *)(pRom+2)); - pRom += 4; - - pViaModeTable->lcdTable[i].MCtr[j].LCDClk_12Bit = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].MCtr[j].VClk_12Bit = *((CARD16 *)(pRom+2)); - pRom += 4; - - for (k = 0; *pRom != 0xFF; k++) { - /*pViaModeTable->lcdTable[i].MCtr[j].port[k] = *pRom++;*/ - pViaModeTable->lcdTable[i].MCtr[j].port[k] = 0xD4; - pViaModeTable->lcdTable[i].MCtr[j].offset[k] = *pRom++; - pViaModeTable->lcdTable[i].MCtr[j].data[k] = *pRom++; - } - } - pViaModeTable->lcdTable[i].MCtr[j].numEntry = k; - - m++; - pRom = pLCDTable + (m * 2); - pRom = pBIOS + *((CARD16 *)pRom); - - if (*pRom == 0xFF) { - k = 0; - } - else { - pViaModeTable->lcdTable[i].MExp[j].LCDClk = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].MExp[j].VClk = *((CARD16 *)(pRom+2)); - pRom += 4; - - pViaModeTable->lcdTable[i].MExp[j].LCDClk_12Bit = *((CARD16 *)pRom); - pViaModeTable->lcdTable[i].MExp[j].VClk_12Bit = *((CARD16 *)(pRom+2)); - pRom += 4; - - for (k = 0; *pRom != 0xFF; k++) { - /*pViaModeTable->lcdTable[i].MExp[j].port[k] = *pRom++;*/ - pViaModeTable->lcdTable[i].MExp[j].port[k] = 0xD4; - pViaModeTable->lcdTable[i].MExp[j].offset[k] = *pRom++; - pViaModeTable->lcdTable[i].MExp[j].data[k] = *pRom++; - } - } - pViaModeTable->lcdTable[i].MExp[j].numEntry = k; - } - - /* Point to Next Support Panel */ - pRom = pFPanel + tableSize; - pFPanel = pRom; - } - - /* Get start of PowerOn Seqence Table */ - if (VIAGetTVTabVer(pBIOSInfo, pBIOS) == 3) { - pRom = pTable + VIA_BIOS_LCDPOWERON_POS; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_POWER_ON: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - } - else { - pRom = pTable + VIA_BIOS_LCDPOWERON_POS - 2; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_POWER_ON: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - } - - for (i = 0; (*((CARD16 *)pRom)) != 0xFFFF; i++) { - if ((*pRom) == 0xFF) - pRom++; - - pViaModeTable->powerOn[i].powerSeq = *pRom++; - - pRom += 2; - - for (j = 0; *pRom != 0xFF; j++) { - switch (*pRom++) { - case ZCR: - pViaModeTable->powerOn[i].port[j] = 0xD4; - break; - case ZSR: - pViaModeTable->powerOn[i].port[j] = 0xC4; - break; - case ZGR: - pViaModeTable->powerOn[i].port[j] = 0xCE; - break; - default: - pViaModeTable->powerOn[i].port[j] = *pRom; - break; - } - /*pViaModeTable->powerOn[i].port[j] = *pRom++;*/ - pViaModeTable->powerOn[i].offset[j] = *pRom++; - pViaModeTable->powerOn[i].mask[j] = *pRom++; - pViaModeTable->powerOn[i].data[j] = *pRom++; - pViaModeTable->powerOn[i].delay[j] = *((CARD16 *)pRom); - pRom += 2; - } - - pViaModeTable->powerOn[i].numEntry = j; - } - - pViaModeTable->NumPowerOn = i; - - /* Get start of PowerOff Seqence Table */ - if (VIAGetTVTabVer(pBIOSInfo, pBIOS) == 3) { - pRom = pTable + VIA_BIOS_LCDPOWEROFF_POS; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_POWER_OFF: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - } - else { - pRom = pTable + VIA_BIOS_LCDPOWEROFF_POS - 4; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_POWER_OFF: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - } - - for (i = 0; (*((CARD16 *)pRom)) != 0xFFFF; i++) { - if ((*pRom) == 0xFF) - pRom++; - - pViaModeTable->powerOff[i].powerSeq = *pRom++; - - pRom += 2; - - for (j = 0; *pRom != 0xFF; j++) { - switch (*pRom++) { - case ZCR: - pViaModeTable->powerOff[i].port[j] = 0xD4; - break; - case ZSR: - pViaModeTable->powerOff[i].port[j] = 0xC4; - break; - case ZGR: - pViaModeTable->powerOff[i].port[j] = 0xCE; - break; - default: - pViaModeTable->powerOff[i].port[j] = *pRom; - break; - } - /*pViaModeTable->powerOff[i].port[j] = *pRom++;*/ - pViaModeTable->powerOff[i].offset[j] = *pRom++; - pViaModeTable->powerOff[i].mask[j] = *pRom++; - pViaModeTable->powerOff[i].data[j] = *pRom++; - pViaModeTable->powerOff[i].delay[j] = *((CARD16 *)pRom); - pRom += 2; - } - - pViaModeTable->powerOff[i].numEntry = j; - } - - pViaModeTable->NumPowerOff = i; - - /* Get start of Mode Fix Table */ - if (VIAGetTVTabVer(pBIOSInfo, pBIOS) == 3) { - pRom = pTable + VIA_BIOS_LCDMODEFIX_POS; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_MODEFIX: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - } - else { - pRom = pTable + VIA_BIOS_LCDMODEFIX_POS - 4; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_MODEFIX: %X\n", *((CARD16 *)pRom))); - pRom = pBIOS + *((CARD16 *)pRom); - } - - for (i = 0; *pRom != 0xFF; i++) { - pViaModeTable->modeFix.reqMode[i] = *pRom++; - pViaModeTable->modeFix.fixMode[i] = *pRom++; - } - - pViaModeTable->modeFix.numEntry = i; - - xf86Msg(X_DEFAULT, "VIAGetBIOSTable Done\n"); - -/* Create Mode Table Header File */ -#ifdef CREATE_MODETABLE_HEADERFILE - if (!VIACreateHeaderFile(pViaModeTable)) { - xfree(pBIOS); - xfree(pViaModeTable->BIOSDate); - xfree(pViaModeTable->Modes); - return FALSE; - } -#endif /* CREATE_MODETABLE_HEADERFILE */ - -#ifdef CREATE_TV2_HEADERFILE - if (VIAGetTVTabVer(pBIOSInfo, pBIOS) != 2) { - ErrorF("BIOS version is wrong!! There is no TV2+ table.\n"); - xfree(pBIOS); - xfree(pViaModeTable->BIOSDate); - xfree(pViaModeTable->Modes); - return FALSE; - } - else { - if (!VIACreateTV2(pViaModeTable)) { - xfree(pBIOS); - xfree(pViaModeTable->BIOSDate); - xfree(pViaModeTable->Modes); - return FALSE; - } - } -#endif /* CREATE_TV2_HEADERFILE */ - -#ifdef DBG_MODETABLE_FILE - VIAPrintModeTableFile(pViaModeTable, pBIOS); -#endif /* DBG_MODETABLE_FILE */ - - xfree(pBIOS); - return TRUE; -} - -int VIAFindSupportRefreshRate(VIABIOSInfoPtr pBIOSInfo, int resIndex) -{ - VIABIOSInfoPtr pVia; - int bppIndex, refIndex; - int needRefresh; - const int *supRefTab; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAFindSupportRefreshRate\n")); - pVia = pBIOSInfo; - bppIndex = 0; - supRefTab = NULL; - needRefresh = pBIOSInfo->Refresh; - - if (needRefresh <= supportRef[0]) { - refIndex = 0; - } - else if (needRefresh >= supportRef[VIA_NUM_REFRESH_RATE - 1]) { - refIndex = VIA_NUM_REFRESH_RATE - 1; - } - else { - for (refIndex = 0; refIndex < VIA_NUM_REFRESH_RATE; refIndex++) { - if (needRefresh < supportRef[refIndex + 1]) { - break; - } - } - } - - switch (pBIOSInfo->bitsPerPixel) { - case 8: - bppIndex = 0; - break; - case 16: - bppIndex = 1; - break; - case 24: - case 32: - bppIndex = 2; - break; - } - - switch (pBIOSInfo->MemClk) { - case VIA_MEM_SDR66: - case VIA_MEM_SDR100: - supRefTab = SDR100[bppIndex][resIndex]; - break; - case VIA_MEM_SDR133: - supRefTab = SDR133[bppIndex][resIndex]; - break; - case VIA_MEM_DDR200: - supRefTab = DDR200[bppIndex][resIndex]; - break; - case VIA_MEM_DDR266: - case VIA_MEM_DDR333: - case VIA_MEM_DDR400: - supRefTab = DDR266[bppIndex][resIndex]; - break; - } - - for ( ; refIndex >= 0; refIndex--) { - if (supRefTab[refIndex]) { - needRefresh = supportRef[refIndex]; - break; - } - } - - pBIOSInfo->FoundRefresh = needRefresh; - return refIndex; -} - - -Bool VIAFindModeUseBIOSTable(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia = pBIOSInfo; - VIAModeTablePtr pViaModeTable; - int refresh, maxRefresh, needRefresh, refreshMode; - int refIndex; - int i, j, k; - int modeNum, tmp; - Bool setVirtual = FALSE; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAFindModeUseBIOSTable\n")); - pViaModeTable = pBIOSInfo->pModeTable; - - i = 0; - j = VIA_RES_INVALID; - - /* detemine support highest resolution by Memory clk */ - VGAOUT8(0x3D4, 0x3D); - pBIOSInfo->MemClk = (VGAIN8(0x3D5) & 0xF0) >> 4; - if ((pBIOSInfo->bitsPerPixel > 16) && (pBIOSInfo->HDisplay == 1600) && - (pBIOSInfo->VDisplay == 1200) && (pBIOSInfo->MemClk < VIA_MEM_DDR266)) { - ErrorF("\n1600x1200 True Color only support in MEMCLK higher than DDR266 platform!!\n"); - ErrorF("Please use lower bpp or resolution.\n"); - return FALSE; - } - - if (pBIOSInfo->ActiveDevice & VIA_DEVICE_DFP && (pBIOSInfo->PanelSize == VIA_PANEL_INVALID)) { - VIAGetPanelInfo(pBIOSInfo); - } - - if (!pBIOSInfo->ActiveDevice) { - pBIOSInfo->ActiveDevice = VIAGetDeviceDetect(pBIOSInfo); - } - /* TV + LCD/DVI has no simultaneous, block it */ - if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) - && (pBIOSInfo->ActiveDevice & (VIA_DEVICE_LCD | VIA_DEVICE_DFP))) { - pBIOSInfo->ActiveDevice = VIA_DEVICE_TV; - } - - if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) && - (pBIOSInfo->CrtcHDisplay > 1024) && ( - (pBIOSInfo->TVEncoder == VIA_TV3) || - (pBIOSInfo->TVEncoder == VIA_VT1622A) || - (pBIOSInfo->TVEncoder == VIA_CH7019) || - (pBIOSInfo->TVEncoder == VIA_SAA7108) || - (pBIOSInfo->TVEncoder == VIA_FS454))) { - for (i = 0; i < pViaModeTable->NumModes; i++) { - if ((pViaModeTable->Modes[i].Bpp == pBIOSInfo->bitsPerPixel) && - (pViaModeTable->Modes[i].Width == 1024) && - (pViaModeTable->Modes[i].Height == 768)) - break; - } - - if (i == pViaModeTable->NumModes) { - ErrorF("\nVIASetModeUseBIOSTable: Cannot find suitable mode!!\n"); - ErrorF("Mode setting in XF86Config(-4) is not supported!!\n"); - return FALSE; - } - - j = VIA_RES_1024X768; - pBIOSInfo->frameX1 = 1023; - pBIOSInfo->frameY1 = 767; - pBIOSInfo->HDisplay = 1024; - pBIOSInfo->VDisplay = 768; - pBIOSInfo->CrtcHDisplay = 1024; - pBIOSInfo->CrtcVDisplay = 768; - } - else if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) && (pBIOSInfo->CrtcHDisplay > 800) - && (pBIOSInfo->TVEncoder == VIA_TV2PLUS)) { - for (i = 0; i < pViaModeTable->NumModes; i++) { - if ((pViaModeTable->Modes[i].Bpp == pBIOSInfo->bitsPerPixel) && - (pViaModeTable->Modes[i].Width == 800) && - (pViaModeTable->Modes[i].Height == 600)) - break; - } - - if (i == pViaModeTable->NumModes) { - ErrorF("\nVIASetModeUseBIOSTable: Cannot find suitable mode!!\n"); - ErrorF("Mode setting in XF86Config(-4) is not supported!!\n"); - return FALSE; - } - - j = VIA_RES_800X600; - pBIOSInfo->frameX1 = 799; - pBIOSInfo->frameY1 = 599; - pBIOSInfo->HDisplay = 800; - pBIOSInfo->VDisplay = 600; - pBIOSInfo->CrtcHDisplay = 800; - pBIOSInfo->CrtcVDisplay = 600; - } - else { - for (i = 0; i < pViaModeTable->NumModes; i++) { - if ((pViaModeTable->Modes[i].Bpp == pBIOSInfo->bitsPerPixel) && - (pViaModeTable->Modes[i].Width == pBIOSInfo->CrtcHDisplay) && - (pViaModeTable->Modes[i].Height == pBIOSInfo->CrtcVDisplay)) - break; - } - - if (i == pViaModeTable->NumModes) { - ErrorF("\nVIASetModeUseBIOSTable: Cannot find suitable mode!!\n"); - ErrorF("Mode setting in XF86Config(-4) is not supported!!\n"); - return FALSE; - } - - modeNum = (int)pViaModeTable->Modes[i].Mode; - - if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) { - switch (pBIOSInfo->PanelSize) { - case VIA_PANEL6X4: - pBIOSInfo->panelX = 640; - pBIOSInfo->panelY = 480; - j = VIA_RES_640X480; - break; - case VIA_PANEL8X6: - pBIOSInfo->panelX = 800; - pBIOSInfo->panelY = 600; - j = VIA_RES_800X600; - break; - case VIA_PANEL10X7: - pBIOSInfo->panelX = 1024; - pBIOSInfo->panelY = 768; - j = VIA_RES_1024X768; - break; - case VIA_PANEL12X7: - pBIOSInfo->panelX = 1280; - pBIOSInfo->panelY = 768; - j = VIA_RES_1280X768; - break; - case VIA_PANEL12X10: - pBIOSInfo->panelX = 1280; - pBIOSInfo->panelY = 1024; - j = VIA_RES_1280X1024; - break; - case VIA_PANEL14X10: - pBIOSInfo->panelX = 1400; - pBIOSInfo->panelY = 1050; - j = VIA_RES_1400X1050; - break; - case VIA_PANEL16X12: - pBIOSInfo->panelX = 1600; - pBIOSInfo->panelY = 1200; - j = VIA_RES_1600X1200; - break; - default: - pBIOSInfo->PanelSize = VIA_PANEL10X7; - pBIOSInfo->panelX = 1024; - pBIOSInfo->panelY = 768; - j = VIA_RES_1024X768; - break; - } - - /* Find Panel Size Index */ - for (k = 0; k < VIA_BIOS_NUM_PANEL; k++) { - if (pViaModeTable->lcdTable[k].fpSize == pBIOSInfo->PanelSize) - break; - }; - - tmp = 0x1; - tmp = tmp << (modeNum & 0xF); - if ((CARD16)(tmp) & - pViaModeTable->lcdTable[k].SuptMode[(modeNum >> 4)]) { - } - else { - if ((pBIOSInfo->CrtcHDisplay > pBIOSInfo->panelX) && - (pBIOSInfo->CrtcVDisplay > pBIOSInfo->panelY)) { - setVirtual = TRUE; - pBIOSInfo->frameX1 = pBIOSInfo->panelX - 1; - pBIOSInfo->frameY1 = pBIOSInfo->panelY - 1; - pBIOSInfo->HDisplay = pBIOSInfo->panelX; - pBIOSInfo->VDisplay = pBIOSInfo->panelY; - pBIOSInfo->CrtcHDisplay = pBIOSInfo->panelX; - pBIOSInfo->CrtcVDisplay = pBIOSInfo->panelY; - } - else { - pBIOSInfo->DVIAttach = FALSE; - pBIOSInfo->scaleY = FALSE; - pBIOSInfo->panelX = 0; - pBIOSInfo->panelY = 0; - } - } - } - - if (setVirtual) { - for (i = 0; i < pViaModeTable->NumModes; i++) { - if ((pViaModeTable->Modes[i].Bpp == pBIOSInfo->bitsPerPixel) && - (pViaModeTable->Modes[i].Width == pBIOSInfo->HDisplay) && - (pViaModeTable->Modes[i].Height == pBIOSInfo->VDisplay)) - break; - } - - if (i == pViaModeTable->NumModes) { - ErrorF("\nVIASetModeUseBIOSTable: Cannot find suitable mode!!\n"); - ErrorF("Mode setting in XF86Config(-4) is not supported!!\n"); - return FALSE; - } - } - - switch (pBIOSInfo->CrtcVDisplay) { - case 480: - switch (pBIOSInfo->CrtcHDisplay) { - case 640: - j = VIA_RES_640X480; - break; - case 720: - j = VIA_RES_720X480; - break; - case 848: - j = VIA_RES_848X480; - break; - case 856: - j = VIA_RES_856X480; - break; - default: - break; - } - break; - case 512: - j = VIA_RES_1024X512; - break; - case 576: - switch (pBIOSInfo->CrtcHDisplay) { - case 720: - j = VIA_RES_720X576; - break; - case 1024: - j = VIA_RES_1024X576; - break; - default: - break; - } - break; - case 600: - j = VIA_RES_800X600; - break; - case 768: - switch (pBIOSInfo->CrtcHDisplay) { - case 1024: - j = VIA_RES_1024X768; - break; - case 1280: - j = VIA_RES_1280X768; - break; - default: - break; - } - break; - case 864: - j = VIA_RES_1152X864; - break; - case 960: - j = VIA_RES_1280X960; - break; - case 1024: - j = VIA_RES_1280X1024; - break; - case 1050: - switch (pBIOSInfo->CrtcHDisplay) { - case 1440: - j = VIA_RES_1440X1050; - break; - case 1400: - j = VIA_RES_1400X1050; - break; - default: - break; - } - break; - case 1200: - j = VIA_RES_1600X1200; - break; - default: - j = VIA_RES_INVALID; - break; - } - } - - k = 0; - - if (j != VIA_RES_INVALID) { - if (pBIOSInfo->OptRefresh) { - pBIOSInfo->Refresh = pBIOSInfo->OptRefresh; - refIndex = VIAFindSupportRefreshRate(pBIOSInfo, j); - needRefresh = pBIOSInfo->FoundRefresh; - if (refIndex < 0) { - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "Mode setting in XF86Config(-4) is not supported!!\n"); - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "Please use lower bpp or resolution.\n"); - return FALSE; - } - } - else { - /* use the monitor information */ - /* needRefresh = (pBIOSInfo->Clock * 1000) / (pBIOSInfo->HTotal * pBIOSInfo->VTotal); */ - /* Do rounding */ - needRefresh = ((pBIOSInfo->Clock * 10000) / (pBIOSInfo->HTotal * pBIOSInfo->VTotal) + 5) / 10; - pBIOSInfo->Refresh = needRefresh; - refIndex = VIAFindSupportRefreshRate(pBIOSInfo, j); - needRefresh = pBIOSInfo->FoundRefresh; - if (refIndex < 0) { - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "Mode setting in XF86Config(-4) is not supported!!\n"); - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "Please use lower bpp or resolution.\n"); - return FALSE; - } - } - - refreshMode = 0xFF; - maxRefresh = 0; - - while (pViaModeTable->refreshTable[j][k].refresh != 0x0) { - refresh = pViaModeTable->refreshTable[j][k].refresh; - if (refresh != 0xFF) { - if ((refresh <= needRefresh) && (refresh > maxRefresh)) { - refreshMode = k; - maxRefresh = refresh; - } - } - k++; - } - - if ((refreshMode == 0xFF) && (needRefresh < 60)) { - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "VIASetModeUseBIOSTable: Cannot Find suitable refresh!!\n"); - return FALSE; - } - - k = refreshMode; - } - - pBIOSInfo->mode = i; - pBIOSInfo->resMode = j; - pBIOSInfo->refresh = k; - /* pBIOSInfo->widthByQWord = (pBIOSInfo->displayWidth * (pBIOSInfo->bitsPerPixel >> 3)) >> 3; */ - pBIOSInfo->offsetWidthByQWord = (pBIOSInfo->displayWidth * (pBIOSInfo->bitsPerPixel >> 3)) >> 3; - pBIOSInfo->countWidthByQWord = (pBIOSInfo->CrtcHDisplay * (pBIOSInfo->bitsPerPixel >> 3)) >> 3; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "pBISOInfo->FoundRefresh: %d\n", pBIOSInfo->FoundRefresh)); - return TRUE; -} - -void VIASetLCDMode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia = pBIOSInfo; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - CARD8 modeNum; - int resIdx; - int port, offset, data; - int resMode = pBIOSInfo->resMode; - int i, j, k, misc; - - - modeNum = (CARD8)(pViaModeTable->Modes[pBIOSInfo->mode].Mode); - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASetLCDMode\n")); - /* Panel Size 1600x1200 Not Supported Now*/ - if (pBIOSInfo->PanelSize == VIA_PANEL16X12) { - xfree(pViaModeTable->BIOSDate); - xfree(pViaModeTable->Modes); - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "VIASetModeUseBIOSTable: Panel Size Not Support!!\n"); - } - - /* Find Panel Size Index */ - for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) { - if (pViaModeTable->lcdTable[i].fpSize == pBIOSInfo->PanelSize) - break; - }; - - if (i == VIA_BIOS_NUM_PANEL) { - xfree(pViaModeTable->BIOSDate); - xfree(pViaModeTable->Modes); - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "VIASetModeUseBIOSTable: Panel Size Not Support!!\n"); - } - - if (pBIOSInfo->PanelSize == VIA_PANEL12X10) { - VGAOUT8(0x3d4, 0x89); - VGAOUT8(0x3d5, 0x07); - } - - /* LCD Expand Mode Y Scale Flag */ - pBIOSInfo->scaleY = FALSE; - - /* Set LCD InitTb Regs */ - - /* Set LClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk & 0xFF)); - } - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB); - - if (!pBIOSInfo->IsSecondary) { - /* Set VClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk & 0xFF)); - } - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - } - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - - for (j = 0; - j < pViaModeTable->lcdTable[i].InitTb.numEntry; - j++) - { - port = pViaModeTable->lcdTable[i].InitTb.port[j]; - offset = pViaModeTable->lcdTable[i].InitTb.offset[j]; - data = pViaModeTable->lcdTable[i].InitTb.data[j]; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - } - - if ((pBIOSInfo->CrtcHDisplay == pBIOSInfo->panelX) && - (pBIOSInfo->CrtcVDisplay == pBIOSInfo->panelY)) { - /* Set LClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk & 0xFF)); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB); - - if (!pBIOSInfo->IsSecondary) { - /* Set VClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk & 0xFF)); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - } - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - else { - if (!(pBIOSInfo->Center)) { - /* LCD Expand Mode Y Scale Flag */ - pBIOSInfo->scaleY = TRUE; - } - - resIdx = VIA_RES_INVALID; - - /* Find MxxxCtr & MxxxExp Index and - * HWCursor Y Scale (PanelSize Y / Res. Y) */ - pBIOSInfo->resY = pBIOSInfo->CrtcVDisplay; - switch (resMode) { - case VIA_RES_640X480: - resIdx = 0; - break; - case VIA_RES_800X600: - resIdx = 1; - break; - case VIA_RES_1024X768: - resIdx = 2; - break; - case VIA_RES_1152X864: - resIdx = 3; - break; - case VIA_RES_1280X768: - case VIA_RES_1280X960: - case VIA_RES_1280X1024: - if (pBIOSInfo->PanelSize == VIA_PANEL12X10) - resIdx = VIA_RES_INVALID; - else - resIdx = 4; - break; - default: - resIdx = VIA_RES_INVALID; - break; - } - - if ((pBIOSInfo->CrtcHDisplay == 640) && - (pBIOSInfo->CrtcVDisplay == 400)) - resIdx = 0; - - if (pBIOSInfo->Center) { - if (resIdx != VIA_RES_INVALID) { - /* Set LCD MxxxCtr Regs */ - for (j = 0; - j < pViaModeTable->lcdTable[i].MCtr[resIdx].numEntry; - j++) - { - port = pViaModeTable->lcdTable[i].MCtr[resIdx].port[j]; - offset = pViaModeTable->lcdTable[i].MCtr[resIdx].offset[j]; - data = pViaModeTable->lcdTable[i].MCtr[resIdx].data[j]; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - } - - /* Set LClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MCtr[resIdx].LCDClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MCtr[resIdx].LCDClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MCtr[resIdx].LCDClk >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MCtr[resIdx].LCDClk & 0xFF)); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB); - - if (!pBIOSInfo->IsSecondary) { - /* Set VClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MCtr[resIdx].VClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MCtr[resIdx].VClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MCtr[resIdx].VClk >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MCtr[resIdx].VClk & 0xFF)); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - } - } - - for (j = 0; j < pViaModeTable->modeFix.numEntry; j++) { - if (pViaModeTable->modeFix.reqMode[j] == modeNum) { - modeNum = pViaModeTable->modeFix.fixMode[j]; - break; - } - } - - for (j = 0; j < pViaModeTable->lcdTable[i].numMPatchDP2Ctr; j++) { - if (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].Mode == modeNum) - break; - } - - if (j != pViaModeTable->lcdTable[i].numMPatchDP2Ctr) { - /* Set LCD MPatchDP2Ctr Regs */ - for (k = 0; - k < pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].numEntry; - k++) - { - port = pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].port[k]; - offset = pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].offset[k]; - data = pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].data[k]; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - } - - /* Set LClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk & 0xFF)); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB); - - if (!pBIOSInfo->IsSecondary) { - /* Set VClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk & 0xFF)); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - } - } - - for (j = 0; j < pViaModeTable->lcdTable[i].numMPatchDP1Ctr; j++) { - if (pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].Mode == modeNum) - break; - } - - if ((j != pViaModeTable->lcdTable[i].numMPatchDP1Ctr) && - pBIOSInfo->IsSecondary) { - /* Set LCD MPatchDP1Ctr Regs */ - for (k = 0; - k < pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].numEntry; - k++) - { - port = pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].port[k]; - offset = pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].offset[k]; - data = pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].data[k]; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - } - } - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - - } - else { - if (resIdx != VIA_RES_INVALID) { - /* Set LCD MxxxExp Regs */ - for (j = 0; - j < pViaModeTable->lcdTable[i].MExp[resIdx].numEntry; - j++) - { - port = pViaModeTable->lcdTable[i].MExp[resIdx].port[j]; - offset = pViaModeTable->lcdTable[i].MExp[resIdx].offset[j]; - data = pViaModeTable->lcdTable[i].MExp[resIdx].data[j]; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - } - - /* Set LClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MExp[resIdx].LCDClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MExp[resIdx].LCDClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MExp[resIdx].LCDClk >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MExp[resIdx].LCDClk & 0xFF)); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB); - - if (!pBIOSInfo->IsSecondary) { - /* Set VClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MExp[resIdx].VClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MExp[resIdx].VClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MExp[resIdx].VClk >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MExp[resIdx].VClk & 0xFF)); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - } - } - - for (j = 0; j < pViaModeTable->modeFix.numEntry; j++) { - if (pViaModeTable->modeFix.reqMode[j] == modeNum) { - modeNum = pViaModeTable->modeFix.fixMode[j]; - break; - } - } - - for (j = 0; j < pViaModeTable->lcdTable[i].numMPatchDP2Exp; j++) { - if (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].Mode == modeNum) - break; - } - - if (j != pViaModeTable->lcdTable[i].numMPatchDP2Exp) { - if (pBIOSInfo->CrtcHDisplay == pBIOSInfo->panelX) - pBIOSInfo->scaleY = FALSE; - /* Set LCD MPatchExp Regs */ - for (k = 0; - k < pViaModeTable->lcdTable[i].MPatchDP2Exp[j].numEntry; - k++) - { - port = pViaModeTable->lcdTable[i].MPatchDP2Exp[j].port[k]; - offset = pViaModeTable->lcdTable[i].MPatchDP2Exp[j].offset[k]; - data = pViaModeTable->lcdTable[i].MPatchDP2Exp[j].data[k]; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - } - - /* Set LClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk >> 8)); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk & 0xFF)); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB); - - if (!pBIOSInfo->IsSecondary) { - /* Set VClk */ - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk_12Bit >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk_12Bit & 0xFF)); - } - else { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, - (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk & 0xFF)); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - } - } - - for (j = 0; j < pViaModeTable->lcdTable[i].numMPatchDP1Exp; j++) { - if (pViaModeTable->lcdTable[i].MPatchDP1Exp[j].Mode == modeNum) - break; - } - - if ((j != pViaModeTable->lcdTable[i].numMPatchDP1Exp) && - pBIOSInfo->IsSecondary) { - /* Set LCD MPatchDP1Ctr Regs */ - for (k = 0; - k < pViaModeTable->lcdTable[i].MPatchDP1Exp[j].numEntry; - k++) - { - port = pViaModeTable->lcdTable[i].MPatchDP1Exp[j].port[k]; - offset = pViaModeTable->lcdTable[i].MPatchDP1Exp[j].offset[k]; - data = pViaModeTable->lcdTable[i].MPatchDP1Exp[j].data[k]; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - } - } - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - } - - /* LCD patch 3D5.02 */ - VGAOUT8(0x3d4, 0x01); - misc = VGAIN8(0x3d5); - VGAOUT8(0x3d4, 0x02); - VGAOUT8(0x3d5, misc); - - /* Enable LCD */ - if (!pBIOSInfo->IsSecondary) { - /* CRT Display Source Bit 6 - 0: CRT, 1: LCD */ - VGAOUT8(0x3c4, 0x16); - VGAOUT8(0x3c5, VGAIN(0x3c5) | 0x40); - - /* Enable Simultaneous */ - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, 0xA8); - if (pBIOSInfo->Chipset == VIA_CLE266 && pBIOSInfo->ChipRev < 15) { - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, 0xB1); - } - else { - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, 0xAF); - } - } - else { - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x08); - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, 0x0); - } - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, 0x48); - } - else { - /* CRT Display Source Bit 6 - 0: CRT, 1: LCD */ - VGAOUT8(0x3c4, 0x16); - VGAOUT8(0x3c5, VGAIN(0x3c5) & ~0x40); - - /* Enable SAMM */ - if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x20); - if (pBIOSInfo->Chipset == VIA_CLE266 && pBIOSInfo->ChipRev < 15) { - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, 0xB1); - } - else { - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, 0xAF); - } - } - else { - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, 0); - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, 0x0); - } - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, 0xC8); - } -} - -void VIAPreSetTV2Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - CARD8 *TV; - CARD16 *DotCrawl, *Patch2; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int i, j; - unsigned char W_Buffer[VIA_BIOS_MAX_NUM_TV_REG+1]; - unsigned char W_Other[2]; - int w_bytes; - I2CDevPtr dev; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetTV2Mode\n")); - pVia = pBIOSInfo; - TV = NULL; - DotCrawl = NULL; - Patch2 = NULL; - W_Buffer[0] = 0; - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) { - W_Buffer[i+1] = pBIOSInfo->TVRegs[i]; - } - - if (pBIOSInfo->TVType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - Patch2 = pViaModeTable->tv2Table[tvIndx].PatchPAL2; - if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE) - TV = pViaModeTable->tv2Table[tvIndx].TVPALC; - else - TV = pViaModeTable->tv2Table[tvIndx].TVPALS; - break; - case VIA_TVOVER: - Patch2 = pViaModeTable->tv2OverTable[tvIndx].PatchPAL2; - if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE) - TV = pViaModeTable->tv2OverTable[tvIndx].TVPALC; - else - TV = pViaModeTable->tv2OverTable[tvIndx].TVPALS; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - Patch2 = pViaModeTable->tv2Table[tvIndx].PatchNTSC2; - DotCrawl = pViaModeTable->tv2Table[tvIndx].DotCrawlNTSC; - if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE) - TV = pViaModeTable->tv2Table[tvIndx].TVNTSCC; - else - TV = pViaModeTable->tv2Table[tvIndx].TVNTSCS; - break; - case VIA_TVOVER: - Patch2 = pViaModeTable->tv2OverTable[tvIndx].PatchNTSC2; - DotCrawl = pViaModeTable->tv2OverTable[tvIndx].DotCrawlNTSC; - if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE) - TV = pViaModeTable->tv2OverTable[tvIndx].TVNTSCC; - else - TV = pViaModeTable->tv2OverTable[tvIndx].TVNTSCS; - break; - } - } - - /* Set TV mode */ - for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numTV - && j < VIA_BIOS_MAX_NUM_TV_REG ; j++) { - if (pViaModeTable->tv2MaskTable.TV[j] == 0xFF) { - W_Buffer[j+1] = TV[j]; - i++; - } - } - - w_bytes = j + 1; - - dev = xf86CreateI2CDevRec(); - dev->DevName = "VT1621"; - dev->SlaveAddr = 0x40; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - xf86I2CDevInit(dev); - - xf86I2CWriteRead(dev, W_Buffer,w_bytes, NULL,0); - - /* Turn on all Composite and S-Video output */ - W_Other[0] = 0x0E; - W_Other[1] = 0; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - - if (pBIOSInfo->TVDotCrawl && (pBIOSInfo->TVType == TVTYPE_NTSC)) { - int numReg = (int)(DotCrawl[0]); - - for (i = 1; i < (numReg + 1); i++) { - W_Other[0] = (unsigned char)(DotCrawl[i] & 0xFF); - if (W_Other[0] == 0x11) { - xf86I2CWriteRead(dev, W_Other,1, R_Buffer,1); - W_Other[1] = R_Buffer[0] | (unsigned char)(DotCrawl[i] >> 8); - } - else { - W_Other[1] = (unsigned char)(DotCrawl[i] >> 8); - } - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - } - - if (pBIOSInfo->IsSecondary) { - int numPatch; - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->tv2MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - W_Other[0] = (unsigned char)(Patch2[i] & 0xFF); - W_Other[1] = (unsigned char)(Patch2[i] >> 8); - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - } - - xf86DestroyI2CDevRec(dev,TRUE); -} - -void VIAPreSetCH7019Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - CARD8 *TV; - CARD16 *DotCrawl, *Patch2; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int i, j; - unsigned char W_Buffer[VIA_BIOS_MAX_NUM_TV_REG + 1]; - unsigned char W_Other[2]; - int w_bytes; - I2CDevPtr dev; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetCH7019Mode\n")); - pVia = pBIOSInfo; - DotCrawl = NULL; - Patch2 = NULL; - TV = NULL; - W_Buffer[0] = 0; - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) { - W_Buffer[i+1] = pBIOSInfo->TVRegs[i]; - } - - if (pBIOSInfo->TVType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->ch7019Table[tvIndx].TVPAL; - Patch2 = pViaModeTable->ch7019Table[tvIndx].PatchPAL2; - break; - case VIA_TVOVER: - TV = pViaModeTable->ch7019OverTable[tvIndx].TVPAL; - Patch2 = pViaModeTable->ch7019OverTable[tvIndx].PatchPAL2; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->ch7019Table[tvIndx].TVNTSC; - DotCrawl = pViaModeTable->ch7019Table[tvIndx].DotCrawlNTSC; - Patch2 = pViaModeTable->ch7019Table[tvIndx].PatchNTSC2; - break; - case VIA_TVOVER: - TV = pViaModeTable->ch7019OverTable[tvIndx].TVNTSC; - DotCrawl = pViaModeTable->ch7019OverTable[tvIndx].DotCrawlNTSC; - Patch2 = pViaModeTable->ch7019OverTable[tvIndx].PatchNTSC2; - break; - } - } - - for (i = 0, j = 0; i < pViaModeTable->ch7019MaskTable.numTV - && j < VIA_BIOS_MAX_NUM_TV_REG ; j++) { - if (pViaModeTable->ch7019MaskTable.TV[j] == 0xFF) { - W_Buffer[j+1] = TV[j]; - i++; - } - } - - w_bytes = j + 1; - - dev = xf86CreateI2CDevRec(); - dev->DevName = "CH7019"; - dev->SlaveAddr = 0xEA; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - xf86I2CDevInit(dev); - - /* Disable TV avoid set mode garbage */ - W_Other[0] = 0x49; - W_Other[1] = 0X3E; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - W_Other[0] = 0x1E; - W_Other[1] = 0xD0; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - - xf86I2CWriteRead(dev, W_Buffer,w_bytes, NULL,0); - - if (pBIOSInfo->TVDotCrawl && (pBIOSInfo->TVType == TVTYPE_NTSC)) { - int numReg = (int)(DotCrawl[0]); - - for (i = 1; i < (numReg + 1); i++) { - W_Other[0] = (unsigned char)(DotCrawl[i] & 0xFF); - if (W_Other[0] == 0x11) { - xf86I2CWriteRead(dev, W_Other,1, R_Buffer,1); - W_Other[1] = R_Buffer[0] | (unsigned char)(DotCrawl[i] >> 8); - } - else { - W_Other[1] = (unsigned char)(DotCrawl[i] >> 8); - } - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - } - - /* Turn TV CH7019 DAC On */ - W_Other[0] = 0x49; - W_Other[1] = 0x20; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - - if (pBIOSInfo->IsSecondary) { - int numPatch; - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->ch7019MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - W_Other[0] = (unsigned char)(Patch2[i] & 0xFF); - W_Other[1] = (unsigned char)(Patch2[i] >> 8); - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - } - - xf86DestroyI2CDevRec(dev,TRUE); -} - -void VIAPreSetFS454Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - VIABIOSFS454TVMASKTablePtr TVMaskTbl; - CARD16 *TV, *DotCrawl, *RGB, *YCbCr; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int tvType = pBIOSInfo->TVType; - int i, numReg; - unsigned char W_Buffer[2]; - unsigned char R_Buffer[1]; - I2CDevPtr dev; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetFS454Mode\n")); - pVia = pBIOSInfo; - TV = NULL; - DotCrawl = NULL; - RGB = NULL; - YCbCr = NULL; - W_Buffer[0] = 0; - - TVMaskTbl = &pViaModeTable->fs454MaskTable; - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->fs454Table[tvIndx].TVNTSC; - DotCrawl = pViaModeTable->fs454Table[tvIndx].DotCrawlNTSC; - RGB = pViaModeTable->fs454Table[tvIndx].RGBNTSC; - YCbCr = pViaModeTable->fs454Table[tvIndx].YCbCrNTSC; - break; - case VIA_TVOVER: - TV = pViaModeTable->fs454OverTable[tvIndx].TVNTSC; - DotCrawl = pViaModeTable->fs454OverTable[tvIndx].DotCrawlNTSC; - RGB = pViaModeTable->fs454OverTable[tvIndx].RGBNTSC; - YCbCr = pViaModeTable->fs454OverTable[tvIndx].YCbCrNTSC; - break; - } - - dev = xf86CreateI2CDevRec(); - dev->DevName = "FS454"; - dev->SlaveAddr = 0xD4; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - xf86I2CDevInit(dev); - - /* Turn on all Composite and S-Video output */ - numReg = (int)(TV[0]); - for (i = 1; i < (numReg + 1); i++){ - W_Buffer[0] = (unsigned char)(TV[i] & 0xFF);; - W_Buffer[1] = (unsigned char)(TV[i] >> 8); - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - } - - if (pBIOSInfo->TVDotCrawl && (tvType == TVTYPE_NTSC)) { - numReg = (int)(DotCrawl[0]); - for (i = 1; i < (numReg + 1); i++) { - W_Buffer[0] = (unsigned char)(DotCrawl[i] & 0xFF); - if (W_Buffer[0] == 0x11) { - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - W_Buffer[1] = R_Buffer[0] | (unsigned char)(DotCrawl[i] >> 8); - } - else { - W_Buffer[1] = (unsigned char)(DotCrawl[i] >> 8); - } - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - } - } - - if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) { - numReg = (int)(RGB[0]); - for (i = 1; i < (numReg + 1); i++) { - W_Buffer[0] = (unsigned char)(RGB[i] & 0xFF); - W_Buffer[1] = (unsigned char)(RGB[i] >> 8); - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - } - } - - if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) { - numReg = (int)(YCbCr[0]); - for (i = 1; i < (numReg + 1); i++) { - W_Buffer[0] = (unsigned char)(YCbCr[i] & 0xFF); - W_Buffer[1] = (unsigned char)(YCbCr[i] >> 8); - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - } - } - - xf86DestroyI2CDevRec(dev,TRUE); -} - -void VIAPreSetSAA7108Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - CARD8 *TV; - CARD16 *RGB, *YCbCr, *Patch2; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int i, j; - unsigned char W_Buffer[VIA_BIOS_MAX_NUM_SAA7108_TV_REG + 1]; - unsigned char W_Other[4]; - int w_bytes; - I2CDevPtr dev; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetSAA7108Mode\n")); - pVia = pBIOSInfo; - RGB = NULL; - YCbCr = NULL; - Patch2 = NULL; - TV = NULL; - W_Buffer[0] = 0; - for (i = 0; i < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; i++) { - W_Buffer[i+1] = pBIOSInfo->TVRegs[i]; - } - - if (pBIOSInfo->TVType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->saa7108Table[tvIndx].TVPAL; - RGB = pViaModeTable->saa7108Table[tvIndx].RGBPAL; - YCbCr = pViaModeTable->saa7108Table[tvIndx].YCbCrPAL; - Patch2 = pViaModeTable->saa7108Table[tvIndx].PatchPAL2; - break; - case VIA_TVOVER: - TV = pViaModeTable->saa7108OverTable[tvIndx].TVPAL; - RGB = pViaModeTable->saa7108OverTable[tvIndx].RGBPAL; - YCbCr = pViaModeTable->saa7108OverTable[tvIndx].YCbCrPAL; - Patch2 = pViaModeTable->saa7108OverTable[tvIndx].PatchPAL2; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->saa7108Table[tvIndx].TVNTSC; - RGB = pViaModeTable->saa7108Table[tvIndx].RGBNTSC; - YCbCr = pViaModeTable->saa7108Table[tvIndx].YCbCrNTSC; - Patch2 = pViaModeTable->saa7108Table[tvIndx].PatchNTSC2; - break; - case VIA_TVOVER: - TV = pViaModeTable->saa7108OverTable[tvIndx].TVNTSC; - RGB = pViaModeTable->saa7108OverTable[tvIndx].RGBNTSC; - YCbCr = pViaModeTable->saa7108OverTable[tvIndx].YCbCrNTSC; - Patch2 = pViaModeTable->saa7108OverTable[tvIndx].PatchNTSC2; - break; - } - } - - for (i = 0, j = 0; i < pViaModeTable->saa7108MaskTable.numTV - && j < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; j++) { - if (pViaModeTable->saa7108MaskTable.TV[j] == 0xFF) { - W_Buffer[j+1] = TV[j]; - i++; - } - } - - w_bytes = j + 1; - - dev = xf86CreateI2CDevRec(); - dev->DevName = "SAA7108"; - dev->SlaveAddr = pBIOSInfo->TVI2CAdd; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - xf86I2CDevInit(dev); - - /* Initial SAA7108AE TV Encoder */ - W_Other[0] = 0x2D; - W_Other[1] = 0x08; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - W_Other[0] = 0xFD; - W_Other[1] = 0x80; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - W_Other[0] = 0x37; - W_Other[1] = 0x12; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - W_Other[0] = 0x3A; - W_Other[1] = 0x04; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - W_Other[0] = 0xA2; - W_Other[1] = 0x0; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - W_Other[0] = 0xFA; - W_Other[1] = 0x07; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - W_Other[0] = 0x17; - W_Other[1] = 0x1B; - W_Other[2] = 0x1B; - W_Other[3] = 0x1F; - xf86I2CWriteRead(dev, W_Other,4, NULL,0); - W_Other[0] = 0x38; - W_Other[1] = 0x1A; - W_Other[2] = 0x1A; - xf86I2CWriteRead(dev, W_Other,3, NULL,0); - W_Other[0] = 0x20; - W_Other[1] = 0x0; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - - xf86I2CWriteRead(dev, W_Buffer,w_bytes, NULL,0); - - /* Turn on all Composite and S-Video output ,Enable TV */ - if ((pBIOSInfo->TVOutput == TVOUTPUT_SVIDEO) || - (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE)) { - W_Other[0] = 0x2D; - W_Other[1] = 0xB4; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - else if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) { - int numReg = (int)(RGB[0]); - for (i = 1; i < (numReg + 1); i++) { - W_Other[0] = (unsigned char)(RGB[i] & 0xFF); - W_Other[1] = (unsigned char)(RGB[i] >> 8); - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - W_Other[0] = 0x2D; - W_Other[1] = 0; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - else if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) { - int numReg = (int)(YCbCr[0]); - for (i = 1; i < (numReg + 1); i++) { - W_Other[0] = (unsigned char)(YCbCr[i] & 0xFF); - W_Other[1] = (unsigned char)(YCbCr[i] >> 8); - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - W_Other[0] = 0x2D; - W_Other[1] = 0x84; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - - if (pBIOSInfo->IsSecondary) { - int numPatch; - - /* Patch as setting 2nd path */ - numPatch = (int)(pViaModeTable->saa7108MaskTable.misc2 >> 5); - for (i = 0; i < numPatch; i++) { - W_Other[0] = (unsigned char)(Patch2[i] & 0xFF); - W_Other[1] = (unsigned char)(Patch2[i] >> 8); - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - } - - xf86DestroyI2CDevRec(dev,TRUE); -} - -void VIAPreSetVT1623Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - VIABIOSTVMASKTablePtr TVMaskTbl; - CARD8 *TV; - CARD16 *DotCrawl, *RGB, *YCbCr, *Patch2; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int tvType = pBIOSInfo->TVType; - int i, j; - unsigned char W_Buffer[VIA_BIOS_MAX_NUM_TV_REG + 1]; - unsigned char W_Other[2]; - int w_bytes; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetVT1623Mode\n")); - pVia = pBIOSInfo; - DotCrawl = NULL; - RGB = NULL; - YCbCr = NULL; - Patch2 = NULL; - TV = NULL; - W_Buffer[0] = 0; - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) { - W_Buffer[i+1] = pBIOSInfo->TVRegs[i]; - } - - TVMaskTbl = &pViaModeTable->vt1622aMaskTable; - if (tvType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->vt1622aTable[tvIndx].TVPAL; - RGB = pViaModeTable->vt1622aTable[tvIndx].RGBPAL; - YCbCr = pViaModeTable->vt1622aTable[tvIndx].YCbCrPAL; - Patch2 = pViaModeTable->vt1622aTable[tvIndx].PatchPAL2; - break; - case VIA_TVOVER: - TV = pViaModeTable->vt1622aOverTable[tvIndx].TVPAL; - RGB = pViaModeTable->vt1622aOverTable[tvIndx].RGBPAL; - YCbCr = pViaModeTable->vt1622aOverTable[tvIndx].YCbCrPAL; - Patch2 = pViaModeTable->vt1622aOverTable[tvIndx].PatchPAL2; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->vt1622aTable[tvIndx].TVNTSC; - DotCrawl = pViaModeTable->vt1622aTable[tvIndx].DotCrawlNTSC; - RGB = pViaModeTable->vt1622aTable[tvIndx].RGBNTSC; - YCbCr = pViaModeTable->vt1622aTable[tvIndx].YCbCrNTSC; - Patch2 = pViaModeTable->vt1622aTable[tvIndx].PatchNTSC2; - break; - case VIA_TVOVER: - TV = pViaModeTable->vt1622aOverTable[tvIndx].TVNTSC; - DotCrawl = pViaModeTable->vt1622aOverTable[tvIndx].DotCrawlNTSC; - RGB = pViaModeTable->vt1622aOverTable[tvIndx].RGBNTSC; - YCbCr = pViaModeTable->vt1622aOverTable[tvIndx].YCbCrNTSC; - Patch2 = pViaModeTable->vt1622aOverTable[tvIndx].PatchNTSC2; - break; - } - } - - for (i = 0, j = 0; i < TVMaskTbl->numTV - && j < VIA_BIOS_MAX_NUM_TV_REG ; j++) { - if (TVMaskTbl->TV[j] == 0xFF) { - W_Buffer[j+1] = TV[j]; - i++; - } - } - w_bytes = j + 1; - - VIAGPIOI2C_Initial(pBIOSInfo, 0x40); - /* TV Reset */ - VIAGPIOI2C_Write(pBIOSInfo, 0x1D, 0x0); - VIAGPIOI2C_Write(pBIOSInfo, 0x1D, 0x80); - - for (i = 0; i < w_bytes && i < VIA_BIOS_MAX_NUM_TV_REG; i++) { - VIAGPIOI2C_Write(pBIOSInfo, i, W_Buffer[i+1]); - } - - /* Turn on all Composite and S-Video output */ - VIAGPIOI2C_Write(pBIOSInfo, 0x0E, 0x0); - - if (pBIOSInfo->TVDotCrawl && (tvType == TVTYPE_NTSC)) { - int numReg = (int)(DotCrawl[0]); - - for (i = 1; i < (numReg + 1); i++) { - W_Other[0] = (unsigned char)(DotCrawl[i] & 0xFF); - if (W_Other[0] == 0x11) { - VIAGPIOI2C_Read(pBIOSInfo, 0x11, R_Buffer, 1); - W_Other[1] = R_Buffer[0] | (unsigned char)(DotCrawl[i] >> 8); - } - else { - W_Other[1] = (unsigned char)(DotCrawl[i] >> 8); - } - VIAGPIOI2C_Write(pBIOSInfo, W_Other[0], W_Other[1]); - } - } - - if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) { - int numReg = (int)(RGB[0]); - - for (i = 1; i < (numReg + 1); i++) { - W_Other[0] = (unsigned char)(RGB[i] & 0xFF); - W_Other[1] = (unsigned char)(RGB[i] >> 8); - VIAGPIOI2C_Write(pBIOSInfo, W_Other[0], W_Other[1]); - } - - } - - if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) { - int numReg = (int)(YCbCr[0]); - - for (i = 1; i < (numReg + 1); i++) { - W_Other[0] = (unsigned char)(YCbCr[i] & 0xFF); - W_Other[1] = (unsigned char)(YCbCr[i] >> 8); - VIAGPIOI2C_Write(pBIOSInfo, W_Other[0], W_Other[1]); - } - - } - - if (pBIOSInfo->IsSecondary) { - int numPatch; - - /* Patch as setting 2nd path */ - numPatch = (int)(TVMaskTbl->misc2 >> 5); - for (i = 0; i < numPatch; i++) { - W_Other[0] = (unsigned char)(Patch2[i] & 0xFF); - W_Other[1] = (unsigned char)(Patch2[i] >> 8); - VIAGPIOI2C_Write(pBIOSInfo, W_Other[0], W_Other[1]); - } - } -} - -void VIAPostSetCH7019Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - CARD8 *CRTC1, *CRTC2, *Misc1, *Misc2; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int i, j, data; - - pVia = pBIOSInfo; - CRTC1 = NULL; - CRTC2 = NULL; - Misc1 = NULL; - Misc2 = NULL; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostSetCH7019Mode\n")); - - if (pBIOSInfo->TVType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->ch7019Table[tvIndx].CRTCPAL1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCPAL2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCPAL2_32BPP; - break; - } - Misc1 = pViaModeTable->ch7019Table[tvIndx].MiscPAL1; - Misc2 = pViaModeTable->ch7019Table[tvIndx].MiscPAL2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->ch7019OverTable[tvIndx].CRTCPAL1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCPAL2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCPAL2_32BPP; - break; - } - Misc1 = pViaModeTable->ch7019OverTable[tvIndx].MiscPAL1; - Misc2 = pViaModeTable->ch7019OverTable[tvIndx].MiscPAL2; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->ch7019Table[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->ch7019Table[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->ch7019Table[tvIndx].MiscNTSC2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->ch7019OverTable[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->ch7019OverTable[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->ch7019OverTable[tvIndx].MiscNTSC2; - break; - } - } - - if (pBIOSInfo->IsSecondary) { - for (i = 0, j = 0; i < pViaModeTable->ch7019MaskTable.numCRTC2; j++) { - if (pViaModeTable->ch7019MaskTable.CRTC2[j] == 0xFF) { - VGAOUT8(0x3d4, j + 0x50); - VGAOUT8(0x3d5, CRTC2[j]); - i++; - } - } - - j = 3; - - if (pViaModeTable->ch7019MaskTable.misc2 & 0x18) { - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, Misc2[j++]); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, Misc2[j++]); - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB); - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0xC0); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01); - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01); - - /* Disable LCD Scaling */ - if (!pBIOSInfo->SAMM || pBIOSInfo->FirstInit) { - VGAOUT8(0x3d4, 0x79); - VGAOUT8(0x3d5, 0); - } - } - else { - for (i = 0, j = 0; i < pViaModeTable->ch7019MaskTable.numCRTC1; j++) { - if (pViaModeTable->ch7019MaskTable.CRTC1[j] == 0xFF) { - VGAOUT8(0x3d4, j); - VGAOUT8(0x3d5, CRTC1[j]); - i++; - } - } - - j = 0; - - VGAOUT8(0x3d4, 0x33); - if (Misc1[j] & 0x20) { - VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20)); - j++; - } - else { - VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf)); - j++; - } - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, Misc1[j++]); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, Misc1[j++] | 0x01); - - if (!pBIOSInfo->A2) { - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, (Misc1[j++] & 0xE1) | 0x01); - } - else { - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, Misc1[j++] | 0x01); - } - - if (pViaModeTable->ch7019MaskTable.misc1 & 0x30) { - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, Misc1[j++]); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, Misc1[j++]); - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - } -} - -void VIAPostSetFS454Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - CARD8 *CRTC1, *CRTC2, *Misc1, *Misc2; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int i, j, data; - - - pVia = pBIOSInfo; - CRTC1 = NULL; - CRTC2 = NULL; - Misc1 = NULL; - Misc2 = NULL; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostSetFS454Mode\n")); - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->fs454Table[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->fs454Table[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->fs454Table[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->fs454Table[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->fs454Table[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->fs454Table[tvIndx].MiscNTSC2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->fs454OverTable[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->fs454OverTable[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->fs454OverTable[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->fs454OverTable[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->fs454OverTable[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->fs454OverTable[tvIndx].MiscNTSC2; - break; - } - - for (i = 0, j = 0; i < pViaModeTable->fs454MaskTable.numCRTC1; j++) { - if (pViaModeTable->fs454MaskTable.CRTC1[j] == 0xFF) { - VGAOUT8(0x3d4, j); - VGAOUT8(0x3d5, CRTC1[j]); - i++; - } - } - - j = 0; - - VGAOUT8(0x3d4, 0x33); - if (Misc1[j] & 0x20) { - VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20)); - j++; - } - else { - VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf)); - j++; - } - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, Misc1[j++]); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, Misc1[j++] | 0x01); - - if (!pBIOSInfo->A2) { - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, (Misc1[j++] & 0xE1) | 0x01); - } - else { - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, Misc1[j++] | 0x01); - } - - if (pViaModeTable->fs454MaskTable.misc1 & 0x30) { - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, Misc1[j++]); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, Misc1[j++]); - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } -} - -void VIAPostSetSAA7108Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - CARD8 *CRTC1, *CRTC2, *Misc1, *Misc2; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int i, j, data; - - - pVia = pBIOSInfo; - CRTC1 = NULL; - CRTC2 = NULL; - Misc1 = NULL; - Misc2 = NULL; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostSetSAA7108Mode\n")); - if (pBIOSInfo->TVType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->saa7108Table[tvIndx].CRTCPAL1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCPAL2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCPAL2_32BPP; - break; - } - Misc1 = pViaModeTable->saa7108Table[tvIndx].MiscPAL1; - Misc2 = pViaModeTable->saa7108Table[tvIndx].MiscPAL2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->saa7108OverTable[tvIndx].CRTCPAL1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCPAL2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCPAL2_32BPP; - break; - } - Misc1 = pViaModeTable->saa7108OverTable[tvIndx].MiscPAL1; - Misc2 = pViaModeTable->saa7108OverTable[tvIndx].MiscPAL2; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->saa7108Table[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->saa7108Table[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->saa7108Table[tvIndx].MiscNTSC2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->saa7108OverTable[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->saa7108OverTable[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->saa7108OverTable[tvIndx].MiscNTSC2; - break; - } - } - - if (pBIOSInfo->IsSecondary) { - for (i = 0, j = 0; i < pViaModeTable->saa7108MaskTable.numCRTC2; j++) { - if (pViaModeTable->saa7108MaskTable.CRTC2[j] == 0xFF) { - VGAOUT8(0x3d4, j + 0x50); - VGAOUT8(0x3d5, CRTC2[j]); - i++; - } - } - - j = 3; - - if (pViaModeTable->saa7108MaskTable.misc2 & 0x18) { - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, Misc2[j++]); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, Misc2[j++]); - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB); - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0xC0); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01); - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01); - - /* Disable LCD Scaling */ - if (!pBIOSInfo->SAMM || pBIOSInfo->FirstInit) { - VGAOUT8(0x3d4, 0x79); - VGAOUT8(0x3d5, 0); - } - } - else { - for (i = 0, j = 0; i < pViaModeTable->saa7108MaskTable.numCRTC1; j++) { - if (pViaModeTable->saa7108MaskTable.CRTC1[j] == 0xFF) { - VGAOUT8(0x3d4, j); - VGAOUT8(0x3d5, CRTC1[j]); - i++; - } - } - - j = 0; - - VGAOUT8(0x3d4, 0x33); - if (Misc1[j] & 0x20) { - VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20)); - j++; - } - else { - VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf)); - j++; - } - - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, Misc1[j++]); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, Misc1[j++] | 0x01); - - if (!pBIOSInfo->A2) { - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, (Misc1[j++] & 0xE1) | 0x01); - } - else { - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, Misc1[j++] | 0x01); - } - - if (pViaModeTable->saa7108MaskTable.misc1 & 0x30) { - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, Misc1[j++]); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, Misc1[j++]); - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - } -} - -void VIAPostSetTV2Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - CARD8 *CRTC1, *CRTC2, *Misc1, *Misc2; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int i, j, data; - - - pVia = pBIOSInfo; - CRTC1 = NULL; - CRTC2 = NULL; - Misc1 = NULL; - Misc2 = NULL; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostSetTV2Mode\n")); - if (pBIOSInfo->TVType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->tv2Table[tvIndx].CRTCPAL1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCPAL2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCPAL2_32BPP; - break; - } - Misc1 = pViaModeTable->tv2Table[tvIndx].MiscPAL1; - Misc2 = pViaModeTable->tv2Table[tvIndx].MiscPAL2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->tv2OverTable[tvIndx].CRTCPAL1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCPAL2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCPAL2_32BPP; - break; - } - Misc1 = pViaModeTable->tv2OverTable[tvIndx].MiscPAL1; - Misc2 = pViaModeTable->tv2OverTable[tvIndx].MiscPAL2; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->tv2Table[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->tv2Table[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->tv2Table[tvIndx].MiscNTSC2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->tv2OverTable[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->tv2OverTable[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->tv2OverTable[tvIndx].MiscNTSC2; - break; - } - } - - if (pBIOSInfo->IsSecondary) { - for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numCRTC2; j++) { - if (pViaModeTable->tv2MaskTable.CRTC2[j] == 0xFF) { - VGAOUT8(0x3d4, j + 0x50); - VGAOUT8(0x3d5, CRTC2[j]); - i++; - } - } - - j = 3; - - if (pViaModeTable->tv2MaskTable.misc2 & 0x18) { - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, Misc2[j++]); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, Misc2[j++]); - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB); - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0xC0); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01); - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01); - - /* Disable LCD Scaling */ - if (!pBIOSInfo->SAMM || pBIOSInfo->FirstInit) { - VGAOUT8(0x3d4, 0x79); - VGAOUT8(0x3d5, 0); - } - } - else { - for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numCRTC1; j++) { - if (pViaModeTable->tv2MaskTable.CRTC1[j] == 0xFF) { - VGAOUT8(0x3d4, j); - VGAOUT8(0x3d5, CRTC1[j]); - i++; - } - } - - j = 0; - - VGAOUT8(0x3d4, 0x33); - if (Misc1[j] & 0x20) { - VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20)); - j++; - } - else { - VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf)); - j++; - } - - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, Misc1[j++]); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, Misc1[j++] | 0x01); - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, Misc1[j++] | 0x01); - - if (pViaModeTable->tv2MaskTable.misc1 & 0x30) { - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, Misc1[j++]); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, Misc1[j++]); - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - } -} - -void VIAPreSetTV3Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - VIABIOSTVMASKTablePtr TVMaskTbl; - CARD8 *TV; - CARD16 *DotCrawl, *RGB, *YCbCr, *Patch2; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int tvType = pBIOSInfo->TVType; - int i, j; - unsigned char W_Buffer[VIA_BIOS_MAX_NUM_TV_REG + 1]; - unsigned char W_Other[2]; - int w_bytes; - I2CDevPtr dev; - unsigned char R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetTV3Mode\n")); - pVia = pBIOSInfo; - DotCrawl = NULL; - RGB = NULL; - YCbCr = NULL; - Patch2 = NULL; - TV = NULL; - W_Buffer[0] = 0; - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) { - W_Buffer[i+1] = pBIOSInfo->TVRegs[i]; - } - - if (pBIOSInfo->TVEncoder == VIA_TV3) { - TVMaskTbl = &pViaModeTable->tv3MaskTable; - if (tvType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->tv3Table[tvIndx].TVPAL; - RGB = pViaModeTable->tv3Table[tvIndx].RGBPAL; - YCbCr = pViaModeTable->tv3Table[tvIndx].YCbCrPAL; - Patch2 = pViaModeTable->tv3Table[tvIndx].PatchPAL2; - break; - case VIA_TVOVER: - TV = pViaModeTable->tv3OverTable[tvIndx].TVPAL; - RGB = pViaModeTable->tv3OverTable[tvIndx].RGBPAL; - YCbCr = pViaModeTable->tv3OverTable[tvIndx].YCbCrPAL; - Patch2 = pViaModeTable->tv3OverTable[tvIndx].PatchPAL2; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->tv3Table[tvIndx].TVNTSC; - DotCrawl = pViaModeTable->tv3Table[tvIndx].DotCrawlNTSC; - RGB = pViaModeTable->tv3Table[tvIndx].RGBNTSC; - YCbCr = pViaModeTable->tv3Table[tvIndx].YCbCrNTSC; - Patch2 = pViaModeTable->tv3Table[tvIndx].PatchNTSC2; - break; - case VIA_TVOVER: - TV = pViaModeTable->tv3OverTable[tvIndx].TVNTSC; - DotCrawl = pViaModeTable->tv3OverTable[tvIndx].DotCrawlNTSC; - RGB = pViaModeTable->tv3OverTable[tvIndx].RGBNTSC; - YCbCr = pViaModeTable->tv3OverTable[tvIndx].YCbCrNTSC; - Patch2 = pViaModeTable->tv3OverTable[tvIndx].PatchNTSC2; - break; - } - } - } - else { - TVMaskTbl = &pViaModeTable->vt1622aMaskTable; - if (tvType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->vt1622aTable[tvIndx].TVPAL; - RGB = pViaModeTable->vt1622aTable[tvIndx].RGBPAL; - YCbCr = pViaModeTable->vt1622aTable[tvIndx].YCbCrPAL; - Patch2 = pViaModeTable->vt1622aTable[tvIndx].PatchPAL2; - break; - case VIA_TVOVER: - TV = pViaModeTable->vt1622aOverTable[tvIndx].TVPAL; - RGB = pViaModeTable->vt1622aOverTable[tvIndx].RGBPAL; - YCbCr = pViaModeTable->vt1622aOverTable[tvIndx].YCbCrPAL; - Patch2 = pViaModeTable->vt1622aOverTable[tvIndx].PatchPAL2; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - TV = pViaModeTable->vt1622aTable[tvIndx].TVNTSC; - DotCrawl = pViaModeTable->vt1622aTable[tvIndx].DotCrawlNTSC; - RGB = pViaModeTable->vt1622aTable[tvIndx].RGBNTSC; - YCbCr = pViaModeTable->vt1622aTable[tvIndx].YCbCrNTSC; - Patch2 = pViaModeTable->vt1622aTable[tvIndx].PatchNTSC2; - break; - case VIA_TVOVER: - TV = pViaModeTable->vt1622aOverTable[tvIndx].TVNTSC; - DotCrawl = pViaModeTable->vt1622aOverTable[tvIndx].DotCrawlNTSC; - RGB = pViaModeTable->vt1622aOverTable[tvIndx].RGBNTSC; - YCbCr = pViaModeTable->vt1622aOverTable[tvIndx].YCbCrNTSC; - Patch2 = pViaModeTable->vt1622aOverTable[tvIndx].PatchNTSC2; - break; - } - } - } - - for (i = 0, j = 0; i < TVMaskTbl->numTV - && j < VIA_BIOS_MAX_NUM_TV_REG; j++) { - if (TVMaskTbl->TV[j] == 0xFF) { - W_Buffer[j+1] = TV[j]; - i++; - } - } - w_bytes = j + 1; - - dev = xf86CreateI2CDevRec(); - dev->DevName = "VT1622"; - dev->SlaveAddr = 0x40; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - - xf86I2CDevInit(dev); - - /* TV Reset */ - W_Other[0] = 0x1D; - W_Other[1] = 0; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - W_Other[0] = 0x1D; - W_Other[1] = 0x80; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - - xf86I2CWriteRead(dev, W_Buffer,w_bytes, NULL,0); - - /* Turn on all Composite and S-Video output */ - W_Other[0] = 0x0E; - W_Other[1] = 0; - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - - if (pBIOSInfo->TVDotCrawl && (tvType == TVTYPE_NTSC)) { - int numReg = (int)(DotCrawl[0]); - - for (i = 1; i < (numReg + 1); i++) { - W_Other[0] = (unsigned char)(DotCrawl[i] & 0xFF); - if (W_Other[0] == 0x11) { - xf86I2CWriteRead(dev, W_Other,1, R_Buffer,1); - W_Other[1] = R_Buffer[0] | (unsigned char)(DotCrawl[i] >> 8); - } - else { - W_Other[1] = (unsigned char)(DotCrawl[i] >> 8); - } - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - } - - if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) { - int numReg = (int)(RGB[0]); - - for (i = 1; i < (numReg + 1); i++) { - W_Other[0] = (unsigned char)(RGB[i] & 0xFF); - W_Other[1] = (unsigned char)(RGB[i] >> 8); - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - - } - - if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) { - int numReg = (int)(YCbCr[0]); - - for (i = 1; i < (numReg + 1); i++) { - W_Other[0] = (unsigned char)(YCbCr[i] & 0xFF); - W_Other[1] = (unsigned char)(YCbCr[i] >> 8); - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - - } - - if (pBIOSInfo->IsSecondary) { - int numPatch; - - /* Patch as setting 2nd path */ - numPatch = (int)(TVMaskTbl->misc2 >> 5); - for (i = 0; i < numPatch; i++) { - W_Other[0] = (unsigned char)(Patch2[i] & 0xFF); - W_Other[1] = (unsigned char)(Patch2[i] >> 8); - xf86I2CWriteRead(dev, W_Other,2, NULL,0); - } - } - - xf86DestroyI2CDevRec(dev,TRUE); -} - -void VIAPostSetTV3Mode(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - VIABIOSTVMASKTablePtr TVMaskTbl; - CARD8 *CRTC1, *CRTC2, *Misc1, *Misc2; - unsigned int tvIndx = pBIOSInfo->resTVMode; - int i, j, data; - - - pVia = pBIOSInfo; - CRTC1 = NULL; - CRTC2 = NULL; - Misc1 = NULL; - Misc2 = NULL; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostSetTV3Mode\n")); - if (pBIOSInfo->TVEncoder == VIA_TV3) { - TVMaskTbl = &pViaModeTable->tv3MaskTable; - if (pBIOSInfo->TVType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->tv3Table[tvIndx].CRTCPAL1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCPAL2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCPAL2_32BPP; - break; - } - Misc1 = pViaModeTable->tv3Table[tvIndx].MiscPAL1; - Misc2 = pViaModeTable->tv3Table[tvIndx].MiscPAL2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->tv3OverTable[tvIndx].CRTCPAL1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCPAL2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCPAL2_32BPP; - break; - } - Misc1 = pViaModeTable->tv3OverTable[tvIndx].MiscPAL1; - Misc2 = pViaModeTable->tv3OverTable[tvIndx].MiscPAL2; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->tv3Table[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->tv3Table[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->tv3Table[tvIndx].MiscNTSC2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->tv3OverTable[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->tv3OverTable[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->tv3OverTable[tvIndx].MiscNTSC2; - break; - } - } - } - else { - TVMaskTbl = &pViaModeTable->vt1622aMaskTable; - if (pBIOSInfo->TVType == TVTYPE_PAL) { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->vt1622aTable[tvIndx].CRTCPAL1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCPAL2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCPAL2_32BPP; - break; - } - Misc1 = pViaModeTable->vt1622aTable[tvIndx].MiscPAL1; - Misc2 = pViaModeTable->vt1622aTable[tvIndx].MiscPAL2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCPAL1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCPAL2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCPAL2_32BPP; - break; - } - Misc1 = pViaModeTable->vt1622aOverTable[tvIndx].MiscPAL1; - Misc2 = pViaModeTable->vt1622aOverTable[tvIndx].MiscPAL2; - break; - } - } - else { - switch (pBIOSInfo->TVVScan) { - case VIA_TVNORMAL: - CRTC1 = pViaModeTable->vt1622aTable[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->vt1622aTable[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->vt1622aTable[tvIndx].MiscNTSC2; - break; - case VIA_TVOVER: - CRTC1 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCNTSC1; - switch (pBIOSInfo->bitsPerPixel) { - case 8: - CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCNTSC2_8BPP; - break; - case 16: - CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCNTSC2_32BPP; - break; - } - Misc1 = pViaModeTable->vt1622aOverTable[tvIndx].MiscNTSC1; - Misc2 = pViaModeTable->vt1622aOverTable[tvIndx].MiscNTSC2; - break; - } - } - } - - if (pBIOSInfo->IsSecondary) { - for (i = 0, j = 0; i < TVMaskTbl->numCRTC2; j++) { - if (TVMaskTbl->CRTC2[j] == 0xFF) { - VGAOUT8(0x3d4, j + 0x50); - VGAOUT8(0x3d5, CRTC2[j]); - i++; - } - } - - j = 3; - - if (TVMaskTbl->misc2 & 0x18) { - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - /* CLE266Ax use 2x XCLK */ - if ((pBIOSInfo->Chipset == VIA_CLE266) && - (pBIOSInfo->ChipRev < 15)) { - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x20); - if (pBIOSInfo->A2) { - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x1C); - } - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, 0x47); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, 0x1C); - } - else { - VGAOUT8(0x3c4, 0x44); - VGAOUT8(0x3c5, Misc2[j++]); - VGAOUT8(0x3c4, 0x45); - VGAOUT8(0x3c5, Misc2[j++]); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB); - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0xC0); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01); - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01); - - /* Disable LCD Scaling */ - if (!pBIOSInfo->SAMM || pBIOSInfo->FirstInit) { - VGAOUT8(0x3d4, 0x79); - VGAOUT8(0x3d5, 0); - } - } - else { - for (i = 0, j = 0; i < TVMaskTbl->numCRTC1; j++) { - if (TVMaskTbl->CRTC1[j] == 0xFF) { - VGAOUT8(0x3d4, j); - VGAOUT8(0x3d5, CRTC1[j]); - i++; - } - } - - j = 0; - - VGAOUT8(0x3d4, 0x33); - if (Misc1[j] & 0x20) { - VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20)); - j++; - } - else { - VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf)); - j++; - } - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, Misc1[j++]); - if ((pBIOSInfo->Chipset == VIA_CLE266) && - (pBIOSInfo->ChipRev < 15)) { - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, Misc1[j++] | 0x81); - if (pBIOSInfo->A2) { - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, Misc1[j++] | 0x01); - } - else { - j++; - } - } - else { - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, Misc1[j++] | 0x01); - j++; - } - - if (TVMaskTbl->misc1 & 0x30) { - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - /* CLE266Ax use 2x XCLK */ - if ((pBIOSInfo->Chipset == VIA_CLE266) && - (pBIOSInfo->ChipRev < 15)) { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, 0x47); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, 0x1C); - } - else { - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, Misc1[j++]); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, Misc1[j++]); - } - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x40); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01); - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01); - } -} - -void VIADisableExtendedFIFO(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - CARD32 dwTemp; - - pVia = pBIOSInfo; - - dwTemp = (CARD32)VIAGETREG(0x298); - dwTemp |= 0x20000000; - VIASETREG(0x298, dwTemp); - - dwTemp = (CARD32)VIAGETREG(0x230); - dwTemp &= ~0x00200000; - VIASETREG(0x230, dwTemp); - - dwTemp = (CARD32)VIAGETREG(0x298); - dwTemp &= ~0x20000000; - VIASETREG(0x298, dwTemp); -} - - -void VIAEnableExtendedFIFO(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - CARD32 dwTemp; - CARD8 bTemp; - - pVia = pBIOSInfo; - - dwTemp = (CARD32)VIAGETREG(0x298); - dwTemp |= 0x20000000; - VIASETREG(0x298, dwTemp); - - dwTemp = (CARD32)VIAGETREG(0x230); - dwTemp |= 0x00200000; - VIASETREG(0x230, dwTemp); - - dwTemp = (CARD32)VIAGETREG(0x298); - dwTemp &= ~0x20000000; - VIASETREG(0x298, dwTemp); - - VGAOUT8(0x3C4, 0x17); - bTemp = VGAIN8(0x3C5); - bTemp &= ~0x7F; - bTemp |= 0x2F; - VGAOUT8(0x3C5, bTemp); - - VGAOUT8(0x3C4, 0x16); - bTemp = VGAIN8(0x3C5); - bTemp &= ~0x3F; - bTemp |= 0x17; - VGAOUT8(0x3C5, bTemp); - - VGAOUT8(0x3C4, 0x18); - bTemp = VGAIN8(0x3C5); - bTemp &= ~0x3F; - bTemp |= 0x17; - bTemp |= 0x40; /* force the preq always higher than treq */ - VGAOUT8(0x3C5, bTemp); -} - - -Bool VIASetModeUseBIOSTable(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - UTUSERSETTINGptr pUTUSERSETTING = pBIOSInfo->pUTUSERSETTING; - BOOL setTV = FALSE; - int mode, resMode, refresh; - int port, offset, mask, data; - int countWidthByQWord, offsetWidthByQWord; - int i, j, k, m, n; - unsigned char cr13, cr35, sr1c, sr1d; - CARD8 misc; - - pVia = pBIOSInfo; - mode = pBIOSInfo->mode; - resMode = pBIOSInfo->resMode; - refresh = pBIOSInfo->refresh; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASetModeUseBIOSTable\n")); - /* Turn off Screen */ - VGAOUT8(0x3d4, 17); - VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0x7f)); - - /* Clean Second Path Status */ -#if 0 - if (pBIOSInfo->SAMM) { - if (pBIOSInfo->FirstInit) { - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, 0x40); - if (pBIOSInfo->Chipset == VIA_CLE266 && pBIOSInfo->ChipRev < 15) { - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, VGAIN8(0x3d5 | 0x3E)); - } - else { - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x0E); - } - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0xFE); - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, 0x0); - } - } - else { - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, 0x0); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, 0x0); - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, 0x0); - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, 0x0); - } -#endif - VGAOUT8(0x3d4, 0x6A); - VGAOUT8(0x3d5, 0x0); - VGAOUT8(0x3d4, 0x6B); - VGAOUT8(0x3d5, 0x0); - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, 0x0); - VGAOUT8(0x3d4, 0x93); - VGAOUT8(0x3d5, 0x0); - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "Active Device is %d\n", - pBIOSInfo->ActiveDevice)); - - if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) { - /* Found TV resmod index */ - switch (pBIOSInfo->resMode) { - case VIA_RES_640X480 : - pBIOSInfo->resTVMode = VIA_TVRES_640X480; - break; - case VIA_RES_800X600 : - pBIOSInfo->resTVMode = VIA_TVRES_800X600; - break; - case VIA_RES_1024X768 : - pBIOSInfo->resTVMode = VIA_TVRES_1024X768; - break; - case VIA_RES_848X480 : - pBIOSInfo->resTVMode = VIA_TVRES_848X480; - break; - case VIA_RES_720X480 : - pBIOSInfo->resTVMode = VIA_TVRES_720X480; - pBIOSInfo->TVType = TVTYPE_NTSC; - break; - case VIA_RES_720X576 : - pBIOSInfo->resTVMode = VIA_TVRES_720X576; - pBIOSInfo->TVType = TVTYPE_PAL; - break; - default : - pBIOSInfo->resTVMode = pBIOSInfo->resMode; - break; - } - - switch (pBIOSInfo->TVEncoder) { - case VIA_TV2PLUS: - if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600) { - setTV = TRUE; - VIAPreSetTV2Mode(pBIOSInfo); - } - break; - case VIA_TV3: - case VIA_VT1622A: - if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 || - resMode == VIA_RES_1024X768 || resMode == VIA_RES_720X480 || - resMode == VIA_RES_720X576 || resMode == VIA_RES_848X480) { - setTV = TRUE; - VIAPreSetTV3Mode(pBIOSInfo); - } - break; - case VIA_VT1623: - if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 || - resMode == VIA_RES_1024X768 || resMode == VIA_RES_720X480 || - resMode == VIA_RES_720X576 || resMode == VIA_RES_848X480) { - setTV = TRUE; - VIAPreSetVT1623Mode(pBIOSInfo); - } - break; - case VIA_CH7009: - case VIA_CH7019: - if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 || - resMode == VIA_RES_1024X768) { - setTV = TRUE; - VIAPreSetCH7019Mode(pBIOSInfo); - } - break; - case VIA_SAA7108: - if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 || - resMode == VIA_RES_1024X768 || resMode == VIA_RES_848X480) { - setTV = TRUE; - VIAPreSetSAA7108Mode(pBIOSInfo); - } - break; - case VIA_FS454: - if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 || - resMode == VIA_RES_1024X768 || resMode == VIA_RES_720X480) { - setTV = TRUE; - VIAPreSetFS454Mode(pBIOSInfo); - } - break; - } - } - - /* Close TV Output, if TVEncoder not support current resolution */ - if (!setTV && !pBIOSInfo->SAMM) { - I2CDevPtr dev; - unsigned char W_Buffer[2]; - - dev = xf86CreateI2CDevRec(); - dev->DevName = "TV"; - dev->SlaveAddr = pBIOSInfo->TVI2CAdd; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - if (xf86I2CDevInit(dev)) { - switch (pBIOSInfo->TVEncoder) { - case VIA_TV2PLUS: - W_Buffer[0] = 0x0E; - W_Buffer[1] = 0x03; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - break; - case VIA_TV3: - case VIA_VT1622A: - W_Buffer[0] = 0x0E; - W_Buffer[1] = 0x0F; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - break; - case VIA_VT1623: - VIAGPIOI2C_Initial(pBIOSInfo, 0x40); - VIAGPIOI2C_Write(pBIOSInfo, 0x0E, 0x0F); - break; - case VIA_CH7019: - W_Buffer[0] = 0x49; - W_Buffer[1] = 0x3E; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x1E; - W_Buffer[1] = 0xD0; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - break; - case VIA_SAA7108: - W_Buffer[0] = 0x2D; - W_Buffer[1] = 0x08; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - break; - case VIA_FS454: - default: - break; - } - xf86DestroyI2CDevRec(dev,TRUE); - } - else - xf86DestroyI2CDevRec(dev,TRUE); - } - - i = mode; - - /* Get Standard VGA Regs */ - /* Set Sequences regs */ - for (j = 1; j < 5; j++) { - VGAOUT8(0x3c4, j); - VGAOUT8(0x3c5, pViaModeTable->Modes[i].stdVgaTable.SR[j]); - } - - /* Set Misc reg */ - VGAOUT8(0x3c2, pViaModeTable->Modes[i].stdVgaTable.misc); - - /* Set CRTC regs */ - for (j = 0; j < 25; j++) { - VGAOUT8(0x3d4, j); - VGAOUT8(0x3d5, pViaModeTable->Modes[i].stdVgaTable.CR[j]); - } - - /* Set attribute regs */ - for (j = 0; j < 20; j++) { - misc = VGAIN8(0x3da); - VGAOUT8(0x3c0, j); - VGAOUT8(0x3c0, pViaModeTable->Modes[i].stdVgaTable.AR[j]); - } - - for (j = 0; j < 9; j++) { - VGAOUT8(0x3ce, j); - VGAOUT8(0x3cf, pViaModeTable->Modes[i].stdVgaTable.GR[j]); - } - - /* Unlock Extended regs */ - VGAOUT8(0x3c4, 0x10); - VGAOUT8(0x3c5, 0x01); - - /* Set Commmon Ext. Regs */ - for (j = 0; j < pViaModeTable->commExtTable.numEntry; j++) { - port = pViaModeTable->commExtTable.port[j]; - offset = pViaModeTable->commExtTable.offset[j]; - mask = pViaModeTable->commExtTable.mask[j]; - data = pViaModeTable->commExtTable.data[j] & mask; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - } - - if (pViaModeTable->Modes[i].Mode <= 0x13) { - /* Set Standard Mode-Spec. Extend Regs */ - for (j = 0; j < pViaModeTable->stdModeExtTable.numEntry; j++) { - port = pViaModeTable->stdModeExtTable.port[j]; - offset = pViaModeTable->stdModeExtTable.offset[j]; - mask = pViaModeTable->stdModeExtTable.mask[j]; - data = pViaModeTable->stdModeExtTable.data[j] & mask; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - } - } - else { - /* Set Extended Mode-Spec. Extend Regs */ - for (j = 0; j < pViaModeTable->Modes[i].extModeExtTable.numEntry; j++) { - port = pViaModeTable->Modes[i].extModeExtTable.port[j]; - offset = pViaModeTable->Modes[i].extModeExtTable.offset[j]; - mask = pViaModeTable->Modes[i].extModeExtTable.mask[j]; - data = pViaModeTable->Modes[i].extModeExtTable.data[j] & mask; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - } - } - - j = resMode; - - if ((j != VIA_RES_INVALID) && (refresh != 0xFF) && !setTV) { - k = refresh; - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, (pViaModeTable->refreshTable[j][k].VClk >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, (pViaModeTable->refreshTable[j][k].VClk & 0xFF)); - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - - m = 0; - VGAOUT8(0x3d4, 0x0); - VGAOUT8(0x3d5, pViaModeTable->refreshTable[j][k].CR[m++]); - - for (n = 2; n <= 7; n++) { - VGAOUT8(0x3d4, n); - VGAOUT8(0x3d5, pViaModeTable->refreshTable[j][k].CR[m++]); - } - - for (n = 16; n <= 17; n++) { - VGAOUT8(0x3d4, n); - VGAOUT8(0x3d5, pViaModeTable->refreshTable[j][k].CR[m++]); - } - - for (n = 21; n <= 22; n++) { - VGAOUT8(0x3d4, n); - VGAOUT8(0x3d5, pViaModeTable->refreshTable[j][k].CR[m++]); - } - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - - } - else { - if (pViaModeTable->Modes[i].VClk != 0) { - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F); - - VGAOUT8(0x3c4, 0x46); - VGAOUT8(0x3c5, (pViaModeTable->Modes[i].VClk >> 8)); - VGAOUT8(0x3c4, 0x47); - VGAOUT8(0x3c5, (pViaModeTable->Modes[i].VClk & 0xFF)); - - VGAOUT8(0x3d4, 0x17); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80); - - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02); - VGAOUT8(0x3c4, 0x40); - VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD); - - /* Use external clock */ - data = VGAIN8(0x3cc) | 0x0C; - VGAOUT8(0x3c2, data); - } - } - - /* Set Quadword offset and counter */ - /*=* Fix bandwidth problem when using virtual desktop *=*/ - countWidthByQWord = pBIOSInfo->countWidthByQWord; - offsetWidthByQWord = pBIOSInfo->offsetWidthByQWord; - - VGAOUT8(0x3d4, 0x35); - cr35 = VGAIN8(0x3d5) & 0x1f; - - cr13 = offsetWidthByQWord & 0xFF; - cr35 |= (offsetWidthByQWord & 0x700) >> 3; /* bit 7:5: offset 10:8 */ - - VGAOUT8(0x3c4, 0x1d); - sr1d = VGAIN8(0x3c5); - - /* Patch for non 32bit alignment mode */ - VIAPitchAlignmentPatch(pBIOSInfo); - - /* Enable Refresh to avoid data lose when enter screen saver */ - /* Refresh disable & 128-bit alignment */ - sr1d = (sr1d & 0xfc) | (countWidthByQWord >> 9); - sr1c = ((countWidthByQWord >> 1) + 1) & 0xff; - /* sr1d = ((sr1d & 0xfc) | (widthByQWord >> 8)) | 0x80; */ - /* sr1c = widthByQWord & 0xff; */ - - VGAOUT8(0x3d4, 0x13); - VGAOUT8(0x3d5, cr13); - VGAOUT8(0x3d4, 0x35); - VGAOUT8(0x3d5, cr35); - VGAOUT8(0x3c4, 0x1c); - VGAOUT8(0x3c5, sr1c); - VGAOUT8(0x3c4, 0x1d); - VGAOUT8(0x3c5, sr1d); - - /* Enable MMIO & PCI burst (1 wait state) */ - VGAOUT8(0x3c4, 0x1a); - data = VGAIN8(0x3c5); - VGAOUT8(0x3c5, data | 0x06); - - /* Enable modify CRTC starting address */ - VGAOUT8(0x3d4, 0x11); - misc = VGAIN8(0x3d5); - VGAOUT8(0x3d5, misc & 0x7f); - - if (pBIOSInfo->FirstInit) { - /* Clear Memory */ - memset(pBIOSInfo->FBBase, 0x00, pBIOSInfo->videoRambytes); - /*pBIOSInfo->FirstInit = FALSE;*/ - } - - /*=* Patch for horizontal blanking end bit6 *=*/ - VGAOUT8(0x3d4, 0x02); - data = VGAIN8(0x3d5); /* Save Blanking Start */ - - VGAOUT8(0x3d4, 0x03); - misc = VGAIN8(0x3d5) & 0x1f; /* Save Blanking End bit[4:0] */ - - VGAOUT8(0x3d4, 0x05); - misc |= ((VGAIN8(0x3d5) & 0x80) >> 2); /* Blanking End bit[5:0] */ - - if ((data & 0x3f) > misc) { /* Is Blanking End overflow ? */ - if (data & 0x40) { /* Blanking Start bit6 = ? */ - VGAOUT8(0x3d4, 0x33); /* bit6 = 1, Blanking End bit6 = 0 */ - VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf)); - } - else { - VGAOUT8(0x3d4, 0x33); /* bit6 = 0, Blanking End bit6 = 1 */ - VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20)); - } - } - else { - if (data & 0x40) { /* Blanking Start bit6 = ? */ - VGAOUT8(0x3d4, 0x33); /* bit6 = 1, Blanking End bit6 = 1 */ - VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20)); - } - else { - VGAOUT8(0x3d4, 0x33); /* bit6 = 0, Blanking End bit6 = 0 */ - VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf)); - } - } - - /* LCD Simultaneous Set Mode */ - if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) { - VIASetLCDMode(pBIOSInfo); - VIAEnableLCD(pBIOSInfo); - } - else if ((pBIOSInfo->ConnectedDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) && - (!pBIOSInfo->HasSecondary)) { - VIADisableLCD(pBIOSInfo); - } - - if (setTV) { - switch (pBIOSInfo->TVEncoder) { - case VIA_TV2PLUS: - VIAPostSetTV2Mode(pBIOSInfo); - break; - case VIA_TV3: - case VIA_VT1622A: - case VIA_VT1623: - VIAPostSetTV3Mode(pBIOSInfo); - break; - case VIA_CH7009: - case VIA_CH7019: - VIAPostSetCH7019Mode(pBIOSInfo); - break; - case VIA_SAA7108: - VIAPostSetSAA7108Mode(pBIOSInfo); - break; - case VIA_FS454: - VIAPostSetFS454Mode(pBIOSInfo); - break; - } - } - - /* load/save TV attribute for utility. */ - if (!pBIOSInfo->HasSecondary && (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV)) { - /* Read User Setting */ - if (pUTUSERSETTING->DefaultSetting) { - VIARestoreUserSetting(pBIOSInfo); - } - else { /* Read from I2C */ - VIAUTGetInfo(pBIOSInfo); - } - } - - VIAEnabledPrimaryExtendedFIFO(pBIOSInfo); - /* Enable extended FIFO if the resolution > 1024x768 - if (pBIOSInfo->CrtcHDisplay > 1024) { - VIAEnableExtendedFIFO(pBIOSInfo); - } - else { - VIADisableExtendedFIFO(pBIOSInfo); - }*/ - - /* Enable CRT Controller (3D5.17 Hardware Reset) */ - VGAOUT8(0x3d4, 0x17); - misc = VGAIN8(0x3d5); - VGAOUT8(0x3d5, (misc | 0x80)); - - /* Turn off CRT, if user doesn't want crt on */ - if (!(pBIOSInfo->ActiveDevice & VIA_DEVICE_CRT1)) { - VGAOUT8(0x3d4, 0x36); - VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x30); - } - - /* Open Screen */ - misc = VGAIN8(0x3da); - VGAOUT8(0x3c0, 0x20); - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "-- VIASetModeUseBIOSTable Done!\n")); - return TRUE; -} - -Bool VIASetModeForMHS(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia; - BOOL setTV = FALSE; - int mode, resMode, refresh; - int countWidthByQWord, offsetWidthByQWord; - unsigned char cr65, cr66, cr67; - CARD8 misc; - - - pVia = pBIOSInfo; - mode = pBIOSInfo->mode; - resMode = pBIOSInfo->resMode; - refresh = pBIOSInfo->refresh; - pBIOSInfo->SetTV = FALSE; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASetModeForMHS\n")); - /* Turn off Screen */ - VGAOUT8(0x3d4, 17); - VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0x7f)); - - if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) { - /* Found TV resmod index */ - switch (pBIOSInfo->resMode) { - case VIA_RES_640X480 : - pBIOSInfo->resTVMode = VIA_TVRES_640X480; - break; - case VIA_RES_800X600 : - pBIOSInfo->resTVMode = VIA_TVRES_800X600; - break; - case VIA_RES_1024X768 : - pBIOSInfo->resTVMode = VIA_TVRES_1024X768; - break; - case VIA_RES_848X480 : - pBIOSInfo->resTVMode = VIA_TVRES_848X480; - break; - case VIA_RES_720X480 : - pBIOSInfo->resTVMode = VIA_TVRES_720X480; - pBIOSInfo->TVType = TVTYPE_NTSC; - break; - case VIA_RES_720X576 : - pBIOSInfo->resTVMode = VIA_TVRES_720X576; - pBIOSInfo->TVType = TVTYPE_PAL; - break; - default : - pBIOSInfo->resTVMode = pBIOSInfo->resMode; - break; - } - switch (pBIOSInfo->TVEncoder) { - case VIA_TV2PLUS: - if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600) { - setTV = TRUE; - pBIOSInfo->SetTV = TRUE; - VIAPreSetTV2Mode(pBIOSInfo); - VIAPostSetTV2Mode(pBIOSInfo); - } - break; - case VIA_TV3: - case VIA_VT1622A: - if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 || - resMode == VIA_RES_1024X768 || resMode == VIA_RES_720X480 || - resMode == VIA_RES_720X576 || resMode == VIA_RES_848X480) { - setTV = TRUE; - pBIOSInfo->SetTV = TRUE; - VIAPreSetTV3Mode(pBIOSInfo); - VIAPostSetTV3Mode(pBIOSInfo); - } - break; - case VIA_CH7009: - case VIA_CH7019: - if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 || - resMode == VIA_RES_1024X768) { - setTV = TRUE; - pBIOSInfo->SetTV = TRUE; - VIAPreSetCH7019Mode(pBIOSInfo); - VIAPostSetCH7019Mode(pBIOSInfo); - } - break; - case VIA_SAA7108: - if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 || - resMode == VIA_RES_1024X768 || resMode == VIA_RES_848X480) { - setTV = TRUE; - pBIOSInfo->SetTV = TRUE; - VIAPreSetSAA7108Mode(pBIOSInfo); - VIAPostSetSAA7108Mode(pBIOSInfo); - } - break; - case VIA_FS454: - return FALSE; - break; - } - } - - /* Close TV Output, if TVEncoder not support current resolution */ - if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) && (!setTV)) { - I2CDevPtr dev; - unsigned char W_Buffer[2]; - - dev = xf86CreateI2CDevRec(); - dev->DevName = "TV"; - dev->SlaveAddr = pBIOSInfo->TVI2CAdd; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - if (xf86I2CDevInit(dev)) { - switch (pBIOSInfo->TVEncoder) { - case VIA_TV2PLUS: - W_Buffer[0] = 0x0E; - W_Buffer[1] = 0x03; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - break; - case VIA_TV3: - case VIA_VT1622A: - W_Buffer[0] = 0x0E; - W_Buffer[1] = 0x0F; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - break; - case VIA_CH7019: - W_Buffer[0] = 0x49; - W_Buffer[1] = 0x3E; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x1E; - W_Buffer[1] = 0xD0; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - break; - case VIA_SAA7108: - W_Buffer[0] = 0x2D; - W_Buffer[1] = 0x08; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - break; - case VIA_FS454: - default: - break; - } - xf86DestroyI2CDevRec(dev,TRUE); - } - else - xf86DestroyI2CDevRec(dev,TRUE); - ErrorF("Not Support TV resolution!!\n"); - } - - if (!pBIOSInfo->A2) { - VGAOUT8(0x3d4, 0x6C); - VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xE1)); - } - - if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) { - pBIOSInfo->SetDVI = TRUE; - VIASetLCDMode(pBIOSInfo); - VIAEnableLCD(pBIOSInfo); - } - else if (pBIOSInfo->ConnectedDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) { - VIADisableLCD(pBIOSInfo); - } - - - /* Set Extended FIFO & Expire Number */ - VIAEnabledSecondaryExtendedFIFO(pBIOSInfo); - VIAFillExpireNumber(pBIOSInfo); - /* Set Quadword offset and counter */ - countWidthByQWord = pBIOSInfo->countWidthByQWord; - offsetWidthByQWord = pBIOSInfo->offsetWidthByQWord; - - VGAOUT8(0x3d4, 0x67); - cr67 = VGAIN8(0x3d5) & 0xFC; - - cr66 = offsetWidthByQWord & 0xFF; - cr67 |= (offsetWidthByQWord & 0x300) >> 8; - - VGAOUT8(0x3d4, 0x66); - VGAOUT8(0x3d5, cr66); - VGAOUT8(0x3d4, 0x67); - VGAOUT8(0x3d5, cr67); - - VGAOUT8(0x3d4, 0x67); - cr67 = VGAIN8(0x3d5) & 0xF3; - - cr67 |= (countWidthByQWord & 0x600) >> 7; - cr65 = (countWidthByQWord >> 1) & 0xff; - - VGAOUT8(0x3d4, 0x65); - VGAOUT8(0x3d5, cr65); - VGAOUT8(0x3d4, 0x67); - VGAOUT8(0x3d5, cr67); - - VGAOUT8(0x3d4, 0x67); - cr67 = VGAIN8(0x3d5); - - switch (pBIOSInfo->bitsPerPixel) { - case 8: - cr67 &= 0x3F; - VGAOUT8(0x3d5, cr67); - break; - case 16: - cr67 &= 0x3F; - cr67 |= 0x40; - VGAOUT8(0x3d5, cr67); - break; - case 24: - case 32: - cr67 |= 0x80; - VGAOUT8(0x3d5, cr67); - break; - } - - /* Patch for non 32bit alignment mode */ - VIAPitchAlignmentPatch(pBIOSInfo); - - /* Open Screen */ - misc = VGAIN8(0x3da); - VGAOUT8(0x3c0, 0x20); - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "-- VIASetModeForMHS Done!\n")); - return TRUE; -} - -Bool VIASavePalette(ScrnInfoPtr pScrn, LOCO *colors) { - VIAPtr pVia = VIAPTR(pScrn); - int i, sr1a, sr1b, cr67, cr6a; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASavePalette\n")); - /*VGAOUT8(0x3C4, 0x16); - sr16 = VGAIN8(0x3C5);*/ - VGAOUT8(0x3C4, 0x1A); - sr1a = VGAIN8(0x3C5); - VGAOUT8(0x3C4, 0x1B); - sr1b = VGAIN8(0x3C5); - VGAOUT8(0x3D4, 0x67); - cr67 = VGAIN8(0x3D5); - VGAOUT8(0x3D4, 0x6A); - cr6a = VGAIN8(0x3D5); - /*VGAOUT8(0x3C4, 0x16); - if (pScrn->bitsPerPixel == 8) - VGAOUT8(0x3C5, sr16 & ~0x80); - else - VGAOUT8(0x3C5, sr16 | 0x80);*/ - if (pVia->IsSecondary) { - VGAOUT8(0x3C4, 0x1A); - VGAOUT8(0x3C5, sr1a | 0x01); - VGAOUT8(0x3C4, 0x1B); - VGAOUT8(0x3C5, sr1b | 0x80); - VGAOUT8(0x3D4, 0x67); - VGAOUT8(0x3D5, cr67 & 0x3F); - VGAOUT8(0x3D4, 0x6A); - VGAOUT8(0x3D5, cr6a | 0xC0); - } - else { - VGAOUT8(0x3C4, 0x1A); - VGAOUT8(0x3C5, sr1a & 0xFE); - VGAOUT8(0x3C4, 0x1B); - VGAOUT8(0x3C5, sr1b | 0x20); - } - - VGAOUT8(0x3c7, 0); - for (i = 0; i < 256; i++) { - colors[i].red = VGAIN8(0x3c9); - colors[i].green = VGAIN8(0x3c9); - colors[i].blue = VGAIN8(0x3c9); - DEBUG(xf86Msg(X_INFO, "%d, %d, %d\n", colors[i].red, colors[i].green, colors[i].blue)); - } - WaitIdle(); - - /*if (pScrn->bitsPerPixel == 8) { - VGAOUT8(0x3C4, 0x16); - VGAOUT8(0x3C5, sr16); - } - VGAOUT8(0x3C4, 0x16); - VGAOUT8(0x3C5, sr16);*/ - VGAOUT8(0x3C4, 0x1A); - VGAOUT8(0x3C5, sr1a); - VGAOUT8(0x3C4, 0x1B); - VGAOUT8(0x3C5, sr1b); - - if (pVia->IsSecondary) { - VGAOUT8(0x3D4, 0x67); - VGAOUT8(0x3D5, cr67); - VGAOUT8(0x3D4, 0x6A); - VGAOUT8(0x3D5, cr6a); - } - return TRUE; -} - -Bool VIARestorePalette(ScrnInfoPtr pScrn, LOCO *colors) { - VIAPtr pVia = VIAPTR(pScrn); - int i, sr1a, sr1b, cr67, cr6a, sr16; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIARestorePalette\n")); - VGAOUT8(0x3C4, 0x16); - sr16 = VGAIN8(0x3C5); - VGAOUT8(0x3C4, 0x1A); - sr1a = VGAIN8(0x3C5); - VGAOUT8(0x3C4, 0x1B); - sr1b = VGAIN8(0x3C5); - VGAOUT8(0x3D4, 0x67); - cr67 = VGAIN8(0x3D5); - VGAOUT8(0x3D4, 0x6A); - cr6a = VGAIN8(0x3D5); - VGAOUT8(0x3C4, 0x16); - if (pScrn->bitsPerPixel == 8) - VGAOUT8(0x3C5, sr16 & ~0x80); - else - VGAOUT8(0x3C5, sr16 | 0x80); - if (pVia->IsSecondary) { - VGAOUT8(0x3C4, 0x1A); - VGAOUT8(0x3C5, sr1a | 0x01); - VGAOUT8(0x3C4, 0x1B); - VGAOUT8(0x3C5, sr1b | 0x80); - VGAOUT8(0x3D4, 0x67); - VGAOUT8(0x3D5, cr67 & 0x3F); - VGAOUT8(0x3D4, 0x6A); - VGAOUT8(0x3D5, cr6a | 0xC0); - } - else { - VGAOUT8(0x3C4, 0x1A); - VGAOUT8(0x3C5, sr1a & 0xFE); - VGAOUT8(0x3C4, 0x1B); - VGAOUT8(0x3C5, sr1b | 0x20); - } - - VGAOUT8(0x3c8, 0); - for (i = 0; i < 256; i++) { - VGAOUT8(0x3c9, colors[i].red); - VGAOUT8(0x3c9, colors[i].green); - VGAOUT8(0x3c9, colors[i].blue); - /*DEBUG(xf86Msg(X_INFO, "%d, %d, %d\n", colors[i].red, colors[i].green, colors[i].blue));*/ - } - WaitIdle(); - /*if (pScrn->bitsPerPixel == 8) { - VGAOUT8(0x3C4, 0x16); - VGAOUT8(0x3C5, sr16); - } - VGAOUT8(0x3C4, 0x16); - VGAOUT8(0x3C5, sr16);*/ - VGAOUT8(0x3C4, 0x1A); - VGAOUT8(0x3C5, sr1a); - VGAOUT8(0x3C4, 0x1B); - VGAOUT8(0x3C5, sr1b); - - if (pVia->IsSecondary) { - VGAOUT8(0x3D4, 0x67); - VGAOUT8(0x3D5, cr67); - VGAOUT8(0x3D4, 0x6A); - VGAOUT8(0x3D5, cr6a); - } - return TRUE; -} - -void VIAPitchAlignmentPatch(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia = pBIOSInfo; - CARD8 cr13, cr35, cr65, cr66, cr67; - CARD32 dwScreenPitch= 0; - CARD32 dwPitch; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "VIAPitchAlignmentPatch\n")); - dwPitch = pBIOSInfo->HDisplay * (pBIOSInfo->bitsPerPixel >> 3); - if (dwPitch & 0x1F) { /* Is 32 Byte Alignment ? */ - dwScreenPitch = ((dwPitch + 31) & ~31) >> 3; - if (!pBIOSInfo->IsSecondary) { - cr13 = (CARD8)(dwScreenPitch & 0xFF); - VGAOUT8(0x3D4, 0x13); - VGAOUT8(0x3D5, cr13); - VGAOUT8(0x3D4, 0x35); - cr35 = VGAIN8(0x3D5) & 0x1F; - cr35 |= (CARD8)((dwScreenPitch & 0x700) >> 3); - VGAOUT8(0x3D5, cr35); - } - else { - cr66 = (CARD8)(dwScreenPitch & 0xFF); - VGAOUT8(0x3D4, 0x66); - VGAOUT8(0x3D5, cr66); - VGAOUT8(0x3D4, 0x67); - cr67 = VGAIN8(0x3D5) & 0xFC; - cr67 |= (CARD8)((dwScreenPitch & 0x300) >> 8); - VGAOUT8(0x3D5, cr67); - - /* Fetch Count */ - VGAOUT8(0x3D4, 0x67); - cr67 = VGAIN8(0x3D5) & 0xF3; - cr67 |= (CARD8)((dwScreenPitch & 0x600) >> 7); - VGAOUT8(0x3D5, cr67); - cr65 = (CARD8)((dwScreenPitch >> 1) & 0xFF); - cr65 += 2; - VGAOUT8(0x3D4, 0x65); - VGAOUT8(0x3D5, cr65); - } - } -} - -void VIAEnableLCD(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia = pBIOSInfo; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - I2CDevPtr dev; - unsigned char W_Buffer[2], R_Buffer[1]; - unsigned char cr6a; - int i, j, k; - int port, offset, mask, data; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "VIAEnableLCD\n")); - /* Enable LCD */ - VGAOUT8(0x3d4, 0x6A); - cr6a = VGAIN8(0x3d5); - VGAOUT8(0x3d5, cr6a | 0x08); - - /* Find Panel Size Index for PowerSeq Table */ - if (pBIOSInfo->Chipset == VIA_CLE266) { - if (pBIOSInfo->PanelSize != VIA_RES_INVALID) { - for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) { - if (pViaModeTable->lcdTable[i].fpSize == pBIOSInfo->PanelSize) - break; - } - - for (j = 0; j < pViaModeTable->NumPowerOn; j++) { - if (pViaModeTable->lcdTable[i].powerSeq == - pViaModeTable->powerOn[j].powerSeq) - break; - } - } - else { - j = 0; - } - } - else { /* KM and K8M use PowerSeq Table index 2. */ - j = 2; - } - - usleep(1); - for (k = 0; k < pViaModeTable->powerOn[j].numEntry; k++) { - port = pViaModeTable->powerOn[j].port[k]; - offset = pViaModeTable->powerOn[j].offset[k]; - mask = pViaModeTable->powerOn[j].mask[k]; - data = pViaModeTable->powerOn[j].data[k] & mask; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, data); - usleep(pViaModeTable->powerOn[j].delay[k]); - } - usleep(1); - - /* Patch for CH7019LVDS PLL Lock */ - if (pBIOSInfo->LVDS == VIA_CH7019LVDS) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "LVDS"; - dev->SlaveAddr = 0xEA; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x63; - W_Buffer[1] = 0x4B; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x66; - W_Buffer[1] = 0x20; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - for (i = 0; i < 10; i++) { - W_Buffer[0] = 0x63; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - usleep(100); - W_Buffer[0] = 0x63; - W_Buffer[1] = (R_Buffer[0] | 0x40); - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "[%d]write 0x63 = %X!\n", i+1, W_Buffer[1])); - usleep(1); - W_Buffer[0] = 0x63; - W_Buffer[1] &= ~0x40; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "[%d]write 0x63 = %X!\n", i+1, W_Buffer[1])); - usleep(100); - W_Buffer[0] = 0x66; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - if (((R_Buffer[0] & 0x44) == 0x44) || (i >= 9)) { /* PLL lock OK, Turn on VDD */ - usleep(500); - W_Buffer[1] = R_Buffer[0] | 0x01; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "CH7019 PLL lock ok!\n")); - /* reset data path */ - W_Buffer[0] = 0x48; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - W_Buffer[1] = R_Buffer[0] & ~0x08; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - usleep(1); - W_Buffer[1] = R_Buffer[0]; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - break; - } - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "[%d]CH7019 PLL lock fail!\n", i+1)); - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "[%d]0x66 = %X!\n", i+1, R_Buffer[0])); - } - xf86DestroyI2CDevRec(dev,TRUE); - } - } -} - -void VIADisableLCD(VIABIOSInfoPtr pBIOSInfo) -{ - VIABIOSInfoPtr pVia = pBIOSInfo; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - I2CDevPtr dev; - unsigned char W_Buffer[2], R_Buffer[1]; - unsigned char cr6a; - int i, j, k; - int port, offset, mask, data; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "VIADisableLCD\n")); - /* Patch for CH7019LVDS PLL Lock */ - if (pBIOSInfo->LVDS == VIA_CH7019LVDS) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "LVDS"; - dev->SlaveAddr = 0xEA; - dev->pI2CBus = pBIOSInfo->I2C_Port2; - if (xf86I2CDevInit(dev)) { - /* Turn off VDD (Turn off backlignt only) */ - W_Buffer[0] = 0x66; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - W_Buffer[1] &= ~0x01; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - usleep(100); - /* Turn off LVDS path */ - W_Buffer[0] = 0x63; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - W_Buffer[1] = (R_Buffer[0] | 0x40); - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - - xf86DestroyI2CDevRec(dev,TRUE); - } - } - - /* Disable LCD */ - VGAOUT8(0x3d4, 0x6A); - cr6a = VGAIN8(0x3d5); - VGAOUT8(0x3d5, (cr6a & ~0x08)); - - /* Find Panel Size Index */ - for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) { - if (pViaModeTable->lcdTable[i].fpSize == pBIOSInfo->PanelSize) - break; - } - - for (j = 0; j < pViaModeTable->NumPowerOn; j++) { - if (pViaModeTable->lcdTable[i].powerSeq == - pViaModeTable->powerOn[j].powerSeq) - break; - } - - for (k = 0; k < pViaModeTable->powerOff[j].numEntry; k++) { - port = pViaModeTable->powerOff[j].port[k]; - offset = pViaModeTable->powerOff[j].offset[k]; - mask = pViaModeTable->powerOff[j].mask[k]; - data = pViaModeTable->powerOff[j].data[k] & mask; - VGAOUT8(0x300+port, offset); - VGAOUT8(0x301+port, (VGAIN8(0x301+port) & ~mask) | data); - usleep(pViaModeTable->powerOff[j].delay[k]); - } -} - -unsigned char VIABIOS_GetActiveDevice(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - int RealOff; - pointer page = NULL; - unsigned char ret = 0x0; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIABIOS_GetActiveDevice\n")); - page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff); - if (!page) - return 0xFF; - pVia->pInt10->ax = 0x4F14; - pVia->pInt10->bx = 0x0103; - pVia->pInt10->cx = 0; - pVia->pInt10->num = 0x10; - xf86ExecX86int10(pVia->pInt10); - - if ((pVia->pInt10->ax & 0xFF) != 0x4F) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS Get Active Device fail!\n")); - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - return 0xFF; - } - - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - - if (pVia->pInt10->cx & 0x01) - ret = VIA_DEVICE_CRT1; - if (pVia->pInt10->cx & 0x02) - ret |= VIA_DEVICE_LCD; - if (pVia->pInt10->cx & 0x04) - ret |= VIA_DEVICE_TV; - if (pVia->pInt10->cx & 0x20) - ret |= VIA_DEVICE_DFP; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Return Value Is: %u\n", ret)); - return ret; -} - -/*=* - * - * unsigned char VIABIOS_GetDisplayDeviceInfo(pScrn, *numDevice) - * - * - Get Display Device Information - * - * Return Type: unsigned int - * - * The Definition of Input Value: - * - * ScrnInfoPtr - * point of int 0-CRT - * 1-DVI - * 2-LCD Panel - * - * The Definition of Return Value: - * - * Bit[15:0] Max. vertical resolution - *=*/ - -unsigned int VIABIOS_GetDisplayDeviceInfo(ScrnInfoPtr pScrn, unsigned char *numDevice) -{ - VIAPtr pVia = VIAPTR(pScrn); - int RealOff; - pointer page = NULL; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIABIOS_GetDisplayDeviceInfo\n")); - page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff); - if (!page) - return 0xFFFF; - pVia->pInt10->ax = 0x4F14; - pVia->pInt10->bx = 0x0806; - pVia->pInt10->cx = *numDevice; - pVia->pInt10->di = 0x00; - pVia->pInt10->num = 0x10; - xf86ExecX86int10(pVia->pInt10); - - if ((pVia->pInt10->ax & 0xFF) != 0x4F) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS Get Device Info fail!\n")); - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - return 0xFFFF; - } - - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - - *numDevice = pVia->pInt10->cx; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Vertical Resolution Is: %u\n", pVia->pInt10->di & 0xFFFF)); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel ID Is: %u\n", *numDevice)); - return (pVia->pInt10->di & 0xFFFF); -} - -/*=* - * - * unsigned char VIABIOS_GetDisplayDeviceAttached(pScrn) - * - * - Get Display Device Information - * - * Return Type: unsigned char - * - * The Definition of Input Value: - * - * ScrnInfoPtr - * - * The Definition of Return Value: - * - * Bit[4] CRT2 - * Bit[3] DFP - * Bit[2] TV - * Bit[1] LCD - * Bit[0] CRT - *=*/ - -unsigned char VIABIOS_GetDisplayDeviceAttached(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - int RealOff; - pointer page = NULL; - unsigned char ret = 0; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIABIOS_GetDisplayDeviceAttached\n")); - page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff); - if (!page) - return 0xFF; - pVia->pInt10->ax = 0x4F14; - pVia->pInt10->bx = 0x0004; - pVia->pInt10->cx = 0x00; - pVia->pInt10->num = 0x10; - xf86ExecX86int10(pVia->pInt10); - - if ((pVia->pInt10->ax & 0xFF) != 0x4F) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS Get Display Device Attached fail!\n")); - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - return 0xFF; - } - - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - - if (pVia->pInt10->cx & 0x01) - ret = VIA_DEVICE_CRT1; - if (pVia->pInt10->cx & 0x02) - ret |= VIA_DEVICE_LCD; - if (pVia->pInt10->cx & 0x04) - ret |= VIA_DEVICE_TV; - if (pVia->pInt10->cx & 0x20) - ret |= VIA_DEVICE_DFP; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Connected Device Is: %d\n", ret)); - return ret; -} - -Bool VIABIOS_GetBIOSDate(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - int RealOff; - pointer page = NULL; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIABIOS_GetBIOSDate\n")); - page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff); - if (!page) - return FALSE; - pVia->pInt10->ax = 0x4F14; - pVia->pInt10->bx = 0x0100; - pVia->pInt10->cx = 0; - pVia->pInt10->dx = 0; - pVia->pInt10->si = 0; - pVia->pInt10->num = 0x10; - xf86ExecX86int10(pVia->pInt10); - - if ((pVia->pInt10->ax & 0xff) != 0x4f) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Get BIOS Date fail!\n")); - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - return FALSE; - } - - pBIOSInfo->BIOSDateYear = ((pVia->pInt10->bx >> 8) - 48) + ((pVia->pInt10->bx & 0xFF) - 48)*10; - pBIOSInfo->BIOSDateMonth = ((pVia->pInt10->cx >> 8) - 48) + ((pVia->pInt10->cx & 0xFF) - 48)*10; - pBIOSInfo->BIOSDateDay = ((pVia->pInt10->dx >> 8) - 48) + ((pVia->pInt10->dx & 0xFF) - 48)*10; - - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS Release Date Is: %d/%d/%d\n" - , pBIOSInfo->BIOSDateYear + 2000, pBIOSInfo->BIOSDateMonth, pBIOSInfo->BIOSDateDay)); - return TRUE; -} - -int VIABIOS_GetBIOSVersion(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - int RealOff; - pointer page = NULL; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIABIOS_GetBIOSVersion\n")); - page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff); - if (!page) - return 0xFFFF; - pVia->pInt10->ax = 0x4F14; - pVia->pInt10->bx = 0x0000; - pVia->pInt10->cx = 0; - pVia->pInt10->num = 0x10; - xf86ExecX86int10(pVia->pInt10); - - if ((pVia->pInt10->ax & 0xff) != 0x4f) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Get BIOS Version fail!\n")); - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - return 0xFFFF; - } - - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Return Value Is: %u\n", pVia->pInt10->bx & 0xFFFF)); - return (pVia->pInt10->bx & 0xFFFF); -} - -unsigned char VIABIOS_GetFlatPanelInfo(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - int RealOff; - pointer page = NULL; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIABIOS_GetFlatPanelInfo\n")); - page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff); - if (!page) - return 0xFF; - pVia->pInt10->ax = 0x4F14; - pVia->pInt10->bx = 0x0006; - pVia->pInt10->cx = 0x00; - pVia->pInt10->num = 0x10; - xf86ExecX86int10(pVia->pInt10); - - if ((pVia->pInt10->ax & 0xFF) != 0x4F) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS Get Flat Panel Info fail!\n")); - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - return 0xFF; - } - - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel ID Is: %u\n", pVia->pInt10->cx & 0x0F)); - return (pVia->pInt10->cx & 0x0F); -} - -unsigned short VIABIOS_GetTVConfiguration(ScrnInfoPtr pScrn, CARD16 dx) -{ - VIAPtr pVia = VIAPTR(pScrn); - int RealOff; - pointer page = NULL; - unsigned short ret = 0; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIABIOS_GetTVConfiguration\n")); - page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff); - if (!page) - return 0xFFFF; - pVia->pInt10->ax = 0x4F14; - pVia->pInt10->bx = 0x8107; - pVia->pInt10->cx = 0x01; - pVia->pInt10->dx = dx; - pVia->pInt10->num = 0x10; - xf86ExecX86int10(pVia->pInt10); - - if ((pVia->pInt10->ax & 0xff) != 0x4f) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Get TV Configuration fail!\n")); - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - return 0xFFFF; - } - - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - - if (pVia->pInt10->dx) - ret = VIABIOS_GetTVConfiguration(pScrn, pVia->pInt10->dx); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Return Value Is: %u\n", ret)); - return ret; -} - -unsigned char VIABIOS_GetTVEncoderType(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - int RealOff; - pointer page = NULL; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIABIOS_GetTVEncoderType\n")); - page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff); - if (!page) - return 0xFF; - pVia->pInt10->ax = 0x4F14; - pVia->pInt10->bx = 0x0000; - pVia->pInt10->cx = 0; - pVia->pInt10->num = 0x10; - xf86ExecX86int10(pVia->pInt10); - - if ((pVia->pInt10->ax & 0xFF) != 0x4F) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Get TV Encoder Type fail!\n")); - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - return 0xFF; - } - - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Return Value Is: %u\n", pVia->pInt10->cx >> 8)); - return (pVia->pInt10->cx >> 8); -} - -int VIABIOS_GetVideoMemSize(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - int RealOff; - pointer page = NULL; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIABIOS_GetVideoMemSize\n")); - page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff); - if (!page) - return 0; - pVia->pInt10->ax = 0x4F14; - pVia->pInt10->bx = 0; - pVia->pInt10->cx = 0; - pVia->pInt10->dx = 0; - pVia->pInt10->di = 0; - pVia->pInt10->si = 0; - pVia->pInt10->num = 0x10; - xf86ExecX86int10(pVia->pInt10); - - if ((pVia->pInt10->ax & 0xFF) != 0x4F) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Get Video Memory Size fail!\n")); - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - return 0; - } - - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Return Value Is: %d\n", pVia->pInt10->si)); - if (pVia->pInt10->si > 1) - return (pVia->pInt10->si); - else - return 0; -} - -Bool VIABIOS_SetActiveDevice(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable; - int RealOff; - pointer page = NULL; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_SetActiveDevice\n")); - page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff); - if (!page) - return FALSE; - pVia->pInt10->ax = 0x4F14; - pVia->pInt10->bx = 0x8003; - pVia->pInt10->cx = 0; - pVia->pInt10->dx = 0; - pVia->pInt10->di = 0; - pVia->pInt10->num = 0x10; - - /* Set Active Device and Translate BIOS byte definition */ - if (pBIOSInfo->ActiveDevice & VIA_DEVICE_CRT1) - pVia->pInt10->cx = 0x01; - if (pBIOSInfo->ActiveDevice & VIA_DEVICE_LCD) - pVia->pInt10->cx |= 0x02; - if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) - pVia->pInt10->cx |= 0x04; - if (pBIOSInfo->ActiveDevice & VIA_DEVICE_DFP) - pVia->pInt10->cx |= 0x20; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Active Device: %d\n", - pVia->pInt10->cx)); - - /* Set Current mode */ - pVia->pInt10->dx = pViaModeTable->Modes[pBIOSInfo->mode].Mode; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Mode Nums: %d\n", - pVia->pInt10->dx)); - - /* Set Current Refresh rate */ - switch(pBIOSInfo->Refresh) { - case 60: - pVia->pInt10->di = 0; - break; - case 75: - pVia->pInt10->di = 5; - break; - case 85: - pVia->pInt10->di = 7; - break; - case 100: - pVia->pInt10->di = 9; - break; - case 120: - pVia->pInt10->di = 10; - break; - default: - pVia->pInt10->di = 0; - break; - } - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Refresh Rate Index: %d\n", - pVia->pInt10->di)); - - /* Real execution */ - xf86ExecX86int10(pVia->pInt10); - - if ((pVia->pInt10->ax & 0xFF) != 0x4F) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS Set Active Device fail!\n")); - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - return FALSE; - } - - if (page) - xf86Int10FreePages(pVia->pInt10, page, 1); - - return TRUE; -} +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*************************************************************************
+ *
+ * File: via_bios.c
+ * Content: Get the mode table from VGA BIOS and set mode by this table
+ *
+ ************************************************************************/
+
+/*
+#define CREATE_MODETABLE_HEADERFILE
+#define CREATE_TV2_HEADERFILE
+#define CREATE_TV3_HEADERFILE
+#define CREATE_SAA7108_HEADERFILE
+#define CREATE_CH7019_HEADERFILE
+#define CREATE_FS454_HEADERFILE
+*/
+
+#include "via_driver.h"
+#ifndef CREATE_MODETABLE_HEADERFILE
+#include "via_mode.h"
+#endif
+#ifndef CREATE_TV2_HEADERFILE
+#include "via_tv2.h"
+#endif
+#ifndef CREATE_TV3_HEADERFILE
+#include "via_tv3.h"
+#endif
+#ifndef CREATE_VT1622A_HEADERFILE
+#include "via_vt1622a.h"
+#endif
+#ifndef CREATE_SAA7108_HEADERFILE
+#include "via_saa7108.h"
+#endif
+#ifndef CREATE_CH7019_HEADERFILE
+#include "via_ch7019.h"
+#endif
+#ifndef CREATE_FS454_HEADERFILE
+#include "via_fs454.h"
+#endif
+#include "via_refresh.h"
+
+
+/*=*
+ *
+ * int VIACheckTVExist(VIABIOSInfoPtr) - Check TV Endcoder
+ *
+ * Return Type: int
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * 0 - None
+ * 1 - VIA VT1621
+ * 2 - VIA VT1622
+ * 3 - Chrontel 7009
+ * 4 - Chrontel 7019
+ * 5 - Philips SAA7108
+ *=*/
+
+int VIACheckTVExist(VIABIOSInfoPtr pBIOSInfo)
+{
+ I2CDevPtr dev;
+ unsigned char W_Buffer[1];
+ unsigned char R_Buffer[1];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIACheckTVExist\n"));
+ /* Check For TV2/TV3 */
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0x40)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = 0x40;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0x1B;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ switch (R_Buffer[0]) {
+ case 2:
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "Found TVEncoder VT1621!\n"));
+ pBIOSInfo->TVEncoder = VIA_TV2PLUS;
+ pBIOSInfo->TVI2CAdd = 0x40;
+ break;
+ case 3:
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "Found TVEncoder VT1622!\n"));
+ pBIOSInfo->TVEncoder = VIA_TV3;
+ pBIOSInfo->TVI2CAdd = 0x40;
+ break;
+ case 16:
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "Found TVEncoder VT1622A!\n"));
+ pBIOSInfo->TVEncoder = VIA_VT1622A;
+ pBIOSInfo->TVI2CAdd = 0x40;
+ break;
+ default:
+ pBIOSInfo->TVEncoder = VIA_NONETV;
+ break;
+ }
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ pBIOSInfo->TVEncoder = VIA_NONETV;
+
+ /* Check For SAA7108 */
+ if (!pBIOSInfo->TVEncoder) {
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0x88)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "SAA7108";
+ dev->SlaveAddr = 0x88;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0x1C;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ if (R_Buffer[0] == 0x04) {
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "Found TVEncoder Philips SAA7108!\n"));
+ pBIOSInfo->TVEncoder = VIA_SAA7108;
+ pBIOSInfo->TVI2CAdd = 0x88;
+ }
+ else
+ pBIOSInfo->TVEncoder = VIA_NONETV;
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ pBIOSInfo->TVEncoder = VIA_NONETV;
+ }
+
+ /* Check For FS454 */
+ if (!pBIOSInfo->TVEncoder) {
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0xD4)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "FS454";
+ dev->SlaveAddr = 0xD4;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0x7F;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ if (R_Buffer[0] == 0x20) {
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "Found TVEncoder FOCUS 453/454!\n"));
+ pBIOSInfo->TVEncoder = VIA_FS454;
+ pBIOSInfo->TVI2CAdd = 0xD4;
+ }
+ else
+ pBIOSInfo->TVEncoder = VIA_NONETV;
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ pBIOSInfo->TVEncoder = VIA_NONETV;
+ }
+
+ /* Check For CH7019 */
+ if (!pBIOSInfo->TVEncoder) {
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0xEA)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "CH7019";
+ dev->SlaveAddr = 0xEA;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0x4B;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ if (R_Buffer[0] == 0x19) {
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "Found TVEncoder Chrontel 7019!\n"));
+ pBIOSInfo->TVEncoder = VIA_CH7019;
+ pBIOSInfo->TVI2CAdd = 0xEA;
+ }
+ else
+ pBIOSInfo->TVEncoder = VIA_NONETV;
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ pBIOSInfo->TVEncoder = VIA_NONETV;
+ }
+
+ return pBIOSInfo->TVEncoder;
+}
+
+
+/*=*
+ *
+ * log VIAQueryChipInfo(VIABIOSInfoPtr) - Query Chip Infomation
+ *
+ * Return Type: log
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * [31:24] Major BIOS Version Number
+ * [31:24] Minor BIOS Version Number
+ * [15:8] Type of External TV Encoder
+ * 0 - None
+ * 1 - VIA VT1621
+ * 2 - VIA VT1622
+ * 3 - Chrontel 7009
+ * 4 - Chrontel 7019
+ * 5 - Philips SAA7108
+ * [7:6] Reserved
+ * [5] DVI Display Supported
+ * [4] Reserved
+ * [3] PAL TV Display Supported
+ * [2] NTSC TV Display Supported
+ * [1] LCD Display Supported
+ * [0] CRT Display Supported
+ *=*/
+
+long VIAQueryChipInfo(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIAModeTablePtr pViaModeTable;
+ long tmp;
+ unsigned char support = 0;
+
+ pViaModeTable = pBIOSInfo->pModeTable;
+
+ tmp = ((long)(pViaModeTable->BIOSVer)) << 16;
+ tmp |= ((long)(VIACheckTVExist(pBIOSInfo))) << 8;
+
+ if (VIA_CRT_SUPPORT)
+ support |= VIA_CRT_SUPPORT_BIT;
+ if (VIA_LCD_SUPPORT)
+ support |= VIA_LCD_SUPPORT_BIT;
+ if (VIA_NTSC_SUPPORT)
+ support |= VIA_NTSC_SUPPORT_BIT;
+ if (VIA_PAL_SUPPORT)
+ support |= VIA_PAL_SUPPORT_BIT;
+ if (VIA_DVI_SUPPORT)
+ support |= VIA_DVI_SUPPORT_BIT;
+
+ tmp |= (long)(support);
+
+ return tmp;
+}
+
+
+/*=*
+ *
+ * char* VIAGetBIOSInfo(VIABIOSInfoPtr) - Get BIOS Release Date
+ *
+ * Return Type: string pointer
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * BIOS release date string pointer
+ *=*/
+
+char* VIAGetBIOSInfo(VIABIOSInfoPtr pBIOSInfo)
+{
+ return pBIOSInfo->pModeTable->BIOSDate;
+}
+
+
+/*=*
+ *
+ * Bool VIASetActiveDisplay(VIABIOSInfoPtr, unsigned char)
+ *
+ * - Set Active Display Device
+ *
+ * Return Type: Bool
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * Bit[7] 2nd Path
+ * Bit[6] 1/0 MHS Enable/Disable
+ * Bit[5] 0 = Bypass Callback, 1 = Enable Callback
+ * Bit[4] 0 = Hot-Key Sequence Control (OEM Specific)
+ * Bit[3] LCD
+ * Bit[2] TV
+ * Bit[1] CRT
+ * Bit[0] DVI
+ *
+ * The Definition of Return Value:
+ *
+ * Success - TRUE
+ * Not Success - FALSE
+ *=*/
+
+Bool VIASetActiveDisplay(VIABIOSInfoPtr pBIOSInfo, unsigned char display)
+{
+ VIABIOSInfoPtr pVia;
+ unsigned char tmp;
+
+ pVia = pBIOSInfo;
+
+ switch (display & 0x0F) {
+ case 0x07: /* WCRTON + WTVON + WDVION */
+ case 0x0E: /* WCRTON + WTVON + WLCDON */
+ return FALSE;
+ default:
+ break;
+ }
+
+ VGAOUT8(0x3D4, 0x3E);
+ tmp = VGAIN8(0x3D5) & 0xF0;
+ tmp |= (display & 0x0F);
+ VGAOUT8(0x3D5, tmp);
+
+ if ((display & 0xC0) == 0x80)
+ return FALSE;
+
+ VGAOUT8(0x3D4, 0x3B);
+ tmp = VGAIN8(0x3D5) & 0xE7;
+ tmp |= ((display & 0xC0) >> 3);
+ VGAOUT8(0x3D5, tmp);
+
+ return TRUE;
+}
+
+
+/*=*
+ *
+ * unsigned char VIAGetActiveDisplay(VIABIOSInfoPtr, unsigned char)
+ *
+ * - Get Active Display Device
+ *
+ * Return Type: unsigned char
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * Bit[7] 2nd Path
+ * Bit[6] 1/0 MHS Enable/Disable
+ * Bit[5] 0 = Bypass Callback, 1 = Enable Callback
+ * Bit[4] 0 = Hot-Key Sequence Control (OEM Specific)
+ * Bit[3] LCD
+ * Bit[2] TV
+ * Bit[1] CRT
+ * Bit[0] DVI
+ *=*/
+
+unsigned char VIAGetActiveDisplay(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ unsigned char tmp;
+
+ pVia = pBIOSInfo;
+
+ VGAOUT8(0x3D4, 0x3E);
+ tmp = (VGAIN8(0x3D5) & 0xF0) >> 4;
+
+ VGAOUT8(0x3D4, 0x3B);
+ tmp |= ((VGAIN8(0x3D5) & 0x18) << 3);
+
+ return tmp;
+}
+
+/*=*
+ *
+ * unsigned char VIASensorCH7019(VIABIOSInfoPtr pBIOSInfo)
+ *
+ * - Sense Chrontel 7019 Encoder
+ *
+ * Return Type: unsigned char
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * 00h No Connected
+ * 02h Composite
+ * 04h S_VIDEO
+ * 06h Composite + S_VIDEO
+ * FFh Undefine
+ *=*/
+
+unsigned char VIASensorCH7019(VIABIOSInfoPtr pBIOSInfo)
+{
+ unsigned char tv20, tmp = 0, ret = 0x06;
+ I2CDevPtr dev;
+ unsigned char W_Buffer[2];
+ unsigned char R_Buffer[1];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASensorCH7019\n"));
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "CH7019";
+ dev->SlaveAddr = 0xEA;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ /* turn all DACPD on */
+ W_Buffer[0] = 0x49;
+ W_Buffer[1] = 0X40;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ /* set connection detect rgister (0x20) SENSE bit (BIT0) to 1 */
+ W_Buffer[0] = 0x20;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ tv20 = R_Buffer[0];
+ W_Buffer[1] = (tv20 | 0x01);
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ usleep(1);
+ /* reset the SENSE bit to 0 */
+ W_Buffer[1] = (tv20 & (~0x01));
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ /* read the status bits */
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ tmp = R_Buffer[0];
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ /* Always return 0x06 */
+ return ret;
+}
+
+/*=*
+ *
+ * unsigned char VIASensorSAA7108(VIABIOSInfoPtr pBIOSInfo)
+ *
+ * - Sense Philips SAA7108 Encoder
+ *
+ * Return Type: unsigned char
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * 0 No Connected
+ * BIT0=1 Composite
+ * BIT1=1 S_VIDEO
+ * BIT2=1 RGB
+ * BIT3=1 YCbCr
+ * FF Undefine
+ *=*/
+
+unsigned char VIASensorSAA7108(VIABIOSInfoPtr pBIOSInfo)
+{
+ unsigned char tv2d, tv61, tmp = 0, ret = 0;
+ I2CDevPtr dev;
+ unsigned char W_Buffer[2];
+ unsigned char R_Buffer[1];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASensorSAA7108\n"));
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "SAA7108";
+ dev->SlaveAddr = 0x88;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+
+ /* Encoder On */
+ W_Buffer[0] = 0x2D;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ tv2d = R_Buffer[0];
+ W_Buffer[1] = 0XB4;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+
+ /* Power Control */
+ W_Buffer[0] = 0x61;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ tv61 = R_Buffer[0];
+ W_Buffer[1] = (tv61 & (~0x60));
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+
+ /* Monitor Sense Mode Threshold */
+ W_Buffer[0] = 0x1A;
+ W_Buffer[1] = 0X46;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+
+ /* Monitor Sense On */
+ W_Buffer[0] = 0x1B;
+ W_Buffer[1] = 0X80;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ usleep(1);
+
+ /* Monitor Sense Off */
+ W_Buffer[1] = 0;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+
+ /* Monitor Sense Result */
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ tmp = R_Buffer[0] & 0x07;
+
+ /* Restore Power Control & Encoder On/Off Status */
+ W_Buffer[0] = 0x61;
+ W_Buffer[1] = tv61;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x2D;
+ W_Buffer[1] = tv2d;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+
+ switch (tmp) {
+ case 0: /* YCbCr */
+ ret = 0x08;
+ break;
+ case 1: /* S_VIDEO */
+ ret = 0x02;
+ break;
+ case 6: /* Composite */
+ ret = 0x01;
+ break;
+ case 7: /* No Connected */
+ ret = 0;
+ break;
+ default: /* Undefine */
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "Sense Result :%d\n", tmp));
+ ret = 0xFF;
+ break;
+ }
+ return ret;
+}
+
+/*=*
+ *
+ * unsigned char VIASensorTV2(VIABIOSInfoPtr pBIOSInfo)
+ *
+ * - Sense TV2+ Encoder
+ *
+ * Return Type: unsigned char
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * Bit[2] Bit[0]
+ * 0 0 - Composite + S-Video
+ * 0 1 - S-Video
+ * 1 0 - Composite
+ * 1 1 - None
+ *=*/
+
+unsigned char VIASensorTV2(VIABIOSInfoPtr pBIOSInfo)
+{
+ I2CDevPtr dev;
+ unsigned char save, tmp = 0x05;
+ unsigned char W_Buffer[2];
+ unsigned char R_Buffer[1];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASensorTV2\n"));
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "VT1621";
+ dev->SlaveAddr = 0x40;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0x0E;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ save = R_Buffer[0];
+ W_Buffer[1] = 0x08;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[1] = 0;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x0F;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ tmp = R_Buffer[0] & 0x0F;
+ W_Buffer[0] = 0x0E;
+ W_Buffer[1] = save;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+
+ return tmp;
+}
+
+
+/*=*
+ *
+ * unsigned char VIASensorTV3(VIABIOSInfoPtr pBIOSInfo)
+ *
+ * - Sense TV3 Encoder
+ *
+ * Return Type: unsigned char
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * Bit[3] Bit[2] Bit[1] Bit[0]
+ * 1 1 1 1 - None
+ * 0 1 1 1 - Composite
+ * 1 1 1 0 - Composite
+ * - Others: S-Video
+ *=*/
+
+unsigned char VIASensorTV3(VIABIOSInfoPtr pBIOSInfo)
+{
+ I2CDevPtr dev;
+ unsigned char save, tmp = 0;
+ unsigned char W_Buffer[2];
+ unsigned char R_Buffer[1];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASensorTV3\n"));
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "VT1622";
+ dev->SlaveAddr = 0x40;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0x0E;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ save = R_Buffer[0];
+ W_Buffer[1] = 0;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[1] = 0x80;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[1] = 0;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x0F;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ tmp = R_Buffer[0] & 0x0F;
+ W_Buffer[0] = 0x0E;
+ W_Buffer[1] = save;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+
+ return tmp;
+}
+
+
+/*=*
+ *
+ * Bool VIASensorDVI(pBIOSInfo)
+ *
+ * - Sense DVI Connector
+ *
+ * Return Type: Bool
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * DVI Attached - TRUE
+ * DVI Not Attached - FALSE
+ *=*/
+
+Bool VIASensorDVI(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ int port, offset, mask, data;
+ int j = 0, k;
+ unsigned char SlaveAddr, misc, cr6c, cr93;
+ Bool ret = FALSE;
+ I2CDevPtr dev;
+ unsigned char W_Buffer[1];
+ unsigned char R_Buffer[1];
+
+ pVia = pBIOSInfo;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASensorDVI\n"));
+
+ switch (pBIOSInfo->TMDS) {
+ case VIA_SIL164:
+ SlaveAddr = 0x70;
+ break;
+ case VIA_VT3192:
+ SlaveAddr = 0x10;
+ break;
+ default:
+ return ret;
+ break;
+ }
+ /* Enable LCD */
+ VGAOUT8(0x3d4, 0x6A);
+ misc = VGAIN8(0x3d5);
+ VGAOUT8(0x3d5, misc | 0x08);
+ VGAOUT8(0x3d4, 0x6C);
+ cr6c = VGAIN8(0x3d5);
+ VGAOUT8(0x3d5, cr6c | 0x21);
+ VGAOUT8(0x3d4, 0x93);
+ cr93 = VGAIN8(0x3d5);
+ if (pBIOSInfo->ChipRev > 15) {
+ VGAOUT8(0x3d5, 0xA3);
+ }
+ else {
+ VGAOUT8(0x3d5, 0xBF);
+ }
+ usleep(1);
+
+ for (k = 0; k < pViaModeTable->powerOn[j].numEntry; k++) {
+ port = pViaModeTable->powerOn[j].port[k];
+ offset = pViaModeTable->powerOn[j].offset[k];
+ mask = pViaModeTable->powerOn[j].mask[k];
+ data = pViaModeTable->powerOn[j].data[k] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, (VGAIN8(0x301+port) & ~mask) | data);
+ usleep(pViaModeTable->powerOn[j].delay[k]);
+ }
+
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, SlaveAddr)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TMDS";
+ dev->SlaveAddr = SlaveAddr;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0x09;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ if (R_Buffer[0] & 0x04)
+ ret = TRUE;
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+
+ for (k = 0; k < pViaModeTable->powerOff[j].numEntry; k++) {
+ port = pViaModeTable->powerOff[j].port[k];
+ offset = pViaModeTable->powerOff[j].offset[k];
+ mask = pViaModeTable->powerOff[j].mask[k];
+ data = pViaModeTable->powerOff[j].data[k] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, (VGAIN8(0x301+port) & ~mask) | data);
+ usleep(pViaModeTable->powerOff[j].delay[k]);
+ }
+
+ /* Disable LCD */
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, misc);
+ /* Restore DI0, DI1 status */
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, cr6c);
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, cr93);
+
+ return ret;
+}
+
+Bool VIAPostDVI(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia = pBIOSInfo;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ int port, offset, mask, data;
+ int i, j = 0, k;
+ unsigned char misc, cr6c, cr93;
+ Bool ret = FALSE;
+ I2CDevPtr dev;
+ unsigned char W_Buffer[2];
+ unsigned char R_Buffer[4];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostDVI\n"));
+
+ /* Enable LCD */
+ VGAOUT8(0x3d4, 0x6A);
+ misc = VGAIN8(0x3d5);
+ VGAOUT8(0x3d5, misc | 0x08);
+ /* Enable DI0, DI1 */
+ VGAOUT8(0x3d4, 0x6C);
+ cr6c = VGAIN8(0x3d5);
+ VGAOUT8(0x3d5, cr6c | 0x21);
+ VGAOUT8(0x3d4, 0x93);
+ cr93 = VGAIN8(0x3d5);
+ if (pBIOSInfo->ChipRev > 15) {
+ VGAOUT8(0x3d5, 0xA3);
+ }
+ else {
+ VGAOUT8(0x3d5, 0xBF);
+ }
+ usleep(1);
+
+ for (k = 0; k < pViaModeTable->powerOn[j].numEntry; k++) {
+ port = pViaModeTable->powerOn[j].port[k];
+ offset = pViaModeTable->powerOn[j].offset[k];
+ mask = pViaModeTable->powerOn[j].mask[k];
+ data = pViaModeTable->powerOn[j].data[k] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, (VGAIN8(0x301+port) & ~mask) | data);
+ usleep(pViaModeTable->powerOn[j].delay[k]);
+ }
+
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0x70)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TMDS";
+ dev->SlaveAddr = 0x70;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0x00;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,4);
+ if (R_Buffer[0] == 0x06 && R_Buffer[1] == 0x11) { /* This is VT3191 */
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "Found VIA LVDS Transmiter!\n"));
+ if (R_Buffer[2] == 0x91 && R_Buffer[3] == 0x31) {
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "VIA: VT1631!\n"));
+ pBIOSInfo->LVDS = VIA_VT3191;
+ W_Buffer[0] = 0x08;
+ if (pBIOSInfo->BusWidth == VIA_DI_24BIT && pBIOSInfo->LCDDualEdge)
+ W_Buffer[1] = 0x0D;
+ else
+ W_Buffer[1] = 0x09;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ ret = TRUE;
+ }
+ else {
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "VIA: Unknow Chip!!\n"));
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ }
+ else if (R_Buffer[0] == 0x01 && R_Buffer[1] == 0x00) { /* This is Sil164 */
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "Found TMDS Transmiter Silicon164.\n"));
+ pBIOSInfo->TMDS = VIA_SIL164;
+ W_Buffer[0] = 0x02;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,2);
+ if (R_Buffer[0] && R_Buffer[1]) {
+ W_Buffer[0] = 0x08;
+ if (pBIOSInfo->BusWidth == VIA_DI_24BIT) {
+ if (pBIOSInfo->LCDDualEdge)
+ W_Buffer[1] = 0x3F;
+ else
+ W_Buffer[1] = 0x37;
+ }
+ else /* 12Bit Only has Single Mode */
+ W_Buffer[1] = 0x3B;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x0C;
+ W_Buffer[1] = 0x09;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ ret = TRUE;
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ }
+
+ /* Check VT3192 TMDS Exist or not?*/
+ if (!pBIOSInfo->TMDS) {
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0x10)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TMDS";
+ dev->SlaveAddr = 0x10;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0x00;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,4);
+
+ if (R_Buffer[0] == 0x06 && R_Buffer[1] == 0x11) { /* This is VT3192 */
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "Found VIA TMDS Transmiter!\n"));
+ pBIOSInfo->TMDS = VIA_VT3192;
+ if (R_Buffer[2] == 0x92 && R_Buffer[3] == 0x31) {
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "VIA: VT1632!\n"));
+ pBIOSInfo->TMDS = VIA_VT3192;
+ W_Buffer[0] = 0x08;
+ if (pBIOSInfo->BusWidth == VIA_DI_24BIT) {
+ if (pBIOSInfo->LCDDualEdge)
+ W_Buffer[1] = 0x3F;
+ else
+ W_Buffer[1] = 0x37;
+ }
+ else
+ W_Buffer[1] = 0x3B;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ ret = TRUE;
+ }
+ else {
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED,
+ "VIA: Unknow Chip!!\n"));
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ }
+ }
+
+ /* Check CH7019 LVDS Exist or not?*/
+ if (!pBIOSInfo->LVDS) {
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0xEA)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "LVDS";
+ dev->SlaveAddr = 0xEA;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0x4B;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ if (R_Buffer[0] == 0x19) {
+ /* Load CH7019 LVDS init table */
+ if (pBIOSInfo->LCDDualEdge) {
+ W_Buffer[0] = 0x64;
+ W_Buffer[1] = 0x14;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x71;
+ W_Buffer[1] = 0xE3;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x73;
+ W_Buffer[1] = 0xDB;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x74;
+ W_Buffer[1] = 0xF6;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x76;
+ W_Buffer[1] = 0xAF;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ }
+ else {
+ W_Buffer[0] = 0x64;
+ W_Buffer[1] = 0x04;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x71;
+ W_Buffer[1] = 0xAD;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x73;
+ W_Buffer[1] = 0xC8;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x74;
+ W_Buffer[1] = 0xF3;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x76;
+ W_Buffer[1] = 0xAD;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ }
+ W_Buffer[0] = 0x63;
+ W_Buffer[1] = 0x4B;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x1C;
+ W_Buffer[1] = 0x40;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x6F;
+ W_Buffer[1] = 0x00;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x21;
+ W_Buffer[1] = 0x84;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x70;
+ W_Buffer[1] = 0xC0;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x72;
+ W_Buffer[1] = 0xAD;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x78;
+ W_Buffer[1] = 0x20;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x15;
+ W_Buffer[1] = 0x00;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x67;
+ W_Buffer[1] = 0x01;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x68;
+ W_Buffer[1] = 0x6E;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x69;
+ W_Buffer[1] = 0x01;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x6A;
+ W_Buffer[1] = 0x01;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x6B;
+ W_Buffer[1] = 0x09;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x66;
+ W_Buffer[1] = 0x20;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+
+ /* Set LVDS output 24 bits mode
+ W_Buffer[0] = 0x64;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] | 0x20;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);*/
+
+ for (i = 0; i < 10; i++) {
+ usleep(100);
+ W_Buffer[0] = 0x66;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ if ((R_Buffer[0] & 0x44) == 0x44 || i >= 10) { /* PLL lock OK, Turn on VDD */
+ if (i >= 10)
+ sleep(0.5);
+ W_Buffer[1] = R_Buffer[0] | 0x01;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "CH7019 PLL lock ok!\n"));
+ break;
+ }
+ else { /* PLL not lock */
+ W_Buffer[0] = 0x63;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] | 0x40;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ usleep(500);
+ W_Buffer[1] = R_Buffer[0] & 0xBF;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "PLL not lock %d times!\n", i));
+ }
+ }
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "Found LVDS Transmiter Chrontel 7019!\n"));
+ pBIOSInfo->LVDS = VIA_CH7019;
+ pBIOSInfo->BusWidth = VIA_DI_12BIT;
+ ret = TRUE;
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ }
+ }
+
+ /* Disable LCD */
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, misc);
+
+ for (k = 0; k < pViaModeTable->powerOff[j].numEntry; k++) {
+ port = pViaModeTable->powerOff[j].port[k];
+ offset = pViaModeTable->powerOff[j].offset[k];
+ mask = pViaModeTable->powerOff[j].mask[k];
+ data = pViaModeTable->powerOff[j].data[k] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, (VGAIN8(0x301+port) & ~mask) | data);
+ usleep(pViaModeTable->powerOff[j].delay[k]);
+ }
+
+ /* Restore DI0, DI1 status */
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, cr6c);
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, cr93);
+
+ if (pBIOSInfo->LVDS && pBIOSInfo->PanelSize == VIA_PANEL_INVALID) {
+ VGAOUT8(0x3d4, 0x3F);
+ pBIOSInfo->PanelSize = (int)(VGAIN8(0x3d5) >> 4);
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO,
+ "Get PanelID From Scratch Pad is %d\n", pBIOSInfo->PanelSize));
+ }
+
+ return ret;
+}
+
+/*=*
+ *
+ * unsigned char VIAGetDeviceDetect(VIABIOSInfoPtr)
+ *
+ * - Get Display Device Attched
+ *
+ * Return Type: unsigned char
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * Bit[7] Reserved ------------ 2nd TV Connector
+ * Bit[6] Reserved ------------ 1st TV Connector
+ * Bit[5] Reserved
+ * Bit[4] CRT2
+ * Bit[3] DFP
+ * Bit[2] TV
+ * Bit[1] LCD
+ * Bit[0] CRT
+ *=*/
+
+unsigned char VIAGetDeviceDetect(VIABIOSInfoPtr pBIOSInfo)
+{
+ unsigned char tmp, sense;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetDeviceDetect\n"));
+
+ tmp = VIA_DEVICE_CRT1; /* Default assume color CRT attached */
+/*
+ if (VIA_LCD_SUPPORT) {
+ if (VIA_UNCOVERD_LCD_PANEL)
+ tmp |= 0x08;
+ }
+*/
+ if (pBIOSInfo->LVDS) {
+ pBIOSInfo->LCDAttach = TRUE;
+ tmp |= VIA_DEVICE_LCD;
+ }
+
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_NONETV:
+ pBIOSInfo->TVAttach = FALSE;
+ break;
+ case VIA_TV2PLUS:
+ sense = VIASensorTV2(pBIOSInfo);
+ if (sense == 0x05) {
+ pBIOSInfo->TVAttach = FALSE; /* No TV Output Attached */
+ }
+ else {
+ tmp |= VIA_DEVICE_TV;
+ pBIOSInfo->TVAttach = TRUE;
+ if (!pBIOSInfo->TVOutput) {
+ if (sense == 0) {
+ /*tmp |= 0xC0; Connect S_Video + Composite */
+ pBIOSInfo->TVOutput = TVOUTPUT_SC;
+ }
+ if (sense == 0x01) {
+ /*tmp |= 0x80; Connect S_Video */
+ pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO;
+ }
+ else {
+ /*tmp |= 0x40; Connect Composite */
+ pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE;
+ }
+ }
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "TV2 sense = %d ,TVOutput = %d\n", sense, pBIOSInfo->TVOutput));
+ }
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ sense = VIASensorTV3(pBIOSInfo);
+ if (sense == 0x0F) {
+ pBIOSInfo->TVAttach = FALSE; /* No TV Output Attached */
+ }
+ else {
+ tmp |= VIA_DEVICE_TV;
+ pBIOSInfo->TVAttach = TRUE;
+ if (!pBIOSInfo->TVOutput) {
+ if (sense == 0x07 || sense == 0x0E) {
+ /*tmp |= 0x40; Connect Composite */
+ pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE;
+ }
+ else {
+ /*tmp |= 0x80; Connect S_Video */
+ pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO;
+ }
+ }
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "TV3 sense = %d ,TVOutput = %d\n", sense, pBIOSInfo->TVOutput));
+ }
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ sense = VIASensorCH7019(pBIOSInfo);
+ if (!sense) {
+ pBIOSInfo->TVAttach = FALSE; /* No TV Output Attached */
+ }
+ else {
+ tmp |= VIA_DEVICE_TV;
+ pBIOSInfo->TVAttach = TRUE;
+ if (!pBIOSInfo->TVOutput) {
+ if (sense == 0x02) {
+ pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE;
+ }
+ else {
+ pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO;
+ }
+ }
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "CH7019 sense = %d ,TVOutput = %d\n", sense, pBIOSInfo->TVOutput));
+ }
+ break;
+ case VIA_SAA7108:
+ sense = VIASensorSAA7108(pBIOSInfo);
+ if (!sense) {
+ pBIOSInfo->TVAttach = FALSE; /* No TV Output Attached */
+ }
+ else {
+ tmp |= VIA_DEVICE_TV;
+ pBIOSInfo->TVAttach = TRUE;
+ if (!pBIOSInfo->TVOutput) {
+ switch (sense) {
+ case 0x01:
+ pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE;
+ break;
+ case 0x02:
+ pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO;
+ break;
+ case 0x04:
+ pBIOSInfo->TVOutput = TVOUTPUT_RGB;
+ break;
+ case 0x08:
+ pBIOSInfo->TVOutput = TVOUTPUT_YCBCR;
+ break;
+ default:
+ pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE;
+ break;
+ }
+ }
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "SAA7108 sense = %d ,TVOutput = %d\n", sense, pBIOSInfo->TVOutput));
+ }
+ break;
+ case VIA_FS454:
+ tmp |= VIA_DEVICE_TV;
+ pBIOSInfo->TVAttach = TRUE;
+ break;
+ default:
+ break;
+ }
+
+ if (pBIOSInfo->TMDS) {
+ if (VIASensorDVI(pBIOSInfo)) {
+ tmp |= VIA_DEVICE_DFP;
+ pBIOSInfo->DVIAttach = TRUE;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "DVI has Attachment.\n"));
+ if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID)
+ VIAGetPanelInfo(pBIOSInfo);
+ }
+ else {
+ pBIOSInfo->DVIAttach = FALSE;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_PROBED, "DVI hasn't Attachment.\n"));
+ }
+ }
+
+ return tmp;
+}
+
+
+/*=*
+ *
+ * Bool VIASetPanelState(VIABIOSInfoPtr, unsigned char)
+ *
+ * - Set Flat Panel Expaension/Centering State
+ *
+ * Return Type: Bool
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * Bit[7:1] Reserved
+ * Bit[0] 0/1 = Centering/Expansion
+ *
+ * The Definition of Return Value:
+ *
+ * Success - TRUE
+ * Not Success - FALSE
+ *=*/
+
+Bool VIASetPanelState(VIABIOSInfoPtr pBIOSInfo, unsigned char state)
+{
+ VIABIOSInfoPtr pVia;
+ unsigned char tmp;
+
+ pVia = pBIOSInfo;
+
+ tmp = state & 0x01;
+ VGAOUT8(0x3D4, 0x3B);
+ tmp |= (VGAIN8(0x3D5) & 0xFE);
+ VGAOUT8(0x3D5, tmp);
+
+ return TRUE;
+}
+
+
+/*=*
+ *
+ * unsigned char VIAGetPanelState(VIABIOSInfoPtr)
+ *
+ * - Get Flat Panel Expaension/Centering State
+ *
+ * Return Type: unsigend char
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * Bit[7:1] Reserved
+ * Bit[0] 0/1 = Centering/Expansion
+ *
+ * The Definition of Return Value:
+ *
+ * Bit[7:1] Reserved
+ * Bit[0] 0/1 = Centering/Expansion
+ *=*/
+
+unsigned char VIAGetPanelState(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ unsigned char tmp;
+
+ pVia = pBIOSInfo;
+
+ VGAOUT8(0x3D4, 0x3B);
+ tmp = VGAIN8(0x3D5) & 0x01;
+
+ return tmp;
+}
+
+
+/*=*
+ *
+ * int VIAQueryDVIEDID(void)
+ *
+ * - Query Flat Panel's EDID Table Version Through DVI Connector
+ *
+ * Return Type: int
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * 0 - Found No EDID Table
+ * 1 - Found EDID1 Table
+ * 2 - Found EDID2 Table
+ *=*/
+
+int VIAQueryDVIEDID(VIABIOSInfoPtr pBIOSInfo)
+{
+ I2CDevPtr dev;
+ unsigned char W_Buffer[1];
+ unsigned char R_Buffer[2];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAQueryDVIEDID\n"));
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0xA0)) {
+ pBIOSInfo->dev = xf86CreateI2CDevRec();
+ dev = pBIOSInfo->dev;
+ dev->DevName = "EDID1";
+ dev->SlaveAddr = 0xA0;
+ dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
+ dev->StartTimeout = 550;
+ dev->BitTimeout = 40;
+ dev->ByteTimeout = 40;
+ dev->AcknTimeout = 40;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,2);
+ if ((R_Buffer[0] == 0) && (R_Buffer[1] == 0xFF))
+ return 1; /* Found EDID1 Table */
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ }
+
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, 0xA2)) {
+ pBIOSInfo->dev = xf86CreateI2CDevRec();
+ dev = pBIOSInfo->dev;
+ dev->DevName = "EDID2";
+ dev->SlaveAddr = 0xA2;
+ dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
+ dev->StartTimeout = 550;
+ dev->BitTimeout = 40;
+ dev->ByteTimeout = 40;
+ dev->AcknTimeout = 40;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ if (R_Buffer[0] == 0x20)
+ return 2; /* Found EDID2 Table */
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ return 0; /* Found No EDID Table */
+ }
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ return 0; /* Found No EDID Table */
+ }
+ }
+ else
+ return 0;
+}
+
+
+/*=*
+ *
+ * unsigned char VIAGetPanelSizeFromDDCv1(VIABIOSInfoPtr pBIOSInfo)
+ *
+ * - Get Panel Size Using EDID1 Table
+ *
+ * Return Type: unsigned char
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * 0 - 640x480
+ * 1 - 800x600
+ * 2 - 1024x768
+ * 3 - 1280x768
+ * 4 - 1280x1024
+ * 5 - 1400x1050
+ * 6 - 1600x1200
+ * 0xFF - Not Supported Panel Size
+ *=*/
+
+unsigned char VIAGetPanelSizeFromDDCv1(VIABIOSInfoPtr pBIOSInfo)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pBIOSInfo->scrnIndex];
+ xf86MonPtr pMon;
+ int i, max = 0;
+ unsigned char W_Buffer[1];
+ unsigned char R_Buffer[1];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetPanelSizeFromDDCv1\n"));
+ for (i = 0x23; i < 0x35; i++) {
+ switch (i) {
+ case 0x23:
+ W_Buffer[0] = i;
+ xf86I2CWriteRead(pBIOSInfo->dev, W_Buffer,1, R_Buffer,1);
+ if (R_Buffer[0] & 0x3C)
+ max = 640;
+ if (R_Buffer[0] & 0xC0)
+ max = 720;
+ if (R_Buffer[0] & 0x03)
+ max = 800;
+ break;
+ case 0x24:
+ W_Buffer[0] = i;
+ xf86I2CWriteRead(pBIOSInfo->dev, W_Buffer,1, R_Buffer,1);
+ if (R_Buffer[0] & 0xC0)
+ max = 800;
+ if (R_Buffer[0] & 0x1E)
+ max = 1024;
+ if (R_Buffer[0] & 0x01)
+ max = 1280;
+ break;
+ case 0x26:
+ case 0x28:
+ case 0x2A:
+ case 0x2C:
+ case 0x2E:
+ case 0x30:
+ case 0x32:
+ case 0x34:
+ W_Buffer[0] = i;
+ xf86I2CWriteRead(pBIOSInfo->dev, W_Buffer,1, R_Buffer,1);
+ if (R_Buffer[0] == 1)
+ break;
+ R_Buffer[0] += 31;
+ R_Buffer[0] = R_Buffer[0] << 3; /* data = (data + 31) * 8 */
+ if (R_Buffer[0] > max)
+ max = R_Buffer[0];
+ break;
+ default:
+ break;
+ }
+ }
+
+ xf86DestroyI2CDevRec(pBIOSInfo->dev,TRUE);
+
+ pMon = xf86DoEDID_DDC2(pScrn->scrnIndex, pBIOSInfo->I2C_Port2);
+ if (pMon) {
+ pBIOSInfo->DDC2 = pMon;
+ xf86PrintEDID(pMon);
+ xf86SetDDCproperties(pScrn, pMon);
+ for (i = 0; i < 8; i++) {
+ if (pMon->timings2[i].hsize > max) {
+ max = pMon->timings2[i].hsize;
+ }
+ }
+ if (pBIOSInfo->DDC1) {
+ xf86SetDDCproperties(pScrn, pBIOSInfo->DDC1);
+ }
+ }
+
+ switch (max) {
+ case 640:
+ pBIOSInfo->PanelSize = VIA_PANEL6X4;
+ break;
+ case 800:
+ pBIOSInfo->PanelSize = VIA_PANEL8X6;
+ break;
+ case 1024:
+ pBIOSInfo->PanelSize = VIA_PANEL10X7;
+ break;
+ case 1280:
+ pBIOSInfo->PanelSize = VIA_PANEL12X10;
+ break;
+ case 1400:
+ pBIOSInfo->PanelSize = VIA_PANEL14X10;
+ break;
+ case 1600:
+ pBIOSInfo->PanelSize = VIA_PANEL16X12;
+ break;
+ default:
+ pBIOSInfo->PanelSize = VIA_PANEL_INVALID;
+ break;
+ }
+ return pBIOSInfo->PanelSize;
+}
+
+
+/*=*
+ *
+ * unsigned char VIAGetPanelSizeFromDDCv2(VIABIOSInfoPtr pBIOSInfo)
+ *
+ * - Get Panel Size Using EDID2 Table
+ *
+ * Return Type: unsigned char
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * 0 - 640x480
+ * 1 - 800x600
+ * 2 - 1024x768
+ * 3 - 1280x768
+ * 4 - 1280x1024
+ * 5 - 1400x1050
+ * 6 - 1600x1200
+ * 0xFF - Not Supported Panel Size
+ *=*/
+
+unsigned char VIAGetPanelSizeFromDDCv2(VIABIOSInfoPtr pBIOSInfo)
+{
+ int data = 0;
+ unsigned char W_Buffer[1];
+ unsigned char R_Buffer[1];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetPanelSizeFromDDCv2\n"));
+ W_Buffer[0] = 0x77;
+ xf86I2CWriteRead(pBIOSInfo->dev, W_Buffer,1, R_Buffer,1);
+ data = R_Buffer[0];
+ data = data << 8;
+ W_Buffer[0] = 0x76;
+ xf86I2CWriteRead(pBIOSInfo->dev, W_Buffer,1, R_Buffer,1);
+ data |= R_Buffer[0];
+
+ xf86DestroyI2CDevRec(pBIOSInfo->dev,TRUE);
+
+ switch (data) {
+ case 640:
+ pBIOSInfo->PanelSize = VIA_PANEL6X4;
+ break;
+ case 800:
+ pBIOSInfo->PanelSize = VIA_PANEL8X6;
+ break;
+ case 1024:
+ pBIOSInfo->PanelSize = VIA_PANEL10X7;
+ break;
+ case 1280:
+ pBIOSInfo->PanelSize = VIA_PANEL12X10;
+ break;
+ case 1400:
+ pBIOSInfo->PanelSize = VIA_PANEL14X10;
+ break;
+ case 1600:
+ pBIOSInfo->PanelSize = VIA_PANEL16X12;
+ break;
+ default:
+ pBIOSInfo->PanelSize = VIA_PANEL_INVALID;
+ break;
+ }
+ return pBIOSInfo->PanelSize;
+}
+
+/*=*
+ *
+ * unsigned char VIAGetPanelInfo(VIABIOSInfoPtr pBIOSInfo)
+ *
+ * - Get Panel Size
+ *
+ * Return Type: unsigned char
+ *
+ * The Definition of Input Value:
+ *
+ * VIABIOSInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * 0 - 640x480
+ * 1 - 800x600
+ * 2 - 1024x768
+ * 3 - 1280x768
+ * 4 - 1280x1024
+ * 5 - 1400x1050
+ * 6 - 1600x1200
+ * 0xFF - Not Supported Panel Size
+ *=*/
+
+unsigned char VIAGetPanelInfo(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia = pBIOSInfo;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ int port, offset, mask, data;
+ int j = 0, k;
+ unsigned char misc, cr6c, cr93;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetPanelInfo\n"));
+
+ if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID) {
+
+ /* Enable LCD */
+ VGAOUT8(0x3d4, 0x6A);
+ misc = VGAIN8(0x3d5);
+ VGAOUT8(0x3d5, misc | 0x08);
+ VGAOUT8(0x3d4, 0x6C);
+ cr6c = VGAIN8(0x3d5);
+ VGAOUT8(0x3d5, cr6c | 0x21);
+ VGAOUT8(0x3d4, 0x93);
+ cr93 = VGAIN8(0x3d5);
+ if (pBIOSInfo->ChipRev > 15) {
+ VGAOUT8(0x3d5, 0xA3);
+ }
+ else {
+ VGAOUT8(0x3d5, 0xBF);
+ }
+ usleep(1);
+
+ for (k = 0; k < pViaModeTable->powerOn[j].numEntry; k++) {
+ port = pViaModeTable->powerOn[j].port[k];
+ offset = pViaModeTable->powerOn[j].offset[k];
+ mask = pViaModeTable->powerOn[j].mask[k];
+ data = pViaModeTable->powerOn[j].data[k] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, (VGAIN8(0x301+port) & ~mask) | data);
+ usleep(pViaModeTable->powerOn[j].delay[k]);
+ }
+
+ switch (VIAQueryDVIEDID(pBIOSInfo)) {
+ case 1:
+ VIAGetPanelSizeFromDDCv1(pBIOSInfo);
+ break;
+ case 2:
+ VIAGetPanelSizeFromDDCv2(pBIOSInfo);
+ break;
+ default:
+ break;
+ }
+
+ for (k = 0; k < pViaModeTable->powerOff[j].numEntry; k++) {
+ port = pViaModeTable->powerOff[j].port[k];
+ offset = pViaModeTable->powerOff[j].offset[k];
+ mask = pViaModeTable->powerOff[j].mask[k];
+ data = pViaModeTable->powerOff[j].data[k] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, (VGAIN8(0x301+port) & ~mask) | data);
+ usleep(pViaModeTable->powerOff[j].delay[k]);
+ }
+
+ /* Disable LCD */
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, misc);
+ /* Restore DI0, DI1 status */
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, cr6c);
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, cr93);
+ }
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "PanelSize = %d\n", pBIOSInfo->PanelSize));
+ return (unsigned char)(pBIOSInfo->PanelSize);
+}
+
+#ifdef CREATE_MODETABLE_HEADERFILE
+Bool VIACreateHeaderFile(VIAModeTablePtr pViaModeTable)
+{
+ int i, j, k, m;
+ int numMPatch;
+ VIALCDMPatchEntryPtr MPatch;
+ FILE *pFile;
+
+
+ if ((pFile = fopen("via_mode.h", "w+")) == NULL) {
+ ErrorF("Can't open \"via_mode.h\" file!!\n");
+ return FALSE;
+ }
+
+ fprintf(pFile, "#ifndef _VIA_MODETABLE_H\n");
+ fprintf(pFile, "#define _VIA_MODETABLE_H\n");
+ fprintf(pFile, "\n");
+
+ fprintf(pFile, "unsigned short BIOSVer = %#X;\n\n", pViaModeTable->BIOSVer);
+ fprintf(pFile, "char BIOSDate[] = { ");
+ for (i = 0; i < 9; i++) {
+ if (i == 8)
+ fprintf(pFile, "%#X };\n\n", pViaModeTable->BIOSDate[i]);
+ else
+ fprintf(pFile, "%#X, ", pViaModeTable->BIOSDate[i]);
+ }
+ fprintf(pFile, "unsigned short NumModes = %d;\n\n", pViaModeTable->NumModes);
+ fprintf(pFile, "int NumPowerOn = %d;\n\n", pViaModeTable->NumPowerOn);
+ fprintf(pFile, "int NumPowerOff = %d;\n\n", pViaModeTable->NumPowerOff);
+ fprintf(pFile, "VIAModeEntry Modes[] = {\n");
+ for (i = 0; i < pViaModeTable->NumModes; i++) {
+ fprintf(pFile, " { %d, %d, %d, %#X, %d, %#X, %#X, ",
+ pViaModeTable->Modes[i].Width,
+ pViaModeTable->Modes[i].Height,
+ pViaModeTable->Modes[i].Bpp,
+ pViaModeTable->Modes[i].Mode,
+ pViaModeTable->Modes[i].MemNeed,
+ pViaModeTable->Modes[i].MClk,
+ pViaModeTable->Modes[i].VClk);
+ fprintf(pFile, "{ %d, %d, %d, %#X, ", /* stdVgaTable */
+ pViaModeTable->Modes[i].stdVgaTable.columns,
+ pViaModeTable->Modes[i].stdVgaTable.rows,
+ pViaModeTable->Modes[i].stdVgaTable.fontHeight,
+ pViaModeTable->Modes[i].stdVgaTable.pageSize);
+ fprintf(pFile, "{ "); /* SR[] */
+ for (j = 0; j < 5; j++) {
+ if (j == 4)
+ fprintf(pFile, "%#X }, ", /* SR[] */
+ pViaModeTable->Modes[i].stdVgaTable.SR[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->Modes[i].stdVgaTable.SR[j]);
+ }
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->Modes[i].stdVgaTable.misc);
+ fprintf(pFile, "{ "); /* CR[] */
+ for (j = 0; j < 25; j++) {
+ if (j == 24)
+ fprintf(pFile, "%#X }, ", /* CR[] */
+ pViaModeTable->Modes[i].stdVgaTable.CR[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->Modes[i].stdVgaTable.CR[j]);
+ }
+ fprintf(pFile, "{ "); /* AR[] */
+ for (j = 0; j < 20; j++) {
+ if (j == 19)
+ fprintf(pFile, "%#X }, ", /* AR[] */
+ pViaModeTable->Modes[i].stdVgaTable.AR[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->Modes[i].stdVgaTable.AR[j]);
+ }
+ fprintf(pFile, "{ "); /* GR[] */
+ for (j = 0; j < 9; j++) {
+ if (j == 8)
+ fprintf(pFile, "%#X } ", /* GR[] */
+ pViaModeTable->Modes[i].stdVgaTable.GR[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->Modes[i].stdVgaTable.GR[j]);
+ }
+ fprintf(pFile, "}, "); /* stdVgaTable */
+ fprintf(pFile, "{ "); /* extModeExtTable */
+ fprintf(pFile, "{ "); /* extModeExtTable.port[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* extModeExtTable.port[] */
+ pViaModeTable->Modes[i].extModeExtTable.port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->Modes[i].extModeExtTable.port[j]);
+ }
+ fprintf(pFile, "{ "); /* extModeExtTable.offset[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* extModeExtTable.offset[] */
+ pViaModeTable->Modes[i].extModeExtTable.offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->Modes[i].extModeExtTable.offset[j]);
+ }
+ fprintf(pFile, "{ "); /* extModeExtTable.mask[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* extModeExtTable.mask[] */
+ pViaModeTable->Modes[i].extModeExtTable.mask[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->Modes[i].extModeExtTable.mask[j]);
+ }
+ fprintf(pFile, "{ "); /* extModeExtTable.data[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* extModeExtTable.data[] */
+ pViaModeTable->Modes[i].extModeExtTable.data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->Modes[i].extModeExtTable.data[j]);
+ }
+ fprintf(pFile, "%d ",
+ pViaModeTable->Modes[i].extModeExtTable.numEntry);
+ fprintf(pFile, "} "); /* extModeExtTable */
+ if (i == (pViaModeTable->NumModes - 1))
+ fprintf(pFile, "}\n");
+ else
+ fprintf(pFile, "},\n");
+ }
+ fprintf(pFile, "};\n\n");
+
+ fprintf(pFile, "VIABIOSRegTableRec commExtTable = {\n"); /* commExtTable */
+ fprintf(pFile, " { "); /* commExtTable.port[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* commExtTable.port[] */
+ pViaModeTable->commExtTable.port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->commExtTable.port[j]);
+ }
+ fprintf(pFile, "{ "); /* commExtTable.offset[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* commExtTable.offset[] */
+ pViaModeTable->commExtTable.offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->commExtTable.offset[j]);
+ }
+ fprintf(pFile, "{ "); /* commExtTable.mask[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* commExtTable.mask[] */
+ pViaModeTable->commExtTable.mask[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->commExtTable.mask[j]);
+ }
+ fprintf(pFile, "{ "); /* commExtTable.data[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* commExtTable.data[] */
+ pViaModeTable->commExtTable.data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->commExtTable.data[j]);
+ }
+ fprintf(pFile, "%d ",
+ pViaModeTable->commExtTable.numEntry);
+ fprintf(pFile, "};\n\n"); /* commExtTable */
+
+ fprintf(pFile, "VIABIOSRegTableRec stdModeExtTable = {\n"); /* stdModeExtTable */
+ fprintf(pFile, " { "); /* stdModeExtTable.port[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* stdModeExtTable.port[] */
+ pViaModeTable->stdModeExtTable.port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->stdModeExtTable.port[j]);
+ }
+ fprintf(pFile, "{ "); /* stdModeExtTable.offset[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* stdModeExtTable.offset[] */
+ pViaModeTable->stdModeExtTable.offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->stdModeExtTable.offset[j]);
+ }
+ fprintf(pFile, "{ "); /* stdModeExtTable.mask[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* stdModeExtTable.mask[] */
+ pViaModeTable->stdModeExtTable.mask[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->stdModeExtTable.mask[j]);
+ }
+ fprintf(pFile, "{ "); /* stdModeExtTable.data[] */
+ for (j = 0; j < VIA_BIOS_REG_TABLE_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_TABLE_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* stdModeExtTable.data[] */
+ pViaModeTable->stdModeExtTable.data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->stdModeExtTable.data[j]);
+ }
+ fprintf(pFile, "%d ",
+ pViaModeTable->stdModeExtTable.numEntry);
+ fprintf(pFile, "};\n\n"); /* stdModeExtTable */
+
+ fprintf(pFile, "VIABIOSRefreshTableRec refreshTable[%d][%d] = {\n",
+ VIA_BIOS_NUM_RES, VIA_BIOS_NUM_REFRESH); /* refreshTable */
+ for (i = 0; i < VIA_BIOS_NUM_RES; i++) {
+ fprintf(pFile, " {\n");
+ for (j = 0; j < VIA_BIOS_NUM_REFRESH; j++) {
+ fprintf(pFile, " { %d, %#X, ",
+ pViaModeTable->refreshTable[i][j].refresh,
+ pViaModeTable->refreshTable[i][j].VClk);
+ fprintf(pFile, "{ "); /* refreshTable.CR[] */
+ for (k = 0; k < 14; k++) {
+ if (k == 13)
+ fprintf(pFile, "%#X } ", /* refreshTable.CR[] */
+ pViaModeTable->refreshTable[i][j].CR[k]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->refreshTable[i][j].CR[k]);
+ }
+ if (j == (VIA_BIOS_NUM_REFRESH - 1)) {
+ if (i == (VIA_BIOS_NUM_RES - 1))
+ fprintf(pFile, "}\n");
+ else
+ fprintf(pFile, "},\n");
+ }
+ else
+ fprintf(pFile, "},\n");
+ }
+ if (i == (VIA_BIOS_NUM_RES - 1)) {
+ fprintf(pFile, " }\n");
+ fprintf(pFile, "};\n\n");
+ }
+ else
+ fprintf(pFile, " },\n");
+ }
+
+ fprintf(pFile, "VIALCDModeTableRec lcdTable[] = {\n"); /* lcdTable */
+ for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) {
+ fprintf(pFile, " { %#X, %#X, %#X, %d, %d, %d, %d, \n",
+ pViaModeTable->lcdTable[i].fpIndex,
+ pViaModeTable->lcdTable[i].fpSize,
+ pViaModeTable->lcdTable[i].powerSeq,
+ pViaModeTable->lcdTable[i].numMPatchDP2Ctr,
+ pViaModeTable->lcdTable[i].numMPatchDP2Exp,
+ pViaModeTable->lcdTable[i].numMPatchDP1Ctr,
+ pViaModeTable->lcdTable[i].numMPatchDP1Exp);
+
+ fprintf(pFile, " { "); /* SuptMode */
+ for (j = 0; j < VIA_BIOS_NUM_LCD_SUPPORT_MASK; j++) {
+ if (j == (VIA_BIOS_NUM_LCD_SUPPORT_MASK - 1))
+ fprintf(pFile, "%#X }, \n", /* SuptMode */
+ pViaModeTable->lcdTable[i].SuptMode[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].SuptMode[j]);
+ }
+
+ fprintf(pFile, " { %#X, %#X, %#X, %#X, ", /* FPconfigTb */
+ pViaModeTable->lcdTable[i].FPconfigTb.LCDClk,
+ pViaModeTable->lcdTable[i].FPconfigTb.VClk,
+ pViaModeTable->lcdTable[i].FPconfigTb.LCDClk_12Bit,
+ pViaModeTable->lcdTable[i].FPconfigTb.VClk_12Bit);
+ fprintf(pFile, "{ "); /* FPconfigTb.port[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* FPconfigTb.port[] */
+ pViaModeTable->lcdTable[i].FPconfigTb.port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].FPconfigTb.port[j]);
+ }
+ fprintf(pFile, "{ "); /* FPconfigTb.offset[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* FPconfigTb.offset[] */
+ pViaModeTable->lcdTable[i].FPconfigTb.offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].FPconfigTb.offset[j]);
+ }
+ fprintf(pFile, "{ "); /* FPconfigTb.data[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* FPconfigTb.data[] */
+ pViaModeTable->lcdTable[i].FPconfigTb.data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].FPconfigTb.data[j]);
+ }
+ fprintf(pFile, "%d }, \n", /* FPconfigTb */
+ pViaModeTable->lcdTable[i].FPconfigTb.numEntry);
+
+ fprintf(pFile, " { %#X, %#X, %#X, %#X, ", /* InitTb */
+ pViaModeTable->lcdTable[i].InitTb.LCDClk,
+ pViaModeTable->lcdTable[i].InitTb.VClk,
+ pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit,
+ pViaModeTable->lcdTable[i].InitTb.VClk_12Bit);
+ fprintf(pFile, "{ "); /* InitTb.port[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* InitTb.port[] */
+ pViaModeTable->lcdTable[i].InitTb.port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].InitTb.port[j]);
+ }
+ fprintf(pFile, "{ "); /* InitTb.offset[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* InitTb.offset[] */
+ pViaModeTable->lcdTable[i].InitTb.offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].InitTb.offset[j]);
+ }
+ fprintf(pFile, "{ "); /* InitTb.data[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* InitTb.data[] */
+ pViaModeTable->lcdTable[i].InitTb.data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].InitTb.data[j]);
+ }
+ fprintf(pFile, "%d }, \n", /* InitTb */
+ pViaModeTable->lcdTable[i].InitTb.numEntry);
+
+ /* MPatch Table */
+ for (m = 0; m < 4; m++) {
+ switch (m) {
+ case 0: /* MPatchDP2Ctr */
+ MPatch = pViaModeTable->lcdTable[i].MPatchDP2Ctr;
+ numMPatch = VIA_BIOS_MAX_NUM_MPATCH2;
+ break;
+ case 1: /* MPatchDP2Exp */
+ MPatch = pViaModeTable->lcdTable[i].MPatchDP2Exp;
+ numMPatch = VIA_BIOS_MAX_NUM_MPATCH2;
+ break;
+ case 2: /* MPatchDP1Ctr */
+ MPatch = pViaModeTable->lcdTable[i].MPatchDP1Ctr;
+ numMPatch = VIA_BIOS_MAX_NUM_MPATCH1;
+ break;
+ case 3: /* MPatchDP1Exp */
+ MPatch = pViaModeTable->lcdTable[i].MPatchDP1Exp;
+ numMPatch = VIA_BIOS_MAX_NUM_MPATCH1;
+ break;
+ }
+
+ fprintf(pFile, " { \n");
+ for (k = 0; k < numMPatch; k++) {
+ fprintf(pFile, " { %#X, %#X, %#X, %#X, %#X, ",
+ MPatch[k].Mode,
+ MPatch[k].LCDClk,
+ MPatch[k].VClk,
+ MPatch[k].LCDClk_12Bit,
+ MPatch[k].VClk_12Bit);
+ fprintf(pFile, "{ "); /* port[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* port[] */
+ MPatch[k].port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ MPatch[k].port[j]);
+ }
+ fprintf(pFile, "{ "); /* offset[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* offset[] */
+ MPatch[k].offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ MPatch[k].offset[j]);
+ }
+ fprintf(pFile, "{ "); /* data[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* data[] */
+ MPatch[k].data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ MPatch[k].data[j]);
+ }
+ if (k == (numMPatch - 1))
+ fprintf(pFile, "%d }\n }, \n",
+ MPatch[k].numEntry);
+ else
+ fprintf(pFile, "%d }, \n",
+ MPatch[k].numEntry);
+ }
+ }
+
+ fprintf(pFile, " { %#X, %#X, %#X, %#X, ", /* LowResCtr */
+ pViaModeTable->lcdTable[i].LowResCtr.LCDClk,
+ pViaModeTable->lcdTable[i].LowResCtr.VClk,
+ pViaModeTable->lcdTable[i].LowResCtr.LCDClk_12Bit,
+ pViaModeTable->lcdTable[i].LowResCtr.VClk_12Bit);
+ fprintf(pFile, "{ "); /* LowResCtr.port[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* LowResCtr.port[] */
+ pViaModeTable->lcdTable[i].LowResCtr.port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].LowResCtr.port[j]);
+ }
+ fprintf(pFile, "{ "); /* LowResCtr.offset[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* LowResCtr.offset[] */
+ pViaModeTable->lcdTable[i].LowResCtr.offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].LowResCtr.offset[j]);
+ }
+ fprintf(pFile, "{ "); /* LowResCtr.data[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* LowResCtr.data[] */
+ pViaModeTable->lcdTable[i].LowResCtr.data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].LowResCtr.data[j]);
+ }
+ fprintf(pFile, "%d }, \n", /* LowResCtr */
+ pViaModeTable->lcdTable[i].LowResCtr.numEntry);
+
+ fprintf(pFile, " { %#X, %#X, %#X, %#X, ", /* LowResExp */
+ pViaModeTable->lcdTable[i].LowResExp.LCDClk,
+ pViaModeTable->lcdTable[i].LowResExp.VClk,
+ pViaModeTable->lcdTable[i].LowResExp.LCDClk_12Bit,
+ pViaModeTable->lcdTable[i].LowResExp.VClk_12Bit);
+ fprintf(pFile, "{ "); /* LowResExp.port[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* LowResExp.port[] */
+ pViaModeTable->lcdTable[i].LowResExp.port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].LowResExp.port[j]);
+ }
+ fprintf(pFile, "{ "); /* LowResExp.offset[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* LowResExp.offset[] */
+ pViaModeTable->lcdTable[i].LowResExp.offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].LowResExp.offset[j]);
+ }
+ fprintf(pFile, "{ "); /* LowResExp.data[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* LowResExp.data[] */
+ pViaModeTable->lcdTable[i].LowResExp.data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].LowResExp.data[j]);
+ }
+ fprintf(pFile, "%d }, \n", /* LowResExp */
+ pViaModeTable->lcdTable[i].LowResExp.numEntry);
+
+ fprintf(pFile, " { \n"); /* MCtr */
+ for (k = 0; k < VIA_BIOS_MAX_NUM_CTREXP; k++) {
+ fprintf(pFile, " { %#X, %#X, %#X, %#X, ",
+ pViaModeTable->lcdTable[i].MCtr[k].LCDClk,
+ pViaModeTable->lcdTable[i].MCtr[k].VClk,
+ pViaModeTable->lcdTable[i].MCtr[k].LCDClk_12Bit,
+ pViaModeTable->lcdTable[i].MCtr[k].VClk_12Bit);
+ fprintf(pFile, "{ "); /* port[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* port[] */
+ pViaModeTable->lcdTable[i].MCtr[k].port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].MCtr[k].port[j]);
+ }
+ fprintf(pFile, "{ "); /* offset[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* offset[] */
+ pViaModeTable->lcdTable[i].MCtr[k].offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].MCtr[k].offset[j]);
+ }
+ fprintf(pFile, "{ "); /* data[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* data[] */
+ pViaModeTable->lcdTable[i].MCtr[k].data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].MCtr[k].data[j]);
+ }
+ if (k == (VIA_BIOS_MAX_NUM_CTREXP - 1))
+ fprintf(pFile, "%d }\n }, \n",
+ pViaModeTable->lcdTable[i].MCtr[k].numEntry);
+ else
+ fprintf(pFile, "%d }, \n",
+ pViaModeTable->lcdTable[i].MCtr[k].numEntry);
+ }
+
+ fprintf(pFile, " { \n"); /* MExp */
+ for (k = 0; k < VIA_BIOS_MAX_NUM_CTREXP; k++) {
+ fprintf(pFile, " { %#X, %#X, %#X, %#X, ",
+ pViaModeTable->lcdTable[i].MExp[k].LCDClk,
+ pViaModeTable->lcdTable[i].MExp[k].VClk,
+ pViaModeTable->lcdTable[i].MExp[k].LCDClk_12Bit,
+ pViaModeTable->lcdTable[i].MExp[k].VClk_12Bit);
+ fprintf(pFile, "{ "); /* port[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* port[] */
+ pViaModeTable->lcdTable[i].MExp[k].port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].MExp[k].port[j]);
+ }
+ fprintf(pFile, "{ "); /* offset[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* offset[] */
+ pViaModeTable->lcdTable[i].MExp[k].offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].MExp[k].offset[j]);
+ }
+ fprintf(pFile, "{ "); /* data[] */
+ for (j = 0; j < VIA_BIOS_REG_LCD_MAX_NUM; j++) {
+ if (j == (VIA_BIOS_REG_LCD_MAX_NUM - 1))
+ fprintf(pFile, "%#X }, ", /* data[] */
+ pViaModeTable->lcdTable[i].MExp[k].data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->lcdTable[i].MExp[k].data[j]);
+ }
+ if (k == (VIA_BIOS_MAX_NUM_CTREXP - 1))
+ fprintf(pFile, "%d }\n }\n",
+ pViaModeTable->lcdTable[i].MExp[k].numEntry);
+ else
+ fprintf(pFile, "%d }, \n",
+ pViaModeTable->lcdTable[i].MExp[k].numEntry);
+ }
+ if (i == (VIA_BIOS_NUM_PANEL - 1))
+ fprintf(pFile, " }\n};\n\n");
+ else
+ fprintf(pFile, " },\n");
+ }
+
+ /* powerOn */
+ fprintf(pFile, "VIALCDPowerSeqRec powerOn[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_LCD_POWER_SEQ; i++) {
+ fprintf(pFile, " { %d, ",
+ pViaModeTable->powerOn[i].powerSeq);
+ fprintf(pFile, "{ "); /* port[] */
+ for (j = 0; j < 4; j++) {
+ if (j == 3)
+ fprintf(pFile, "%#X }, ", /* port[] */
+ pViaModeTable->powerOn[i].port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->powerOn[i].port[j]);
+ }
+ fprintf(pFile, "{ "); /* offset[] */
+ for (j = 0; j < 4; j++) {
+ if (j == 3)
+ fprintf(pFile, "%#X }, ", /* offset[] */
+ pViaModeTable->powerOn[i].offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->powerOn[i].offset[j]);
+ }
+ fprintf(pFile, "{ "); /* mask[] */
+ for (j = 0; j < 4; j++) {
+ if (j == 3)
+ fprintf(pFile, "%#X }, ", /* mask[] */
+ pViaModeTable->powerOn[i].mask[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->powerOn[i].mask[j]);
+ }
+ fprintf(pFile, "{ "); /* data[] */
+ for (j = 0; j < 4; j++) {
+ if (j == 3)
+ fprintf(pFile, "%#X }, ", /* data[] */
+ pViaModeTable->powerOn[i].data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->powerOn[i].data[j]);
+ }
+ fprintf(pFile, "{ "); /* delay[] */
+ for (j = 0; j < 4; j++) {
+ if (j == 3)
+ fprintf(pFile, "%#X }, ", /* delay[] */
+ pViaModeTable->powerOn[i].delay[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->powerOn[i].delay[j]);
+ }
+ if (i == (VIA_BIOS_NUM_LCD_POWER_SEQ - 1)) {
+ fprintf(pFile, "%d }\n}; \n\n",
+ pViaModeTable->powerOn[i].numEntry);
+ }
+ else
+ fprintf(pFile, "%d }, \n",
+ pViaModeTable->powerOn[i].numEntry);
+ }
+
+ /* powerOff */
+ fprintf(pFile, "VIALCDPowerSeqRec powerOff[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_LCD_POWER_SEQ; i++) {
+ fprintf(pFile, " { %d, ",
+ pViaModeTable->powerOff[i].powerSeq);
+ fprintf(pFile, "{ "); /* port[] */
+ for (j = 0; j < 4; j++) {
+ if (j == 3)
+ fprintf(pFile, "%#X }, ", /* port[] */
+ pViaModeTable->powerOff[i].port[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->powerOff[i].port[j]);
+ }
+ fprintf(pFile, "{ "); /* offset[] */
+ for (j = 0; j < 4; j++) {
+ if (j == 3)
+ fprintf(pFile, "%#X }, ", /* offset[] */
+ pViaModeTable->powerOff[i].offset[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->powerOff[i].offset[j]);
+ }
+ fprintf(pFile, "{ "); /* mask[] */
+ for (j = 0; j < 4; j++) {
+ if (j == 3)
+ fprintf(pFile, "%#X }, ", /* mask[] */
+ pViaModeTable->powerOff[i].mask[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->powerOff[i].mask[j]);
+ }
+ fprintf(pFile, "{ "); /* data[] */
+ for (j = 0; j < 4; j++) {
+ if (j == 3)
+ fprintf(pFile, "%#X }, ", /* data[] */
+ pViaModeTable->powerOff[i].data[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->powerOff[i].data[j]);
+ }
+ fprintf(pFile, "{ "); /* delay[] */
+ for (j = 0; j < 4; j++) {
+ if (j == 3)
+ fprintf(pFile, "%#X }, ", /* delay[] */
+ pViaModeTable->powerOff[i].delay[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->powerOff[i].delay[j]);
+ }
+ if (i == (VIA_BIOS_NUM_LCD_POWER_SEQ - 1)) {
+ fprintf(pFile, "%d }\n}; \n\n",
+ pViaModeTable->powerOff[i].numEntry);
+ }
+ else
+ fprintf(pFile, "%d }, \n",
+ pViaModeTable->powerOff[i].numEntry);
+ }
+
+ /* ModeFix */
+ fprintf(pFile, "VIALCDModeFixRec modeFix = {\n");
+ fprintf(pFile, " { "); /* modeFix.reqMode[] */
+ for (i = 0; i < 32; i++) {
+ if (i == 31)
+ fprintf(pFile, "%#X }, ", /* ModeFix.reqMode[] */
+ pViaModeTable->modeFix.reqMode[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->modeFix.reqMode[i]);
+ }
+ fprintf(pFile, "{ "); /* modeFix.fixMode[] */
+ for (i = 0; i < 32; i++) {
+ if (i == 31)
+ fprintf(pFile, "%#X }, ", /* modeFix.fixMode[] */
+ pViaModeTable->modeFix.fixMode[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->modeFix.fixMode[i]);
+ }
+ fprintf(pFile, "%d }; \n\n",
+ pViaModeTable->modeFix.numEntry);
+
+ fprintf(pFile, "\n");
+ fprintf(pFile, "#endif\n");
+
+ if (fclose(pFile) != 0) {
+ ErrorF("Error closing file!!\n");
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+#endif /* CREATE_MODETABLE_HEADERFILE */
+
+#ifdef CREATE_FS454_HEADERFILE
+Bool VIACreateFS454(VIAModeTablePtr pViaModeTable)
+{
+ int i, j;
+ FILE *pFile;
+
+ if ((pFile = fopen("via_fs454.h", "w+")) == NULL) {
+ ErrorF("Can't open \"via_fs454.h\" file!!\n");
+ return FALSE;
+ }
+
+ fprintf(pFile, "#ifndef _VIA_FS454MODETABLE_H\n");
+ fprintf(pFile, "#define _VIA_FS454MODETABLE_H\n");
+ fprintf(pFile, "\n");
+
+ /* fs454MaskTable */
+ fprintf(pFile, "VIABIOSFS454TVMASKTableRec fs454MaskTable = {\n");
+ fprintf(pFile, " { ");
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* fs454MaskTable.CRTC1[] */
+ pViaModeTable->fs454MaskTable.CRTC1[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454MaskTable.CRTC1[i]);
+ }
+
+ fprintf(pFile, " { "); /* fs454MaskTable.CRTC2[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* fs454MaskTable.CRTC2[] */
+ pViaModeTable->fs454MaskTable.CRTC2[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454MaskTable.CRTC2[i]);
+ }
+
+ fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n",
+ pViaModeTable->fs454MaskTable.misc1,
+ pViaModeTable->fs454MaskTable.misc2,
+ pViaModeTable->fs454MaskTable.numCRTC1,
+ pViaModeTable->fs454MaskTable.numCRTC2);
+
+ /* fs454Table */
+ fprintf(pFile, "VIABIOSFS454TableRec fs454Table[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_FS454; i++) {
+ fprintf(pFile, " {\n");
+
+ fprintf(pFile, " { "); /* fs454Table.TVNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_FS454_TV_REG; j++) {
+ if (j == (VIA_BIOS_NUM_FS454_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* fs454Table.TVNTSC[] */
+ pViaModeTable->fs454Table[i].TVNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454Table[i].TVNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454Table.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* fs454Table.CRTCNTSC1[] */
+ pViaModeTable->fs454Table[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454Table[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454Table.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* fs454Table.MiscNTSC1[] */
+ pViaModeTable->fs454Table[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454Table[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454Table.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* fs454Table.MiscNTSC2[] */
+ pViaModeTable->fs454Table[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454Table[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454Table.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* fs454Table.CRTCNTSC2_8BPP[] */
+ pViaModeTable->fs454Table[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454Table[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454Table.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* fs454Table.CRTCNTSC2_16BPP[] */
+ pViaModeTable->fs454Table[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454Table[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454Table.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* fs454Table.CRTCNTSC2_32BPP[] */
+ pViaModeTable->fs454Table[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454Table[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454Table.RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* fs454Table.RGBNTSC[] */
+ pViaModeTable->fs454Table[i].RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454Table[i].RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454Table.YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* fs454Table.YCbCrNTSC[] */
+ pViaModeTable->fs454Table[i].YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454Table[i].YCbCrNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454Table.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* fs454Table.DotCrawlNTSC[] */
+ pViaModeTable->fs454Table[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454Table[i].DotCrawlNTSC[j]);
+ }
+
+ if (i == (VIA_BIOS_NUM_FS454 - 1))
+ fprintf(pFile, " }\n};\n\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ /* fs454OverTable */
+ fprintf(pFile, "VIABIOSFS454TableRec fs454OverTable[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_FS454; i++) {
+ fprintf(pFile, " {\n");
+
+ fprintf(pFile, " { ");
+ for (j = 0; j < VIA_BIOS_NUM_FS454_TV_REG; j++) {
+ if (j == (VIA_BIOS_NUM_FS454_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* fs454OverTable.TVNTSC[] */
+ pViaModeTable->fs454OverTable[i].TVNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454OverTable[i].TVNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454OverTable.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* fs454OverTable.CRTCNTSC1[] */
+ pViaModeTable->fs454OverTable[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454OverTable[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454OverTable.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* fs454OverTable.MiscNTSC1[] */
+ pViaModeTable->fs454OverTable[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454OverTable[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454OverTable.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* fs454OverTable.MiscNTSC2[] */
+ pViaModeTable->fs454OverTable[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454OverTable[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454OverTable.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* fs454OverTable.CRTCNTSC2_8BPP[] */
+ pViaModeTable->fs454OverTable[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454OverTable[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454OverTable.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* fs454OverTable.CRTCNTSC2_16BPP[] */
+ pViaModeTable->fs454OverTable[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454OverTable[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454OverTable.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* fs454OverTable.CRTCNTSC2_32BPP[] */
+ pViaModeTable->fs454OverTable[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454OverTable[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454OverTable.RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* fs454OverTable.RGBNTSC[] */
+ pViaModeTable->fs454OverTable[i].RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454OverTable[i].RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454OverTable.YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* fs454OverTable.YCbCrNTSC[] */
+ pViaModeTable->fs454OverTable[i].YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454OverTable[i].YCbCrNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* fs454OverTable.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* fs454OverTable.DotCrawlNTSC[] */
+ pViaModeTable->fs454OverTable[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->fs454OverTable[i].DotCrawlNTSC[j]);
+ }
+
+ if (i == (VIA_BIOS_NUM_FS454 - 1))
+ fprintf(pFile, " }\n};\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ fprintf(pFile, "\n");
+ fprintf(pFile, "#endif\n");
+
+ return TRUE;
+}
+#endif /* CREATE_FS454_HEADERFILE */
+
+#ifdef CREATE_TV2_HEADERFILE
+Bool VIACreateTV2(VIAModeTablePtr pViaModeTable)
+{
+ int i, j;
+ FILE *pFile;
+
+
+ if ((pFile = fopen("via_tv2.h", "w+")) == NULL) {
+ ErrorF("Can't open \"via_tv2.h\" file!!\n");
+ return FALSE;
+ }
+
+ fprintf(pFile, "#ifndef _VIA_TV2MODETABLE_H\n");
+ fprintf(pFile, "#define _VIA_TV2MODETABLE_H\n");
+ fprintf(pFile, "\n");
+
+ /* tv2MaskTable */
+ fprintf(pFile, "VIABIOSTVMASKTableRec tv2MaskTable = {\n");
+ fprintf(pFile, " { "); /* tv2MaskTable.TV[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2MaskTable.TV[] */
+ pViaModeTable->tv2MaskTable.TV[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2MaskTable.TV[i]);
+ }
+
+ fprintf(pFile, " { "); /* tv2MaskTable.CRTC1[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2MaskTable.CRTC1[] */
+ pViaModeTable->tv2MaskTable.CRTC1[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2MaskTable.CRTC1[i]);
+ }
+
+ fprintf(pFile, " { "); /* tv2MaskTable.CRTC2[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2MaskTable.CRTC2[] */
+ pViaModeTable->tv2MaskTable.CRTC2[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2MaskTable.CRTC2[i]);
+ }
+
+ fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n",
+ pViaModeTable->tv2MaskTable.misc1,
+ pViaModeTable->tv2MaskTable.misc2,
+ pViaModeTable->tv2MaskTable.numTV,
+ pViaModeTable->tv2MaskTable.numCRTC1,
+ pViaModeTable->tv2MaskTable.numCRTC2);
+
+ fprintf(pFile, "VIABIOSTV2TableRec tv2Table[] = {\n"); /* tv2Table */
+ for (i = 0; i < VIA_BIOS_NUM_TV2; i++) {
+ fprintf(pFile, " {\n");
+ fprintf(pFile, " { "); /* tv2Table.TVNTSCC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.TVNTSCC[] */
+ pViaModeTable->tv2Table[i].TVNTSCC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].TVNTSCC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.TVNTSCS[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.TVNTSCS[] */
+ pViaModeTable->tv2Table[i].TVNTSCS[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].TVNTSCS[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.CRTCNTSC1[] */
+ pViaModeTable->tv2Table[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.MiscNTSC1[] */
+ pViaModeTable->tv2Table[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.MiscNTSC2[] */
+ pViaModeTable->tv2Table[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.CRTCNTSC2_8BPP[] */
+ pViaModeTable->tv2Table[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.CRTCNTSC2_16BPP[] */
+ pViaModeTable->tv2Table[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.CRTCNTSC2_32BPP[] */
+ pViaModeTable->tv2Table[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.PatchNTSC2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.PatchNTSC[] */
+ pViaModeTable->tv2Table[i].PatchNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].PatchNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.DotCrawlNTSC[] */
+ pViaModeTable->tv2Table[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].DotCrawlNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.TVPALC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.TVPALC[] */
+ pViaModeTable->tv2Table[i].TVPALC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].TVPALC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.TVPALS[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.TVPALS[] */
+ pViaModeTable->tv2Table[i].TVPALS[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].TVPALS[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.CRTCPAL1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.CRTCPAL1[] */
+ pViaModeTable->tv2Table[i].CRTCPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].CRTCPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.MiscPAL1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.MiscPAL1[] */
+ pViaModeTable->tv2Table[i].MiscPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].MiscPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.MiscPAL2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.MiscPAL2[] */
+ pViaModeTable->tv2Table[i].MiscPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].MiscPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.CRTCPAL2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.CRTCPAL2_8BPP[] */
+ pViaModeTable->tv2Table[i].CRTCPAL2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].CRTCPAL2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.CRTCPAL2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.CRTCPAL2_16BPP[] */
+ pViaModeTable->tv2Table[i].CRTCPAL2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].CRTCPAL2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.CRTCPAL2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2Table.CRTCPAL2_32BPP[] */
+ pViaModeTable->tv2Table[i].CRTCPAL2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].CRTCPAL2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.PatchPAL2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X }\n", /* tv2Table.PatchPAL2[] */
+ pViaModeTable->tv2Table[i].PatchPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2Table[i].PatchPAL2[j]);
+ }
+
+ if (i == (VIA_BIOS_NUM_TV2 - 1))
+ fprintf(pFile, " }\n};\n\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ /* tv2OverTable */
+ fprintf(pFile, "VIABIOSTV2TableRec tv2OverTable[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_TV2; i++) {
+ fprintf(pFile, " {\n");
+ fprintf(pFile, " { "); /* tv2OverTable.TVNTSCC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.TVNTSCC[] */
+ pViaModeTable->tv2OverTable[i].TVNTSCC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].TVNTSCC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.TVNTSCS[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.TVNTSCS[] */
+ pViaModeTable->tv2OverTable[i].TVNTSCS[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].TVNTSCS[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCNTSC1[] */
+ pViaModeTable->tv2OverTable[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.MiscNTSC1[] */
+ pViaModeTable->tv2OverTable[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.MiscNTSC2[] */
+ pViaModeTable->tv2OverTable[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCNTSC2_8BPP[] */
+ pViaModeTable->tv2OverTable[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCNTSC2_16BPP[] */
+ pViaModeTable->tv2OverTable[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCNTSC2_32BPP[] */
+ pViaModeTable->tv2OverTable[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.PatchNTSC2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.PatchNTSC[] */
+ pViaModeTable->tv2OverTable[i].PatchNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].PatchNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.DotCrawlNTSC[] */
+ pViaModeTable->tv2OverTable[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].DotCrawlNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.TVPALC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.TVPALC[] */
+ pViaModeTable->tv2OverTable[i].TVPALC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].TVPALC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.TVPALS[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.TVPALS[] */
+ pViaModeTable->tv2OverTable[i].TVPALS[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].TVPALS[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.CRTCPAL1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCPAL1[] */
+ pViaModeTable->tv2OverTable[i].CRTCPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].CRTCPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.MiscPAL1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.MiscPAL1[] */
+ pViaModeTable->tv2OverTable[i].MiscPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].MiscPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.MiscPAL2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.MiscPAL2[] */
+ pViaModeTable->tv2OverTable[i].MiscPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].MiscPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.CRTCPAL2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCPAL2_8BPP[] */
+ pViaModeTable->tv2OverTable[i].CRTCPAL2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].CRTCPAL2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.CRTCPAL2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCPAL2_16BPP[] */
+ pViaModeTable->tv2OverTable[i].CRTCPAL2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].CRTCPAL2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2OverTable.CRTCPAL2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv2OverTable.CRTCPAL2_32BPP[] */
+ pViaModeTable->tv2OverTable[i].CRTCPAL2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].CRTCPAL2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv2Table.PatchPAL2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X }\n", /* tv2Table.PatchPAL2[] */
+ pViaModeTable->tv2OverTable[i].PatchPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv2OverTable[i].PatchPAL2[j]);
+ }
+
+ if (i == (VIA_BIOS_NUM_TV2 - 1))
+ fprintf(pFile, " }\n};\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ fprintf(pFile, "\n");
+ fprintf(pFile, "#endif\n");
+
+ return TRUE;
+}
+#endif /* CREATE_TV2_HEADERFILE */
+#ifdef CREATE_TV3_HEADERFILE
+Bool VIACreateTV3(VIAModeTablePtr pViaModeTable)
+{
+ int i, j;
+ FILE *pFile;
+
+ if ((pFile = fopen("via_tv3.h", "w+")) == NULL) {
+ ErrorF("Can't open \"via_tv3.h\" file!!\n");
+ return FALSE;
+ }
+
+ fprintf(pFile, "#ifndef _VIA_TV3MODETABLE_H\n");
+ fprintf(pFile, "#define _VIA_TV3MODETABLE_H\n");
+ fprintf(pFile, "\n");
+
+ /* tv3MaskTable */
+ fprintf(pFile, "VIABIOSTVMASKTableRec tv3MaskTable = {\n");
+ fprintf(pFile, " { "); /* tv3MaskTable.TV[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3MaskTable.TV[] */
+ pViaModeTable->tv3MaskTable.TV[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3MaskTable.TV[i]);
+ }
+
+ fprintf(pFile, " { "); /* tv3MaskTable.CRTC1[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3MaskTable.CRTC1[] */
+ pViaModeTable->tv3MaskTable.CRTC1[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3MaskTable.CRTC1[i]);
+ }
+
+ fprintf(pFile, " { "); /* tv3MaskTable.CRTC2[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3MaskTable.CRTC2[] */
+ pViaModeTable->tv3MaskTable.CRTC2[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3MaskTable.CRTC2[i]);
+ }
+
+ fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n",
+ pViaModeTable->tv3MaskTable.misc1,
+ pViaModeTable->tv3MaskTable.misc2,
+ pViaModeTable->tv3MaskTable.numTV,
+ pViaModeTable->tv3MaskTable.numCRTC1,
+ pViaModeTable->tv3MaskTable.numCRTC2);
+
+ /* tv3Table */
+ fprintf(pFile, "VIABIOSTV3TableRec tv3Table[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_TV3; i++) {
+ fprintf(pFile, " {\n");
+ fprintf(pFile, " { "); /* tv3Table.TVNTSC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.TVNTSC[] */
+ pViaModeTable->tv3Table[i].TVNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].TVNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.CRTCNTSC1[] */
+ pViaModeTable->tv3Table[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.MiscNTSC1[] */
+ pViaModeTable->tv3Table[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.MiscNTSC2[] */
+ pViaModeTable->tv3Table[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.CRTCNTSC2_8BPP[] */
+ pViaModeTable->tv3Table[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.CRTCNTSC2_16BPP[] */
+ pViaModeTable->tv3Table[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.CRTCNTSC2_32BPP[] */
+ pViaModeTable->tv3Table[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.PatchNTSC2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.PatchNTSC2[] */
+ pViaModeTable->tv3Table[i].PatchNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].PatchNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.RGBNTSC[] */
+ pViaModeTable->tv3Table[i].RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.YCbCrNTSC[] */
+ pViaModeTable->tv3Table[i].YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].YCbCrNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.SDTV_RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.SDTV_RGBNTSC[] */
+ pViaModeTable->tv3Table[i].SDTV_RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].SDTV_RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.SDTV_YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.SDTV_YCbCrNTSC[] */
+ pViaModeTable->tv3Table[i].SDTV_YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].SDTV_YCbCrNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.DotCrawlNTSC[] */
+ pViaModeTable->tv3Table[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].DotCrawlNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.TVPAL[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.TVPAL[] */
+ pViaModeTable->tv3Table[i].TVPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].TVPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.CRTCPAL1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.CRTCPAL1[] */
+ pViaModeTable->tv3Table[i].CRTCPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].CRTCPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.MiscPAL1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.MiscPAL1[] */
+ pViaModeTable->tv3Table[i].MiscPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].MiscPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.MiscPAL2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.MiscPAL2[] */
+ pViaModeTable->tv3Table[i].MiscPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].MiscPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.CRTCPAL2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.CRTCPAL2_8BPP[] */
+ pViaModeTable->tv3Table[i].CRTCPAL2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].CRTCPAL2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.CRTCPAL2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.CRTCPAL2_16BPP[] */
+ pViaModeTable->tv3Table[i].CRTCPAL2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].CRTCPAL2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.CRTCPAL2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.CRTCPAL2_32BPP[] */
+ pViaModeTable->tv3Table[i].CRTCPAL2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].CRTCPAL2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.PatchPAL2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.PatchPAL2[] */
+ pViaModeTable->tv3Table[i].PatchPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].PatchPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.RGBPAL[] */
+ pViaModeTable->tv3Table[i].RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].RGBPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.YCbCrPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.YCbCrPAL[] */
+ pViaModeTable->tv3Table[i].YCbCrPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].YCbCrPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.SDTV_RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3Table.SDTV_RGBPAL[] */
+ pViaModeTable->tv3Table[i].SDTV_RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].SDTV_RGBPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Table.SDTV_YCbCrPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X }\n", /* tv3Table.SDTV_YCbCrPAL[] */
+ pViaModeTable->tv3Table[i].SDTV_YCbCrPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3Table[i].SDTV_YCbCrPAL[j]);
+ }
+
+ if (i == (VIA_BIOS_NUM_TV3 - 1))
+ fprintf(pFile, " }\n};\n\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ /* tv3OverTable */
+ fprintf(pFile, "VIABIOSTV3TableRec tv3OverTable[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_TV3; i++) {
+ fprintf(pFile, " {\n");
+ fprintf(pFile, " { "); /* tv3OverTable.TVNTSC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.TVNTSC[] */
+ pViaModeTable->tv3OverTable[i].TVNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].TVNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCNTSC1[] */
+ pViaModeTable->tv3OverTable[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.MiscNTSC1[] */
+ pViaModeTable->tv3OverTable[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.MiscNTSC2[] */
+ pViaModeTable->tv3OverTable[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCNTSC2_8BPP[] */
+ pViaModeTable->tv3OverTable[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCNTSC2_16BPP[] */
+ pViaModeTable->tv3OverTable[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCNTSC2_32BPP[] */
+ pViaModeTable->tv3OverTable[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.PatchNTSC2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.PatchNTSC2[] */
+ pViaModeTable->tv3OverTable[i].PatchNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].PatchNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.RGBNTSC[] */
+ pViaModeTable->tv3OverTable[i].RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.YCbCrNTSC[] */
+ pViaModeTable->tv3OverTable[i].YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].YCbCrNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.SDTV_RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.SDTV_RGBNTSC[] */
+ pViaModeTable->tv3OverTable[i].SDTV_RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].SDTV_RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.SDTV_YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.SDTV_YCbCrNTSC[] */
+ pViaModeTable->tv3OverTable[i].SDTV_YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].SDTV_YCbCrNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.DotCrawlNTSC[] */
+ pViaModeTable->tv3OverTable[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].DotCrawlNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.TVPAL[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.TVPAL[] */
+ pViaModeTable->tv3OverTable[i].TVPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].TVPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.CRTCPAL1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCPAL1[] */
+ pViaModeTable->tv3OverTable[i].CRTCPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].CRTCPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.MiscPAL1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.MiscPAL1[] */
+ pViaModeTable->tv3OverTable[i].MiscPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].MiscPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.MiscPAL2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.MiscPAL2[] */
+ pViaModeTable->tv3OverTable[i].MiscPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].MiscPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Over.CRTCPAL2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCPAL2_8BPP[] */
+ pViaModeTable->tv3OverTable[i].CRTCPAL2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].CRTCPAL2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.CRTCPAL2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCPAL2_16BPP[] */
+ pViaModeTable->tv3OverTable[i].CRTCPAL2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].CRTCPAL2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.CRTCPAL2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.CRTCPAL2_32BPP[] */
+ pViaModeTable->tv3OverTable[i].CRTCPAL2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].CRTCPAL2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.PatchPAL2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.PatchPAL2[] */
+ pViaModeTable->tv3OverTable[i].PatchPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].PatchPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.RGBPAL[] */
+ pViaModeTable->tv3OverTable[i].RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].RGBPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.YCbCrPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.YCbCrPAL[] */
+ pViaModeTable->tv3OverTable[i].YCbCrPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].YCbCrPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.SDTV_RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* tv3OverTable.SDTV_RGBPAL[] */
+ pViaModeTable->tv3OverTable[i].SDTV_RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].SDTV_RGBPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3OverTable.SDTV_YCbCrPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X }\n", /* tv3OverTable.SDTV_YCbCrPAL[] */
+ pViaModeTable->tv3OverTable[i].SDTV_YCbCrPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->tv3OverTable[i].SDTV_YCbCrPAL[j]);
+ }
+
+ if (i == (VIA_BIOS_NUM_TV3 - 1))
+ fprintf(pFile, " }\n};\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ fprintf(pFile, "\n");
+ fprintf(pFile, "#endif\n");
+
+ return TRUE;
+}
+#endif /* CREATE_TV3_HEADERFILE */
+
+#ifdef CREATE_VT1622A_HEADERFILE
+Bool VIACreateVT1622A(VIAModeTablePtr pViaModeTable)
+{
+ int i, j;
+ FILE *pFile;
+
+ if ((pFile = fopen("via_vt1622a.h", "w+")) == NULL) {
+ ErrorF("Can't open \"via_vt1622a.h\" file!!\n");
+ return FALSE;
+ }
+
+ fprintf(pFile, "#ifndef _VIA_VT1622AMODETABLE_H\n");
+ fprintf(pFile, "#define _VIA_VT1622AMODETABLE_H\n");
+ fprintf(pFile, "\n");
+
+ /* tv3MaskTable */
+ fprintf(pFile, "VIABIOSTVMASKTableRec vt1622aMaskTable = {\n");
+ fprintf(pFile, " { "); /* vt1622aMaskTable.TV[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aMaskTable.TV[] */
+ pViaModeTable->vt1622aMaskTable.TV[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aMaskTable.TV[i]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aMaskTable.CRTC1[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aMaskTable.CRTC1[] */
+ pViaModeTable->vt1622aMaskTable.CRTC1[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aMaskTable.CRTC1[i]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aMaskTable.CRTC2[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aMaskTable.CRTC2[] */
+ pViaModeTable->vt1622aMaskTable.CRTC2[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aMaskTable.CRTC2[i]);
+ }
+
+ fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n",
+ pViaModeTable->vt1622aMaskTable.misc1,
+ pViaModeTable->vt1622aMaskTable.misc2,
+ pViaModeTable->vt1622aMaskTable.numTV,
+ pViaModeTable->vt1622aMaskTable.numCRTC1,
+ pViaModeTable->vt1622aMaskTable.numCRTC2);
+
+ /* tv3Table */
+ fprintf(pFile, "VIABIOSTV3TableRec vt1622aTable[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_TV3; i++) {
+ fprintf(pFile, " {\n");
+ fprintf(pFile, " { "); /* vt1622aTable.TVNTSC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.TVNTSC[] */
+ pViaModeTable->vt1622aTable[i].TVNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].TVNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCNTSC1[] */
+ pViaModeTable->vt1622aTable[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.MiscNTSC1[] */
+ pViaModeTable->vt1622aTable[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.MiscNTSC2[] */
+ pViaModeTable->vt1622aTable[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCNTSC2_8BPP[] */
+ pViaModeTable->vt1622aTable[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCNTSC2_16BPP[] */
+ pViaModeTable->vt1622aTable[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCNTSC2_32BPP[] */
+ pViaModeTable->vt1622aTable[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.PatchNTSC2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.PatchNTSC2[] */
+ pViaModeTable->vt1622aTable[i].PatchNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].PatchNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.RGBNTSC[] */
+ pViaModeTable->vt1622aTable[i].RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.YCbCrNTSC[] */
+ pViaModeTable->vt1622aTable[i].YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].YCbCrNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.SDTV_RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.SDTV_RGBNTSC[] */
+ pViaModeTable->vt1622aTable[i].SDTV_RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].SDTV_RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.SDTV_YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.SDTV_YCbCrNTSC[] */
+ pViaModeTable->vt1622aTable[i].SDTV_YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].SDTV_YCbCrNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.DotCrawlNTSC[] */
+ pViaModeTable->vt1622aTable[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].DotCrawlNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.TVPAL[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.TVPAL[] */
+ pViaModeTable->vt1622aTable[i].TVPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].TVPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.CRTCPAL1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCPAL1[] */
+ pViaModeTable->vt1622aTable[i].CRTCPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].CRTCPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.MiscPAL1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.MiscPAL1[] */
+ pViaModeTable->vt1622aTable[i].MiscPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].MiscPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.MiscPAL2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.MiscPAL2[] */
+ pViaModeTable->vt1622aTable[i].MiscPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].MiscPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.CRTCPAL2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCPAL2_8BPP[] */
+ pViaModeTable->vt1622aTable[i].CRTCPAL2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].CRTCPAL2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.CRTCPAL2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCPAL2_16BPP[] */
+ pViaModeTable->vt1622aTable[i].CRTCPAL2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].CRTCPAL2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.CRTCPAL2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.CRTCPAL2_32BPP[] */
+ pViaModeTable->vt1622aTable[i].CRTCPAL2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].CRTCPAL2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.PatchPAL2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.PatchPAL2[] */
+ pViaModeTable->vt1622aTable[i].PatchPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].PatchPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.RGBPAL[] */
+ pViaModeTable->vt1622aTable[i].RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].RGBPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.YCbCrPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.YCbCrPAL[] */
+ pViaModeTable->vt1622aTable[i].YCbCrPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].YCbCrPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.SDTV_RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aTable.SDTV_RGBPAL[] */
+ pViaModeTable->vt1622aTable[i].SDTV_RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].SDTV_RGBPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aTable.SDTV_YCbCrPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X }\n", /* vt1622aTable.SDTV_YCbCrPAL[] */
+ pViaModeTable->vt1622aTable[i].SDTV_YCbCrPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aTable[i].SDTV_YCbCrPAL[j]);
+ }
+
+ if (i == (VIA_BIOS_NUM_TV3 - 1))
+ fprintf(pFile, " }\n};\n\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ /* tv3OverTable */
+ fprintf(pFile, "VIABIOSTV3TableRec vt1622aOverTable[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_TV3; i++) {
+ fprintf(pFile, " {\n");
+ fprintf(pFile, " { "); /* vt1622aOverTable.TVNTSC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.TVNTSC[] */
+ pViaModeTable->vt1622aOverTable[i].TVNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].TVNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCNTSC1[] */
+ pViaModeTable->vt1622aOverTable[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.MiscNTSC1[] */
+ pViaModeTable->vt1622aOverTable[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.MiscNTSC2[] */
+ pViaModeTable->vt1622aOverTable[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCNTSC2_8BPP[] */
+ pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCNTSC2_16BPP[] */
+ pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCNTSC2_32BPP[] */
+ pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.PatchNTSC2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.PatchNTSC2[] */
+ pViaModeTable->vt1622aOverTable[i].PatchNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].PatchNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.RGBNTSC[] */
+ pViaModeTable->vt1622aOverTable[i].RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.YCbCrNTSC[] */
+ pViaModeTable->vt1622aOverTable[i].YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].YCbCrNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.SDTV_RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.SDTV_RGBNTSC[] */
+ pViaModeTable->vt1622aOverTable[i].SDTV_RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].SDTV_RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.SDTV_YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.SDTV_YCbCrNTSC[] */
+ pViaModeTable->vt1622aOverTable[i].SDTV_YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].SDTV_YCbCrNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.DotCrawlNTSC[] */
+ pViaModeTable->vt1622aOverTable[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].DotCrawlNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.TVPAL[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.TVPAL[] */
+ pViaModeTable->vt1622aOverTable[i].TVPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].TVPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.CRTCPAL1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCPAL1[] */
+ pViaModeTable->vt1622aOverTable[i].CRTCPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].CRTCPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.MiscPAL1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.MiscPAL1[] */
+ pViaModeTable->vt1622aOverTable[i].MiscPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].MiscPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.MiscPAL2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.MiscPAL2[] */
+ pViaModeTable->vt1622aOverTable[i].MiscPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].MiscPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOver.CRTCPAL2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCPAL2_8BPP[] */
+ pViaModeTable->vt1622aOverTable[i].CRTCPAL2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].CRTCPAL2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.CRTCPAL2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCPAL2_16BPP[] */
+ pViaModeTable->vt1622aOverTable[i].CRTCPAL2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].CRTCPAL2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.CRTCPAL2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.CRTCPAL2_32BPP[] */
+ pViaModeTable->vt1622aOverTable[i].CRTCPAL2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].CRTCPAL2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.PatchPAL2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.PatchPAL2[] */
+ pViaModeTable->vt1622aOverTable[i].PatchPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].PatchPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.RGBPAL[] */
+ pViaModeTable->vt1622aOverTable[i].RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].RGBPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.YCbCrPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.YCbCrPAL[] */
+ pViaModeTable->vt1622aOverTable[i].YCbCrPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].YCbCrPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.SDTV_RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* vt1622aOverTable.SDTV_RGBPAL[] */
+ pViaModeTable->vt1622aOverTable[i].SDTV_RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].SDTV_RGBPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* vt1622aOverTable.SDTV_YCbCrPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X }\n", /* vt1622aOverTable.SDTV_YCbCrPAL[] */
+ pViaModeTable->vt1622aOverTable[i].SDTV_YCbCrPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->vt1622aOverTable[i].SDTV_YCbCrPAL[j]);
+ }
+
+ if (i == (VIA_BIOS_NUM_TV3 - 1))
+ fprintf(pFile, " }\n};\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ fprintf(pFile, "\n");
+ fprintf(pFile, "#endif\n");
+
+ return TRUE;
+}
+#endif /* CREATE_VT1622A_HEADERFILE */
+
+#ifdef CREATE_SAA7108_HEADERFILE
+Bool VIACreateSAA7108(VIAModeTablePtr pViaModeTable)
+{
+ int i, j;
+ FILE *pFile;
+
+ if ((pFile = fopen("via_saa7108.h", "w+")) == NULL) {
+ ErrorF("Can't open \"via_saa7108.h\" file!!\n");
+ return FALSE;
+ }
+
+ fprintf(pFile, "#ifndef _VIA_SAA7108MODETABLE_H\n");
+ fprintf(pFile, "#define _VIA_SAA7108MODETABLE_H\n");
+ fprintf(pFile, "\n");
+
+ /* saa7108MaskTable */
+ fprintf(pFile, "VIABIOSSAA7108TVMASKTableRec saa7108MaskTable = {\n");
+ fprintf(pFile, " { "); /* saa7108MaskTable.TV[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_SAA7108_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108MaskTable.TV[] */
+ pViaModeTable->saa7108MaskTable.TV[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108MaskTable.TV[i]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108MaskTable.CRTC1[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108MaskTable.CRTC1[] */
+ pViaModeTable->saa7108MaskTable.CRTC1[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108MaskTable.CRTC1[i]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108MaskTable.CRTC2[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108MaskTable.CRTC2[] */
+ pViaModeTable->saa7108MaskTable.CRTC2[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108MaskTable.CRTC2[i]);
+ }
+
+ fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n",
+ pViaModeTable->saa7108MaskTable.misc1,
+ pViaModeTable->saa7108MaskTable.misc2,
+ pViaModeTable->saa7108MaskTable.numTV,
+ pViaModeTable->saa7108MaskTable.numCRTC1,
+ pViaModeTable->saa7108MaskTable.numCRTC2);
+
+ /* saa7108Table */
+ fprintf(pFile, "VIABIOSSAA7108TableRec saa7108Table[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_SAA7108; i++) {
+ fprintf(pFile, " {\n");
+ fprintf(pFile, " { "); /* saa7108Table.TVNTSC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_SAA7108_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.TVNTSC[] */
+ pViaModeTable->saa7108Table[i].TVNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].TVNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCNTSC1[] */
+ pViaModeTable->saa7108Table[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.MiscNTSC1[] */
+ pViaModeTable->saa7108Table[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.MiscNTSC2[] */
+ pViaModeTable->saa7108Table[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCNTSC2_8BPP[] */
+ pViaModeTable->saa7108Table[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCNTSC2_16BPP[] */
+ pViaModeTable->saa7108Table[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCNTSC2_32BPP[] */
+ pViaModeTable->saa7108Table[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.PatchNTSC2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.PatchNTSC2[] */
+ pViaModeTable->saa7108Table[i].PatchNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].PatchNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.RGBNTSC[] */
+ pViaModeTable->saa7108Table[i].RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.YCbCrNTSC[] */
+ pViaModeTable->saa7108Table[i].YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].YCbCrNTSC[j]);
+ }
+#if 0
+ fprintf(pFile, " { "); /* saa7108Table.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.DotCrawlNTSC[] */
+ pViaModeTable->saa7108Table[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].DotCrawlNTSC[j]);
+ }
+#endif
+ fprintf(pFile, " { "); /* saa7108Table.TVPAL[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_SAA7108_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.TVPAL[] */
+ pViaModeTable->saa7108Table[i].TVPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].TVPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.CRTCPAL1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCPAL1[] */
+ pViaModeTable->saa7108Table[i].CRTCPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].CRTCPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.MiscPAL1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.MiscPAL1[] */
+ pViaModeTable->saa7108Table[i].MiscPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].MiscPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.MiscPAL2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.MiscPAL2[] */
+ pViaModeTable->saa7108Table[i].MiscPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].MiscPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.CRTCPAL2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCPAL2_8BPP[] */
+ pViaModeTable->saa7108Table[i].CRTCPAL2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].CRTCPAL2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.CRTCPAL2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCPAL2_16BPP[] */
+ pViaModeTable->saa7108Table[i].CRTCPAL2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].CRTCPAL2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.CRTCPAL2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.CRTCPAL2_32BPP[] */
+ pViaModeTable->saa7108Table[i].CRTCPAL2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].CRTCPAL2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.PatchPAL2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.PatchPAL2[] */
+ pViaModeTable->saa7108Table[i].PatchPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].PatchPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.RGBPAL[] */
+ pViaModeTable->saa7108Table[i].RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].RGBPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108Table.YCbCrPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108Table.YCbCrPAL[] */
+ pViaModeTable->saa7108Table[i].YCbCrPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108Table[i].YCbCrPAL[j]);
+ }
+
+ if (i == (VIA_BIOS_NUM_SAA7108 - 1))
+ fprintf(pFile, " }\n};\n\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ /* saa7108OverTable */
+ fprintf(pFile, "VIABIOSSAA7108TableRec saa7108OverTable[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_SAA7108; i++) {
+ fprintf(pFile, " {\n");
+ fprintf(pFile, " { "); /* saa7108OverTable.TVNTSC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_SAA7108_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.TVNTSC[] */
+ pViaModeTable->saa7108OverTable[i].TVNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].TVNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCNTSC1[] */
+ pViaModeTable->saa7108OverTable[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.MiscNTSC1[] */
+ pViaModeTable->saa7108OverTable[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.MiscNTSC2[] */
+ pViaModeTable->saa7108OverTable[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCNTSC2_8BPP[] */
+ pViaModeTable->saa7108OverTable[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCNTSC2_16BPP[] */
+ pViaModeTable->saa7108OverTable[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCNTSC2_32BPP[] */
+ pViaModeTable->saa7108OverTable[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.PatchNTSC2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.PatchNTSC2[] */
+ pViaModeTable->saa7108OverTable[i].PatchNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].PatchNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.RGBNTSC[] */
+ pViaModeTable->saa7108OverTable[i].RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].RGBNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.YCbCrNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.YCbCrNTSC[] */
+ pViaModeTable->saa7108OverTable[i].YCbCrNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].YCbCrNTSC[j]);
+ }
+#if 0
+ fprintf(pFile, " { "); /* saa7108OverTable.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.DotCrawlNTSC[] */
+ pViaModeTable->saa7108OverTable[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].DotCrawlNTSC[j]);
+ }
+#endif
+ fprintf(pFile, " { "); /* saa7108OverTable.TVPAL[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_SAA7108_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.TVPAL[] */
+ pViaModeTable->saa7108OverTable[i].TVPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].TVPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.CRTCPAL1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCPAL1[] */
+ pViaModeTable->saa7108OverTable[i].CRTCPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].CRTCPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.MiscPAL1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.MiscPAL1[] */
+ pViaModeTable->saa7108OverTable[i].MiscPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].MiscPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.MiscPAL2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.MiscPAL2[] */
+ pViaModeTable->saa7108OverTable[i].MiscPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].MiscPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Over.CRTCPAL2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCPAL2_8BPP[] */
+ pViaModeTable->saa7108OverTable[i].CRTCPAL2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].CRTCPAL2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.CRTCPAL2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCPAL2_16BPP[] */
+ pViaModeTable->saa7108OverTable[i].CRTCPAL2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].CRTCPAL2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.CRTCPAL2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.CRTCPAL2_32BPP[] */
+ pViaModeTable->saa7108OverTable[i].CRTCPAL2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].CRTCPAL2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.PatchPAL2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.PatchPAL2[] */
+ pViaModeTable->saa7108OverTable[i].PatchPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].PatchPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.RGBPAL[] */
+ pViaModeTable->saa7108OverTable[i].RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].RGBPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* saa7108OverTable.YCbCrPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* saa7108OverTable.YCbCrPAL[] */
+ pViaModeTable->saa7108OverTable[i].YCbCrPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->saa7108OverTable[i].YCbCrPAL[j]);
+ }
+
+ if (i == (VIA_BIOS_NUM_SAA7108 - 1))
+ fprintf(pFile, " }\n};\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ fprintf(pFile, "\n");
+ fprintf(pFile, "#endif\n");
+
+ return TRUE;
+}
+#endif /* CREATE_SAA7108_HEADERFILE */
+
+#ifdef CREATE_CH7019_HEADERFILE
+Bool VIACreateCH7019(VIAModeTablePtr pViaModeTable)
+{
+ int i, j;
+ FILE *pFile;
+
+ if ((pFile = fopen("via_ch7019.h", "w+")) == NULL) {
+ ErrorF("Can't open \"via_ch7019.h\" file!!\n");
+ return FALSE;
+ }
+
+ fprintf(pFile, "#ifndef _VIA_CH7019MODETABLE_H\n");
+ fprintf(pFile, "#define _VIA_CH7019MODETABLE_H\n");
+ fprintf(pFile, "\n");
+
+ /* ch7019MaskTable */
+ fprintf(pFile, "VIABIOSTVMASKTableRec ch7019MaskTable = {\n");
+ fprintf(pFile, " { "); /* ch7019MaskTable.TV[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019MaskTable.TV[] */
+ pViaModeTable->ch7019MaskTable.TV[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019MaskTable.TV[i]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019MaskTable.CRTC1[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019MaskTable.CRTC1[] */
+ pViaModeTable->ch7019MaskTable.CRTC1[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019MaskTable.CRTC1[i]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019MaskTable.CRTC2[] */
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_CRTC; i++) {
+ if (i == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019MaskTable.CRTC2[] */
+ pViaModeTable->ch7019MaskTable.CRTC2[i]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019MaskTable.CRTC2[i]);
+ }
+
+ fprintf(pFile, " %#X, %#X, %d, %d, %d \n};\n\n",
+ pViaModeTable->ch7019MaskTable.misc1,
+ pViaModeTable->ch7019MaskTable.misc2,
+ pViaModeTable->ch7019MaskTable.numTV,
+ pViaModeTable->ch7019MaskTable.numCRTC1,
+ pViaModeTable->ch7019MaskTable.numCRTC2);
+
+ /* ch7019Table */
+ fprintf(pFile, "VIABIOSCH7019TableRec ch7019Table[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_CH7019; i++) {
+ fprintf(pFile, " {\n");
+ fprintf(pFile, " { "); /* ch7019Table.TVNTSC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.TVNTSC[] */
+ pViaModeTable->ch7019Table[i].TVNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].TVNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCNTSC1[] */
+ pViaModeTable->ch7019Table[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.MiscNTSC1[] */
+ pViaModeTable->ch7019Table[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.MiscNTSC2[] */
+ pViaModeTable->ch7019Table[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCNTSC2_8BPP[] */
+ pViaModeTable->ch7019Table[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCNTSC2_16BPP[] */
+ pViaModeTable->ch7019Table[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCNTSC2_32BPP[] */
+ pViaModeTable->ch7019Table[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.PatchNTSC2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.PatchNTSC2[] */
+ pViaModeTable->ch7019Table[i].PatchNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].PatchNTSC2[j]);
+ }
+#if 0
+ fprintf(pFile, " { "); /* ch7019Table.RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.RGBNTSC[] */
+ pViaModeTable->ch7019Table[i].RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].RGBNTSC[j]);
+ }
+#endif
+ fprintf(pFile, " { "); /* ch7019Table.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.DotCrawlNTSC[] */
+ pViaModeTable->ch7019Table[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].DotCrawlNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.TVPAL[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.TVPAL[] */
+ pViaModeTable->ch7019Table[i].TVPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].TVPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.CRTCPAL1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCPAL1[] */
+ pViaModeTable->ch7019Table[i].CRTCPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].CRTCPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.MiscPAL1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.MiscPAL1[] */
+ pViaModeTable->ch7019Table[i].MiscPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].MiscPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.MiscPAL2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.MiscPAL2[] */
+ pViaModeTable->ch7019Table[i].MiscPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].MiscPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.CRTCPAL2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCPAL2_8BPP[] */
+ pViaModeTable->ch7019Table[i].CRTCPAL2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].CRTCPAL2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.CRTCPAL2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCPAL2_16BPP[] */
+ pViaModeTable->ch7019Table[i].CRTCPAL2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].CRTCPAL2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.CRTCPAL2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.CRTCPAL2_32BPP[] */
+ pViaModeTable->ch7019Table[i].CRTCPAL2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].CRTCPAL2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019Table.PatchPAL2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.PatchPAL2[] */
+ pViaModeTable->ch7019Table[i].PatchPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].PatchPAL2[j]);
+ }
+#if 0
+ fprintf(pFile, " { "); /* ch7019Table.RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019Table.RGBPAL[] */
+ pViaModeTable->ch7019Table[i].RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019Table[i].RGBPAL[j]);
+ }
+#endif
+ if (i == (VIA_BIOS_NUM_CH7019 - 1))
+ fprintf(pFile, " }\n};\n\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ /* ch7019OverTable */
+ fprintf(pFile, "VIABIOSCH7019TableRec ch7019OverTable[] = {\n");
+ for (i = 0; i < VIA_BIOS_NUM_CH7019; i++) {
+ fprintf(pFile, " {\n");
+ fprintf(pFile, " { "); /* ch7019OverTable.TVNTSC[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.TVNTSC[] */
+ pViaModeTable->ch7019OverTable[i].TVNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].TVNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.CRTCNTSC1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCNTSC1[] */
+ pViaModeTable->ch7019OverTable[i].CRTCNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].CRTCNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.MiscNTSC1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.MiscNTSC1[] */
+ pViaModeTable->ch7019OverTable[i].MiscNTSC1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].MiscNTSC1[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.MiscNTSC2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.MiscNTSC2[] */
+ pViaModeTable->ch7019OverTable[i].MiscNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].MiscNTSC2[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.CRTCNTSC2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCNTSC2_8BPP[] */
+ pViaModeTable->ch7019OverTable[i].CRTCNTSC2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].CRTCNTSC2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.CRTCNTSC2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCNTSC2_16BPP[] */
+ pViaModeTable->ch7019OverTable[i].CRTCNTSC2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].CRTCNTSC2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.CRTCNTSC2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCNTSC2_32BPP[] */
+ pViaModeTable->ch7019OverTable[i].CRTCNTSC2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].CRTCNTSC2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.PatchNTSC2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.PatchNTSC2[] */
+ pViaModeTable->ch7019OverTable[i].PatchNTSC2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].PatchNTSC2[j]);
+ }
+#if 0
+ fprintf(pFile, " { "); /* ch7019OverTable.RGBNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.RGBNTSC[] */
+ pViaModeTable->ch7019OverTable[i].RGBNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].RGBNTSC[j]);
+ }
+#endif
+ fprintf(pFile, " { "); /* ch7019OverTable.DotCrawlNTSC[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.DotCrawlNTSC[] */
+ pViaModeTable->ch7019OverTable[i].DotCrawlNTSC[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].DotCrawlNTSC[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.TVPAL[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_REG; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.TVPAL[] */
+ pViaModeTable->ch7019OverTable[i].TVPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].TVPAL[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.CRTCPAL1[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCPAL1[] */
+ pViaModeTable->ch7019OverTable[i].CRTCPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].CRTCPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.MiscPAL1[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.MiscPAL1[] */
+ pViaModeTable->ch7019OverTable[i].MiscPAL1[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].MiscPAL1[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.MiscPAL2[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_SPECIAL_REG; j++) {
+ if (j == (VIA_BIOS_NUM_TV_SPECIAL_REG - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.MiscPAL2[] */
+ pViaModeTable->ch7019OverTable[i].MiscPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].MiscPAL2[j]);
+ }
+
+ fprintf(pFile, " { "); /* tv3Over.CRTCPAL2_8BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCPAL2_8BPP[] */
+ pViaModeTable->ch7019OverTable[i].CRTCPAL2_8BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].CRTCPAL2_8BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.CRTCPAL2_16BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCPAL2_16BPP[] */
+ pViaModeTable->ch7019OverTable[i].CRTCPAL2_16BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].CRTCPAL2_16BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.CRTCPAL2_32BPP[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_CRTC; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_CRTC - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.CRTCPAL2_32BPP[] */
+ pViaModeTable->ch7019OverTable[i].CRTCPAL2_32BPP[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].CRTCPAL2_32BPP[j]);
+ }
+
+ fprintf(pFile, " { "); /* ch7019OverTable.PatchPAL2[] */
+ for (j = 0; j < VIA_BIOS_MAX_NUM_TV_PATCH; j++) {
+ if (j == (VIA_BIOS_MAX_NUM_TV_PATCH - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.PatchPAL2[] */
+ pViaModeTable->ch7019OverTable[i].PatchPAL2[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].PatchPAL2[j]);
+ }
+#if 0
+ fprintf(pFile, " { "); /* ch7019OverTable.RGBPAL[] */
+ for (j = 0; j < VIA_BIOS_NUM_TV_OTHER; j++) {
+ if (j == (VIA_BIOS_NUM_TV_OTHER - 1))
+ fprintf(pFile, "%#X },\n", /* ch7019OverTable.RGBPAL[] */
+ pViaModeTable->ch7019OverTable[i].RGBPAL[j]);
+ else
+ fprintf(pFile, "%#X, ",
+ pViaModeTable->ch7019OverTable[i].RGBPAL[j]);
+ }
+#endif
+ if (i == (VIA_BIOS_NUM_CH7019 - 1))
+ fprintf(pFile, " }\n};\n");
+ else
+ fprintf(pFile, " }, \n");
+ }
+
+ fprintf(pFile, "\n");
+ fprintf(pFile, "#endif\n");
+
+ return TRUE;
+}
+#endif /* CREATE_CH7019_HEADERFILE */
+
+void VIAGetCH7019Mask(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ unsigned char *pRom;
+ int i, j, k, m;
+ CARD16 tmp;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetCH7019Mask\n"));
+ /* Get start of TV Mask Table */
+ pRom = pTable + VIA_BIOS_TVMASKTAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVMaskTbl: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0, k = 0; i < 9; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->ch7019MaskTable.TV[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->ch7019MaskTable.TV[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->ch7019MaskTable.numTV = k;
+
+ for (i = 0, j = 0, k = 0; i < 2; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->ch7019MaskTable.CRTC1[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->ch7019MaskTable.CRTC1[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->ch7019MaskTable.numCRTC1 = k;
+
+ pViaModeTable->ch7019MaskTable.misc1 = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < 2; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->ch7019MaskTable.CRTC2[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->ch7019MaskTable.CRTC2[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->ch7019MaskTable.numCRTC2 = k;
+
+ pViaModeTable->ch7019MaskTable.misc2 = *pRom++;
+
+}
+
+void VIAGetCH7019NTSC(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ VIABIOSCH7019TablePtr pCH7019Tab;
+ unsigned char *pRom, *pNTSC;
+ unsigned char *pTVTable;
+ unsigned char numCRTC;
+ unsigned char numPatch, numReg;
+ int vScan, offset;
+ int i, j, k, n;
+
+ pCH7019Tab = NULL;
+ pTVTable = NULL;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetCH7019NTSC\n"));
+ for (vScan = 0; vScan < 2; vScan++) {
+ switch (vScan) {
+ case VIA_TVNORMAL:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_TVMODETAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVModeTbl: %X\n", *((CARD16 *)pRom)));
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pCH7019Tab = pViaModeTable->ch7019Table;
+ /* HSoffset = 2; */
+ break;
+ case VIA_TVOVER:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_MODEOVERTAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVModeOverTbl: %X\n", *((CARD16 *)pRom)));
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pCH7019Tab = pViaModeTable->ch7019OverTable;
+ /* HSoffset = 38; */
+ break;
+ }
+
+ /* offset: skip MODE3, MODE13 */
+ for (offset = 11, n = 0; n < VIA_BIOS_NUM_CH7019; offset += 5, n++) {
+
+ /* Get pointer table of each mode */
+ pRom = pTVTable + offset;
+
+ if ((*((CARD16 *)pRom)) != 0) {
+ pNTSC = pBIOS + *((CARD16 *)pRom);
+
+ /* Get start of TV Table */
+ pRom = pNTSC + 1;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0; i < pViaModeTable->ch7019MaskTable.numTV; j++) {
+ if (pViaModeTable->ch7019MaskTable.TV[j] == 0xFF) {
+ pCH7019Tab[n].TVNTSC[j] = *pRom++;
+ i++;
+ }
+ }
+
+ numCRTC = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < numCRTC; j++) {
+ if (pViaModeTable->ch7019MaskTable.CRTC1[j] == 0xFF) {
+ if (i >= pViaModeTable->ch7019MaskTable.numCRTC1) {
+ pCH7019Tab[n].MiscNTSC1[k++] = *pRom++;
+ i++;
+ }
+ else {
+ pCH7019Tab[n].CRTCNTSC1[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+
+ for (i = 0, j = 0, k = 0; i < pViaModeTable->ch7019MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->ch7019MaskTable.CRTC2[j] == 0xFF) {
+ /* CRTC 65-57 8bpp, 16bpp, 32bpp */
+ if (j == 0x15) {
+ pCH7019Tab[n].CRTCNTSC2_8BPP[j] = *pRom++;
+ pCH7019Tab[n].CRTCNTSC2_8BPP[j+1] = *pRom++;
+ pCH7019Tab[n].CRTCNTSC2_8BPP[j+2] = *pRom++;
+ pCH7019Tab[n].CRTCNTSC2_16BPP[j] = *pRom++;
+ pCH7019Tab[n].CRTCNTSC2_16BPP[j+1] = *pRom++;
+ pCH7019Tab[n].CRTCNTSC2_16BPP[j+2] = *pRom++;
+ pCH7019Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++;
+ pCH7019Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++;
+ pCH7019Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i += 3;
+ }
+ else {
+ /* For CRTC 6A-6C */
+ if (i >= (pViaModeTable->ch7019MaskTable.numCRTC2 - 3)) {
+ pCH7019Tab[n].CRTCNTSC2_8BPP[j] = *pRom;
+ pCH7019Tab[n].CRTCNTSC2_16BPP[j] = *pRom;
+ pCH7019Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i++;
+ }
+ else {
+ pCH7019Tab[n].CRTCNTSC2_8BPP[j] = *pRom;
+ pCH7019Tab[n].CRTCNTSC2_16BPP[j] = *pRom;
+ pCH7019Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+ }
+
+ k = 3;
+ /* LCK 3c5.44-45 */
+ if (pViaModeTable->ch7019MaskTable.misc2 & 0x18) {
+ pCH7019Tab[n].MiscNTSC2[k++] = *pRom++;
+ pCH7019Tab[n].MiscNTSC2[k++] = *pRom++;
+ }
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->ch7019MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ pCH7019Tab[n].PatchNTSC2[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get DotCrawl Table */
+ pRom = pNTSC + 4;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pCH7019Tab[n].DotCrawlNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pCH7019Tab[n].DotCrawlNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+ }
+ }
+ }
+}
+
+void VIAGetCH7019PAL(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ VIABIOSCH7019TablePtr pCH7019Tab;
+ unsigned char *pRom, *pPAL;
+ unsigned char *pTVTable;
+ unsigned char numCRTC;
+ unsigned char numPatch;
+ int vScan, offset;
+ int i, j, k, n;
+
+ pCH7019Tab = NULL;
+ pTVTable = NULL;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetSAA7108PAL\n"));
+ for (vScan = 0; vScan < 2; vScan++) {
+ switch (vScan) {
+ case VIA_TVNORMAL:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_TVMODETAB_POS;
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pCH7019Tab = pViaModeTable->ch7019Table;
+ /* HSoffset = 4; */
+ break;
+ case VIA_TVOVER:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_MODEOVERTAB_POS;
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pCH7019Tab = pViaModeTable->ch7019OverTable;
+ /* HSoffset = 40; */
+ break;
+ }
+
+ /* offset: skip MODE3, MODE13 */
+ for (offset = 13, n = 0; n < VIA_BIOS_NUM_CH7019; offset += 5, n++) {
+
+ /* Get pointer table of each mode */
+ pRom = pTVTable + offset;
+
+ if (*((CARD16 *)pRom) != 0) {
+ pPAL = pBIOS + *((CARD16 *)pRom);
+
+ /* Get start of TV Table */
+ pRom = pPAL + 1;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0; i < pViaModeTable->ch7019MaskTable.numTV; j++) {
+ if (pViaModeTable->ch7019MaskTable.TV[j] == 0xFF) {
+ pCH7019Tab[n].TVPAL[j] = *pRom++;
+ i++;
+ }
+ }
+
+ numCRTC = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < numCRTC; j++) {
+ if (pViaModeTable->ch7019MaskTable.CRTC1[j] == 0xFF) {
+ if (i >= pViaModeTable->ch7019MaskTable.numCRTC1) {
+ pCH7019Tab[n].MiscPAL1[k++] = *pRom++;
+ i++;
+ }
+ else {
+ pCH7019Tab[n].CRTCPAL1[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+
+ for (i = 0, j = 0, k = 0; i < pViaModeTable->ch7019MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->ch7019MaskTable.CRTC2[j] == 0xFF) {
+ if (j == 0x15) {
+ pCH7019Tab[n].CRTCPAL2_8BPP[j] = *pRom++;
+ pCH7019Tab[n].CRTCPAL2_8BPP[j+1] = *pRom++;
+ pCH7019Tab[n].CRTCPAL2_8BPP[j+2] = *pRom++;
+ pCH7019Tab[n].CRTCPAL2_16BPP[j] = *pRom++;
+ pCH7019Tab[n].CRTCPAL2_16BPP[j+1] = *pRom++;
+ pCH7019Tab[n].CRTCPAL2_16BPP[j+2] = *pRom++;
+ pCH7019Tab[n].CRTCPAL2_32BPP[j++] = *pRom++;
+ pCH7019Tab[n].CRTCPAL2_32BPP[j++] = *pRom++;
+ pCH7019Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i += 3;
+ }
+ else {
+ /* For CRTC 6A-6C */
+ if (i >= (pViaModeTable->ch7019MaskTable.numCRTC2 - 3)) {
+ pCH7019Tab[n].CRTCPAL2_8BPP[j] = *pRom;
+ pCH7019Tab[n].CRTCPAL2_16BPP[j] = *pRom;
+ pCH7019Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i++;
+ }
+ else {
+ pCH7019Tab[n].CRTCPAL2_8BPP[j] = *pRom;
+ pCH7019Tab[n].CRTCPAL2_16BPP[j] = *pRom;
+ pCH7019Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+ }
+
+ k = 3;
+ /* LCK 3c5.44-45 */
+ if (pViaModeTable->ch7019MaskTable.misc2 & 0x18) {
+ pCH7019Tab[n].MiscPAL2[k++] = *pRom++;
+ pCH7019Tab[n].MiscPAL2[k++] = *pRom++;
+ }
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->ch7019MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ pCH7019Tab[n].PatchPAL2[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+ }
+ }
+ }
+}
+
+void VIAGetSAA7108Mask(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ unsigned char *pRom;
+ int i, j, k, m;
+ CARD16 tmp;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetSAA7108Mask\n"));
+ /* Get start of TV Mask Table */
+ pRom = pTable + VIA_BIOS_TVMASKTAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVMaskTbl: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0, k = 0; i < 11; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->saa7108MaskTable.TV[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->saa7108MaskTable.TV[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->saa7108MaskTable.numTV = k;
+
+ for (i = 0, j = 0, k = 0; i < 2; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->saa7108MaskTable.CRTC1[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->saa7108MaskTable.CRTC1[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->saa7108MaskTable.numCRTC1 = k;
+
+ pViaModeTable->saa7108MaskTable.misc1 = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < 2; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->saa7108MaskTable.CRTC2[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->saa7108MaskTable.CRTC2[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->saa7108MaskTable.numCRTC2 = k;
+
+ pViaModeTable->saa7108MaskTable.misc2 = *pRom++;
+
+}
+
+void VIAGetSAA7108NTSC(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ VIABIOSSAA7108TablePtr pSAA7108Tab;
+ unsigned char *pRom, *pNTSC;
+ unsigned char *pTVTable;
+ unsigned char numCRTC;
+ unsigned char numPatch, numReg;
+ int vScan, offset;
+ int i, j, k, n;
+
+ pSAA7108Tab = NULL;
+ pTVTable = NULL;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetSAA7108NTSC\n"));
+ for (vScan = 0; vScan < 2; vScan++) {
+ switch (vScan) {
+ case VIA_TVNORMAL:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_TVMODETAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVModeTbl: %X\n", *((CARD16 *)pRom)));
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pSAA7108Tab = pViaModeTable->saa7108Table;
+ /* HSoffset = 2; */
+ break;
+ case VIA_TVOVER:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_MODEOVERTAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVModeOverTbl: %X\n", *((CARD16 *)pRom)));
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pSAA7108Tab = pViaModeTable->saa7108OverTable;
+ /* HSoffset = 38; */
+ break;
+ }
+
+ /* offset: skip MODE3, MODE13 */
+ for (offset = 11, n = 0; n < VIA_BIOS_NUM_SAA7108; offset += 5, n++) {
+
+ /* Get pointer table of each mode */
+ pRom = pTVTable + offset;
+
+ if ((*((CARD16 *)pRom)) != 0) {
+ pNTSC = pBIOS + *((CARD16 *)pRom);
+
+ /* Get start of TV Table */
+ pRom = pNTSC + 1;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0; i < pViaModeTable->saa7108MaskTable.numTV; j++) {
+ if (pViaModeTable->saa7108MaskTable.TV[j] == 0xFF) {
+ pSAA7108Tab[n].TVNTSC[j] = *pRom++;
+ i++;
+ }
+ }
+
+ numCRTC = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < numCRTC; j++) {
+ if (pViaModeTable->saa7108MaskTable.CRTC1[j] == 0xFF) {
+ if (i >= pViaModeTable->saa7108MaskTable.numCRTC1) {
+ pSAA7108Tab[n].MiscNTSC1[k++] = *pRom++;
+ i++;
+ }
+ else {
+ pSAA7108Tab[n].CRTCNTSC1[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+
+ for (i = 0, j = 0, k = 0; i < pViaModeTable->saa7108MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->saa7108MaskTable.CRTC2[j] == 0xFF) {
+ /* CRTC 65-57 8bpp, 16bpp, 32bpp */
+ if (j == 0x15) {
+ pSAA7108Tab[n].CRTCNTSC2_8BPP[j] = *pRom++;
+ pSAA7108Tab[n].CRTCNTSC2_8BPP[j+1] = *pRom++;
+ pSAA7108Tab[n].CRTCNTSC2_8BPP[j+2] = *pRom++;
+ pSAA7108Tab[n].CRTCNTSC2_16BPP[j] = *pRom++;
+ pSAA7108Tab[n].CRTCNTSC2_16BPP[j+1] = *pRom++;
+ pSAA7108Tab[n].CRTCNTSC2_16BPP[j+2] = *pRom++;
+ pSAA7108Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++;
+ pSAA7108Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++;
+ pSAA7108Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i += 3;
+ }
+ else {
+ /* For CRTC 6A-6C */
+ if (i >= (pViaModeTable->saa7108MaskTable.numCRTC2 - 3)) {
+ pSAA7108Tab[n].CRTCNTSC2_8BPP[j] = *pRom;
+ pSAA7108Tab[n].CRTCNTSC2_16BPP[j] = *pRom;
+ pSAA7108Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i++;
+ }
+ else {
+ pSAA7108Tab[n].CRTCNTSC2_8BPP[j] = *pRom;
+ pSAA7108Tab[n].CRTCNTSC2_16BPP[j] = *pRom;
+ pSAA7108Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+ }
+
+ k = 3;
+ /* LCK 3c5.44-45 */
+ if (pViaModeTable->saa7108MaskTable.misc2 & 0x18) {
+ pSAA7108Tab[n].MiscNTSC2[k++] = *pRom++;
+ pSAA7108Tab[n].MiscNTSC2[k++] = *pRom++;
+ }
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->saa7108MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ pSAA7108Tab[n].PatchNTSC2[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get RGB Table */
+ pRom = pNTSC + 4;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pSAA7108Tab[n].RGBNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pSAA7108Tab[n].RGBNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get YCbCr Table */
+ pRom = pNTSC + 7;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pSAA7108Tab[n].YCbCrNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pSAA7108Tab[n].YCbCrNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+ }
+ }
+ }
+}
+
+void VIAGetSAA7108PAL(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ VIABIOSSAA7108TablePtr pSAA7108Tab;
+ unsigned char *pRom, *pPAL;
+ unsigned char *pTVTable;
+ unsigned char numCRTC;
+ unsigned char numPatch, numReg;
+ int vScan, offset;
+ int i, j, k, n;
+
+ pSAA7108Tab = NULL;
+ pTVTable = NULL;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetSAA7108PAL\n"));
+ for (vScan = 0; vScan < 2; vScan++) {
+ switch (vScan) {
+ case VIA_TVNORMAL:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_TVMODETAB_POS;
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pSAA7108Tab = pViaModeTable->saa7108Table;
+ /* HSoffset = 4; */
+ break;
+ case VIA_TVOVER:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_MODEOVERTAB_POS;
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pSAA7108Tab = pViaModeTable->saa7108OverTable;
+ /* HSoffset = 40; */
+ break;
+ }
+
+ /* offset: skip MODE3, MODE13 */
+ for (offset = 13, n = 0; n < VIA_BIOS_NUM_SAA7108; offset += 5, n++) {
+
+ /* Get pointer table of each mode */
+ pRom = pTVTable + offset;
+
+ if (*((CARD16 *)pRom) != 0) {
+ pPAL = pBIOS + *((CARD16 *)pRom);
+
+ /* Get start of TV Table */
+ pRom = pPAL + 1;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0; i < pViaModeTable->saa7108MaskTable.numTV; j++) {
+ if (pViaModeTable->saa7108MaskTable.TV[j] == 0xFF) {
+ pSAA7108Tab[n].TVPAL[j] = *pRom++;
+ i++;
+ }
+ }
+
+ numCRTC = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < numCRTC; j++) {
+ if (pViaModeTable->saa7108MaskTable.CRTC1[j] == 0xFF) {
+ if (i >= pViaModeTable->saa7108MaskTable.numCRTC1) {
+ pSAA7108Tab[n].MiscPAL1[k++] = *pRom++;
+ i++;
+ }
+ else {
+ pSAA7108Tab[n].CRTCPAL1[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+
+ for (i = 0, j = 0, k = 0; i < pViaModeTable->saa7108MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->saa7108MaskTable.CRTC2[j] == 0xFF) {
+ if (j == 0x15) {
+ pSAA7108Tab[n].CRTCPAL2_8BPP[j] = *pRom++;
+ pSAA7108Tab[n].CRTCPAL2_8BPP[j+1] = *pRom++;
+ pSAA7108Tab[n].CRTCPAL2_8BPP[j+2] = *pRom++;
+ pSAA7108Tab[n].CRTCPAL2_16BPP[j] = *pRom++;
+ pSAA7108Tab[n].CRTCPAL2_16BPP[j+1] = *pRom++;
+ pSAA7108Tab[n].CRTCPAL2_16BPP[j+2] = *pRom++;
+ pSAA7108Tab[n].CRTCPAL2_32BPP[j++] = *pRom++;
+ pSAA7108Tab[n].CRTCPAL2_32BPP[j++] = *pRom++;
+ pSAA7108Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i += 3;
+ }
+ else {
+ /* For CRTC 6A-6C */
+ if (i >= (pViaModeTable->saa7108MaskTable.numCRTC2 - 3)) {
+ pSAA7108Tab[n].CRTCPAL2_8BPP[j] = *pRom;
+ pSAA7108Tab[n].CRTCPAL2_16BPP[j] = *pRom;
+ pSAA7108Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i++;
+ }
+ else {
+ pSAA7108Tab[n].CRTCPAL2_8BPP[j] = *pRom;
+ pSAA7108Tab[n].CRTCPAL2_16BPP[j] = *pRom;
+ pSAA7108Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+ }
+
+ k = 3;
+ /* LCK 3c5.44-45 */
+ if (pViaModeTable->saa7108MaskTable.misc2 & 0x18) {
+ pSAA7108Tab[n].MiscPAL2[k++] = *pRom++;
+ pSAA7108Tab[n].MiscPAL2[k++] = *pRom++;
+ }
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->saa7108MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ pSAA7108Tab[n].PatchPAL2[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get RGB Table */
+ pRom = pPAL + 4;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pSAA7108Tab[n].RGBPAL[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pSAA7108Tab[n].RGBPAL[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get YCbCr Table */
+ pRom = pPAL + 7;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pSAA7108Tab[n].YCbCrPAL[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pSAA7108Tab[n].YCbCrPAL[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+ }
+ }
+ }
+}
+
+void VIAGetTV2Mask(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ unsigned char *pRom;
+ int i, j, k, m;
+ CARD16 tmp;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetTV2Mask\n"));
+ /* Get start of TV Mask Table */
+ pRom = pTable + VIA_BIOS_TVMASKTAB_POS;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0, k = 0; i < 9; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->tv2MaskTable.TV[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->tv2MaskTable.TV[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->tv2MaskTable.numTV = k;
+
+ for (i = 0, j = 0, k = 0; i < 2; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->tv2MaskTable.CRTC1[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->tv2MaskTable.CRTC1[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->tv2MaskTable.numCRTC1 = k;
+
+ pViaModeTable->tv2MaskTable.misc1 = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < 2; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->tv2MaskTable.CRTC2[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->tv2MaskTable.CRTC2[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->tv2MaskTable.numCRTC2 = k;
+
+ pViaModeTable->tv2MaskTable.misc2 = *pRom++;
+}
+
+
+void VIAGetTV3Mask(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ unsigned char *pRom;
+ int i, j, k, m;
+ CARD16 tmp;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetTV3Mask\n"));
+ /* Get start of TV Mask Table */
+ pRom = pTable + VIA_BIOS_TVMASKTAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVMaskTbl: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0, k = 0; i < 9; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->tv3MaskTable.TV[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->tv3MaskTable.TV[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->tv3MaskTable.numTV = k;
+
+ for (i = 0, j = 0, k = 0; i < 2; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->tv3MaskTable.CRTC1[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->tv3MaskTable.CRTC1[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->tv3MaskTable.numCRTC1 = k;
+
+ pViaModeTable->tv3MaskTable.misc1 = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < 2; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->tv3MaskTable.CRTC2[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->tv3MaskTable.CRTC2[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->tv3MaskTable.numCRTC2 = k;
+
+ pViaModeTable->tv3MaskTable.misc2 = *pRom++;
+
+}
+
+
+void VIAGetTV2NTSC(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ VIABIOSTV2TablePtr pTV2Tab;
+ unsigned char *pRom, *pNTSC;
+ unsigned char *pTVTable;
+ unsigned char numCRTC;
+ unsigned char numPatch, numReg;
+ int vScan, offset;
+ int i, j, k, n;
+
+ pTV2Tab = NULL;
+ pTVTable = NULL;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetTV2NTSC\n"));
+ for (vScan = 0; vScan < 2; vScan++) {
+ switch (vScan) {
+ case VIA_TVNORMAL:
+ /* Get start of TV Table */
+ pRom = pTable + VIA_BIOS_TVMODETAB_POS;
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pTV2Tab = pViaModeTable->tv2Table;
+ break;
+ case VIA_TVOVER:
+ /* Get start of TV Table */
+ pRom = pTable + VIA_BIOS_MODEOVERTAB_POS;
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pTV2Tab = pViaModeTable->tv2OverTable;
+ break;
+ }
+
+ for (offset = 16, n = 0; n < VIA_BIOS_NUM_TV2; offset += 5, n++) {
+
+ pRom = pTVTable + offset;
+ pNTSC = pBIOS + *((CARD16 *)pRom);
+
+ pRom = pNTSC + 1;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numTV; j++) {
+ if (pViaModeTable->tv2MaskTable.TV[j] == 0xFF) {
+ pTV2Tab[n].TVNTSCC[j] = *pRom++;
+ i++;
+ }
+ }
+
+ for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numTV; j++) {
+ if (pViaModeTable->tv2MaskTable.TV[j] == 0xFF) {
+ if (j >= 0x53) {
+ pTV2Tab[n].TVNTSCS[j] = *pRom++;
+ i++;
+ }
+ else {
+ pTV2Tab[n].TVNTSCS[j] =
+ pTV2Tab[n].TVNTSCC[j];
+ i++;
+ }
+ }
+ }
+
+ numCRTC = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < numCRTC; j++) {
+ if (pViaModeTable->tv2MaskTable.CRTC1[j] == 0xFF) {
+ if (i >= pViaModeTable->tv2MaskTable.numCRTC1) {
+ pTV2Tab[n].MiscNTSC1[k++] = *pRom++;
+ i++;
+ }
+ else {
+ pTV2Tab[n].CRTCNTSC1[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+
+ for (i = 0, j = 0, k = 0; i < pViaModeTable->tv2MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->tv2MaskTable.CRTC2[j] == 0xFF) {
+ /* CRTC 65-57 8bpp, 16bpp, 32bpp */
+ if (j == 0x15) {
+ pTV2Tab[n].CRTCNTSC2_8BPP[j] = *pRom++;
+ pTV2Tab[n].CRTCNTSC2_8BPP[j+1] = *pRom++;
+ pTV2Tab[n].CRTCNTSC2_8BPP[j+2] = *pRom++;
+ pTV2Tab[n].CRTCNTSC2_16BPP[j] = *pRom++;
+ pTV2Tab[n].CRTCNTSC2_16BPP[j+1] = *pRom++;
+ pTV2Tab[n].CRTCNTSC2_16BPP[j+2] = *pRom++;
+ pTV2Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++;
+ pTV2Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++;
+ pTV2Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i += 3;
+ }
+ else {
+ /* For CRTC 6A-6C */
+ if (i >= (pViaModeTable->tv2MaskTable.numCRTC2 - 3)) {
+ pTV2Tab[n].CRTCNTSC2_8BPP[j] = *pRom;
+ pTV2Tab[n].CRTCNTSC2_16BPP[j] = *pRom;
+ pTV2Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i++;
+ }
+ else {
+ pTV2Tab[n].CRTCNTSC2_8BPP[j] = *pRom;
+ pTV2Tab[n].CRTCNTSC2_16BPP[j] = *pRom;
+ pTV2Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+ }
+
+ k = 3;
+ /* LCK 3c5.44-45 */
+ if (pViaModeTable->tv2MaskTable.misc2 & 0x18) {
+ pTV2Tab[n].MiscNTSC2[k++] = *pRom++;
+ pTV2Tab[n].MiscNTSC2[k++] = *pRom++;
+ }
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->tv2MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ pTV2Tab[n].PatchNTSC2[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get DotCrawl Table */
+ pRom = pNTSC + 4;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pTV2Tab[n].DotCrawlNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pTV2Tab[n].DotCrawlNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+ }
+ }
+}
+
+void VIAGetTV2PAL(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ VIABIOSTV2TablePtr pTV2Tab;
+ unsigned char *pRom, *pPAL;
+ unsigned char *pTVTable;
+ unsigned char numCRTC;
+ int vScan, offset;
+ int numPatch;
+ int i, j, k, n;
+
+ pTV2Tab = NULL;
+ pTVTable = NULL;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetTV2PAL\n"));
+ for (vScan = 0; vScan < 2; vScan++) {
+ switch (vScan) {
+ case VIA_TVNORMAL:
+ /* Get start of TV Table */
+ pRom = pTable + VIA_BIOS_TVMODETAB_POS;
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pTV2Tab = pViaModeTable->tv2Table;
+ break;
+ case VIA_TVOVER:
+ /* Get start of TV Table */
+ pRom = pTable + VIA_BIOS_MODEOVERTAB_POS;
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pTV2Tab = pViaModeTable->tv2OverTable;
+ break;
+ }
+
+ for (offset = 18, n = 0; n < VIA_BIOS_NUM_TV2; offset += 5, n++) {
+
+ pRom = pTVTable + offset;
+ pPAL = pBIOS + *((CARD16 *)pRom);
+
+ pRom = pPAL + 1;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numTV; j++) {
+ if (pViaModeTable->tv2MaskTable.TV[j] == 0xFF) {
+ pTV2Tab[n].TVPALC[j] = *pRom++;
+ i++;
+ }
+ }
+
+ for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numTV; j++) {
+ if (pViaModeTable->tv2MaskTable.TV[j] == 0xFF) {
+ if (j >= 0x53) {
+ pTV2Tab[n].TVPALS[j] = *pRom++;
+ i++;
+ }
+ else {
+ pTV2Tab[n].TVPALS[j] =
+ pTV2Tab[n].TVPALC[j];
+ i++;
+ }
+ }
+ }
+
+ numCRTC = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < numCRTC; j++) {
+ if (pViaModeTable->tv2MaskTable.CRTC1[j] == 0xFF) {
+ if (i >= pViaModeTable->tv2MaskTable.numCRTC1) {
+ pTV2Tab[n].MiscPAL1[k++] = *pRom++;
+ i++;
+ }
+ else {
+ pTV2Tab[n].CRTCPAL1[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+
+ for (i = 0, j = 0, k = 0; i < pViaModeTable->tv2MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->tv2MaskTable.CRTC2[j] == 0xFF) {
+ /* CRTC 65-57 8bpp, 16bpp, 32bpp */
+ if (j == 0x15) {
+ pTV2Tab[n].CRTCPAL2_8BPP[j] = *pRom++;
+ pTV2Tab[n].CRTCPAL2_8BPP[j+1] = *pRom++;
+ pTV2Tab[n].CRTCPAL2_8BPP[j+2] = *pRom++;
+ pTV2Tab[n].CRTCPAL2_16BPP[j] = *pRom++;
+ pTV2Tab[n].CRTCPAL2_16BPP[j+1] = *pRom++;
+ pTV2Tab[n].CRTCPAL2_16BPP[j+2] = *pRom++;
+ pTV2Tab[n].CRTCPAL2_32BPP[j++] = *pRom++;
+ pTV2Tab[n].CRTCPAL2_32BPP[j++] = *pRom++;
+ pTV2Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i += 3;
+ }
+ else {
+ /* For CRTC 6A-6C */
+ if (i >= (pViaModeTable->tv2MaskTable.numCRTC2 - 3)) {
+ pTV2Tab[n].CRTCPAL2_8BPP[j] = *pRom;
+ pTV2Tab[n].CRTCPAL2_16BPP[j] = *pRom;
+ pTV2Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i++;
+ }
+ else {
+ pTV2Tab[n].CRTCPAL2_8BPP[j] = *pRom;
+ pTV2Tab[n].CRTCPAL2_16BPP[j] = *pRom;
+ pTV2Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+ }
+
+ k = 3;
+ /* LCK 3c5.44-45 */
+ if (pViaModeTable->tv2MaskTable.misc2 & 0x18) {
+ pTV2Tab[n].MiscPAL2[k++] = *pRom++;
+ pTV2Tab[n].MiscPAL2[k++] = *pRom++;
+ }
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->tv2MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ pTV2Tab[n].PatchPAL2[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+ }
+ }
+}
+
+void VIAGetTV3NTSC(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ VIABIOSTV3TablePtr pTV3Tab;
+ unsigned char *pRom, *pNTSC;
+ unsigned char *pTVTable;
+ unsigned char numCRTC;
+ unsigned char numPatch, numReg;
+ int vScan, offset;
+ int i, j, k, n;
+
+ pTV3Tab = NULL;
+ pTVTable = NULL;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetTV3NTSC\n"));
+ for (vScan = 0; vScan < 2; vScan++) {
+ switch (vScan) {
+ case VIA_TVNORMAL:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_TVMODETAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVModeTbl: %X\n", *((CARD16 *)pRom)));
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pTV3Tab = pViaModeTable->tv3Table;
+ /* HSoffset = 2; */
+ break;
+ case VIA_TVOVER:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_MODEOVERTAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVModeOverTbl: %X\n", *((CARD16 *)pRom)));
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pTV3Tab = pViaModeTable->tv3OverTable;
+ /* HSoffset = 38; */
+ break;
+ }
+
+ /* offset: skip MODE3, MODE13 */
+ for (offset = 11, n = 0; n < VIA_BIOS_NUM_TV3; offset += 5, n++) {
+
+ /* Get pointer table of each mode */
+ pRom = pTVTable + offset;
+
+ if ((*((CARD16 *)pRom)) != 0) {
+
+ pNTSC = pBIOS + *((CARD16 *)pRom);
+
+ /* Get start of TV Table */
+ pRom = pNTSC + 1;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0; i < pViaModeTable->tv3MaskTable.numTV; j++) {
+ if (pViaModeTable->tv3MaskTable.TV[j] == 0xFF) {
+ pTV3Tab[n].TVNTSC[j] = *pRom++;
+ i++;
+ }
+ }
+
+ numCRTC = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < numCRTC; j++) {
+ if (pViaModeTable->tv3MaskTable.CRTC1[j] == 0xFF) {
+ if (i >= pViaModeTable->tv3MaskTable.numCRTC1) {
+ pTV3Tab[n].MiscNTSC1[k++] = *pRom++;
+ i++;
+ }
+ else {
+ pTV3Tab[n].CRTCNTSC1[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+
+ for (i = 0, j = 0, k = 0; i < pViaModeTable->tv3MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->tv3MaskTable.CRTC2[j] == 0xFF) {
+ /* CRTC 65-57 8bpp, 16bpp, 32bpp */
+ if (j == 0x15) {
+ pTV3Tab[n].CRTCNTSC2_8BPP[j] = *pRom++;
+ pTV3Tab[n].CRTCNTSC2_8BPP[j+1] = *pRom++;
+ pTV3Tab[n].CRTCNTSC2_8BPP[j+2] = *pRom++;
+ pTV3Tab[n].CRTCNTSC2_16BPP[j] = *pRom++;
+ pTV3Tab[n].CRTCNTSC2_16BPP[j+1] = *pRom++;
+ pTV3Tab[n].CRTCNTSC2_16BPP[j+2] = *pRom++;
+ pTV3Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++;
+ pTV3Tab[n].CRTCNTSC2_32BPP[j++] = *pRom++;
+ pTV3Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i += 3;
+ }
+ else {
+ /* For CRTC 6A-6C */
+ if (i >= (pViaModeTable->tv3MaskTable.numCRTC2 - 3)) {
+ pTV3Tab[n].CRTCNTSC2_8BPP[j] = *pRom;
+ pTV3Tab[n].CRTCNTSC2_16BPP[j] = *pRom;
+ pTV3Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i++;
+ }
+ else {
+ pTV3Tab[n].CRTCNTSC2_8BPP[j] = *pRom;
+ pTV3Tab[n].CRTCNTSC2_16BPP[j] = *pRom;
+ pTV3Tab[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+ }
+
+ k = 3;
+ /* LCK 3c5.44-45 */
+ if (pViaModeTable->tv3MaskTable.misc2 & 0x18) {
+ pTV3Tab[n].MiscNTSC2[k++] = *pRom++;
+ pTV3Tab[n].MiscNTSC2[k++] = *pRom++;
+ }
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->tv3MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ pTV3Tab[n].PatchNTSC2[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get RGB Table */
+ pRom = pNTSC + 4;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pTV3Tab[n].RGBNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pTV3Tab[n].RGBNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get YCbCr Table */
+ pRom = pNTSC + 7;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pTV3Tab[n].YCbCrNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pTV3Tab[n].YCbCrNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+#if 0
+ /* Get SDTV_RGB Table */
+ pRom = pNTSC + 10;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pTV3Tab[n].SDTV_RGBNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pTV3Tab[n].SDTV_RGBNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get SDTV_YCbCr Table */
+ pRom = pNTSC + 13;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pTV3Tab[n].SDTV_YCbCrNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pTV3Tab[n].SDTV_YCbCrNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get DotCrawl Table */
+ pRom = pNTSC + 16;
+ pRom = pBIOS + *((CARD16 *)pRom);
+#endif
+
+ /* Get DotCrawl Table */
+ pRom = pNTSC + 10;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pTV3Tab[n].DotCrawlNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pTV3Tab[n].DotCrawlNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+ }
+ }
+ }
+}
+
+void VIAGetFS454Mask(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ unsigned char *pRom;
+ int i, j, k, m;
+ CARD16 tmp;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetFS454Mask\n"));
+ /* Get start of TV Mask Table */
+ pRom = pTable + VIA_BIOS_TVMASKTAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVMaskTbl: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ /* Skip Zero TV Register Mask Table */
+ pRom += (9*2);
+
+ for (i = 0, j = 0, k = 0; i < 2; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->fs454MaskTable.CRTC1[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->fs454MaskTable.CRTC1[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->fs454MaskTable.numCRTC1 = k;
+
+ pViaModeTable->fs454MaskTable.misc1 = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < 2; i++) {
+ tmp = *((CARD16 *)pRom);
+ for (m = 0; m < 16; m++, j++) {
+ if ((tmp >> m) & 0x01) {
+ pViaModeTable->fs454MaskTable.CRTC2[j] = 0xFF;
+ k++;
+ }
+ else {
+ pViaModeTable->fs454MaskTable.CRTC2[j] = 0;
+ }
+ }
+ pRom += 2;
+ }
+ pViaModeTable->fs454MaskTable.numCRTC2 = k;
+
+ pViaModeTable->fs454MaskTable.misc2 = *pRom++;
+
+}
+
+void VIAGetFS454NTSC(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ VIABIOSFS454TablePtr pFS454Tbl;
+ unsigned char *pRom, *pNTSC;
+ unsigned char *pTVTable;
+ unsigned char numCRTC, numReg;
+ int vScan, offset;
+ int i, j, k, n;
+
+ pFS454Tbl = NULL;
+ pTVTable = NULL;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetFS454NTSC\n"));
+ for (vScan = 0; vScan < 2; vScan++) {
+ switch (vScan) {
+ case VIA_TVNORMAL:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_TVMODETAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVModeTbl: %X\n", *((CARD16 *)pRom)));
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pFS454Tbl = pViaModeTable->fs454Table;
+ /* HSoffset = 2; */
+ break;
+ case VIA_TVOVER:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_MODEOVERTAB_POS;
+ DEBUG(xf86Msg(X_INFO, "csTVModeOverTbl: %X\n", *((CARD16 *)pRom)));
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pFS454Tbl = pViaModeTable->fs454OverTable;
+ /* HSoffset = 38; */
+ break;
+ }
+
+ /* offset: skip MODE3, MODE13 */
+ for (offset = 11, n = 0; n < VIA_BIOS_NUM_FS454; offset += 5, n++) {
+
+ /* Get pointer table of each mode */
+ pRom = pTVTable + offset;
+
+ if ((*((CARD16 *)pRom)) != 0) {
+
+ pNTSC = pBIOS + *((CARD16 *)pRom);
+
+ /* Get start of TV Table */
+ pRom = pNTSC + 1;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pFS454Tbl[n].TVNTSC[0] = numReg;
+ for (i = 1; i < (numReg + 1); i++) {
+ pFS454Tbl[n].TVNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ numCRTC = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < numCRTC; j++) {
+ if (pViaModeTable->fs454MaskTable.CRTC1[j] == 0xFF) {
+ if (i >= pViaModeTable->fs454MaskTable.numCRTC1) {
+ pFS454Tbl[n].MiscNTSC1[k++] = *pRom++;
+ i++;
+ }
+ else {
+ pFS454Tbl[n].CRTCNTSC1[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+
+ for (i = 0, j = 0, k = 0; i < pViaModeTable->fs454MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->fs454MaskTable.CRTC2[j] == 0xFF) {
+ /* CRTC 65-57 8bpp, 16bpp, 32bpp */
+ if (j == 0x15) {
+ pFS454Tbl[n].CRTCNTSC2_8BPP[j] = *pRom++;
+ pFS454Tbl[n].CRTCNTSC2_8BPP[j+1] = *pRom++;
+ pFS454Tbl[n].CRTCNTSC2_8BPP[j+2] = *pRom++;
+ pFS454Tbl[n].CRTCNTSC2_16BPP[j] = *pRom++;
+ pFS454Tbl[n].CRTCNTSC2_16BPP[j+1] = *pRom++;
+ pFS454Tbl[n].CRTCNTSC2_16BPP[j+2] = *pRom++;
+ pFS454Tbl[n].CRTCNTSC2_32BPP[j++] = *pRom++;
+ pFS454Tbl[n].CRTCNTSC2_32BPP[j++] = *pRom++;
+ pFS454Tbl[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i += 3;
+ }
+ else {
+ /* For CRTC 6A-6C */
+ if (i >= (pViaModeTable->fs454MaskTable.numCRTC2 - 3)) {
+ pFS454Tbl[n].CRTCNTSC2_8BPP[j] = *pRom;
+ pFS454Tbl[n].CRTCNTSC2_16BPP[j] = *pRom;
+ pFS454Tbl[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i++;
+ }
+ else {
+ pFS454Tbl[n].CRTCNTSC2_8BPP[j] = *pRom;
+ pFS454Tbl[n].CRTCNTSC2_16BPP[j] = *pRom;
+ pFS454Tbl[n].CRTCNTSC2_32BPP[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+ }
+
+ k = 3;
+ /* LCK 3c5.44-45 */
+ if (pViaModeTable->fs454MaskTable.misc2 & 0x18) {
+ pFS454Tbl[n].MiscNTSC2[k++] = *pRom++;
+ pFS454Tbl[n].MiscNTSC2[k++] = *pRom++;
+ }
+
+ /* Get RGB Table */
+ pRom = pNTSC + 4;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pFS454Tbl[n].RGBNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pFS454Tbl[n].RGBNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get YCbCr Table */
+ pRom = pNTSC + 7;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pFS454Tbl[n].YCbCrNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pFS454Tbl[n].YCbCrNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get DotCrawl Table */
+ pRom = pNTSC + 10;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pFS454Tbl[n].DotCrawlNTSC[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pFS454Tbl[n].DotCrawlNTSC[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+ }
+ }
+ }
+}
+
+void VIAGetTV3PAL(VIAModeTablePtr pViaModeTable,
+ unsigned char *pBIOS,
+ unsigned char *pTable)
+{
+ VIABIOSTV3TablePtr pTV3Tab;
+ unsigned char *pRom, *pPAL;
+ unsigned char *pTVTable;
+ unsigned char numCRTC;
+ unsigned char numPatch, numReg;
+ int vScan, offset;
+ int i, j, k, n;
+
+ pTV3Tab = NULL;
+ pTVTable = NULL;
+
+ DEBUG(xf86Msg(X_INFO, "VIAGetTV3PAL\n"));
+ for (vScan = 0; vScan < 2; vScan++) {
+ switch (vScan) {
+ case VIA_TVNORMAL:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_TVMODETAB_POS;
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pTV3Tab = pViaModeTable->tv3Table;
+ /* HSoffset = 4; */
+ break;
+ case VIA_TVOVER:
+ /* Get pointer table of all mode */
+ pRom = pTable + VIA_BIOS_MODEOVERTAB_POS;
+ pTVTable = pBIOS + *((CARD16 *)pRom);
+
+ pTV3Tab = pViaModeTable->tv3OverTable;
+ /* HSoffset = 40; */
+ break;
+ }
+
+ /* offset: skip MODE3, MODE13 */
+ for (offset = 13, n = 0; n < VIA_BIOS_NUM_TV3; offset += 5, n++) {
+
+ /* Get pointer table of each mode */
+ pRom = pTVTable + offset;
+
+ if (*((CARD16 *)pRom) != 0) {
+
+ pPAL = pBIOS + *((CARD16 *)pRom);
+
+ /* Get start of TV Table */
+ pRom = pPAL + 1;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0, j = 0; i < pViaModeTable->tv3MaskTable.numTV; j++) {
+ if (pViaModeTable->tv3MaskTable.TV[j] == 0xFF) {
+ pTV3Tab[n].TVPAL[j] = *pRom++;
+ i++;
+ }
+ }
+
+ numCRTC = *pRom++;
+
+ for (i = 0, j = 0, k = 0; i < numCRTC; j++) {
+ if (pViaModeTable->tv3MaskTable.CRTC1[j] == 0xFF) {
+ if (i >= pViaModeTable->tv3MaskTable.numCRTC1) {
+ pTV3Tab[n].MiscPAL1[k++] = *pRom++;
+ i++;
+ }
+ else {
+ pTV3Tab[n].CRTCPAL1[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+
+ for (i = 0, j = 0, k = 0; i < pViaModeTable->tv3MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->tv3MaskTable.CRTC2[j] == 0xFF) {
+ if (j == 0x15) {
+ pTV3Tab[n].CRTCPAL2_8BPP[j] = *pRom++;
+ pTV3Tab[n].CRTCPAL2_8BPP[j+1] = *pRom++;
+ pTV3Tab[n].CRTCPAL2_8BPP[j+2] = *pRom++;
+ pTV3Tab[n].CRTCPAL2_16BPP[j] = *pRom++;
+ pTV3Tab[n].CRTCPAL2_16BPP[j+1] = *pRom++;
+ pTV3Tab[n].CRTCPAL2_16BPP[j+2] = *pRom++;
+ pTV3Tab[n].CRTCPAL2_32BPP[j++] = *pRom++;
+ pTV3Tab[n].CRTCPAL2_32BPP[j++] = *pRom++;
+ pTV3Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i += 3;
+ }
+ else {
+ /* For CRTC 6A-6C */
+ if (i >= (pViaModeTable->tv3MaskTable.numCRTC2 - 3)) {
+ pTV3Tab[n].CRTCPAL2_8BPP[j] = *pRom;
+ pTV3Tab[n].CRTCPAL2_16BPP[j] = *pRom;
+ pTV3Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i++;
+ }
+ else {
+ pTV3Tab[n].CRTCPAL2_8BPP[j] = *pRom;
+ pTV3Tab[n].CRTCPAL2_16BPP[j] = *pRom;
+ pTV3Tab[n].CRTCPAL2_32BPP[j] = *pRom++;
+ i++;
+ }
+ }
+ }
+ }
+
+ k = 3;
+ /* LCK 3c5.44-45 */
+ if (pViaModeTable->tv3MaskTable.misc2 & 0x18) {
+ pTV3Tab[n].MiscPAL2[k++] = *pRom++;
+ pTV3Tab[n].MiscPAL2[k++] = *pRom++;
+ }
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->tv3MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ pTV3Tab[n].PatchPAL2[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get RGB Table */
+ pRom = pPAL + 4;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pTV3Tab[n].RGBPAL[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pTV3Tab[n].RGBPAL[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get YCbCr Table */
+ pRom = pPAL + 7;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pTV3Tab[n].YCbCrPAL[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pTV3Tab[n].YCbCrPAL[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+#if 0
+ /* Get SDTV_RGB Table */
+ pRom = pPAL + 10;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pTV3Tab[n].SDTV_RGBPAL[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pTV3Tab[n].SDTV_RGBPAL[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get SDTV_YCbCr Table */
+ pRom = pPAL + 13;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ numReg = *pRom++;
+ pTV3Tab[n].SDTV_YCbCrPAL[0] = numReg;
+ for ( i = 1; i < (numReg + 1); i++) {
+ pTV3Tab[n].SDTV_YCbCrPAL[i] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+#endif
+ }
+ }
+ }
+}
+
+
+/* Check TV mode table is TV2+ or TV3 */
+int VIAGetTVTabVer(VIABIOSInfoPtr pBIOSInfo,
+ unsigned char *pBIOS)
+{
+ unsigned char *pRom, *pTable;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetTVTabVer\n"));
+ /* Get the start of Table */
+ pRom = pBIOS + VIA_BIOS_OFFSET_POS;
+ pTable = pBIOS + *((CARD16 *)pRom);
+
+ /* Get start of TV Mask Table */
+ pRom = pTable + VIA_BIOS_TVMASKTAB_POS;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ pRom += 12;
+ if (*((CARD16 *)pRom) == 0x03) {
+ pBIOSInfo->BIOSTVTabVer = 2;
+ return 2;
+ }
+ else {
+ pBIOSInfo->BIOSTVTabVer = 3;
+ return 3;
+ }
+}
+
+
+Bool VIAGetBIOSTable(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ unsigned char *pBIOS = NULL, *pRom, *pTable, *pFPanel, *pLCDTable, *pSuptTable;
+ unsigned char *pRefreshTableStart;
+ unsigned char *pRefreshIndexTable;
+ unsigned char *pRefreshTable;
+ unsigned char numSuptPanel, numEntry;
+ unsigned short tableSize;
+ int romSize;
+ int i = 0, j, k, m, sum;
+
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAGetBIOSTable\n"));
+
+ if (!(pBIOS=xcalloc(1, 0x10000))) {
+ ErrorF("Allocate memory fail !!\n");
+ return FALSE;
+ }
+
+ if (xf86ReadBIOS(0xC0000, 0, pBIOS, 0x10000) != 0x10000) {
+ pBIOSInfo->UseBIOS = FALSE;
+ xfree(pBIOS);
+ ErrorF("Read VGA BIOS image fail !!\n");
+ }
+ else {
+ if (*((CARD16 *) pBIOS) != 0xAA55) {
+ pBIOSInfo->UseBIOS = FALSE;
+ xfree(pBIOS);
+ ErrorF("VGA BIOS image is wrong!!\n");
+ }
+ else {
+ romSize = *((CARD8 *) (pBIOS + VIA_BIOS_SIZE_POS)) * 512;
+ pRom = pBIOS;
+ sum = 0;
+
+ for (i = 0; i < romSize; i++) {
+ sum += *pRom++;
+ }
+
+ if (((CARD8) sum) != 0) {
+ pBIOSInfo->UseBIOS = FALSE;
+ xfree(pBIOS);
+ ErrorF("VGA BIOS image is wrong!! CheckSum = %x\n", sum);
+ }
+ }
+ }
+
+ /* To check is TV Encoder match with BIOS TV mode table */
+ if (pBIOSInfo->UseBIOS) {
+ int TVEncoder = pBIOSInfo->TVEncoder;
+ if (TVEncoder && (VIAGetTVTabVer(pBIOSInfo, pBIOS) != (TVEncoder+1))) {
+ pBIOSInfo->UseBIOS = FALSE;
+ xfree(pBIOS);
+ }
+ }
+
+ /* Get the start of Table */
+ pRom = pBIOS + VIA_BIOS_OFFSET_POS;
+ pTable = pBIOS + *((CARD16 *)pRom);
+
+#ifdef CREATE_CH7019_HEADERFILE
+ VIAGetCH7019Mask(pViaModeTable, pBIOS, pTable);
+ VIAGetCH7019NTSC(pViaModeTable, pBIOS, pTable);
+ VIAGetCH7019PAL(pViaModeTable, pBIOS, pTable);
+ VIACreateCH7019(pViaModeTable);
+#else
+ pViaModeTable->ch7019MaskTable = ch7019MaskTable;
+ for (i = 0; i < VIA_BIOS_NUM_CH7019; i++) {
+ pViaModeTable->ch7019Table[i] = ch7019Table[i];
+ pViaModeTable->ch7019OverTable[i] = ch7019OverTable[i];
+ }
+#endif
+#ifdef CREATE_FS454_HEADERFILE
+ VIAGetFS454Mask(pViaModeTable, pBIOS, pTable);
+ VIAGetFS454NTSC(pViaModeTable, pBIOS, pTable);
+ /*VIAGetFS454PAL(pViaModeTable, pBIOS, pTable);*/
+ VIACreateFS454(pViaModeTable);
+#else
+ pViaModeTable->fs454MaskTable = fs454MaskTable;
+ for (i = 0; i < VIA_BIOS_NUM_FS454; i++) {
+ pViaModeTable->fs454Table[i] = fs454Table[i];
+ pViaModeTable->fs454OverTable[i] = fs454OverTable[i];
+ }
+#endif
+#ifdef CREATE_SAA7108_HEADERFILE
+ VIAGetSAA7108Mask(pViaModeTable, pBIOS, pTable);
+ VIAGetSAA7108NTSC(pViaModeTable, pBIOS, pTable);
+ VIAGetSAA7108PAL(pViaModeTable, pBIOS, pTable);
+ VIACreateSAA7108(pViaModeTable);
+#else
+ pViaModeTable->saa7108MaskTable = saa7108MaskTable;
+ for (i = 0; i < VIA_BIOS_NUM_SAA7108; i++) {
+ pViaModeTable->saa7108Table[i] = saa7108Table[i];
+ pViaModeTable->saa7108OverTable[i] = saa7108OverTable[i];
+ }
+#endif
+#ifdef CREATE_TV2_HEADERFILE
+ VIAGetTV2Mask(pViaModeTable, pBIOS, pTable);
+ VIAGetTV2NTSC(pViaModeTable, pBIOS, pTable);
+ VIAGetTV2PAL(pViaModeTable, pBIOS, pTable);
+ VIACreateTV2(pViaModeTable);
+#else
+ pViaModeTable->tv2MaskTable = tv2MaskTable;
+ for (i = 0; i < VIA_BIOS_NUM_TV2; i++) {
+ pViaModeTable->tv2Table[i] = tv2Table[i];
+ pViaModeTable->tv2OverTable[i] = tv2OverTable[i];
+ }
+#endif
+#ifdef CREATE_TV3_HEADERFILE
+ VIAGetTV3Mask(pViaModeTable, pBIOS, pTable);
+ VIAGetTV3NTSC(pViaModeTable, pBIOS, pTable);
+ VIAGetTV3PAL(pViaModeTable, pBIOS, pTable);
+ VIACreateTV3(pViaModeTable);
+#else
+ pViaModeTable->tv3MaskTable = tv3MaskTable;
+ for (i = 0; i < VIA_BIOS_NUM_TV3; i++) {
+ pViaModeTable->tv3Table[i] = tv3Table[i];
+ pViaModeTable->tv3OverTable[i] = tv3OverTable[i];
+ }
+#endif
+#ifdef CREATE_VT1622A_HEADERFILE
+ VIAGetTV3Mask(pViaModeTable, pBIOS, pTable);
+ VIAGetTV3NTSC(pViaModeTable, pBIOS, pTable);
+ VIAGetTV3PAL(pViaModeTable, pBIOS, pTable);
+ VIACreateVT1622A(pViaModeTable);
+#else
+ pViaModeTable->vt1622aMaskTable = vt1622aMaskTable;
+ for (i = 0; i < VIA_BIOS_NUM_TV3; i++) {
+ pViaModeTable->vt1622aTable[i] = vt1622aTable[i];
+ pViaModeTable->vt1622aOverTable[i] = vt1622aOverTable[i];
+ }
+#endif
+#ifndef CREATE_MODETABLE_HEADERFILE
+ if (!pBIOSInfo->UseBIOS) {
+ pViaModeTable->BIOSVer = BIOSVer;
+ pViaModeTable->BIOSDate = BIOSDate;
+ pViaModeTable->NumModes = NumModes;
+ pViaModeTable->NumPowerOn = NumPowerOn;
+ pViaModeTable->NumPowerOff = NumPowerOff;
+ pViaModeTable->Modes = Modes;
+ pViaModeTable->commExtTable = commExtTable;
+ pViaModeTable->stdModeExtTable = stdModeExtTable;
+ for (i = 0; i < VIA_BIOS_NUM_RES; i++) {
+ for (j = 0; j < VIA_BIOS_NUM_REFRESH; j++) {
+ pViaModeTable->refreshTable[i][j] = refreshTable[i][j];
+ }
+ }
+ for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) {
+ pViaModeTable->lcdTable[i] = lcdTable[i];
+ }
+ for (i = 0; i < VIA_BIOS_NUM_LCD_POWER_SEQ; i++) {
+ pViaModeTable->powerOn[i] = powerOn[i];
+ pViaModeTable->powerOff[i] = powerOff[i];
+ }
+ pViaModeTable->modeFix = modeFix;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "BIOS Version: %x.%x\n",
+ (pViaModeTable->BIOSVer >> 8), (pViaModeTable->BIOSVer & 0xFF)));
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "BIOS Release Date: %s\n", pViaModeTable->BIOSDate));
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "Get mode table from via_mode.h\n"));
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "-- VIAGetBIOSTable Done!\n"));
+ xfree(pBIOS);
+ return TRUE;
+ }
+#else
+ pBIOSInfo->UseBIOS = TRUE;
+#endif /* #ifndef CREATE_MODETABLE_HEADERFILE */
+
+ /* Get the start of biosver structure */
+ pRom = pTable + VIA_BIOS_BIOSVER_POS;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "bcpPost: %X\n", i, *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ /* The offset should be 44, but the actual image is less three char. */
+ /* pRom += 44; */
+ pRom += 41;
+ pViaModeTable->BIOSVer = *pRom++;
+ pViaModeTable->BIOSVer = (pViaModeTable->BIOSVer << 8) | *pRom;
+ xf86DrvMsg(pBIOSInfo->scrnIndex, X_DEFAULT, "BIOS Version: %x.%x\n",
+ (pViaModeTable->BIOSVer >> 8), (pViaModeTable->BIOSVer & 0xFF));
+
+ /* Get the start of bcpPost structure */
+ pRom = pTable + VIA_BIOS_BCPPOST_POS;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ pViaModeTable->BIOSDate = (char *) xcalloc(9, sizeof(char));
+
+ pRom += 10;
+ for (i = 0; i < 8; i++) {
+ pViaModeTable->BIOSDate[i] = *pRom;
+ pRom++;
+ }
+ xf86DrvMsg(pBIOSInfo->scrnIndex, X_DEFAULT, "BIOS Release Date: %s\n", pViaModeTable->BIOSDate);
+
+ /* Get CSTAB Tables */
+ pRom = pTable + VIA_BIOS_CSTAB_POS;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "cstabExtendEnd: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ pViaModeTable->NumModes = *pRom;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "BIOS Support Mode Numbers: %hu\n", pViaModeTable->NumModes));
+ pViaModeTable->Modes = (VIAModeEntryPtr) xcalloc(pViaModeTable->NumModes,
+ sizeof(VIAModeEntry));
+
+ for (i = 0, j = pViaModeTable->NumModes - 1; i < pViaModeTable->NumModes; i++, j--) {
+ pRom -= 8;
+ pViaModeTable->Modes[j].Mode = *pRom;
+ pViaModeTable->Modes[j].Bpp = *(pRom + 2);
+ pViaModeTable->Modes[j].extModeExtTable.numEntry = 0;
+ pViaModeTable->Modes[j].MClk = 0;
+ pViaModeTable->Modes[j].VClk = 0;
+
+ /* Using Mode Number To Set Resolution */
+ switch (pViaModeTable->Modes[j].Mode) {
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ pViaModeTable->Modes[j].Height = 1024;
+ pViaModeTable->Modes[j].Width = 576;
+ break;
+ case 0x22:
+ case 0x23:
+ case 0x24:
+ pViaModeTable->Modes[j].Height = 300;
+ pViaModeTable->Modes[j].Width = 400;
+ break;
+ case 0x25:
+ case 0x26:
+ case 0x27:
+ pViaModeTable->Modes[j].Height = 384;
+ pViaModeTable->Modes[j].Width = 512;
+ break;
+ case 0x2E:
+ case 0x2F:
+ case 0x30:
+ pViaModeTable->Modes[j].Height = 400;
+ pViaModeTable->Modes[j].Width = 640;
+ break;
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ pViaModeTable->Modes[j].Height = 480;
+ pViaModeTable->Modes[j].Width = 640;
+ break;
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ case 0x38:
+ case 0x39:
+ pViaModeTable->Modes[j].Height = 600;
+ pViaModeTable->Modes[j].Width = 800;
+ break;
+ case 0x3A:
+ case 0x3B:
+ case 0x3C:
+ case 0x3D:
+ case 0x3E:
+ pViaModeTable->Modes[j].Height = 768;
+ pViaModeTable->Modes[j].Width = 1024;
+ break;
+ case 0x3F:
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ pViaModeTable->Modes[j].Height = 864;
+ pViaModeTable->Modes[j].Width = 1152;
+ break;
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ pViaModeTable->Modes[j].Height = 1024;
+ pViaModeTable->Modes[j].Width = 1280;
+ break;
+ case 0x49:
+ case 0x4A:
+ case 0x4B:
+ case 0x4C:
+ case 0x4D:
+ pViaModeTable->Modes[j].Height = 1200;
+ pViaModeTable->Modes[j].Width = 1600;
+ break;
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ pViaModeTable->Modes[j].Height = 1050;
+ pViaModeTable->Modes[j].Width = 1440;
+ break;
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ pViaModeTable->Modes[j].Height = 768;
+ pViaModeTable->Modes[j].Width = 1280;
+ break;
+ case 0x58:
+ case 0x59:
+ case 0x5A:
+ case 0x5B:
+ pViaModeTable->Modes[j].Height = 960;
+ pViaModeTable->Modes[j].Width = 1280;
+ break;
+#if 0
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ pViaModeTable->Modes[j].Height = 1440;
+ pViaModeTable->Modes[j].Width = 1920;
+ break;
+#endif
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ pViaModeTable->Modes[j].Height = 480;
+ pViaModeTable->Modes[j].Width = 848;
+ break;
+ case 0x66:
+ case 0x67:
+ case 0x68:
+ pViaModeTable->Modes[j].Height = 1050;
+ pViaModeTable->Modes[j].Width = 1400;
+ break;
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ pViaModeTable->Modes[j].Height = 480;
+ pViaModeTable->Modes[j].Width = 720;
+ break;
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ pViaModeTable->Modes[j].Height = 576;
+ pViaModeTable->Modes[j].Width = 720;
+ break;
+ case 0x76:
+ case 0x77:
+ case 0x78:
+ pViaModeTable->Modes[j].Height = 512;
+ pViaModeTable->Modes[j].Width = 1024;
+ break;
+ case 0x79:
+ case 0x7A:
+ case 0x7B:
+ pViaModeTable->Modes[j].Height = 480;
+ pViaModeTable->Modes[j].Width = 856;
+ break;
+ case 0x5C:
+ case 0x5D:
+ case 0x5E:
+ pViaModeTable->Modes[j].Height = 200;
+ pViaModeTable->Modes[j].Width = 320;
+ break;
+ case 0x7C:
+ case 0x7D:
+ case 0x7E:
+ pViaModeTable->Modes[j].Height = 240;
+ pViaModeTable->Modes[j].Width = 320;
+ break;
+ default:
+ pViaModeTable->Modes[j].Height = 0;
+ pViaModeTable->Modes[j].Width = 0;
+ break;
+ }
+ }
+
+ /* Get Set Mode Regs. Init. (Standard VGA) */
+ pRom = pTable + VIA_BIOS_STDVGAREGTAB_POS;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "csVidParams: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0; i < pViaModeTable->NumModes; i++) {
+ pViaModeTable->Modes[i].stdVgaTable.columns = *pRom++;
+ pViaModeTable->Modes[i].stdVgaTable.rows = *pRom++;
+ pViaModeTable->Modes[i].stdVgaTable.fontHeight = *pRom++;
+ pViaModeTable->Modes[i].stdVgaTable.pageSize = *((CARD16 *)pRom++);
+
+ pRom++;
+
+ for (j = 1; j < 5; j++) {
+ pViaModeTable->Modes[i].stdVgaTable.SR[j] = *pRom++;
+ }
+
+ pViaModeTable->Modes[i].stdVgaTable.misc = *pRom++;
+
+ for (j = 0; j < 25; j++) {
+ pViaModeTable->Modes[i].stdVgaTable.CR[j] = *pRom++;
+ }
+
+ for (j = 0; j < 20; j++) {
+ pViaModeTable->Modes[i].stdVgaTable.AR[j] = *pRom++;
+ }
+
+ for (j = 0; j < 9; j++) {
+ pViaModeTable->Modes[i].stdVgaTable.GR[j] = *pRom++;
+ }
+ }
+
+ /* Get Commmon Ext. Regs */
+ pRom = pTable + VIA_BIOS_COMMEXTREGTAB_POS;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "Mode_XRegs: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ pViaModeTable->commExtTable.port[j] = *pRom++;
+ pViaModeTable->commExtTable.offset[j] = *pRom++;
+ pViaModeTable->commExtTable.mask[j] = *pRom++;
+ pViaModeTable->commExtTable.data[j] = *pRom++;
+ }
+
+ pViaModeTable->commExtTable.numEntry = j;
+
+ /* Get Standard Mode-Spec. Extend Regs */
+ pRom = pTable + VIA_BIOS_STDMODEXTREGTAB_POS;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "StdMode_XRegs: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ pViaModeTable->stdModeExtTable.port[j] = *pRom++;
+ pViaModeTable->stdModeExtTable.offset[j] = *pRom++;
+ pViaModeTable->stdModeExtTable.mask[j] = *pRom++;
+ pViaModeTable->stdModeExtTable.data[j] = *pRom++;
+ }
+
+ pViaModeTable->stdModeExtTable.numEntry = j;
+
+ /* Get Extended Mode-Spec. Extend Regs */
+ pRom = pTable + VIA_BIOS_EXTMODEREGTAB_POS;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "csextModeTbl: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ while (*pRom != 0xFF) {
+ unsigned char *pExtModeExtTable;
+ CARD16 mode = *pRom;
+
+ for (i = 0; i < pViaModeTable->NumModes; i++) {
+ if (pViaModeTable->Modes[i].Mode == mode)
+ break;
+ }
+
+ if (i == pViaModeTable->NumModes) {
+ /* Cannot find a match mode, skip this mode information */
+ pRom += 11;
+ continue;
+ }
+
+ pViaModeTable->Modes[i].MemNeed = *(pRom + 1);
+ pViaModeTable->Modes[i].VClk = *((CARD16 *)(pRom + 2));
+ pViaModeTable->Modes[i].MClk = *((CARD16 *)(pRom + 4));
+
+ pExtModeExtTable = pBIOS + *((CARD16 *)(pRom + 6));
+
+ for (j = 0; *pExtModeExtTable != 0xFF; j++) {
+ pViaModeTable->Modes[i].extModeExtTable.port[j] = *pExtModeExtTable++;
+ pViaModeTable->Modes[i].extModeExtTable.offset[j] = *pExtModeExtTable++;
+ pViaModeTable->Modes[i].extModeExtTable.mask[j] = *pExtModeExtTable++;
+ pViaModeTable->Modes[i].extModeExtTable.data[j] = *pExtModeExtTable++;
+ }
+
+ pViaModeTable->Modes[i].extModeExtTable.numEntry = j;
+
+ pRom += 11;
+ }
+
+ /* Get Refresh Rate Table */
+ pRom = pTable + VIA_BIOS_REFRESHMODETAB_POS;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "csModeRateTbl: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (i = 0; i < VIA_BIOS_NUM_RES; i++) {
+ for (j = 0; j < VIA_BIOS_NUM_REFRESH; j++) {
+ /* Set all modes is invalid */
+ pViaModeTable->refreshTable[i][j].refresh = 0;
+ }
+ }
+
+ i = 0;
+
+ while (*((CARD16 *)pRom) != 0xFFFF) {
+ if (i >= VIA_BIOS_NUM_RES) {
+ xfree(pBIOS);
+ xfree(pViaModeTable->BIOSDate);
+ xfree(pViaModeTable->Modes);
+ ErrorF("Too much modes for Refresh Table!!\n");
+ return FALSE;
+ }
+
+ pRefreshTableStart = pBIOS + *((CARD16 *)pRom);
+ pRefreshIndexTable = pRefreshTableStart + 3;
+ j = 0;
+
+ while (*pRefreshIndexTable != 0xFF) {
+ if (j >= VIA_BIOS_NUM_REFRESH) {
+ xfree(pBIOS);
+ xfree(pViaModeTable->BIOSDate);
+ xfree(pViaModeTable->Modes);
+ ErrorF("Too much refresh modes for Refresh Table!!\n");
+ return FALSE;
+ }
+
+ switch (*pRefreshIndexTable) {
+ case 0:
+ pViaModeTable->refreshTable[i][j].refresh = 60;
+ break;
+ case 1:
+ pViaModeTable->refreshTable[i][j].refresh = 56;
+ break;
+ case 2:
+ pViaModeTable->refreshTable[i][j].refresh = 65;
+ break;
+ case 3:
+ pViaModeTable->refreshTable[i][j].refresh = 70;
+ break;
+ case 4:
+ pViaModeTable->refreshTable[i][j].refresh = 72;
+ break;
+ case 5:
+ pViaModeTable->refreshTable[i][j].refresh = 75;
+ break;
+ case 6:
+ pViaModeTable->refreshTable[i][j].refresh = 80;
+ break;
+ case 7:
+ pViaModeTable->refreshTable[i][j].refresh = 85;
+ break;
+ case 8:
+ pViaModeTable->refreshTable[i][j].refresh = 90;
+ break;
+ case 9:
+ pViaModeTable->refreshTable[i][j].refresh = 100;
+ break;
+ case 10:
+ pViaModeTable->refreshTable[i][j].refresh = 120;
+ break;
+ default:
+ pViaModeTable->refreshTable[i][j].refresh = 255;
+ break;
+ }
+
+ pRefreshTable = pRefreshTableStart + *(pRefreshIndexTable + 1);
+
+ pViaModeTable->refreshTable[i][j].VClk = *((CARD16 *) pRefreshTable);
+ pRefreshTable += 2;
+
+ for (k = 0; k < 11; k++) {
+ pViaModeTable->refreshTable[i][j].CR[k] = *pRefreshTable++;
+ }
+
+ pRefreshIndexTable += 3;
+ j++;
+ }
+
+ pRom += 2;
+
+ /* Skip Mode table, we don't need it */
+ while (*pRom++ != 0x0)
+ ;
+
+ i++;
+ }
+
+ /* Get BIOS LCD Mode Table */
+ /* Get start of LCD Table */
+ pRom = pTable + VIA_BIOS_LCDMODETAB_POS;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ /* No. of Support Panels */
+ pRom += 6; /* Skip six char. - "FPANEL" */
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "numSuptPanel: %X\n", *pRom));
+ numSuptPanel = *pRom;
+
+ /* Point to LCD 640x480 Table */
+ pRom += 3;
+ pFPanel = pRom;
+
+ for (i = 0; i < numSuptPanel; i++) {
+
+ /* Get fpIndex */
+ pViaModeTable->lcdTable[i].fpIndex = *pRom++;
+
+ /* Get fpSize */
+ pViaModeTable->lcdTable[i].fpSize = *pRom++;
+
+ /* Get No. of Entry */
+ numEntry = *pRom++;
+
+ /* vidMemAdjust skip */
+ pRom++;
+
+ /* Get Table Size */
+ tableSize = *((CARD16 *)pRom);
+
+ /* Get Support Mode Table */
+ pRom += 2;
+ pSuptTable = pRom;
+
+ /* Get Power Seqence Index */
+ pRom += 2;
+ pViaModeTable->lcdTable[i].powerSeq = *pRom++;
+
+ pLCDTable = pRom;
+
+ pRom = pSuptTable;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (j = 0; j < VIA_BIOS_NUM_LCD_SUPPORT_MASK; j++) {
+ pViaModeTable->lcdTable[i].SuptMode[j] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ /* Get FPconfig Table */
+ pRom = pLCDTable;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "FPconfigTbl000%d: %X\n", i, *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ pViaModeTable->lcdTable[i].FPconfigTb.port[j] = *pRom++;
+ pViaModeTable->lcdTable[i].FPconfigTb.offset[j] = *pRom++;
+ pViaModeTable->lcdTable[i].FPconfigTb.data[j] = *pRom++;
+ }
+ pViaModeTable->lcdTable[i].FPconfigTb.numEntry = j;
+
+ /* Get Init Table */
+ pRom = pLCDTable + 2;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ pViaModeTable->lcdTable[i].InitTb.LCDClk = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].InitTb.VClk = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].InitTb.VClk_12Bit = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ /*pViaModeTable->lcdTable[i].InitTb.port[j] = *pRom++;*/
+ pViaModeTable->lcdTable[i].InitTb.port[j] = 0xD4;
+ pViaModeTable->lcdTable[i].InitTb.offset[j] = *pRom++;
+ pViaModeTable->lcdTable[i].InitTb.data[j] = *pRom++;
+ }
+ pViaModeTable->lcdTable[i].InitTb.numEntry = j;
+
+ /* Get MPatchDP2Ctr Table */
+ pRom = pLCDTable + 4;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].Mode = *pRom;
+ pRom++;
+
+ pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk_12Bit = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk_12Bit = *((CARD16 *)(pRom+2));
+ pRom += 4;
+ for (k = 0; *pRom != 0xFF; k++) {
+ pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].port[k] = 0xD4;
+ pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].offset[k] = *pRom++;
+ pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].data[k] = *pRom++;
+ }
+ pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].numEntry = k;
+ pRom++;
+ }
+ pViaModeTable->lcdTable[i].numMPatchDP2Ctr = j;
+
+ /* Get MPatchDP2Exp Table */
+ pRom = pLCDTable + 6;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ pViaModeTable->lcdTable[i].MPatchDP2Exp[j].Mode = *pRom;
+ pRom++;
+
+ pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk_12Bit = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk_12Bit = *((CARD16 *)(pRom+2));
+ pRom += 4;
+ for (k = 0; *pRom != 0xFF; k++) {
+ pViaModeTable->lcdTable[i].MPatchDP2Exp[j].port[k] = 0xD4;
+ pViaModeTable->lcdTable[i].MPatchDP2Exp[j].offset[k] = *pRom++;
+ pViaModeTable->lcdTable[i].MPatchDP2Exp[j].data[k] = *pRom++;
+ }
+ pViaModeTable->lcdTable[i].MPatchDP2Exp[j].numEntry = k;
+ pRom++;
+ }
+ pViaModeTable->lcdTable[i].numMPatchDP2Exp = j;
+
+ /* Get MPatchDP1Ctr Table */
+ pRom = pLCDTable + 8;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].Mode = *pRom;
+ pRom++;
+
+ for (k = 0; *pRom != 0xFF; k++) {
+ pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].port[k] = *pRom++;
+ pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].offset[k] = *pRom++;
+ pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].data[k] = *pRom++;
+ }
+ pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].numEntry = k;
+ pRom++;
+ }
+ pViaModeTable->lcdTable[i].numMPatchDP1Ctr = j;
+
+ /* Get MPatchDP1Exp Table */
+ pRom = pLCDTable + 10;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ pViaModeTable->lcdTable[i].MPatchDP1Exp[j].Mode = *pRom;
+ pRom++;
+
+ for (k = 0; *pRom != 0xFF; k++) {
+ pViaModeTable->lcdTable[i].MPatchDP1Exp[j].port[k] = *pRom++;
+ pViaModeTable->lcdTable[i].MPatchDP1Exp[j].offset[k] = *pRom++;
+ pViaModeTable->lcdTable[i].MPatchDP1Exp[j].data[k] = *pRom++;
+ }
+ pViaModeTable->lcdTable[i].MPatchDP1Exp[j].numEntry = k;
+ pRom++;
+ }
+ pViaModeTable->lcdTable[i].numMPatchDP1Exp = j;
+
+ /* Get LowResCtr Table */
+ pRom = pLCDTable + 12;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ pViaModeTable->lcdTable[i].LowResCtr.LCDClk = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].LowResCtr.VClk = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ pViaModeTable->lcdTable[i].LowResCtr.LCDClk_12Bit = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].LowResCtr.VClk_12Bit = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ /*pViaModeTable->lcdTable[i].LowResCtr.port[j] = *pRom++;*/
+ pViaModeTable->lcdTable[i].LowResCtr.port[j] = 0xD4;
+ pViaModeTable->lcdTable[i].LowResCtr.offset[j] = *pRom++;
+ pViaModeTable->lcdTable[i].LowResCtr.data[j] = *pRom++;
+ }
+ pViaModeTable->lcdTable[i].LowResCtr.numEntry = j;
+
+ /* Get LowResExp Table */
+ pRom = pLCDTable + 14;
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ pViaModeTable->lcdTable[i].LowResExp.LCDClk = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].LowResExp.VClk = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ pViaModeTable->lcdTable[i].LowResExp.LCDClk_12Bit = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].LowResExp.VClk_12Bit = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ /*pViaModeTable->lcdTable[i].LowResExp.port[j] = *pRom++;*/
+ pViaModeTable->lcdTable[i].LowResExp.port[j] = 0xD4;
+ pViaModeTable->lcdTable[i].LowResExp.offset[j] = *pRom++;
+ pViaModeTable->lcdTable[i].LowResExp.data[j] = *pRom++;
+ }
+ pViaModeTable->lcdTable[i].LowResExp.numEntry = j;
+
+ /* No. of Mxxx */
+ numEntry = (numEntry - 8) / 2;
+
+ /* Get MxxxCtr & MxxxExp Table */
+ for (j = 0, m = 8; j < numEntry; j++, m++) {
+ pRom = pLCDTable + (m * 2);
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ if (*pRom == 0xFF) {
+ k = 0;
+ }
+ else {
+ pViaModeTable->lcdTable[i].MCtr[j].LCDClk = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].MCtr[j].VClk = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ pViaModeTable->lcdTable[i].MCtr[j].LCDClk_12Bit = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].MCtr[j].VClk_12Bit = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ for (k = 0; *pRom != 0xFF; k++) {
+ /*pViaModeTable->lcdTable[i].MCtr[j].port[k] = *pRom++;*/
+ pViaModeTable->lcdTable[i].MCtr[j].port[k] = 0xD4;
+ pViaModeTable->lcdTable[i].MCtr[j].offset[k] = *pRom++;
+ pViaModeTable->lcdTable[i].MCtr[j].data[k] = *pRom++;
+ }
+ }
+ pViaModeTable->lcdTable[i].MCtr[j].numEntry = k;
+
+ m++;
+ pRom = pLCDTable + (m * 2);
+ pRom = pBIOS + *((CARD16 *)pRom);
+
+ if (*pRom == 0xFF) {
+ k = 0;
+ }
+ else {
+ pViaModeTable->lcdTable[i].MExp[j].LCDClk = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].MExp[j].VClk = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ pViaModeTable->lcdTable[i].MExp[j].LCDClk_12Bit = *((CARD16 *)pRom);
+ pViaModeTable->lcdTable[i].MExp[j].VClk_12Bit = *((CARD16 *)(pRom+2));
+ pRom += 4;
+
+ for (k = 0; *pRom != 0xFF; k++) {
+ /*pViaModeTable->lcdTable[i].MExp[j].port[k] = *pRom++;*/
+ pViaModeTable->lcdTable[i].MExp[j].port[k] = 0xD4;
+ pViaModeTable->lcdTable[i].MExp[j].offset[k] = *pRom++;
+ pViaModeTable->lcdTable[i].MExp[j].data[k] = *pRom++;
+ }
+ }
+ pViaModeTable->lcdTable[i].MExp[j].numEntry = k;
+ }
+
+ /* Point to Next Support Panel */
+ pRom = pFPanel + tableSize;
+ pFPanel = pRom;
+ }
+
+ /* Get start of PowerOn Seqence Table */
+ if (VIAGetTVTabVer(pBIOSInfo, pBIOS) == 3) {
+ pRom = pTable + VIA_BIOS_LCDPOWERON_POS;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_POWER_ON: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+ }
+ else {
+ pRom = pTable + VIA_BIOS_LCDPOWERON_POS - 2;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_POWER_ON: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+ }
+
+ for (i = 0; (*((CARD16 *)pRom)) != 0xFFFF; i++) {
+ if ((*pRom) == 0xFF)
+ pRom++;
+
+ pViaModeTable->powerOn[i].powerSeq = *pRom++;
+
+ pRom += 2;
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ pViaModeTable->powerOn[i].port[j] = *pRom++;
+ pViaModeTable->powerOn[i].offset[j] = *pRom++;
+ pViaModeTable->powerOn[i].mask[j] = *pRom++;
+ pViaModeTable->powerOn[i].data[j] = *pRom++;
+ pViaModeTable->powerOn[i].delay[j] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ pViaModeTable->powerOn[i].numEntry = j;
+ }
+
+ pViaModeTable->NumPowerOn = i;
+
+ /* Get start of PowerOff Seqence Table */
+ if (VIAGetTVTabVer(pBIOSInfo, pBIOS) == 3) {
+ pRom = pTable + VIA_BIOS_LCDPOWEROFF_POS;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_POWER_OFF: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+ }
+ else {
+ pRom = pTable + VIA_BIOS_LCDPOWEROFF_POS - 4;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_POWER_OFF: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+ }
+
+ for (i = 0; (*((CARD16 *)pRom)) != 0xFFFF; i++) {
+ if ((*pRom) == 0xFF)
+ pRom++;
+
+ pViaModeTable->powerOff[i].powerSeq = *pRom++;
+
+ pRom += 2;
+
+ for (j = 0; *pRom != 0xFF; j++) {
+ pViaModeTable->powerOff[i].port[j] = *pRom++;
+ pViaModeTable->powerOff[i].offset[j] = *pRom++;
+ pViaModeTable->powerOff[i].mask[j] = *pRom++;
+ pViaModeTable->powerOff[i].data[j] = *pRom++;
+ pViaModeTable->powerOff[i].delay[j] = *((CARD16 *)pRom);
+ pRom += 2;
+ }
+
+ pViaModeTable->powerOff[i].numEntry = j;
+ }
+
+ pViaModeTable->NumPowerOff = i;
+
+ /* Get start of Mode Fix Table */
+ if (VIAGetTVTabVer(pBIOSInfo, pBIOS) == 3) {
+ pRom = pTable + VIA_BIOS_LCDMODEFIX_POS;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_MODEFIX: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+ }
+ else {
+ pRom = pTable + VIA_BIOS_LCDMODEFIX_POS - 4;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "LCD_MODEFIX: %X\n", *((CARD16 *)pRom)));
+ pRom = pBIOS + *((CARD16 *)pRom);
+ }
+
+ for (i = 0; *pRom != 0xFF; i++) {
+ pViaModeTable->modeFix.reqMode[i] = *pRom++;
+ pViaModeTable->modeFix.fixMode[i] = *pRom++;
+ }
+
+ pViaModeTable->modeFix.numEntry = i;
+
+ xf86Msg(X_DEFAULT, "VIAGetBIOSTable Done\n");
+
+/* Create Mode Table Header File */
+#ifdef CREATE_MODETABLE_HEADERFILE
+ if (!VIACreateHeaderFile(pViaModeTable)) {
+ xfree(pBIOS);
+ xfree(pViaModeTable->BIOSDate);
+ xfree(pViaModeTable->Modes);
+ return FALSE;
+ }
+#endif /* CREATE_MODETABLE_HEADERFILE */
+
+#ifdef CREATE_TV2_HEADERFILE
+ if (VIAGetTVTabVer(pBIOSInfo, pBIOS) != 2) {
+ ErrorF("BIOS version is wrong!! There is no TV2+ table.\n");
+ xfree(pBIOS);
+ xfree(pViaModeTable->BIOSDate);
+ xfree(pViaModeTable->Modes);
+ return FALSE;
+ }
+ else {
+ if (!VIACreateTV2(pViaModeTable)) {
+ xfree(pBIOS);
+ xfree(pViaModeTable->BIOSDate);
+ xfree(pViaModeTable->Modes);
+ return FALSE;
+ }
+ }
+#endif /* CREATE_TV2_HEADERFILE */
+
+#ifdef DBG_MODETABLE_FILE
+ VIAPrintModeTableFile(pViaModeTable, pBIOS);
+#endif /* DBG_MODETABLE_FILE */
+
+ xfree(pBIOS);
+ return TRUE;
+}
+
+int VIAFindSupportRefreshRate(VIABIOSInfoPtr pBIOSInfo, int resIndex)
+{
+ VIABIOSInfoPtr pVia;
+ int bppIndex, refIndex;
+ int needRefresh;
+ int *supRefTab;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAFindSupportRefreshRate\n"));
+ pVia = pBIOSInfo;
+ bppIndex = 0;
+ supRefTab = NULL;
+ needRefresh = pBIOSInfo->Refresh;
+
+ if (needRefresh <= supportRef[0]) {
+ refIndex = 0;
+ }
+ else if (needRefresh >= supportRef[VIA_NUM_REFRESH_RATE - 1]) {
+ refIndex = VIA_NUM_REFRESH_RATE - 1;
+ }
+ else {
+ for (refIndex = 0; refIndex < VIA_NUM_REFRESH_RATE; refIndex++) {
+ if (needRefresh < supportRef[refIndex + 1]) {
+ break;
+ }
+ }
+ }
+
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ bppIndex = 0;
+ break;
+ case 16:
+ bppIndex = 1;
+ break;
+ case 24:
+ case 32:
+ bppIndex = 2;
+ break;
+ }
+
+ switch (pBIOSInfo->MemClk) {
+ case VIA_MEM_SDR66:
+ case VIA_MEM_SDR100:
+ supRefTab = SDR100[bppIndex][resIndex];
+ break;
+ case VIA_MEM_SDR133:
+ supRefTab = SDR133[bppIndex][resIndex];
+ break;
+ case VIA_MEM_DDR200:
+ supRefTab = DDR200[bppIndex][resIndex];
+ break;
+ case VIA_MEM_DDR266:
+ case VIA_MEM_DDR333:
+ case VIA_MEM_DDR400:
+ supRefTab = DDR266[bppIndex][resIndex];
+ break;
+ }
+
+ for ( ; refIndex >= 0; refIndex--) {
+ if (supRefTab[refIndex]) {
+ needRefresh = supportRef[refIndex];
+ break;
+ }
+ }
+
+ pBIOSInfo->FoundRefresh = needRefresh;
+ return refIndex;
+}
+
+
+Bool VIAFindModeUseBIOSTable(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia = pBIOSInfo;
+ VIAModeTablePtr pViaModeTable;
+ int refresh, maxRefresh, needRefresh, refreshMode;
+ int refIndex;
+ int i, j, k;
+ int modeNum, tmp;
+ Bool setVirtual = FALSE;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAFindModeUseBIOSTable\n"));
+ pViaModeTable = pBIOSInfo->pModeTable;
+
+ i = 0;
+ j = VIA_RES_INVALID;
+
+ /* detemine support highest resolution by Memory clk */
+ VGAOUT8(0x3D4, 0x3D);
+ pBIOSInfo->MemClk = (VGAIN8(0x3D5) & 0xF0) >> 4;
+ if ((pBIOSInfo->bitsPerPixel > 16) && (pBIOSInfo->HDisplay == 1600) &&
+ (pBIOSInfo->VDisplay == 1200) && (pBIOSInfo->MemClk < VIA_MEM_DDR266)) {
+ ErrorF("\n1600x1200 True Color only support in MEMCLK higher than DDR266 platform!!\n");
+ ErrorF("Please use lower bpp or resolution.\n");
+ return FALSE;
+ }
+
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_DFP && (pBIOSInfo->PanelSize == VIA_PANEL_INVALID)) {
+ VIAGetPanelInfo(pBIOSInfo);
+ }
+
+ /* load utility user setting */
+ if (!pBIOSInfo->HasSecondary) {
+ if (!VIALoadUserSetting(pBIOSInfo)){
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_WARNING, "No suitable user setting found!\n"));
+ }
+ }
+ if (!pBIOSInfo->ActiveDevice) {
+ pBIOSInfo->ActiveDevice = VIAGetDeviceDetect(pBIOSInfo);
+ }
+ /* TV + LCD/DVI has no simultaneous, block it */
+ if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV)
+ && (pBIOSInfo->ActiveDevice & (VIA_DEVICE_LCD | VIA_DEVICE_DFP))) {
+ pBIOSInfo->ActiveDevice = VIA_DEVICE_TV;
+ }
+
+ if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) &&
+ (pBIOSInfo->CrtcHDisplay > 1024) && (
+ (pBIOSInfo->TVEncoder == VIA_TV3) ||
+ (pBIOSInfo->TVEncoder == VIA_VT1622A) ||
+ (pBIOSInfo->TVEncoder == VIA_CH7019) ||
+ (pBIOSInfo->TVEncoder == VIA_SAA7108) ||
+ (pBIOSInfo->TVEncoder == VIA_FS454))) {
+ for (i = 0; i < pViaModeTable->NumModes; i++) {
+ if ((pViaModeTable->Modes[i].Bpp == pBIOSInfo->bitsPerPixel) &&
+ (pViaModeTable->Modes[i].Width == 1024) &&
+ (pViaModeTable->Modes[i].Height == 768))
+ break;
+ }
+
+ if (i == pViaModeTable->NumModes) {
+ ErrorF("\nVIASetModeUseBIOSTable: Cannot find suitable mode!!\n");
+ ErrorF("Mode setting in XF86Config(-4) is not supported!!\n");
+ return FALSE;
+ }
+
+ j = VIA_RES_1024X768;
+ pBIOSInfo->frameX1 = 1023;
+ pBIOSInfo->frameY1 = 767;
+ pBIOSInfo->HDisplay = 1024;
+ pBIOSInfo->VDisplay = 768;
+ pBIOSInfo->CrtcHDisplay = 1024;
+ pBIOSInfo->CrtcVDisplay = 768;
+ }
+ else if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) && (pBIOSInfo->CrtcHDisplay > 800)
+ && (pBIOSInfo->TVEncoder == VIA_TV2PLUS)) {
+ for (i = 0; i < pViaModeTable->NumModes; i++) {
+ if ((pViaModeTable->Modes[i].Bpp == pBIOSInfo->bitsPerPixel) &&
+ (pViaModeTable->Modes[i].Width == 800) &&
+ (pViaModeTable->Modes[i].Height == 600))
+ break;
+ }
+
+ if (i == pViaModeTable->NumModes) {
+ ErrorF("\nVIASetModeUseBIOSTable: Cannot find suitable mode!!\n");
+ ErrorF("Mode setting in XF86Config(-4) is not supported!!\n");
+ return FALSE;
+ }
+
+ j = VIA_RES_800X600;
+ pBIOSInfo->frameX1 = 799;
+ pBIOSInfo->frameY1 = 599;
+ pBIOSInfo->HDisplay = 800;
+ pBIOSInfo->VDisplay = 600;
+ pBIOSInfo->CrtcHDisplay = 800;
+ pBIOSInfo->CrtcVDisplay = 600;
+ }
+ else {
+ for (i = 0; i < pViaModeTable->NumModes; i++) {
+ if ((pViaModeTable->Modes[i].Bpp == pBIOSInfo->bitsPerPixel) &&
+ (pViaModeTable->Modes[i].Width == pBIOSInfo->CrtcHDisplay) &&
+ (pViaModeTable->Modes[i].Height == pBIOSInfo->CrtcVDisplay))
+ break;
+ }
+
+ if (i == pViaModeTable->NumModes) {
+ ErrorF("\nVIASetModeUseBIOSTable: Cannot find suitable mode!!\n");
+ ErrorF("Mode setting in XF86Config(-4) is not supported!!\n");
+ return FALSE;
+ }
+
+ modeNum = (int)pViaModeTable->Modes[i].Mode;
+
+ if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) {
+ switch (pBIOSInfo->PanelSize) {
+ case VIA_PANEL6X4:
+ pBIOSInfo->panelX = 640;
+ pBIOSInfo->panelY = 480;
+ j = VIA_RES_640X480;
+ break;
+ case VIA_PANEL8X6:
+ pBIOSInfo->panelX = 800;
+ pBIOSInfo->panelY = 600;
+ j = VIA_RES_800X600;
+ break;
+ case VIA_PANEL10X7:
+ pBIOSInfo->panelX = 1024;
+ pBIOSInfo->panelY = 768;
+ j = VIA_RES_1024X768;
+ break;
+ case VIA_PANEL12X7:
+ pBIOSInfo->panelX = 1280;
+ pBIOSInfo->panelY = 768;
+ j = VIA_RES_1280X768;
+ break;
+ case VIA_PANEL12X10:
+ pBIOSInfo->panelX = 1280;
+ pBIOSInfo->panelY = 1024;
+ j = VIA_RES_1280X1024;
+ break;
+ case VIA_PANEL14X10:
+ pBIOSInfo->panelX = 1400;
+ pBIOSInfo->panelY = 1050;
+ j = VIA_RES_1400X1050;
+ break;
+ case VIA_PANEL16X12:
+ pBIOSInfo->panelX = 1600;
+ pBIOSInfo->panelY = 1200;
+ j = VIA_RES_1600X1200;
+ break;
+ default:
+ pBIOSInfo->PanelSize = VIA_PANEL10X7;
+ pBIOSInfo->panelX = 1024;
+ pBIOSInfo->panelY = 768;
+ j = VIA_RES_1024X768;
+ break;
+ }
+
+ /* Find Panel Size Index */
+ for (k = 0; k < VIA_BIOS_NUM_PANEL; k++) {
+ if (pViaModeTable->lcdTable[k].fpSize == pBIOSInfo->PanelSize)
+ break;
+ };
+
+ tmp = 0x1;
+ tmp = tmp << (modeNum & 0xF);
+ if ((CARD16)(tmp) &
+ pViaModeTable->lcdTable[k].SuptMode[(modeNum >> 4)]) {
+ }
+ else {
+ if ((pBIOSInfo->CrtcHDisplay > pBIOSInfo->panelX) &&
+ (pBIOSInfo->CrtcVDisplay > pBIOSInfo->panelY)) {
+ setVirtual = TRUE;
+ pBIOSInfo->frameX1 = pBIOSInfo->panelX - 1;
+ pBIOSInfo->frameY1 = pBIOSInfo->panelY - 1;
+ pBIOSInfo->HDisplay = pBIOSInfo->panelX;
+ pBIOSInfo->VDisplay = pBIOSInfo->panelY;
+ pBIOSInfo->CrtcHDisplay = pBIOSInfo->panelX;
+ pBIOSInfo->CrtcVDisplay = pBIOSInfo->panelY;
+ }
+ else {
+ pBIOSInfo->DVIAttach = FALSE;
+ pBIOSInfo->scaleY = FALSE;
+ pBIOSInfo->panelX = 0;
+ pBIOSInfo->panelY = 0;
+ }
+ }
+ }
+
+ if (setVirtual) {
+ for (i = 0; i < pViaModeTable->NumModes; i++) {
+ if ((pViaModeTable->Modes[i].Bpp == pBIOSInfo->bitsPerPixel) &&
+ (pViaModeTable->Modes[i].Width == pBIOSInfo->HDisplay) &&
+ (pViaModeTable->Modes[i].Height == pBIOSInfo->VDisplay))
+ break;
+ }
+
+ if (i == pViaModeTable->NumModes) {
+ ErrorF("\nVIASetModeUseBIOSTable: Cannot find suitable mode!!\n");
+ ErrorF("Mode setting in XF86Config(-4) is not supported!!\n");
+ return FALSE;
+ }
+ }
+
+ switch (pBIOSInfo->CrtcVDisplay) {
+ case 480:
+ switch (pBIOSInfo->CrtcHDisplay) {
+ case 640:
+ j = VIA_RES_640X480;
+ break;
+ case 720:
+ j = VIA_RES_720X480;
+ break;
+ case 848:
+ j = VIA_RES_848X480;
+ break;
+ case 856:
+ j = VIA_RES_856X480;
+ break;
+ default:
+ break;
+ }
+ break;
+ case 512:
+ j = VIA_RES_1024X512;
+ break;
+ case 576:
+ switch (pBIOSInfo->CrtcHDisplay) {
+ case 720:
+ j = VIA_RES_720X576;
+ break;
+ case 1024:
+ j = VIA_RES_1024X576;
+ break;
+ default:
+ break;
+ }
+ break;
+ case 600:
+ j = VIA_RES_800X600;
+ break;
+ case 768:
+ switch (pBIOSInfo->CrtcHDisplay) {
+ case 1024:
+ j = VIA_RES_1024X768;
+ break;
+ case 1280:
+ j = VIA_RES_1280X768;
+ break;
+ default:
+ break;
+ }
+ break;
+ case 864:
+ j = VIA_RES_1152X864;
+ break;
+ case 960:
+ j = VIA_RES_1280X960;
+ break;
+ case 1024:
+ j = VIA_RES_1280X1024;
+ break;
+ case 1050:
+ switch (pBIOSInfo->CrtcHDisplay) {
+ case 1440:
+ j = VIA_RES_1440X1050;
+ break;
+ case 1400:
+ j = VIA_RES_1400X1050;
+ break;
+ default:
+ break;
+ }
+ break;
+ case 1200:
+ j = VIA_RES_1600X1200;
+ break;
+ default:
+ j = VIA_RES_INVALID;
+ break;
+ }
+ }
+
+ k = 0;
+
+ if (j != VIA_RES_INVALID) {
+ if (pBIOSInfo->OptRefresh) {
+ pBIOSInfo->Refresh = pBIOSInfo->OptRefresh;
+ refIndex = VIAFindSupportRefreshRate(pBIOSInfo, j);
+ needRefresh = pBIOSInfo->FoundRefresh;
+ if (refIndex < 0) {
+ xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "Mode setting in XF86Config(-4) is not supported!!\n");
+ xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "Please use lower bpp or resolution.\n");
+ return FALSE;
+ }
+ }
+ else {
+ /* use the monitor information */
+ /* needRefresh = (pBIOSInfo->Clock * 1000) / (pBIOSInfo->HTotal * pBIOSInfo->VTotal); */
+ /* Do rounding */
+ needRefresh = ((pBIOSInfo->Clock * 10000) / (pBIOSInfo->HTotal * pBIOSInfo->VTotal) + 5) / 10;
+ pBIOSInfo->Refresh = needRefresh;
+ refIndex = VIAFindSupportRefreshRate(pBIOSInfo, j);
+ needRefresh = pBIOSInfo->FoundRefresh;
+ if (refIndex < 0) {
+ xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "Mode setting in XF86Config(-4) is not supported!!\n");
+ xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "Please use lower bpp or resolution.\n");
+ return FALSE;
+ }
+ }
+
+ refreshMode = 0xFF;
+ maxRefresh = 0;
+
+ while (pViaModeTable->refreshTable[j][k].refresh != 0x0) {
+ refresh = pViaModeTable->refreshTable[j][k].refresh;
+ if (refresh != 0xFF) {
+ if ((refresh <= needRefresh) && (refresh > maxRefresh)) {
+ refreshMode = k;
+ maxRefresh = refresh;
+ }
+ }
+ k++;
+ }
+
+ if ((refreshMode == 0xFF) && (needRefresh < 60)) {
+ xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "VIASetModeUseBIOSTable: Cannot Find suitable refresh!!\n");
+ return FALSE;
+ }
+
+ k = refreshMode;
+ }
+
+ pBIOSInfo->mode = i;
+ pBIOSInfo->resMode = j;
+ pBIOSInfo->refresh = k;
+ /* pBIOSInfo->widthByQWord = (pBIOSInfo->displayWidth * (pBIOSInfo->bitsPerPixel >> 3)) >> 3; */
+ pBIOSInfo->offsetWidthByQWord = (pBIOSInfo->displayWidth * (pBIOSInfo->bitsPerPixel >> 3)) >> 3;
+ pBIOSInfo->countWidthByQWord = (pBIOSInfo->CrtcHDisplay * (pBIOSInfo->bitsPerPixel >> 3)) >> 3;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "pBISOInfo->FoundRefresh: %d\n", pBIOSInfo->FoundRefresh));
+ return TRUE;
+}
+
+void VIASetLCDMode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable;
+ CARD8 modeNum;
+ int resIdx;
+ int port, offset, mask, data;
+ int resMode;
+ int i, j, k, misc;
+
+
+ pVia = pBIOSInfo;
+ pViaModeTable = pBIOSInfo->pModeTable;
+ resMode = pBIOSInfo->resMode;
+ modeNum = (CARD8)(pViaModeTable->Modes[pBIOSInfo->mode].Mode);
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASetLCDMode\n"));
+ /* Panel Size 1600x1200 Not Supported Now*/
+ if (pBIOSInfo->PanelSize == VIA_PANEL16X12) {
+ xfree(pViaModeTable->BIOSDate);
+ xfree(pViaModeTable->Modes);
+ xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "VIASetModeUseBIOSTable: Panel Size Not Support!!\n");
+ }
+
+ /* Find Panel Size Index */
+ for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) {
+ if (pViaModeTable->lcdTable[i].fpSize == pBIOSInfo->PanelSize)
+ break;
+ };
+
+ if (i == VIA_BIOS_NUM_PANEL) {
+ xfree(pViaModeTable->BIOSDate);
+ xfree(pViaModeTable->Modes);
+ xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "VIASetModeUseBIOSTable: Panel Size Not Support!!\n");
+ }
+
+ switch (pBIOSInfo->PanelSize) {
+ case VIA_PANEL6X4:
+ case VIA_PANEL8X6:
+ if (pBIOSInfo->IsSecondary) {
+ VGAOUT8(0x3c4, 0x16);
+ VGAOUT8(0x3c5, 0x08);
+ }
+ else {
+ VGAOUT8(0x3c4, 0x16);
+ VGAOUT8(0x3c5, 0x48);
+ }
+ VGAOUT8(0x3c4, 0x17);
+ VGAOUT8(0x3c5, 0x1F);
+ VGAOUT8(0x3c4, 0x18);
+ VGAOUT8(0x3c5, 0x0E);
+ break;
+ case VIA_PANEL10X7:
+ case VIA_PANEL12X7:
+ case VIA_PANEL12X10:
+ case VIA_PANEL14X10:
+ if (pBIOSInfo->IsSecondary) {
+ VGAOUT8(0x3c4, 0x16);
+ VGAOUT8(0x3c5, 0x0C);
+ }
+ else {
+ VGAOUT8(0x3c4, 0x16);
+ VGAOUT8(0x3c5, 0x4C);
+ }
+ VGAOUT8(0x3c4, 0x17);
+ VGAOUT8(0x3c5, 0x1F);
+ VGAOUT8(0x3c4, 0x18);
+ VGAOUT8(0x3c5, 0x0C);
+ break;
+ case VIA_PANEL16X12:
+ if (pBIOSInfo->IsSecondary) {
+ VGAOUT8(0x3c4, 0x16);
+ VGAOUT8(0x3c5, 0x0F);
+ }
+ else {
+ VGAOUT8(0x3c4, 0x16);
+ VGAOUT8(0x3c5, 0x4F);
+ }
+ VGAOUT8(0x3c4, 0x17);
+ VGAOUT8(0x3c5, 0x1F);
+ VGAOUT8(0x3c4, 0x18);
+ VGAOUT8(0x3c5, 0x0F);
+ break;
+ default:
+ if (pBIOSInfo->IsSecondary) {
+ VGAOUT8(0x3c4, 0x16);
+ VGAOUT8(0x3c5, 0x0C);
+ }
+ else {
+ VGAOUT8(0x3c4, 0x16);
+ VGAOUT8(0x3c5, 0x4C);
+ }
+ VGAOUT8(0x3c4, 0x17);
+ VGAOUT8(0x3c5, 0x1F);
+ VGAOUT8(0x3c4, 0x18);
+ VGAOUT8(0x3c5, 0x0C);
+ break;
+ }
+
+ if (pBIOSInfo->PanelSize == VIA_PANEL12X10) {
+ VGAOUT8(0x3d4, 0x89);
+ VGAOUT8(0x3d5, 0x07);
+ }
+
+ /* LCD Expand Mode Y Scale Flag */
+ pBIOSInfo->scaleY = FALSE;
+
+ /* Set LCD InitTb Regs */
+
+ /* Set LClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk & 0xFF));
+ }
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB);
+
+ if (!pBIOSInfo->IsSecondary) {
+ /* Set VClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk & 0xFF));
+ }
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+ }
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+
+ for (j = 0;
+ j < pViaModeTable->lcdTable[i].InitTb.numEntry;
+ j++)
+ {
+ port = pViaModeTable->lcdTable[i].InitTb.port[j];
+ offset = pViaModeTable->lcdTable[i].InitTb.offset[j];
+ data = pViaModeTable->lcdTable[i].InitTb.data[j];
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ }
+
+ if ((pBIOSInfo->CrtcHDisplay == pBIOSInfo->panelX) &&
+ (pBIOSInfo->CrtcVDisplay == pBIOSInfo->panelY)) {
+ /* Set LClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.LCDClk & 0xFF));
+ }
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB);
+
+ if (!pBIOSInfo->IsSecondary) {
+ /* Set VClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, (pViaModeTable->lcdTable[i].InitTb.VClk & 0xFF));
+ }
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+ }
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+ else {
+ if (!(pBIOSInfo->Center)) {
+ /* LCD Expand Mode Y Scale Flag */
+ pBIOSInfo->scaleY = TRUE;
+ }
+
+ resIdx = VIA_RES_INVALID;
+
+ /* Find MxxxCtr & MxxxExp Index and
+ * HWCursor Y Scale (PanelSize Y / Res. Y) */
+ pBIOSInfo->resY = pBIOSInfo->CrtcVDisplay;
+ switch (resMode) {
+ case VIA_RES_640X480:
+ resIdx = 0;
+ break;
+ case VIA_RES_800X600:
+ resIdx = 1;
+ break;
+ case VIA_RES_1024X768:
+ resIdx = 2;
+ break;
+ case VIA_RES_1152X864:
+ resIdx = 3;
+ break;
+ case VIA_RES_1280X768:
+ case VIA_RES_1280X960:
+ case VIA_RES_1280X1024:
+ if (pBIOSInfo->PanelSize == VIA_PANEL12X10)
+ resIdx = VIA_RES_INVALID;
+ else
+ resIdx = 4;
+ break;
+ default:
+ resIdx = VIA_RES_INVALID;
+ break;
+ }
+
+ if ((pBIOSInfo->CrtcHDisplay == 640) &&
+ (pBIOSInfo->CrtcVDisplay == 400))
+ resIdx = 0;
+
+ if (pBIOSInfo->Center) {
+ if (resIdx != VIA_RES_INVALID) {
+ /* Set LCD MxxxCtr Regs */
+ for (j = 0;
+ j < pViaModeTable->lcdTable[i].MCtr[resIdx].numEntry;
+ j++)
+ {
+ port = pViaModeTable->lcdTable[i].MCtr[resIdx].port[j];
+ offset = pViaModeTable->lcdTable[i].MCtr[resIdx].offset[j];
+ data = pViaModeTable->lcdTable[i].MCtr[resIdx].data[j];
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ }
+
+ /* Set LClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MCtr[resIdx].LCDClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MCtr[resIdx].LCDClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MCtr[resIdx].LCDClk >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MCtr[resIdx].LCDClk & 0xFF));
+ }
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB);
+
+ if (!pBIOSInfo->IsSecondary) {
+ /* Set VClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MCtr[resIdx].VClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MCtr[resIdx].VClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MCtr[resIdx].VClk >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MCtr[resIdx].VClk & 0xFF));
+ }
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+ }
+ }
+
+ for (j = 0; j < pViaModeTable->modeFix.numEntry; j++) {
+ if (pViaModeTable->modeFix.reqMode[j] == modeNum) {
+ modeNum = pViaModeTable->modeFix.fixMode[j];
+ break;
+ }
+ }
+
+ for (j = 0; j < pViaModeTable->lcdTable[i].numMPatchDP2Ctr; j++) {
+ if (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].Mode == modeNum)
+ break;
+ }
+
+ if (j != pViaModeTable->lcdTable[i].numMPatchDP2Ctr) {
+ /* Set LCD MPatchDP2Ctr Regs */
+ for (k = 0;
+ k < pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].numEntry;
+ k++)
+ {
+ port = pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].port[k];
+ offset = pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].offset[k];
+ data = pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].data[k];
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ }
+
+ /* Set LClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].LCDClk & 0xFF));
+ }
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB);
+
+ if (!pBIOSInfo->IsSecondary) {
+ /* Set VClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Ctr[j].VClk & 0xFF));
+ }
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+ }
+ }
+
+ for (j = 0; j < pViaModeTable->lcdTable[i].numMPatchDP1Ctr; j++) {
+ if (pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].Mode == modeNum)
+ break;
+ }
+
+ if ((j != pViaModeTable->lcdTable[i].numMPatchDP1Ctr) &&
+ pBIOSInfo->IsSecondary) {
+ /* Set LCD MPatchDP1Ctr Regs */
+ for (k = 0;
+ k < pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].numEntry;
+ k++)
+ {
+ port = pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].port[k];
+ offset = pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].offset[k];
+ data = pViaModeTable->lcdTable[i].MPatchDP1Ctr[j].data[k];
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ }
+ }
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+
+ }
+ else {
+ if (resIdx != VIA_RES_INVALID) {
+ /* Set LCD MxxxExp Regs */
+ for (j = 0;
+ j < pViaModeTable->lcdTable[i].MExp[resIdx].numEntry;
+ j++)
+ {
+ port = pViaModeTable->lcdTable[i].MExp[resIdx].port[j];
+ offset = pViaModeTable->lcdTable[i].MExp[resIdx].offset[j];
+ data = pViaModeTable->lcdTable[i].MExp[resIdx].data[j];
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ }
+
+ /* Set LClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MExp[resIdx].LCDClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MExp[resIdx].LCDClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MExp[resIdx].LCDClk >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MExp[resIdx].LCDClk & 0xFF));
+ }
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB);
+
+ if (!pBIOSInfo->IsSecondary) {
+ /* Set VClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MExp[resIdx].VClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MExp[resIdx].VClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MExp[resIdx].VClk >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MExp[resIdx].VClk & 0xFF));
+ }
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+ }
+ }
+
+ for (j = 0; j < pViaModeTable->modeFix.numEntry; j++) {
+ if (pViaModeTable->modeFix.reqMode[j] == modeNum) {
+ modeNum = pViaModeTable->modeFix.fixMode[j];
+ break;
+ }
+ }
+
+ for (j = 0; j < pViaModeTable->lcdTable[i].numMPatchDP2Exp; j++) {
+ if (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].Mode == modeNum)
+ break;
+ }
+
+ if (j != pViaModeTable->lcdTable[i].numMPatchDP2Exp) {
+ if (pBIOSInfo->CrtcHDisplay == pBIOSInfo->panelX)
+ pBIOSInfo->scaleY = FALSE;
+ /* Set LCD MPatchExp Regs */
+ for (k = 0;
+ k < pViaModeTable->lcdTable[i].MPatchDP2Exp[j].numEntry;
+ k++)
+ {
+ port = pViaModeTable->lcdTable[i].MPatchDP2Exp[j].port[k];
+ offset = pViaModeTable->lcdTable[i].MPatchDP2Exp[j].offset[k];
+ data = pViaModeTable->lcdTable[i].MPatchDP2Exp[j].data[k];
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ }
+
+ /* Set LClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk >> 8));
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].LCDClk & 0xFF));
+ }
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB);
+
+ if (!pBIOSInfo->IsSecondary) {
+ /* Set VClk */
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk_12Bit >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk_12Bit & 0xFF));
+ }
+ else {
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5,
+ (pViaModeTable->lcdTable[i].MPatchDP2Exp[j].VClk & 0xFF));
+ }
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+ }
+ }
+
+ for (j = 0; j < pViaModeTable->lcdTable[i].numMPatchDP1Exp; j++) {
+ if (pViaModeTable->lcdTable[i].MPatchDP1Exp[j].Mode == modeNum)
+ break;
+ }
+
+ if ((j != pViaModeTable->lcdTable[i].numMPatchDP1Exp) &&
+ pBIOSInfo->IsSecondary) {
+ /* Set LCD MPatchDP1Ctr Regs */
+ for (k = 0;
+ k < pViaModeTable->lcdTable[i].MPatchDP1Exp[j].numEntry;
+ k++)
+ {
+ port = pViaModeTable->lcdTable[i].MPatchDP1Exp[j].port[k];
+ offset = pViaModeTable->lcdTable[i].MPatchDP1Exp[j].offset[k];
+ data = pViaModeTable->lcdTable[i].MPatchDP1Exp[j].data[k];
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ }
+ }
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+ }
+
+ /* CRT Display Source Bit 6 - 0: CRT, 1: LCD */
+ /*
+ VGAOUT8(0x3c4, 0x16);
+ VGAOUT8(0x3c5, 0x50);
+ */
+
+ /* LCD patch 3D5.02 */
+ VGAOUT8(0x3d4, 0x01);
+ misc = VGAIN8(0x3d5);
+ VGAOUT8(0x3d4, 0x02);
+ VGAOUT8(0x3d5, misc);
+
+ /* Delay 1 Millisecond for CRT+LCD Simultaneous. If there is no delay,
+ * LCD will not receive signal when user press Ctrl+Alt++(or +-) to
+ * switch mode. */
+ usleep(1);
+
+ /* Enable LCD */
+ for (j = 0; j < pViaModeTable->NumPowerOn; j++) {
+ if (pViaModeTable->lcdTable[i].powerSeq ==
+ pViaModeTable->powerOn[j].powerSeq)
+ break;
+ }
+
+ for (k = 0; k < pViaModeTable->powerOn[j].numEntry; k++) {
+ port = pViaModeTable->powerOn[j].port[k];
+ offset = pViaModeTable->powerOn[j].offset[k];
+ mask = pViaModeTable->powerOn[j].mask[k];
+ data = pViaModeTable->powerOn[j].data[k] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ usleep(pViaModeTable->powerOn[j].delay[k]);
+ }
+ usleep(1);
+
+ if (!pBIOSInfo->IsSecondary) {
+
+ /* Enable Simultaneous */
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, 0xA8);
+ if (pBIOSInfo->ChipRev > 15) {
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, 0xA3);
+ }
+ else {
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, 0xBF);
+ }
+ }
+ else {
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x08);
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, 0x0);
+ }
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, 0x48);
+ }
+ else {
+
+ /* Enable SAMM */
+ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) {
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, 0x20);
+ if (pBIOSInfo->ChipRev > 15) {
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, 0xA3);
+ }
+ else {
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, 0xBF);
+ }
+ }
+ else {
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, 0);
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, 0x0);
+ }
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, 0xC8);
+ }
+}
+
+void VIAPreSetTV2Mode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ CARD8 *TV;
+ CARD16 *DotCrawl, *Patch2;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ int i, j;
+ unsigned char W_Buffer[VIA_BIOS_MAX_NUM_TV_REG];
+ unsigned char W_Other[2];
+ int w_bytes;
+ I2CDevPtr dev;
+ unsigned char R_Buffer[1];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetTV2Mode\n"));
+ pVia = pBIOSInfo;
+ TV = NULL;
+ DotCrawl = NULL;
+ Patch2 = NULL;
+ W_Buffer[0] = 0;
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) {
+ W_Buffer[i+1] = pBIOSInfo->TVRegs[i];
+ }
+
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ Patch2 = pViaModeTable->tv2Table[tvIndx].PatchPAL2;
+ if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE)
+ TV = pViaModeTable->tv2Table[tvIndx].TVPALC;
+ else
+ TV = pViaModeTable->tv2Table[tvIndx].TVPALS;
+ break;
+ case VIA_TVOVER:
+ Patch2 = pViaModeTable->tv2OverTable[tvIndx].PatchPAL2;
+ if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE)
+ TV = pViaModeTable->tv2OverTable[tvIndx].TVPALC;
+ else
+ TV = pViaModeTable->tv2OverTable[tvIndx].TVPALS;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ Patch2 = pViaModeTable->tv2Table[tvIndx].PatchNTSC2;
+ DotCrawl = pViaModeTable->tv2Table[tvIndx].DotCrawlNTSC;
+ if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE)
+ TV = pViaModeTable->tv2Table[tvIndx].TVNTSCC;
+ else
+ TV = pViaModeTable->tv2Table[tvIndx].TVNTSCS;
+ break;
+ case VIA_TVOVER:
+ Patch2 = pViaModeTable->tv2OverTable[tvIndx].PatchNTSC2;
+ DotCrawl = pViaModeTable->tv2OverTable[tvIndx].DotCrawlNTSC;
+ if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE)
+ TV = pViaModeTable->tv2OverTable[tvIndx].TVNTSCC;
+ else
+ TV = pViaModeTable->tv2OverTable[tvIndx].TVNTSCS;
+ break;
+ }
+ }
+
+ /* Set TV mode */
+ for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numTV; j++) {
+ if (pViaModeTable->tv2MaskTable.TV[j] == 0xFF) {
+ W_Buffer[j+1] = TV[j];
+ i++;
+ }
+ }
+
+ w_bytes = j + 1;
+
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "VT1621";
+ dev->SlaveAddr = 0x40;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ xf86I2CDevInit(dev);
+
+ xf86I2CWriteRead(dev, W_Buffer,w_bytes, NULL,0);
+
+ /* Turn on all Composite and S-Video output */
+ W_Other[0] = 0x0E;
+ W_Other[1] = 0;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+
+ if (pBIOSInfo->TVDotCrawl && (pBIOSInfo->TVType == TVTYPE_NTSC)) {
+ int numReg = (int)(DotCrawl[0]);
+
+ for (i = 1; i < (numReg + 1); i++) {
+ W_Other[0] = (unsigned char)(DotCrawl[i] & 0xFF);
+ if (W_Other[0] == 0x11) {
+ xf86I2CWriteRead(dev, W_Other,1, R_Buffer,1);
+ W_Other[1] = R_Buffer[0] | (unsigned char)(DotCrawl[i] >> 8);
+ }
+ else {
+ W_Other[1] = (unsigned char)(DotCrawl[i] >> 8);
+ }
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ }
+
+ if (pBIOSInfo->IsSecondary) {
+ int numPatch;
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->tv2MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ W_Other[0] = (unsigned char)(Patch2[i] & 0xFF);
+ W_Other[1] = (unsigned char)(Patch2[i] >> 8);
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+}
+
+void VIAPreSetCH7019Mode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ CARD8 *TV;
+ CARD16 *DotCrawl, *Patch2;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ int i, j;
+ unsigned char W_Buffer[VIA_BIOS_MAX_NUM_TV_REG];
+ unsigned char W_Other[2];
+ int w_bytes;
+ I2CDevPtr dev;
+ unsigned char R_Buffer[1];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetCH7019Mode\n"));
+ pVia = pBIOSInfo;
+ DotCrawl = NULL;
+ Patch2 = NULL;
+ TV = NULL;
+ W_Buffer[0] = 0;
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) {
+ W_Buffer[i+1] = pBIOSInfo->TVRegs[i];
+ }
+
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->ch7019Table[tvIndx].TVPAL;
+ Patch2 = pViaModeTable->ch7019Table[tvIndx].PatchPAL2;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->ch7019OverTable[tvIndx].TVPAL;
+ Patch2 = pViaModeTable->ch7019OverTable[tvIndx].PatchPAL2;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->ch7019Table[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->ch7019Table[tvIndx].DotCrawlNTSC;
+ Patch2 = pViaModeTable->ch7019Table[tvIndx].PatchNTSC2;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->ch7019OverTable[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->ch7019OverTable[tvIndx].DotCrawlNTSC;
+ Patch2 = pViaModeTable->ch7019OverTable[tvIndx].PatchNTSC2;
+ break;
+ }
+ }
+
+ for (i = 0, j = 0; i < pViaModeTable->ch7019MaskTable.numTV; j++) {
+ if (pViaModeTable->ch7019MaskTable.TV[j] == 0xFF) {
+ W_Buffer[j+1] = TV[j];
+ i++;
+ }
+ }
+
+ w_bytes = j + 1;
+
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "CH7019";
+ dev->SlaveAddr = 0xEA;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ xf86I2CDevInit(dev);
+
+ /* Disable TV avoid set mode garbage */
+ W_Other[0] = 0x49;
+ W_Other[1] = 0X3E;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ W_Other[0] = 0x1E;
+ W_Other[1] = 0xD0;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+
+ xf86I2CWriteRead(dev, W_Buffer,w_bytes, NULL,0);
+
+ if (pBIOSInfo->TVDotCrawl && (pBIOSInfo->TVType == TVTYPE_NTSC)) {
+ int numReg = (int)(DotCrawl[0]);
+
+ for (i = 1; i < (numReg + 1); i++) {
+ W_Other[0] = (unsigned char)(DotCrawl[i] & 0xFF);
+ if (W_Other[0] == 0x11) {
+ xf86I2CWriteRead(dev, W_Other,1, R_Buffer,1);
+ W_Other[1] = R_Buffer[0] | (unsigned char)(DotCrawl[i] >> 8);
+ }
+ else {
+ W_Other[1] = (unsigned char)(DotCrawl[i] >> 8);
+ }
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ }
+
+ /* Turn TV CH7019 DAC On */
+ W_Other[0] = 0x49;
+ W_Other[1] = 0x20;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+
+ if (pBIOSInfo->IsSecondary) {
+ int numPatch;
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->ch7019MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ W_Other[0] = (unsigned char)(Patch2[i] & 0xFF);
+ W_Other[1] = (unsigned char)(Patch2[i] >> 8);
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+}
+
+void VIAPreSetFS454Mode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ VIABIOSFS454TVMASKTablePtr TVMaskTbl;
+ CARD16 *TV, *DotCrawl, *RGB, *YCbCr;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ int tvType = pBIOSInfo->TVType;
+ int i, numReg;
+ unsigned char W_Buffer[2];
+ unsigned char R_Buffer[1];
+ I2CDevPtr dev;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetFS454Mode\n"));
+ pVia = pBIOSInfo;
+ TV = NULL;
+ DotCrawl = NULL;
+ RGB = NULL;
+ YCbCr = NULL;
+ W_Buffer[0] = 0;
+
+ TVMaskTbl = &pViaModeTable->fs454MaskTable;
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->fs454Table[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->fs454Table[tvIndx].DotCrawlNTSC;
+ RGB = pViaModeTable->fs454Table[tvIndx].RGBNTSC;
+ YCbCr = pViaModeTable->fs454Table[tvIndx].YCbCrNTSC;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->fs454OverTable[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->fs454OverTable[tvIndx].DotCrawlNTSC;
+ RGB = pViaModeTable->fs454OverTable[tvIndx].RGBNTSC;
+ YCbCr = pViaModeTable->fs454OverTable[tvIndx].YCbCrNTSC;
+ break;
+ }
+
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "FS454";
+ dev->SlaveAddr = 0xD4;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ xf86I2CDevInit(dev);
+
+ /* Turn on all Composite and S-Video output */
+ numReg = (int)(TV[0]);
+ for (i = 1; i < (numReg + 1); i++){
+ W_Buffer[0] = (unsigned char)(TV[i] & 0xFF);;
+ W_Buffer[1] = (unsigned char)(TV[i] >> 8);
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ }
+
+ if (pBIOSInfo->TVDotCrawl && (tvType == TVTYPE_NTSC)) {
+ numReg = (int)(DotCrawl[0]);
+ for (i = 1; i < (numReg + 1); i++) {
+ W_Buffer[0] = (unsigned char)(DotCrawl[i] & 0xFF);
+ if (W_Buffer[0] == 0x11) {
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] | (unsigned char)(DotCrawl[i] >> 8);
+ }
+ else {
+ W_Buffer[1] = (unsigned char)(DotCrawl[i] >> 8);
+ }
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ }
+ }
+
+ if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) {
+ numReg = (int)(RGB[0]);
+ for (i = 1; i < (numReg + 1); i++) {
+ W_Buffer[0] = (unsigned char)(RGB[i] & 0xFF);
+ W_Buffer[1] = (unsigned char)(RGB[i] >> 8);
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ }
+ }
+
+ if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) {
+ numReg = (int)(YCbCr[0]);
+ for (i = 1; i < (numReg + 1); i++) {
+ W_Buffer[0] = (unsigned char)(YCbCr[i] & 0xFF);
+ W_Buffer[1] = (unsigned char)(YCbCr[i] >> 8);
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ }
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+}
+
+void VIAPreSetSAA7108Mode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ CARD8 *TV;
+ CARD16 *RGB, *YCbCr, *Patch2;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ int i, j;
+ unsigned char W_Buffer[VIA_BIOS_MAX_NUM_SAA7108_TV_REG];
+ unsigned char W_Other[4];
+ int w_bytes;
+ I2CDevPtr dev;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetSAA7108Mode\n"));
+ pVia = pBIOSInfo;
+ RGB = NULL;
+ YCbCr = NULL;
+ Patch2 = NULL;
+ TV = NULL;
+ W_Buffer[0] = 0;
+ for (i = 0; i < VIA_BIOS_MAX_NUM_SAA7108_TV_REG; i++) {
+ W_Buffer[i+1] = pBIOSInfo->TVRegs[i];
+ }
+
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->saa7108Table[tvIndx].TVPAL;
+ RGB = pViaModeTable->saa7108Table[tvIndx].RGBPAL;
+ YCbCr = pViaModeTable->saa7108Table[tvIndx].YCbCrPAL;
+ Patch2 = pViaModeTable->saa7108Table[tvIndx].PatchPAL2;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->saa7108OverTable[tvIndx].TVPAL;
+ RGB = pViaModeTable->saa7108OverTable[tvIndx].RGBPAL;
+ YCbCr = pViaModeTable->saa7108OverTable[tvIndx].YCbCrPAL;
+ Patch2 = pViaModeTable->saa7108OverTable[tvIndx].PatchPAL2;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->saa7108Table[tvIndx].TVNTSC;
+ RGB = pViaModeTable->saa7108Table[tvIndx].RGBNTSC;
+ YCbCr = pViaModeTable->saa7108Table[tvIndx].YCbCrNTSC;
+ Patch2 = pViaModeTable->saa7108Table[tvIndx].PatchNTSC2;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->saa7108OverTable[tvIndx].TVNTSC;
+ RGB = pViaModeTable->saa7108OverTable[tvIndx].RGBNTSC;
+ YCbCr = pViaModeTable->saa7108OverTable[tvIndx].YCbCrNTSC;
+ Patch2 = pViaModeTable->saa7108OverTable[tvIndx].PatchNTSC2;
+ break;
+ }
+ }
+
+ for (i = 0, j = 0; i < pViaModeTable->saa7108MaskTable.numTV; j++) {
+ if (pViaModeTable->saa7108MaskTable.TV[j] == 0xFF) {
+ W_Buffer[j+1] = TV[j];
+ i++;
+ }
+ }
+
+ w_bytes = j + 1;
+
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "SAA7108";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ xf86I2CDevInit(dev);
+
+ /* Initial SAA7108AE TV Encoder */
+ W_Other[0] = 0x2D;
+ W_Other[1] = 0x08;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ W_Other[0] = 0xFD;
+ W_Other[1] = 0x80;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ W_Other[0] = 0x37;
+ W_Other[1] = 0x12;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ W_Other[0] = 0x3A;
+ W_Other[1] = 0x04;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ W_Other[0] = 0xA2;
+ W_Other[1] = 0x0;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ W_Other[0] = 0xFA;
+ W_Other[1] = 0x07;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ W_Other[0] = 0x17;
+ W_Other[1] = 0x1B;
+ W_Other[2] = 0x1B;
+ W_Other[3] = 0x1F;
+ xf86I2CWriteRead(dev, W_Other,4, NULL,0);
+ W_Other[0] = 0x38;
+ W_Other[1] = 0x1A;
+ W_Other[2] = 0x1A;
+ xf86I2CWriteRead(dev, W_Other,3, NULL,0);
+ W_Other[0] = 0x20;
+ W_Other[1] = 0x0;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+
+ xf86I2CWriteRead(dev, W_Buffer,w_bytes, NULL,0);
+
+ /* Turn on all Composite and S-Video output ,Enable TV */
+ if ((pBIOSInfo->TVOutput == TVOUTPUT_SVIDEO) ||
+ (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE)) {
+ W_Other[0] = 0x2D;
+ W_Other[1] = 0xB4;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ else if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) {
+ int numReg = (int)(RGB[0]);
+ for (i = 1; i < (numReg + 1); i++) {
+ W_Other[0] = (unsigned char)(RGB[i] & 0xFF);
+ W_Other[1] = (unsigned char)(RGB[i] >> 8);
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ W_Other[0] = 0x2D;
+ W_Other[1] = 0;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ else if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) {
+ int numReg = (int)(YCbCr[0]);
+ for (i = 1; i < (numReg + 1); i++) {
+ W_Other[0] = (unsigned char)(YCbCr[i] & 0xFF);
+ W_Other[1] = (unsigned char)(YCbCr[i] >> 8);
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ W_Other[0] = 0x2D;
+ W_Other[1] = 0x84;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+
+ if (pBIOSInfo->IsSecondary) {
+ int numPatch;
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(pViaModeTable->saa7108MaskTable.misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ W_Other[0] = (unsigned char)(Patch2[i] & 0xFF);
+ W_Other[1] = (unsigned char)(Patch2[i] >> 8);
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+}
+
+void VIAPostSetCH7019Mode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ CARD8 *CRTC1, *CRTC2, *Misc1, *Misc2;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ int i, j, data;
+
+ pVia = pBIOSInfo;
+ CRTC1 = NULL;
+ CRTC2 = NULL;
+ Misc1 = NULL;
+ Misc2 = NULL;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostSetCH7019Mode\n"));
+
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->ch7019Table[tvIndx].CRTCPAL1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCPAL2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCPAL2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCPAL2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->ch7019Table[tvIndx].MiscPAL1;
+ Misc2 = pViaModeTable->ch7019Table[tvIndx].MiscPAL2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->ch7019OverTable[tvIndx].CRTCPAL1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCPAL2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCPAL2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCPAL2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->ch7019OverTable[tvIndx].MiscPAL1;
+ Misc2 = pViaModeTable->ch7019OverTable[tvIndx].MiscPAL2;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->ch7019Table[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->ch7019Table[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->ch7019Table[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->ch7019Table[tvIndx].MiscNTSC2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->ch7019OverTable[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->ch7019OverTable[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->ch7019OverTable[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->ch7019OverTable[tvIndx].MiscNTSC2;
+ break;
+ }
+ }
+
+ if (pBIOSInfo->IsSecondary) {
+ for (i = 0, j = 0; i < pViaModeTable->ch7019MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->ch7019MaskTable.CRTC2[j] == 0xFF) {
+ VGAOUT8(0x3d4, j + 0x50);
+ VGAOUT8(0x3d5, CRTC2[j]);
+ i++;
+ }
+ }
+
+ j = 3;
+
+ if (pViaModeTable->ch7019MaskTable.misc2 & 0x18) {
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5, Misc2[j++]);
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5, Misc2[j++]);
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB);
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0xC0);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01);
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01);
+
+ /* Disable LCD Scaling */
+ if (!pBIOSInfo->SAMM || pBIOSInfo->FirstInit) {
+ VGAOUT8(0x3d4, 0x79);
+ VGAOUT8(0x3d5, 0);
+ }
+ }
+ else {
+ for (i = 0, j = 0; i < pViaModeTable->ch7019MaskTable.numCRTC1; j++) {
+ if (pViaModeTable->ch7019MaskTable.CRTC1[j] == 0xFF) {
+ VGAOUT8(0x3d4, j);
+ VGAOUT8(0x3d5, CRTC1[j]);
+ i++;
+ }
+ }
+
+ j = 0;
+
+ VGAOUT8(0x3d4, 0x33);
+ if (Misc1[j] & 0x20) {
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20));
+ j++;
+ }
+ else {
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf));
+ j++;
+ }
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, Misc1[j++]);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, Misc1[j++] | 0x01);
+
+ if (!pBIOSInfo->A2) {
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, (Misc1[j++] & 0xE1) | 0x01);
+ }
+ else {
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, Misc1[j++] | 0x01);
+ }
+
+ if (pViaModeTable->ch7019MaskTable.misc1 & 0x30) {
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, Misc1[j++]);
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, Misc1[j++]);
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+ }
+}
+
+void VIAPostSetFS454Mode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ CARD8 *CRTC1, *CRTC2, *Misc1, *Misc2;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ int i, j, data;
+
+
+ pVia = pBIOSInfo;
+ CRTC1 = NULL;
+ CRTC2 = NULL;
+ Misc1 = NULL;
+ Misc2 = NULL;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostSetFS454Mode\n"));
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->fs454Table[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->fs454Table[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->fs454Table[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->fs454Table[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->fs454Table[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->fs454Table[tvIndx].MiscNTSC2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->fs454OverTable[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->fs454OverTable[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->fs454OverTable[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->fs454OverTable[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->fs454OverTable[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->fs454OverTable[tvIndx].MiscNTSC2;
+ break;
+ }
+
+ for (i = 0, j = 0; i < pViaModeTable->fs454MaskTable.numCRTC1; j++) {
+ if (pViaModeTable->fs454MaskTable.CRTC1[j] == 0xFF) {
+ VGAOUT8(0x3d4, j);
+ VGAOUT8(0x3d5, CRTC1[j]);
+ i++;
+ }
+ }
+
+ j = 0;
+
+ VGAOUT8(0x3d4, 0x33);
+ if (Misc1[j] & 0x20) {
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20));
+ j++;
+ }
+ else {
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf));
+ j++;
+ }
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, Misc1[j++]);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, Misc1[j++] | 0x01);
+
+ if (!pBIOSInfo->A2) {
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, (Misc1[j++] & 0xE1) | 0x01);
+ }
+ else {
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, Misc1[j++] | 0x01);
+ }
+
+ if (pViaModeTable->fs454MaskTable.misc1 & 0x30) {
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, Misc1[j++]);
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, Misc1[j++]);
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+}
+
+void VIAPostSetSAA7108Mode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ CARD8 *CRTC1, *CRTC2, *Misc1, *Misc2;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ int i, j, data;
+
+
+ pVia = pBIOSInfo;
+ CRTC1 = NULL;
+ CRTC2 = NULL;
+ Misc1 = NULL;
+ Misc2 = NULL;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostSetSAA7108Mode\n"));
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->saa7108Table[tvIndx].CRTCPAL1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCPAL2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCPAL2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCPAL2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->saa7108Table[tvIndx].MiscPAL1;
+ Misc2 = pViaModeTable->saa7108Table[tvIndx].MiscPAL2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->saa7108OverTable[tvIndx].CRTCPAL1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCPAL2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCPAL2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCPAL2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->saa7108OverTable[tvIndx].MiscPAL1;
+ Misc2 = pViaModeTable->saa7108OverTable[tvIndx].MiscPAL2;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->saa7108Table[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->saa7108Table[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->saa7108Table[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->saa7108Table[tvIndx].MiscNTSC2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->saa7108OverTable[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->saa7108OverTable[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->saa7108OverTable[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->saa7108OverTable[tvIndx].MiscNTSC2;
+ break;
+ }
+ }
+
+ if (pBIOSInfo->IsSecondary) {
+ for (i = 0, j = 0; i < pViaModeTable->saa7108MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->saa7108MaskTable.CRTC2[j] == 0xFF) {
+ VGAOUT8(0x3d4, j + 0x50);
+ VGAOUT8(0x3d5, CRTC2[j]);
+ i++;
+ }
+ }
+
+ j = 3;
+
+ if (pViaModeTable->saa7108MaskTable.misc2 & 0x18) {
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5, Misc2[j++]);
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5, Misc2[j++]);
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB);
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0xC0);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01);
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01);
+
+ /* Disable LCD Scaling */
+ if (!pBIOSInfo->SAMM || pBIOSInfo->FirstInit) {
+ VGAOUT8(0x3d4, 0x79);
+ VGAOUT8(0x3d5, 0);
+ }
+ }
+ else {
+ for (i = 0, j = 0; i < pViaModeTable->saa7108MaskTable.numCRTC1; j++) {
+ if (pViaModeTable->saa7108MaskTable.CRTC1[j] == 0xFF) {
+ VGAOUT8(0x3d4, j);
+ VGAOUT8(0x3d5, CRTC1[j]);
+ i++;
+ }
+ }
+
+ j = 0;
+
+ VGAOUT8(0x3d4, 0x33);
+ if (Misc1[j] & 0x20) {
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20));
+ j++;
+ }
+ else {
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf));
+ j++;
+ }
+
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, Misc1[j++]);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, Misc1[j++] | 0x01);
+
+ if (!pBIOSInfo->A2) {
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, (Misc1[j++] & 0xE1) | 0x01);
+ }
+ else {
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, Misc1[j++] | 0x01);
+ }
+
+ if (pViaModeTable->saa7108MaskTable.misc1 & 0x30) {
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, Misc1[j++]);
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, Misc1[j++]);
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+ }
+}
+
+void VIAPostSetTV2Mode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ CARD8 *CRTC1, *CRTC2, *Misc1, *Misc2;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ int i, j, data;
+
+
+ pVia = pBIOSInfo;
+ CRTC1 = NULL;
+ CRTC2 = NULL;
+ Misc1 = NULL;
+ Misc2 = NULL;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostSetTV2Mode\n"));
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->tv2Table[tvIndx].CRTCPAL1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCPAL2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCPAL2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCPAL2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->tv2Table[tvIndx].MiscPAL1;
+ Misc2 = pViaModeTable->tv2Table[tvIndx].MiscPAL2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->tv2OverTable[tvIndx].CRTCPAL1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCPAL2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCPAL2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCPAL2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->tv2OverTable[tvIndx].MiscPAL1;
+ Misc2 = pViaModeTable->tv2OverTable[tvIndx].MiscPAL2;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->tv2Table[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->tv2Table[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->tv2Table[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->tv2Table[tvIndx].MiscNTSC2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->tv2OverTable[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->tv2OverTable[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->tv2OverTable[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->tv2OverTable[tvIndx].MiscNTSC2;
+ break;
+ }
+ }
+
+ if (pBIOSInfo->IsSecondary) {
+ for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numCRTC2; j++) {
+ if (pViaModeTable->tv2MaskTable.CRTC2[j] == 0xFF) {
+ VGAOUT8(0x3d4, j + 0x50);
+ VGAOUT8(0x3d5, CRTC2[j]);
+ i++;
+ }
+ }
+
+ j = 3;
+
+ if (pViaModeTable->tv2MaskTable.misc2 & 0x18) {
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5, Misc2[j++]);
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5, Misc2[j++]);
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB);
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0xC0);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01);
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01);
+
+ /* Disable LCD Scaling */
+ if (!pBIOSInfo->SAMM || pBIOSInfo->FirstInit) {
+ VGAOUT8(0x3d4, 0x79);
+ VGAOUT8(0x3d5, 0);
+ }
+ }
+ else {
+ for (i = 0, j = 0; i < pViaModeTable->tv2MaskTable.numCRTC1; j++) {
+ if (pViaModeTable->tv2MaskTable.CRTC1[j] == 0xFF) {
+ VGAOUT8(0x3d4, j);
+ VGAOUT8(0x3d5, CRTC1[j]);
+ i++;
+ }
+ }
+
+ j = 0;
+
+ VGAOUT8(0x3d4, 0x33);
+ if (Misc1[j] & 0x20) {
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20));
+ j++;
+ }
+ else {
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf));
+ j++;
+ }
+
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, Misc1[j++]);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, Misc1[j++] | 0x01);
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, Misc1[j++] | 0x01);
+
+ if (pViaModeTable->tv2MaskTable.misc1 & 0x30) {
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, Misc1[j++]);
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, Misc1[j++]);
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+ }
+}
+
+void VIAPreSetTV3Mode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ VIABIOSTVMASKTablePtr TVMaskTbl;
+ CARD8 *TV;
+ CARD16 *DotCrawl, *RGB, *YCbCr, *Patch2;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ int tvType = pBIOSInfo->TVType;
+ int i, j;
+ unsigned char W_Buffer[VIA_BIOS_MAX_NUM_TV_REG];
+ unsigned char W_Other[2];
+ int w_bytes;
+ I2CDevPtr dev;
+ unsigned char R_Buffer[1];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetTV3Mode\n"));
+ pVia = pBIOSInfo;
+ DotCrawl = NULL;
+ RGB = NULL;
+ YCbCr = NULL;
+ Patch2 = NULL;
+ TV = NULL;
+ W_Buffer[0] = 0;
+ for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) {
+ W_Buffer[i+1] = pBIOSInfo->TVRegs[i];
+ }
+
+ if (pBIOSInfo->TVEncoder == VIA_TV3) {
+ TVMaskTbl = &pViaModeTable->tv3MaskTable;
+ if (tvType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->tv3Table[tvIndx].TVPAL;
+ RGB = pViaModeTable->tv3Table[tvIndx].RGBPAL;
+ YCbCr = pViaModeTable->tv3Table[tvIndx].YCbCrPAL;
+ Patch2 = pViaModeTable->tv3Table[tvIndx].PatchPAL2;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->tv3OverTable[tvIndx].TVPAL;
+ RGB = pViaModeTable->tv3OverTable[tvIndx].RGBPAL;
+ YCbCr = pViaModeTable->tv3OverTable[tvIndx].YCbCrPAL;
+ Patch2 = pViaModeTable->tv3OverTable[tvIndx].PatchPAL2;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->tv3Table[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->tv3Table[tvIndx].DotCrawlNTSC;
+ RGB = pViaModeTable->tv3Table[tvIndx].RGBNTSC;
+ YCbCr = pViaModeTable->tv3Table[tvIndx].YCbCrNTSC;
+ Patch2 = pViaModeTable->tv3Table[tvIndx].PatchNTSC2;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->tv3OverTable[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->tv3OverTable[tvIndx].DotCrawlNTSC;
+ RGB = pViaModeTable->tv3OverTable[tvIndx].RGBNTSC;
+ YCbCr = pViaModeTable->tv3OverTable[tvIndx].YCbCrNTSC;
+ Patch2 = pViaModeTable->tv3OverTable[tvIndx].PatchNTSC2;
+ break;
+ }
+ }
+ }
+ else {
+ TVMaskTbl = &pViaModeTable->vt1622aMaskTable;
+ if (tvType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->vt1622aTable[tvIndx].TVPAL;
+ RGB = pViaModeTable->vt1622aTable[tvIndx].RGBPAL;
+ YCbCr = pViaModeTable->vt1622aTable[tvIndx].YCbCrPAL;
+ Patch2 = pViaModeTable->vt1622aTable[tvIndx].PatchPAL2;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->vt1622aOverTable[tvIndx].TVPAL;
+ RGB = pViaModeTable->vt1622aOverTable[tvIndx].RGBPAL;
+ YCbCr = pViaModeTable->vt1622aOverTable[tvIndx].YCbCrPAL;
+ Patch2 = pViaModeTable->vt1622aOverTable[tvIndx].PatchPAL2;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->vt1622aTable[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->vt1622aTable[tvIndx].DotCrawlNTSC;
+ RGB = pViaModeTable->vt1622aTable[tvIndx].RGBNTSC;
+ YCbCr = pViaModeTable->vt1622aTable[tvIndx].YCbCrNTSC;
+ Patch2 = pViaModeTable->vt1622aTable[tvIndx].PatchNTSC2;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->vt1622aOverTable[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->vt1622aOverTable[tvIndx].DotCrawlNTSC;
+ RGB = pViaModeTable->vt1622aOverTable[tvIndx].RGBNTSC;
+ YCbCr = pViaModeTable->vt1622aOverTable[tvIndx].YCbCrNTSC;
+ Patch2 = pViaModeTable->vt1622aOverTable[tvIndx].PatchNTSC2;
+ break;
+ }
+ }
+ }
+
+ for (i = 0, j = 0; i < TVMaskTbl->numTV; j++) {
+ if (TVMaskTbl->TV[j] == 0xFF) {
+ W_Buffer[j+1] = TV[j];
+ i++;
+ }
+ }
+ w_bytes = j + 1;
+
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "VT1622";
+ dev->SlaveAddr = 0x40;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ xf86I2CDevInit(dev);
+
+ /* TV Reset */
+ W_Other[0] = 0x1D;
+ W_Other[1] = 0;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ W_Other[0] = 0x1D;
+ W_Other[1] = 0x80;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+
+ xf86I2CWriteRead(dev, W_Buffer,w_bytes, NULL,0);
+
+ /* Turn on all Composite and S-Video output */
+ W_Other[0] = 0x0E;
+ W_Other[1] = 0;
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+
+ if (pBIOSInfo->TVDotCrawl && (tvType == TVTYPE_NTSC)) {
+ int numReg = (int)(DotCrawl[0]);
+
+ for (i = 1; i < (numReg + 1); i++) {
+ W_Other[0] = (unsigned char)(DotCrawl[i] & 0xFF);
+ if (W_Other[0] == 0x11) {
+ xf86I2CWriteRead(dev, W_Other,1, R_Buffer,1);
+ W_Other[1] = R_Buffer[0] | (unsigned char)(DotCrawl[i] >> 8);
+ }
+ else {
+ W_Other[1] = (unsigned char)(DotCrawl[i] >> 8);
+ }
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ }
+
+ if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) {
+ int numReg = (int)(RGB[0]);
+
+ for (i = 1; i < (numReg + 1); i++) {
+ W_Other[0] = (unsigned char)(RGB[i] & 0xFF);
+ W_Other[1] = (unsigned char)(RGB[i] >> 8);
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+
+ }
+
+ if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) {
+ int numReg = (int)(YCbCr[0]);
+
+ for (i = 1; i < (numReg + 1); i++) {
+ W_Other[0] = (unsigned char)(YCbCr[i] & 0xFF);
+ W_Other[1] = (unsigned char)(YCbCr[i] >> 8);
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+
+ }
+
+ if (pBIOSInfo->IsSecondary) {
+ int numPatch;
+
+ /* Patch as setting 2nd path */
+ numPatch = (int)(TVMaskTbl->misc2 >> 5);
+ for (i = 0; i < numPatch; i++) {
+ W_Other[0] = (unsigned char)(Patch2[i] & 0xFF);
+ W_Other[1] = (unsigned char)(Patch2[i] >> 8);
+ xf86I2CWriteRead(dev, W_Other,2, NULL,0);
+ }
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+}
+
+void VIAPostSetTV3Mode(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ VIABIOSTVMASKTablePtr TVMaskTbl;
+ CARD8 *CRTC1, *CRTC2, *Misc1, *Misc2;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ int i, j, data;
+
+
+ pVia = pBIOSInfo;
+ CRTC1 = NULL;
+ CRTC2 = NULL;
+ Misc1 = NULL;
+ Misc2 = NULL;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPostSetTV3Mode\n"));
+ if (pBIOSInfo->TVEncoder == VIA_TV3) {
+ TVMaskTbl = &pViaModeTable->tv3MaskTable;
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->tv3Table[tvIndx].CRTCPAL1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCPAL2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCPAL2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCPAL2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->tv3Table[tvIndx].MiscPAL1;
+ Misc2 = pViaModeTable->tv3Table[tvIndx].MiscPAL2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->tv3OverTable[tvIndx].CRTCPAL1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCPAL2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCPAL2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCPAL2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->tv3OverTable[tvIndx].MiscPAL1;
+ Misc2 = pViaModeTable->tv3OverTable[tvIndx].MiscPAL2;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->tv3Table[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->tv3Table[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->tv3Table[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->tv3Table[tvIndx].MiscNTSC2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->tv3OverTable[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->tv3OverTable[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->tv3OverTable[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->tv3OverTable[tvIndx].MiscNTSC2;
+ break;
+ }
+ }
+ }
+ else {
+ TVMaskTbl = &pViaModeTable->vt1622aMaskTable;
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->vt1622aTable[tvIndx].CRTCPAL1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCPAL2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCPAL2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCPAL2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->vt1622aTable[tvIndx].MiscPAL1;
+ Misc2 = pViaModeTable->vt1622aTable[tvIndx].MiscPAL2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCPAL1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCPAL2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCPAL2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCPAL2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->vt1622aOverTable[tvIndx].MiscPAL1;
+ Misc2 = pViaModeTable->vt1622aOverTable[tvIndx].MiscPAL2;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ CRTC1 = pViaModeTable->vt1622aTable[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->vt1622aTable[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->vt1622aTable[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->vt1622aTable[tvIndx].MiscNTSC2;
+ break;
+ case VIA_TVOVER:
+ CRTC1 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCNTSC1;
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCNTSC2_8BPP;
+ break;
+ case 16:
+ CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCNTSC2_16BPP;
+ break;
+ case 24:
+ case 32:
+ CRTC2 = pViaModeTable->vt1622aOverTable[tvIndx].CRTCNTSC2_32BPP;
+ break;
+ }
+ Misc1 = pViaModeTable->vt1622aOverTable[tvIndx].MiscNTSC1;
+ Misc2 = pViaModeTable->vt1622aOverTable[tvIndx].MiscNTSC2;
+ break;
+ }
+ }
+ }
+
+ if (pBIOSInfo->IsSecondary) {
+ for (i = 0, j = 0; i < TVMaskTbl->numCRTC2; j++) {
+ if (TVMaskTbl->CRTC2[j] == 0xFF) {
+ VGAOUT8(0x3d4, j + 0x50);
+ VGAOUT8(0x3d5, CRTC2[j]);
+ i++;
+ }
+ }
+
+ j = 3;
+
+ if (TVMaskTbl->misc2 & 0x18) {
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5, Misc2[j++]);
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5, Misc2[j++]);
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x04);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFB);
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0xC0);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01);
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x01);
+
+ /* Disable LCD Scaling */
+ if (!pBIOSInfo->SAMM || pBIOSInfo->FirstInit) {
+ VGAOUT8(0x3d4, 0x79);
+ VGAOUT8(0x3d5, 0);
+ }
+ }
+ else {
+ for (i = 0, j = 0; i < TVMaskTbl->numCRTC1; j++) {
+ if (TVMaskTbl->CRTC1[j] == 0xFF) {
+ VGAOUT8(0x3d4, j);
+ VGAOUT8(0x3d5, CRTC1[j]);
+ i++;
+ }
+ }
+
+ j = 0;
+
+ VGAOUT8(0x3d4, 0x33);
+ if (Misc1[j] & 0x20) {
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20));
+ j++;
+ }
+ else {
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf));
+ j++;
+ }
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, Misc1[j++]);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, Misc1[j++] | 0x01);
+
+ if (!pBIOSInfo->A2) {
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, (Misc1[j++] & 0xE1) | 0x01);
+ }
+ else {
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, Misc1[j++] | 0x01);
+ }
+
+ if (TVMaskTbl->misc1 & 0x30) {
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, Misc1[j++]);
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, Misc1[j++]);
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+ }
+}
+
+void VIADisableExtendedFIFO(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ CARD32 dwTemp;
+
+ pVia = pBIOSInfo;
+
+ dwTemp = (CARD32)VIAGETREG(0x298);
+ dwTemp |= 0x20000000;
+ VIASETREG(0x298, dwTemp);
+
+ dwTemp = (CARD32)VIAGETREG(0x230);
+ dwTemp &= ~0x00200000;
+ VIASETREG(0x230, dwTemp);
+
+ dwTemp = (CARD32)VIAGETREG(0x298);
+ dwTemp &= ~0x20000000;
+ VIASETREG(0x298, dwTemp);
+}
+
+
+void VIAEnableExtendedFIFO(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ CARD32 dwTemp;
+ CARD8 bTemp;
+
+ pVia = pBIOSInfo;
+
+ dwTemp = (CARD32)VIAGETREG(0x298);
+ dwTemp |= 0x20000000;
+ VIASETREG(0x298, dwTemp);
+
+ dwTemp = (CARD32)VIAGETREG(0x230);
+ dwTemp |= 0x00200000;
+ VIASETREG(0x230, dwTemp);
+
+ dwTemp = (CARD32)VIAGETREG(0x298);
+ dwTemp &= ~0x20000000;
+ VIASETREG(0x298, dwTemp);
+
+ VGAOUT8(0x3C4, 0x17);
+ bTemp = VGAIN8(0x3C5);
+ bTemp &= ~0x7F;
+ bTemp |= 0x2F;
+ VGAOUT8(0x3C5, bTemp);
+
+ VGAOUT8(0x3C4, 0x16);
+ bTemp = VGAIN8(0x3C5);
+ bTemp &= ~0x3F;
+ bTemp |= 0x17;
+ VGAOUT8(0x3C5, bTemp);
+
+ VGAOUT8(0x3C4, 0x18);
+ bTemp = VGAIN8(0x3C5);
+ bTemp &= ~0x3F;
+ bTemp |= 0x17;
+ bTemp |= 0x40; /* force the preq always higher than treq */
+ VGAOUT8(0x3C5, bTemp);
+}
+
+
+Bool VIASetModeUseBIOSTable(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ UTUSERSETTINGptr pUTUSERSETTING = pBIOSInfo->pUTUSERSETTING;
+ BOOL setTV = FALSE;
+ int mode, resMode, refresh;
+ int port, offset, mask, data;
+ int countWidthByQWord, offsetWidthByQWord;
+ int i, j, k, m, n;
+ unsigned char cr13, cr35, sr1c, sr1d;
+ CARD8 misc;
+
+ pVia = pBIOSInfo;
+ mode = pBIOSInfo->mode;
+ resMode = pBIOSInfo->resMode;
+ refresh = pBIOSInfo->refresh;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASetModeUseBIOSTable\n"));
+ /* Turn off Screen */
+ VGAOUT8(0x3d4, 17);
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0x7f));
+
+ /* Clean Second Path Status */
+ if (pBIOSInfo->SAMM) {
+ if (pBIOSInfo->FirstInit) {
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, 0x40);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x3E);
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0xFE);
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, 0x0);
+ }
+ }
+ else {
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, 0x0);
+ VGAOUT8(0x3d4, 0x6B);
+ VGAOUT8(0x3d5, 0x0);
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, 0x0);
+ VGAOUT8(0x3d4, 0x93);
+ VGAOUT8(0x3d5, 0x0);
+ }
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "Active Device is %d\n",
+ pBIOSInfo->ActiveDevice));
+
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ /* Found TV resmod index */
+ switch (pBIOSInfo->resMode) {
+ case VIA_RES_640X480 :
+ pBIOSInfo->resTVMode = VIA_TVRES_640X480;
+ break;
+ case VIA_RES_800X600 :
+ pBIOSInfo->resTVMode = VIA_TVRES_800X600;
+ break;
+ case VIA_RES_1024X768 :
+ pBIOSInfo->resTVMode = VIA_TVRES_1024X768;
+ break;
+ case VIA_RES_848X480 :
+ pBIOSInfo->resTVMode = VIA_TVRES_848X480;
+ break;
+ case VIA_RES_720X480 :
+ pBIOSInfo->resTVMode = VIA_TVRES_720X480;
+ pBIOSInfo->TVType = TVTYPE_NTSC;
+ break;
+ case VIA_RES_720X576 :
+ pBIOSInfo->resTVMode = VIA_TVRES_720X576;
+ pBIOSInfo->TVType = TVTYPE_PAL;
+ break;
+ default :
+ pBIOSInfo->resTVMode = pBIOSInfo->resMode;
+ break;
+ }
+
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600) {
+ setTV = TRUE;
+ VIAPreSetTV2Mode(pBIOSInfo);
+ }
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 ||
+ resMode == VIA_RES_1024X768 || resMode == VIA_RES_720X480 ||
+ resMode == VIA_RES_720X576 || resMode == VIA_RES_848X480) {
+ setTV = TRUE;
+ VIAPreSetTV3Mode(pBIOSInfo);
+ }
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 ||
+ resMode == VIA_RES_1024X768) {
+ setTV = TRUE;
+ VIAPreSetCH7019Mode(pBIOSInfo);
+ }
+ break;
+ case VIA_SAA7108:
+ if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 ||
+ resMode == VIA_RES_1024X768 || resMode == VIA_RES_848X480) {
+ setTV = TRUE;
+ VIAPreSetSAA7108Mode(pBIOSInfo);
+ }
+ break;
+ case VIA_FS454:
+ if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 ||
+ resMode == VIA_RES_1024X768 || resMode == VIA_RES_720X480) {
+ setTV = TRUE;
+ VIAPreSetFS454Mode(pBIOSInfo);
+ }
+ break;
+ }
+ }
+
+ /* Close TV Output, if TVEncoder not support current resolution */
+ if (!setTV && !pBIOSInfo->SAMM) {
+ I2CDevPtr dev;
+ unsigned char W_Buffer[2];
+
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ W_Buffer[0] = 0x0E;
+ W_Buffer[1] = 0x03;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ W_Buffer[0] = 0x0E;
+ W_Buffer[1] = 0x0F;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_CH7019:
+ W_Buffer[0] = 0x49;
+ W_Buffer[1] = 0x3E;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x1E;
+ W_Buffer[1] = 0xD0;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_SAA7108:
+ W_Buffer[0] = 0x2D;
+ W_Buffer[1] = 0x08;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_FS454:
+ default:
+ break;
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+
+ i = mode;
+
+ /* Get Standard VGA Regs */
+ /* Set Sequences regs */
+ for (j = 1; j < 5; j++) {
+ VGAOUT8(0x3c4, j);
+ VGAOUT8(0x3c5, pViaModeTable->Modes[i].stdVgaTable.SR[j]);
+ }
+
+ /* Set Misc reg */
+ VGAOUT8(0x3c2, pViaModeTable->Modes[i].stdVgaTable.misc);
+
+ /* Set CRTC regs */
+ for (j = 0; j < 25; j++) {
+ VGAOUT8(0x3d4, j);
+ VGAOUT8(0x3d5, pViaModeTable->Modes[i].stdVgaTable.CR[j]);
+ }
+
+ /* Set attribute regs */
+ for (j = 0; j < 20; j++) {
+ misc = VGAIN8(0x3da);
+ VGAOUT8(0x3c0, j);
+ VGAOUT8(0x3c0, pViaModeTable->Modes[i].stdVgaTable.AR[j]);
+ }
+
+ for (j = 0; j < 9; j++) {
+ VGAOUT8(0x3ce, j);
+ VGAOUT8(0x3cf, pViaModeTable->Modes[i].stdVgaTable.GR[j]);
+ }
+
+ /* Unlock Extended regs */
+ VGAOUT8(0x3c4, 0x10);
+ VGAOUT8(0x3c5, 0x01);
+
+ /* Set Commmon Ext. Regs */
+ for (j = 0; j < pViaModeTable->commExtTable.numEntry; j++) {
+ port = pViaModeTable->commExtTable.port[j];
+ offset = pViaModeTable->commExtTable.offset[j];
+ mask = pViaModeTable->commExtTable.mask[j];
+ data = pViaModeTable->commExtTable.data[j] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ }
+
+ if (pViaModeTable->Modes[i].Mode <= 0x13) {
+ /* Set Standard Mode-Spec. Extend Regs */
+ for (j = 0; j < pViaModeTable->stdModeExtTable.numEntry; j++) {
+ port = pViaModeTable->stdModeExtTable.port[j];
+ offset = pViaModeTable->stdModeExtTable.offset[j];
+ mask = pViaModeTable->stdModeExtTable.mask[j];
+ data = pViaModeTable->stdModeExtTable.data[j] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ }
+ }
+ else {
+ /* Set Extended Mode-Spec. Extend Regs */
+ for (j = 0; j < pViaModeTable->Modes[i].extModeExtTable.numEntry; j++) {
+ port = pViaModeTable->Modes[i].extModeExtTable.port[j];
+ offset = pViaModeTable->Modes[i].extModeExtTable.offset[j];
+ mask = pViaModeTable->Modes[i].extModeExtTable.mask[j];
+ data = pViaModeTable->Modes[i].extModeExtTable.data[j] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, data);
+ }
+ }
+
+ j = resMode;
+
+ if ((j != VIA_RES_INVALID) && (refresh != 0xFF) && !setTV) {
+ k = refresh;
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, (pViaModeTable->refreshTable[j][k].VClk >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, (pViaModeTable->refreshTable[j][k].VClk & 0xFF));
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+
+ m = 0;
+ VGAOUT8(0x3d4, 0x0);
+ VGAOUT8(0x3d5, pViaModeTable->refreshTable[j][k].CR[m++]);
+
+ for (n = 2; n <= 7; n++) {
+ VGAOUT8(0x3d4, n);
+ VGAOUT8(0x3d5, pViaModeTable->refreshTable[j][k].CR[m++]);
+ }
+
+ for (n = 16; n <= 17; n++) {
+ VGAOUT8(0x3d4, n);
+ VGAOUT8(0x3d5, pViaModeTable->refreshTable[j][k].CR[m++]);
+ }
+
+ for (n = 21; n <= 22; n++) {
+ VGAOUT8(0x3d4, n);
+ VGAOUT8(0x3d5, pViaModeTable->refreshTable[j][k].CR[m++]);
+ }
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+
+ }
+ else {
+ if (pViaModeTable->Modes[i].VClk != 0) {
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0x7F);
+
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, (pViaModeTable->Modes[i].VClk >> 8));
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, (pViaModeTable->Modes[i].VClk & 0xFF));
+
+ VGAOUT8(0x3d4, 0x17);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x80);
+
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) | 0x02);
+ VGAOUT8(0x3c4, 0x40);
+ VGAOUT8(0x3c5, VGAIN8(0x3c5) & 0xFD);
+
+ /* Use external clock */
+ data = VGAIN8(0x3cc) | 0x0C;
+ VGAOUT8(0x3c2, data);
+ }
+ }
+
+ /* Set Quadword offset and counter */
+ /*=* Fix bandwidth problem when using virtual desktop *=*/
+ countWidthByQWord = pBIOSInfo->countWidthByQWord;
+ offsetWidthByQWord = pBIOSInfo->offsetWidthByQWord;
+
+ VGAOUT8(0x3d4, 0x35);
+ cr35 = VGAIN8(0x3d5) & 0x1f;
+
+ cr13 = offsetWidthByQWord & 0xFF;
+ cr35 |= (offsetWidthByQWord & 0x700) >> 3; /* bit 7:5: offset 10:8 */
+
+ VGAOUT8(0x3c4, 0x1d);
+ sr1d = VGAIN8(0x3c5);
+
+ /* Enable Refresh to avoid data lose when enter screen saver */
+ /* Refresh disable & 128-bit alignment */
+ sr1d = (sr1d & 0xfc) | (countWidthByQWord >> 9);
+ sr1c = ((countWidthByQWord >> 1) + 1) & 0xff;
+ /* sr1d = ((sr1d & 0xfc) | (widthByQWord >> 8)) | 0x80; */
+ /* sr1c = widthByQWord & 0xff; */
+
+ VGAOUT8(0x3d4, 0x13);
+ VGAOUT8(0x3d5, cr13);
+ VGAOUT8(0x3d4, 0x35);
+ VGAOUT8(0x3d5, cr35);
+ VGAOUT8(0x3c4, 0x1c);
+ VGAOUT8(0x3c5, sr1c);
+ VGAOUT8(0x3c4, 0x1d);
+ VGAOUT8(0x3c5, sr1d);
+
+ /* Enable MMIO & PCI burst (1 wait state) */
+ VGAOUT8(0x3c4, 0x1a);
+ data = VGAIN8(0x3c5);
+ VGAOUT8(0x3c5, data | 0x06);
+
+ /* Enable modify CRTC starting address */
+ VGAOUT8(0x3d4, 0x11);
+ misc = VGAIN8(0x3d5);
+ VGAOUT8(0x3d5, misc & 0x7f);
+
+ if (pBIOSInfo->FirstInit) {
+ /* Clear Memory */
+ memset(pBIOSInfo->FBBase, 0x00, pBIOSInfo->videoRambytes);
+ /*pBIOSInfo->FirstInit = FALSE;*/
+ }
+
+ /*=* Patch for horizontal blanking end bit6 *=*/
+ VGAOUT8(0x3d4, 0x02);
+ data = VGAIN8(0x3d5); /* Save Blanking Start */
+
+ VGAOUT8(0x3d4, 0x03);
+ misc = VGAIN8(0x3d5) & 0x1f; /* Save Blanking End bit[4:0] */
+
+ VGAOUT8(0x3d4, 0x05);
+ misc |= ((VGAIN8(0x3d5) & 0x80) >> 2); /* Blanking End bit[5:0] */
+
+ if ((data & 0x3f) > misc) { /* Is Blanking End overflow ? */
+ if (data & 0x40) { /* Blanking Start bit6 = ? */
+ VGAOUT8(0x3d4, 0x33); /* bit6 = 1, Blanking End bit6 = 0 */
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf));
+ }
+ else {
+ VGAOUT8(0x3d4, 0x33); /* bit6 = 0, Blanking End bit6 = 1 */
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20));
+ }
+ }
+ else {
+ if (data & 0x40) { /* Blanking Start bit6 = ? */
+ VGAOUT8(0x3d4, 0x33); /* bit6 = 1, Blanking End bit6 = 1 */
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) | 0x20));
+ }
+ else {
+ VGAOUT8(0x3d4, 0x33); /* bit6 = 0, Blanking End bit6 = 0 */
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xdf));
+ }
+ }
+
+ /* LCD Simultaneous Set Mode */
+ if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD))
+ VIASetLCDMode(pBIOSInfo);
+
+ if (setTV) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ VIAPostSetTV2Mode(pBIOSInfo);
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ VIAPostSetTV3Mode(pBIOSInfo);
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ VIAPostSetCH7019Mode(pBIOSInfo);
+ break;
+ case VIA_SAA7108:
+ VIAPostSetSAA7108Mode(pBIOSInfo);
+ break;
+ case VIA_FS454:
+ VIAPostSetFS454Mode(pBIOSInfo);
+ break;
+ }
+ }
+
+ /* load/save TV attribute for utility. */
+ if (!pBIOSInfo->HasSecondary && (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV)) {
+ /* Read User Setting */
+ if (pUTUSERSETTING->DefaultSetting) {
+ VIARestoreUserSetting(pBIOSInfo);
+ }
+ else { /* Read from I2C */
+ UTGetInfo(pBIOSInfo);
+ }
+ }
+
+ /* Enable extended FIFO if the resolution > 1024x768 */
+ if (pBIOSInfo->CrtcHDisplay > 1024) {
+ VIAEnableExtendedFIFO(pBIOSInfo);
+ }
+ else {
+ VIADisableExtendedFIFO(pBIOSInfo);
+ }
+
+ /* Enable CRT Controller (3D5.17 Hardware Reset) */
+ VGAOUT8(0x3d4, 0x17);
+ misc = VGAIN8(0x3d5);
+ VGAOUT8(0x3d5, (misc | 0x80));
+
+ /* Turn off CRT, if user doesn't want crt on */
+ if (!(pBIOSInfo->ActiveDevice & VIA_DEVICE_CRT1)) {
+ VGAOUT8(0x3d4, 0x36);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x30);
+ }
+
+ /* Open Screen */
+ misc = VGAIN8(0x3da);
+ VGAOUT8(0x3c0, 0x20);
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "-- VIASetModeUseBIOSTable Done!\n"));
+ return TRUE;
+}
+
+Bool VIASetModeForMHS(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia;
+ BOOL setTV = FALSE;
+ int mode, resMode, refresh;
+ int countWidthByQWord, offsetWidthByQWord;
+ unsigned char cr65, cr66, cr67;
+ CARD8 misc;
+
+
+ pVia = pBIOSInfo;
+ mode = pBIOSInfo->mode;
+ resMode = pBIOSInfo->resMode;
+ refresh = pBIOSInfo->refresh;
+ pBIOSInfo->SetTV = FALSE;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASetModeForMHS\n"));
+ /* Turn off Screen */
+ VGAOUT8(0x3d4, 17);
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0x7f));
+
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ /* Found TV resmod index */
+ switch (pBIOSInfo->resMode) {
+ case VIA_RES_640X480 :
+ pBIOSInfo->resTVMode = VIA_TVRES_640X480;
+ break;
+ case VIA_RES_800X600 :
+ pBIOSInfo->resTVMode = VIA_TVRES_800X600;
+ break;
+ case VIA_RES_1024X768 :
+ pBIOSInfo->resTVMode = VIA_TVRES_1024X768;
+ break;
+ case VIA_RES_848X480 :
+ pBIOSInfo->resTVMode = VIA_TVRES_848X480;
+ break;
+ case VIA_RES_720X480 :
+ pBIOSInfo->resTVMode = VIA_TVRES_720X480;
+ pBIOSInfo->TVType = TVTYPE_NTSC;
+ break;
+ case VIA_RES_720X576 :
+ pBIOSInfo->resTVMode = VIA_TVRES_720X576;
+ pBIOSInfo->TVType = TVTYPE_PAL;
+ break;
+ default :
+ pBIOSInfo->resTVMode = pBIOSInfo->resMode;
+ break;
+ }
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600) {
+ setTV = TRUE;
+ pBIOSInfo->SetTV = TRUE;
+ VIAPreSetTV2Mode(pBIOSInfo);
+ VIAPostSetTV2Mode(pBIOSInfo);
+ }
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 ||
+ resMode == VIA_RES_1024X768 || resMode == VIA_RES_720X480 ||
+ resMode == VIA_RES_720X576 || resMode == VIA_RES_848X480) {
+ setTV = TRUE;
+ pBIOSInfo->SetTV = TRUE;
+ VIAPreSetTV3Mode(pBIOSInfo);
+ VIAPostSetTV3Mode(pBIOSInfo);
+ }
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 ||
+ resMode == VIA_RES_1024X768) {
+ setTV = TRUE;
+ pBIOSInfo->SetTV = TRUE;
+ VIAPreSetCH7019Mode(pBIOSInfo);
+ VIAPostSetCH7019Mode(pBIOSInfo);
+ }
+ break;
+ case VIA_SAA7108:
+ if (resMode == VIA_RES_640X480 || resMode == VIA_RES_800X600 ||
+ resMode == VIA_RES_1024X768 || resMode == VIA_RES_848X480) {
+ setTV = TRUE;
+ pBIOSInfo->SetTV = TRUE;
+ VIAPreSetSAA7108Mode(pBIOSInfo);
+ VIAPostSetSAA7108Mode(pBIOSInfo);
+ }
+ break;
+ case VIA_FS454:
+ return FALSE;
+ break;
+ }
+ }
+
+ /* Close TV Output, if TVEncoder not support current resolution */
+ if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) && (!setTV)) {
+ I2CDevPtr dev;
+ unsigned char W_Buffer[2];
+
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ W_Buffer[0] = 0x0E;
+ W_Buffer[1] = 0x03;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ W_Buffer[0] = 0x0E;
+ W_Buffer[1] = 0x0F;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_CH7019:
+ W_Buffer[0] = 0x49;
+ W_Buffer[1] = 0x3E;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x1E;
+ W_Buffer[1] = 0xD0;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_SAA7108:
+ W_Buffer[0] = 0x2D;
+ W_Buffer[1] = 0x08;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_FS454:
+ default:
+ break;
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ ErrorF("Not Support TV resolution!!\n");
+ }
+
+ if (!pBIOSInfo->A2) {
+ VGAOUT8(0x3d4, 0x6C);
+ VGAOUT8(0x3d5, (VGAIN8(0x3d5) & 0xE1));
+ }
+
+ if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) {
+ pBIOSInfo->SetDVI = TRUE;
+ VIASetLCDMode(pBIOSInfo);
+ }
+
+ /* Set Quadword offset and counter */
+ countWidthByQWord = pBIOSInfo->countWidthByQWord;
+ offsetWidthByQWord = pBIOSInfo->offsetWidthByQWord;
+
+ VGAOUT8(0x3d4, 0x67);
+ cr67 = VGAIN8(0x3d5) & 0xFC;
+
+ cr66 = offsetWidthByQWord & 0xFF;
+ cr67 |= (offsetWidthByQWord & 0x300) >> 8;
+
+ VGAOUT8(0x3d4, 0x66);
+ VGAOUT8(0x3d5, cr66);
+ VGAOUT8(0x3d4, 0x67);
+ VGAOUT8(0x3d5, cr67);
+
+ VGAOUT8(0x3d4, 0x67);
+ cr67 = VGAIN8(0x3d5) & 0xF3;
+
+ cr67 |= (countWidthByQWord & 0x600) >> 7;
+ cr65 = (countWidthByQWord >> 1) & 0xff;
+
+ VGAOUT8(0x3d4, 0x65);
+ VGAOUT8(0x3d5, cr65);
+ VGAOUT8(0x3d4, 0x67);
+ VGAOUT8(0x3d5, cr67);
+
+ VGAOUT8(0x3d4, 0x67);
+ cr67 = VGAIN8(0x3d5);
+
+ switch (pBIOSInfo->bitsPerPixel) {
+ case 8:
+ cr67 &= 0x3F;
+ VGAOUT8(0x3d5, cr67);
+ break;
+ case 16:
+ cr67 &= 0x3F;
+ cr67 |= 0x40;
+ VGAOUT8(0x3d5, cr67);
+ break;
+ case 24:
+ case 32:
+ cr67 |= 0x80;
+ VGAOUT8(0x3d5, cr67);
+ break;
+ }
+
+ /* Open Screen */
+ misc = VGAIN8(0x3da);
+ VGAOUT8(0x3c0, 0x20);
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "-- VIASetModeForMHS Done!\n"));
+ return TRUE;
+}
+
+Bool VIASavePalette(ScrnInfoPtr pScrn, LOCO *colors) {
+ VIAPtr pVia = VIAPTR(pScrn);
+ int i, sr1a, sr1b, cr67, cr6a;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASavePalette\n"));
+ /*VGAOUT8(0x3C4, 0x16);
+ sr16 = VGAIN8(0x3C5);*/
+ VGAOUT8(0x3C4, 0x1A);
+ sr1a = VGAIN8(0x3C5);
+ VGAOUT8(0x3C4, 0x1B);
+ sr1b = VGAIN8(0x3C5);
+ VGAOUT8(0x3D4, 0x67);
+ cr67 = VGAIN8(0x3D5);
+ VGAOUT8(0x3D4, 0x6A);
+ cr6a = VGAIN8(0x3D5);
+ /*VGAOUT8(0x3C4, 0x16);
+ if (pScrn->bitsPerPixel == 8)
+ VGAOUT8(0x3C5, sr16 & ~0x80);
+ else
+ VGAOUT8(0x3C5, sr16 | 0x80);*/
+ if (pVia->IsSecondary) {
+ VGAOUT8(0x3C4, 0x1A);
+ VGAOUT8(0x3C5, sr1a | 0x01);
+ VGAOUT8(0x3C4, 0x1B);
+ VGAOUT8(0x3C5, sr1b | 0x80);
+ VGAOUT8(0x3D4, 0x67);
+ VGAOUT8(0x3D5, cr67 & 0x3F);
+ VGAOUT8(0x3D4, 0x6A);
+ VGAOUT8(0x3D5, cr6a | 0xC0);
+ }
+ else {
+ VGAOUT8(0x3C4, 0x1A);
+ VGAOUT8(0x3C5, sr1a & 0xFE);
+ VGAOUT8(0x3C4, 0x1B);
+ VGAOUT8(0x3C5, sr1b | 0x20);
+ }
+
+ VGAOUT8(0x3c7, 0);
+ for (i = 0; i < 256; i++) {
+ colors[i].red = VGAIN8(0x3c9);
+ colors[i].green = VGAIN8(0x3c9);
+ colors[i].blue = VGAIN8(0x3c9);
+ DEBUG(xf86Msg(X_INFO, "%d, %d, %d\n", colors[i].red, colors[i].green, colors[i].blue));
+ }
+ WaitIdle();
+
+ /*if (pScrn->bitsPerPixel == 8) {
+ VGAOUT8(0x3C4, 0x16);
+ VGAOUT8(0x3C5, sr16);
+ }
+ VGAOUT8(0x3C4, 0x16);
+ VGAOUT8(0x3C5, sr16);*/
+ VGAOUT8(0x3C4, 0x1A);
+ VGAOUT8(0x3C5, sr1a);
+ VGAOUT8(0x3C4, 0x1B);
+ VGAOUT8(0x3C5, sr1b);
+
+ if (pVia->IsSecondary) {
+ VGAOUT8(0x3D4, 0x67);
+ VGAOUT8(0x3D5, cr67);
+ VGAOUT8(0x3D4, 0x6A);
+ VGAOUT8(0x3D5, cr6a);
+ }
+ return TRUE;
+}
+
+Bool VIARestorePalette(ScrnInfoPtr pScrn, LOCO *colors) {
+ VIAPtr pVia = VIAPTR(pScrn);
+ int i, sr1a, sr1b, cr67, cr6a, sr16;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIARestorePalette\n"));
+ VGAOUT8(0x3C4, 0x16);
+ sr16 = VGAIN8(0x3C5);
+ VGAOUT8(0x3C4, 0x1A);
+ sr1a = VGAIN8(0x3C5);
+ VGAOUT8(0x3C4, 0x1B);
+ sr1b = VGAIN8(0x3C5);
+ VGAOUT8(0x3D4, 0x67);
+ cr67 = VGAIN8(0x3D5);
+ VGAOUT8(0x3D4, 0x6A);
+ cr6a = VGAIN8(0x3D5);
+ VGAOUT8(0x3C4, 0x16);
+ if (pScrn->bitsPerPixel == 8)
+ VGAOUT8(0x3C5, sr16 & ~0x80);
+ else
+ VGAOUT8(0x3C5, sr16 | 0x80);
+ if (pVia->IsSecondary) {
+ VGAOUT8(0x3C4, 0x1A);
+ VGAOUT8(0x3C5, sr1a | 0x01);
+ VGAOUT8(0x3C4, 0x1B);
+ VGAOUT8(0x3C5, sr1b | 0x80);
+ VGAOUT8(0x3D4, 0x67);
+ VGAOUT8(0x3D5, cr67 & 0x3F);
+ VGAOUT8(0x3D4, 0x6A);
+ VGAOUT8(0x3D5, cr6a | 0xC0);
+ }
+ else {
+ VGAOUT8(0x3C4, 0x1A);
+ VGAOUT8(0x3C5, sr1a & 0xFE);
+ VGAOUT8(0x3C4, 0x1B);
+ VGAOUT8(0x3C5, sr1b | 0x20);
+ }
+
+ VGAOUT8(0x3c8, 0);
+ for (i = 0; i < 256; i++) {
+ VGAOUT8(0x3c9, colors[i].red);
+ VGAOUT8(0x3c9, colors[i].green);
+ VGAOUT8(0x3c9, colors[i].blue);
+ /*DEBUG(xf86Msg(X_INFO, "%d, %d, %d\n", colors[i].red, colors[i].green, colors[i].blue));*/
+ }
+ WaitIdle();
+ /*if (pScrn->bitsPerPixel == 8) {
+ VGAOUT8(0x3C4, 0x16);
+ VGAOUT8(0x3C5, sr16);
+ }
+ VGAOUT8(0x3C4, 0x16);
+ VGAOUT8(0x3C5, sr16);*/
+ VGAOUT8(0x3C4, 0x1A);
+ VGAOUT8(0x3C5, sr1a);
+ VGAOUT8(0x3C4, 0x1B);
+ VGAOUT8(0x3C5, sr1b);
+
+ if (pVia->IsSecondary) {
+ VGAOUT8(0x3D4, 0x67);
+ VGAOUT8(0x3D5, cr67);
+ VGAOUT8(0x3D4, 0x6A);
+ VGAOUT8(0x3D5, cr6a);
+ }
+ return TRUE;
+}
+
+unsigned char BIOS_GetActiveDevice(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int RealOff;
+ pointer page = NULL;
+ unsigned char ret = 0x0;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_GetActiveDevice\n"));
+ page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff);
+ if (!page)
+ return 0xFF;
+ pVia->pInt10->ax = 0x4F14;
+ pVia->pInt10->bx = 0x0103;
+ pVia->pInt10->cx = 0;
+ pVia->pInt10->num = 0x10;
+ xf86ExecX86int10(pVia->pInt10);
+
+ if ((pVia->pInt10->ax & 0xFF) != 0x4F) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS Get Active Device fail!\n"));
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ return 0xFF;
+ }
+
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+
+ if (pVia->pInt10->cx & 0x01)
+ ret = VIA_DEVICE_CRT1;
+ if (pVia->pInt10->cx & 0x02)
+ ret |= VIA_DEVICE_LCD;
+ if (pVia->pInt10->cx & 0x04)
+ ret |= VIA_DEVICE_TV;
+ if (pVia->pInt10->cx & 0x20)
+ ret |= VIA_DEVICE_DFP;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Return Value Is: %u\n", ret));
+ return ret;
+}
+
+/*=*
+ *
+ * unsigned char BIOS_GetDisplayDeviceInfo(pScrn, *numDevice)
+ *
+ * - Get Display Device Information
+ *
+ * Return Type: unsigned int
+ *
+ * The Definition of Input Value:
+ *
+ * ScrnInfoPtr
+ * point of int 0-CRT
+ * 1-DVI
+ * 2-LCD Panel
+ *
+ * The Definition of Return Value:
+ *
+ * Bit[15:0] Max. vertical resolution
+ *=*/
+
+unsigned int BIOS_GetDisplayDeviceInfo(ScrnInfoPtr pScrn, unsigned char *numDevice)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int RealOff;
+ pointer page = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_GetDisplayDeviceInfo\n"));
+ page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff);
+ if (!page)
+ return 0xFFFF;
+ pVia->pInt10->ax = 0x4F14;
+ pVia->pInt10->bx = 0x0806;
+ pVia->pInt10->cx = *numDevice;
+ pVia->pInt10->di = 0x00;
+ pVia->pInt10->num = 0x10;
+ xf86ExecX86int10(pVia->pInt10);
+
+ if ((pVia->pInt10->ax & 0xFF) != 0x4F) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS Get Device Info fail!\n"));
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ return 0xFFFF;
+ }
+
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+
+ *numDevice = pVia->pInt10->cx;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Vertical Resolution Is: %u\n", pVia->pInt10->di & 0xFFFF));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel ID Is: %u\n", *numDevice));
+ return (pVia->pInt10->di & 0xFFFF);
+}
+
+/*=*
+ *
+ * unsigned char BIOS_GetDisplayDeviceAttached(pScrn)
+ *
+ * - Get Display Device Information
+ *
+ * Return Type: unsigned char
+ *
+ * The Definition of Input Value:
+ *
+ * ScrnInfoPtr
+ *
+ * The Definition of Return Value:
+ *
+ * Bit[4] CRT2
+ * Bit[3] DFP
+ * Bit[2] TV
+ * Bit[1] LCD
+ * Bit[0] CRT
+ *=*/
+
+unsigned char BIOS_GetDisplayDeviceAttached(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int RealOff;
+ pointer page = NULL;
+ unsigned char ret = 0;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_GetDisplayDeviceAttached\n"));
+ page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff);
+ if (!page)
+ return 0xFF;
+ pVia->pInt10->ax = 0x4F14;
+ pVia->pInt10->bx = 0x0004;
+ pVia->pInt10->cx = 0x00;
+ pVia->pInt10->num = 0x10;
+ xf86ExecX86int10(pVia->pInt10);
+
+ if ((pVia->pInt10->ax & 0xFF) != 0x4F) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS Get Display Device Attached fail!\n"));
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ return 0xFF;
+ }
+
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+
+ if (pVia->pInt10->cx & 0x01)
+ ret = VIA_DEVICE_CRT1;
+ if (pVia->pInt10->cx & 0x02)
+ ret |= VIA_DEVICE_LCD;
+ if (pVia->pInt10->cx & 0x04)
+ ret |= VIA_DEVICE_TV;
+ if (pVia->pInt10->cx & 0x20)
+ ret |= VIA_DEVICE_DFP;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Connected Device Is: %d\n", ret));
+ return ret;
+}
+
+Bool BIOS_GetBIOSDate(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ int RealOff;
+ pointer page = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_GetBIOSDate\n"));
+ page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff);
+ if (!page)
+ return FALSE;
+ pVia->pInt10->ax = 0x4F14;
+ pVia->pInt10->bx = 0x0100;
+ pVia->pInt10->cx = 0;
+ pVia->pInt10->dx = 0;
+ pVia->pInt10->si = 0;
+ pVia->pInt10->num = 0x10;
+ xf86ExecX86int10(pVia->pInt10);
+
+ if ((pVia->pInt10->ax & 0xff) != 0x4f) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Get BIOS Date fail!\n"));
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ return FALSE;
+ }
+
+ pBIOSInfo->BIOSDateYear = ((pVia->pInt10->bx >> 8) - 48) + ((pVia->pInt10->bx & 0xFF) - 48)*10;
+ pBIOSInfo->BIOSDateMonth = ((pVia->pInt10->cx >> 8) - 48) + ((pVia->pInt10->cx & 0xFF) - 48)*10;
+ pBIOSInfo->BIOSDateDay = ((pVia->pInt10->dx >> 8) - 48) + ((pVia->pInt10->dx & 0xFF) - 48)*10;
+
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS Release Date Is: %d/%d/%d\n"
+ , pBIOSInfo->BIOSDateYear + 2000, pBIOSInfo->BIOSDateMonth, pBIOSInfo->BIOSDateDay));
+ return TRUE;
+}
+
+int BIOS_GetBIOSVersion(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int RealOff;
+ pointer page = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_GetBIOSVersion\n"));
+ page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff);
+ if (!page)
+ return 0xFFFF;
+ pVia->pInt10->ax = 0x4F14;
+ pVia->pInt10->bx = 0x0000;
+ pVia->pInt10->cx = 0;
+ pVia->pInt10->num = 0x10;
+ xf86ExecX86int10(pVia->pInt10);
+
+ if ((pVia->pInt10->ax & 0xff) != 0x4f) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Get BIOS Version fail!\n"));
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ return 0xFFFF;
+ }
+
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Return Value Is: %u\n", pVia->pInt10->bx & 0xFFFF));
+ return (pVia->pInt10->bx & 0xFFFF);
+}
+
+unsigned char BIOS_GetFlatPanelInfo(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int RealOff;
+ pointer page = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_GetFlatPanelInfo\n"));
+ page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff);
+ if (!page)
+ return 0xFF;
+ pVia->pInt10->ax = 0x4F14;
+ pVia->pInt10->bx = 0x0006;
+ pVia->pInt10->cx = 0x00;
+ pVia->pInt10->num = 0x10;
+ xf86ExecX86int10(pVia->pInt10);
+
+ if ((pVia->pInt10->ax & 0xFF) != 0x4F) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS Get Flat Panel Info fail!\n"));
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ return 0xFF;
+ }
+
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel ID Is: %u\n", pVia->pInt10->cx & 0x0F));
+ return (pVia->pInt10->cx & 0x0F);
+}
+
+unsigned int BIOS_GetTVConfiguration(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int RealOff;
+ pointer page = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_GetTVConfiguration\n"));
+ page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff);
+ if (!page)
+ return 0xFFFF;
+ pVia->pInt10->ax = 0x4F14;
+ pVia->pInt10->bx = 0x8107;
+ pVia->pInt10->cx = 0;
+ pVia->pInt10->num = 0x10;
+ xf86ExecX86int10(pVia->pInt10);
+
+ if ((pVia->pInt10->ax & 0xff) != 0x4f) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Get TV Configuration fail!\n"));
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ return 0xFFFF;
+ }
+
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Return Value Is: %u\n", pVia->pInt10->cx & 0xFFFF));
+ return (pVia->pInt10->cx & 0xFFFF);
+}
+
+unsigned char BIOS_GetTVEncoderType(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int RealOff;
+ pointer page = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_GetTVEncoderType\n"));
+ page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff);
+ if (!page)
+ return 0xFF;
+ pVia->pInt10->ax = 0x4F14;
+ pVia->pInt10->bx = 0x0000;
+ pVia->pInt10->cx = 0;
+ pVia->pInt10->num = 0x10;
+ xf86ExecX86int10(pVia->pInt10);
+
+ if ((pVia->pInt10->ax & 0xFF) != 0x4F) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Get TV Encoder Type fail!\n"));
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ return 0xFF;
+ }
+
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Return Value Is: %u\n", pVia->pInt10->cx >> 8));
+ return (pVia->pInt10->cx >> 8);
+}
+
+int BIOS_GetVideoMemSize(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int RealOff;
+ pointer page = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_GetVideoMemSize\n"));
+ page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff);
+ if (!page)
+ return 0;
+ pVia->pInt10->ax = 0x4F14;
+ pVia->pInt10->bx = 0;
+ pVia->pInt10->cx = 0;
+ pVia->pInt10->dx = 0;
+ pVia->pInt10->di = 0;
+ pVia->pInt10->si = 0;
+ pVia->pInt10->num = 0x10;
+ xf86ExecX86int10(pVia->pInt10);
+
+ if ((pVia->pInt10->ax & 0xFF) != 0x4F) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Get Video Memory Size fail!\n"));
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ return 0;
+ }
+
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Return Value Is: %d\n", pVia->pInt10->si));
+ if (pVia->pInt10->si > 1)
+ return (pVia->pInt10->si);
+ else
+ return 0;
+}
+
+Bool BIOS_SetActiveDevice(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ int RealOff;
+ pointer page = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS_SetActiveDevice\n"));
+ page = xf86Int10AllocPages(pVia->pInt10, 1, &RealOff);
+ if (!page)
+ return FALSE;
+ pVia->pInt10->ax = 0x4F14;
+ pVia->pInt10->bx = 0x8003;
+ pVia->pInt10->cx = 0;
+ pVia->pInt10->dx = 0;
+ pVia->pInt10->di = 0;
+ pVia->pInt10->num = 0x10;
+
+ /* Set Active Device and Translate BIOS byte definition */
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_CRT1)
+ pVia->pInt10->cx = 0x01;
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_LCD)
+ pVia->pInt10->cx |= 0x02;
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV)
+ pVia->pInt10->cx |= 0x04;
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_DFP)
+ pVia->pInt10->cx |= 0x20;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Active Device: %d\n",
+ pVia->pInt10->cx));
+
+ /* Set Current mode */
+ pVia->pInt10->dx = pViaModeTable->Modes[pBIOSInfo->mode].Mode;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Mode Nums: %d\n",
+ pVia->pInt10->dx));
+
+ /* Set Current Refresh rate */
+ switch(pBIOSInfo->Refresh) {
+ case 60:
+ pVia->pInt10->di = 0;
+ break;
+ case 75:
+ pVia->pInt10->di = 5;
+ break;
+ case 85:
+ pVia->pInt10->di = 7;
+ break;
+ case 100:
+ pVia->pInt10->di = 9;
+ break;
+ case 120:
+ pVia->pInt10->di = 10;
+ break;
+ default:
+ pVia->pInt10->di = 0;
+ break;
+ }
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Refresh Rate Index: %d\n",
+ pVia->pInt10->di));
+
+ /* Real execution */
+ xf86ExecX86int10(pVia->pInt10);
+
+ if ((pVia->pInt10->ax & 0xFF) != 0x4F) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS Set Active Device fail!\n"));
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+ return FALSE;
+ }
+
+ if (page)
+ xf86Int10FreePages(pVia->pInt10, page, 1);
+
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_bios.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_bios.h new file mode 100644 index 000000000..890016d11 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_bios.h @@ -0,0 +1,685 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_BIOS_H
+#define _VIA_BIOS_H
+
+#define VIA_CRT_SUPPORT TRUE
+#define VIA_LCD_SUPPORT TRUE
+#define VIA_UNCOVERD_LCD_PANEL FALSE
+#define VIA_NTSC_SUPPORT TRUE
+#define VIA_PAL_SUPPORT TRUE
+#define VIA_DVI_SUPPORT TRUE
+
+#define VIA_CRT_SUPPORT_BIT 0x01
+#define VIA_LCD_SUPPORT_BIT 0x02
+#define VIA_NTSC_SUPPORT_BIT 0x04
+#define VIA_PAL_SUPPORT_BIT 0x08
+#define VIA_DVI_SUPPORT_BIT 0x20
+
+#define VIA_BIOS_REG_TABLE_MAX_NUM 32
+#define VIA_BIOS_REG_LCD_MAX_NUM 48
+#define VIA_BIOS_NUM_RES 17
+#define VIA_BIOS_NUM_REFRESH 5
+#define VIA_BIOS_NUM_LCD_SUPPORT_MASK 8
+#define VIA_BIOS_NUM_LCD_POWER_SEQ 4
+#define VIA_BIOS_NUM_PANEL 7
+#define VIA_BIOS_MAX_NUM_MPATCH2 18
+#define VIA_BIOS_MAX_NUM_MPATCH1 9
+#define VIA_BIOS_MAX_NUM_CTREXP 5
+#define VIA_BIOS_MAX_NUM_TV_REG 144 /* 00 - 8F, tv2,tv3,ch7019 are the same */
+#define VIA_BIOS_MAX_NUM_SAA7108_TV_REG 176 /* 00 - AF */
+#define VIA_BIOS_NUM_FS454_TV_REG 32 /* Nums of TV Register in setmode needs */
+#define VIA_BIOS_MAX_NUM_TV_CRTC 32
+#define VIA_BIOS_NUM_TV_SPECIAL_REG 8
+#define VIA_BIOS_MAX_NUM_TV_PATCH 8
+#define VIA_BIOS_NUM_TV_OTHER 16
+#define VIA_BIOS_NUM_TV2 2
+#define VIA_BIOS_NUM_TV3 6
+#define VIA_BIOS_NUM_SAA7108 4
+#define VIA_BIOS_NUM_CH7019 3
+#define VIA_BIOS_NUM_FS454 5
+
+
+/* The position of some BIOS information from start of BIOS */
+#define VIA_BIOS_SIZE_POS 0x2
+#define VIA_BIOS_OFFSET_POS 0x1B
+
+/* The offset of table from table start */
+#define VIA_BIOS_CSTAB_POS 6
+#define VIA_BIOS_STDVGAREGTAB_POS 8
+#define VIA_BIOS_COMMEXTREGTAB_POS 10
+#define VIA_BIOS_STDMODEXTREGTAB_POS 12
+#define VIA_BIOS_EXTMODEREGTAB_POS 14
+#define VIA_BIOS_REFRESHMODETAB_POS 16
+#define VIA_BIOS_BIOSVER_POS 18
+#define VIA_BIOS_BCPPOST_POS 20
+#define VIA_BIOS_LCDMODETAB_POS 40
+#define VIA_BIOS_TVMODETAB_POS 42
+#define VIA_BIOS_TVMASKTAB_POS 44
+#define VIA_BIOS_MODEOVERTAB_POS 46
+#define VIA_BIOS_TV3HSCALETAB_POS 48
+#define VIA_BIOS_LCDPOWERON_POS 50
+#define VIA_BIOS_LCDPOWEROFF_POS 52
+#define VIA_BIOS_LCDMODEFIX_POS 54
+
+#define VIA_RES_640X480 0
+#define VIA_RES_800X600 1
+#define VIA_RES_1024X768 2
+#define VIA_RES_1152X864 3
+#define VIA_RES_1280X1024 4
+#define VIA_RES_1600X1200 5
+#define VIA_RES_1440X1050 6
+#define VIA_RES_1280X768 7
+#define VIA_RES_1280X960 8
+#define VIA_RES_1920X1440 9
+#define VIA_RES_848X480 10
+#define VIA_RES_1400X1050 11
+#define VIA_RES_720X480 12
+#define VIA_RES_720X576 13
+#define VIA_RES_1024X512 14
+#define VIA_RES_856X480 15
+#define VIA_RES_1024X576 16
+#define VIA_RES_INVALID 255
+
+#define VIA_TVRES_640X480 0
+#define VIA_TVRES_800X600 1
+#define VIA_TVRES_1024X768 2
+#define VIA_TVRES_848X480 3
+#define VIA_TVRES_720X480 4
+#define VIA_TVRES_720X576 5
+
+
+#define VIA_NUM_REFRESH_RATE 5
+#define VIA_PANEL6X4 0
+#define VIA_PANEL8X6 1
+#define VIA_PANEL10X7 2
+#define VIA_PANEL12X7 3
+#define VIA_PANEL12X10 4
+#define VIA_PANEL14X10 5
+#define VIA_PANEL16X12 6
+#define VIA_PANEL_INVALID 255
+
+#define VIA_NONEDVI 0x00
+#define VIA_SIL164 0x11
+#define VIA_VT3191 0x21
+#define VIA_VT3192 0x22
+
+
+#define TVTYPE_NONE 0x00
+#define TVTYPE_NTSC 0x01
+#define TVTYPE_PAL 0x02
+
+#define TVOUTPUT_NONE 0x00
+#define TVOUTPUT_COMPOSITE 0x01
+#define TVOUTPUT_SVIDEO 0x02
+#define TVOUTPUT_RGB 0x04
+#define TVOUTPUT_YCBCR 0x08
+#define TVOUTPUT_SC 0x16
+
+#define VIA_NONETV 0
+#define VIA_TV2PLUS 1
+#define VIA_TV3 2
+#define VIA_CH7009 3
+#define VIA_CH7019 4
+#define VIA_SAA7108 5
+#define VIA_CH7005 6
+#define VIA_VT1622A 7
+#define VIA_FS454 8
+#define VIA_VT1623 9
+
+#define VIA_TVNORMAL 0
+#define VIA_TVOVER 1
+#define VIA_NO_TVHSCALE 0
+#define VIA_TVHSCALE0 0
+#define VIA_TVHSCALE1 1
+#define VIA_TVHSCALE2 2
+#define VIA_TVHSCALE3 3
+#define VIA_TVHSCALE4 4
+#define VIA_TV_NUM_HSCALE_LEVEL 8
+#define VIA_TV_NUM_HSCALE_REG 16
+
+#define VIA_DEVICE_CRT1 0x01
+#define VIA_DEVICE_LCD 0x02
+#define VIA_DEVICE_TV 0x04
+#define VIA_DEVICE_DFP 0x08
+#define VIA_DEVICE_CRT2 0x10
+
+/* System Memory CLK */
+#define VIA_MEM_SDR66 0x00
+#define VIA_MEM_SDR100 0x01
+#define VIA_MEM_SDR133 0x02
+#define VIA_MEM_DDR200 0x03
+#define VIA_MEM_DDR266 0x04
+#define VIA_MEM_DDR333 0x05
+#define VIA_MEM_DDR400 0x06
+
+/* Digital Output Bus Width */
+#define VIA_DI_12BIT 0x00
+#define VIA_DI_24BIT 0x01
+
+#define CAP_WEAVE 0x0
+#define CAP_BOB 0x1
+
+typedef struct _GPIOI2C_INFO
+{
+ CARD8 bGPIOPort;
+ CARD8 bSlaveAddr;
+} GPIOI2C_INFO, *PGPIOI2C_INFO;
+
+typedef struct _VIABIOSSTDVGATABLE {
+ CARD8 columns;
+ CARD8 rows;
+ CARD8 fontHeight;
+ CARD16 pageSize;
+ CARD8 SR[5];
+ CARD8 misc;
+ CARD8 CR[25];
+ CARD8 AR[20];
+ CARD8 GR[9];
+} VIABIOSStdVGATableRec, *VIABIOSStdVGATablePtr;
+
+
+typedef struct _VIABIOSREFRESHTABLE {
+ CARD8 refresh;
+ CARD16 VClk;
+ CARD8 CR[14];
+} VIABIOSRefreshTableRec, *VIABIOSRefreshTablePtr;
+
+
+typedef struct _VIABIOSREGTABLE {
+ CARD8 port[VIA_BIOS_REG_TABLE_MAX_NUM];
+ CARD8 offset[VIA_BIOS_REG_TABLE_MAX_NUM];
+ CARD8 mask[VIA_BIOS_REG_TABLE_MAX_NUM];
+ CARD8 data[VIA_BIOS_REG_TABLE_MAX_NUM];
+ int numEntry;
+} VIABIOSRegTableRec, *VIABIOSRegTablePtr;
+
+
+typedef struct _VIAVMODEENTRY {
+ unsigned short Width;
+ unsigned short Height;
+ unsigned short Bpp;
+ unsigned short Mode;
+ unsigned short MemNeed;
+ unsigned short MClk;
+ unsigned short VClk;
+ VIABIOSStdVGATableRec stdVgaTable;
+ VIABIOSRegTableRec extModeExtTable;
+} VIAModeEntry, *VIAModeEntryPtr;
+
+
+typedef struct _VIALCDMODEENTRY {
+ CARD16 LCDClk;
+ CARD16 VClk;
+ CARD16 LCDClk_12Bit;
+ CARD16 VClk_12Bit;
+ CARD8 port[VIA_BIOS_REG_LCD_MAX_NUM];
+ CARD8 offset[VIA_BIOS_REG_LCD_MAX_NUM];
+ CARD8 data[VIA_BIOS_REG_LCD_MAX_NUM];
+ int numEntry;
+} VIALCDModeEntry, *VIALCDModeEntryPtr;
+
+
+typedef struct _VIALCDMPATCHENTRY {
+ CARD8 Mode;
+ CARD16 LCDClk;
+ CARD16 VClk;
+ CARD16 LCDClk_12Bit;
+ CARD16 VClk_12Bit;
+ CARD8 port[VIA_BIOS_REG_LCD_MAX_NUM];
+ CARD8 offset[VIA_BIOS_REG_LCD_MAX_NUM];
+ CARD8 data[VIA_BIOS_REG_LCD_MAX_NUM];
+ int numEntry;
+} VIALCDMPatchEntry, *VIALCDMPatchEntryPtr;
+
+
+typedef struct _VIALCDMODEFIX {
+ CARD8 reqMode[32];
+ CARD8 fixMode[32];
+ int numEntry;
+} VIALCDModeFixRec, *VIALCDModeFixRecPtr;
+
+
+typedef struct _VIALCDPOWERSEQUENCE {
+ CARD8 powerSeq;
+ CARD8 port[4];
+ CARD8 offset[4];
+ CARD8 mask[4];
+ CARD8 data[4];
+ CARD16 delay[4];
+ int numEntry;
+} VIALCDPowerSeqRec, *VIALCDPowerSeqRecPtr;
+
+
+typedef struct _VIALCDMODETABLE {
+ CARD8 fpIndex;
+ CARD8 fpSize;
+ CARD8 powerSeq;
+ int numMPatchDP2Ctr;
+ int numMPatchDP2Exp;
+ int numMPatchDP1Ctr;
+ int numMPatchDP1Exp;
+ CARD16 SuptMode[VIA_BIOS_NUM_LCD_SUPPORT_MASK];
+ VIALCDModeEntry FPconfigTb;
+ VIALCDModeEntry InitTb;
+ VIALCDMPatchEntry MPatchDP2Ctr[VIA_BIOS_MAX_NUM_MPATCH2];
+ VIALCDMPatchEntry MPatchDP2Exp[VIA_BIOS_MAX_NUM_MPATCH2];
+ VIALCDMPatchEntry MPatchDP1Ctr[VIA_BIOS_MAX_NUM_MPATCH1];
+ VIALCDMPatchEntry MPatchDP1Exp[VIA_BIOS_MAX_NUM_MPATCH1];
+ VIALCDModeEntry LowResCtr;
+ VIALCDModeEntry LowResExp;
+ VIALCDModeEntry MCtr[VIA_BIOS_MAX_NUM_CTREXP];
+ VIALCDModeEntry MExp[VIA_BIOS_MAX_NUM_CTREXP];
+} VIALCDModeTableRec, *VIALCDModePtr;
+
+
+typedef struct _VIATVMASKTABLE {
+ CARD8 TV[VIA_BIOS_MAX_NUM_TV_REG];
+ CARD8 CRTC1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTC2[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 misc1;
+ CARD8 misc2;
+ int numTV;
+ int numCRTC1;
+ int numCRTC2;
+} VIABIOSTVMASKTableRec, *VIABIOSTVMASKTablePtr;
+
+typedef struct _VIASAA7108TVMASKTABLE {
+ CARD8 TV[VIA_BIOS_MAX_NUM_SAA7108_TV_REG];
+ CARD8 CRTC1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTC2[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 misc1;
+ CARD8 misc2;
+ int numTV;
+ int numCRTC1;
+ int numCRTC2;
+} VIABIOSSAA7108TVMASKTableRec, *VIABIOSSAA7108TVMASKTablePtr;
+
+typedef struct _VIAFS454TVMASKTABLE {
+ CARD8 CRTC1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTC2[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 misc1;
+ CARD8 misc2;
+ int numCRTC1;
+ int numCRTC2;
+} VIABIOSFS454TVMASKTableRec, *VIABIOSFS454TVMASKTablePtr;
+
+typedef struct _VIATVMODETABLE {
+ CARD8 TVNTSCC[VIA_BIOS_MAX_NUM_TV_REG];
+ CARD8 TVNTSCS[VIA_BIOS_MAX_NUM_TV_REG];
+ CARD8 CRTCNTSC1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 MiscNTSC1[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 MiscNTSC2[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 CRTCNTSC2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCNTSC2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCNTSC2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD16 PatchNTSC2[VIA_BIOS_MAX_NUM_TV_PATCH];
+ CARD16 DotCrawlNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD8 TVPALC[VIA_BIOS_MAX_NUM_TV_REG];
+ CARD8 TVPALS[VIA_BIOS_MAX_NUM_TV_REG];
+ CARD8 CRTCPAL1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 MiscPAL1[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 MiscPAL2[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 CRTCPAL2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCPAL2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCPAL2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD16 PatchPAL2[VIA_BIOS_MAX_NUM_TV_PATCH];
+} VIABIOSTV2TableRec, *VIABIOSTV2TablePtr;
+
+
+typedef struct _VIATV3MODETABLE {
+ CARD8 TVNTSC[VIA_BIOS_MAX_NUM_TV_REG];
+ CARD8 CRTCNTSC1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 MiscNTSC1[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 MiscNTSC2[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 CRTCNTSC2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCNTSC2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCNTSC2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD16 PatchNTSC2[VIA_BIOS_MAX_NUM_TV_PATCH];
+ CARD16 RGBNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 YCbCrNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 SDTV_RGBNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 SDTV_YCbCrNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 DotCrawlNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD8 TVPAL[VIA_BIOS_MAX_NUM_TV_REG];
+ CARD8 CRTCPAL1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 MiscPAL1[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 MiscPAL2[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 CRTCPAL2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCPAL2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCPAL2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD16 PatchPAL2[VIA_BIOS_MAX_NUM_TV_PATCH];
+ CARD16 RGBPAL[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 YCbCrPAL[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 SDTV_RGBPAL[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 SDTV_YCbCrPAL[VIA_BIOS_NUM_TV_OTHER];
+} VIABIOSTV3TableRec, *VIABIOSTV3TablePtr;
+
+
+typedef struct _VIAPHILIPSMODETABLE {
+ CARD8 TVNTSC[VIA_BIOS_MAX_NUM_SAA7108_TV_REG];
+ CARD8 CRTCNTSC1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 MiscNTSC1[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 MiscNTSC2[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 CRTCNTSC2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCNTSC2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCNTSC2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD16 PatchNTSC2[VIA_BIOS_MAX_NUM_TV_PATCH];
+ CARD16 RGBNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 YCbCrNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD8 TVPAL[VIA_BIOS_MAX_NUM_SAA7108_TV_REG];
+ CARD8 CRTCPAL1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 MiscPAL1[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 MiscPAL2[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 CRTCPAL2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCPAL2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCPAL2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD16 PatchPAL2[VIA_BIOS_MAX_NUM_TV_PATCH];
+ CARD16 RGBPAL[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 YCbCrPAL[VIA_BIOS_NUM_TV_OTHER];
+} VIABIOSSAA7108TableRec, *VIABIOSSAA7108TablePtr;
+
+typedef struct _VIACH7019MODETABLE {
+ CARD8 TVNTSC[VIA_BIOS_MAX_NUM_TV_REG];
+ CARD8 CRTCNTSC1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 MiscNTSC1[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 MiscNTSC2[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 CRTCNTSC2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCNTSC2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCNTSC2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD16 PatchNTSC2[VIA_BIOS_MAX_NUM_TV_PATCH];
+ CARD16 DotCrawlNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD8 TVPAL[VIA_BIOS_MAX_NUM_TV_REG];
+ CARD8 CRTCPAL1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 MiscPAL1[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 MiscPAL2[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 CRTCPAL2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCPAL2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCPAL2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD16 PatchPAL2[VIA_BIOS_MAX_NUM_TV_PATCH];
+} VIABIOSCH7019TableRec, *VIABIOSCH7019TablePtr;
+
+typedef struct _VIAFS454MODETABLE {
+ CARD16 TVNTSC[VIA_BIOS_NUM_FS454_TV_REG];
+ CARD8 CRTCNTSC1[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 MiscNTSC1[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 MiscNTSC2[VIA_BIOS_NUM_TV_SPECIAL_REG];
+ CARD8 CRTCNTSC2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCNTSC2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD8 CRTCNTSC2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC];
+ CARD16 RGBNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 YCbCrNTSC[VIA_BIOS_NUM_TV_OTHER];
+ CARD16 DotCrawlNTSC[VIA_BIOS_NUM_TV_OTHER];
+} VIABIOSFS454TableRec, *VIABIOSFS454TablePtr;
+
+typedef struct _VIAVMODETABLE {
+ unsigned short BIOSVer;
+ char * BIOSDate;
+ unsigned short NumModes;
+ int NumPowerOn;
+ int NumPowerOff;
+ VIAModeEntryPtr Modes;
+ VIABIOSRegTableRec commExtTable;
+ VIABIOSRegTableRec stdModeExtTable;
+ VIABIOSRefreshTableRec refreshTable[VIA_BIOS_NUM_RES][VIA_BIOS_NUM_REFRESH];
+ VIALCDModeTableRec lcdTable[VIA_BIOS_NUM_PANEL];
+ VIALCDPowerSeqRec powerOn[VIA_BIOS_NUM_LCD_POWER_SEQ];
+ VIALCDPowerSeqRec powerOff[VIA_BIOS_NUM_LCD_POWER_SEQ];
+ VIALCDModeFixRec modeFix;
+ VIABIOSTVMASKTableRec tv2MaskTable;
+ VIABIOSTVMASKTableRec tv3MaskTable;
+ VIABIOSTVMASKTableRec vt1622aMaskTable;
+ VIABIOSSAA7108TVMASKTableRec saa7108MaskTable;
+ VIABIOSTVMASKTableRec ch7019MaskTable;
+ VIABIOSFS454TVMASKTableRec fs454MaskTable;
+ VIABIOSTV2TableRec tv2Table[VIA_BIOS_NUM_TV2];
+ VIABIOSTV2TableRec tv2OverTable[VIA_BIOS_NUM_TV2];
+ VIABIOSTV3TableRec tv3Table[VIA_BIOS_NUM_TV3];
+ VIABIOSTV3TableRec tv3OverTable[VIA_BIOS_NUM_TV3];
+ VIABIOSTV3TableRec vt1622aTable[VIA_BIOS_NUM_TV3];
+ VIABIOSTV3TableRec vt1622aOverTable[VIA_BIOS_NUM_TV3];
+ VIABIOSSAA7108TableRec saa7108Table[VIA_BIOS_NUM_SAA7108];
+ VIABIOSSAA7108TableRec saa7108OverTable[VIA_BIOS_NUM_SAA7108];
+ VIABIOSCH7019TableRec ch7019Table[VIA_BIOS_NUM_CH7019];
+ VIABIOSCH7019TableRec ch7019OverTable[VIA_BIOS_NUM_CH7019];
+ VIABIOSFS454TableRec fs454Table[VIA_BIOS_NUM_FS454];
+ VIABIOSFS454TableRec fs454OverTable[VIA_BIOS_NUM_FS454];
+} VIAModeTableRec, *VIAModeTablePtr;
+
+typedef struct _UTUSERSETTING
+{
+ Bool DefaultSetting;
+ Bool ADAPTIVE_FFILTER_ON;
+ unsigned long UT_TV_VPOSITION;
+ unsigned long UT_TV_HPOSITION;
+ unsigned long UT_TV_FFILTER;
+ unsigned long UT_TV_ADAPTIVE_FFILTER;
+ unsigned long UT_TV_BRIGHTNESS;
+ unsigned long UT_TV_CONTRAST;
+ unsigned long UT_TV_SATURATION;
+ unsigned long UT_TV_TINT;
+} UTUSERSETTING, *UTUSERSETTINGptr;
+
+typedef struct _VIABIOSINFO {
+
+ VIAModeTablePtr pModeTable;
+
+ int Chipset;
+ int ChipRev;
+ unsigned char TMDS;
+ unsigned char LVDS;
+ /*int DVIEncoder;*/
+ int TVEncoder;
+ int BIOSTVTabVer;
+
+ unsigned char* MapBase;
+ Bool FirstInit;
+ unsigned char* FBBase;
+ unsigned long videoRambytes;
+ unsigned char MemClk;
+ int scrnIndex;
+
+ unsigned int mode, refresh, resMode;
+ int countWidthByQWord;
+ int offsetWidthByQWord;
+
+ unsigned char ConnectedDevice;
+ unsigned char ActiveDevice;
+
+ /* Here are all the BIOS Relative Options */
+ int BIOSMajorVersion;
+ int BIOSMinorVersion;
+ unsigned char BIOSDateYear;
+ unsigned char BIOSDateMonth;
+ unsigned char BIOSDateDay;
+ Bool A2;
+ Bool UseBIOS;
+ Bool LCDDualEdge; /* mean add-on card is 2CH or Dual or DDR */
+ Bool DVIAttach;
+ Bool LCDAttach;
+ Bool Center;
+ Bool TVAttach;
+ Bool TVDotCrawl;
+ unsigned char BusWidth; /* Digital Output Bus Width */
+ int PanelSize;
+ int TVType;
+ int TVOutput;
+ int TVVScan;
+ int TVHScale;
+ int OptRefresh;
+ int Refresh;
+ int FoundRefresh;
+
+ /* LCD Simultaneous Expand Mode HWCursor Y Scale */
+ Bool scaleY;
+ int panelX;
+ int panelY;
+ int resY;
+
+ /* Some Used Member of ScrnInfoRec */
+ int bitsPerPixel; /* fb bpp */
+ int displayWidth; /* memory pitch */
+ int frameX1; /* viewport position */
+ int frameY1;
+ int SaveframeX1;
+ int SaveframeY1;
+
+ /* Some Used Member of DisplayModeRec */
+ int Clock; /* pixel clock freq */
+ int HTotal;
+ int VTotal;
+ int HDisplay; /* horizontal timing */
+ int VDisplay; /* vertical timing */
+ int SaveHDisplay;
+ int SaveVDisplay;
+ int CrtcHDisplay;
+ int CrtcVDisplay;
+ int SaveCrtcHDisplay;
+ int SaveCrtcVDisplay;
+
+ /* I2C & DDC */
+ GPIOI2C_INFO GPIOI2CInfo;
+ I2CBusPtr I2C_Port1;
+ I2CBusPtr I2C_Port2;
+ xf86MonPtr DDC1;
+ xf86MonPtr DDC2;
+ I2CDevPtr dev;
+
+ unsigned int resTVMode;
+ unsigned char TVI2CAdd;
+ unsigned char TVRegs[0xFF];
+
+ /* MHS */
+ Bool SAMM; /* SAMM success or not? */
+ Bool IsSecondary;
+ Bool HasSecondary;
+ Bool SetTV;
+ Bool SetDVI;
+
+ /* Utility User Setting */
+ UTUSERSETTINGptr pUTUSERSETTING;
+ LOCO colors[256]; /* Gamma value. LOCO typedef in colormapst.h */
+
+} VIABIOSInfoRec, *VIABIOSInfoPtr;
+
+/* Functions protype */
+
+int VIACheckTVExist(VIABIOSInfoPtr pBIOSInfo);
+long VIAQueryChipInfo(VIABIOSInfoPtr pBIOSInfo);
+char* VIAGetBIOSInfo(VIABIOSInfoPtr pBIOSInfo);
+Bool VIASetActiveDisplay(VIABIOSInfoPtr pBIOSInfo, unsigned char display);
+unsigned char VIAGetActiveDisplay(VIABIOSInfoPtr pBIOSInfo);
+unsigned char VIASensorCH7019(VIABIOSInfoPtr pBIOSInfo);
+unsigned char VIASensorSAA7108(VIABIOSInfoPtr pBIOSInfo);
+unsigned char VIASensorTV2(VIABIOSInfoPtr pBIOSInfo);
+unsigned char VIASensorTV3(VIABIOSInfoPtr pBIOSInfo);
+Bool VIASensorDVI(VIABIOSInfoPtr pBIOSInfo);
+Bool VIAPostDVI(VIABIOSInfoPtr pBIOSInfo);
+unsigned char VIAGetDeviceDetect(VIABIOSInfoPtr pBIOSInfo);
+unsigned char VIAGetPanelInfo(VIABIOSInfoPtr pBIOSInfo);
+Bool VIASetPanelState(VIABIOSInfoPtr pBIOSInfo, unsigned char state);
+unsigned char VIAGetPanelState(VIABIOSInfoPtr pBIOSInfo);
+int VIAQueryDVIEDID(VIABIOSInfoPtr pBIOSInfo);
+unsigned char VIAGetPanelSizeFromDDCv1(VIABIOSInfoPtr pBIOSInfo);
+unsigned char VIAGetPanelSizeFromDDCv2(VIABIOSInfoPtr pBIOSInfo);
+int VIAGetTVTabVer(VIABIOSInfoPtr pBIOSInfo, unsigned char *pBIOS);
+void VIAPreSetCH7019Mode(VIABIOSInfoPtr pBIOSInfo);
+void VIAPreSetFS454Mode(VIABIOSInfoPtr pBIOSInfo);
+void VIAPreSetSAA7108Mode(VIABIOSInfoPtr pBIOSInfo);
+void VIAPreSetTV2Mode(VIABIOSInfoPtr pBIOSInfo);
+void VIAPreSetTV3Mode(VIABIOSInfoPtr pBIOSInfo);
+void VIAPostSetCH7019Mode(VIABIOSInfoPtr pBIOSInfo);
+void VIAPostSetFS454Mode(VIABIOSInfoPtr pBIOSInfo);
+void VIAPostSetSAA7108Mode(VIABIOSInfoPtr pBIOSInfo);
+void VIAPostSetTV2Mode(VIABIOSInfoPtr pBIOSInfo);
+void VIAPostSetTV3Mode(VIABIOSInfoPtr pBIOSInfo);
+Bool VIAGetBIOSTable(VIABIOSInfoPtr pBIOSInfo);
+Bool VIAFindModeUseBIOSTable(VIABIOSInfoPtr pBIOSInfo);
+Bool VIASetModeUseBIOSTable(VIABIOSInfoPtr pBIOSInfo);
+Bool VIASetModeForMHS(VIABIOSInfoPtr pBIOSInfo);
+Bool VIASavePalette(ScrnInfoPtr pScrn, LOCO *colors);
+Bool VIARestorePalette(ScrnInfoPtr pScrn, LOCO *colors);
+
+int BIOS_GetBIOSVersion(ScrnInfoPtr pScrn);
+unsigned char BIOS_GetActiveDevice(ScrnInfoPtr pScrn);
+unsigned char BIOS_GetDisplayDeviceAttached(ScrnInfoPtr pScrn);
+unsigned int BIOS_GetTVConfiguration(ScrnInfoPtr pScrn);
+unsigned char BIOS_GetTVEncoderType(ScrnInfoPtr pScrn);
+unsigned int BIOS_GetDisplayDeviceInfo(ScrnInfoPtr pScrn, unsigned char *numDevice);
+unsigned char BIOS_GetFlatPanelInfo(ScrnInfoPtr pScrn);
+Bool BIOS_GetBIOSDate(ScrnInfoPtr pScrn);
+int BIOS_GetVideoMemSize(ScrnInfoPtr pScrn);
+Bool BIOS_SetActiveDevice(ScrnInfoPtr pScrn);
+
+void VIAGetTV2Mask(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetTV2NTSC(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetTV2PAL(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetTV3Mask(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetTV3NTSC(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetTV3PAL(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetSAA7108Mask(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetSAA7108NTSC(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetSAA7108PAL(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetCH7019Mask(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetCH7019NTSC(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetCH7019PAL(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetFS454Mask(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+void VIAGetFS454NTSC(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);
+/*void VIAGetFS454PAL(VIAModeTablePtr pViaModeTable, unsigned char *pBIOS,
+ unsigned char *pTable);*/
+
+#ifdef CREATE_TV2_HEADERFILE
+Bool VIACreateTV2(VIAModeTablePtr pViaModeTable);
+#endif
+#ifdef CREATE_TV3_HEADERFILE
+Bool VIACreateTV3(VIAModeTablePtr pViaModeTable);
+#endif
+#ifdef CREATE_VT1622A_HEADERFILE
+Bool VIACreateVT1622A(VIAModeTablePtr pViaModeTable);
+#endif
+#ifdef CREATE_SAA7108_HEADERFILE
+Bool VIACreateSAA7108(VIAModeTablePtr pViaModeTable);
+#endif
+#ifdef CREATE_CH7019_HEADERFILE
+Bool VIACreateCH7019(VIAModeTablePtr pViaModeTable);
+#endif
+#ifdef CREATE_FS454_HEADERFILE
+Bool VIACreateFS454(VIAModeTablePtr pViaModeTable);
+#endif
+#endif /* _VIA_BIOS_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_ch7019.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_ch7019.h new file mode 100644 index 000000000..0bc27c2ed --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_ch7019.h @@ -0,0 +1,155 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_CH7019MODETABLE_H
+#define _VIA_CH7019MODETABLE_H
+
+VIABIOSTVMASKTableRec ch7019MaskTable = {
+ { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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programs/Xserver/hw/xfree86/drivers/via/via_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_cursor.c new file mode 100644 index 000000000..433c1dbfd --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_cursor.c @@ -0,0 +1,190 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*************************************************************************
+ *
+ * File: via_cursor.c
+ * Content: Hardware cursor support for VIA/S3G UniChrom
+ *
+ ************************************************************************/
+
+#include "via_driver.h"
+
+static void VIALoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src);
+static void VIASetCursorPosition(ScrnInfoPtr pScrn, int x, int y);
+static void VIASetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
+
+
+/*
+ * Read/write to the DAC via MMIO
+ */
+
+#define inCRReg(reg) (VGAHWPTR(pScrn))->readCrtc(VGAHWPTR(pScrn), reg)
+#define outCRReg(reg, val) (VGAHWPTR(pScrn))->writeCrtc(VGAHWPTR(pScrn), reg, val)
+#define inStatus1() (VGAHWPTR(pScrn))->readST01(VGAHWPTR(pScrn))
+
+
+#define MAX_CURS 32
+
+Bool
+VIAHWCursorInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+ xf86CursorInfoPtr infoPtr;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAHWCursorInit\n"));
+ infoPtr = xf86CreateCursorInfoRec();
+ if (!infoPtr)
+ return FALSE;
+
+ pVia->CursorInfoRec = infoPtr;
+
+ infoPtr->MaxWidth = MAX_CURS;
+ infoPtr->MaxHeight = MAX_CURS;
+ infoPtr->Flags = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 |
+ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
+ /*HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK |*/
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_INVERT_MASK |
+ HARDWARE_CURSOR_BIT_ORDER_MSBFIRST|
+ 0;
+
+ infoPtr->SetCursorColors = VIASetCursorColors;
+ infoPtr->SetCursorPosition = VIASetCursorPosition;
+ infoPtr->LoadCursorImage = VIALoadCursorImage;
+ infoPtr->HideCursor = VIAHideCursor;
+ infoPtr->ShowCursor = VIAShowCursor;
+ infoPtr->UseHWCursor = NULL;
+
+ if (!pVia->CursorStart) {
+ pVia->CursorStart = pVia->FBFreeEnd - VIA_CURSOR_SIZE;
+ pVia->FBFreeEnd -= VIA_CURSOR_SIZE;
+
+ /* Set cursor location in frame buffer. */
+ VIASETREG(VIA_REG_CURSOR_MODE, pVia->CursorStart);
+ }
+
+ return xf86InitCursor(pScreen, infoPtr);
+}
+
+
+
+void
+VIAShowCursor(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ CARD32 dwCursorMode;
+
+ dwCursorMode = VIAGETREG(VIA_REG_CURSOR_MODE);
+
+ /* Turn on Hardware Cursor */
+ VIASETREG(VIA_REG_CURSOR_MODE, dwCursorMode | 0x3);
+}
+
+
+void
+VIAHideCursor(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ CARD32 dwCursorMode;
+
+ dwCursorMode = VIAGETREG(VIA_REG_CURSOR_MODE);
+
+ /* Turn cursor off. */
+ VIASETREG(VIA_REG_CURSOR_MODE, dwCursorMode & 0xFFFFFFFE);
+}
+
+
+static void
+VIALoadCursorImage(ScrnInfoPtr pScrn, unsigned char* src)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ CARD32 dwCursorMode;
+
+ WaitIdle();
+
+ dwCursorMode = VIAGETREG(VIA_REG_CURSOR_MODE);
+
+ /* Turn cursor off. */
+ VIASETREG(VIA_REG_CURSOR_MODE, dwCursorMode & 0xFFFFFFFE);
+
+ /* Upload the cursor image to the frame buffer. */
+ memcpy(pVia->FBBase + pVia->CursorStart, src, MAX_CURS * MAX_CURS / 8 * 2);
+
+ /* Restore cursor status */
+ VIASETREG(VIA_REG_CURSOR_MODE, dwCursorMode);
+}
+
+static void
+VIASetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ unsigned char xoff, yoff;
+ CARD32 dwCursorMode;
+
+ if (x < 0) {
+ xoff = ((-x) & 0xFE);
+ x = 0;
+ } else {
+ xoff = 0;
+ }
+
+ if (y < 0) {
+ yoff = ((-y) & 0xFE);
+ y = 0;
+ } else {
+ yoff = 0;
+ /* LCD Expand Mode Cursor Y Position Re-Calculated */
+ if (pBIOSInfo->scaleY) {
+ y = (int)(((pBIOSInfo->panelY * y) + (pBIOSInfo->resY >> 1)) / pBIOSInfo->resY);
+ }
+ }
+
+ /* Hide cursor before set cursor position in order to avoid ghost cursor
+ * image when directly set cursor position. It should be a HW bug but
+ * we can use patch by SW. */
+ dwCursorMode = VIAGETREG(VIA_REG_CURSOR_MODE);
+
+ /* Turn cursor off. */
+ VIASETREG(VIA_REG_CURSOR_MODE, dwCursorMode & 0xFFFFFFFE);
+
+ VIASETREG(VIA_REG_CURSOR_ORG, ((xoff << 16) | (yoff & 0x003f)));
+ VIASETREG(VIA_REG_CURSOR_POS, ((x << 16) | (y & 0x07ff)));
+
+ /* Restore cursor status */
+ VIASETREG(VIA_REG_CURSOR_MODE, dwCursorMode);
+}
+
+
+static void
+VIASetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ VIASETREG(VIA_REG_CURSOR_FG, fg);
+ VIASETREG(VIA_REG_CURSOR_BG, bg);
+
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_dga.c new file mode 100644 index 000000000..ee6c83078 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_dga.c @@ -0,0 +1,357 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "xaalocal.h"
+#include "via_driver.h"
+#include "dgaproc.h"
+
+
+static Bool VIADGAOpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
+ int *, int *, int *);
+static Bool VIADGASetMode(ScrnInfoPtr, DGAModePtr);
+static int VIADGAGetViewport(ScrnInfoPtr);
+static void VIADGASetViewport(ScrnInfoPtr, int, int, int);
+static void VIADGAFillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
+static void VIADGABlitRect(ScrnInfoPtr, int, int, int, int, int, int);
+
+
+static
+DGAFunctionRec VIADGAFuncs = {
+ VIADGAOpenFramebuffer,
+ NULL, /* CloseFrameBuffer */
+ VIADGASetMode,
+ VIADGASetViewport,
+ VIADGAGetViewport,
+ VIAAccelSync,
+ VIADGAFillRect,
+ VIADGABlitRect,
+ NULL /* BlitTransRect */
+};
+
+#define DGATRACE 4
+
+
+static DGAModePtr
+VIASetupDGAMode(
+ ScrnInfoPtr pScrn,
+ DGAModePtr modes,
+ int *num,
+ int bitsPerPixel,
+ int depth,
+ Bool pixmap,
+ int secondPitch,
+ unsigned long red,
+ unsigned long green,
+ unsigned long blue,
+ short visualClass
+)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ DGAModePtr mode, newmodes = NULL;
+ DisplayModePtr pMode, firstMode;
+ int otherPitch, Bpp = bitsPerPixel >> 3;
+ Bool oneMore;
+
+ xf86ErrorFVerb(DGATRACE, " VIASetupDGAMode\n");
+
+ pMode = firstMode = pScrn->modes;
+
+ /*
+ * DGA 1.0 would only provide modes where the depth and stride
+ * matched the current desktop. Some DGA apps might still expect
+ * this, so we provide them, too.
+ */
+
+ while (pMode) {
+
+ otherPitch = secondPitch ? secondPitch : pMode->HDisplay;
+
+ if (pMode->HDisplay != otherPitch) {
+ newmodes = xrealloc(modes, (*num + 2) * sizeof(DGAModeRec));
+ oneMore = TRUE;
+ }
+ else {
+ newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec));
+ oneMore = FALSE;
+ }
+
+ if (!newmodes) {
+ xfree(modes);
+ return NULL;
+ }
+
+ modes = newmodes;
+
+SECOND_PASS:
+
+ mode = modes + *num;
+ (*num)++;
+
+ mode->mode = pMode;
+ mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
+
+ if(!pVia->NoAccel)
+ mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
+
+ if (pMode->Flags & V_DBLSCAN)
+ mode->flags |= DGA_DOUBLESCAN;
+
+ if (pMode->Flags & V_INTERLACE)
+ mode->flags |= DGA_INTERLACED;
+
+ mode->byteOrder = pScrn->imageByteOrder;
+ mode->depth = depth;
+ mode->bitsPerPixel = bitsPerPixel;
+ mode->red_mask = red;
+ mode->green_mask = green;
+ mode->blue_mask = blue;
+ mode->visualClass = visualClass;
+ mode->viewportWidth = pMode->HDisplay;
+ mode->viewportHeight = pMode->VDisplay;
+ mode->xViewportStep = 2;
+ mode->yViewportStep = 1;
+ mode->viewportFlags = DGA_FLIP_RETRACE;
+ mode->offset = 0;
+ mode->address = pVia->FBBase;
+
+ xf86ErrorFVerb(DGATRACE,
+ "VIADGAInit vpWid=%d, vpHgt=%d, Bpp=%d, mdbitsPP=%d\n",
+ mode->viewportWidth,
+ mode->viewportHeight,
+ Bpp,
+ mode->bitsPerPixel);
+
+ if (oneMore) { /* first one is narrow width */
+ mode->bytesPerScanline = ((pMode->HDisplay * Bpp) + 3) & ~3L;
+ mode->imageWidth = pMode->HDisplay;
+ mode->imageHeight = pMode->VDisplay;
+ mode->pixmapWidth = mode->imageWidth;
+ mode->pixmapHeight = mode->imageHeight;
+ mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
+
+ /* this might need to get clamped to some maximum */
+ mode->maxViewportY = mode->imageHeight - mode->viewportHeight;
+ oneMore = FALSE;
+
+ xf86ErrorFVerb(DGATRACE,
+ "VIADGAInit 1 imgHgt=%d, stride=%d\n",
+ mode->imageHeight,
+ mode->bytesPerScanline );
+
+ goto SECOND_PASS;
+ }
+ else {
+ mode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 3) & ~3L;
+ mode->imageWidth = pScrn->displayWidth;
+ mode->imageHeight = pVia->videoRambytes / mode->bytesPerScanline;
+ mode->pixmapWidth = mode->imageWidth;
+ mode->pixmapHeight = mode->imageHeight;
+ mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
+ /* this might need to get clamped to some maximum */
+ mode->maxViewportY = mode->imageHeight - mode->viewportHeight;
+
+ xf86ErrorFVerb(DGATRACE,
+ "VIADGAInit 2 imgHgt=%d, stride=%d\n",
+ mode->imageHeight,
+ mode->bytesPerScanline);
+ }
+
+ pMode = pMode->next;
+
+ if (pMode == firstMode)
+ break;
+ }
+
+ return modes;
+}
+
+
+Bool
+VIADGAInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+ DGAModePtr modes = NULL;
+ int num = 0;
+
+ xf86ErrorFVerb(DGATRACE, " VIADGAInit\n");
+
+ /* 8 */
+ modes = VIASetupDGAMode(pScrn, modes, &num, 8, 8,
+ (pScrn->bitsPerPixel == 8),
+ (pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth,
+ 0, 0, 0, PseudoColor);
+
+ /* 16 */
+ modes = VIASetupDGAMode(pScrn, modes, &num, 16, 16,
+ (pScrn->bitsPerPixel == 16),
+ (pScrn->depth != 16) ? 0 : pScrn->displayWidth,
+ 0xf800, 0x07e0, 0x001f, TrueColor);
+
+ modes = VIASetupDGAMode(pScrn, modes, &num, 16, 16,
+ (pScrn->bitsPerPixel == 16),
+ (pScrn->depth != 16) ? 0 : pScrn->displayWidth,
+ 0xf800, 0x07e0, 0x001f, DirectColor);
+
+ /* 24-in-32 */
+ modes = VIASetupDGAMode(pScrn, modes, &num, 32, 24,
+ (pScrn->bitsPerPixel == 32),
+ (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
+ 0xff0000, 0x00ff00, 0x0000ff, TrueColor);
+
+ modes = VIASetupDGAMode(pScrn, modes, &num, 32, 24,
+ (pScrn->bitsPerPixel == 32),
+ (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
+ 0xff0000, 0x00ff00, 0x0000ff, DirectColor);
+
+ pVia->numDGAModes = num;
+ pVia->DGAModes = modes;
+
+ return DGAInit(pScreen, &VIADGAFuncs, modes, num);
+}
+
+
+static Bool
+VIADGASetMode(ScrnInfoPtr pScrn, DGAModePtr pMode)
+{
+ static int OldDisplayWidth[MAXSCREENS];
+ static int OldBitsPerPixel[MAXSCREENS];
+ static int OldDepth[MAXSCREENS];
+ int index = pScrn->pScreen->myNum;
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ if (!pMode) { /* restore the original mode */
+ /* put the ScreenParameters back */
+
+ pScrn->displayWidth = OldDisplayWidth[index];
+ pScrn->bitsPerPixel = OldBitsPerPixel[index];
+ pScrn->depth = OldDepth[index];
+
+ VIASwitchMode(index, pScrn->currentMode, 0);
+ if (pVia->hwcursor)
+ VIAShowCursor(pScrn);
+
+ pVia->DGAactive = FALSE;
+ }
+ else {
+#if 0
+ ErrorF("pScrn->bitsPerPixel %d, pScrn->depth %d\n",
+ pScrn->bitsPerPixel, pScrn->depth);
+ ErrorF(" want bitsPerPixel %d, want depth %d\n",
+ pMode->bitsPerPixel, pMode->depth);
+#endif
+
+ if (pVia->hwcursor)
+ VIAHideCursor(pScrn);
+
+ if (!pVia->DGAactive) { /* save the old parameters */
+ OldDisplayWidth[index] = pScrn->displayWidth;
+ OldBitsPerPixel[index] = pScrn->bitsPerPixel;
+ OldDepth[index] = pScrn->depth;
+
+ pVia->DGAactive = TRUE;
+ }
+
+ pScrn->bitsPerPixel = pMode->bitsPerPixel;
+ pScrn->depth = pMode->depth;
+ pScrn->displayWidth = pMode->bytesPerScanline /
+ (pMode->bitsPerPixel >> 3);
+
+ VIASwitchMode(index, pMode->mode, 0);
+ }
+
+ return TRUE;
+}
+
+
+static int
+VIADGAGetViewport(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ return pVia->DGAViewportStatus;
+}
+
+
+static void
+VIADGASetViewport(ScrnInfoPtr pScrn, int x, int y, int flags)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ VIAAdjustFrame(pScrn->pScreen->myNum, x, y, flags);
+ pVia->DGAViewportStatus = 0; /* MGAAdjustFrame loops until finished */
+}
+
+
+static void
+VIADGAFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ if (pVia->AccelInfoRec) {
+ (*pVia->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0);
+ (*pVia->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ SET_SYNC_FLAG(pVia->AccelInfoRec);
+ }
+}
+
+
+static void
+VIADGABlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h,
+ int dstx, int dsty)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ if (pVia->AccelInfoRec) {
+ int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
+ int ydir = (srcy < dsty) ? -1 : 1;
+
+ (*pVia->AccelInfoRec->SetupForScreenToScreenCopy)(
+ pScrn, xdir, ydir, GXcopy, ~0, -1);
+ (*pVia->AccelInfoRec->SubsequentScreenToScreenCopy)(
+ pScrn, srcx, srcy, dstx, dsty, w, h);
+ SET_SYNC_FLAG(pVia->AccelInfoRec);
+ }
+}
+
+
+static Bool
+VIADGAOpenFramebuffer(
+ ScrnInfoPtr pScrn,
+ char **name,
+ unsigned char **mem,
+ int *size,
+ int *offset,
+ int *flags)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ *name = NULL; /* no special device */
+ *mem = (unsigned char*)pVia->FrameBufferBase;
+ *size = pVia->videoRambytes;
+ *offset = 0;
+ *flags = DGA_NEED_ROOT;
+
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_dri.c new file mode 100644 index 000000000..3e4c9acc4 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_dri.c @@ -0,0 +1,582 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86Priv.h"
+
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+
+#include "GL/glxtokens.h"
+
+#include "via_driver.h"
+#include "via_dri.h"
+#include "xf86drm.h"
+#include "xf86drmVIA.h"
+extern void GlxSetVisualConfigs(
+ int nconfigs,
+ __GLXvisualConfig *configs,
+ void **configprivs
+);
+unsigned int agpaddr;
+
+#define VIDEO 0
+#define AGP 1
+#define AGP_PAGE_SIZE 4096
+#define AGP_PAGES 2048
+#define AGP_SIZE (AGP_PAGE_SIZE * AGP_PAGES)
+#define AGP_CMDBUF_PAGES 256
+#define AGP_CMDBUF_SIZE (AGP_PAGE_SIZE * AGP_CMDBUF_PAGES)
+
+static char VIAKernelDriverName[] = "via";
+static char VIAClientDriverName[] = "via";
+int test_alloc_FB(ScreenPtr pScreen, VIAPtr pVia, int Size);
+int test_alloc_AGP(ScreenPtr pScreen, VIAPtr pVia, int Size);
+static Bool VIAInitVisualConfigs(ScreenPtr pScreen);
+static Bool VIADRIAgpInit(ScreenPtr pScreen, VIAPtr pVia);
+static Bool VIADRIPciInit(ScreenPtr pScreen, VIAPtr pVia);
+static Bool VIADRIFBInit(ScreenPtr pScreen, VIAPtr pVia);
+static Bool VIADRIKernelInit(ScreenPtr pScreen, VIAPtr pVia);
+static Bool VIADRIMapInit(ScreenPtr pScreen, VIAPtr pVia);
+
+static Bool VIACreateContext(ScreenPtr pScreen, VisualPtr visual,
+ drmContext hwContext, void *pVisualConfigPriv,
+ DRIContextType contextStore);
+static void VIADestroyContext(ScreenPtr pScreen, drmContext hwContext,
+ DRIContextType contextStore);
+static void VIADRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
+ DRIContextType readContextType,
+ void *readContextStore,
+ DRIContextType writeContextType,
+ void *writeContextStore);
+static void VIADRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
+static void VIADRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc, CARD32 index);
+
+
+static Bool VIADRIAgpInit(ScreenPtr pScreen, VIAPtr pVia)
+{
+ unsigned long agp_phys;
+ VIADRIPtr pVIADRI;
+ DRIInfoPtr pDRIInfo;
+ pDRIInfo = pVia->pDRIInfo;
+ pVIADRI = pDRIInfo->devPrivate;
+ pVia->agpSize = 0;
+
+ if (drmAgpAcquire(pVia->drmFD) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed\n");
+ return FALSE;
+ }
+
+ if (drmAgpEnable(pVia->drmFD, drmAgpGetMode(pVia->drmFD)&~0x0) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n");
+ return FALSE;
+ }
+
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] drmAgpEnabled succeeded\n");
+
+ if (drmAgpAlloc(pVia->drmFD, AGP_SIZE, 0, &agp_phys, &pVia->agpHandle) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] drmAgpAlloc failed\n");
+ drmAgpRelease(pVia->drmFD);
+ return FALSE;
+ }
+
+ if (drmAgpBind(pVia->drmFD, pVia->agpHandle, 0) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] drmAgpBind failed\n");
+ drmAgpFree(pVia->drmFD, pVia->agpHandle);
+ drmAgpRelease(pVia->drmFD);
+
+ return FALSE;
+ }
+
+ pVia->agpSize = AGP_SIZE;
+ pVia->agpAddr = drmAgpBase(pVia->drmFD);
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] agpAddr = 0x%08lx\n",pVia->agpAddr);
+
+ pVIADRI->agp.size = pVia->agpSize;
+ if (drmAddMap(pVia->drmFD, (drmHandle)0,
+ pVIADRI->agp.size, DRM_AGP, 0,
+ &pVIADRI->agp.handle) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] Failed to map public agp area\n");
+ pVIADRI->agp.size = 0;
+ return FALSE;
+ }
+ /* Map AGP from kernel to Xserver - Not really needed */
+ drmMap(pVia->drmFD, pVIADRI->agp.handle,pVIADRI->agp.size,
+ (drmAddressPtr)&agpaddr);
+
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] agpBase = 0x%08lx\n", pVia->agpBase);
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] agpAddr = 0x%08lx\n", pVia->agpAddr);
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] agpSize = 0x%08lx\n", pVia->agpSize);
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] agp physical addr = 0x%08lx\n", agp_phys);
+
+ drmVIAAgpInit(pVia->drmFD, 0, AGP_SIZE);
+ return TRUE;
+
+}
+static Bool VIADRIFBInit(ScreenPtr pScreen, VIAPtr pVia)
+{
+ int FBSize = pVia->FBFreeEnd-pVia->FBFreeStart;
+ int FBOffset = pVia->FBFreeStart;
+ VIADRIPtr pVIADRI = pVia->pDRIInfo->devPrivate;
+ pVIADRI->fbOffset = FBOffset;
+ pVIADRI->fbSize = pVia->videoRambytes;
+
+ if (drmVIAFBInit(pVia->drmFD, FBOffset, FBSize) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,"[drm] failed to init frame buffer area\n");
+ return FALSE;
+ }
+ else {
+ xf86DrvMsg(pScreen->myNum, X_INFO,"[drm] FBFreeStart= 0x%08lx FBFreeEnd= 0x%08lx FBSize= 0x%08lx\n", pVia->FBFreeStart, pVia->FBFreeEnd, FBSize);
+ return TRUE;
+ }
+}
+static Bool VIADRIPciInit(ScreenPtr pScreen, VIAPtr pVia)
+{
+ return TRUE;
+}
+
+static Bool
+VIAInitVisualConfigs(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+ int numConfigs = 0;
+ __GLXvisualConfig *pConfigs = 0;
+ VIAConfigPrivPtr pVIAConfigs = 0;
+ VIAConfigPrivPtr *pVIAConfigPtrs = 0;
+ int i, db, stencil, accum;
+
+ switch (pScrn->bitsPerPixel) {
+ case 8:
+ case 24:
+ break;
+ case 16:
+ case 32:
+ numConfigs = 8;
+ if (!(pConfigs = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig),
+ numConfigs)))
+ return FALSE;
+ if (!(pVIAConfigs = (VIAConfigPrivPtr)xcalloc(sizeof(VIAConfigPrivRec),
+ numConfigs))) {
+ xfree(pConfigs);
+ return FALSE;
+ }
+ if (!(pVIAConfigPtrs = (VIAConfigPrivPtr*)xcalloc(sizeof(VIAConfigPrivPtr),
+ numConfigs))) {
+ xfree(pConfigs);
+ xfree(pVIAConfigs);
+ return FALSE;
+ }
+ for (i=0; i<numConfigs; i++)
+ pVIAConfigPtrs[i] = &pVIAConfigs[i];
+
+ i = 0;
+ for (accum = 0; accum <= 1; accum++) {
+ for (stencil=0; stencil<=1; stencil++) {
+ for (db = 0; db <= 1; db++) {
+ pConfigs[i].vid = -1;
+ pConfigs[i].class = -1;
+ pConfigs[i].rgba = TRUE;
+ pConfigs[i].redSize = -1;
+ pConfigs[i].greenSize = -1;
+ pConfigs[i].blueSize = -1;
+ pConfigs[i].redMask = -1;
+ pConfigs[i].greenMask = -1;
+ pConfigs[i].blueMask = -1;
+ pConfigs[i].alphaMask = 0;
+
+ if (accum) {
+ pConfigs[i].accumRedSize = 16;
+ pConfigs[i].accumGreenSize = 16;
+ pConfigs[i].accumBlueSize = 16;
+ pConfigs[i].accumAlphaSize = 16;
+ }
+ else {
+ pConfigs[i].accumRedSize = 0;
+ pConfigs[i].accumGreenSize = 0;
+ pConfigs[i].accumBlueSize = 0;
+ pConfigs[i].accumAlphaSize = 0;
+ }
+ if (db)
+ pConfigs[i].doubleBuffer = TRUE;
+ else
+ pConfigs[i].doubleBuffer = FALSE;
+
+ pConfigs[i].stereo = FALSE;
+ pConfigs[i].bufferSize = -1;
+
+ switch (stencil) {
+ case 0:
+ pConfigs[i].depthSize = 0;
+ pConfigs[i].stencilSize = 0;
+ break;
+ case 1:
+ pConfigs[i].depthSize = 16;
+ pConfigs[i].stencilSize = 0;
+ break;
+ case 2:
+ pConfigs[i].depthSize = 32;
+ pConfigs[i].stencilSize = 0;
+ break;
+ case 3:
+ pConfigs[i].depthSize = 24;
+ pConfigs[i].stencilSize = 8;
+ break;
+ }
+
+ pConfigs[i].auxBuffers = 0;
+ pConfigs[i].level = 0;
+ pConfigs[i].visualRating = GLX_NONE_EXT;
+ pConfigs[i].transparentPixel = 0;
+ pConfigs[i].transparentRed = 0;
+ pConfigs[i].transparentGreen = 0;
+ pConfigs[i].transparentBlue = 0;
+ pConfigs[i].transparentAlpha = 0;
+ pConfigs[i].transparentIndex = 0;
+ i++;
+ }
+ }
+ }
+
+ if (i != numConfigs) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "[dri] Incorrect initialization of visuals. Disabling DRI.\n");
+ return FALSE;
+ }
+
+ break;
+ }
+
+ pVia->numVisualConfigs = numConfigs;
+ pVia->pVisualConfigs = pConfigs;
+ pVia->pVisualConfigsPriv = pVIAConfigs;
+ GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pVIAConfigPtrs);
+
+ return TRUE;
+}
+
+Bool VIADRIScreenInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+ DRIInfoPtr pDRIInfo;
+ VIADRIPtr pVIADRI;
+
+ /* Check that the GLX, DRI, and DRM modules have been loaded by testing
+ * for canonical symbols in each module. */
+ if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE;
+ if (!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE;
+ if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE;
+ if (!xf86LoaderCheckSymbol("DRIQueryVersion")) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[dri] VIADRIScreenInit failed (libdri.a too old)\n");
+ return FALSE;
+ }
+
+ /* Check the DRI version */
+ {
+ int major, minor, patch;
+ DRIQueryVersion(&major, &minor, &patch);
+ if (major != 4 || minor < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[dri] VIADRIScreenInit failed because of a version mismatch.\n"
+ "[dri] libDRI version is %d.%d.%d but version 4.0.x is needed.\n"
+ "[dri] Disabling DRI.\n",
+ major, minor, patch);
+ return FALSE;
+ }
+ }
+
+ pDRIInfo = DRICreateInfoRec();
+
+ if (!pDRIInfo) return FALSE;
+
+ pVia->pDRIInfo = pDRIInfo;
+ pDRIInfo->drmDriverName = VIAKernelDriverName;
+ pDRIInfo->clientDriverName = VIAClientDriverName;
+ pDRIInfo->busIdString = xalloc(64);
+ sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
+ ((pciConfigPtr)pVia->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr)pVia->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr)pVia->PciInfo->thisCard)->funcnum);
+ pDRIInfo->ddxDriverMajorVersion = VIA_VERSION_MAJOR;
+ pDRIInfo->ddxDriverMinorVersion = VIA_VERSION_MINOR;
+ pDRIInfo->ddxDriverPatchVersion = PATCHLEVEL;
+ pDRIInfo->frameBufferPhysicalAddress = pVia->FrameBufferBase;
+ pDRIInfo->frameBufferSize = pVia->videoRambytes;
+
+ pDRIInfo->frameBufferStride = (pScrn->displayWidth *
+ pScrn->bitsPerPixel / 8);
+ pDRIInfo->ddxDrawableTableEntry = VIA_MAX_DRAWABLES;
+
+ if (SAREA_MAX_DRAWABLES < VIA_MAX_DRAWABLES)
+ pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES;
+ else
+ pDRIInfo->maxDrawableTableEntry = VIA_MAX_DRAWABLES;
+
+#ifdef NOT_DONE
+ /* FIXME need to extend DRI protocol to pass this size back to client
+ * for SAREA mapping that includes a device private record
+ */
+ pDRIInfo->SAREASize =
+ ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */
+ /* + shared memory device private rec */
+#else
+ /* For now the mapping works by using a fixed size defined
+ * in the SAREA header
+ */
+ if (sizeof(XF86DRISAREARec)+sizeof(VIASAREAPriv) > SAREA_MAX) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Data does not fit in SAREA\n");
+ return FALSE;
+ }
+ pDRIInfo->SAREASize = SAREA_MAX;
+#endif
+
+ if (!(pVIADRI = (VIADRIPtr)xcalloc(sizeof(VIADRIRec),1))) {
+ DRIDestroyInfoRec(pVia->pDRIInfo);
+ pVia->pDRIInfo=0;
+ return FALSE;
+ }
+ pDRIInfo->devPrivate = pVIADRI;
+ pDRIInfo->devPrivateSize = sizeof(VIADRIRec);
+ pDRIInfo->contextSize = sizeof(VIADRIContextRec);
+
+ pDRIInfo->CreateContext = VIACreateContext;
+ pDRIInfo->DestroyContext = VIADestroyContext;
+ pDRIInfo->SwapContext = VIADRISwapContext;
+ pDRIInfo->InitBuffers = VIADRIInitBuffers;
+ pDRIInfo->MoveBuffers = VIADRIMoveBuffers;
+ pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
+
+ if (!DRIScreenInit(pScreen, pDRIInfo, &pVia->drmFD)) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[dri] DRIScreenInit failed. Disabling DRI.\n");
+ xfree(pDRIInfo->devPrivate);
+ pDRIInfo->devPrivate=0;
+ DRIDestroyInfoRec(pVia->pDRIInfo);
+ pVia->pDRIInfo=0;
+ pVia->drmFD = -1;
+ return FALSE;
+ }
+
+
+ pVia->IsPCI = !VIADRIAgpInit(pScreen, pVia);
+
+ if (pVia->IsPCI) {
+ VIADRIPciInit(pScreen, pVia);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] use pci.\n" );
+ }
+ else
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] use agp.\n" );
+
+ if (!(VIADRIFBInit(pScreen, pVia))) {
+ VIADRICloseScreen(pScreen);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[dri] frame buffer initialize fial .\n" );
+ return FALSE;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] frame buffer initialized.\n" );
+
+ if (!(VIAInitVisualConfigs(pScreen))) {
+ VIADRICloseScreen(pScreen);
+ return FALSE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized.\n" );
+
+ /* DRIScreenInit doesn't add all the common mappings. Add additional mappings here. */
+ if (!VIADRIMapInit(pScreen, pVia)) {
+ VIADRICloseScreen(pScreen);
+ return FALSE;
+ }
+ pVIADRI->regs.size = VIA_MMIO_REGSIZE;
+ pVIADRI->regs.map = 0;
+ pVIADRI->regs.handle = pVia->registerHandle;
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] mmio Registers = 0x%08lx\n",
+ pVIADRI->regs.handle);
+
+ pVIADRI->drixinerama = pVia->drixinerama;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] mmio maped.\n" );
+
+ return TRUE;
+}
+
+void
+VIADRICloseScreen(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ DRICloseScreen(pScreen);
+
+ if (pVia->pDRIInfo) {
+ if (pVia->pDRIInfo->devPrivate) {
+ xfree(pVia->pDRIInfo->devPrivate);
+ pVia->pDRIInfo->devPrivate=0;
+ }
+ DRIDestroyInfoRec(pVia->pDRIInfo);
+ pVia->pDRIInfo=0;
+ }
+
+ if (pVia->pVisualConfigs) xfree(pVia->pVisualConfigs);
+ if (pVia->pVisualConfigsPriv) xfree(pVia->pVisualConfigsPriv);
+ if (pVia->agpSize) {
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Freeing agp memory\n");
+ drmAgpFree(pVia->drmFD, pVia->agpHandle);
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Releasing agp module\n");
+ drmAgpRelease(pVia->drmFD);
+ }
+}
+
+/* TODO: xserver receives driver's swapping event and do something
+ * according the data initialized in this function
+ */
+static Bool
+VIACreateContext(ScreenPtr pScreen, VisualPtr visual,
+ drmContext hwContext, void *pVisualConfigPriv,
+ DRIContextType contextStore)
+{
+ return TRUE;
+}
+
+static void
+VIADestroyContext(ScreenPtr pScreen, drmContext hwContext,
+ DRIContextType contextStore)
+{
+}
+
+Bool
+VIADRIFinishScreenInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIADRIPtr pVIADRI;
+
+ pVia->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
+
+ DRIFinishScreenInit(pScreen);
+
+ if (!VIADRIKernelInit(pScreen, pVia)) {
+ VIADRICloseScreen(pScreen);
+ return FALSE;
+ }
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[dri] kernel data initilized.\n");
+
+ /* set SAREA value */
+ {
+ VIASAREAPriv *saPriv;
+
+ saPriv=(VIASAREAPriv*)DRIGetSAREAPrivate(pScreen);
+ assert(saPriv);
+ memset(saPriv, 0, sizeof(*saPriv));
+ saPriv->CtxOwner = -1;
+ }
+ pVIADRI=(VIADRIPtr)pVia->pDRIInfo->devPrivate;
+ pVIADRI->deviceID=pVia->Chipset;
+ pVIADRI->width=pScrn->virtualX;
+ pVIADRI->height=pScrn->virtualY;
+ pVIADRI->mem=pScrn->videoRam*1024;
+ pVIADRI->bytesPerPixel= (pScrn->bitsPerPixel+7) / 8;
+ pVIADRI->sarea_priv_offset = sizeof(XF86DRISAREARec);
+ /* TODO */
+ pVIADRI->scrnX=pVIADRI->width;
+ pVIADRI->scrnY=pVIADRI->height;
+
+ return TRUE;
+}
+
+static void
+VIADRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
+ DRIContextType oldContextType, void *oldContext,
+ DRIContextType newContextType, void *newContext)
+{
+ /*ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+ */
+ return;
+}
+
+static void
+VIADRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
+{
+ /*ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+ */
+ return;
+}
+
+static void
+VIADRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc, CARD32 index)
+{
+ /*ScreenPtr pScreen = pParent->drawable.pScreen;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+ */
+ return;
+}
+
+/* Initialize the kernel data structures. */
+static Bool VIADRIKernelInit(ScreenPtr pScreen, VIAPtr pVia)
+{
+ drmVIAInit drmInfo;
+ drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec);
+ drmInfo.fb_offset = pVia->FrameBufferBase;
+ drmInfo.mmio_offset = pVia->registerHandle;
+ if (pVia->IsPCI)
+ drmInfo.agpAddr = (CARD32)NULL;
+ else
+ drmInfo.agpAddr = (CARD32)pVia->agpAddr;
+
+ if (drmVIAInitMAP(pVia->drmFD, &drmInfo) < 0) return FALSE;
+
+ return TRUE;
+}
+/* Add a map for the MMIO registers */
+static Bool VIADRIMapInit(ScreenPtr pScreen, VIAPtr pVia)
+{
+ int flags = 0;
+
+ if (drmAddMap(pVia->drmFD, pVia->MmioBase, VIA_MMIO_REGSIZE,
+ DRM_REGISTERS, flags, &pVia->registerHandle) < 0) {
+ return FALSE;
+ }
+
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] register handle = 0x%08lx\n", pVia->registerHandle);
+
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_dri.h new file mode 100644 index 000000000..b004537c7 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_dri.h @@ -0,0 +1,83 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#ifndef _VIA_DRI_
+#define _VIA_DRI_
+
+#include "xf86drm.h"
+
+#define VIA_MAX_DRAWABLES 256
+
+#define VIA_VERSION_MAJOR 4
+#define VIA_VERSION_MINOR 1
+
+typedef struct {
+ int CtxOwner;
+} VIASAREAPriv;
+
+typedef struct {
+ drmHandle handle;
+ drmSize size;
+ drmAddress map;
+} viaRegion, *viaRegionPtr;
+
+typedef struct {
+ viaRegion regs, agp;
+ int deviceID;
+ int width;
+ int height;
+ int mem;
+ int bytesPerPixel;
+ int priv1;
+ int priv2;
+ int fbOffset;
+ int fbSize;
+ Bool drixinerama;
+
+ int backOffset;
+ int depthOffset;
+ int textureOffset;
+ int textureSize;
+ int irqEnabled;
+ unsigned int scrnX, scrnY;
+ int sarea_priv_offset;
+} VIADRIRec, *VIADRIPtr;
+
+typedef struct {
+ int dummy;
+} VIAConfigPrivRec, *VIAConfigPrivPtr;
+
+typedef struct {
+ int dummy;
+} VIADRIContextRec, *VIADRIContextPtr;
+
+#ifdef XFree86Server
+
+#include "screenint.h"
+
+Bool VIADRIScreenInit(ScreenPtr pScreen);
+void VIADRICloseScreen(ScreenPtr pScreen);
+Bool VIADRIFinishScreenInit(ScreenPtr pScreen);
+
+#endif
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_driver.c new file mode 100644 index 000000000..49132e50c --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_driver.c @@ -0,0 +1,3501 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*************************************************************************
+ *
+ * File: via_driver.c
+ * Content: XFree86 4.0 for VIA/S3G UniChrom
+ *
+ ************************************************************************/
+
+#include "xf86RAC.h"
+#include "shadowfb.h"
+
+#include "globals.h"
+#define DPMS_SERVER
+#include "extensions/dpms.h"
+
+
+#include "via_driver.h"
+#include "via_video.h"
+#include "videodev.h"
+#include "via_swov.h"
+#include "HWDiff.h"
+
+#include "ddmpeg.h"
+#include "capture.h"
+#include "via.h"
+#include "via_privIoctl.h" /* for VIAGRAPHICINFO & custom ioctl command */
+#ifdef XF86DRI
+#include "dri.h"
+#endif
+
+/*
+ * prototypes
+ */
+
+static void VIAIdentify(int flags);
+static Bool VIAProbe(DriverPtr drv, int flags);
+static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags);
+static Bool VIAEnterVT(int scrnIndex, int flags);
+static void VIALeaveVT(int scrnIndex, int flags);
+static void VIASave(ScrnInfoPtr pScrn);
+static void VIAWriteMode(ScrnInfoPtr pScrn, vgaRegPtr, VIARegPtr);
+static Bool VIAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
+static Bool VIACloseScreen(int scrnIndex, ScreenPtr pScreen);
+static Bool VIASaveScreen(ScreenPtr pScreen, int mode);
+static void VIALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies,
+ LOCO *colors, VisualPtr pVisual);
+static Bool VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
+ char **argv);
+static int VIAInternalScreenInit(int scrnIndex, ScreenPtr pScreen);
+static void VIAFreeScreen(int scrnIndex, int flags);
+static ModeStatus VIAValidMode(int index, DisplayModePtr mode,
+ Bool verbose, int flags);
+static void VIADPMS(ScrnInfoPtr pScrn, int mode, int flags);
+static const OptionInfoRec * VIAAvailableOptions(int chipid, int busid);
+
+
+static void VIAEnableMMIO(ScrnInfoPtr pScrn);
+static void VIADisableMMIO(ScrnInfoPtr pScrn);
+static Bool VIAMapMMIO(ScrnInfoPtr pScrn);
+static Bool VIAMapFB(ScrnInfoPtr pScrn);
+static void VIAUnmapMem(ScrnInfoPtr pScrn);
+static int VIAGetMemSize();
+Bool VIADeviceSeletion(ScrnInfoPtr pScrn);
+Bool VIADeviceDispatch(ScrnInfoPtr pScrn);
+
+extern unsigned char Save_3C4_16;
+extern unsigned char Save_3C4_17;
+extern unsigned char Save_3C4_18;
+
+#ifdef XF86DRI
+void VIAInitialize3DEngine(ScrnInfoPtr pScrn);
+static Bool b3DRegsInitialized = 0;
+#endif
+
+extern VIAGRAPHICINFO gVIAGraphicInfo;
+extern LPVIAVIDCTRL lpVideoControl;
+
+/* E X T E R N F U N C T I O N S ------------------------------------------*/
+extern void vfInitHWDiff( VIAPtr pVia );
+/*---------------------------------------------------------------------------*/
+
+DriverRec VIA =
+{
+ VIA_VERSION,
+ DRIVER_NAME,
+ VIAIdentify,
+ VIAProbe,
+ VIAAvailableOptions,
+ NULL,
+ 0
+};
+
+
+/* Supported chipsets */
+
+static SymTabRec VIAChipsets[] = {
+ {VIA_CLE266, "CLE266"},
+ {VIA_KM400, "KM400"},
+ {VIA_K8M400, "K8M400"},
+ {-1, NULL }
+};
+
+
+/* This table maps a PCI device ID to a chipset family identifier. */
+
+static PciChipsets VIAPciChipsets[] = {
+ {VIA_CLE266, PCI_CHIP_CLE3122, RES_SHARED_VGA},
+ {VIA_CLE266, PCI_CHIP_CLE3022, RES_SHARED_VGA},
+ {VIA_KM400, PCI_CHIP_VT7205, RES_SHARED_VGA},
+ {VIA_KM400, PCI_CHIP_VT3205, RES_SHARED_VGA},
+ {VIA_K8M400, PCI_CHIP_VT7204, RES_SHARED_VGA},
+ {VIA_K8M400, PCI_CHIP_VT3204, RES_SHARED_VGA},
+ {-1, -1, RES_UNDEFINED}
+};
+
+int gVIAEntityIndex = -1;
+
+typedef enum {
+ OPTION_A2,
+ OPTION_PCI_BURST,
+ OPTION_PCI_RETRY,
+ OPTION_NOACCEL,
+ OPTION_SWCURSOR,
+ OPTION_HWCURSOR,
+ OPTION_SHADOW_FB,
+ OPTION_ROTATE,
+ OPTION_USEBIOS,
+ OPTION_VIDEORAM,
+ OPTION_ACTIVEDEVICE,
+ OPTION_LCDDUALEDGE,
+ OPTION_BUSWIDTH,
+ OPTION_CENTER,
+ OPTION_PANELSIZE,
+ OPTION_TVDOTCRAWL,
+ OPTION_TVTYPE,
+ OPTION_TVOUTPUT,
+ OPTION_TVVSCAN,
+ OPTION_TVHSCALE,
+ OPTION_TVENCODER,
+ OPTION_REFRESH,
+ OPTION_DISABLEVQ,
+ OPTION_NODDCVALUE,
+ OPTION_CAP0_DEINTERLACE,
+ OPTION_CAP1_DEINTERLACE,
+ OPTION_CAP0_FIELDSWAP,
+ OPTION_DRIXINERAMA
+} VIAOpts;
+
+
+static OptionInfoRec VIAOptions[] =
+{
+ {OPTION_A2, "A2", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_VIDEORAM, "VideoRAM", OPTV_INTEGER, {0}, FALSE},
+ {OPTION_ACTIVEDEVICE, "ActiveDevice", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_LCDDUALEDGE, "LCDDualEdge", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_BUSWIDTH, "BusWidth", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_CENTER, "Center", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_PANELSIZE, "PanelSize", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_TVDOTCRAWL, "TVDotCrawl", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_TVTYPE, "TVType", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_TVOUTPUT, "TVOutput", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_TVVSCAN, "TVVScan", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_TVHSCALE, "TVHScale", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_TVENCODER, "TVEncoder", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_REFRESH, "Refresh", OPTV_INTEGER, {0}, FALSE},
+ {OPTION_DISABLEVQ, "DisableVQ", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_NODDCVALUE, "NoDDCValue", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_CAP0_DEINTERLACE, "Cap0Deinterlace", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_CAP1_DEINTERLACE, "Cap1Deinterlace", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_CAP0_FIELDSWAP, "Cap0FieldSwap", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DRIXINERAMA, "DRIXINERAMA", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE}
+};
+
+
+static const char *vgaHWSymbols[] = {
+ "vgaHWGetHWRec",
+ "vgaHWSetMmioFuncs",
+ "vgaHWSetStdFuncs",
+ "vgaHWGetIOBase",
+ "vgaHWSave",
+ "vgaHWProtect",
+ "vgaHWRestore",
+ "vgaHWMapMem",
+ "vgaHWUnmapMem",
+ "vgaHWInit",
+ "vgaHWSaveScreen",
+ "vgaHWLock",
+ "vgaHWUnlock",
+ "vgaHWFreeHWRec",
+ NULL
+};
+
+
+static const char *ramdacSymbols[] = {
+ "xf86InitCursor",
+ "xf86CreateCursorInfoRec",
+ "xf86DestroyCursorInfoRec",
+ NULL
+};
+
+static const char *vbeSymbols[] = {
+ "VBEInit",
+ "vbeDoEDID",
+ "vbeFree",
+ NULL
+};
+
+static const char *ddcSymbols[] = {
+ "xf86InterpretEDID",
+ "xf86PrintEDID",
+ "xf86DoEDID_DDC1",
+ "xf86DoEDID_DDC2",
+ "xf86SetDDCproperties",
+ NULL
+};
+
+
+static const char *i2cSymbols[] = {
+ "xf86CreateI2CBusRec",
+ "xf86I2CBusInit",
+ "xf86CreateI2CDevRec",
+ "xf86I2CDevInit",
+ "xf86I2CWriteRead",
+ "xf86DestroyI2CDevRec",
+ NULL
+};
+
+static const char *xaaSymbols[] = {
+ "XAACopyROP",
+ "XAACopyROP_PM",
+ "XAAPatternROP",
+ "XAACreateInfoRec",
+ "XAADestroyInfoRec",
+ "XAAHelpPatternROP",
+ "XAAHelpSolidROP",
+ "XAAInit",
+ "XAAScreenIndex",
+ NULL
+};
+
+static const char *int10Symbols[] = {
+ "xf86FreeInt10",
+ "xf86InitInt10",
+ NULL
+};
+
+static const char *shadowSymbols[] = {
+ "ShadowFBInit",
+ NULL
+};
+
+#ifdef USE_FB
+static const char *fbSymbols[] = {
+ "fbScreenInit",
+ "fbPictureInit",
+ NULL
+};
+#else
+static const char *cfbSymbols[] = {
+ "cfbScreenInit",
+ "cfb16ScreenInit",
+ "cfb24ScreenInit",
+ "cfb24_32ScreenInit",
+ "cfb32ScreenInit",
+ "cfb16BresS",
+ "cfb24BresS",
+ NULL
+};
+#endif
+
+#ifdef XF86DRI
+static const char *drmSymbols[] = {
+ "drmAddMap",
+ "drmAgpAcquire",
+ "drmAgpAlloc",
+ "drmAgpBase",
+ "drmAgpBind",
+ "drmAgpEnable",
+ "drmAgpFree",
+ "drmAgpGetMode",
+ "drmAgpRelease",
+ "drmCtlInstHandler",
+ "drmGetInterruptFromBusID",
+ NULL
+};
+
+static const char *driSymbols[] = {
+ "DRICloseScreen",
+ "DRICreateInfoRec",
+ "DRIDestroyInfoRec",
+ "DRIFinishScreenInit",
+ "DRIGetSAREAPrivate",
+ "DRILock",
+ "DRIQueryVersion",
+ "DRIScreenInit",
+ "DRIUnlock",
+ "GlxSetVisualConfigs",
+ NULL
+};
+#endif
+
+#ifdef XFree86LOADER
+
+static MODULESETUPPROTO(VIASetup);
+
+static XF86ModuleVersionInfo VIAVersRec = {
+ "via",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_VIDEODRV,
+ {0, 0, 0, 0}
+};
+
+XF86ModuleData viaModuleData = {&VIAVersRec, VIASetup, NULL};
+
+void FillGraphicInfo(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ FILE* pFilePointer; /* for SAMM mode passing screen info */
+ char szBuffer[256];
+ char* pBuffer;
+ int icount = 0;
+
+ gVIAGraphicInfo.TotalVRAM = pVia->videoRambytes;
+ gVIAGraphicInfo.VideoHeapBase = (unsigned long) pVia->FBFreeStart;
+ gVIAGraphicInfo.VideoHeapEnd = (unsigned long) (pVia->FBFreeEnd - 1);
+ gVIAGraphicInfo.dwWidth = pBIOSInfo->CrtcHDisplay;
+ gVIAGraphicInfo.dwHeight = pBIOSInfo->CrtcVDisplay;
+ gVIAGraphicInfo.dwBPP = pScrn->bitsPerPixel;
+ gVIAGraphicInfo.dwPitch = (((pScrn->virtualX) + 15) & ~15) * (pScrn->bitsPerPixel) / 8;
+ gVIAGraphicInfo.dwRefreshRate = (unsigned long)pBIOSInfo->FoundRefresh;
+ gVIAGraphicInfo.dwDVIOn = pBIOSInfo->DVIAttach;
+ gVIAGraphicInfo.dwExpand = pBIOSInfo->scaleY;
+ gVIAGraphicInfo.dwPanelWidth = pBIOSInfo->panelX;
+ gVIAGraphicInfo.dwPanelHeight = pBIOSInfo->panelY;
+ gVIAGraphicInfo.Cap0_Deinterlace = pVia->Cap0_Deinterlace;
+ gVIAGraphicInfo.Cap1_Deinterlace = pVia->Cap1_Deinterlace;
+ gVIAGraphicInfo.Cap0_FieldSwap = pVia->Cap0_FieldSwap;
+ gVIAGraphicInfo.RevisionID = pVia->ChipRev;
+
+ /* for SAMM mode passing screen info */
+ gVIAGraphicInfo.HasSecondary = pBIOSInfo->HasSecondary;
+ gVIAGraphicInfo.IsSecondary = pBIOSInfo->IsSecondary;
+
+ if( (pFilePointer = fopen( "/etc/X11/XF86Config-4", "r" )) != NULL )
+ {
+ while( !feof(pFilePointer) )
+ {
+ fgets(szBuffer, sizeof(szBuffer), pFilePointer);
+ pBuffer = szBuffer;
+ for ( icount=0 ; icount<256 ; icount++ )
+ {
+ if ( strncmp(pBuffer, "RightOf", 7) == 0 )
+ {
+ ErrorF("Screen 1 is Right side !!!!!!!!!!!!\n");
+ break;
+ }
+ if ( strncmp(pBuffer, "LeftOf", 6) == 0 )
+ {
+ gVIAGraphicInfo.Screen1IsLeft = 1;
+ ErrorF("Screen 1 is Left side !!!!!!!!!!!!\n");
+ break;
+ }
+ if ( strncmp(pBuffer, "Below", 5) == 0 )
+ {
+ ErrorF("Screen 1 is Below !!!!!!!!!!!!\n");
+ break;
+ }
+ if ( strncmp(pBuffer, "Above", 5) == 0 )
+ {
+ gVIAGraphicInfo.Screen1IsAbove = 1;
+ ErrorF("Screen 1 is Above !!!!!!!!!!!!\n");
+ break;
+ }
+ pBuffer++;
+ }
+ }
+ fclose( pFilePointer );
+ }
+
+
+ /* Added to pass DRM info to V4L */
+#ifdef XF86DRI
+ gVIAGraphicInfo.DRMEnabled = pVia->directRenderingEnabled;
+#else
+ gVIAGraphicInfo.DRMEnabled = 0;
+#endif
+}
+
+static pointer VIASetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ if (!setupDone) {
+ setupDone = TRUE;
+ xf86AddDriver(&VIA, module, 0);
+ LoaderRefSymLists(vgaHWSymbols,
+#ifdef USE_FB
+ fbSymbols,
+#else
+ cfbSymbols,
+#endif
+ ramdacSymbols,
+ xaaSymbols,
+ shadowSymbols,
+ vbeSymbols,
+ i2cSymbols,
+ ddcSymbols,
+ /*
+ mpegSymbols,
+ */
+#ifdef XF86DRI
+ drmSymbols,
+ driSymbols,
+#endif
+ NULL);
+
+ return (pointer) 1;
+ }
+ else {
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
+
+ return NULL;
+ }
+} /* VIASetup */
+
+#endif /* XFree86LOADER */
+
+
+static int
+WaitIdleCLE266(VIAPtr pVia)
+{
+ int loop = 0;
+
+ mem_barrier();
+
+ while (!(VIAGETREG(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && (loop++ < MAXLOOP))
+ ;
+
+ while ((VIAGETREG(VIA_REG_STATUS) &
+ (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | VIA_3D_ENG_BUSY)) &&
+ (loop++ < MAXLOOP))
+ ;
+
+ return loop >= MAXLOOP;
+}
+
+
+static Bool VIAGetRec(ScrnInfoPtr pScrn)
+{
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetRec\n"));
+ if (pScrn->driverPrivate)
+ return TRUE;
+
+ pScrn->driverPrivate = xnfcalloc(sizeof(VIARec), 1);
+ ((VIARec *)(pScrn->driverPrivate))->pBIOSInfo =
+ xnfcalloc(sizeof(VIABIOSInfoRec), 1);
+ ((VIARec *)(pScrn->driverPrivate))->pBIOSInfo->pModeTable =
+ xnfcalloc(sizeof(VIAModeTableRec), 1);
+
+ /* initial value in VIARec */
+ ((VIARec *)(pScrn->driverPrivate))->SavedReg.mode = 0xFF;
+ ((VIARec *)(pScrn->driverPrivate))->ModeReg.mode = 0xFF;
+
+ ((VIARec *)(pScrn->driverPrivate))->pBIOSInfo->FirstInit = TRUE;
+
+ return TRUE;
+
+} /* VIAGetRec */
+
+
+static void VIAFreeRec(ScrnInfoPtr pScrn)
+{
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAFreeRec\n"));
+ if (!pScrn->driverPrivate)
+ return;
+
+ xfree(((VIARec *)(pScrn->driverPrivate))->pBIOSInfo->pModeTable);
+ xfree(((VIARec *)(pScrn->driverPrivate))->pBIOSInfo);
+ xfree(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+
+ VIAUnmapMem(pScrn);
+
+} /* VIAFreeRec */
+
+
+static const OptionInfoRec * VIAAvailableOptions(int chipid, int busid)
+{
+
+ return VIAOptions;
+
+} /* VIAAvailableOptions */
+
+
+static void VIAIdentify(int flags)
+{
+ xf86PrintChipsets(DRIVER_NAME,
+ "driver for VIA chipsets",
+ VIAChipsets);
+} /* VIAIdentify */
+
+
+static Bool VIAProbe(DriverPtr drv, int flags)
+{
+ GDevPtr *devSections;
+ int *usedChips;
+ int numDevSections;
+ int numUsed;
+ Bool foundScreen = FALSE;
+ int i;
+
+ /* sanity checks */
+ if ((numDevSections = xf86MatchDevice(DRIVER_NAME, &devSections)) <= 0)
+ return FALSE;
+
+ if (xf86GetPciVideoInfo() == NULL)
+ return FALSE;
+
+ numUsed = xf86MatchPciInstances(DRIVER_NAME,
+ PCI_VIA_VENDOR_ID,
+ VIAChipsets,
+ VIAPciChipsets,
+ devSections,
+ numDevSections,
+ drv,
+ &usedChips);
+ xfree(devSections);
+
+ if (numUsed <= 0)
+ return FALSE;
+
+ if (flags & PROBE_DETECT) {
+ foundScreen = TRUE;
+ }
+ else {
+ for (i = 0; i < numUsed; i++) {
+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
+ EntityInfoPtr pEnt;
+ if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
+ VIAPciChipsets, 0, 0, 0, 0, 0)))
+ {
+ pScrn->driverVersion = (int)DRIVER_VERSION;
+ pScrn->driverName = DRIVER_NAME;
+ pScrn->name = DRIVER_NAME;
+ pScrn->Probe = VIAProbe;
+ pScrn->PreInit = VIAPreInit;
+ pScrn->ScreenInit = VIAScreenInit;
+ pScrn->SwitchMode = VIASwitchMode;
+ pScrn->AdjustFrame = VIAAdjustFrame;
+ pScrn->EnterVT = VIAEnterVT;
+ pScrn->LeaveVT = VIALeaveVT;
+ pScrn->FreeScreen = VIAFreeScreen;
+ pScrn->ValidMode = VIAValidMode;
+ foundScreen = TRUE;
+ }
+ /*
+ xf86ConfigActivePciEntity(pScrn,
+ usedChips[i],
+ VIAPciChipsets,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ */
+
+ pEnt = xf86GetEntityInfo(usedChips[i]);
+
+ /* CLE266 card support Dual-Head, mark the entity as sharable*/
+ if(pEnt->chipset == VIA_CLE266)
+ {
+ static int instance = 0;
+ DevUnion* pPriv;
+
+ xf86SetEntitySharable(usedChips[i]);
+ xf86SetEntityInstanceForScreen(pScrn,
+ pScrn->entityList[0], instance);
+
+ if(gVIAEntityIndex < 0)
+ {
+ gVIAEntityIndex = xf86AllocateEntityPrivateIndex();
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
+ gVIAEntityIndex);
+
+ if (!pPriv->ptr)
+ {
+ VIAEntPtr pVIAEnt;
+ pPriv->ptr = xnfcalloc(sizeof(VIAEntRec), 1);
+ pVIAEnt = pPriv->ptr;
+ pVIAEnt->IsDRIEnabled = FALSE;
+ pVIAEnt->BypassSecondary = FALSE;
+ pVIAEnt->HasSecondary = FALSE;
+ pVIAEnt->IsSecondaryRestored = FALSE;
+ }
+ }
+ instance++;
+ }
+ xfree(pEnt);
+ }
+ }
+
+ xfree(usedChips);
+
+ return foundScreen;
+
+} /* VIAProbe */
+
+
+static int LookupChipID(PciChipsets* pset, int ChipID)
+{
+ /* Is there a function to do this for me? */
+ while (pset->numChipset >= 0)
+ {
+ if (pset->PCIid == ChipID)
+ return pset->numChipset;
+
+ pset++;
+ }
+
+ return -1;
+
+} /* LookupChipID */
+
+
+static unsigned int
+VIAddc1Read(ScrnInfoPtr pScrn)
+{
+ register vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ register CARD8 tmp;
+
+ while (hwp->readST01(hwp)&0x8) {};
+ while (!(hwp->readST01(hwp)&0x8)) {};
+
+ VGAOUT8(0x3c4, 0x26);
+ tmp = VGAIN8(0x3c5);
+ return ((unsigned int) ((tmp & 0x08) >> 3));
+}
+
+static Bool
+VIAddc1(int scrnIndex)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ VIAPtr pVia = VIAPTR(pScrn);
+ xf86MonPtr pMon;
+ CARD8 tmp;
+ Bool success = FALSE;
+
+ /* initialize chipset */
+ VGAOUT8(0x3c4, 0x26);
+ tmp = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x26);
+ VGAOUT8(0x3c5, (tmp | 0x11));
+
+ if ((pMon = xf86PrintEDID(
+ xf86DoEDID_DDC1(scrnIndex,vgaHWddc1SetSpeed,VIAddc1Read))) != NULL)
+ success = TRUE;
+ xf86SetDDCproperties(pScrn,pMon);
+
+ /* undo initialization */
+ VGAOUT8(0x3c4, 0x26);
+ VGAOUT8(0x3c5, tmp);
+ return success;
+}
+
+static Bool
+VIAddc2(int scrnIndex)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ VIAPtr pVia = VIAPTR(pScrn);
+ xf86MonPtr pMon;
+ CARD8 tmp;
+ Bool success = FALSE;
+
+ VGAOUT8(0x3c4, 0x26);
+ tmp = VGAIN8(0x3c5);
+ pMon = xf86DoEDID_DDC2(pScrn->scrnIndex, pVia->I2C_Port1);
+ if (pMon)
+ success = TRUE;
+ pVia->DDC1 = pMon;
+ xf86PrintEDID(pMon);
+ xf86SetDDCproperties(pScrn, pMon);
+ VGAOUT8(0x3c4, 0x26);
+ VGAOUT8(0x3c5, tmp);
+
+ return success;
+}
+
+static void
+VIAProbeDDC(ScrnInfoPtr pScrn, int index)
+{
+ vbeInfoPtr pVbe;
+
+ if (xf86LoadSubModule(pScrn, "vbe")) {
+ pVbe = VBEInit(NULL,index);
+ ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
+ }
+}
+
+
+static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags)
+{
+ EntityInfoPtr pEnt;
+ VIAPtr pVia;
+ VIABIOSInfoPtr pBIOSInfo;
+ MessageType from = X_DEFAULT;
+ ClockRangePtr clockRanges;
+ char *s = NULL;
+#ifndef USE_FB
+ char *mod = NULL;
+ const char *reqSym = NULL;
+#endif
+ vgaHWPtr hwp;
+ int vgaCRIndex, vgaCRReg, vgaIOBase;
+ int i, bMemSize = 0, tmp;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAPreInit\n"));
+
+ if (pScrn->numEntities > 1)
+ return FALSE;
+
+ if (flags & PROBE_DETECT)
+ return FALSE;
+
+ if (!xf86LoadSubModule(pScrn, "vgahw"))
+ return FALSE;
+
+ xf86LoaderReqSymLists(vgaHWSymbols, NULL);
+ if (!vgaHWGetHWRec(pScrn))
+ return FALSE;
+
+#if 0
+ /* Here we can alter the number of registers saved and restored by the
+ * standard vgaHWSave and Restore routines.
+ */
+ vgaHWSetRegCounts(pScrn, VGA_NUM_CRTC, VGA_NUM_SEQ, VGA_NUM_GFX, VGA_NUM_ATTR);
+#endif
+
+ if (!VIAGetRec(pScrn)) {
+ return FALSE;
+ }
+
+ pVia = VIAPTR(pScrn);
+ pBIOSInfo = pVia->pBIOSInfo;
+
+ pVia->IsSecondary = FALSE;
+ pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+ if (pEnt->resources) {
+ xfree(pEnt);
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+
+ pVia->EntityIndex = pEnt->index;
+
+ if(xf86IsEntityShared(pScrn->entityList[0]))
+ {
+ if(xf86IsPrimInitDone(pScrn->entityList[0]))
+ {
+ DevUnion* pPriv;
+ VIAEntPtr pVIAEnt;
+ VIAPtr pVia1;
+
+ pVia->IsSecondary = TRUE;
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
+ gVIAEntityIndex);
+ pVIAEnt = pPriv->ptr;
+ if(pVIAEnt->BypassSecondary) return FALSE;
+ pVIAEnt->pSecondaryScrn = pScrn;
+ pVIAEnt->HasSecondary = TRUE;
+ pVia1 = VIAPTR(pVIAEnt->pPrimaryScrn);
+ pVia1->HasSecondary = TRUE;
+ }
+ else
+ {
+ DevUnion* pPriv;
+ VIAEntPtr pVIAEnt;
+
+ xf86SetPrimInitDone(pScrn->entityList[0]);
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
+ gVIAEntityIndex);
+ pVIAEnt = pPriv->ptr;
+ pVIAEnt->pPrimaryScrn = pScrn;
+ pVIAEnt->IsDRIEnabled = FALSE;
+ pVIAEnt->BypassSecondary = FALSE;
+ pVIAEnt->HasSecondary = FALSE;
+ pVIAEnt->RestorePrimary = FALSE;
+ pVIAEnt->IsSecondaryRestored = FALSE;
+ }
+ }
+
+ if (flags & PROBE_DETECT) {
+ VIAProbeDDC(pScrn, pVia->EntityIndex);
+ return TRUE;
+ }
+
+ pScrn->monitor = pScrn->confScreen->monitor;
+
+ /*
+ * We support depths of 8, 16 and 24.
+ * We support bpp of 8, 16, and 32.
+ */
+
+ if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) {
+ return FALSE;
+ }
+ else {
+ switch (pScrn->depth) {
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ /* OK */
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Given depth (%d) is not supported by this driver\n",
+ pScrn->depth);
+ return FALSE;
+ }
+ }
+
+ xf86PrintDepthBpp(pScrn);
+
+ if (pScrn->depth == 32) {
+ pScrn->depth = 24;
+ }
+
+ if (pScrn->depth > 8) {
+ rgb zeros = {0, 0, 0};
+
+ if (!xf86SetWeight(pScrn, zeros, zeros))
+ return FALSE;
+ else {
+ /* TODO check weight returned is supported */
+ ;
+ }
+ }
+
+ if (!xf86SetDefaultVisual(pScrn, -1)) {
+ return FALSE;
+ }
+ else {
+ /* We don't currently support DirectColor at > 8bpp */
+ if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual"
+ " (%s) is not supported at depth %d\n",
+ xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
+ return FALSE;
+ }
+ }
+
+ /* We use a programmable clock */
+ pScrn->progClock = TRUE;
+
+ xf86CollectOptions(pScrn, NULL);
+
+ /* Set the bits per RGB for 8bpp mode */
+ if (pScrn->depth == 8)
+ pScrn->rgbBits = 6;
+
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, VIAOptions);
+
+ pVia->drixinerama = FALSE;
+ if (xf86IsOptionSet(VIAOptions, OPTION_DRIXINERAMA))
+ pVia->drixinerama = TRUE;
+
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_PCI_BURST, FALSE)) {
+ pVia->pci_burst = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Option: pci_burst - PCI burst read enabled\n");
+ }
+ else {
+ pVia->pci_burst = FALSE;
+ }
+
+ pVia->NoPCIRetry = 1; /* default */
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_PCI_RETRY, FALSE)) {
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_PCI_BURST, FALSE)) {
+ pVia->NoPCIRetry = 0;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_retry\n");
+ }
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "\"pci_retry\" option requires \"pci_burst\"\n");
+ }
+ }
+
+ if (xf86IsOptionSet(VIAOptions, OPTION_SHADOW_FB)) {
+ pVia->shadowFB = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: ShadowFB %s.\n",
+ pVia->shadowFB ? "enabled" : "disabled");
+ }
+ else {
+ pVia->shadowFB = FALSE;
+ }
+
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATE))) {
+ if (!xf86NameCmp(s, "CW")) {
+ /* accel is disabled below for shadowFB */
+ pVia->shadowFB = TRUE;
+ pVia->rotate = 1;
+ pVia->hwcursor = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen clockwise - acceleration disabled\n");
+ }
+ else if(!xf86NameCmp(s, "CCW")) {
+ pVia->shadowFB = TRUE;
+ pVia->rotate = -1;
+ pVia->hwcursor = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen"
+ "counter clockwise - acceleration disabled\n");
+ }
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid"
+ "value for Option \"Rotate\"\n", s);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Valid options are \"CW\" or \"CCW\"\n");
+ }
+ }
+
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_NOACCEL, FALSE)) {
+ pVia->NoAccel = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Option: NoAccel -Acceleration Disabled\n");
+ }
+ else {
+ pVia->NoAccel = FALSE;
+ }
+
+ if (pVia->shadowFB && !pVia->NoAccel) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "HW acceleration not supported with \"shadowFB\".\n");
+ pVia->NoAccel = TRUE;
+ }
+
+ /*
+ * The SWCursor setting takes priority over HWCursor. The default
+ * if neither is specified is HW.
+ */
+
+ from = X_DEFAULT;
+ pVia->hwcursor = pVia->shadowFB ? FALSE : TRUE;
+ if (xf86GetOptValBool(VIAOptions, OPTION_HWCURSOR, &pVia->hwcursor))
+ from = X_CONFIG;
+
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_SWCURSOR, FALSE)) {
+ pVia->hwcursor = FALSE;
+ from = X_CONFIG;
+ }
+
+ if (pVia->IsSecondary) pVia->hwcursor = FALSE;
+
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
+ pVia->hwcursor ? "HW" : "SW");
+
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_A2, FALSE)) {
+ pBIOSInfo->A2 = TRUE;
+ }
+ else {
+ pBIOSInfo->A2 = FALSE;
+ }
+
+ from = X_DEFAULT;
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_USEBIOS, FALSE)) {
+ from = X_CONFIG;
+ pBIOSInfo->UseBIOS = TRUE;
+ }
+ else {
+ pBIOSInfo->UseBIOS = FALSE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "%ssing video BIOS to set modes\n",
+ pBIOSInfo->UseBIOS ? "U" : "Not u" );
+
+ pScrn->videoRam = 0;
+ if(xf86GetOptValInteger(VIAOptions, OPTION_VIDEORAM, &pScrn->videoRam)) {
+ xf86DrvMsg( pScrn->scrnIndex, X_CONFIG,
+ "Option: VideoRAM %dkB\n", pScrn->videoRam );
+ }
+
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_DISABLEVQ, FALSE)) {
+ pVia->VQEnable = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Option: DisableVQ -VQ Disabled\n");
+ }
+ else {
+ pVia->VQEnable = TRUE;
+ }
+
+ /* ActiveDevice Option for device selection */
+ pBIOSInfo->ActiveDevice = 0x00;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_ACTIVEDEVICE))) {
+ if (!xf86NameCmp(s, "CRT,TV") || !xf86NameCmp(s, "TV,CRT")) {
+ pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1 | VIA_DEVICE_TV;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is CRT and TV.\n");
+ }
+ else if(!xf86NameCmp(s, "CRT,LCD") || !xf86NameCmp(s, "LCD,CRT")) {
+ pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1 | VIA_DEVICE_LCD;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is CRT and LCD.\n");
+ }
+ else if(!xf86NameCmp(s, "CRT,DFP") || !xf86NameCmp(s, "DFP,CRT")
+ || !xf86NameCmp(s, "CRT,DVI") || !xf86NameCmp(s, "DVI,CRT")) {
+ pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1 | VIA_DEVICE_DFP;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is CRT and DFP.\n");
+ }
+ else if(!xf86NameCmp(s, "TV,DFP") || !xf86NameCmp(s, "DFP,TV")
+ || !xf86NameCmp(s, "TV,DVI") || !xf86NameCmp(s, "DVI,TV")) {
+ pBIOSInfo->ActiveDevice = VIA_DEVICE_TV | VIA_DEVICE_DFP;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is TV and DFP.\n");
+ }
+#if 0
+ else if(!xf86NameCmp(s, "DFP,LCD") || !xf86NameCmp(s, "LCD,DFP")
+ || !xf86NameCmp(s, "LCD,DVI") || !xf86NameCmp(s, "DVI,LCD")) {
+ pBIOSInfo->ActiveDevice = VIA_DEVICE_DFP | VIA_DEVICE_LCD;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is DFP and LCD.\n");
+ }
+#endif
+ else if(!xf86NameCmp(s, "CRT") || !xf86NameCmp(s, "CRT ONLY")) {
+ pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is CRT Only.\n");
+ }
+ else if(!xf86NameCmp(s, "LCD") || !xf86NameCmp(s, "LCD ONLY")) {
+ pBIOSInfo->ActiveDevice = VIA_DEVICE_LCD;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is LCD Only.\n");
+ }
+ else if(!xf86NameCmp(s, "TV") || !xf86NameCmp(s, "TV ONLY")) {
+ pBIOSInfo->ActiveDevice = VIA_DEVICE_TV;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is TV Only.\n");
+ }
+ else if(!xf86NameCmp(s, "DFP") || !xf86NameCmp(s, "DFP ONLY")
+ || !xf86NameCmp(s, "DVI") || !xf86NameCmp(s, "DVI ONLY")) {
+ pBIOSInfo->ActiveDevice = VIA_DEVICE_DFP;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is DFP Only.\n");
+ }
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option \"%s\" can't recognize!, Active Device by default.\n", s);
+ }
+ }
+
+ /* NoDDCValue Option */
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_NODDCVALUE, FALSE)) {
+ pVia->NoDDCValue = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Option: Not using DDC probed value to set HorizSync & VertRefresh\n");
+ }
+ else {
+ pVia->NoDDCValue = FALSE;
+ }
+
+ /* LCDDualEdge Option */
+ pBIOSInfo->LCDDualEdge = FALSE;
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_LCDDUALEDGE, FALSE)) {
+ pBIOSInfo->LCDDualEdge = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Option: Using Dual Edge mode to set LCD\n");
+ }
+ else {
+ pBIOSInfo->LCDDualEdge = FALSE;
+ }
+
+ /* Digital Output Bus Width Option */
+ pBIOSInfo->BusWidth = VIA_DI_12BIT;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_BUSWIDTH))) {
+ if (!xf86NameCmp(s, "12BIT")) {
+ pBIOSInfo->BusWidth = VIA_DI_12BIT;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Digital Output Bus Width is 12BIT\n");
+ }
+ else if (!xf86NameCmp(s, "24BIT")) {
+ pBIOSInfo->BusWidth = VIA_DI_24BIT;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Digital Output Bus Width is 24BIT\n");
+ }
+ }
+
+ /* LCD Center/Expend Option */
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_CENTER, FALSE)) {
+ pBIOSInfo->Center = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DVI Center is On\n");
+ }
+ else {
+ pBIOSInfo->Center = FALSE;
+ }
+
+ /* Panel Size Option */
+ pBIOSInfo->PanelSize = VIA_PANEL_INVALID;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_PANELSIZE))) {
+ if (!xf86NameCmp(s, "640x480")) {
+ pBIOSInfo->PanelSize = VIA_PANEL6X4;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Selected Panel Size is 640x480\n");
+ }
+ else if (!xf86NameCmp(s, "800x600")) {
+ pBIOSInfo->PanelSize = VIA_PANEL8X6;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Selected Panel Size is 800x600\n");
+ }
+ else if(!xf86NameCmp(s, "1024x768")) {
+ pBIOSInfo->PanelSize = VIA_PANEL10X7;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Selected Panel Size is 1024x768\n");
+ }
+ else if (!xf86NameCmp(s, "1280x768")) {
+ pBIOSInfo->PanelSize = VIA_PANEL12X7;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Selected Panel Size is 1280x768\n");
+ }
+ else if (!xf86NameCmp(s, "1280x1024")) {
+ pBIOSInfo->PanelSize = VIA_PANEL12X10;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Selected Panel Size is 1280x1024\n");
+ }
+ else if (!xf86NameCmp(s, "1400x1050")) {
+ pBIOSInfo->PanelSize = VIA_PANEL14X10;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Selected Panel Size is 1400x1050\n");
+ }
+ }
+
+ /* TV DotCrawl Enable Option */
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_TVDOTCRAWL, FALSE)) {
+ pBIOSInfo->TVDotCrawl = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DotCrawl is Enable\n");
+ }
+ else {
+ pBIOSInfo->TVDotCrawl = FALSE;
+ }
+
+ pBIOSInfo->TVType = TVTYPE_NONE;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_TVTYPE))) {
+ if (!xf86NameCmp(s, "NTSC")) {
+ pBIOSInfo->TVType = TVTYPE_NTSC;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is NTSC\n");
+ }
+ else if(!xf86NameCmp(s, "PAL")) {
+ pBIOSInfo->TVType = TVTYPE_PAL;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is PAL\n");
+ }
+ }
+
+ /* TV out put signal Option */
+ pBIOSInfo->TVOutput = TVOUTPUT_NONE;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_TVOUTPUT))) {
+ if (!xf86NameCmp(s, "S-Video")) {
+ pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Output Signal is S-Video\n");
+ }
+ else if(!xf86NameCmp(s, "Composite")) {
+ pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Output Signal is Composite\n");
+ }
+ else if(!xf86NameCmp(s, "SC")) {
+ pBIOSInfo->TVOutput = TVOUTPUT_SC;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Output Signal is SC\n");
+ }
+ else if(!xf86NameCmp(s, "RGB")) {
+ pBIOSInfo->TVOutput = TVOUTPUT_RGB;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Output Signal is RGB\n");
+ }
+ else if(!xf86NameCmp(s, "YCbCr")) {
+ pBIOSInfo->TVOutput = TVOUTPUT_YCBCR;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Output Signal is YCbCr\n");
+ }
+ }
+
+ /* TV Standard Option */
+ pBIOSInfo->TVVScan = VIA_TVNORMAL;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_TVVSCAN))) {
+ if (!xf86NameCmp(s, "under")) {
+ pBIOSInfo->TVVScan = VIA_TVNORMAL;
+ }
+ else if (!xf86NameCmp(s, "over")) {
+ pBIOSInfo->TVVScan = VIA_TVOVER;
+ }
+ }
+
+ pBIOSInfo->TVHScale = VIA_NO_TVHSCALE;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_TVHSCALE))) {
+#if 0
+ if (!xf86NameCmp(s, "0")) {
+ pBIOSInfo->TVHScale = VIA_TVHSCALE0;
+ }
+ else if (!xf86NameCmp(s, "1")) {
+ pBIOSInfo->TVHScale = VIA_TVHSCALE1;
+ }
+ else if(!xf86NameCmp(s, "2")) {
+ pBIOSInfo->TVHScale = VIA_TVHSCALE2;
+ }
+ else if (!xf86NameCmp(s, "3")) {
+ pBIOSInfo->TVHScale = VIA_TVHSCALE3;
+ }
+ else if (!xf86NameCmp(s, "4")) {
+ pBIOSInfo->TVHScale = VIA_TVHSCALE4;
+ }
+#endif
+ }
+
+ /* TV Encoder Type Option */
+ pBIOSInfo->TVEncoder = VIA_NONETV;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_TVENCODER))) {
+ if (!xf86NameCmp(s, "VT1621")) {
+ pBIOSInfo->TVEncoder = VIA_TV2PLUS;
+ pBIOSInfo->TVI2CAdd = 0x40;
+ }
+ else if(!xf86NameCmp(s, "VT1622")) {
+ pBIOSInfo->TVEncoder = VIA_TV3;
+ pBIOSInfo->TVI2CAdd = 0x40;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Encoder is VT1622!\n");
+ }
+ else if(!xf86NameCmp(s, "VT1622A")) {
+ pBIOSInfo->TVEncoder = VIA_VT1622A;
+ pBIOSInfo->TVI2CAdd = 0x40;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Encoder is VT1622!\n");
+ }
+ else if(!xf86NameCmp(s, "CH7019")) {
+ pBIOSInfo->TVEncoder = VIA_CH7019;
+ pBIOSInfo->TVI2CAdd = 0xEA;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Encoder is CH7019!\n");
+ }
+ else if(!xf86NameCmp(s, "SAA7108")) {
+ pBIOSInfo->TVEncoder = VIA_SAA7108;
+ pBIOSInfo->TVI2CAdd = 0x88;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Encoder is SAA7108!\n");
+ }
+ else if(!xf86NameCmp(s, "FS454")) {
+ pBIOSInfo->TVEncoder = VIA_FS454;
+ pBIOSInfo->TVI2CAdd = 0xD4;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Encoder is FS453/FS454!\n");
+ }
+ }
+
+ if (xf86GetOptValInteger(VIAOptions, OPTION_REFRESH, &(pBIOSInfo->OptRefresh))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Refresh is %d\n", pBIOSInfo->OptRefresh);
+ }
+
+ if (xf86LoadSubModule(pScrn, "int10")) {
+ xf86LoaderReqSymLists(int10Symbols, NULL);
+ pVia->pInt10 = xf86InitInt10(pEnt->index);
+ }
+
+ if (pVia->pInt10 && xf86LoadSubModule(pScrn, "vbe")) {
+ xf86LoaderReqSymLists(vbeSymbols, NULL);
+ pVia->pVbe = VBEInit(pVia->pInt10, pVia->EntityIndex);
+ }
+
+ pVia->PciInfo = xf86GetPciInfoForEntity(pEnt->index);
+ xf86RegisterResources(pEnt->index, NULL, ResNone);
+ /*
+ xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr);
+ xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr);
+ */
+
+ if (pEnt->device->chipset && *pEnt->device->chipset) {
+ pScrn->chipset = pEnt->device->chipset;
+ pVia->ChipId = pEnt->device->chipID;
+ pVia->Chipset = xf86StringToToken(VIAChipsets, pScrn->chipset);
+ from = X_CONFIG;
+ } else if (pEnt->device->chipID >= 0) {
+ pVia->ChipId = pEnt->device->chipID;
+ pVia->Chipset = LookupChipID(VIAPciChipsets, pVia->ChipId);
+ pScrn->chipset = (char *)xf86TokenToString(VIAChipsets,
+ pVia->Chipset);
+ from = X_CONFIG;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n",
+ pEnt->device->chipID);
+ } else {
+ from = X_PROBED;
+ pVia->ChipId = pVia->PciInfo->chipType;
+ pVia->Chipset = LookupChipID(VIAPciChipsets, pVia->ChipId);
+ pScrn->chipset = (char *)xf86TokenToString(VIAChipsets,
+ pVia->Chipset);
+ }
+
+ if (pEnt->device->chipRev >= 0) {
+ pVia->ChipRev = pEnt->device->chipRev;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n",
+ pVia->ChipRev);
+ }
+ else {
+ /*pVia->ChipRev = pVia->PciInfo->chipRev;*/
+ /* Read PCI bus 0, dev 0, function 0, index 0xF6 to get chip rev. */
+ pVia->ChipRev = pciReadByte(pciTag(0, 0, 0), 0xF6);
+ }
+
+ if (pEnt->device->videoRam != 0) {
+ if (!pScrn->videoRam)
+ pScrn->videoRam = pEnt->device->videoRam;
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Video Memory Size in Option is %d KB, Detect is %d KB!",
+ pScrn->videoRam, pEnt->device->videoRam);
+ }
+ }
+
+ xfree(pEnt);
+
+ vfInitHWDiff(pVia);
+
+ /* maybe throw in some more sanity checks here */
+
+ xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset);
+
+ pVia->PciTag = pciTag(pVia->PciInfo->bus, pVia->PciInfo->device,
+ pVia->PciInfo->func);
+
+ switch (pVia->ChipRev) {
+ case 2:
+ pBIOSInfo->A2 = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, from, "Chipset Rev.: A2\n");
+ break;
+ default:
+ pBIOSInfo->A2 = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, from, "Chipset Rev.: A3 or later\n");
+ break;
+ }
+
+ hwp = VGAHWPTR(pScrn);
+ vgaHWGetIOBase(hwp);
+ vgaIOBase = hwp->IOBase;
+ vgaCRIndex = vgaIOBase + 4;
+ vgaCRReg = vgaIOBase + 5;
+
+ if (!VIAMapMMIO(pScrn)) {
+ vbeFree(pVia->pVbe);
+ return FALSE;
+ }
+
+ /* Get BIOS ver. From BIOS Call Function */
+ tmp = BIOS_GetBIOSVersion(pScrn);
+ pBIOSInfo->BIOSMajorVersion = tmp >> 8;
+ pBIOSInfo->BIOSMinorVersion = tmp & 0xFF;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS Version is = %d.%d\n", pBIOSInfo->BIOSMajorVersion, pBIOSInfo->BIOSMinorVersion));
+ BIOS_GetBIOSDate(pScrn);
+
+ if (pBIOSInfo->TVType == TVTYPE_NONE) {
+ /* use jumper to determine TV Type */
+ VGAOUT8(0x3D4, 0x3B);
+ if (VGAIN8(0x3D5) & 0x02) {
+ pBIOSInfo->TVType = TVTYPE_PAL;
+ }
+ else {
+ pBIOSInfo->TVType = TVTYPE_NTSC;
+ }
+ }
+
+ {
+ Gamma zeros = {0.0, 0.0, 0.0};
+
+ if (!xf86SetGamma(pScrn, zeros)) {
+ vbeFree(pVia->pVbe);
+ return FALSE;
+ }
+ }
+
+ /* Next go on to detect amount of installed ram */
+ if (pScrn->videoRam < 16384 || pScrn->videoRam > 65536) {
+ bMemSize = BIOS_GetVideoMemSize(pScrn);
+ if (bMemSize) {
+ pScrn->videoRam = bMemSize << 6;
+ }
+ else {
+ VGAOUT8(0x3C4, 0x39);
+ bMemSize = VGAIN8(0x3c5);
+ if (bMemSize > 16 && bMemSize <= 128) {
+ pScrn->videoRam = (bMemSize + 1) << 9;
+ }
+ else if (bMemSize > 0 && bMemSize < 31){
+ pScrn->videoRam = bMemSize << 12;
+ }
+ else {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "bMemSize = %d\nGet Video Memory Size by default.\n", bMemSize));
+ pScrn->videoRam = VIAGetMemSize();
+ }
+ }
+ }
+
+ /* Split FB for SAMM */
+ /* FIXME: For now, split FB into two equal sections. This should
+ * be able to be adjusted by user with a config option. */
+ if (pVia->IsSecondary) {
+ DevUnion* pPriv;
+ VIAEntPtr pVIAEnt;
+ VIAPtr pVia1;
+
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
+ gVIAEntityIndex);
+ pVIAEnt = pPriv->ptr;
+ pScrn->videoRam = pScrn->videoRam >> 1;
+ pVIAEnt->pPrimaryScrn->videoRam = pScrn->videoRam;
+ pVia1 = VIAPTR(pVIAEnt->pPrimaryScrn);
+ pVia1->videoRambytes = pScrn->videoRam << 10;
+ pVia->FrameBufferBase += (pScrn->videoRam << 10);
+ }
+
+ pVia->videoRambytes = pScrn->videoRam << 10;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,"videoram = %dk\n",
+ pScrn->videoRam);
+
+ /* Set status word positions based on chip type. */
+
+ switch (pVia->Chipset) {
+ case VIA_CLE266:
+ pVia->myWaitIdle = WaitIdleCLE266;
+ break;
+ default:
+ pVia->myWaitIdle = WaitIdleCLE266;
+ break;
+ }
+
+ if (!xf86LoadSubModule(pScrn, "i2c")) {
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+ else {
+ xf86LoaderReqSymLists(i2cSymbols,NULL);
+ VIAI2CInit(pScrn);
+ }
+
+ if (!xf86LoadSubModule(pScrn, "ddc")) {
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+ else {
+ xf86MonPtr pMon = NULL;
+
+ xf86LoaderReqSymLists(ddcSymbols, NULL);
+ if ((pVia->pVbe)
+ && ((pMon = xf86PrintEDID(vbeDoEDID(pVia->pVbe, NULL))) != NULL)) {
+ pVia->DDC1 = pMon;
+ xf86SetDDCproperties(pScrn,pMon);
+ }
+ else if (!VIAddc2(pScrn->scrnIndex)) {
+ VIAddc1(pScrn->scrnIndex);
+ }
+ }
+
+ /* Reset HorizSync & VertRefresh Rang Using DDC Value */
+ if (pVia->DDC1 && !pVia->NoDDCValue) {
+ int i;
+ int h = 0;
+ int v = 0;
+
+ for (i = 0; i < DET_TIMINGS; i++) {
+ if (pVia->DDC1->det_mon[i].type == DS_RANGES) {
+ pScrn->monitor->hsync[h].lo
+ = pVia->DDC1->det_mon[i].section.ranges.min_h;
+ pScrn->monitor->hsync[h++].hi
+ = pVia->DDC1->det_mon[i].section.ranges.max_h;
+ pScrn->monitor->vrefresh[v].lo
+ = pVia->DDC1->det_mon[i].section.ranges.min_v;
+ pScrn->monitor->vrefresh[v++].hi
+ = pVia->DDC1->det_mon[i].section.ranges.max_v;
+ break;
+ }
+ }
+ pScrn->monitor->nHsync = h;
+ pScrn->monitor->nVrefresh = v;
+ }
+
+ /*
+ * Setup the ClockRanges, which describe what clock ranges are available,
+ * and what sort of modes they can be used for.
+ */
+
+ clockRanges = xnfalloc(sizeof(ClockRange));
+ clockRanges->next = NULL;
+ clockRanges->minClock = 20000;
+ clockRanges->maxClock = 230000;
+
+ clockRanges->clockIndex = -1;
+ clockRanges->interlaceAllowed = TRUE;
+ clockRanges->doubleScanAllowed = FALSE;
+
+
+ /*
+ * xf86ValidateModes will check that the mode HTotal and VTotal values
+ * don't exceed the chipset's limit if pScrn->maxHValue and
+ * pScrn->maxVValue are set. Since our VIAValidMode() already takes
+ * care of this, we don't worry about setting them here.
+ */
+
+ /* Select valid modes from those available */
+ i = xf86ValidateModes(pScrn,
+ pScrn->monitor->Modes, /* availModes */
+ pScrn->display->modes, /* modeNames */
+ clockRanges, /* list of clock ranges */
+ NULL, /* list of line pitches */
+ 256, /* mini line pitch */
+ 2048, /* max line pitch */
+ 16 * pScrn->bitsPerPixel, /* pitch inc (bits) */
+ 128, /* min height */
+ 2048, /* max height */
+ pScrn->virtualX, /* virtual width */
+ pScrn->virtualY, /* virutal height */
+ pVia->videoRambytes, /* size of video memory */
+ LOOKUP_BEST_REFRESH); /* lookup mode flags */
+
+ if (i == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86ValidateModes failure\n");
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+
+ xf86PruneDriverModes(pScrn);
+
+ if (i == 0 || pScrn->modes == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+
+ if (!VIAGetBIOSTable(pBIOSInfo)) {
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+
+ pBIOSInfo->I2C_Port1 = pVia->I2C_Port1;
+ pBIOSInfo->I2C_Port2 = pVia->I2C_Port2;
+ pBIOSInfo->DDC1 = pVia->DDC1;
+ pBIOSInfo->DDC2 = pVia->DDC2;
+
+ /* Detect TV Encoder */
+ if (!pBIOSInfo->TVEncoder) {
+ pBIOSInfo->TVEncoder = VIACheckTVExist(pBIOSInfo);
+ }
+ /* Detect TMDS/LVDS Encoder */
+ VIAPostDVI(pBIOSInfo);
+ /*VIAGetPanelInfo(pBIOSInfo);*/
+ pBIOSInfo->ConnectedDevice = VIAGetDeviceDetect(pBIOSInfo);
+
+ xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V);
+ pScrn->currentMode = pScrn->modes;
+ xf86PrintModes(pScrn);
+ xf86SetDpi(pScrn, 0, 0);
+
+#ifdef USE_FB
+ if (xf86LoadSubModule(pScrn, "fb") == NULL) {
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+
+ xf86LoaderReqSymLists(fbSymbols, NULL);
+
+#else
+ /* load bpp-specific modules */
+ switch (pScrn->bitsPerPixel) {
+ case 8:
+ mod = "cfb";
+ reqSym = "cfbScreenInit";
+ break;
+ case 16:
+ mod = "cfb16";
+ reqSym = "cfb16ScreenInit";
+ break;
+ case 32:
+ mod = "cfb32";
+ reqSym = "cfb32ScreenInit";
+ break;
+ }
+
+ if (mod && xf86LoadSubModule(pScrn, mod) == NULL) {
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+
+ xf86LoaderReqSymbols(reqSym, NULL);
+#endif
+
+ if (!pVia->NoAccel) {
+ if(!xf86LoadSubModule(pScrn, "xaa")) {
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+ xf86LoaderReqSymLists(xaaSymbols, NULL);
+ }
+
+ if (pVia->hwcursor) {
+ if (!xf86LoadSubModule(pScrn, "ramdac")) {
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+ xf86LoaderReqSymLists(ramdacSymbols, NULL);
+ }
+
+ if (pVia->shadowFB) {
+ if (!xf86LoadSubModule(pScrn, "shadowfb")) {
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+ xf86LoaderReqSymLists(shadowSymbols, NULL);
+ }
+
+ /* Capture option parameter */
+ pVia->Cap0_Deinterlace = CAP_BOB;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_CAP0_DEINTERLACE))) {
+ if (!xf86NameCmp(s, "Bob")) {
+ pVia->Cap0_Deinterlace = CAP_BOB;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Capture 0 de-interlace mode is Bob\n");
+ }
+ else if(!xf86NameCmp(s, "Weave")) {
+ pVia->Cap0_Deinterlace = CAP_WEAVE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Capture 0 de-interlace mode is Weave\n");
+ }
+ }
+
+ pVia->Cap1_Deinterlace = CAP_BOB;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_CAP1_DEINTERLACE))) {
+ if (!xf86NameCmp(s, "Bob")) {
+ pVia->Cap1_Deinterlace = CAP_BOB;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Capture 1 de-interlace mode is Bob\n");
+ }
+ else if(!xf86NameCmp(s, "Weave")) {
+ pVia->Cap1_Deinterlace = CAP_WEAVE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Capture 1 de-interlace mode is Weave\n");
+ }
+ }
+
+ /* xf86LoaderReqSymLists(mpegSymbols, NULL); */
+
+ VIADeviceSeletion(pScrn);
+ if (pVia->IsSecondary) {
+ if (pBIOSInfo->SAMM)
+ VIADeviceDispatch(pScrn);
+ else
+ return FALSE;
+ }
+
+ VIAUnmapMem(pScrn);
+
+ return TRUE;
+}
+
+
+static Bool VIAEnterVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ VIAPtr pVia = VIAPTR(pScrn);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ Bool ret;
+
+ DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAEnterVT\n"));
+ VIASave(pScrn);
+ vgaHWUnlock(hwp);
+ ret = VIAModeInit(pScrn, pScrn->currentMode);
+
+ /* retore video status */
+ if (!pVia->IsSecondary)
+ viaRestoreVideo(pScrn);
+
+ VIAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ return ret;
+}
+
+
+static void VIALeaveVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ vgaRegPtr vgaSavePtr = &hwp->SavedReg;
+ VIARegPtr viaSavePtr = &pVia->SavedReg;
+
+ DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIALeaveVT\n"));
+ /* Wait Hardware Engine idle to exit graphicd mode */
+ WaitIdle();
+
+ if (pVia->VQEnable) {
+ /* if we use VQ, disable it before we exit */
+ VIASETREG(0x43c, 0x00fe0000);
+ VIASETREG(0x440, 0x00000004);
+ }
+
+ /* Save video status and turn off all video activities */
+ if (!pVia->IsSecondary)
+ viaSaveVideo(pScrn);
+
+ VIAWriteMode(pScrn, vgaSavePtr, viaSavePtr);
+ vgaHWLock(hwp);
+}
+
+
+static void VIASave(ScrnInfoPtr pScrn)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ vgaRegPtr vgaSavePtr = &hwp->SavedReg;
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ VIARegPtr save = &pVia->SavedReg;
+ int vgaCRIndex, vgaCRReg, vgaIOBase;
+ int i;
+ I2CDevPtr dev;
+ unsigned char W_Buffer[1];
+ unsigned char TVRegs[0xFF];
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASave\n"));
+
+ if(pVia->IsSecondary)
+ {
+ DevUnion* pPriv;
+ VIAEntPtr pVIAEnt;
+ VIAPtr pVia1;
+ vgaHWPtr hwp1;
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
+ gVIAEntityIndex);
+ pVIAEnt = pPriv->ptr;
+ hwp1 = VGAHWPTR(pVIAEnt->pPrimaryScrn);
+ pVia1 = VIAPTR(pVIAEnt->pPrimaryScrn);
+ hwp->SavedReg = hwp1->SavedReg;
+ pVia->SavedReg = pVia1->SavedReg;
+ }
+ else {
+ vgaHWProtect(pScrn, TRUE);
+
+ if (xf86IsPrimaryPci(pVia->PciInfo)) {
+ vgaHWSave(pScrn, vgaSavePtr, VGA_SR_ALL);
+ }
+ else {
+ vgaHWSave(pScrn, vgaSavePtr, VGA_SR_MODE);
+ }
+
+ vgaIOBase = hwp->IOBase;
+ vgaCRReg = vgaIOBase + 5;
+ vgaCRIndex = vgaIOBase + 4;
+
+ /* Unlock Extended Regs */
+ outb(0x3c4, 0x10);
+ outb(0x3c5, 0x01);
+
+ VGAOUT8(0x3c4, 0x14);
+ save->SR14 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x15);
+ save->SR15 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x16);
+ save->SR16 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x17);
+ save->SR17 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x18);
+ save->SR18 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x19);
+ save->SR19 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x1a);
+ save->SR1A = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x1b);
+ save->SR1B = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x1c);
+ save->SR1C = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x1d);
+ save->SR1D = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x1e);
+ save->SR1E = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x1f);
+ save->SR1F = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x22);
+ save->SR22 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x23);
+ save->SR23 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x24);
+ save->SR24 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x25);
+ save->SR25 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x26);
+ save->SR26 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x27);
+ save->SR27 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x28);
+ save->SR28 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x29);
+ save->SR29 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x2a);
+ save->SR2A = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x2b);
+ save->SR2B = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x2e);
+ save->SR2E = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x44);
+ save->SR44 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x45);
+ save->SR45 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x46);
+ save->SR46 = VGAIN8(0x3c5);
+ VGAOUT8(0x3c4, 0x47);
+ save->SR47 = VGAIN8(0x3c5);
+
+ VGAOUT8(vgaCRIndex, 0x32);
+ save->CR32 = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x33);
+ save->CR33 = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x34);
+ save->CR34 = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x35);
+ save->CR35 = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x36);
+ save->CR36 = VGAIN8(vgaCRReg);
+
+ if (pBIOSInfo->TVEncoder) {
+ if (xf86I2CProbeAddress(pVia->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pVia->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ W_Buffer[0] = 0;
+ xf86I2CWriteRead(dev, W_Buffer,1, TVRegs, 0xFF);
+ for (i = 0; i < 0xFF; i++) {
+ save->TVRegs[i] = TVRegs[i];
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ }
+
+ VGAOUT8(vgaCRIndex, 0x6a);
+ save->CR6A = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x6b);
+ save->CR6B = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x6c);
+ save->CR6C = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x91);
+ save->CR91 = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x93);
+ save->CR93 = VGAIN8(vgaCRReg);
+
+ /* Save LCD control regs */
+ for (i = 0; i < 68; i++) {
+ VGAOUT8(vgaCRIndex, i + 0x50);
+ save->LCDRegs[i] = VGAIN8(vgaCRReg);
+ }
+
+ if (!pVia->ModeStructInit) {
+ vgaHWCopyReg(&hwp->ModeReg, vgaSavePtr);
+ memcpy(&pVia->ModeReg, save, sizeof(VIARegRec));
+ pVia->ModeStructInit = TRUE;
+ }
+ vgaHWProtect(pScrn, FALSE);
+ }
+ return;
+}
+
+
+static void VIAWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr,
+ VIARegPtr restore)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ int vgaCRIndex, vgaCRReg, vgaIOBase;
+/* Bool graphicsMode = FALSE;*/
+ int i;
+ unsigned char W_Buffer[3];
+ I2CDevPtr dev = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAWriteMode\n"));
+ vgaIOBase = hwp->IOBase;
+ vgaCRIndex = vgaIOBase + 4;
+ vgaCRReg = vgaIOBase + 5;
+
+ /*
+ * If we figured out a VESA mode number for this timing, just use
+ * the VGA BIOS to do the switching, with a few additional tweaks.
+ */
+ if (restore->mode != 0xFF)
+ {
+ /* Set up the mode. Don't clear video RAM. */
+ if (!pVia->IsSecondary)
+ VIASetModeUseBIOSTable(pBIOSInfo);
+ else
+ VIASetModeForMHS(pBIOSInfo);
+
+ /* Restore the DAC.*/
+ if (pBIOSInfo->FirstInit ) {
+ vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_CMAP);
+ }
+ /*else {
+ vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE);
+ }
+ vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_CMAP);*/
+ pBIOSInfo->FirstInit = FALSE;
+ /* Enable the graphics engine. */
+ if (!pVia->NoAccel)
+ VIAInitialize2DEngine(pScrn);
+
+#ifdef XF86DRI
+ VIAInitialize3DEngine(pScrn);
+#endif
+
+ return;
+ }
+
+ vgaHWProtect(pScrn, TRUE);
+
+ /* Unlock Extended Regs */
+ outb(0x3c4, 0x10);
+ outb(0x3c5, 0x01);
+
+ /* How can we know the mode is graphicd mode or not ? */
+ /* graphicsMode = (restore->mode == 0xFF) ? FALSE : TRUE; */
+
+ VGAOUT8(vgaCRIndex, 0x6a);
+ VGAOUT8(vgaCRReg, 0);
+ VGAOUT8(vgaCRIndex, 0x6b);
+ VGAOUT8(vgaCRReg, 0);
+ VGAOUT8(vgaCRIndex, 0x6c);
+ VGAOUT8(vgaCRReg, 0);
+
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ case VIA_TV3:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ case VIA_SAA7108:
+ case VIA_CH7005:
+ case VIA_VT1622A:
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pVia->I2C_Port2;
+ if (xf86I2CDevInit(dev)) {
+
+ for (i = 0; i < 0xFF; i++) {
+ W_Buffer[0] = (unsigned char)(i);
+ W_Buffer[1] = (unsigned char)(restore->TVRegs[i]);
+ xf86I2CWriteRead(dev, W_Buffer, 2, NULL,0);
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ break;
+ case VIA_FS454:
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pVia->I2C_Port2;
+ if (xf86I2CDevInit(dev)) {
+
+ /* QPR programming */
+ W_Buffer[0] = 0xC4;
+ W_Buffer[1] = (unsigned char)(restore->TVRegs[0xC4]);
+ W_Buffer[2] = (unsigned char)(restore->TVRegs[0xC5]);
+ xf86I2CWriteRead(dev, W_Buffer,3, NULL,0);
+
+ /* Restore TV Regs */
+ for (i = 0; i < 0xFF; i++) {
+ W_Buffer[0] = (unsigned char)(i);
+ W_Buffer[1] = (unsigned char)(restore->TVRegs[i]);
+ if (i == 0xC4)
+ i++;
+ else
+ xf86I2CWriteRead(dev, W_Buffer, 2, NULL,0);
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ break;
+ case VIA_NONETV:
+ default:
+ break;
+ }
+
+ /* restore the standard vga regs */
+ if (xf86IsPrimaryPci(pVia->PciInfo))
+ vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL);
+ else
+ vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE);
+
+ /* restore extended regs */
+ VGAOUT8(0x3c4, 0x14);
+ VGAOUT8(0x3c5, restore->SR14);
+ VGAOUT8(0x3c4, 0x15);
+ VGAOUT8(0x3c5, restore->SR15);
+ VGAOUT8(0x3c4, 0x16);
+ VGAOUT8(0x3c5, restore->SR16);
+ VGAOUT8(0x3c4, 0x17);
+ VGAOUT8(0x3c5, restore->SR17);
+ VGAOUT8(0x3c4, 0x18);
+ VGAOUT8(0x3c5, restore->SR18);
+ VGAOUT8(0x3c4, 0x19);
+ VGAOUT8(0x3c5, restore->SR19);
+ VGAOUT8(0x3c4, 0x1a);
+ VGAOUT8(0x3c5, restore->SR1A);
+ VGAOUT8(0x3c4, 0x1b);
+ VGAOUT8(0x3c5, restore->SR1B);
+ VGAOUT8(0x3c4, 0x1c);
+ VGAOUT8(0x3c5, restore->SR1C);
+ VGAOUT8(0x3c4, 0x1d);
+ VGAOUT8(0x3c5, restore->SR1D);
+ VGAOUT8(0x3c4, 0x1e);
+ VGAOUT8(0x3c5, restore->SR1E);
+ VGAOUT8(0x3c4, 0x1f);
+ VGAOUT8(0x3c5, restore->SR1F);
+ VGAOUT8(0x3c4, 0x22);
+ VGAOUT8(0x3c5, restore->SR22);
+ VGAOUT8(0x3c4, 0x23);
+ VGAOUT8(0x3c5, restore->SR23);
+ VGAOUT8(0x3c4, 0x24);
+ VGAOUT8(0x3c5, restore->SR24);
+ VGAOUT8(0x3c4, 0x25);
+ VGAOUT8(0x3c5, restore->SR25);
+ VGAOUT8(0x3c4, 0x26);
+ VGAOUT8(0x3c5, restore->SR26);
+ VGAOUT8(0x3c4, 0x27);
+ VGAOUT8(0x3c5, restore->SR27);
+ VGAOUT8(0x3c4, 0x28);
+ VGAOUT8(0x3c5, restore->SR28);
+ VGAOUT8(0x3c4, 0x29);
+ VGAOUT8(0x3c5, restore->SR29);
+ VGAOUT8(0x3c4, 0x2a);
+ VGAOUT8(0x3c5, restore->SR2A);
+ VGAOUT8(0x3c4, 0x2b);
+ VGAOUT8(0x3c5, restore->SR2B);
+ VGAOUT8(0x3c4, 0x2e);
+ VGAOUT8(0x3c5, restore->SR2E);
+ VGAOUT8(0x3c4, 0x44);
+ VGAOUT8(0x3c5, restore->SR44);
+ VGAOUT8(0x3c4, 0x45);
+ VGAOUT8(0x3c5, restore->SR45);
+ VGAOUT8(0x3c4, 0x46);
+ VGAOUT8(0x3c5, restore->SR46);
+ VGAOUT8(0x3c4, 0x47);
+ VGAOUT8(0x3c5, restore->SR47);
+
+ VGAOUT8(vgaCRIndex, 0x32);
+ VGAOUT8(vgaCRReg, restore->CR32);
+ VGAOUT8(vgaCRIndex, 0x33);
+ VGAOUT8(vgaCRReg, restore->CR33);
+ VGAOUT8(vgaCRIndex, 0x34);
+ VGAOUT8(vgaCRReg, restore->CR34);
+ VGAOUT8(vgaCRIndex, 0x35);
+ VGAOUT8(vgaCRReg, restore->CR35);
+ VGAOUT8(vgaCRIndex, 0x36);
+ VGAOUT8(vgaCRReg, restore->CR36);
+ VGAOUT8(vgaCRIndex, 0x91);
+ VGAOUT8(vgaCRReg, restore->CR91);
+ VGAOUT8(vgaCRIndex, 0x93);
+ VGAOUT8(vgaCRReg, restore->CR93);
+
+ /* Restore LCD control regs */
+ for (i = 0; i < 68; i++) {
+ VGAOUT8(vgaCRIndex, i + 0x50);
+ VGAOUT8(vgaCRReg, restore->LCDRegs[i]);
+ }
+
+ /* Reset clock */
+ VGAOUT8(0x3c2, VGAIN8(0x3cc));
+
+ /* If we're going into graphics mode and acceleration was enabled, */
+/*
+ if (graphicsMode && (!pVia->NoAccel)) {
+ VIAInitialize2DEngine(pScrn);
+ }
+*/
+
+ vgaHWProtect(pScrn, FALSE);
+
+ return;
+}
+
+
+static Bool VIAMapMMIO(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ vgaHWPtr hwp;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAMapMMIO\n"));
+
+ pVia->FrameBufferBase = pVia->PciInfo->memBase[0];
+ pVia->MmioBase = pVia->PciInfo->memBase[1];
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "mapping MMIO @ 0x%x with size 0x%x\n",
+ pVia->MmioBase, VIA_MMIO_REGSIZE);
+
+ pVia->MapBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVia->PciTag,
+ pVia->MmioBase,
+ VIA_MMIO_REGSIZE);
+ pBIOSInfo->MapBase = pVia->MapBase;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "mapping BitBlt MMIO @ 0x%x with size 0x%x\n",
+ pVia->MmioBase + VIA_MMIO_BLTBASE, VIA_MMIO_BLTSIZE);
+
+ pVia->BltBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVia->PciTag,
+ pVia->MmioBase + VIA_MMIO_BLTBASE,
+ VIA_MMIO_BLTSIZE);
+/* if (pVia->V4LEnabled == 0) {
+ pVia->FBFreeStart += 0x300000;
+ ErrorF("After 3M FBFreeStart = 0x%x\n",pVia->FBFreeStart);
+ }
+*/
+ if (!pVia->MapBase || !pVia->BltBase) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Internal error: cound not map registers\n");
+ return FALSE;
+ }
+
+ /* Memory maped IO for Video Engine */
+ pVia->VidMapBase = pVia->MapBase + 0x200;
+
+ VIAEnableMMIO(pScrn);
+ hwp = VGAHWPTR(pScrn);
+ vgaHWGetIOBase(hwp);
+
+ return TRUE;
+}
+
+
+static Bool VIAMapFB(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAMapFB\n"));
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "mapping framebuffer @ 0x%x with size 0x%x\n",
+ pVia->FrameBufferBase, pVia->videoRambytes);
+
+ if (pVia->videoRambytes) {
+ pVia->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+ pVia->PciTag, pVia->FrameBufferBase,
+ pVia->videoRambytes);
+ pBIOSInfo->FBBase = pVia->FBBase;
+ pBIOSInfo->videoRambytes = pVia->videoRambytes;
+
+ if (!pVia->FBBase) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Internal error: could not map framebuffer\n");
+ return FALSE;
+ }
+
+ pVia->FBStart = pVia->FBBase;
+ pVia->FBFreeStart = (pScrn->displayWidth * pScrn->bitsPerPixel >> 3) *
+ pScrn->virtualY;
+ pVia->FBFreeEnd = pVia->videoRambytes;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Frame buffer start: 0x%x, free start: 0x%x end: 0x%x\n",
+ pVia->FBStart, pVia->FBFreeStart, pVia->FBFreeEnd);
+ }
+
+ pScrn->memPhysBase = pVia->PciInfo->memBase[0];
+ pScrn->fbOffset = 0;
+ if(pVia->IsSecondary) pScrn->fbOffset = pScrn->videoRam << 10;
+
+ return TRUE;
+}
+
+
+static void VIAUnmapMem(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia;
+
+ pVia = VIAPTR(pScrn);
+
+ VIADisableMMIO(pScrn);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAUnmapMem\n"));
+
+ if (pVia->MapBase) {
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pVia->MapBase,
+ VIA_MMIO_REGSIZE);
+ }
+
+ if (pVia->BltBase) {
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pVia->BltBase,
+ VIA_MMIO_BLTSIZE);
+ }
+
+ if (pVia->FBBase) {
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pVia->FBBase,
+ pVia->videoRambytes);
+ }
+
+ return;
+}
+
+
+static Bool VIAScreenInit(int scrnIndex, ScreenPtr pScreen,
+ int argc, char **argv)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ int ret, fd;
+
+
+ fd = open("/dev/video2",O_RDWR);
+
+ if( -1 == fd) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " Couldn't open \"/dev/video2\"\n");
+ pVia->V4LEnabled = 0;
+ ErrorF("VIAScreenInit : V4L Disabled : fd = %d \n",fd);
+ }
+ else {
+ pVia->V4LEnabled = 1;
+ ErrorF("VIAScreenInit : V4L Enabled : fd = %d \n",fd);
+ }
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAScreenInit\n"));
+ vgaHWUnlock(hwp);
+
+ if (!VIAMapFB(pScrn))
+ return FALSE;
+
+ if (!VIAMapMMIO(pScrn))
+ return FALSE;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Mem Mapped\n"));
+
+ VIASave(pScrn);
+
+ vgaHWBlankScreen(pScrn, FALSE);
+
+ if (!VIAModeInit(pScrn, pScrn->currentMode))
+ return FALSE;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- State saved\n"));
+
+ /* Darken the screen for aesthetic reasons and set the viewport */
+ VIASaveScreen(pScreen, SCREEN_SAVER_ON);
+ pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Blanked\n"));
+
+ miClearVisualTypes();
+
+ if (pScrn->bitsPerPixel > 8 && !pVia->IsSecondary) {
+ if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+ if (!miSetPixmapDepths())
+ return FALSE;
+ } else {
+ if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+ if (!miSetPixmapDepths())
+ return FALSE;
+ }
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Visuals set up\n"));
+
+ ret = VIAInternalScreenInit(scrnIndex, pScreen);
+
+ if (!ret)
+ return FALSE;
+
+ xf86SetBlackWhitePixels(pScreen);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- B & W\n"));
+
+ if (pScrn->bitsPerPixel > 8) {
+ VisualPtr visual;
+
+ visual = pScreen->visuals + pScreen->numVisuals;
+ while (--visual >= pScreen->visuals) {
+ if ((visual->class | DynamicClass) == DirectColor) {
+ visual->offsetRed = pScrn->offset.red;
+ visual->offsetGreen = pScrn->offset.green;
+ visual->offsetBlue = pScrn->offset.blue;
+ visual->redMask = pScrn->mask.red;
+ visual->greenMask = pScrn->mask.green;
+ visual->blueMask = pScrn->mask.blue;
+ }
+ }
+ }
+
+#ifdef USE_FB
+ /* must be after RGB ordering fixed */
+ fbPictureInit(pScreen, 0, 0);
+#endif
+
+ if (!pVia->NoAccel)
+ VIAInitAccel(pScreen);
+
+ miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+ /*xf86SetSilkenMouse(pScreen);*/
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Backing store set up\n"));
+
+ if(!pVia->shadowFB) /* hardware cursor needs to wrap this layer */
+ VIADGAInit(pScreen);
+
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- SW cursor set up\n"));
+
+ if (pVia->hwcursor) {
+ if (!VIAHWCursorInit(pScreen)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Hardware cursor initialization failed\n");
+ }
+ }
+
+ if (pVia->shadowFB) {
+ RefreshAreaFuncPtr refreshArea = VIARefreshArea;
+
+ if(pVia->rotate) {
+ if (!pVia->PointerMoved) {
+ pVia->PointerMoved = pScrn->PointerMoved;
+ pScrn->PointerMoved = VIAPointerMoved;
+ }
+
+ switch(pScrn->bitsPerPixel) {
+ case 8:
+ refreshArea = VIARefreshArea8;
+ break;
+ case 16:
+ refreshArea = VIARefreshArea16;
+ break;
+ case 32:
+ refreshArea = VIARefreshArea32;
+ break;
+ }
+ }
+
+ ShadowFBInit(pScreen, refreshArea);
+ }
+
+ if (!miCreateDefColormap(pScreen))
+ return FALSE;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Def Color map set up\n"));
+
+ if (!xf86HandleColormaps(pScreen, 256, 6, VIALoadPalette, NULL,
+ CMAP_RELOAD_ON_MODE_SWITCH
+ | CMAP_PALETTED_TRUECOLOR))
+ return FALSE;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Palette loaded\n"));
+
+ /* Remove restart flag file for utility */
+ UTRemoveRestartFlag(pBIOSInfo);
+ /* Load user utility Gamma setting */
+ if (!(pVia->HasSecondary || pVia->IsSecondary || (pScrn->bitsPerPixel == 8))) {
+ if (VIALoadGammaSetting(pBIOSInfo)){
+ VIARestorePalette(pScrn, pBIOSInfo->colors);
+ }
+ }
+
+ vgaHWBlankScreen(pScrn, TRUE);
+
+ pVia->CloseScreen = pScreen->CloseScreen;
+ pScreen->SaveScreen = VIASaveScreen;
+ pScreen->CloseScreen = VIACloseScreen;
+
+ xf86DPMSInit(pScreen, VIADPMS, 0);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- DPMS set up\n"));
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Color maps etc. set up\n"));
+
+#ifdef XF86DRI
+ pVia->directRenderingEnabled = VIADRIScreenInit(pScreen);
+
+ if (pVia->directRenderingEnabled) {
+ pVia->directRenderingEnabled = VIADRIFinishScreenInit(pScreen);
+ }
+ if (pVia->directRenderingEnabled) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering enabled\n");
+ }
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering disabled\n");
+ }
+#endif
+
+ if (VIA_SERIES(pVia->Chipset) && !pVia->IsSecondary) {
+ FillGraphicInfo(pScrn);
+
+ /* Mark we have already use all memory */
+ /* pVia->FBFreeStart = pVia->FBFreeEnd; */
+
+ /* pass graphic info to via_v4l kernel module */
+
+ if (pVia->V4LEnabled == 1) {
+ if ( -1 == ioctl(fd, VIAMGR_INFO_XSERVERON, &gVIAGraphicInfo) )
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "IOCTL VIAMGR_INFO_XSERVERON fail.\n");
+ }
+ }
+
+ close(fd);
+
+ viaInitVideo(pScreen);
+ }
+
+ if (serverGeneration == 1)
+ xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Done\n"));
+ return TRUE;
+}
+
+
+static int VIAInternalScreenInit(int scrnIndex, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn;
+ VIAPtr pVia;
+ int width, height, displayWidth;
+ unsigned char *FBStart;
+ int ret = TRUE;
+
+ xf86DrvMsg(scrnIndex, X_INFO, "VIAInternalScreenInit\n");
+
+ pScrn = xf86Screens[pScreen->myNum];
+ pVia = VIAPTR(pScrn);
+
+ displayWidth = pScrn->displayWidth;
+
+ if (pVia->rotate) {
+ height = pScrn->virtualX;
+ width = pScrn->virtualY;
+ } else {
+ width = pScrn->virtualX;
+ height = pScrn->virtualY;
+ }
+
+ if (pVia->shadowFB) {
+ pVia->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
+ pVia->ShadowPtr = xalloc(pVia->ShadowPitch * height);
+ displayWidth = pVia->ShadowPitch / (pScrn->bitsPerPixel >> 3);
+ FBStart = pVia->ShadowPtr;
+ }
+ else {
+ pVia->ShadowPtr = NULL;
+ FBStart = pVia->FBStart;
+ }
+
+#ifdef USE_FB
+ ret = fbScreenInit(pScreen, FBStart, width, height,
+ pScrn->xDpi, pScrn->yDpi, displayWidth,
+ pScrn->bitsPerPixel);
+#else
+ switch (pScrn->bitsPerPixel) {
+ case 8:
+ ret = cfbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi,
+ pScrn->yDpi, displayWidth);
+ break;
+
+ case 16:
+ ret = cfb16ScreenInit(pScreen, FBStart, width, height, pScrn->xDpi,
+ pScrn->yDpi, displayWidth);
+ break;
+
+ case 32:
+ ret = cfb32ScreenInit(pScreen, FBStart, width, height, pScrn->xDpi,
+ pScrn->yDpi, displayWidth);
+ break;
+
+ default:
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "Internal error: invalid bpp (%d) in SavageScreenInit\n",
+ pScrn->bitsPerPixel);
+ ret = FALSE;
+ break;
+ }
+#endif
+
+ return ret;
+}
+
+
+static ModeStatus VIAValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flags)
+{
+ DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAValidMode\n"));
+ /* TODO check modes */
+ return MODE_OK;
+}
+
+
+static void VIABIOSInit(VIAPtr pVia, ScrnInfoPtr pScrn, DisplayModePtr pMode)
+{
+ int i;
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+
+ pBIOSInfo->Chipset = pVia->Chipset;
+ pBIOSInfo->ChipRev = pVia->ChipRev;
+ pBIOSInfo->bitsPerPixel = pScrn->bitsPerPixel;
+ pBIOSInfo->displayWidth = pScrn->displayWidth;
+ pBIOSInfo->frameX1 = pScrn->frameX1;
+ pBIOSInfo->frameY1 = pScrn->frameY1;
+ pBIOSInfo->scrnIndex = pScrn->scrnIndex;
+
+ pBIOSInfo->Clock = pMode->Clock;
+ pBIOSInfo->HTotal = pMode->HTotal;
+ pBIOSInfo->VTotal = pMode->VTotal;
+ pBIOSInfo->HDisplay = pMode->HDisplay;
+ pBIOSInfo->VDisplay = pMode->VDisplay;
+ pBIOSInfo->CrtcHDisplay = pMode->CrtcHDisplay;
+ pBIOSInfo->CrtcVDisplay = pMode->CrtcVDisplay;
+ if (pBIOSInfo->FirstInit) {
+ pBIOSInfo->SaveframeX1 = pScrn->frameX1;
+ pBIOSInfo->SaveframeY1 = pScrn->frameY1;
+ pBIOSInfo->SaveHDisplay = pMode->HDisplay;
+ pBIOSInfo->SaveVDisplay = pMode->VDisplay;
+ pBIOSInfo->SaveCrtcHDisplay = pMode->CrtcHDisplay;
+ pBIOSInfo->SaveCrtcVDisplay = pMode->CrtcVDisplay;
+ }
+
+ pBIOSInfo->IsSecondary = pVia->IsSecondary;
+ pBIOSInfo->HasSecondary = pVia->HasSecondary;
+
+ for (i = 0; i < 0xFF; i++) {
+ pBIOSInfo->TVRegs[i] = pVia->SavedReg.TVRegs[i];
+ }
+}
+
+
+static void VIAPostFindMode(VIAPtr pVia, ScrnInfoPtr pScrn, DisplayModePtr pMode)
+{
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+
+ pVia->ModeReg.mode = pBIOSInfo->mode;
+ pVia->ModeReg.resMode = pBIOSInfo->resMode;
+ pVia->ModeReg.refresh = pBIOSInfo->refresh;
+ pVia->ModeReg.offsetWidthByQWord = pBIOSInfo->offsetWidthByQWord;
+ pVia->ModeReg.countWidthByQWord = pBIOSInfo->countWidthByQWord;
+
+ pScrn->frameX1 = pBIOSInfo->frameX1;
+ pScrn->frameY1 = pBIOSInfo->frameY1;
+ pMode->HDisplay = pBIOSInfo->HDisplay;
+ pMode->VDisplay = pBIOSInfo->VDisplay;
+
+}
+
+
+static Bool VIAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ VIARegPtr new = &pVia->ModeReg;
+ vgaRegPtr vganew = &hwp->ModeReg;
+ int fd;
+ /* DDUPDATEOVERLAY UpdateOverlay; */
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAModeInit\n"));
+
+ fd = open("/dev/video2",O_RDWR);
+ /* memset(&UpdateOverlay,0,sizeof(UpdateOverlay)); */
+
+ if (!vgaHWInit(pScrn, mode)) {
+ vgaHWBlankScreen(pScrn, TRUE);
+ return FALSE;
+ }
+
+ pScrn->vtSema = TRUE;
+
+ VIABIOSInit(pVia, pScrn, mode);
+
+ if (!VIAFindModeUseBIOSTable(pBIOSInfo)) {
+ vgaHWBlankScreen(pScrn, TRUE);
+ VIAFreeRec(pScrn);
+ return FALSE;
+ }
+
+ VIAPostFindMode(pVia, pScrn, mode);
+
+ /* do it! */
+ VIAWriteMode(pScrn, vganew, new);
+
+ /* pass graphic info to via_v4l kernel module */
+ /* Coz mode changes, some member in gVIAGraphicInfo need to modify */
+ if (VIA_SERIES(pVia->Chipset) && !pVia->IsSecondary)
+ {
+ FillGraphicInfo(pScrn);
+
+ if( -1 == fd) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " Couldn't open \"/dev/video2\"\n");
+ }
+
+ if (pVia->V4LEnabled == 1) {
+ if ( -1 == ioctl(fd, VIA_VID_SET_2D_INFO, &gVIAGraphicInfo) )
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Can't get through IOCTL to V4L\n");
+ }
+ }
+ else {
+ DBG_DD(ErrorF("SWOV: VIAVidSet2DInfo\n"));
+
+ /* Save MCLK value*/
+ VGAOUT8(0x3C4, 0x16); Save_3C4_16 = VGAIN8(0x3C5);
+ DBG_DD(ErrorF(" 3c4.16 : %08x \n",VGAIN8(0x3C5)));
+ VGAOUT8(0x3C4, 0x17); Save_3C4_17 = VGAIN8(0x3C5);
+ DBG_DD(ErrorF(" 3c4.17 : %08x \n",VGAIN8(0x3C5)));
+ VGAOUT8(0x3C4, 0x18); Save_3C4_18 = VGAIN8(0x3C5);
+ DBG_DD(ErrorF(" 3c4.18 : %08x \n",VGAIN8(0x3C5)));
+ }
+ }
+
+ close(fd);
+
+ VIAAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+
+ return TRUE;
+}
+
+
+static Bool VIACloseScreen(int scrnIndex, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ vgaRegPtr vgaSavePtr = &hwp->SavedReg;
+ VIARegPtr viaSavePtr = &pVia->SavedReg;
+ CARD32 dwCursorMode;
+ int fd;
+
+ DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIACloseScreen\n"));
+ /* Wait Hardware Engine idle to exit graphicd mode */
+ WaitIdle();
+
+ /* Patch for normal log out and restart X, 3D application will hang */
+ VIAWriteMode(pScrn, vgaSavePtr, viaSavePtr);
+
+ if (!pVia->IsSecondary) {
+ /* pass graphic info to via_v4l kernel module */
+ fd = open("/dev/video2",O_RDWR);
+
+ if( -1 == fd) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " Couldn't open \"/dev/video2\"\n");
+ }
+
+ if (pVia->V4LEnabled == 1) {
+ if ( -1 == ioctl(fd, VIAMGR_INFO_XSERVEROFF, &gVIAGraphicInfo) )
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Can't get through IOCTL to V4L\n");
+ }
+ }
+
+ close(fd);
+
+ /* Turn off all video activities */
+ viaExitVideo(pScrn);
+
+ /* Diable Hardware Cursor */
+ dwCursorMode = VIAGETREG(VIA_REG_CURSOR_MODE);
+ VIASETREG(VIA_REG_CURSOR_MODE, dwCursorMode & 0xFFFFFFFE);
+ }
+
+ if (pVia->VQEnable) {
+ /* if we use VQ, disable it before we exit */
+ VIASETREG(0x43c, 0x00fe0000);
+ VIASETREG(0x440, 0x00000004);
+ }
+
+ if (pVia->AccelInfoRec) {
+ XAADestroyInfoRec(pVia->AccelInfoRec);
+ pVia->AccelInfoRec = NULL;
+ }
+ if (pVia->CursorInfoRec) {
+ xf86DestroyCursorInfoRec(pVia->CursorInfoRec);
+ pVia->CursorInfoRec = NULL;
+ }
+ if (pVia->ShadowPtr) {
+ xfree(pVia->ShadowPtr);
+ pVia->ShadowPtr = NULL;
+ }
+ if (pVia->DGAModes) {
+ xfree(pVia->DGAModes);
+ pVia->DGAModes = NULL;
+ }
+ if(pVia->pInt10) {
+ xf86FreeInt10(pVia->pInt10);
+ pVia->pInt10 = NULL;
+ }
+
+ if (pScrn->vtSema) {
+ VIAWriteMode(pScrn, vgaSavePtr, viaSavePtr);
+ vgaHWLock(hwp);
+ VIAUnmapMem(pScrn);
+ }
+
+ pScrn->vtSema = FALSE;
+ pScreen->CloseScreen = pVia->CloseScreen;
+
+ return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+}
+
+/*
+ * This only gets called when a screen is being deleted. It does not
+ * get called routinely at the end of a server generation.
+ */
+static void VIAFreeScreen(int scrnIndex, int flags)
+{
+ DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAFreeScreen\n"));
+ if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
+ vgaHWFreeHWRec(xf86Screens[scrnIndex]);
+ VIAFreeRec(xf86Screens[scrnIndex]);
+}
+
+static Bool VIASaveScreen(ScreenPtr pScreen, int mode)
+{
+ return vgaHWSaveScreen(pScreen, mode);
+}
+
+
+void VIAAdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ int Base, tmp;
+ int vgaCRIndex, vgaCRReg, vgaIOBase;
+ int fd0 = -1, fd1 = -1, fd2 = -1;
+ static int old_x=0, old_y=0;
+ DDLOCK ddLock;
+ LPDDLOCK lpddLock = &ddLock;
+ DDUPDATEOVERLAY UpdateOverlay;
+ ADJUSTFRAME AdjustFrame;
+ struct video_window ov_win_v1;
+ struct video_window ov_win_v3;
+
+ DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAAdjustFrame\n"));
+ vgaIOBase = hwp->IOBase;
+ vgaCRIndex = vgaIOBase + 4;
+ vgaCRReg = vgaIOBase + 5;
+
+ Base = (y * pScrn->displayWidth + x) * (pScrn->bitsPerPixel / 8);
+
+ /* now program the start address registers */
+ if (pVia->IsSecondary) {
+ Base = (Base + pScrn->fbOffset) >> 3;
+ VGAOUT8(vgaCRIndex, 0x62);
+ tmp = VGAIN8(vgaCRReg) & 0x01;
+ tmp |= (Base & 0x7F) << 1;
+ VGAOUT8(vgaCRReg, tmp);
+ VGAOUT8(vgaCRIndex, 0x63);
+ VGAOUT8(vgaCRReg, ((Base & 0x7F80) >> 7));
+ VGAOUT8(vgaCRIndex, 0x64);
+ VGAOUT8(vgaCRReg, ((Base & 0x7F8000) >> 15));
+ }
+ else {
+ Base = Base >> 1;
+ VGAOUT16(vgaCRIndex, (Base & 0x00ff00) | 0x0c);
+ VGAOUT16(vgaCRIndex, ((Base & 0x00ff) << 8) | 0x0d);
+ VGAOUT16(vgaCRIndex, ((Base & 0xff0000) >> 8) | 0x34);
+ }
+
+ if (pVia->V4LEnabled == 1) {
+ /* deal with panning case via via_v4l kernel module */
+ fd0 = open("/dev/video0",O_RDWR);
+ if( -1 == fd0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " Couldn't open \"/dev/video0\"\n");
+ }
+
+ fd1 = open("/dev/video1",O_RDWR);
+ if( -1 == fd1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " Couldn't open \"/dev/video1\"\n");
+ }
+
+ fd2 = open("/dev/video2",O_RDWR);
+ if( -1 == fd2) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " Couldn't open \"/dev/video2\"\n");
+ }
+
+ /* Pass Panning (x, y) info to V4L */
+ AdjustFrame.x = x;
+ AdjustFrame.y = y;
+
+ if ( -1 == ioctl(fd0, VIA_VID_ADJUSTFRAME, &AdjustFrame))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "IOCTL VIA_VID_ADJUSTFRAME failed.\n");
+ }
+
+ /* Check if HW mpeg engine active */
+ if (lpVideoControl->VideoStatus & SW_VIDEO_ON) /* SW video case */
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ " Call SW MPEG UpdateOverlay at panning mode.\n");
+
+ ddLock.dwFourCC = FOURCC_YUY2;
+ if ( -1 == ioctl(fd2, VIA_VID_LOCKSURFACE, &ddLock) )
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "IOCTL VIA_VID_LOCKSURFACE failed.\n");
+ }
+
+ UpdateOverlay.dwFlags = DDOVER_SHOW | DDOVER_KEYDEST;
+ UpdateOverlay.dwColorSpaceLowValue = VIAGETREG(0x220);
+ UpdateOverlay.rSrc.left = 0;
+ UpdateOverlay.rSrc.top = 0;
+ UpdateOverlay.rSrc.right = 720;
+ UpdateOverlay.rSrc.bottom = 480;
+
+ UpdateOverlay.rDest.left = (int) lpddLock->SWDevice.gdwSWDstLeft;
+ UpdateOverlay.rDest.top = (int) lpddLock->SWDevice.gdwSWDstTop;
+ UpdateOverlay.rDest.right = UpdateOverlay.rDest.left + lpddLock->SWDevice.gdwSWDstWidth;
+ UpdateOverlay.rDest.bottom = UpdateOverlay.rDest.top + lpddLock->SWDevice.gdwSWDstHeight;
+
+ if ( -1 == ioctl(fd2, VIA_VID_UPDATEOVERLAY, (LPDDUPDATEOVERLAY) &UpdateOverlay))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "IOCTL VIA_VID_UPDATEOVERLAY failed.\n");
+ }
+
+ }
+ else if (VIAGETREG(0x310) & 0x1) /* capture 0 (TV2) case */
+ {
+ ddLock.dwFourCC = FOURCC_TV2;
+ if ( -1 == ioctl(fd1, VIA_VID_LOCKSURFACE, &ddLock) )
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "IOCTL VIA_VID_LOCKSURFACE failed.\n");
+ }
+
+ ov_win_v1.width = ddLock.Capdev_TV2.gdwCAPDstWidth;
+ ov_win_v1.height = ddLock.Capdev_TV2.gdwCAPDstHeight;
+ ov_win_v1.x = ddLock.Capdev_TV2.gdwCAPDstLeft;
+ ov_win_v1.y = ddLock.Capdev_TV2.gdwCAPDstTop;
+ ov_win_v1.flags = 0;
+ ov_win_v1.chromakey = 0x080408;
+ ov_win_v1.clipcount = 0;
+
+ if (-1 == ioctl(fd1, VIDIOCSWIN, &ov_win_v1))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Can't upateoverlay TV2 via V4L\n");
+ }
+
+ }
+
+ if (VIAGETREG(0x354) & 0x1) /* capture 1 (TV1) case */
+ {
+ ddLock.dwFourCC = FOURCC_TV1;
+ if ( -1 == ioctl(fd0, VIA_VID_LOCKSURFACE, &ddLock) )
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "IOCTL VIA_VID_LOCKSURFACE failed.\n");
+ }
+
+ ov_win_v3.width = ddLock.Capdev_TV1.gdwCAPDstWidth;
+ ov_win_v3.height = ddLock.Capdev_TV1.gdwCAPDstHeight;
+ ov_win_v3.x = ddLock.Capdev_TV1.gdwCAPDstLeft;
+ ov_win_v3.y = ddLock.Capdev_TV1.gdwCAPDstTop;
+ ov_win_v3.flags = 0;
+ ov_win_v3.chromakey = 0x080408;
+ ov_win_v3.clipcount = 0;
+
+ if (-1 == ioctl(fd0, VIDIOCSWIN, &ov_win_v3))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Can't upateoverlay TV1 via V4L\n");
+ }
+
+ }
+
+ old_x = x;
+ old_y = y;
+
+ close(fd0);
+ close(fd1);
+ close(fd2);
+ } /* if (pVia->V4LEnabled == 1) */
+
+ else { /* if (pVia->V4LEnabled == 1) */
+ /* Pass Panning (x, y) info to V4L */
+ AdjustFrame.x = x;
+ AdjustFrame.y = y;
+
+ VIAVidAdjustFrame(&AdjustFrame);
+
+ /* Check if HW mpeg engine active */
+ if (lpVideoControl->VideoStatus & SW_VIDEO_ON) /* SW video case */
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ " Call SW MPEG UpdateOverlay at panning mode.\n");
+
+ ddLock.dwFourCC = FOURCC_YUY2;
+
+ VIAVidLockSurface(pScrn, &ddLock);
+
+ UpdateOverlay.dwFlags = DDOVER_SHOW | DDOVER_KEYDEST;
+ UpdateOverlay.dwColorSpaceLowValue = VIAGETREG(0x220);
+ UpdateOverlay.rSrc.left = 0;
+ UpdateOverlay.rSrc.top = 0;
+ UpdateOverlay.rSrc.right = 720;
+ UpdateOverlay.rSrc.bottom = 480;
+
+ UpdateOverlay.rDest.left = (int) lpddLock->SWDevice.gdwSWDstLeft;
+ UpdateOverlay.rDest.top = (int) lpddLock->SWDevice.gdwSWDstTop;
+ UpdateOverlay.rDest.right = UpdateOverlay.rDest.left + lpddLock->SWDevice.gdwSWDstWidth;
+ UpdateOverlay.rDest.bottom = UpdateOverlay.rDest.top + lpddLock->SWDevice.gdwSWDstHeight;
+
+ VIAVidUpdateOverlay(pScrn, &UpdateOverlay);
+ }
+ else if (VIAGETREG(0x310) & 0x1) /* capture 0 (TV2) case */
+ {
+ ddLock.dwFourCC = FOURCC_TV2;
+
+ VIAVidLockSurface(pScrn, &ddLock);
+
+ ov_win_v1.width = ddLock.Capdev_TV2.gdwCAPDstWidth;
+ ov_win_v1.height = ddLock.Capdev_TV2.gdwCAPDstHeight;
+ ov_win_v1.x = ddLock.Capdev_TV2.gdwCAPDstLeft;
+ ov_win_v1.y = ddLock.Capdev_TV2.gdwCAPDstTop;
+ ov_win_v1.flags = 0;
+ ov_win_v1.chromakey = 0x080408;
+ ov_win_v1.clipcount = 0;
+ }
+
+ if (VIAGETREG(0x354) & 0x1) /* capture 1 (TV1) case */
+ {
+ ddLock.dwFourCC = FOURCC_TV1;
+
+ VIAVidLockSurface(pScrn, &ddLock);
+
+ ov_win_v3.width = ddLock.Capdev_TV1.gdwCAPDstWidth;
+ ov_win_v3.height = ddLock.Capdev_TV1.gdwCAPDstHeight;
+ ov_win_v3.x = ddLock.Capdev_TV1.gdwCAPDstLeft;
+ ov_win_v3.y = ddLock.Capdev_TV1.gdwCAPDstTop;
+ ov_win_v3.flags = 0;
+ ov_win_v3.chromakey = 0x080408;
+ ov_win_v3.clipcount = 0;
+ }
+
+ old_x = x;
+ old_y = y;
+
+ } /* else (pVia->V4LEnabled == 1) */
+
+ return;
+}
+
+
+Bool VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIASwitchMode\n"));
+ /* Wait Hardware Engine idle to switch graphicd mode */
+ WaitIdle();
+
+ if (pVia->VQEnable) {
+ /* if we use VQ, disable it before we exit */
+ VIASETREG(0x43c, 0x00fe0000);
+ VIASETREG(0x440, 0x00000004);
+ }
+
+ return VIAModeInit(xf86Screens[scrnIndex], mode);
+}
+
+
+void VIAEnableMMIO(ScrnInfoPtr pScrn)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ unsigned char val;
+
+ if (xf86IsPrimaryPci(pVia->PciInfo)) {
+ /* If we are primary card, we still use std vga port. If we use
+ * MMIO, system will hang in vgaHWSave when our card used in
+ * PLE and KLE (integrated Trident MVP4)
+ */
+ vgaHWSetStdFuncs(hwp);
+ }
+ else {
+ vgaHWSetMmioFuncs(hwp, pVia->MapBase, 0x8000);
+ }
+
+ val = VGAIN8(0x3c3);
+ VGAOUT8(0x3c3, val | 0x01);
+ val = VGAIN8(VGA_MISC_OUT_R);
+ VGAOUT8(VGA_MISC_OUT_W, val | 0x01);
+
+ /* Unlock Extended IO Space */
+ VGAOUT8(0x3c4, 0x10);
+ VGAOUT8(0x3c5, 0x01);
+
+ /* Enable MMIO */
+ if(!pVia->IsSecondary) {
+ VGAOUT8(0x3c4, 0x1a);
+ val = VGAIN8(0x3c5);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "primary val = %x\n", val));
+ VGAOUT8(0x3c5, val | 0x68);
+ }
+ else {
+ VGAOUT8(0x3c4, 0x1a);
+ val = VGAIN8(0x3c5);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "secondary val = %x\n", val));
+ VGAOUT8(0x3c5, val | 0x38);
+ }
+
+ return;
+}
+
+
+void VIADisableMMIO(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ unsigned char val;
+
+ VGAOUT8(0x3c4, 0x1a);
+ val = VGAIN8(0x3c5);
+ VGAOUT8(0x3c5, val & 0x97);
+
+ return;
+}
+
+
+void VIALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies,
+ LOCO *colors, VisualPtr pVisual)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int i, index;
+ int sr1a, sr1b, cr67, cr6a;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIALoadPalette\n"));
+
+ if (pScrn->bitsPerPixel != 8)
+ return;
+ VGAOUT8(0x3C4, 0x1A);
+ sr1a = VGAIN8(0x3C5);
+ VGAOUT8(0x3C4, 0x1B);
+ sr1b = VGAIN8(0x3C5);
+ VGAOUT8(0x3D4, 0x67);
+ cr67 = VGAIN8(0x3D5);
+ VGAOUT8(0x3D4, 0x6A);
+ cr6a = VGAIN8(0x3D5);
+
+ if (pVia->IsSecondary) {
+ VGAOUT8(0x3C4, 0x1A);
+ VGAOUT8(0x3C5, sr1a | 0x01);
+ VGAOUT8(0x3C4, 0x1B);
+ VGAOUT8(0x3C5, sr1b | 0x80);
+ VGAOUT8(0x3D4, 0x67);
+ VGAOUT8(0x3D5, cr67 & 0x3F);
+ VGAOUT8(0x3D4, 0x6A);
+ VGAOUT8(0x3D5, cr6a | 0xC0);
+ }
+
+ for (i = 0; i < numColors; i++) {
+ index = indicies[i];
+ VGAOUT8(0x3c8, index);
+ VGAOUT8(0x3c9, colors[index].red);
+ VGAOUT8(0x3c9, colors[index].green);
+ VGAOUT8(0x3c9, colors[index].blue);
+ }
+
+ if (pVia->IsSecondary) {
+ VGAOUT8(0x3C4, 0x1A);
+ VGAOUT8(0x3C5, sr1a);
+ VGAOUT8(0x3C4, 0x1B);
+ VGAOUT8(0x3C5, sr1b);
+ VGAOUT8(0x3D4, 0x67);
+ VGAOUT8(0x3D5, cr67);
+ VGAOUT8(0x3D4, 0x6A);
+ VGAOUT8(0x3D5, cr6a);
+
+ /* Screen 0 palette was changed by mode setting of Screen 1,
+ * so load again */
+ for (i = 0; i < numColors; i++) {
+ index = indicies[i];
+ VGAOUT8(0x3c8, index);
+ VGAOUT8(0x3c9, colors[index].red);
+ VGAOUT8(0x3c9, colors[index].green);
+ VGAOUT8(0x3c9, colors[index].blue);
+ }
+
+ }
+
+}
+
+
+static void VIADPMS(ScrnInfoPtr pScrn, int mode, int flags)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ VIAModeTablePtr pViaModeTable;
+ int vgaCRIndex, vgaCRReg;
+ int port, offset, mask, data;
+ int i, j, k;
+ CARD8 val, misc;
+
+ I2CDevPtr dev;
+ unsigned char W_Buffer[2];
+
+ vgaCRIndex = hwp->IOBase + 4;
+ vgaCRReg = hwp->IOBase + 5;
+ pViaModeTable = pBIOSInfo->pModeTable;
+ j = 0;
+
+ VGAOUT8(0x3d4, 0x6A);
+ misc = VGAIN8(0x3d5);
+
+ /* Clear DPMS setting */
+ VGAOUT8(vgaCRIndex, 0x36);
+ val = VGAIN8(vgaCRReg);
+ val &= 0xCF;
+ /* Turn Off CRT, if user doesn't want crt on */
+ if (!pVia->IsSecondary && !(pBIOSInfo->ActiveDevice & VIA_DEVICE_CRT1)) {
+ val |= 0x30;
+ }
+
+ if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) {
+ /* Find Panel Size Index */
+ for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) {
+ if (pViaModeTable->lcdTable[i].fpSize == pBIOSInfo->PanelSize)
+ break;
+ };
+
+ for (j = 0; j < pViaModeTable->NumPowerOn; j++) {
+ if (pViaModeTable->lcdTable[i].powerSeq ==
+ pViaModeTable->powerOn[j].powerSeq)
+ break;
+ }
+ }
+
+
+ switch (mode) {
+ case DPMSModeOn:
+ if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) {
+ /* Enable LCD */
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) | 0x08);
+
+ for (k = 0; k < pViaModeTable->powerOn[j].numEntry; k++) {
+ port = pViaModeTable->powerOn[j].port[k];
+ offset = pViaModeTable->powerOn[j].offset[k];
+ mask = pViaModeTable->powerOn[j].mask[k];
+ data = pViaModeTable->powerOn[j].data[k] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, (VGAIN8(0x301+port) & ~mask) | data);
+ usleep(pViaModeTable->powerOn[j].delay[k]);
+ }
+ misc |= 0x08;
+ }
+
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ case VIA_TV3:
+ case VIA_VT1622A:
+ W_Buffer[0] = 0x0E;
+ W_Buffer[1] = 0x0;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_CH7019:
+ W_Buffer[0] = 0x49;
+ W_Buffer[1] = 0x20;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ /*W_Buffer[0] = 0x1E;
+ W_Buffer[1] = 0xD0;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);*/
+ break;
+ case VIA_SAA7108:
+ W_Buffer[0] = 0x2D;
+ switch (pBIOSInfo->TVOutput) {
+ case TVOUTPUT_COMPOSITE:
+ case TVOUTPUT_SVIDEO:
+ W_Buffer[1] = 0xB4;
+ break;
+ case TVOUTPUT_RGB:
+ W_Buffer[1] = 0;
+ break;
+ case TVOUTPUT_YCBCR:
+ W_Buffer[1] = 0x84;
+ break;
+ default:
+ W_Buffer[1] = 0x08;
+ break;
+ }
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ default:
+ break;
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ VGAOUT8(vgaCRIndex, 0x36);
+ VGAOUT8(vgaCRReg, val);
+ break;
+ case DPMSModeStandby:
+ case DPMSModeSuspend:
+ case DPMSModeOff:
+ if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) {
+ /* Disable LCD */
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, VGAIN8(0x3d5) & 0xF7);
+ for (k = 0; k < pViaModeTable->powerOff[j].numEntry; k++) {
+ port = pViaModeTable->powerOff[j].port[k];
+ offset = pViaModeTable->powerOff[j].offset[k];
+ mask = pViaModeTable->powerOff[j].mask[k];
+ data = pViaModeTable->powerOff[j].data[k] & mask;
+ VGAOUT8(0x300+port, offset);
+ VGAOUT8(0x301+port, (VGAIN8(0x301+port) & ~mask) | data);
+ usleep(pViaModeTable->powerOff[j].delay[k]);
+ }
+ misc &= 0xF7;
+ }
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ W_Buffer[0] = 0x0E;
+ W_Buffer[1] = 0x03;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ W_Buffer[0] = 0x0E;
+ W_Buffer[1] = 0x0F;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_CH7019:
+ W_Buffer[0] = 0x49;
+ W_Buffer[1] = 0x3E;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x1E;
+ W_Buffer[1] = 0xD0;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_SAA7108:
+ W_Buffer[0] = 0x2D;
+ W_Buffer[1] = 0x08;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ default:
+ break;
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+
+ val |= 0x30;
+ VGAOUT8(vgaCRIndex, 0x36);
+ VGAOUT8(vgaCRReg, val);
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid DPMS mode %d\n", mode);
+ break;
+ }
+
+ if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) {
+ VGAOUT8(0x3d4, 0x6A);
+ VGAOUT8(0x3d5, misc);
+ }
+ return;
+}
+
+
+int VIAGetMemSize()
+{
+ /* TODO: Do memory sizing */
+
+ /* Default 16MB */
+ return (16 << 10);
+}
+
+/* Active Device according connected status */
+Bool VIADeviceSeletion(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ /*unsigned int i;
+ unsigned char numDevice;*/
+ pBIOSInfo->SAMM = FALSE;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIADeviceSeletion\n"));
+ /* if XF86Config Option "ActiveDevice" hasn't set, active device according CMOS */
+ if (!pBIOSInfo->ActiveDevice) {
+ pBIOSInfo->ActiveDevice = BIOS_GetActiveDevice(pScrn);
+ }
+ /* if XF86Config-4 set SAMM, and only active one device, active device according CMOS */
+ else if (pVia->IsSecondary && (pBIOSInfo->ActiveDevice == VIA_DEVICE_CRT1 ||
+ pBIOSInfo->ActiveDevice == VIA_DEVICE_LCD ||
+ pBIOSInfo->ActiveDevice == VIA_DEVICE_TV ||
+ pBIOSInfo->ActiveDevice == VIA_DEVICE_DFP ||
+ pBIOSInfo->ActiveDevice == VIA_DEVICE_CRT2)){
+ pBIOSInfo->ActiveDevice = BIOS_GetActiveDevice(pScrn);
+ }
+ if (((pBIOSInfo->ActiveDevice & pBIOSInfo->ConnectedDevice) == pBIOSInfo->ActiveDevice)
+ && (pVia->IsSecondary)) {
+ pBIOSInfo->SAMM = TRUE;
+ }
+ pBIOSInfo->ActiveDevice &= pBIOSInfo->ConnectedDevice;
+ pVia->ActiveDevice = pBIOSInfo->ActiveDevice;
+
+ /*if (pBIOSInfo->ActiveDevice & VIA_DEVICE_LCD) {
+ pBIOSInfo->DVIEncoder = VIA_VT3191;
+ numDevice = 0x02;
+ i = BIOS_GetDisplayDeviceInfo(pScrn, &numDevice);
+ if (i != 0xFFFF) {
+ if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID)
+ pBIOSInfo->PanelSize = numDevice;
+ }*/
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Connected Device is %d\n", pBIOSInfo->ConnectedDevice));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Active Device is %d\n", pBIOSInfo->ActiveDevice));
+
+ return TRUE;
+}
+
+/* SAMM device dispatch */
+Bool VIADeviceDispatch(ScrnInfoPtr pScrn)
+{
+ DevUnion* pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gVIAEntityIndex);
+ VIAEntPtr pVIAEnt = pPriv->ptr;
+ VIAPtr pVia1 = VIAPTR(pScrn), pVia0 = VIAPTR(pVIAEnt->pPrimaryScrn);
+ VIABIOSInfoPtr pBIOSInfo1 = pVia1->pBIOSInfo, pBIOSInfo0 = pVia0->pBIOSInfo;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIADeviceDispatch\n"));
+ pBIOSInfo0->SAMM = TRUE;
+ switch (pBIOSInfo1->ActiveDevice) {
+ case (VIA_DEVICE_CRT1 | VIA_DEVICE_LCD) : /* If CRT + LCD, CRT is IGA1 */
+ pBIOSInfo0->ActiveDevice = VIA_DEVICE_CRT1;
+ pBIOSInfo1->ActiveDevice = VIA_DEVICE_LCD;
+ break;
+ case (VIA_DEVICE_CRT1 | VIA_DEVICE_TV) : /* If CRT + TV, CRT is IGA1 */
+ pBIOSInfo0->ActiveDevice = VIA_DEVICE_CRT1;
+ pBIOSInfo1->ActiveDevice = VIA_DEVICE_TV;
+ break;
+ case (VIA_DEVICE_CRT1 | VIA_DEVICE_DFP) : /* If CRT + DFP, CRT is IGA1 */
+ pBIOSInfo0->ActiveDevice = VIA_DEVICE_CRT1;
+ pBIOSInfo1->ActiveDevice = VIA_DEVICE_DFP;
+ break;
+ case (VIA_DEVICE_LCD | VIA_DEVICE_TV) : /* If LCD + TV, TV is IGA1 */
+ pBIOSInfo0->ActiveDevice = VIA_DEVICE_TV;
+ pBIOSInfo1->ActiveDevice = VIA_DEVICE_LCD;
+ break;
+ case (VIA_DEVICE_LCD | VIA_DEVICE_DFP) : /* If LCD + DFP, DFP is IGA1 */
+ pBIOSInfo0->ActiveDevice = VIA_DEVICE_DFP;
+ pBIOSInfo1->ActiveDevice = VIA_DEVICE_LCD;
+ break;
+ case (VIA_DEVICE_TV | VIA_DEVICE_DFP) : /* If TV + DFP, TV is IGA1 */
+ pBIOSInfo0->ActiveDevice = VIA_DEVICE_TV;
+ pBIOSInfo1->ActiveDevice = VIA_DEVICE_DFP;
+ break;
+ default :
+ return FALSE;
+ break;
+ }
+ DEBUG(xf86DrvMsg(pVIAEnt->pPrimaryScrn->scrnIndex, X_INFO, "Active Device is %d\n", pBIOSInfo0->ActiveDevice));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Active Device is %d\n", pBIOSInfo1->ActiveDevice));
+ return TRUE;
+}
+
+void VIADebugBreak()
+{
+ /* use int3 to set breakpoint */
+ __asm __volatile("int $3");
+}
+
+#ifdef XF86DRI
+void
+VIAInitialize3DEngine(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int i;
+
+ if (!b3DRegsInitialized)
+ {
+
+ VIASETREG(0x43C, 0x00010000);
+
+ for (i = 0; i <= 0x7D; i++)
+ {
+ VIASETREG(0x440, (CARD32) i << 24);
+ }
+
+ VIASETREG(0x43C, 0x00020000);
+
+ for (i = 0; i <= 0x94; i++)
+ {
+ VIASETREG(0x440, (CARD32) i << 24);
+ }
+
+ VIASETREG(0x440, 0x82400000);
+
+ VIASETREG(0x43C, 0x01020000);
+
+
+ for (i = 0; i <= 0x94; i++)
+ {
+ VIASETREG(0x440, (CARD32) i << 24);
+ }
+
+ VIASETREG(0x440, 0x82400000);
+ VIASETREG(0x43C, 0xfe020000);
+
+ for (i = 0; i <= 0x03; i++)
+ {
+ VIASETREG(0x440, (CARD32) i << 24);
+ }
+
+ VIASETREG(0x43C, 0x00030000);
+
+ for (i = 0; i <= 0xff; i++)
+ {
+ VIASETREG(0x440, 0);
+ }
+ VIASETREG(0x43C, 0x00100000);
+ VIASETREG(0x440, 0x00333004);
+ VIASETREG(0x440, 0x10000002);
+ VIASETREG(0x440, 0x60000000);
+ VIASETREG(0x440, 0x61000000);
+ VIASETREG(0x440, 0x62000000);
+ VIASETREG(0x440, 0x63000000);
+ VIASETREG(0x440, 0x64000000);
+
+ VIASETREG(0x43C, 0x00fe0000);
+
+ if (pVia->ChipRev >= 3 )
+ VIASETREG(0x440,0x40008c0f);
+ else
+ VIASETREG(0x440,0x4000800f);
+
+ VIASETREG(0x440,0x44000000);
+ VIASETREG(0x440,0x45080C04);
+ VIASETREG(0x440,0x46800408);
+ VIASETREG(0x440,0x50000000);
+ VIASETREG(0x440,0x51000000);
+ VIASETREG(0x440,0x52000000);
+ VIASETREG(0x440,0x53000000);
+
+ b3DRegsInitialized = 1;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "3D Register has been initilized !\n");
+ }
+
+ VIASETREG(0x43C,0x00fe0000);
+ VIASETREG(0x440,0x08000001);
+ VIASETREG(0x440,0x0A000183);
+ VIASETREG(0x440,0x0B00019F);
+ VIASETREG(0x440,0x0C00018B);
+ VIASETREG(0x440,0x0D00019B);
+ VIASETREG(0x440,0x0E000000);
+ VIASETREG(0x440,0x0F000000);
+ VIASETREG(0x440,0x10000000);
+ VIASETREG(0x440,0x11000000);
+ VIASETREG(0x440,0x20000000);
+}
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_driver.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_driver.h new file mode 100644 index 000000000..2c116432e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_driver.h @@ -0,0 +1,320 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_DRIVER_H
+#define _VIA_DRIVER_H
+
+/*#define DEBUG_PRINT*/
+#ifdef DEBUG_PRINT
+#define DEBUG(x) x
+#else
+#define DEBUG(x)
+#endif
+
+#include "vgaHW.h"
+#include "xf86.h"
+#include "xf86Resources.h"
+#include "xf86_ansic.h"
+#include "xf86Pci.h"
+#include "xf86PciInfo.h"
+#include "xf86_OSproc.h"
+#include "compiler.h"
+#include "xf86Cursor.h"
+#include "mipointer.h"
+#include "micmap.h"
+
+#define USE_FB
+#ifdef USE_FB
+#include "fb.h"
+#else
+#include "cfb.h"
+#include "cfb16.h"
+#include "cfb32.h"
+#endif
+
+#include "xf86cmap.h"
+#include "vbe.h"
+#include "xaa.h"
+
+#include "via_regs.h"
+#include "via_bios.h"
+#include "via_gpioi2c.h"
+
+#ifdef XF86DRI
+#define _XF86DRI_SERVER_
+#include "sarea.h"
+#include "dri.h"
+#include "GL/glxint.h"
+#include "via_dri.h"
+#endif
+
+#define DRIVER_NAME "via"
+#define DRIVER_VERSION "4.1.0"
+#define VERSION_MAJOR 4
+#define VERSION_MINOR 1
+#define PATCHLEVEL 28
+#define VIA_VERSION ((VERSION_MAJOR<<24) | (VERSION_MINOR<<16) | PATCHLEVEL)
+
+#define VGAIN8(addr) MMIO_IN8(pVia->MapBase+0x8000, addr)
+#define VGAIN16(addr) MMIO_IN16(pVia->MapBase+0x8000, addr)
+#define VGAIN(addr) MMIO_IN32(pVia->MapBase+0x8000, addr)
+
+#define VGAOUT8(addr, val) MMIO_OUT8(pVia->MapBase+0x8000, addr, val)
+#define VGAOUT16(addr, val) MMIO_OUT16(pVia->MapBase+0x8000, addr, val)
+#define VGAOUT(addr, val) MMIO_OUT32(pVia->MapBase+0x8000, addr, val)
+
+#define INREG(addr) MMIO_IN32(pVia->MapBase, addr)
+#define OUTREG(addr, val) MMIO_OUT32(pVia->MapBase, addr, val)
+#define INREG16(addr) MMIO_IN16(pVia->MapBase, addr)
+#define OUTREG16(addr, val) MMIO_OUT16(pVia->MapBase, addr, val)
+
+#define VIA_PIXMAP_CACHE_SIZE (256 * 1024)
+#define VIA_CURSOR_SIZE (4 * 1024)
+#define VIA_VQ_SIZE (256 * 1024)
+
+typedef struct {
+ unsigned int mode, refresh, resMode;
+ int countWidthByQWord;
+ int offsetWidthByQWord;
+ unsigned char SR08, SR0A, SR0F;
+
+ /* extended Sequencer registers */
+ unsigned char SR10, SR11, SR12, SR13,SR14,SR15,SR16;
+ unsigned char SR17, SR18, SR19, SR1A,SR1B,SR1C,SR1D,SR1E;
+ unsigned char SR1F, SR20, SR21, SR22,SR23,SR24,SR25,SR26;
+ unsigned char SR27, SR28, SR29, SR2A,SR2B,SR2C,SR2D,SR2E;
+ unsigned char SR2F, SR30, SR31, SR32,SR33,SR34,SR40,SR41;
+ unsigned char SR42, SR43, SR44, SR45,SR46,SR47;
+
+ unsigned char Clock;
+
+ /* extended CRTC registers */
+ unsigned char CR30, CR31, CR32, CR33, CR34, CR35, CR36, CR37;
+ unsigned char CR38, CR39, CR3A, CR40, CR41, CR42, CR43, CR44;
+ unsigned char CR45, CR46, CR47, CR48, CR49, CR4A;
+ unsigned char CR6A, CR6B, CR6C, CR91, CR93;
+ unsigned char LCDRegs[68];
+ unsigned char TVRegs[0xFF];
+
+} VIARegRec, *VIARegPtr;
+
+
+typedef struct _VIA {
+ VIARegRec SavedReg;
+ VIARegRec ModeReg;
+ xf86CursorInfoPtr CursorInfoRec;
+ Bool ModeStructInit;
+ int Bpp, Bpl, ScissB;
+ unsigned PlaneMask;
+
+ unsigned long videoRambytes;
+ int videoRamKbytes;
+ int FBFreeStart;
+ int FBFreeEnd;
+ int CursorStart;
+ int VQStart;
+ int VQEnd;
+
+ /* These are physical addresses. */
+ unsigned long FrameBufferBase;
+ unsigned long MmioBase;
+
+ /* These are linear addresses. */
+ unsigned char* MapBase;
+ unsigned char* VidMapBase;
+ unsigned char* BltBase;
+ unsigned char* MapBaseDense;
+ unsigned char* FBBase;
+ unsigned char* FBStart;
+
+ Bool PrimaryVidMapped;
+ int dacSpeedBpp;
+ int minClock, maxClock;
+ int MCLK, REFCLK, LCDclk;
+ double refclk_fact;
+
+ /* Here are all the Options */
+ Bool VQEnable;
+ Bool pci_burst;
+ Bool NoPCIRetry;
+ Bool hwcursor;
+ Bool NoAccel;
+ Bool shadowFB;
+ Bool NoDDCValue;
+ int rotate;
+
+ CloseScreenProcPtr CloseScreen;
+ pciVideoPtr PciInfo;
+ PCITAG PciTag;
+ int Chipset;
+ int ChipId;
+ int ChipRev;
+ vbeInfoPtr pVbe;
+ int EntityIndex;
+
+ /* Support for shadowFB and rotation */
+ unsigned char* ShadowPtr;
+ int ShadowPitch;
+ void (*PointerMoved)(int index, int x, int y);
+
+ /* Support for XAA acceleration */
+ XAAInfoRecPtr AccelInfoRec;
+ xRectangle Rect;
+ CARD32 SavedCmd;
+ CARD32 SavedFgColor;
+ CARD32 SavedBgColor;
+ CARD32 SavedPattern0;
+ CARD32 SavedPattern1;
+ CARD32 SavedPatternAddr;
+
+ /* Support for Int10 processing */
+ xf86Int10InfoPtr pInt10;
+
+ /* BIOS Info Ptr */
+ VIABIOSInfoPtr pBIOSInfo;
+
+ /* Support for DGA */
+ int numDGAModes;
+ DGAModePtr DGAModes;
+ Bool DGAactive;
+ int DGAViewportStatus;
+
+ /* The various wait handlers. */
+ int (*myWaitIdle)(struct _VIA*);
+
+ /* I2C & DDC */
+ I2CBusPtr I2C_Port1;
+ I2CBusPtr I2C_Port2;
+ xf86MonPtr DDC1;
+ xf86MonPtr DDC2;
+
+ /* MHS */
+ Bool IsSecondary;
+ Bool HasSecondary;
+
+ /* Capture de-interlace Mode */
+ CARD32 Cap0_Deinterlace;
+ CARD32 Cap1_Deinterlace;
+
+ Bool Cap0_FieldSwap;
+
+#ifdef XF86DRI
+ Bool directRenderingEnabled;
+ DRIInfoPtr pDRIInfo;
+ int drmFD;
+ int numVisualConfigs;
+ __GLXvisualConfig* pVisualConfigs;
+ VIAConfigPrivPtr pVisualConfigsPriv;
+ unsigned long agpHandle;
+ unsigned long registerHandle;
+ CARD32 agpAddr;
+ unsigned char *agpBase;
+ unsigned int agpSize;
+ Bool IsPCI;
+ Bool drixinerama;
+#endif
+
+ Bool V4LEnabled;
+ unsigned char ActiveDevice; /* if SAMM, non-equal pBIOSInfo->ActiveDevice */
+
+} VIARec, *VIAPtr;
+
+
+typedef struct
+{
+ Bool IsDRIEnabled;
+
+ Bool HasSecondary;
+ Bool BypassSecondary;
+ /*These two registers are used to make sure the CRTC2 is
+ retored before CRTC_EXT, otherwise it could lead to blank screen.*/
+ Bool IsSecondaryRestored;
+ Bool RestorePrimary;
+
+ ScrnInfoPtr pSecondaryScrn;
+ ScrnInfoPtr pPrimaryScrn;
+}VIAEntRec, *VIAEntPtr;
+
+
+/* Shortcuts. These depend on a local symbol "pVia". */
+
+#define WaitIdle() pVia->myWaitIdle(pVia)
+#define VIAPTR(p) ((VIAPtr)((p)->driverPrivate))
+
+
+/* Prototypes. */
+void VIAAdjustFrame(int scrnIndex, int y, int x, int flags);
+Bool VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
+void VIADebugBreak();
+
+/* In via_cursor.c. */
+Bool VIAHWCursorInit(ScreenPtr pScreen);
+void VIAShowCursor(ScrnInfoPtr);
+void VIAHideCursor(ScrnInfoPtr);
+
+
+/* In via_accel.c. */
+Bool VIAInitAccel(ScreenPtr);
+void VIAInitialize2DEngine(ScrnInfoPtr);
+void VIAAccelSync(ScrnInfoPtr);
+
+
+/* In via_shadow.c */
+void VIAPointerMoved(int index, int x, int y);
+void VIARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+void VIARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+void VIARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+void VIARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+void VIARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+
+
+/* In via_bios.c */
+
+/* In via_dga.c */
+Bool VIADGAInit(ScreenPtr);
+
+/* In via_i2c.c */
+Bool VIAI2CInit(ScrnInfoPtr pScrn);
+
+/* In via_gpioi2c.c */
+Bool GPIOI2C_Write(VIABIOSInfoPtr pBIOSInfo, int SubAddress, CARD8 Data);
+Bool GPIOI2C_Read(VIABIOSInfoPtr pBIOSInfo, int SubAddress, CARD8 *Buffer, int BufferLen);
+Bool GPIOI2C_Initial(VIABIOSInfoPtr pBIOSInfo, CARD8 SlaveDevice);
+
+/*In via_video.c*/
+void viaInitVideo(ScreenPtr pScreen);
+void viaExitVideo(ScrnInfoPtr pScrn);
+void viaResetVideo(ScrnInfoPtr pScrn);
+void viaSaveVideo(ScrnInfoPtr pScrn);
+void viaRestoreVideo(ScrnInfoPtr pScrn);
+
+/*In via_utility.c */
+void VIAXVUtilityProc(ScrnInfoPtr pScrn, unsigned char* buf);
+Bool UTGetInfo(VIABIOSInfoPtr pBIOSInfo);
+Bool VIALoadUserSetting(VIABIOSInfoPtr pBIOSInfo);
+Bool VIALoadGammaSetting(VIABIOSInfoPtr pBIOSInfo);
+Bool VIARestoreUserSetting(VIABIOSInfoPtr pBIOSInfo);
+void UTRemoveRestartFlag(VIABIOSInfoPtr pBIOSInfo);
+#endif /* _VIA_DRIVER_H */
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_fs454.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_fs454.h new file mode 100644 index 000000000..775bce74f --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_fs454.h @@ -0,0 +1,160 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_FS454MODETABLE_H
+#define _VIA_FS454MODETABLE_H
+
+VIABIOSFS454TVMASKTableRec fs454MaskTable = {
+ { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0, 0XFF, 0, 0, 0, 0, 0, 0, 0XFF, 0, 0XFF, 0, 0, 0XFF, 0XFF, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF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+ { 0X47, 0XCF, 0XCF, 0X47, 0X9A, 0X23, 0XD9, 0XA, 0X57, 0XDF, 0XDF, 0X57, 0X51, 0XA, 0XFF, 0X3B, 0, 0, 0, 0, 0, 0XB4, 0X68, 0X81, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0X6, 0X2A02, 0X9465, 0X9066, 0X9067, 0X9127, 0X9C2B, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X4, 0X302, 0X4265, 0X4966, 0X4867, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X3, 0X811, 0XC316, 0X4C17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ }
+};
+
+VIABIOSFS454TableRec fs454OverTable[] = {
+ {
+ { 0X1C, 0X40C4, 0X98C5, 0, 0X1, 0X100E, 0XF, 0X92, 0X393, 0XFA0, 0X2A1, 0X100E, 0X40F, 0X100E, 0XF, 0XFF9E, 0XFF9F, 0XA0, 0X3A1, 0X100C, 0X740D, 0X100E, 0X40F, 0X92, 0XB93, 0X8000, 0X1, 0X1802, 0X3, 0, 0, 0 },
+ { 0X70, 0X4F, 0X4F, 0X94, 0X5C, 0X84, 0XB, 0X3E, 0, 0X40, 0, 0, 0, 0, 0, 0, 0XEE, 0, 0XDF, 0, 0, 0XDF, 0XC, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X20, 0X40, 0X80, 0, 0X47, 0X1C, 0, 0 },
+ { 0, 0, 0, 0X47, 0X1C, 0, 0, 0 },
+ { 0XCF, 0X7F, 0X7F, 0XCF, 0X92, 0X22, 0X87, 0XBC, 0X2F, 0XDF, 0XDF, 0X2F, 0X11, 0XA, 0XFF, 0X24, 0, 0, 0, 0, 0, 0X28, 0X50, 0, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XCF, 0X7F, 0X7F, 0XCF, 0X92, 0X22, 0X87, 0XBC, 0X2F, 0XDF, 0XDF, 0X2F, 0X11, 0XA, 0XFF, 0X24, 0, 0, 0, 0, 0, 0X50, 0XA0, 0X40, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XCF, 0X7F, 0X7F, 0XCF, 0X92, 0X22, 0X87, 0XBC, 0X2F, 0XDF, 0XDF, 0X2F, 0X11, 0XA, 0XFF, 0X24, 0, 0, 0, 0, 0, 0XA0, 0X40, 0X81, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0X4, 0X2A02, 0XAD65, 0XA966, 0XA967, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X4, 0X302, 0X4F65, 0X4966, 0X4967, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X3, 0X811, 0XF416, 0X9F17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ {
+ { 0X1C, 0X44C4, 0X98C5, 0, 0X1, 0X100E, 0XF, 0X92, 0X393, 0XFA0, 0X2A1, 0X100E, 0X40F, 0X100E, 0XF, 0XFF9E, 0XFF9F, 0XA0, 0X3A1, 0X100C, 0X740D, 0X100E, 0X40F, 0X92, 0XB93, 0X6000, 0X1, 0X1D02, 0X3, 0, 0, 0 },
+ { 0X79, 0X63, 0X63, 0X9D, 0X6D, 0X95, 0X88, 0XF0, 0, 0X60, 0, 0, 0, 0, 0, 0, 0X58, 0, 0X57, 0, 0, 0X57, 0X89, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X20, 0X40, 0X80, 0, 0X47, 0X1C, 0, 0 },
+ { 0, 0, 0, 0X47, 0X1C, 0, 0, 0 },
+ { 0X37, 0X1F, 0X1F, 0X37, 0XE3, 0X34, 0X4A, 0X8B, 0X98, 0X57, 0X57, 0X98, 0X52, 0X12, 0X59, 0X48, 0, 0, 0, 0, 0, 0X32, 0X64, 0, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0X37, 0X1F, 0X1F, 0X37, 0XE3, 0X34, 0X4A, 0X8B, 0X98, 0X57, 0X57, 0X98, 0X52, 0X12, 0X59, 0X48, 0, 0, 0, 0, 0, 0X64, 0XC8, 0X40, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0X37, 0X1F, 0X1F, 0X37, 0XE3, 0X34, 0X4A, 0X8B, 0X98, 0X57, 0X57, 0X98, 0X52, 0X12, 0X59, 0X48, 0, 0, 0, 0, 0, 0XC8, 0X90, 0X81, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0X4, 0X2A02, 0X9365, 0X9066, 0X9067, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X4, 0X302, 0X4265, 0X4566, 0X4567, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X3, 0X811, 0X1416, 0XC717, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ {
+ { 0X1C, 0X46C4, 0X98C5, 0, 0X1, 0X100E, 0XF, 0X92, 0X393, 0XFA0, 0X2A1, 0X100E, 0X40F, 0X100E, 0XF, 0XFF9E, 0XFF9F, 0XA0, 0X3A1, 0X100C, 0X740D, 0X900E, 0X40F, 0X92, 0XB93, 0X2300, 0X1, 0X2502, 0X3, 0, 0, 0 },
+ { 0X97, 0X7F, 0X7F, 0X9B, 0X89, 0X11, 0X37, 0XF5, 0, 0X60, 0, 0, 0, 0, 0, 0, 0X3, 0, 0XFF, 0, 0, 0XFF, 0X38, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0X40, 0X80, 0X16, 0X47, 0X1C, 0, 0 },
+ { 0, 0, 0, 0X47, 0X1C, 0, 0, 0 },
+ { 0XAF, 0XFF, 0XFF, 0XAF, 0X23, 0X34, 0XC, 0X49, 0X47, 0XFF, 0XFF, 0X47, 0X9A, 0X13, 0X4, 0X7A, 0, 0, 0, 0, 0, 0X40, 0X80, 0, 0, 0, 0X80, 0X20, 0X9C, 0, 0, 0 },
+ { 0XAF, 0XFF,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 0X81, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0X4, 0X2A02, 0XAB65, 0XA766, 0XA767, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X4, 0X302, 0X4D65, 0X4966, 0X4967, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X3, 0X811, 0X1E16, 0X5C17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ }
+};
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_gpioi2c.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_gpioi2c.c new file mode 100644 index 000000000..e87f40add --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_gpioi2c.c @@ -0,0 +1,451 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "via_driver.h"
+#include "via_gpioi2c.h"
+
+void delayIn_usec(int usec);
+void HWGPIOI2C_SetSCL(VIABIOSInfoPtr pBIOSInfo, CARD8 flag);
+void HWGPIOI2C_SetSDA(VIABIOSInfoPtr pBIOSInfo, CARD8 flag);
+CARD8 HWGPIOI2C_GetSDA(VIABIOSInfoPtr pBIOSInfo);
+void GPIOI2C_START(VIABIOSInfoPtr pBIOSInfo);
+void GPIOI2C_STOP(VIABIOSInfoPtr pBIOSInfo);
+Bool GPIOI2C_ACKNOWLEDGE(VIABIOSInfoPtr pBIOSInfo);
+Bool GPIOI2C_SENDACKNOWLEDGE(VIABIOSInfoPtr pBIOSInfo);
+Bool GPIOI2C_SENDNACKNOWLEDGE(VIABIOSInfoPtr pBIOSInfo);
+CARD8 GPIOI2C_ReadData(VIABIOSInfoPtr pBIOSInfo);
+Bool GPIOI2C_WriteData(VIABIOSInfoPtr pBIOSInfo, CARD8 Data);
+void I2C_RW_Control(VIABIOSInfoPtr pBIOSInfo, CARD8 Command, CARD8 Data);
+
+/* I2C Functions */
+
+Bool GPIOI2C_Initial(VIABIOSInfoPtr pBIOSInfo, CARD8 SlaveDevice)
+{
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "GPIOI2C_Initial\n"));
+ switch (pBIOSInfo->Chipset)
+ {
+ case VIA_KM400:
+ case VIA_K8M400:
+ GPIOPORT = 0x2C;
+ break;
+ default:
+ GPIOPORT = 0;
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO,
+ "GPIOI2C initial failure!\n"));
+ return FALSE;
+ }
+/*
+ switch (pBIOSInfo->TVEncoder)
+ {
+ case VIA_VT1623:
+ break;
+ default:
+ SLAVEADDR = 0;
+ return FALSE;
+ }
+*/
+ SLAVEADDR = SlaveDevice;
+
+ return TRUE;
+}
+
+/* I2C R/W Control */
+void I2C_RW_Control(VIABIOSInfoPtr pBIOSInfo, CARD8 Command, CARD8 Data)
+{
+ VIABIOSInfoPtr pVia = pBIOSInfo;
+ CARD8 value;
+
+ switch(Command) {
+ case I2C_RELEASE:
+ VGAOUT8(0x3c4, GPIOPORT);
+ value = VGAIN8(0x3c5) & ~GPIOI2C_MASKD;
+ VGAOUT8(0x3c5, value);
+ break;
+ case I2C_WRITE_SCL:
+ VGAOUT8(0x3c4, GPIOPORT);
+ value = VGAIN8(0x3c5) & ~GPIOI2C_SCL_MASK;
+ VGAOUT8(0x3c5, value);
+ if (Data) {
+ VGAOUT8(0x3c5, (value | GPIOI2C_SCL_WRITE) | I2C_OUTPUT_CLOCK);
+ }
+ else {
+ VGAOUT8(0x3c5, (value | GPIOI2C_SCL_WRITE) | ~I2C_OUTPUT_CLOCK);
+ }
+ break;
+ case I2C_READ_SCL:
+ VGAOUT8(0x3c4, GPIOPORT);
+ value = VGAIN8(0x3c5) & ~GPIOI2C_SCL_MASK;
+ VGAOUT8(0x3c5, value | GPIOI2C_SCL_READ);
+ break;
+ case I2C_WRITE_SDA:
+ VGAOUT8(0x3c4, GPIOPORT);
+ value = VGAIN8(0x3c5) & ~GPIOI2C_SDA_MASK;
+ if (Data) {
+ VGAOUT8(0x3c5, (value | GPIOI2C_SDA_WRITE) | I2C_OUTPUT_DATA);
+ }
+ else {
+ VGAOUT8(0x3c5, (value | GPIOI2C_SDA_WRITE) | ~I2C_OUTPUT_DATA);
+ }
+ break;
+ case I2C_READ_SDA:
+ VGAOUT8(0x3c4, GPIOPORT);
+ value = VGAIN8(0x3c5) & ~GPIOI2C_SDA_MASK;
+ VGAOUT8(0x3c5, value | GPIOI2C_SCL_READ);
+ break;
+ default:
+ break;
+ }
+}
+
+#if 0
+void delayIn_usec(int usec)
+{
+ long b_secs, b_usecs;
+ long a_secs, a_usecs;
+ long d_secs, d_usecs;
+ long diff;
+
+ if (usec > 0) {
+ xf86getsecs(&b_secs, &b_usecs);
+ do {
+ /* It would be nice to use {xf86}usleep,
+ * but usleep (1) takes >10000 usec !
+ */
+ xf86getsecs(&a_secs, &a_usecs);
+ d_secs = (a_secs - b_secs);
+ d_usecs = (a_usecs - b_usecs);
+ diff = d_secs*1000000 + d_usecs;
+ } while (diff>0 && diff< (usec + 1));
+ }
+}
+#endif
+
+/* Set SCL */
+void HWGPIOI2C_SetSCL(VIABIOSInfoPtr pBIOSInfo, CARD8 flag)
+{
+ I2C_RW_Control(pBIOSInfo, I2C_WRITE_SCL, flag);
+ if (flag) usleep(I2C_WAIT_TIME);
+ /* usleep(I2C_WAIT_TIME); */
+}
+
+/* Set SDA */
+void HWGPIOI2C_SetSDA(VIABIOSInfoPtr pBIOSInfo, CARD8 flag)
+{
+ I2C_RW_Control(pBIOSInfo, I2C_WRITE_SDA, flag);
+ usleep(I2C_WAIT_TIME);
+}
+
+/* Get SDA */
+CARD8 HWGPIOI2C_GetSDA(VIABIOSInfoPtr pBIOSInfo)
+{
+ VIABIOSInfoPtr pVia = pBIOSInfo;
+ CARD8 value;
+
+ VGAOUT8(0x3c4, GPIOPORT);
+ value = VGAIN8(0x3c5);
+ if (value & I2C_INPUT_DATA)
+ return 1;
+ else
+ return 0;
+}
+
+/* START Condition */
+void GPIOI2C_START(VIABIOSInfoPtr pBIOSInfo)
+{
+ HWGPIOI2C_SetSDA(pBIOSInfo, 1);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 1);
+ HWGPIOI2C_SetSDA(pBIOSInfo, 0);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 0);
+}
+
+/* STOP Condition */
+void GPIOI2C_STOP(VIABIOSInfoPtr pBIOSInfo)
+{
+ HWGPIOI2C_SetSDA(pBIOSInfo, 0);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 1);
+ HWGPIOI2C_SetSDA(pBIOSInfo, 1);
+ I2C_RW_Control(pBIOSInfo, I2C_RELEASE, 0);
+ /* to make the differentiation of next START condition */
+ usleep(10000);
+}
+
+/* Check ACK */
+Bool GPIOI2C_ACKNOWLEDGE(VIABIOSInfoPtr pBIOSInfo)
+{
+ CARD8 Status;
+
+ I2C_RW_Control(pBIOSInfo, I2C_READ_SDA, 0);
+ usleep(I2C_WAIT_TIME);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 1);
+ Status = HWGPIOI2C_GetSDA(pBIOSInfo);
+ I2C_RW_Control(pBIOSInfo, I2C_WRITE_SDA, Status);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 0);
+ usleep(I2C_WAIT_TIME);
+
+ if(Status) return FALSE;
+ else return TRUE;
+}
+
+/* Send ACK */
+Bool GPIOI2C_SENDACKNOWLEDGE(VIABIOSInfoPtr pBIOSInfo)
+{
+ HWGPIOI2C_SetSDA(pBIOSInfo, 0);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 1);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 0);
+ usleep(I2C_WAIT_TIME);
+
+ return TRUE;
+}
+
+/* Send NACK */
+Bool GPIOI2C_SENDNACKNOWLEDGE(VIABIOSInfoPtr pBIOSInfo)
+{
+ HWGPIOI2C_SetSDA(pBIOSInfo, 1);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 1);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 0);
+ usleep(I2C_WAIT_TIME);
+
+ return TRUE;
+}
+
+/* Read Data(Bit by Bit) from I2C */
+CARD8 GPIOI2C_ReadData(VIABIOSInfoPtr pBIOSInfo)
+{
+ int i;
+ CARD8 Data = 0;
+
+ for(i = 0; i < 8; i++) {
+
+ Data <<= 1;
+ I2C_RW_Control(pBIOSInfo, I2C_READ_SDA, 0);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 1);
+ if (HWGPIOI2C_GetSDA(pBIOSInfo)) Data++;
+ HWGPIOI2C_SetSCL(pBIOSInfo, 0);
+ usleep(I2C_WAIT_TIME);
+ }
+
+ return Data;
+}
+
+/* Write Data(Bit by Bit) to I2C */
+Bool GPIOI2C_WriteData(VIABIOSInfoPtr pBIOSInfo, CARD8 Data)
+{
+ int i;
+ CARD8 d;
+
+ d = Data;
+
+ for(i = 0; i < 8; i++) {
+
+ usleep(I2C_WAIT_TIME/5);
+
+ if((d&0x80)==0x80) HWGPIOI2C_SetSDA(pBIOSInfo, 1);
+ else HWGPIOI2C_SetSDA(pBIOSInfo, 0);
+
+ usleep(I2C_WAIT_TIME/5);
+
+ HWGPIOI2C_SetSCL(pBIOSInfo, 1);
+ HWGPIOI2C_SetSCL(pBIOSInfo, 0);
+ d <<= 1;
+ }
+
+ return GPIOI2C_ACKNOWLEDGE(pBIOSInfo);
+}
+
+/* Write Data(one Byte) to Desired Device on I2C */
+Bool GPIOI2C_Write(VIABIOSInfoPtr pBIOSInfo, int SubAddress, CARD8 Data)
+{
+ int Retry;
+ Bool Done = FALSE;
+
+ for(Retry = 1; Retry <= WRITE_MAX_RETRIES; Retry++)
+ {
+ GPIOI2C_START(pBIOSInfo);
+
+ if(!GPIOI2C_WriteData(pBIOSInfo, SLAVEADDR)) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+
+ if(SubAddress & 0xF00) { /* write 12-bit sub address */
+ if(!GPIOI2C_WriteData(pBIOSInfo, (CARD8)((SubAddress/0x100)&0x0F))) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ if(!GPIOI2C_WriteData(pBIOSInfo, (CARD8)(SubAddress%0x100))) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ } else { /* write 8-bit sub address */
+ if(!GPIOI2C_WriteData(pBIOSInfo, (CARD8)(SubAddress))) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ }
+
+ if(!GPIOI2C_WriteData(pBIOSInfo, Data)) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ Done = TRUE;
+ break;
+ }
+
+ GPIOI2C_STOP(pBIOSInfo);
+
+ return Done;
+}
+
+/* Read Data from Desired Device on I2C */
+Bool GPIOI2C_Read(VIABIOSInfoPtr pBIOSInfo, int SubAddress, CARD8 *Buffer, int BufferLen)
+{
+ int i, Retry;
+
+ for(Retry = 1; Retry <= READ_MAX_RETRIES; Retry++)
+ {
+ GPIOI2C_START(pBIOSInfo);
+ if(!GPIOI2C_WriteData(pBIOSInfo, SLAVEADDR&0xFE)) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+
+ if(SubAddress & 0xF00) { /* write 12-bit sub address */
+ if(!GPIOI2C_WriteData(pBIOSInfo, (CARD8)((SubAddress/0x100)&0x0F))) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ if(!GPIOI2C_WriteData(pBIOSInfo, (CARD8)(SubAddress%0x100))) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ } else { /* write 8-bit sub address */
+ if(!GPIOI2C_WriteData(pBIOSInfo, (CARD8)(SubAddress))) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ }
+
+ break;
+ }
+
+ if (Retry > READ_MAX_RETRIES) return FALSE;
+
+ for(Retry = 1; Retry <= READ_MAX_RETRIES; Retry++)
+ {
+ GPIOI2C_START(pBIOSInfo);
+ if(!GPIOI2C_WriteData(pBIOSInfo, SLAVEADDR | 0x01)) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ for(i = 0; i < BufferLen; i++) {
+
+ *Buffer = GPIOI2C_ReadData(pBIOSInfo);
+ Buffer ++;
+ if(BufferLen == 1)
+ /*GPIOI2C_SENDACKNOWLEDGE(pBIOSInfo);*/ /* send ACK for normal operation */
+ GPIOI2C_SENDNACKNOWLEDGE(pBIOSInfo); /* send NACK for VT3191/VT3192 only */
+ else if(i < BufferLen - 1)
+ GPIOI2C_SENDACKNOWLEDGE(pBIOSInfo); /* send ACK */
+ else
+ GPIOI2C_SENDNACKNOWLEDGE(pBIOSInfo); /* send NACK */
+ }
+ GPIOI2C_STOP(pBIOSInfo);
+ break;
+ }
+
+ if (Retry > READ_MAX_RETRIES)
+ return FALSE;
+ else
+ return TRUE;
+}
+
+/* Read Data(one Byte) from Desired Device on I2C */
+Bool GPIOI2C_ReadByte(VIABIOSInfoPtr pBIOSInfo, int SubAddress, CARD8 *Buffer)
+{
+ int Retry;
+
+ for(Retry = 1; Retry <= READ_MAX_RETRIES; Retry++)
+ {
+ GPIOI2C_START(pBIOSInfo);
+ if(!GPIOI2C_WriteData(pBIOSInfo, SLAVEADDR & 0xFE)) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+
+ if(SubAddress & 0xF00) { /* write 12-bit sub address */
+ if(!GPIOI2C_WriteData(pBIOSInfo, (CARD8)((SubAddress/0x100)&0x0F))) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ if(!GPIOI2C_WriteData(pBIOSInfo, (CARD8)(SubAddress%0x100))) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ } else { /* write 8-bit sub address */
+ if(!GPIOI2C_WriteData(pBIOSInfo, (CARD8)(SubAddress))) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+ }
+
+ break;
+ }
+
+ if (Retry > READ_MAX_RETRIES) return FALSE;
+
+ for(Retry = 1; Retry <= READ_MAX_RETRIES; Retry++) {
+
+ GPIOI2C_START(pBIOSInfo);
+
+ if(!GPIOI2C_WriteData(pBIOSInfo, SLAVEADDR | 0x01)) {
+
+ GPIOI2C_STOP(pBIOSInfo);
+ continue;
+ }
+
+ *Buffer = GPIOI2C_ReadData(pBIOSInfo);
+
+ GPIOI2C_STOP(pBIOSInfo);
+ break;
+ }
+
+ if (Retry > READ_MAX_RETRIES)
+ return FALSE;
+ else
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_gpioi2c.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_gpioi2c.h new file mode 100644 index 000000000..64a58ad62 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_gpioi2c.h @@ -0,0 +1,55 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#define GPIOPORT (pBIOSInfo->GPIOI2CInfo.bGPIOPort)
+#define SLAVEADDR (pBIOSInfo->GPIOI2CInfo.bSlaveAddr)
+
+#define EDID1 0xA0
+#define EDID2 0xA2
+
+#define I2C_WAIT_TIME 100
+
+#define GPIOI2C_MASKD 0xC0
+#define GPIOI2C_SCL_MASK 0x80
+#define GPIOI2C_SCL_WRITE 0x80
+#define GPIOI2C_SCL_READ 0x80
+#define GPIOI2C_SDA_MASK 0x40
+#define GPIOI2C_SDA_WRITE 0x40
+#define GPIOI2C_SDA_READ 0x00
+
+#define I2C_RELEASE 0x00
+#define I2C_WRITE_SCL 0x01
+#define I2C_READ_SCL 0x02
+#define I2C_WRITE_SDA 0x03
+#define I2C_READ_SDA 0x04
+
+#define I2C_SDA_SCL_MASK 0x30
+#define I2C_SDA_SCL 0x30
+#define I2C_OUTPUT_CLOCK 0x20
+#define I2C_OUTPUT_DATA 0x10
+#define I2C_INPUT_CLOCK 0x08
+#define I2C_INPUT_DATA 0x04
+
+#define READ_MAX_RETRIES 20
+#define WRITE_MAX_RETRIES 20
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_i2c.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_i2c.c new file mode 100644 index 000000000..5b97842e2 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_i2c.c @@ -0,0 +1,412 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "compiler.h"
+
+#include "xf86Pci.h"
+#include "xf86PciInfo.h"
+
+#include "vgaHW.h"
+
+#include "via_driver.h"
+
+/*
+ * DDC2 support requires DDC_SDA_MASK and DDC_SCL_MASK
+ */
+#define DDC_SDA_READ_MASK (1 << 2)
+#define DDC_SCL_READ_MASK (1 << 3)
+#define DDC_SDA_WRITE_MASK (1 << 4)
+#define DDC_SCL_WRITE_MASK (1 << 5)
+
+/* I2C Function for DDC2 */
+static void
+VIAI2C1PutBits(I2CBusPtr b, int clock, int data)
+{
+ CARD8 reg;
+
+ outb(0x3c4, 0x26);
+ reg = inb(0x3c5);
+ reg &= 0xF0;
+ reg |= 0x01; /* Enable DDC */
+
+ if (clock)
+ reg |= DDC_SCL_WRITE_MASK;
+ else
+ reg &= ~DDC_SCL_WRITE_MASK;
+
+ if (data)
+ reg |= DDC_SDA_WRITE_MASK;
+ else
+ reg &= ~DDC_SDA_WRITE_MASK;
+
+ outb(0x3c4, 0x26);
+ outb(0x3c5, reg);
+}
+
+static void
+VIAI2C1GetBits(I2CBusPtr b, int *clock, int *data)
+{
+ CARD8 reg;
+
+ outb(0x3c4, 0x26);
+ reg = inb(0x3c5);
+
+ *clock = (reg & DDC_SCL_READ_MASK) != 0;
+ *data = (reg & DDC_SDA_READ_MASK) != 0;
+}
+
+/* Function for DVI DDC2 */
+static void
+VIAI2C2PutBits(I2CBusPtr b, int clock, int data)
+{
+ CARD8 reg;
+
+ outb(0x3c4, 0x31);
+ reg = inb(0x3c5);
+ reg &= 0xF0;
+ reg |= 0x01; /* Enable DDC */
+
+ if (clock)
+ reg |= DDC_SCL_WRITE_MASK;
+ else
+ reg &= ~DDC_SCL_WRITE_MASK;
+
+ if (data)
+ reg |= DDC_SDA_WRITE_MASK;
+ else
+ reg &= ~DDC_SDA_WRITE_MASK;
+
+ outb(0x3c4, 0x31);
+ outb(0x3c5, reg);
+}
+
+static void
+VIAI2C2GetBits(I2CBusPtr b, int *clock, int *data)
+{
+ CARD8 reg;
+
+ outb(0x3c4, 0x31);
+ reg = inb(0x3c5);
+
+ *clock = (reg & DDC_SCL_READ_MASK) != 0;
+ *data = (reg & DDC_SDA_READ_MASK) != 0;
+}
+
+
+Bool
+VIAI2CInit(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ I2CBusPtr I2CPtr1, I2CPtr2;
+
+ I2CPtr1 = xf86CreateI2CBusRec();
+ I2CPtr2 = xf86CreateI2CBusRec();
+ if (!I2CPtr1 || !I2CPtr2)
+ return FALSE;
+
+ I2CPtr1->BusName = "I2C bus 1";
+ I2CPtr1->scrnIndex = pScrn->scrnIndex;
+ I2CPtr1->I2CPutBits = VIAI2C1PutBits;
+ I2CPtr1->I2CGetBits = VIAI2C1GetBits;
+
+ I2CPtr2->BusName = "I2C bus 2";
+ I2CPtr2->scrnIndex = pScrn->scrnIndex;
+ I2CPtr2->I2CPutBits = VIAI2C2PutBits;
+ I2CPtr2->I2CGetBits = VIAI2C2GetBits;
+
+ if (!xf86I2CBusInit(I2CPtr1) || !xf86I2CBusInit(I2CPtr2))
+ return FALSE;
+
+ pVia->I2C_Port1 = I2CPtr1;
+ pVia->I2C_Port2 = I2CPtr2;
+
+ return TRUE;
+}
+
+#ifdef _MY_I2C_
+/*------------------------------------------------
+ I2C Module
+ ------------------------------------------------*/
+
+static int pcI2CIndex = 0x3c4;
+static int pcI2Cport = 0x3c5;
+/*
+static int pcIndexReg = 0x31;
+static int pcSDAReadBack= 0x31;
+*/
+
+static int gSDA=0;
+
+
+#if 0
+static void I2CUDelay(int usec)
+{
+ long b_secs, b_usecs;
+ long a_secs, a_usecs;
+ long d_secs, d_usecs;
+ long diff;
+
+ if (usec > 0) {
+ xf86getsecs(&b_secs, &b_usecs);
+ do {
+ /* It would be nice to use {xf86}usleep,
+ * but usleep (1) takes >10000 usec !
+ */
+ xf86getsecs(&a_secs, &a_usecs);
+ d_secs = (a_secs - b_secs);
+ d_usecs = (a_usecs - b_usecs);
+ diff = d_secs*1000000 + d_usecs;
+ } while (diff>0 && diff< (usec + 1));
+ }
+}
+#endif
+
+/* Enable I2C */
+void I2C_Enable(int pcIndexReg)
+{
+ int tempI2Cdata, Reg3C4H;
+
+ /* save 3c4H */
+ Reg3C4H = inb(pcI2CIndex);
+
+ outb(pcI2CIndex, pcIndexReg);
+ tempI2Cdata = inb(pcI2Cport);
+
+ tempI2Cdata |= 0x01; /* Bit 0:I2C Serial Port Enable */
+ outb(pcI2Cport, tempI2Cdata);
+
+ /* restore 3c4H */
+ outb(pcI2CIndex, Reg3C4H);
+
+} /* I2C_enable */
+
+
+
+/* reverse data */
+long I2C_reverk(register unsigned data)
+{
+ unsigned long rdata = 0;
+ int i;
+
+ for ( i = 0; i < 16 ; i++ ) {
+ rdata |= ( data & 1 ); /* strip off LSBIT */
+ data >>= 1;
+ rdata <<= 1;
+ }
+ return(rdata >> 1);
+
+} /* I2C_reverk */
+
+
+
+/* get an acknowledge back from a slave device */
+int I2C_ack_pc(int pcIndexReg)
+{
+ int ack;
+
+ I2C_regwrit_pc(pcIndexReg, I2C_SDA, 1);
+ I2C_regwrit_pc(pcIndexReg, I2C_SCL, HICLK);
+ ack = I2C_regread_pc(pcIndexReg, I2C_SDA);
+ I2C_regwrit_pc(pcIndexReg, I2C_SCL, LOCLK);
+
+ return (ack);
+
+} /* I2C_ack_pc */
+
+
+
+/* send a start condition */
+void I2C_start_pc(int pcIndexReg)
+{
+ I2C_regwrit_pc(pcIndexReg, I2C_SDA, 1);
+ I2C_regwrit_pc(pcIndexReg, I2C_SCL, HICLK);
+ I2C_regwrit_pc(pcIndexReg, I2C_SDA, 0);
+ I2C_regwrit_pc(pcIndexReg, I2C_SCL, LOCLK);
+
+} /* I2C_start_pc */
+
+
+
+/* send a stop condition */
+void I2C_stop_pc(int pcIndexReg)
+{
+ I2C_regwrit_pc(pcIndexReg, I2C_SDA, 0);
+ I2C_regwrit_pc(pcIndexReg, I2C_SCL, HICLK);
+ I2C_regwrit_pc(pcIndexReg, I2C_SDA, 1);
+
+} /* I2C_stop_pc */
+
+
+
+/* write I2C data */
+int I2C_wdata_pc(int pcIndexReg, unsigned type , unsigned data)
+{
+ int i;
+
+ data = (unsigned int)(I2C_reverk(data) >> 8); /* MSBIT goes out first */
+
+ if ( type == I2C_ADR )
+ I2C_start_pc(pcIndexReg);
+
+ for ( i = 0; i < 8; data >>=1, i++ ) {
+ I2C_regwrit_pc(pcIndexReg, I2C_SDA, data);
+ I2C_regwrit_pc(pcIndexReg, I2C_SCL, HICLK);
+ I2C_regwrit_pc(pcIndexReg, I2C_SCL, LOCLK);
+ }
+
+ return I2C_ack_pc(pcIndexReg); /* wait for acknowledge */
+
+} /* I2C_wdata_pc */
+
+
+/* Write SCL/SDA bit */
+void I2C_regwrit_pc(int pcIndexReg, unsigned type, unsigned data )
+{
+ int tempI2Cdata, Reg3C4H;
+
+ /* save 3c4H */
+ Reg3C4H = inb(pcI2CIndex);
+
+ outb(pcI2CIndex, pcIndexReg);
+ tempI2Cdata = inb(pcI2Cport);
+
+
+ switch (type) {
+ case I2C_SCL:
+ tempI2Cdata &= 0xcf; /* bit5 SPCLCK, bit4 SDATA */
+ tempI2Cdata |= gSDA | ( (data & 1)<< 5);
+ outb(pcI2Cport, tempI2Cdata);
+ break;
+
+ case I2C_SDA:
+ tempI2Cdata &= 0xef;
+ tempI2Cdata |= ( (data & 1) << 4);
+ outb(pcI2Cport, tempI2Cdata);
+
+ gSDA = 0;
+ gSDA = ( (data & 1) << 4);
+
+ break;
+ }
+
+ /* restore 3c4H */
+ outb(pcI2CIndex, Reg3C4H);
+
+} /* I2C_regwrit_pc */
+
+
+
+/* Read SDA bit */
+int I2C_regread_pc(int pcIndexReg, unsigned type)
+{
+ int temp=0,Reg3C4H;
+
+ /* save 3c4H */
+ Reg3C4H = inb(pcI2CIndex);
+
+ switch (type) {
+ case I2C_SCL :
+ break;
+
+ case I2C_SDA:
+ outb(pcI2CIndex, pcIndexReg);
+ temp = ( inb(pcI2Cport) >> 2) & 0x01;
+ break;
+ }
+
+ /* restore 3c4H */
+ outb(pcI2CIndex, Reg3C4H);
+
+ return(temp);
+
+} /* I2C_regread_pc */
+
+
+void I2C_wdata(int pcIndexReg, int addr, int subAddr, int data)
+{
+ int ack = 1;
+
+ ack = I2C_wdata_pc(pcIndexReg, I2C_ADR, addr);
+ ack = I2C_wdata_pc(pcIndexReg, I2C_DAT, subAddr);
+ ack = I2C_wdata_pc(pcIndexReg, I2C_DAT, data);
+
+ I2C_stop_pc(pcIndexReg);
+}
+
+
+int I2C_rdata(int pcIndexReg, int addr, unsigned subAddr)
+{
+ int StatusData =0, data, i;
+
+ I2C_wdata_pc(pcIndexReg, I2C_ADR, addr);
+ I2C_wdata_pc(pcIndexReg, I2C_DAT, subAddr);
+ I2C_stop_pc(pcIndexReg);
+
+ I2C_wdata_pc(pcIndexReg, I2C_ADR, addr+1);
+
+
+ /* pull SDA High */
+ I2C_regwrit_pc(pcIndexReg, I2C_SDA, 1);
+
+ /* Read Register */
+ for ( i = 0; i <= 7 ; i++ ) {
+
+ I2C_regwrit_pc(pcIndexReg, I2C_SCL, HICLK);
+ data = I2C_regread_pc(pcIndexReg, I2C_SDA);
+ I2C_regwrit_pc(pcIndexReg, I2C_SCL, LOCLK);
+
+ data &= 0x01; /* Keep SDA only */
+ StatusData <<= 1;
+ StatusData |= data;
+ }
+
+ I2C_stop_pc(pcIndexReg);
+ return(StatusData);
+}
+
+Bool I2C_Write(int pcIndexReg, int addr, unsigned char *WriteBuffer, int nWrite)
+{
+ int s = 0;
+ int ack = 1;
+
+ ack = I2C_wdata_pc(pcIndexReg, I2C_ADR, addr);
+
+ if (nWrite > 0) {
+ for (; nWrite > 0; WriteBuffer++, nWrite--)
+ ack = I2C_wdata_pc(pcIndexReg, I2C_DAT, *WriteBuffer);
+ s++;
+ }
+ else {
+ I2C_stop_pc(pcIndexReg);
+ return (s);
+ }
+
+ I2C_stop_pc(pcIndexReg);
+ return (s);
+}
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_memmgr.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_memmgr.c new file mode 100644 index 000000000..c09541cf2 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_memmgr.c @@ -0,0 +1,496 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*#include <linux/slab.h> for kmalloc/kfree */
+#include <stdlib.h>
+#include <string.h>
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+
+#include "via_memmgr.h"
+
+/* kernel module global variables */
+ViaOffScrnPtr MemLayOut;
+unsigned long viabase0; /* physical address of frame buffer */
+unsigned long viaBankSize; /* Amount of total frame buffer */
+ /* Set 8MB default,update by Xserver */
+Bool XserverIsUp = FALSE ; /* If Xserver had run(register action) */
+unsigned long S2D_Count = 0;
+unsigned long S3D_Count = 0;
+unsigned long Video_Count = 0;
+
+void PrintFBMem()
+{
+ OffMemRange *used,*unused;
+
+ unused = MemLayOut->unused;
+ used = MemLayOut->used;
+
+ DBG_DD(ErrorF("\n"));
+ DBG_DD(ErrorF("mem.c : Used ID, StartAddr, EndAddr, size, type, this, next\n"));
+ while (used != NULL)
+ {
+ DBG_DD(ErrorF("mem.c : %08lx, %08lx, %08lx, %08lx, %08x, %p, %p \n",
+ used->ID, used->StartAddr, used->EndAddr,used->size, used->type, used, used->next ));
+ used = nextq(used);
+ }
+
+ DBG_DD(ErrorF("\n"));
+ DBG_DD(ErrorF("mem.c : Unused ID, StartAddr, EndAddr, size, type, this, next\n"));
+ while (unused != NULL)
+ {
+ DBG_DD(ErrorF("mem.c : %08lx, %08lx, %08lx, %08lx, %08x, %p, %p \n",
+ unused->ID,unused->StartAddr, unused->EndAddr,unused->size, unused->type,
+ unused, unused->next ));
+ unused = nextq(unused);
+ }
+}
+
+void MergeL(OffMemRange * left , unsigned long size)
+{
+ left->EndAddr = endq(left) + size;
+ left->size = sizeq(left) + size;
+}
+
+void MergeR(OffMemRange * right, unsigned long Addr,unsigned long size)
+{
+ right->StartAddr = Addr;
+ right->size = sizeq(right) + size;
+}
+
+void MergeLR(OffMemRange *left, OffMemRange *right, unsigned long S_Addr,unsigned long size)
+{
+ left->size = sizeq(left) + sizeq(right) + size;
+ left->EndAddr = endq(right);
+ left->next = nextq(right);
+}
+
+OffMemRange * lastq( OffMemRange *qSet )
+{
+ while ( nextq(qSet) != NULL )
+ qSet = nextq(qSet);
+
+ return qSet;
+}
+
+OffMemRange * prevq(OffMemRange *qSet, OffMemRange *curq )
+{
+
+ /* First Queue */
+ if ( qSet == curq )
+ return NULL;
+
+ while ( qSet != NULL ){
+ if ( nextq(qSet ) == curq )
+ return qSet;
+ qSet = nextq(qSet);
+ }
+
+ /* Warnning! Not Found. This should not happen */
+ return NULL;
+}
+
+OffMemRange * numNinq(OffMemRange *qSet, int N )
+{
+ int i=1;
+
+ for ( i=1; i< N; i++ ){
+ qSet = nextq(qSet);
+ if ( qSet == NULL )
+ return NULL;
+ }
+
+ return qSet;
+
+}
+
+void swapq(OffMemRange *qSet ,OffMemRange *L, OffMemRange *R )
+{
+ OffMemRange *tmp, *prevL, *prevR, *nextL, *nextR;
+
+ prevL = prevq(qSet,L);
+ prevR = prevq(qSet,R);
+ nextL = nextq(L);
+ nextR = nextq(R);
+
+ tmp = (OffMemRange *) xalloc(sizeof(OffMemRange));
+ memcpy((void *)tmp,(void *) R ,sizeof(OffMemRange));
+ memcpy((void *)R ,(void *) L ,sizeof(OffMemRange));
+ memcpy((void *)L ,(void *)tmp,sizeof(OffMemRange));
+
+ L->next = nextR;
+ R->next = nextL;
+ if ( prevL != NULL )
+ prevL->next = R;
+ if ( prevR != NULL )
+ prevR->next = L;
+
+ deleteq(tmp);
+}
+
+
+OffMemRange * viaAllocSurface(int *size ,int alignment)
+{
+ int new_size ;
+ unsigned long old_addr;
+ OffMemRange *fq,*sq,*bq=NULL;
+ Bool isFind = FALSE ;
+
+ DBG_DD(ErrorF("mem.c : viaAllocSurface \n"));
+ /* new_size = (*size + alignment - 1) & ~(alignment-1) ;
+ aligap = new_size - *size; */
+ new_size = *size;
+
+ fq = MemLayOut->unused;
+ DBG_DD(ErrorF("mem.c : MemLayOut->unused: %p \n", MemLayOut->unused));
+ bq = fq;
+ while ( fq )
+ {
+ /* we must find the smaller-suitable memory for allocation */
+ if ( (endq(fq) - startq(fq) + 1 ) >= new_size ){
+ isFind = TRUE;
+ break;
+ }
+ bq = fq ;
+ fq = nextq(fq) ;
+ }
+
+ if (!isFind){
+ DBG_DD(ErrorF("mem.c : viaAllocSurface : No surface available\n"));
+ PrintMemLayOut();
+ return NULL ;
+ }
+ else{
+ old_addr = startq(fq);
+ fq->StartAddr = startq(fq) + new_size ;
+ fq->size = sizeq(fq) - new_size;
+
+ /* No memory left in this queue */
+ if (startq(fq) == endq(fq) + 1)
+ {
+ if ( bq == MemLayOut->unused ){
+ fq = nextq(fq);
+ deleteq(MemLayOut->unused);
+ MemLayOut->unused = fq ;
+ }
+ else{
+ bq->next = nextq(fq) ;
+ deleteq(fq);
+ }
+ }
+
+ if (MemLayOut->used == NULL ){
+ MemLayOut->used = xalloc( sizeof( OffMemRange));
+ MemLayOut->used->StartAddr = old_addr;
+ MemLayOut->used->EndAddr = old_addr + new_size - 1;
+ MemLayOut->used->size = new_size;
+ MemLayOut->used->next = NULL ;
+ DBG_DD(ErrorF("mem.c : viaAllocSurface : First Used \n"));
+ PrintMemLayOut();
+ return (MemLayOut->used);
+ }
+
+ sq = MemLayOut->used ;
+
+ while (sq->next !=NULL )
+ sq = nextq(sq);
+ sq->next = xalloc( sizeof( OffMemRange));
+ sq = nextq(sq);
+ sq->next = NULL;
+ sq->StartAddr = old_addr;
+ sq->EndAddr = old_addr + new_size - 1;
+ sq->size = new_size;
+ DBG_DD(ErrorF("mem.c : viaAllocSurface : 2\n"));
+ PrintMemLayOut();
+ return (sq);
+ }
+}
+
+
+Bool viaFreeSurface(unsigned long S_Addr,int size,unsigned char ctype)
+{
+ Bool isFind;
+ OffMemRange *this_free,*fq,*bq;
+ OffMemRange *rightq=NULL,*leftq=NULL;
+ Bool fm = FALSE, bm = FALSE, bRightest=FALSE;
+
+ DBG_DD(ErrorF("mem.c : viaFreeSurface : \n"));
+ isFind = FALSE;
+ this_free = MemLayOut->used;
+ fq = MemLayOut->unused;
+ bq = NULL;
+
+ bq = this_free;
+ /* Find the queue to be deleted */
+ while (this_free != NULL) {
+ if (startq(this_free) == S_Addr && size ==sizeq(this_free) && typeq(this_free) == ctype){
+ /*if (this_free->StartAddr == S_Addr && size ==this_free->size && this_free->type == ctype){*/
+ isFind = TRUE;
+ break;
+ }
+ else
+ {
+ bq = this_free;
+ this_free = nextq(this_free);
+ }
+ }
+
+
+ if ( ! isFind ) {
+ PrintMemLayOut();
+ DBG_DD(ErrorF("mem.c : viaFreeSurface : Warnning! Surface to be freed not found. \n"));
+ return isFind ;
+ }
+
+ /* bq is the first queue in the link list */
+ if (bq == this_free && isFind){
+ MemLayOut->used = nextq(bq) ;
+ deleteq(this_free);
+ /* bq -> this_free */
+ }else if(bq != this_free && isFind) {
+ bq->next = nextq(this_free);
+ deleteq(this_free);
+ }
+
+ DBG_DD(ErrorF("mem.c : viaFreeSurface : 2\n"));
+ /* add the free memory block to unused queue,first we find the
+ "correct" queue to insert */
+
+ /* ====================================================================== */
+ bq = fq; /* where fq is MemLayOut->unused */
+
+
+ while( fq!=NULL )
+ {
+ /* fq -> this_free->nextq(fq) */
+ if ( (endq(fq) == (S_Addr - 1)) && (nextq(fq)->StartAddr == (S_Addr + size)) ){
+ bm = TRUE ;
+ fm = TRUE ;
+ leftq = fq;
+ rightq = nextq(fq);
+ break;
+ }
+
+ /* fq -> this_free */
+ if (endq(fq) == (S_Addr - 1) ){
+ bm = TRUE ;
+ leftq = fq;
+ break;
+ }
+
+ /* this_free -> fq */
+ if ( startq(fq) == (S_Addr + size) ) {
+ fm = TRUE ;
+ rightq = fq;
+ break;
+ }
+
+ bq=fq;
+ fq = nextq(fq);
+ }
+
+ DBG_DD(ErrorF("mem.c : viaFreeSurface : 3\n"));
+
+
+ if ( fm && bm ){
+ PrintMemLayOut();
+ DBG_DD(ErrorF("mem.c : viaFreeSurface : MergeLR\n"));
+ MergeLR(leftq, rightq, S_Addr, size);
+ PrintMemLayOut();
+ deleteq(rightq);
+ }
+ else if ( fm ){
+ DBG_DD(ErrorF("mem.c : viaFreeSurface : MergeR\n"));
+ MergeR(rightq ,S_Addr, size);
+ }
+ else if ( bm ) {
+ DBG_DD(ErrorF("mem.c : viaFreeSurface : MergeL\n"));
+ MergeL(leftq ,size);
+ }
+
+ /* Merged and return */
+ if ( fm || bm ){
+ PrintMemLayOut();
+ return isFind ;
+ }
+
+ /* sort it when insert unused queue */
+ fq = MemLayOut->unused;
+ bq = nextq(fq);
+
+ /* fq -> NULL */
+ if ( bq == NULL ){
+ OffMemRange * this_add;
+ this_add = (OffMemRange *)xalloc(sizeof(OffMemRange));
+ this_add->StartAddr = S_Addr;
+ this_add->EndAddr = S_Addr + size -1;
+ this_add->type = ctype;
+ this_add->size = size;
+
+
+ if ( startq(fq) > S_Addr ) {
+ MemLayOut->unused = this_add;
+ this_add->next = fq;
+ }
+ else{
+ fq->next = this_add;
+ this_add->next = NULL;
+ }
+ PrintMemLayOut();
+ return isFind;
+ }
+ /* fq -> bq */
+ else{
+ while (fq != NULL && bq != NULL){
+ if ( (startq(fq) < S_Addr) && (startq(bq) > S_Addr) )
+ break;
+ else {
+ fq = nextq(fq);
+ bq = nextq(bq);
+ }
+ }
+ }
+
+ if ( bq == NULL )
+ bRightest = TRUE;
+
+ if (MemLayOut->unused == NULL) {
+ MemLayOut->unused = xalloc(sizeof(OffMemRange));
+ bq= MemLayOut->unused;
+ bq->next = NULL;
+ }else { /* fq -> bq and bq = NULL*/
+ if ( bRightest ) {
+ bq = xalloc(sizeof(OffMemRange));
+ bq->next = NULL;
+ fq->next = bq;
+ bq->EndAddr = S_Addr+size-1;
+ bq->StartAddr = S_Addr;
+ bq->size = size;
+ }
+ else { /* fq -> bq */
+ OffMemRange * cq;
+ cq = xalloc(sizeof(OffMemRange));
+ fq->next = cq;
+ cq->next = bq;
+ cq->EndAddr = S_Addr+size-1;
+ cq->StartAddr = S_Addr;
+ cq->size = size;
+ }
+ }
+
+
+ PrintMemLayOut();
+ return isFind ;
+ /* ====================================================================== */
+}
+
+
+int viaMgr_vid_ioctl(unsigned int cmd, char *arg)
+{
+ DBG_DD(ErrorF("mem.c: IOCTL : cmd = %08x \n",cmd));
+ switch (cmd){
+
+ case VIAMGR_ALLOC_2D:
+ case VIAMGR_ALLOC_3D:
+ case VIAMGR_ALLOC_VIDEO:
+ {
+ ViaMMReq MMReq;
+ int req_size;
+ OffMemRange *offset;
+
+ memcpy(&MMReq ,(ViaMMReq *)arg,sizeof(ViaMMReq));
+
+ if (MMReq.checkID != VIA_MID)
+ {
+ DBG_DD(ErrorF("mem.c: fail ID code.\n"));
+ return MEM_ERROR;
+ }
+
+ DBG_DD(ErrorF("mem.c: Alloc type = %08x\n",MMReq.type));
+ req_size = MMReq.size;
+ if( (offset=viaAllocSurface(&req_size,0 )) == NULL)
+ return(MEM_ERROR);
+
+
+ switch (MMReq.type) {
+ case VIDMGR_TYPE_2D :
+ offset->ID = S2D_Count;
+ S2D_Count ++;
+ break;
+ case VIDMGR_TYPE_3D :
+ offset->ID = S3D_Count;
+ S3D_Count ++;
+ break;
+ case VIDMGR_TYPE_VIDEO :
+ offset->ID = Video_Count ;
+ Video_Count ++;
+ break;
+ default :
+ DBG_DD(ErrorF("mem.c: Invalid buffer type! \n"));
+ return(MEM_ERROR);
+
+ }
+
+ offset->type = MMReq.type;
+ offset->priority = MMReq.priority;
+ offset->capability = MMReq.capability;
+ MMReq.offset = offset->StartAddr;
+ MMReq.ID = offset->ID;
+ memcpy((ViaMMReq *)arg,&MMReq,sizeof(ViaMMReq));
+
+ return MEM_OK;
+ }
+
+ case VIAMGR_FREE_2D:
+ case VIAMGR_FREE_3D:
+ case VIAMGR_FREE_VIDEO:
+ {
+ ViaMMReq fm ;
+
+ memcpy(&fm ,(ViaMMReq *)arg,sizeof(ViaMMReq));
+ if (fm.checkID != VIA_MID)
+ {
+ DBG_DD(ErrorF("mem.c: fail ID code.\n"));
+ return(MEM_ERROR);
+ }
+ DBG_DD(ErrorF("mem.c: VIAMGR_FREE type = %08x ,size = %lx\n",
+ fm.type,fm.size));
+
+ if(!viaFreeSurface(fm.offset,(int)fm.size,fm.type))
+ {
+ return(MEM_ERROR);
+ }
+ return MEM_OK;
+ }
+
+ default :
+ DBG_DD(ErrorF("mem.c: Invalid ioctl cmd! \n"));
+ return(MEM_ERROR);
+ } /* end of switch */
+
+
+ return MEM_OK;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_memmgr.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_memmgr.h new file mode 100644 index 000000000..6c130f581 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_memmgr.h @@ -0,0 +1,138 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __LINUX_MEM_H
+#define __LINUX_MEM_H
+
+/*#define XV_DEBUG 1*/ /* write log msg to /var/log/XFree86.0.log */
+
+#ifdef XV_DEBUG
+ #define DBG_DD(x) (x)
+#else
+ #define DBG_DD(x)
+#endif
+
+
+struct offrange
+ {
+ unsigned long StartAddr;
+ unsigned long EndAddr;
+ unsigned long size;
+ unsigned char type;
+ unsigned long ID;
+ unsigned char priority;
+ unsigned char capability;
+ unsigned char status;
+ struct offrange * next ;
+ };
+
+typedef struct offrange OffMemRange ;
+
+typedef struct {
+ OffMemRange *unused;
+ OffMemRange *used;
+ } ViaOffScrnRec, *ViaOffScrnPtr;
+
+/* user-app use */
+
+typedef struct {
+ unsigned long size;
+ unsigned long offset;
+ unsigned long checkID;
+ unsigned long ID;
+ unsigned char type;
+ unsigned char priority;
+ unsigned char capability;
+ unsigned char alignment;
+ unsigned char num;
+
+ } ViaMMReq;
+
+typedef struct {
+ unsigned long StartAddr;
+ unsigned long size;
+ unsigned long ID;
+ unsigned char type;
+ unsigned char priority;
+ unsigned char capability;
+ } ViaMMInfo;
+
+/* Xserver Sync Protocol */
+typedef struct {
+ unsigned long BeginAddr;
+ unsigned long EndAddr;
+ } XserverSyncK;
+/*
+typedef unsigned int Bool;
+#define FALSE 0
+#define TRUE 1;
+*/
+#define VIA_MID 0x00004567
+
+/* memory type */
+#define VIDMGR_TYPE_2D 0x11
+#define VIDMGR_TYPE_3D 0x12
+#define VIDMGR_TYPE_VIDEO 0x13
+
+/* memory priority */
+#define VIDMGR_PRI_LOW 0x21
+#define VIDMGR_PRI_NORM 0x22
+#define VIDMGR_PRI_HIGHT 0x23
+
+/* memory capability */
+#define VIDMGR_CAP_MOVABLE 0x31
+#define VIDMGR_CAP_IMMOVABLE 0x32
+
+/* memory return value */
+#define MEM_OK 0
+#define MEM_ERROR -1
+
+
+/* memory macro functions */
+#define nextq(x) x->next
+#define sizeq(x) x->size
+#define endq(x) x->EndAddr
+#define startq(x) x->StartAddr
+#define deleteq(x) free(x)
+#define typeq(x) x->type
+
+#define VIAMGR_INFO_2D 0x00004001
+#define VIAMGR_INFO_3D 0x00004002
+#define VIAMGR_INFO_VIDEO 0x00004003
+#define VIAMGR_ALLOC_2D 0x00004004
+#define VIAMGR_ALLOC_3D 0x00004005
+#define VIAMGR_ALLOC_VIDEO 0x00004006
+#define VIAMGR_FREE_2D 0x00004007
+#define VIAMGR_FREE_3D 0x00004008
+#define VIAMGR_FREE_VIDEO 0x00004009
+
+
+void PrintFBMem(void);
+OffMemRange * viaAllocSurface(int *size ,int alignment);
+Bool viaFreeSurface(unsigned long S_Addr,int size,unsigned char ctype);
+int viaMgr_vid_ioctl(unsigned int cmd, char *arg);
+
+#define PrintMemLayOut PrintFBMem
+
+#endif /* end of LINUX_MEM_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_mode.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_mode.h new file mode 100644 index 000000000..9f03eeab8 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_mode.h @@ -0,0 +1,868 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_MODETABLE_H
+#define _VIA_MODETABLE_H
+
+unsigned short BIOSVer = 0X10A;
+
+char BIOSDate[] = { 0X30, 0X32, 0X2F, 0X32, 0X37, 0X2F, 0X30, 0X33, 0 };
+
+unsigned short NumModes = 97;
+
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XE0, 0X3, 0XDF, 0X2, 0, 0, 0 } },
+ { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
+ },
+ {
+ { 75, 0X8653, { 0X7F, 0X63, 0X83, 0X66, 0X10, 0X6F, 0XF0, 0X58, 0XB, 0X57, 0X70, 0, 0, 0 } },
+ { 85, 0X47B7, { 0X7E, 0X63, 0X82, 0X68, 0X10, 0X75, 0XF0, 0X58, 0XB, 0X57, 0X76, 0, 0, 0 } },
+ { 100, 0X413, { 0X81, 0X63, 0X85, 0X6A, 0X15, 0X7A, 0XF0, 0X58, 0XB, 0X57, 0X7B, 0, 0, 0 } },
+ { 120, 0X729, { 0X83, 0X63, 0X87, 0X6B, 0X16, 0X81, 0XF0, 0X58, 0XB, 0X57, 0X82, 0, 0, 0 } },
+ { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
+ },
+ {
+ { 75, 0X4321, { 0X9F, 0X7F, 0X83, 0X82, 0X8E, 0X1E, 0XF5, 0, 0X3, 0XFF, 0X1F, 0, 0, 0 } },
+ { 85, 0X521, { 0XA7, 0X7F, 0X8B, 0X86, 0X92, 0X26, 0XF5, 0, 0X3, 0XFF, 0X27, 0, 0, 0 } },
+ { 100, 0X465F, { 0XA9, 0X7F, 0XD, 0X89, 0X97, 0X2C, 0XF5, 0, 0X3, 0XFF, 0X2D, 0, 0, 0 } },
+ { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
+ },
+ {
+ { 75, 0X47EA, { 0XC3, 0X8F, 0X87, 0X98, 0X8, 0X82, 0XFF, 0X60, 0X3, 0X5F, 0X83, 0, 0, 0 } },
+ { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { 0, 0, { 0, 0, 0, 0, 0, 0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0X64, 0, 0 }, 2 },
+ { 1, { 0XD4, 0XD4, 0XD4, 0 }, { 0X91, 0X91, 0X91, 0 }, { 0X10, 0X8, 0X6, 0 }, { 0X10, 0X8, 0X6, 0 }, { 0X19, 0X1FE, 0X1, 0 }, 3 },
+ { 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 },
+ { 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }
+};
+
+VIALCDPowerSeqRec powerOff[] = {
+ { 0, { 0XD4, 0, 0, 0 }, { 0X91, 0, 0, 0 }, { 0X18, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0X1, 0, 0, 0 }, 1 },
+ { 1, { 0XD4, 0XD4, 0XD4, 0 }, { 0X91, 0X91, 0X91, 0 }, { 0X6, 0X8, 0X10, 0 }, { 0, 0, 0, 0 }, { 0XD2, 0X19, 0X1, 0 }, 3 },
+ { 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 },
+ { 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }
+};
+
+VIALCDModeFixRec modeFix = {
+ { 0X1, 0X3, 0X7, 0X5, 0X2E, 0X2F, 0X52, 0X53, 0X56, 0X57, 0X5A, 0X5B, 0X67, 0X68, 0X5D, 0X5E, 0X7D, 0X7E, 0X23, 0X24, 0X26, 0X27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0X2, 0X2, 0X4, 0X30, 0X30, 0X50, 0X50, 0X54, 0X54, 0X58, 0X58, 0X66, 0X66, 0X5C, 0X5C, 0X7C, 0X7C, 0X22, 0X22, 0X25, 0X25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 22 };
+
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_privIoctl.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_privIoctl.h new file mode 100644 index 000000000..11978ca91 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_privIoctl.h @@ -0,0 +1,76 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __via_privIoctl_h
+#define __via_privIoctl_h
+
+/* #include <linux/videodev.h> */
+#include <asm/ioctl.h>
+
+#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
+
+typedef struct {
+ unsigned long dwWidth; /* On screen Width */
+ unsigned long dwHeight; /* On screen Height */
+ unsigned long dwBPP; /* Bits Per Pixel */
+ unsigned long dwPitch; /* On screen pitch= width x BPP */
+ unsigned long dwRefreshRate; /* Refresh rate of the mode */
+ unsigned long TotalVRAM; /* Total Video RAM in unit of byte */
+ unsigned long VideoHeapBase; /* Physical Start of video heap */
+ unsigned long VideoHeapEnd; /* Physical End of video heap */
+ unsigned long dwDVIOn; /* Is it DVI simultaneous mode ? */
+ unsigned long dwExpand; /* Is DVI in expand mode ? */
+ unsigned long dwPanelWidth; /* Panel physical Width */
+ unsigned long dwPanelHeight; /* Panel physical Height */
+ unsigned long Cap0_Deinterlace; /* Capture 0 deintrlace mode */
+ unsigned long Cap1_Deinterlace; /* Capture 1 deintrlace mode */
+ unsigned long Cap0_FieldSwap; /* Capture 0 input field swap */
+ Bool DRMEnabled; /* kernel module DRM flag */
+ Bool HasSecondary; /* True: XServer in SAMM mode */
+ Bool IsSecondary; /* True: In SAMM mode 2nd display */
+ Bool Screen1IsLeft; /* True: Screen1 LeftOf Screen0 ; False: Screen1 RightOf Screen0 */
+ Bool Screen1IsAbove; /* True: Screen1 Above Screen0 ; False: Screen1 Below Screen0 */
+ int RevisionID; /* The chip revision ID */
+}VIAGRAPHICINFO, * LPVIAGRAPHICINFO;
+
+
+/* via private ioctls */
+
+#define VIAMGR_INFO_XSERVERON _IOW ('v', BASE_VIDIOCPRIVATE+1, VIAGRAPHICINFO)
+#define VIAMGR_INFO_XSERVEROFF _IO ('v', BASE_VIDIOCPRIVATE+2 )
+#define VIA_VID_GET_2D_INFO _IOR ('v', BASE_VIDIOCPRIVATE+3, VIAGRAPHICINFO)
+#define VIA_VID_SET_2D_INFO _IOW ('v', BASE_VIDIOCPRIVATE+4, VIAGRAPHICINFO)
+#define VIA_VID_GET_VIDCTL _IOR ('v', BASE_VIDIOCPRIVATE+5, VIAVIDCTRL)
+#define VIA_VID_SET_VIDCTL _IOW ('v', BASE_VIDIOCPRIVATE+6, VIAVIDCTRL)
+#define VIA_VID_CREATESURFACE _IOW ('v', BASE_VIDIOCPRIVATE+7, DDSURFACEDESC)
+#define VIA_VID_DESTROYSURFACE _IOW ('v', BASE_VIDIOCPRIVATE+8, DDSURFACEDESC)
+#define VIA_VID_LOCKSURFACE _IOWR ('v', BASE_VIDIOCPRIVATE+9, DDLOCK)
+#define VIA_VID_UPDATEOVERLAY _IOW ('v', BASE_VIDIOCPRIVATE+10, DDUPDATEOVERLAY)
+#define VIA_VID_SETALPHAWIN _IOW ('v', BASE_VIDIOCPRIVATE+11, ALPHACTRL)
+#define VIA_VID_UPDATEALPHA _IOW ('v', BASE_VIDIOCPRIVATE+12, RECTL)
+#define VIA_VID_ADJUSTFRAME _IOW ('v', BASE_VIDIOCPRIVATE+13, ADJUSTFRAME)
+#define VIA_VID_FLIP _IOW ('v', BASE_VIDIOCPRIVATE+14, unsigned long)
+
+
+#endif /* end of __via_privIoctl_h */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_refresh.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_refresh.h new file mode 100644 index 000000000..a7bbb8559 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_refresh.h @@ -0,0 +1,485 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_REFRESH_H
+#define _VIA_REFRESH_H
+
+ int supportRef[] = { 60, 75, 85, 100, 120 };
+ int DDR266[3][17][5] = {
+ /* 8 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 1 },
+ /* 1024x768 */
+ { 1, 1, 1, 1, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 1, 0, 0 },
+ /* 1600x1200 */
+ { 1, 1, 1, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ },
+ /* 16 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 1 },
+ /* 1024x768 */
+ { 1, 1, 1, 1, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 1, 0, 0 },
+ /* 1600x1200 */
+ { 1, 1, 1, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ },
+ /* 24, 32 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 0 },
+ /* 1024x768 */
+ { 1, 1, 1, 0, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 1, 0, 0 },
+ /* 1600x1200 */
+ { 1, 0, 0, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ }
+ };
+
+ int DDR200[3][17][5] = {
+ /* 8 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 1 },
+ /* 1024x768 */
+ { 1, 1, 1, 1, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 1, 0, 0 },
+ /* 1600x1200 */
+ { 1, 1, 1, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ },
+ /* 16 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 1 },
+ /* 1024x768 */
+ { 1, 1, 1, 1, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 1, 0, 0 },
+ /* 1600x1200 */
+ { 1, 1, 1, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ },
+ /* 24, 32 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 0 },
+ /* 1024x768 */
+ { 1, 1, 1, 0, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 0, 0, 0 },
+ /* 1600x1200 */
+ { 0, 0, 0, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ }
+ };
+
+ int SDR133[3][17][5] = {
+ /* 8 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 1 },
+ /* 1024x768 */
+ { 1, 1, 1, 1, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 1, 0, 0 },
+ /* 1600x1200 */
+ { 1, 1, 1, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ },
+ /* 16 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 1 },
+ /* 1024x768 */
+ { 1, 1, 1, 1, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 1, 0, 0 },
+ /* 1600x1200 */
+ { 1, 1, 1, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ },
+ /* 24, 32 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 0 },
+ /* 1024x768 */
+ { 1, 1, 1, 0, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 0, 0, 0 },
+ /* 1600x1200 */
+ { 0, 0, 0, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ }
+ };
+
+ int SDR100[3][17][5] = {
+ /* 8 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 1 },
+ /* 1024x768 */
+ { 1, 1, 1, 1, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 1, 0, 0 },
+ /* 1600x1200 */
+ { 1, 1, 1, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ },
+ /* 16 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 1 },
+ /* 1024x768 */
+ { 1, 1, 1, 1, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 1, 1, 0, 0 },
+ /* 1600x1200 */
+ { 1, 1, 1, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ },
+ /* 24, 32 bpp */
+ {
+ /* 640x480 */
+ { 1, 1, 1, 1, 1 },
+ /* 800x600 */
+ { 1, 1, 1, 1, 0 },
+ /* 1024x768 */
+ { 1, 1, 1, 0, 0 },
+ /* 1152x864 */
+ { 1, 1, 0, 0, 0 },
+ /* 1280x1024 */
+ { 1, 0, 0, 0, 0 },
+ /* 1600x1200 */
+ { 0, 0, 0, 0, 0 },
+ /* 1440x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x768 */
+ { 1, 0, 0, 0, 0 },
+ /* 1280x960 */
+ { 1, 0, 0, 0, 0 },
+ /* 1920x1440 */
+ { 0, 0, 0, 0, 0 },
+ /* 848x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1400x1050 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 720x576 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x512 */
+ { 1, 0, 0, 0, 0 },
+ /* 856x480 */
+ { 1, 0, 0, 0, 0 },
+ /* 1024x576 */
+ { 1, 1, 1, 0, 0 }
+ }
+ };
+
+#endif /* _VIA_REFRESH_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_regs.h new file mode 100644 index 000000000..6e01fc771 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_regs.h @@ -0,0 +1,211 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*************************************************************************
+ *
+ * File: via_regs.c
+ * Content: The defines of Via registers
+ *
+ ************************************************************************/
+
+#ifndef _VIA_REGS_H
+#define _VIA_REGS_H
+
+#include "via_driver.h"
+
+#define VIA_SERIES(chip) (chip == VIA_CLE266)
+
+
+/* Chip tags. These are used to group the adapters into
+ * related families.
+ */
+
+enum VIACHIPTAGS {
+ VIA_UNKNOWN = 0,
+ VIA_CLE266,
+ VIA_KM400,
+ VIA_K8M400,
+ VIA_LAST
+};
+
+
+#define PCI_VIA_VENDOR_ID 0x1106
+
+#define PCI_CHIP_CLE3122 0x3122
+#define PCI_CHIP_CLE3022 0x3022
+#define PCI_CHIP_VT3205 0x3205
+#define PCI_CHIP_VT7205 0x7205
+#define PCI_CHIP_VT3204 0x3204
+#define PCI_CHIP_VT7204 0x7204
+
+
+#define BIOS_BSIZE 1024
+#define BIOS_BASE 0xc0000
+
+
+#define VIA_MMIO_REGSIZE 0x9000
+#define VIA_MMIO_REGBASE 0x0
+#define VIA_MMIO_VGABASE 0x8000
+#define VIA_MMIO_BLTBASE 0x200000
+#define VIA_MMIO_BLTSIZE 0x10000
+
+
+/* defines for VIA 2D registers */
+#define VIA_REG_GECMD 0x000
+#define VIA_REG_GEMODE 0x004
+#define VIA_REG_GESTATUS 0x004 /* as same as VIA_REG_GEMODE */
+#define VIA_REG_SRCPOS 0x008
+#define VIA_REG_DSTPOS 0x00C
+#define VIA_REG_LINE_K1K2 0x008
+#define VIA_REG_LINE_XY 0x00C
+#define VIA_REG_DIMENSION 0x010 /* width and height */
+#define VIA_REG_PATADDR 0x014
+#define VIA_REG_FGCOLOR 0x018
+#define VIA_REG_DSTCOLORKEY 0x018 /* as same as VIA_REG_FG */
+#define VIA_REG_BGCOLOR 0x01C
+#define VIA_REG_SRCCOLORKEY 0x01C /* as same as VIA_REG_BG */
+#define VIA_REG_CLIPTL 0x020 /* top and left of clipping */
+#define VIA_REG_CLIPBR 0x024 /* bottom and right of clipping */
+#define VIA_REG_OFFSET 0x028
+#define VIA_REG_LINE_ERROR 0x028
+#define VIA_REG_KEYCONTROL 0x02C /* color key control */
+#define VIA_REG_SRCBASE 0x030
+#define VIA_REG_DSTBASE 0x034
+#define VIA_REG_PITCH 0x038 /* pitch of src and dst */
+#define VIA_REG_MONOPAT0 0x03C
+#define VIA_REG_MONOPAT1 0x040
+#define VIA_REG_COLORPAT 0x100 /* from 0x100 to 0x1ff */
+
+
+
+/* defines for VIA video registers */
+#define VIA_REG_INTERRUPT 0x200
+#define VIA_REG_CRTCSTART 0x214
+
+
+/* defines for VIA HW cursor registers */
+#define VIA_REG_CURSOR_MODE 0x2D0
+#define VIA_REG_CURSOR_POS 0x2D4
+#define VIA_REG_CURSOR_ORG 0x2D8
+#define VIA_REG_CURSOR_BG 0x2DC
+#define VIA_REG_CURSOR_FG 0x2E0
+
+
+/* defines for VIA 3D registers */
+#define VIA_REG_STATUS 0x400
+#define VIA_REG_TRANSET 0x43C
+#define VIA_REG_TRANSPACE 0x440
+
+/* VIA_REG_STATUS(0x400): Engine Status */
+#define VIA_CMD_RGTR_BUSY 0x00000080 /* Command Regulator is busy */
+#define VIA_2D_ENG_BUSY 0x00000001 /* 2D Engine is busy */
+#define VIA_3D_ENG_BUSY 0x00000002 /* 3D Engine is busy */
+#define VIA_VR_QUEUE_BUSY 0x00020000 /* Virtual Queue is busy */
+
+
+/* VIA_REG_GECMD(0x00): 2D Engine Command */
+#define VIA_GEC_NOOP 0x00000000
+#define VIA_GEC_BLT 0x00000001
+#define VIA_GEC_LINE 0x00000005
+
+#define VIA_GEC_SRC_XY 0x00000000
+#define VIA_GEC_SRC_LINEAR 0x00000010
+#define VIA_GEC_DST_XY 0x00000000
+#define VIA_GEC_DST_LINRAT 0x00000020
+
+#define VIA_GEC_SRC_FB 0x00000000
+#define VIA_GEC_SRC_SYS 0x00000040
+#define VIA_GEC_DST_FB 0x00000000
+#define VIA_GEC_DST_SYS 0x00000080
+
+#define VIA_GEC_SRC_MONO 0x00000100 /* source is mono */
+#define VIA_GEC_PAT_MONO 0x00000200 /* pattern is mono */
+
+#define VIA_GEC_MSRC_OPAQUE 0x00000000 /* mono src is opaque */
+#define VIA_GEC_MSRC_TRANS 0x00000400 /* mono src is transparent */
+
+#define VIA_GEC_PAT_FB 0x00000000 /* pattern is in frame buffer */
+#define VIA_GEC_PAT_REG 0x00000800 /* pattern is from reg setting */
+
+#define VIA_GEC_CLIP_DISABLE 0x00000000
+#define VIA_GEC_CLIP_ENABLE 0x00001000
+
+#define VIA_GEC_FIXCOLOR_PAT 0x00002000
+
+#define VIA_GEC_INCX 0x00000000
+#define VIA_GEC_DECY 0x00004000
+#define VIA_GEC_INCY 0x00000000
+#define VIA_GEC_DECX 0x00008000
+
+#define VIA_GEC_MPAT_OPAQUE 0x00000000 /* mono pattern is opaque */
+#define VIA_GEC_MPAT_TRANS 0x00010000 /* mono pattern is transparent */
+
+#define VIA_GEC_MONO_UNPACK 0x00000000
+#define VIA_GEC_MONO_PACK 0x00020000
+#define VIA_GEC_MONO_DWORD 0x00000000
+#define VIA_GEC_MONO_WORD 0x00040000
+#define VIA_GEC_MONO_BYTE 0x00080000
+
+#define VIA_GEC_LASTPIXEL_ON 0x00000000
+#define VIA_GEC_LASTPIXEL_OFF 0x00100000
+#define VIA_GEC_X_MAJOR 0x00000000
+#define VIA_GEC_Y_MAJOR 0x00200000
+#define VIA_GEC_QUICK_START 0x00800000
+
+
+/* VIA_REG_GEMODE(0x04): GE mode */
+#define VIA_GEM_8bpp 0x00000000
+#define VIA_GEM_16bpp 0x00000100
+#define VIA_GEM_32bpp 0x00000300
+
+#define VIA_GEM_640 0x00000000 /* 640*480 */
+#define VIA_GEM_800 0x00000400 /* 800*600 */
+#define VIA_GEM_1024 0x00000800 /* 1024*768 */
+#define VIA_GEM_1280 0x00000C00 /* 1280*1024 */
+#define VIA_GEM_1600 0x00001000 /* 1600*1200 */
+#define VIA_GEM_2048 0x00001400 /* 2048*1536 */
+
+/* VIA_REG_PITCH(0x38): Pitch Setting */
+#define VIA_PITCH_ENABLE 0x80000000
+
+
+#define MAXLOOP 0xffffff
+
+
+#define VerticalRetraceWait() \
+{ \
+ VGAOUT8(vgaCRIndex, 0x17); \
+ if (VGAIN8(vgaCRReg) & 0x80) { \
+ while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \
+ while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x08) ; \
+ while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \
+ } \
+}
+
+
+#define VIASETREG(addr, data) *(volatile unsigned int *)(pVia->MapBase + (addr)) = (data)
+#define VIAGETREG(addr) *(volatile unsigned int *)(pVia->MapBase + (addr))
+
+
+#endif /* _VIA_REGS_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_saa7108.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_saa7108.h new file mode 100644 index 000000000..bbe629b45 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_saa7108.h @@ -0,0 +1,217 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_SAA7108MODETABLE_H
+#define _VIA_SAA7108MODETABLE_H
+
+VIABIOSSAA7108TVMASKTableRec saa7108MaskTable = {
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0X1C, 0, 0 },
+ { 0, 0, 0, 0X47, 0X1C, 0, 0, 0 },
+ { 0XAF, 0X4F, 0X4F, 0XAF, 0XE3, 0X34, 0X66, 0XA, 0XC, 0XDF, 0XDF, 0XC, 0X11, 0XA, 0XE6, 0X2F, 0, 0, 0, 0, 0, 0X35, 0X6A, 0, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XAF, 0X4F, 0X4F, 0XAF, 0XE3, 0X34, 0X66, 0XA, 0XC, 0XDF, 0XDF, 0XC, 0X11, 0XA, 0XE6, 0X2F, 0, 0, 0, 0, 0, 0X6A, 0XD4, 0X40, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XAF, 0X4F, 0X4F, 0XAF, 0XE3, 0X34, 0X66, 0XA, 0XC, 0XDF, 0XDF, 0XC, 0X11, 0XA, 0XE6, 0X2F, 0, 0, 0, 0, 0, 0XD4, 0XA8, 0X81, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X7, 0X43A, 0XB17, 0XB18, 0XB19, 0X38, 0X39, 0X3254, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X6, 0XC3A, 0XB17, 0X1B18, 0XB19, 0X38, 0X39, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ }
+};
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_shadow.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_shadow.c new file mode 100644 index 000000000..beee67c55 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_shadow.c @@ -0,0 +1,275 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "via_driver.h"
+#include "shadowfb.h"
+#include "servermd.h"
+
+
+void
+VIARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int width, height, Bpp, FBPitch;
+ unsigned char *src, *dst;
+
+ Bpp = pScrn->bitsPerPixel >> 3;
+ FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel);
+
+ while (num--) {
+ width = (pbox->x2 - pbox->x1) * Bpp;
+ height = pbox->y2 - pbox->y1;
+ src = pVia->ShadowPtr + (pbox->y1 * pVia->ShadowPitch) +
+ (pbox->x1 * Bpp);
+ dst = pVia->FBStart + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp);
+
+ while (height--) {
+ memcpy(dst, src, width);
+ dst += FBPitch;
+ src += pVia->ShadowPitch;
+ }
+
+ pbox++;
+ }
+}
+
+
+void
+VIAPointerMoved(int index, int x, int y)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ VIAPtr pVia = VIAPTR(pScrn);
+ int newX, newY;
+
+ if (pVia->rotate == 1) {
+ newX = pScrn->pScreen->height - y - 1;
+ newY = x;
+ }
+ else {
+ newX = y;
+ newY = pScrn->pScreen->width - x - 1;
+
+ }
+
+ (*pVia->PointerMoved)(index, newX, newY);
+}
+
+
+void
+VIARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int count, width, height, y1, y2, dstPitch, srcPitch;
+ CARD8 *dstPtr, *srcPtr, *src;
+ CARD32 *dst;
+
+ dstPitch = pScrn->displayWidth;
+ srcPitch = -pVia->rotate * pVia->ShadowPitch;
+
+ while (num--) {
+ width = pbox->x2 - pbox->x1;
+ y1 = pbox->y1 & ~3;
+ y2 = (pbox->y2 + 3) & ~3;
+ height = (y2 - y1) >> 2; /* in dwords */
+
+ if (pVia->rotate == 1) {
+ dstPtr = pVia->FBStart + (pbox->x1 * dstPitch) +
+ pScrn->virtualX - y2;
+ srcPtr = pVia->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1;
+ }
+ else {
+ dstPtr = pVia->FBStart +
+ ((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
+ srcPtr = pVia->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1;
+ }
+
+ while (width--) {
+ src = srcPtr;
+ dst = (CARD32*) dstPtr;
+ count = height;
+
+ while (count--) {
+ *(dst++) = src[0] | (src[srcPitch] << 8) |
+ (src[srcPitch * 2] << 16) |
+ (src[srcPitch * 3] << 24);
+ src += srcPitch * 4;
+ }
+
+ srcPtr += pVia->rotate;
+ dstPtr += dstPitch;
+ }
+
+ pbox++;
+ }
+}
+
+
+void
+VIARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int count, width, height, y1, y2, dstPitch, srcPitch;
+ CARD16 *dstPtr, *srcPtr, *src;
+ CARD32 *dst;
+
+ dstPitch = pScrn->displayWidth;
+ srcPitch = -pVia->rotate * pVia->ShadowPitch >> 1;
+
+ while(num--) {
+ width = pbox->x2 - pbox->x1;
+ y1 = pbox->y1 & ~1;
+ y2 = (pbox->y2 + 1) & ~1;
+ height = (y2 - y1) >> 1; /* in dwords */
+
+ if (pVia->rotate == 1) {
+ dstPtr = (CARD16*)pVia->FBStart +
+ (pbox->x1 * dstPitch) + pScrn->virtualX - y2;
+ srcPtr = (CARD16*)pVia->ShadowPtr +
+ ((1 - y2) * srcPitch) + pbox->x1;
+ }
+ else {
+ dstPtr = (CARD16*)pVia->FBStart +
+ ((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
+ srcPtr = (CARD16*)pVia->ShadowPtr +
+ (y1 * srcPitch) + pbox->x2 - 1;
+ }
+
+ while (width--) {
+ src = srcPtr;
+ dst = (CARD32*)dstPtr;
+ count = height;
+
+ while (count--) {
+ *(dst++) = src[0] | (src[srcPitch] << 16);
+ src += srcPitch * 2;
+ }
+
+ srcPtr += pVia->rotate;
+ dstPtr += dstPitch;
+ }
+
+ pbox++;
+ }
+}
+
+
+/* this one could be faster */
+void
+VIARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int count, width, height, y1, y2, dstPitch, srcPitch;
+ CARD8 *dstPtr, *srcPtr, *src;
+ CARD32 *dst;
+
+ dstPitch = BitmapBytePad(pScrn->displayWidth * 24);
+ srcPitch = -pVia->rotate * pVia->ShadowPitch;
+
+ while (num--) {
+ width = pbox->x2 - pbox->x1;
+ y1 = pbox->y1 & ~3;
+ y2 = (pbox->y2 + 3) & ~3;
+ height = (y2 - y1) >> 2; /* blocks of 3 dwords */
+
+ if (pVia->rotate == 1) {
+ dstPtr = pVia->FBStart +
+ (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3);
+ srcPtr = pVia->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3);
+ }
+ else {
+ dstPtr = pVia->FBStart +
+ ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3);
+ srcPtr = pVia->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3;
+ }
+
+ while (width--) {
+ src = srcPtr;
+ dst = (CARD32*)dstPtr;
+ count = height;
+ while(count--) {
+ dst[0] = src[0] | (src[1] << 8) | (src[2] << 16) |
+ (src[srcPitch] << 24);
+ dst[1] = src[srcPitch + 1] | (src[srcPitch + 2] << 8) |
+ (src[srcPitch * 2] << 16) |
+ (src[(srcPitch * 2) + 1] << 24);
+ dst[2] = src[(srcPitch * 2) + 2] | (src[srcPitch * 3] << 8) |
+ (src[(srcPitch * 3) + 1] << 16) |
+ (src[(srcPitch * 3) + 2] << 24);
+ dst += 3;
+ src += srcPitch * 4;
+ }
+
+ srcPtr += pVia->rotate * 3;
+ dstPtr += dstPitch;
+ }
+
+ pbox++;
+ }
+}
+
+
+void
+VIARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int count, width, height, dstPitch, srcPitch;
+ CARD32 *dstPtr, *srcPtr, *src, *dst;
+
+ dstPitch = pScrn->displayWidth;
+ srcPitch = -pVia->rotate * pVia->ShadowPitch >> 2;
+
+ while (num--) {
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+
+ if (pVia->rotate == 1) {
+ dstPtr = (CARD32*)pVia->FBStart +
+ (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2;
+ srcPtr = (CARD32*)pVia->ShadowPtr +
+ ((1 - pbox->y2) * srcPitch) + pbox->x1;
+ }
+ else {
+ dstPtr = (CARD32*)pVia->FBStart +
+ ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1;
+ srcPtr = (CARD32*)pVia->ShadowPtr +
+ (pbox->y1 * srcPitch) + pbox->x2 - 1;
+ }
+
+ while(width--) {
+ src = srcPtr;
+ dst = dstPtr;
+ count = height;
+
+ while(count--) {
+ *(dst++) = *src;
+ src += srcPitch;
+ }
+
+ srcPtr += pVia->rotate;
+ dstPtr += dstPitch;
+ }
+
+ pbox++;
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_swov.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_swov.c new file mode 100644 index 000000000..88715e059 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_swov.c @@ -0,0 +1,2155 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86fbman.h"
+
+#include "compose.h"
+#include "capture.h"
+#include "via.h"
+#include "ddmpeg.h"
+#include "via_privIoctl.h" /* for VIAGRAPHICINFO & custom ioctl command */
+#include "../../os-support/linux/drm/kernel/drm.h"
+#include "../../os-support/linux/drm/kernel/via_drm.h"
+
+#include "regrec.h"
+#include "ddover.h"
+#include "via_driver.h"
+#include "via_swov.h"
+#include "via_memmgr.h"
+#include "HWDiff.h"
+
+
+/* E X T E R N G L O B A L S ----------------------------------------------*/
+extern VIAGRAPHICINFO gVIAGraphicInfo; /* 2D information */
+
+extern volatile unsigned char * lpVidMEMIO;
+
+extern Bool XserverIsUp; /* If Xserver had run(register action) */
+
+extern unsigned long viaBankSize; /* Amount of total frame buffer */
+
+extern LPVIAVIDCTRL lpVideoControl ;
+
+/* G L O B A L V A R I A B L E S ------------------------------------------*/
+
+unsigned long gdwVideoFlagTV1=0;
+unsigned long gdwVideoFlagSW=0;
+unsigned long gdwVideoFlagMPEG=0;
+unsigned long gdwAlphaEnabled = 0; /* For Alpha blending use*/
+
+/* memory management */
+ViaMMReq SWMemRequest;
+ViaMMReq HQVMemRequest;
+/*ViaMMReq MPEGMemRequest;
+ViaMMReq SUBPMemRequest;*/
+
+/* for DRM memory management */
+#ifdef XF86DRI
+drm_via_mem_t MPEGfbRequest;
+drm_via_mem_t SUBPfbRequest;
+drm_via_mem_t HQVfbRequest;
+drm_via_mem_t TV1fbRequest;
+drm_via_mem_t TV2fbRequest;
+drm_via_mem_t ALPHAfbRequest;
+drm_via_mem_t SWfbRequest;
+drm_via_mem_t drm_SWOV_fb;
+drm_via_mem_t drm_HQV_fb;
+int drm_SWOV_fd;
+int drm_HQV_fd;
+#endif
+
+DDPIXELFORMAT DPFsrc;
+LPDDPIXELFORMAT lpDPFsrc = &DPFsrc;
+DDUPDATEOVERLAY UpdateOverlayBackup; /* For HQVcontrol func use
+ // To save MPEG updateoverlay info.*/
+
+/* device struct */
+SWDEVICE SWDevice;
+SUBDEVICE SUBDevice;
+MPGDEVICE MPGDevice;
+LPMPGDEVICE lpMPGDevice = &MPGDevice;
+OVERLAYRECORD overlayRecordV1;
+
+BoxRec AvailFBArea;
+FBLinearPtr SWOVlinear;
+
+Bool MPEG_ON = FALSE;
+Bool SWVideo_ON = FALSE;
+
+/*To solve the bandwidth issue */
+unsigned long gdwUseExtendedFIFO = 0;
+
+/* For panning mode use */
+static int panning_old_x=0;
+static int panning_old_y=0;
+static int panning_x=0;
+static int panning_y=0;
+
+/*To solve the bandwidth issue */
+unsigned char Save_3C4_16 =0;
+unsigned char Save_3C4_17 =0;
+unsigned char Save_3C4_18 =0;
+
+VIDHWDIFFERENCE VideoHWDifference;
+
+/*************************************************************************
+ Function : VIAVidCreateSurface
+ Create overlay surface depend on FOURCC
+*************************************************************************/
+unsigned long VIAVidCreateSurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC lpDDSurfaceDesc)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ unsigned long dwWidth, dwHeight, dwPitch=0;
+ unsigned long dwBackBufferCount;
+ unsigned long dwRet=PI_OK;
+ unsigned long dwAddr;
+ unsigned long HQVFBSIZE = 0, SWFBSIZE = 0, SWOVFBSIZE = 0;
+ int iCount; /* iCount for clean HQV FB use */
+ unsigned char *lpTmpAddr; /* for clean HQV FB use */
+/* int dwNewHight = 0;*/
+ int depth = 0;/*, DisplayWidth32 = 0; */
+ LPVIDHWDIFFERENCE lpVideoHWDifference = &VideoHWDifference;
+
+
+ DBG_DD(ErrorF("//VIAVidCreateSurface: \n"));
+
+ if ( lpDDSurfaceDesc == NULL )
+ return PI_ERR;
+
+ switch (lpDDSurfaceDesc->dwFourCC)
+ {
+ case FOURCC_YUY2 :
+ lpDPFsrc->dwFlags = DDPF_FOURCC;
+ lpDPFsrc->dwFourCC = FOURCC_YUY2;
+
+ /* init Video status flag*/
+ gdwVideoFlagSW = VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_1_INUSE;
+ /*gdwVideoFlagSW = VIDEO_1_INUSE;*/
+
+/* if (gdwVideoFlagTV1 & VIDEO_HQV_INUSE)
+ {
+ lpNewVidCtrl->dwHighQVDO = VW_HIGHQVDO_OFF;
+ DriverProc( HQVCONTROL , lpNewVidCtrl );
+ }*/
+
+ /*write Color Space Conversion param.*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ VIDOutD(V1_ColorSpaceReg_1, ColorSpaceValue_1_3123C0);
+ VIDOutD(V1_ColorSpaceReg_2, ColorSpaceValue_2_3123C0);
+
+ DBG_DD(ErrorF("00000284 %08x\n",ColorSpaceValue_1_3123C0));
+ DBG_DD(ErrorF("00000288 %08x\n",ColorSpaceValue_2_3123C0));
+ break;
+
+ default :
+ VIDOutD(V1_ColorSpaceReg_2, ColorSpaceValue_2);
+ VIDOutD(V1_ColorSpaceReg_1, ColorSpaceValue_1);
+
+ DBG_DD(ErrorF("00000288 %08x\n",ColorSpaceValue_2));
+ DBG_DD(ErrorF("00000284 %08x\n",ColorSpaceValue_1));
+ break;
+ }
+
+
+ dwBackBufferCount = lpDDSurfaceDesc->dwBackBufferCount;
+ dwWidth = lpDDSurfaceDesc->dwWidth;
+ dwHeight = lpDDSurfaceDesc->dwHeight;
+ dwPitch = ALIGN_TO_32_BYTES(dwWidth)*2;
+ DBG_DD(ErrorF(" srcWidth= %ld \n", dwWidth));
+ DBG_DD(ErrorF(" srcHeight= %ld \n", dwHeight));
+
+ SWFBSIZE = dwPitch*dwHeight; /*YUYV*/
+
+ if (!gVIAGraphicInfo.DRMEnabled)
+ {
+/* dwNewHight = dwHeight<<1;*/
+ depth = (pScrn->bitsPerPixel + 7 ) >> 3;
+/* DisplayWidth32 = ALIGN_TO_32_BYTES(pScrn->displayWidth);*/
+ SWOVFBSIZE = SWFBSIZE << 1;
+
+ if(SWOVlinear)
+ {
+ xf86FreeOffscreenLinear(SWOVlinear);
+ DBG_DD(ErrorF("xfree86 Manager Free Init_SWOVLinear Offscreen Memory Success!!!! \n"));
+ }
+
+ if(!(SWOVlinear = xf86AllocateOffscreenLinear(pScrn->pScreen, SWOVFBSIZE,
+ 32, NULL, NULL, NULL)))
+ {
+ return BadAlloc;
+ }
+
+ dwAddr = SWOVlinear->offset * depth;
+ DBG_DD(ErrorF("SWOV dwAddr = 0x%x!!!! \n",dwAddr));
+ }
+
+#ifdef XF86DRI
+ else
+ {
+ DBG_DD(ErrorF("\n//DRM Device : Allocate SWOV memory!!\n"));
+
+ if((drm_SWOV_fd = drmOpen("via",NULL)) < 0)
+ {
+ ErrorF("DRM Device for via could not be opened.\n");
+ return BadAccess;
+ }
+
+ SWfbRequest.context=1;
+ SWfbRequest.size=SWFBSIZE*2;
+ SWfbRequest.type= VIDEO;
+
+ if ( ioctl( drm_SWOV_fd, DRM_IOCTL_VIA_ALLOCMEM, &SWfbRequest ) )
+ {
+ ErrorF("\n//Cannot allocate SWOV memory use DRM module!\n");
+ return -errno;
+ }
+ dwAddr = SWfbRequest.offset;
+ }
+#endif
+
+ /* fill in the SW buffer with 0x8000 (YUY2-black color) to clear FB buffer*/
+ lpTmpAddr = pVia->FBBase + dwAddr;
+
+ for(iCount=0;iCount<(SWFBSIZE*2);iCount++)
+ {
+ if((iCount%2) == 0)
+ *lpTmpAddr++=0x00;
+ else
+ *lpTmpAddr++=0x80;
+ }
+
+ SWDevice.dwSWPhysicalAddr[0] = dwAddr;
+ SWDevice.lpSWOverlaySurface[0] = pVia->FBBase+dwAddr;
+
+ SWDevice.dwSWPhysicalAddr[1] = SWDevice.dwSWPhysicalAddr[0] + SWFBSIZE;
+ SWDevice.lpSWOverlaySurface[1] = SWDevice.lpSWOverlaySurface[0] + SWFBSIZE;
+
+ DBG_DD(ErrorF("SWDevice.dwSWPhysicalAddr[0] %08lx\n", dwAddr));
+ DBG_DD(ErrorF("SWDevice.dwSWPhysicalAddr[1] %08lx\n", dwAddr + SWFBSIZE));
+
+ SWDevice.gdwSWSrcWidth = dwWidth;
+ SWDevice.gdwSWSrcHeight= dwHeight;
+ SWDevice.dwPitch = dwPitch;
+
+ /* Fill image data in overlay record*/
+ overlayRecordV1.dwV1OriWidth = dwWidth;
+ overlayRecordV1.dwV1OriHeight = dwHeight;
+ overlayRecordV1.dwV1OriPitch = dwPitch;
+if (!(gdwVideoFlagSW & SW_USE_HQV))
+ break;
+
+ case FOURCC_HQVSW :
+ DBG_DD(ErrorF("//Create HQV_SW Surface\n"));
+ dwWidth = SWDevice.gdwSWSrcWidth;
+ dwHeight = SWDevice.gdwSWSrcHeight;
+ dwPitch = SWDevice.dwPitch;
+
+ HQVFBSIZE = dwPitch * dwHeight;
+
+ if (!gVIAGraphicInfo.DRMEnabled)
+ {
+ if(SWOVlinear)
+ {
+ xf86FreeOffscreenLinear(SWOVlinear);
+ DBG_DD(ErrorF("xfree86 Manager Free Init_SWOVLinear Offscreen Memory Success!!!! \n"));
+ }
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /* CLE_C0 */
+ {
+ if(!(SWOVlinear = xf86AllocateOffscreenLinear(pScrn->pScreen, HQVFBSIZE*3,
+ 32, NULL, NULL, NULL)))
+ {
+ return BadAlloc;
+ }
+ }
+ else
+ {
+ if(!(SWOVlinear = xf86AllocateOffscreenLinear(pScrn->pScreen, HQVFBSIZE*2,
+ 32, NULL, NULL, NULL)))
+ {
+ return BadAlloc;
+ }
+ }
+
+
+ dwAddr = SWOVlinear->offset * depth + SWOVFBSIZE;
+ DBG_DD(ErrorF("HQV dwAddr = 0x%x!!!! \n",dwAddr));
+ }
+#ifdef XF86DRI
+ else
+ {
+ DBG_DD(ErrorF("\n//DRM Device : Allocate HQV memory!!\n"));
+
+ if((drm_HQV_fd = drmOpen("via",NULL)) < 0)
+ {
+ ErrorF("DRM Device for via could not be opened.\n");
+ return BadAccess;
+ }
+
+ HQVfbRequest.context=1;
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /* CLE_C0 */
+ HQVfbRequest.size=HQVFBSIZE*3;
+ else
+ HQVfbRequest.size=HQVFBSIZE*2;
+
+ HQVfbRequest.type= VIDEO;
+
+ if ( ioctl( drm_HQV_fd, DRM_IOCTL_VIA_ALLOCMEM, &HQVfbRequest ) )
+ {
+ ErrorF("\n//Cannot allocate HQV memory use DRM module!\n");
+ return -errno;
+ }
+ dwAddr = HQVfbRequest.offset;
+ }
+#endif
+
+ overlayRecordV1.dwHQVAddr[0] = dwAddr;
+ overlayRecordV1.dwHQVAddr[1] = dwAddr + HQVFBSIZE;
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /*CLE_C0*/
+ {
+ overlayRecordV1.dwHQVAddr[2] = overlayRecordV1.dwHQVAddr[1] + HQVFBSIZE;
+
+ if (overlayRecordV1.dwHQVAddr[2] + HQVFBSIZE >=
+ (unsigned long)gVIAGraphicInfo.VideoHeapEnd)
+ {
+ ErrorF("// :Memory not enough for MPEG with HQV\n");
+ return PI_ERR_CANNOT_CREATE_SURFACE;
+ }
+ }
+ else
+ {
+ if (overlayRecordV1.dwHQVAddr[1] + HQVFBSIZE >=
+ (unsigned long)gVIAGraphicInfo.VideoHeapEnd)
+ {
+ DBG_DD(ErrorF("// :Memory not enough for MPEG with HQV\n"));
+ return PI_ERR_CANNOT_CREATE_SURFACE;
+ }
+ }
+
+
+ /* fill in the HQV buffer with 0x8000 (YUY2-black color) to clear HQV buffers*/
+ for(iCount=0;iCount<HQVFBSIZE*2;iCount++)
+ {
+ lpTmpAddr = pVia->FBBase + dwAddr + iCount;
+ if((iCount%2) == 0)
+ *(lpTmpAddr)=0x00;
+ else
+ *(lpTmpAddr)=0x80;
+ }
+
+ VIDOutD(HQV_DST_STARTADDR1,overlayRecordV1.dwHQVAddr[1]);
+ VIDOutD(HQV_DST_STARTADDR0,overlayRecordV1.dwHQVAddr[0]);
+
+ DBG_DD(ErrorF("000003F0 %08lx\n",VIDInD(HQV_DST_STARTADDR1) ));
+ DBG_DD(ErrorF("000003EC %08lx\n",VIDInD(HQV_DST_STARTADDR0) ));
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /*CLE_C0*/
+ {
+ VIDOutD(HQV_DST_STARTADDR2,overlayRecordV1.dwHQVAddr[2]);
+ ErrorF("000003FC %08lx\n",VIDInD(HQV_DST_STARTADDR2) );
+ }
+
+ break;
+
+ case FOURCC_YV12 :
+ DBG_DD(ErrorF(" Create SW YV12 Surface: \n"));
+ lpDPFsrc->dwFlags = DDPF_FOURCC;
+ lpDPFsrc->dwFourCC = FOURCC_YV12;
+
+ /* init Video status flag */
+ gdwVideoFlagSW = VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_1_INUSE;
+ /* gdwVideoFlagSW = VIDEO_1_INUSE; */
+
+ /* if (gdwVideoFlagTV1 & VIDEO_HQV_INUSE) */
+/*
+ if (gdwVideoFlagTV2 & VIDEO_HQV_INUSE)
+ {
+ lpNewVidCtrl->dwHighQVDO = VW_HIGHQVDO_OFF;
+ VIADriverProc( HQVCONTROL , lpNewVidCtrl );
+ }
+*/
+ /* write Color Space Conversion param. */
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ VIDOutD(V1_ColorSpaceReg_1, ColorSpaceValue_1_3123C0);
+ VIDOutD(V1_ColorSpaceReg_2, ColorSpaceValue_2_3123C0);
+
+ DBG_DD(ErrorF("00000284 %08x\n",ColorSpaceValue_1_3123C0));
+ DBG_DD(ErrorF("00000288 %08x\n",ColorSpaceValue_2_3123C0));
+ break;
+
+ default :
+ VIDOutD(V1_ColorSpaceReg_2, ColorSpaceValue_2);
+ VIDOutD(V1_ColorSpaceReg_1, ColorSpaceValue_1);
+
+ DBG_DD(ErrorF("00000288 %08x\n",ColorSpaceValue_2));
+ DBG_DD(ErrorF("00000284 %08x\n",ColorSpaceValue_1));
+ break;
+ }
+
+
+ dwBackBufferCount = lpDDSurfaceDesc->dwBackBufferCount;
+ dwWidth = lpDDSurfaceDesc->dwWidth;
+ dwHeight = lpDDSurfaceDesc->dwHeight;
+ dwPitch = ALIGN_TO_32_BYTES(dwWidth);
+ DBG_DD(ErrorF(" srcWidth= %ld \n", dwWidth));
+ DBG_DD(ErrorF(" srcHeight= %ld \n", dwHeight));
+
+ SWFBSIZE = dwPitch * dwHeight * 1.5; /* 1.5 bytes per pixel */
+
+ if (!gVIAGraphicInfo.DRMEnabled)
+ {
+ depth = (pScrn->bitsPerPixel + 7 ) >> 3;
+ SWOVFBSIZE = SWFBSIZE << 1; /* ( SWOVFBSIZE = SWFBSIZE*2 )*/
+
+ if(SWOVlinear)
+ {
+ xf86FreeOffscreenLinear(SWOVlinear);
+ DBG_DD(ErrorF("xfree86 Manager Free Init_SWOVLinear Offscreen Memory Success!!!! \n"));
+ }
+
+ if(!(SWOVlinear = xf86AllocateOffscreenLinear(pScrn->pScreen, SWOVFBSIZE,
+ 32, NULL, NULL, NULL)))
+ {
+ return BadAlloc;
+ }
+
+ dwAddr = SWOVlinear->offset * depth;
+ DBG_DD(ErrorF("SWOV dwAddr = 0x%x!!!! \n",dwAddr));
+ }
+#ifdef XF86DRI
+ else
+ {
+ DBG_DD(ErrorF("\n//DRM Device : Allocate SWOV memory!!\n"));
+ if((drm_SWOV_fd = drmOpen("via",NULL)) < 0)
+ {
+ ErrorF("DRM Device for via could not be opened.\n");
+ return BadAccess;
+ }
+
+ SWfbRequest.context=1;
+ SWfbRequest.size=SWFBSIZE*2;
+ SWfbRequest.type= VIDEO;
+
+ if ( ioctl( drm_SWOV_fd, DRM_IOCTL_VIA_ALLOCMEM, &SWfbRequest ) )
+ {
+ ErrorF("\n//Cannot allocate SWOV memory use DRM module!\n");
+ return -errno;
+ }
+
+ dwAddr = SWfbRequest.offset;
+ }
+#endif
+
+ /* fill in the SW buffer with 0x8000 (YUY2-black color) to clear FB buffer
+ */
+ lpTmpAddr = pVia->FBBase + dwAddr;
+ for(iCount=0;iCount<(SWFBSIZE*2);iCount++)
+ {
+ if((iCount%2) == 0)
+ *lpTmpAddr++=0x00;
+ else
+ *lpTmpAddr++=0x80;
+ }
+
+ SWDevice.dwSWPhysicalAddr[0] = dwAddr;
+ SWDevice.dwSWCrPhysicalAddr[0] = SWDevice.dwSWPhysicalAddr[0]
+ + (dwPitch*dwHeight);
+ SWDevice.dwSWCbPhysicalAddr[0] = SWDevice.dwSWCrPhysicalAddr[0]
+ + ((dwPitch>>1)*(dwHeight>>1));
+ SWDevice.lpSWOverlaySurface[0] = pVia->FBBase+dwAddr;
+
+ SWDevice.dwSWPhysicalAddr[1] = dwAddr + SWFBSIZE;
+ SWDevice.dwSWCrPhysicalAddr[1] = SWDevice.dwSWPhysicalAddr[1]
+ + (dwPitch*dwHeight);
+ SWDevice.dwSWCbPhysicalAddr[1] = SWDevice.dwSWCrPhysicalAddr[1]
+ + ((dwPitch>>1)*(dwHeight>>1));
+ SWDevice.lpSWOverlaySurface[1] = SWDevice.lpSWOverlaySurface[0] + SWFBSIZE;
+
+ DBG_DD(ErrorF("SWDevice.dwSWPhysicalAddr[0] %08lx\n", dwAddr));
+ DBG_DD(ErrorF("SWDevice.dwSWPhysicalAddr[1] %08lx\n", dwAddr + SWFBSIZE));
+
+ SWDevice.gdwSWSrcWidth = dwWidth;
+ SWDevice.gdwSWSrcHeight= dwHeight;
+ SWDevice.dwPitch = dwPitch;
+
+ /* Fill image data in overlay record */
+ overlayRecordV1.dwV1OriWidth = dwWidth;
+ overlayRecordV1.dwV1OriHeight = dwHeight;
+ overlayRecordV1.dwV1OriPitch = dwPitch;
+/*
+if (!(gdwVideoFlagSW & SW_USE_HQV))
+ break;
+ case FOURCC_HQVSW :
+*/
+ /*
+ * if sw video use HQV dwpitch should changed
+ */
+ DBG_DD(ErrorF("//Create HQV_SW Surface\n"));
+/* lpDPFsrc->dwFourCC = FOURCC_YUY2; */
+ dwWidth = SWDevice.gdwSWSrcWidth;
+ dwHeight = SWDevice.gdwSWSrcHeight;
+ dwPitch = SWDevice.dwPitch;
+
+ HQVFBSIZE = dwPitch * dwHeight * 2;
+
+ if (!gVIAGraphicInfo.DRMEnabled)
+ {
+ if(SWOVlinear)
+ {
+ xf86FreeOffscreenLinear(SWOVlinear);
+ DBG_DD(ErrorF("xfree86 Manager Free Init_SWOVLinear Offscreen Memory Success!!!! \n"));
+ }
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /* CLE_C0 */
+ {
+ if(!(SWOVlinear = xf86AllocateOffscreenLinear(pScrn->pScreen, HQVFBSIZE*3,
+ 32, NULL, NULL, NULL)))
+ {
+ return BadAlloc;
+ }
+ }
+ else
+ {
+ if(!(SWOVlinear = xf86AllocateOffscreenLinear(pScrn->pScreen, HQVFBSIZE*2,
+ 32, NULL, NULL, NULL)))
+ {
+ return BadAlloc;
+ }
+ }
+
+ dwAddr = SWOVlinear->offset * depth + SWOVFBSIZE;
+ DBG_DD(ErrorF("HQV dwAddr = 0x%x!!!! \n",dwAddr));
+ }
+#ifdef XF86DRI
+ else
+ {
+ DBG_DD(ErrorF("\n//DRM Device : Allocate HQV memory!!\n"));
+
+ if((drm_HQV_fd = drmOpen("via",NULL)) < 0)
+ {
+ ErrorF("DRM Device for via could not be opened.\n");
+ return BadAccess;
+ }
+
+ HQVfbRequest.context=1;
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /* CLE_C0 */
+ HQVfbRequest.size=HQVFBSIZE*3;
+ else
+ HQVfbRequest.size=HQVFBSIZE*2;
+
+ HQVfbRequest.type= VIDEO;
+
+ if ( ioctl( drm_HQV_fd, DRM_IOCTL_VIA_ALLOCMEM, &HQVfbRequest ) )
+ {
+ ErrorF("\n//Cannot allocate HQV memory use DRM module!\n");
+ return -errno;
+ }
+ dwAddr = HQVfbRequest.offset;
+ }
+#endif
+
+ overlayRecordV1.dwHQVAddr[0] = dwAddr;
+ overlayRecordV1.dwHQVAddr[1] = dwAddr + HQVFBSIZE;
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /*CLE_C0*/
+ {
+ overlayRecordV1.dwHQVAddr[2] = overlayRecordV1.dwHQVAddr[1] + HQVFBSIZE;
+
+ if (overlayRecordV1.dwHQVAddr[2] + HQVFBSIZE >=
+ (unsigned long)gVIAGraphicInfo.VideoHeapEnd)
+ {
+ ErrorF("// :Memory not enough for MPEG with HQV\n");
+ return PI_ERR_CANNOT_CREATE_SURFACE;
+ }
+ }
+ else
+ {
+ if (overlayRecordV1.dwHQVAddr[1] + HQVFBSIZE >=
+ (unsigned long)gVIAGraphicInfo.VideoHeapEnd)
+ {
+ DBG_DD(ErrorF("// :Memory not enough for MPEG with HQV\n"));
+ return PI_ERR_CANNOT_CREATE_SURFACE;
+ }
+ }
+
+ /* fill in the HQV buffer with 0x8000 (YUY2-black color) to clear HQV buffers
+ */
+ for(iCount=0;iCount<HQVFBSIZE*2;iCount++)
+ {
+ lpTmpAddr = pVia->FBBase + dwAddr + iCount;
+ if((iCount%2) == 0)
+ *(lpTmpAddr)=0x00;
+ else
+ *(lpTmpAddr)=0x80;
+ }
+
+ VIDOutD(HQV_DST_STARTADDR1,overlayRecordV1.dwHQVAddr[1]);
+ VIDOutD(HQV_DST_STARTADDR0,overlayRecordV1.dwHQVAddr[0]);
+
+ DBG_DD(ErrorF("000003F0 %08lx\n",VIDInD(HQV_DST_STARTADDR1) ));
+ DBG_DD(ErrorF("000003EC %08lx\n",VIDInD(HQV_DST_STARTADDR0) ));
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /*CLE_C0*/
+ {
+ VIDOutD(HQV_DST_STARTADDR2,overlayRecordV1.dwHQVAddr[2]);
+ ErrorF("000003FC %08lx\n",VIDInD(HQV_DST_STARTADDR2) );
+ }
+
+ break;
+
+ default :
+ break;
+ }
+
+ return dwRet;
+
+} /*VIAVidCreateSurface*/
+
+/*************************************************************************
+ Function : VIAVidLockSurface
+ Lock Surface
+*************************************************************************/
+unsigned long VIAVidLockSurface(ScrnInfoPtr pScrn, LPDDLOCK lpLock)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ switch (lpLock->dwFourCC)
+ {
+ case FOURCC_YUY2 :
+ case FOURCC_YV12 :
+ lpLock->SWDevice = SWDevice ;
+ lpLock->dwPhysicalBase = pVia->FrameBufferBase;
+
+ }
+
+ return PI_OK;
+
+} /*VIAVidLockSurface*/
+
+/*************************************************************************
+ * Destroy Surface
+*************************************************************************/
+unsigned long VIAVidDestroySurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC lpDDSurfaceDesc)
+{
+/*
+ VIAVIDCTRL NewvidCtrl;
+ LPVIAVIDCTRL lpNewVidCtrl = &NewvidCtrl;
+*/
+
+ DBG_DD(ErrorF("//VIAVidDestroySurface: \n"));
+
+ switch (lpDDSurfaceDesc->dwFourCC)
+ {
+ case FOURCC_YUY2 :
+ lpDPFsrc->dwFlags = 0;
+ lpDPFsrc->dwFourCC = 0;
+ SWMemRequest.checkID = VIA_MID;
+ SWMemRequest.type = VIDMGR_TYPE_VIDEO;
+
+ if (!gVIAGraphicInfo.DRMEnabled)
+ {
+ if(SWOVlinear)
+ {
+ xf86FreeOffscreenLinear(SWOVlinear);
+ SWOVlinear = NULL;
+ }
+
+ }
+#ifdef XF86DRI
+ else
+ {
+ DBG_DD(ErrorF("\n//DRM Device : Free SWOV memory!!\n"));
+
+ if ( ioctl( drm_SWOV_fd, DRM_IOCTL_VIA_FREEMEM, &SWfbRequest ) )
+ {
+ ErrorF("\n//Cannot free SWOV memory use DRM module!\n");
+ return -errno;
+ }
+ drmClose(drm_SWOV_fd);
+ }
+#endif
+
+ if (!(gdwVideoFlagSW & SW_USE_HQV))
+ {
+ gdwVideoFlagSW = 0;
+ break;
+ }
+
+ case FOURCC_HQVSW :
+ HQVMemRequest.checkID = VIA_MID;
+ HQVMemRequest.type = VIDMGR_TYPE_VIDEO;
+
+ if (!gVIAGraphicInfo.DRMEnabled)
+ {
+ if(SWOVlinear)
+ {
+ xf86FreeOffscreenLinear(SWOVlinear);
+ SWOVlinear = NULL;
+ }
+
+ }
+#ifdef XF86DRI
+ else
+ {
+ DBG_DD(ErrorF("\n//DRM Device : Free HQV memory!!\n"));
+
+ if ( ioctl( drm_HQV_fd, DRM_IOCTL_VIA_FREEMEM, &HQVfbRequest ) )
+ {
+ ErrorF("\n//Cannot free HQV memory use DRM module!\n");
+ return -errno;
+ }
+ drmClose(drm_HQV_fd);
+ }
+#endif
+
+ gdwVideoFlagSW = 0;
+/* if (gdwVideoFlagTV1 != 0)
+ {
+ DBG_DD(ErrorF(" Assign HQV to TV1 \n"));
+ lpNewVidCtrl->dwHighQVDO = VW_HIGHQVDO_TV1;
+ DriverProc( HQVCONTROL , lpNewVidCtrl );
+ }
+*/
+ break;
+
+ case FOURCC_YV12 :
+ lpDPFsrc->dwFlags = 0;
+ lpDPFsrc->dwFourCC = 0;
+ SWMemRequest.checkID = VIA_MID;
+ SWMemRequest.type = VIDMGR_TYPE_VIDEO;
+
+ if (!gVIAGraphicInfo.DRMEnabled)
+ {
+ if(SWOVlinear)
+ {
+ xf86FreeOffscreenLinear(SWOVlinear);
+ SWOVlinear = NULL;
+ }
+
+ }
+#ifdef XF86DRI
+ else
+ {
+ DBG_DD(ErrorF("\n//DRM Device : Free SWOV memory!!\n"));
+
+ if ( ioctl( drm_SWOV_fd, DRM_IOCTL_VIA_FREEMEM, &SWfbRequest ) )
+ {
+ ErrorF("\n//Cannot free SWOV memory use DRM module!\n");
+ return -errno;
+ }
+ drmClose(drm_SWOV_fd);
+ }
+#endif
+
+ HQVMemRequest.checkID = VIA_MID;
+ HQVMemRequest.type = VIDMGR_TYPE_VIDEO;
+
+ if (!gVIAGraphicInfo.DRMEnabled)
+ {
+ if(SWOVlinear)
+ {
+ xf86FreeOffscreenLinear(SWOVlinear);
+ SWOVlinear = NULL;
+ }
+
+ }
+#ifdef XF86DRI
+ else
+ {
+ DBG_DD(ErrorF("\n//DRM Device : Free HQV memory!!\n"));
+
+ if ( ioctl( drm_HQV_fd, DRM_IOCTL_VIA_FREEMEM, &HQVfbRequest ) )
+ {
+ ErrorF("\n//Cannot free HQV memory use DRM module!\n");
+ return -errno;
+ }
+ drmClose(drm_HQV_fd);
+ }
+#endif
+
+
+ gdwVideoFlagSW = 0;
+ break;
+ }
+ DBG_DD(ErrorF("\n//VIAVidDestroySurface : OK!!\n"));
+ /*memset(&MPGDevice, 0, sizeof(MPGDevice));*/
+ return PI_OK;
+
+} /*VIAVidDestroySurface*/
+
+
+/****************************************************************************
+ *
+ * Upd_Video()
+ *
+ ***************************************************************************/
+unsigned long Upd_Video(ScrnInfoPtr pScrn, unsigned long dwVideoFlag,unsigned long dwStartAddr,RECTL rSrc,RECTL rDest,unsigned long dwSrcPitch,
+ unsigned long dwOriSrcWidth,unsigned long dwOriSrcHeight,LPDDPIXELFORMAT lpDPFsrc,
+ unsigned long dwDeinterlaceMode,unsigned long dwColorKey,unsigned long dwChromaKey,
+ unsigned long dwKeyLow,unsigned long dwKeyHigh,unsigned long dwChromaLow,unsigned long dwChromaHigh, unsigned long dwFlags)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ unsigned long dwVidCtl=0, dwCompose=(VIDInD(V_COMPOSE_MODE)&~(SELECT_VIDEO_IF_COLOR_KEY|V1_COMMAND_FIRE|V3_COMMAND_FIRE))|V_COMMAND_LOAD_VBI;
+ unsigned long srcWidth, srcHeight,dstWidth,dstHeight;
+ unsigned long zoomCtl=0, miniCtl=0;
+ unsigned long dwHQVCtl=0;
+ unsigned long dwHQVfilterCtl=0,dwHQVminiCtl=0;
+ unsigned long dwHQVzoomflagH=0,dwHQVzoomflagV=0;
+ unsigned long dwHQVsrcWidth=0,dwHQVdstWidth=0;
+ unsigned long dwHQVsrcFetch = 0,dwHQVoffset=0;
+ unsigned long dwOffset=0,dwFetch=0,dwTmp=0;
+ unsigned long dwDisplayCountW=0;
+ LPVIDHWDIFFERENCE lpVideoHWDifference = &VideoHWDifference;
+
+ DBG_DD(ErrorF("// Upd_Video:\n"));
+ DBG_DD(ErrorF("Modified rSrc X (%ld,%ld) Y (%ld,%ld)\n",
+ rSrc.left, rSrc.right,rSrc.top, rSrc.bottom));
+ DBG_DD(ErrorF("Modified rDest X (%ld,%ld) Y (%ld,%ld)\n",
+ rDest.left, rDest.right,rDest.top, rDest.bottom));
+
+ if (dwVideoFlag & VIDEO_SHOW)
+ {
+ overlayRecordV1.dwWidth=dstWidth = rDest.right - rDest.left;
+ overlayRecordV1.dwHeight=dstHeight = rDest.bottom - rDest.top;
+ srcWidth = (unsigned long)rSrc.right - rSrc.left;
+ srcHeight = (unsigned long)rSrc.bottom - rSrc.top;
+ DBG_DD(ErrorF("===srcWidth= %ld \n", srcWidth));
+ DBG_DD(ErrorF("===srcHeight= %ld \n", srcHeight));
+
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ dwVidCtl = (V1_ENABLE|V1_EXPIRE_NUM_F);
+ break;
+
+ default:
+ /* Overlay source format for V1*/
+ if (gdwUseExtendedFIFO)
+ {
+ dwVidCtl = (V1_ENABLE|V1_EXPIRE_NUM_A|V1_FIFO_EXTENDED);
+ }
+ else
+ {
+ dwVidCtl = (V1_ENABLE|V1_EXPIRE_NUM);
+ }
+ break;
+ }
+
+ DDOver_GetV1Format(dwVideoFlag,lpDPFsrc,&dwVidCtl,&dwHQVCtl);
+ DDOver_GetV1Format(dwVideoFlag,lpDPFsrc,&dwVidCtl,&dwHQVCtl);
+ }
+ else
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ dwVidCtl = (V3_ENABLE|V3_EXPIRE_NUM_F);
+ break;
+
+ default:
+ /* Overlay source format for V1*/
+ dwVidCtl = (V3_ENABLE|V3_EXPIRE_NUM);
+ break;
+ }
+
+ DDOver_GetV3Format(dwVideoFlag,lpDPFsrc,&dwVidCtl,&dwHQVCtl);
+ }
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /*CLE_C0*/
+ {
+ /* HQV support 3 HQV buffer */
+ dwHQVCtl &= ~HQV_SW_FLIP;
+ dwHQVCtl |= HQV_TRIPLE_BUFF | HQV_FLIP_STATUS;
+ }
+
+ /* Starting address of source and Source offset*/
+ dwOffset = DDOver_GetSrcStartAddress (dwVideoFlag,rSrc,rDest,dwSrcPitch,lpDPFsrc,&dwHQVoffset );
+ DBG_DD(ErrorF("===dwOffset= 0x%lx \n", dwOffset));
+
+ overlayRecordV1.dwOffset = dwOffset;
+
+ if (lpDPFsrc->dwFourCC == FOURCC_YV12)
+ {
+ YCBCRREC YCbCr;
+ if (dwVideoFlag & VIDEO_HQV_INUSE)
+ {
+ dwHQVsrcWidth=(unsigned long)rSrc.right - rSrc.left;
+ dwHQVdstWidth=(unsigned long)rDest.right - rDest.left;
+ if (dwHQVsrcWidth>dwHQVdstWidth)
+ {
+ dwOffset = dwOffset * dwHQVdstWidth / dwHQVsrcWidth;
+ }
+
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STARTADDR_0, overlayRecordV1.dwHQVAddr[0]+dwOffset);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STARTADDR_1, overlayRecordV1.dwHQVAddr[1]+dwOffset);
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /*CLE_C0*/
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STARTADDR_2, overlayRecordV1.dwHQVAddr[2]+dwOffset);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_STARTADDR_0, overlayRecordV1.dwHQVAddr[0]+dwOffset);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_STARTADDR_1, overlayRecordV1.dwHQVAddr[1]+dwOffset);
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /*CLE_C0*/
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_STARTADDR_2, overlayRecordV1.dwHQVAddr[2]+dwOffset);
+ }
+ YCbCr = DDOVer_GetYCbCrStartAddress(dwVideoFlag,dwStartAddr,overlayRecordV1.dwOffset,overlayRecordV1.dwUVoffset,dwSrcPitch,dwOriSrcHeight);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_SRC_STARTADDR_Y, YCbCr.dwY);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_SRC_STARTADDR_U, YCbCr.dwCR);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_SRC_STARTADDR_V, YCbCr.dwCB);
+ }
+ else
+ {
+ YCbCr = DDOVer_GetYCbCrStartAddress(dwVideoFlag,dwStartAddr,overlayRecordV1.dwOffset,overlayRecordV1.dwUVoffset,dwSrcPitch,dwOriSrcHeight);
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STARTADDR_0, YCbCr.dwY);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STARTADDR_CB0, YCbCr.dwCR);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STARTADDR_CR0, YCbCr.dwCB);
+ }
+ else
+ {
+ DBG_DD(ErrorF("Upd_Video() : We do not support YV12 with V3!\n"));
+ }
+ }
+ }
+ else
+ {
+ if (dwVideoFlag & VIDEO_HQV_INUSE)
+ {
+ dwHQVsrcWidth=(unsigned long)rSrc.right - rSrc.left;
+ dwHQVdstWidth=(unsigned long)rDest.right - rDest.left;
+ if (dwHQVsrcWidth>dwHQVdstWidth)
+ {
+ dwOffset = dwOffset * dwHQVdstWidth / dwHQVsrcWidth;
+ }
+
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STARTADDR_0, overlayRecordV1.dwHQVAddr[0]+dwHQVoffset);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STARTADDR_1, overlayRecordV1.dwHQVAddr[1]+dwHQVoffset);
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /*CLE_C0*/
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STARTADDR_2, overlayRecordV1.dwHQVAddr[2]+dwHQVoffset);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_STARTADDR_0, overlayRecordV1.dwHQVAddr[0]+dwHQVoffset);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_STARTADDR_1, overlayRecordV1.dwHQVAddr[1]+dwHQVoffset);
+
+ if ( lpVideoHWDifference->dwThreeHQVBuffer ) /*CLE_C0*/
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_STARTADDR_2, overlayRecordV1.dwHQVAddr[2]+dwHQVoffset);
+ }
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_SRC_STARTADDR_Y, dwStartAddr);
+ }
+ else
+ {
+ dwStartAddr += dwOffset;
+
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STARTADDR_0, dwStartAddr);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_STARTADDR_0, dwStartAddr);
+ }
+ }
+ }
+
+ dwFetch = DDOver_GetFetch(dwVideoFlag,lpDPFsrc,srcWidth,dstWidth,dwOriSrcWidth,&dwHQVsrcFetch);
+ DBG_DD(ErrorF("===dwFetch= 0x%lx \n", dwFetch));
+/*
+ //For DCT450 test-BOB INTERLEAVE
+ if ( (dwDeinterlaceMode & DDOVER_INTERLEAVED) && (dwDeinterlaceMode & DDOVER_BOB ) )
+ {
+ if (dwVideoFlag & VIDEO_HQV_INUSE)
+ {
+ dwHQVCtl |= HQV_FIELD_2_FRAME|HQV_FRAME_2_FIELD|HQV_DEINTERLACE;
+ }
+ else
+ {
+ dwVidCtl |= (V1_BOB_ENABLE | V1_FRAME_BASE);
+ }
+ }
+ else if (dwDeinterlaceMode & DDOVER_BOB )
+ {
+ if (dwVideoFlag & VIDEO_HQV_INUSE)
+ {
+ //The HQV source data line count should be two times of the original line count
+ dwHQVCtl |= HQV_FIELD_2_FRAME|HQV_DEINTERLACE;
+ }
+ else
+ {
+ dwVidCtl |= V1_BOB_ENABLE;
+ }
+ }
+*/
+ if (dwVideoFlag & VIDEO_HQV_INUSE)
+ {
+ if ( !(dwDeinterlaceMode & DDOVER_INTERLEAVED) && (dwDeinterlaceMode & DDOVER_BOB ) )
+ {
+ if ( lpVideoHWDifference->dwHQVFetchByteUnit ) /* CLE_C0 */
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_SRC_FETCH_LINE, (((dwHQVsrcFetch)-1)<<16)|((dwOriSrcHeight<<1)-1));
+ else
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_SRC_FETCH_LINE, (((dwHQVsrcFetch>>3)-1)<<16)|((dwOriSrcHeight<<1)-1));
+ }
+ else
+ {
+ if ( lpVideoHWDifference->dwHQVFetchByteUnit ) /* CLE_C0 */
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_SRC_FETCH_LINE, (((dwHQVsrcFetch)-1)<<16)|(dwOriSrcHeight-1));
+ else
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_SRC_FETCH_LINE, (((dwHQVsrcFetch>>3)-1)<<16)|(dwOriSrcHeight-1));
+ }
+ if (lpDPFsrc->dwFourCC == FOURCC_YV12)
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STRIDE, dwSrcPitch<<1);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_STRIDE, dwSrcPitch<<1);
+ }
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_SRC_STRIDE, ((dwSrcPitch>>1)<<16)|dwSrcPitch);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_DST_STRIDE, (dwSrcPitch<<1));
+ }
+ else
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STRIDE, dwSrcPitch);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_STRIDE, dwSrcPitch);
+ }
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_SRC_STRIDE, dwSrcPitch);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_DST_STRIDE, dwSrcPitch);
+ }
+
+ }
+ else
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+/* Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STRIDE, dwSrcPitch | (dwSrcPitch <<15) );*/
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_STRIDE, dwSrcPitch );
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_STRIDE, dwSrcPitch | (dwSrcPitch <<15) );
+ }
+ }
+
+ DBG_DD(ErrorF("rSrc X (%ld,%ld) Y (%ld,%ld)\n",
+ rSrc.left, rSrc.right,rSrc.top, rSrc.bottom));
+ DBG_DD(ErrorF("rDest X (%ld,%ld) Y (%ld,%ld)\n",
+ rDest.left, rDest.right,rDest.top, rDest.bottom));
+
+ /* Destination window key*/
+
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ /*modify for HW DVI limitation,
+ //When we enable the CRT and DVI both, then change resolution.
+ //If the resolution small than the panel physical size, the video display in Y direction will be cut.
+ //So, we need to adjust the Y top and bottom position. */
+ if ((gVIAGraphicInfo.dwDVIOn)&&(gVIAGraphicInfo.dwExpand))
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_WIN_END_Y,
+ ((rDest.right-1)<<16) + (rDest.bottom*(gVIAGraphicInfo.dwPanelHeight)/gVIAGraphicInfo.dwHeight));
+ if (rDest.top > 0)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_WIN_START_Y,
+ (rDest.left<<16) + (rDest.top*(gVIAGraphicInfo.dwPanelHeight)/gVIAGraphicInfo.dwHeight));
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_WIN_START_Y,(rDest.left<<16));
+ }
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_WIN_END_Y, ((rDest.right-1)<<16) + (rDest.bottom-1));
+ if (rDest.top > 0)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_WIN_START_Y, (rDest.left<<16) + rDest.top );
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_WIN_START_Y, (rDest.left<<16));
+ }
+ }
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_WIN_END_Y, ((rDest.right-1)<<16) + (rDest.bottom-1));
+ if (rDest.top > 0)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_WIN_START_Y, (rDest.left<<16) + rDest.top );
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_WIN_START_Y, (rDest.left<<16));
+ }
+ }
+
+ dwCompose |= ALWAYS_SELECT_VIDEO;
+
+
+ /* Setup X zoom factor*/
+ overlayRecordV1.dwFetchAlignment = 0;
+
+ if ( DDOVER_HQVCalcZoomWidth(dwVideoFlag, srcWidth , dstWidth,
+ &zoomCtl, &miniCtl, &dwHQVfilterCtl, &dwHQVminiCtl,&dwHQVzoomflagH) == PI_ERR )
+ {
+ /* too small to handle*/
+ dwFetch <<= 20;
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V12_QWORD_PER_LINE, dwFetch);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_COMPOSE_MODE , dwCompose|V1_COMMAND_FIRE );
+ }
+ else
+ {
+ dwFetch |=(VIDInD(V3_ALPHA_QWORD_PER_LINE)&(~V3_FETCH_COUNT));
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_ALPHA_QWORD_PER_LINE, dwFetch);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_COMPOSE_MODE , dwCompose|V3_COMMAND_FIRE );
+
+ }
+ Macro_VidREGFlush();
+ return PI_ERR;
+ }
+
+ dwFetch <<= 20;
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V12_QWORD_PER_LINE, dwFetch);
+ }
+ else
+ {
+ dwFetch |=(VIDInD(V3_ALPHA_QWORD_PER_LINE)&(~V3_FETCH_COUNT));
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V3_ALPHA_QWORD_PER_LINE, dwFetch);
+ }
+
+ /*
+ // Setup Y zoom factor
+ */
+
+ /*For DCT450 test-BOB INTERLEAVE*/
+ if ( (dwDeinterlaceMode & DDOVER_INTERLEAVED) && (dwDeinterlaceMode & DDOVER_BOB))
+ {
+ if (!(dwVideoFlag & VIDEO_HQV_INUSE))
+ {
+ srcHeight /=2;
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ dwVidCtl |= (V1_BOB_ENABLE | V1_FRAME_BASE);
+ }
+ else
+ {
+ dwVidCtl |= (V3_BOB_ENABLE | V3_FRAME_BASE);
+ }
+ }
+ else
+ {
+ dwHQVCtl |= HQV_FIELD_2_FRAME|HQV_FRAME_2_FIELD|HQV_DEINTERLACE;
+ }
+ }
+ else if (dwDeinterlaceMode & DDOVER_BOB )
+ {
+ if (dwVideoFlag & VIDEO_HQV_INUSE)
+ {
+ srcHeight <<=1;
+ dwHQVCtl |= HQV_FIELD_2_FRAME|HQV_DEINTERLACE;
+ }
+ else
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ dwVidCtl |= V1_BOB_ENABLE;
+ }
+ else
+ {
+ dwVidCtl |= V3_BOB_ENABLE;
+ }
+ }
+ }
+
+ DDOver_GetDisplayCount(dwVideoFlag,lpDPFsrc,srcWidth,&dwDisplayCountW);
+
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V1_SOURCE_HEIGHT, (srcHeight<<16)|dwDisplayCountW);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_SOURCE_WIDTH, dwDisplayCountW);
+ }
+
+ if ( DDOVER_HQVCalcZoomHeight(srcHeight,dstHeight,&zoomCtl,&miniCtl, &dwHQVfilterCtl, &dwHQVminiCtl ,&dwHQVzoomflagV) == PI_ERR )
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_COMPOSE_MODE , dwCompose|V1_COMMAND_FIRE );
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_COMPOSE_MODE , dwCompose|V3_COMMAND_FIRE );
+ }
+
+ Macro_VidREGFlush();
+ return PI_ERR;
+ }
+
+ if (miniCtl & V1_Y_INTERPOLY)
+ {
+ if (lpDPFsrc->dwFourCC == FOURCC_YV12)
+ {
+ if (dwVideoFlag & VIDEO_HQV_INUSE)
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56);
+ break;
+
+ default:
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH32 | V1_FIFO_PRETHRESHOLD29 | V1_FIFO_THRESHOLD16);
+ break;
+ }
+ }
+ else
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH64 | V3_FIFO_THRESHOLD61);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,V3_FIFO_PRETHRESHOLD61 |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+
+ default:
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH32 | V3_FIFO_THRESHOLD16);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,(V3_FIFO_THRESHOLD16>>8) |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+ }
+ }
+ }
+ else
+ {
+ /*Minified Video will be skewed if not work around*/
+ if (srcWidth <= 80) /*Fetch count <= 5*/
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,V1_FIFO_DEPTH16 );
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH16 );
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,(V3_FIFO_THRESHOLD16>>8) |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ }
+ }
+ else
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56);
+ break;
+
+ default:
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH16 | V1_FIFO_PRETHRESHOLD12 | V1_FIFO_THRESHOLD8);
+ break;
+ }
+ }
+ else
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH64 | V3_FIFO_THRESHOLD61);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,V3_FIFO_PRETHRESHOLD61 |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+
+ default:
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH16 | V3_FIFO_THRESHOLD8);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,(V3_FIFO_THRESHOLD16>>8) |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56);
+ break;
+
+ default:
+ if (gdwUseExtendedFIFO)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH48 | V1_FIFO_PRETHRESHOLD40 | V1_FIFO_THRESHOLD40);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH32 | V1_FIFO_PRETHRESHOLD29 | V1_FIFO_THRESHOLD16);
+ }
+ break;
+ }
+ }
+ else
+ {
+ /*Fix V3 bug*/
+ if (srcWidth <= 8)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK));
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ }
+ else
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH64 | V3_FIFO_THRESHOLD61);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,V3_FIFO_PRETHRESHOLD61 |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+
+ default:
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH32 | V3_FIFO_THRESHOLD16);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,(V3_FIFO_THRESHOLD16>>8) |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if (lpDPFsrc->dwFourCC == FOURCC_YV12)
+ {
+ if (dwVideoFlag & VIDEO_HQV_INUSE)
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56);
+ break;
+
+ default:
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH32 | V1_FIFO_PRETHRESHOLD29 | V1_FIFO_THRESHOLD16);
+ break;
+ }
+ }
+ else
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH64 | V3_FIFO_THRESHOLD61);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,V3_FIFO_PRETHRESHOLD61 |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+
+ default:
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH32 | V3_FIFO_THRESHOLD16);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,(V3_FIFO_THRESHOLD16>>8) |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+ }
+ }
+ }
+ else
+ {
+ /*Minified Video will be skewed if not work around*/
+ if (srcWidth <= 80) /*Fetch count <= 5*/
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,V1_FIFO_DEPTH16 );
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH16 );
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,(V3_FIFO_THRESHOLD16>>8) |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ }
+ }
+ else
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56);
+ break;
+
+ default:
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH16 | V1_FIFO_PRETHRESHOLD12 | V1_FIFO_THRESHOLD8);
+ break;
+ }
+ }
+ else
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH64 | V3_FIFO_THRESHOLD61);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,V3_FIFO_THRESHOLD61 |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+ default:
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH16 | V3_FIFO_THRESHOLD8);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,(V3_FIFO_THRESHOLD16>>8) |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56);
+ break;
+
+ default:
+ if (gdwUseExtendedFIFO)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH48 | V1_FIFO_PRETHRESHOLD40 | V1_FIFO_THRESHOLD40);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,
+ V1_FIFO_DEPTH32 | V1_FIFO_PRETHRESHOLD29 | V1_FIFO_THRESHOLD16);
+ }
+ break;
+ }
+ }
+ else
+ {
+ /*Fix V3 bug*/
+ if (srcWidth <= 8)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK));
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ }
+ else
+ {
+ /*=* Modify for C1 FIFO *=*/
+ switch ( DispatchVGARevisionID(gVIAGraphicInfo) )
+ {
+ case VIA_REVISION_CLECX :
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH64 | V3_FIFO_THRESHOLD61);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,V3_FIFO_PRETHRESHOLD61 |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+
+ default:
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH32 | V3_FIFO_THRESHOLD16);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,(V3_FIFO_THRESHOLD16>>8) |
+ ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) );
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (dwVideoFlag & VIDEO_HQV_INUSE)
+ {
+ miniCtl=0;
+ if (dwHQVzoomflagH||dwHQVzoomflagV)
+ {
+ dwTmp = 0;
+ if (dwHQVzoomflagH)
+ {
+ miniCtl = V1_X_INTERPOLY;
+ dwTmp = (zoomCtl&0xffff0000);
+ }
+
+ if (dwHQVzoomflagV)
+ {
+ miniCtl |= (V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY);
+ dwTmp |= (zoomCtl&0x0000ffff);
+ dwHQVfilterCtl &= 0xfffdffff;
+ }
+
+ /*Temporarily fix for 2D bandwidth problem. 2002/08/01*/
+ if ((gdwUseExtendedFIFO))
+ {
+ miniCtl &= ~V1_Y_INTERPOLY;
+ }
+
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_MINI_CONTROL, miniCtl);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_ZOOM_CONTROL, dwTmp);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_MINI_CONTROL, miniCtl);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_ZOOM_CONTROL, dwTmp);
+ }
+ }
+ else
+ {
+ if (srcHeight==dstHeight)
+ {
+ dwHQVfilterCtl &= 0xfffdffff;
+ }
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_MINI_CONTROL, 0);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_ZOOM_CONTROL, 0);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_MINI_CONTROL, 0);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_ZOOM_CONTROL, 0);
+ }
+ }
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,HQV_MINIFY_CONTROL, dwHQVminiCtl);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,HQV_FILTER_CONTROL, dwHQVfilterCtl);
+ }
+ else
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_MINI_CONTROL, miniCtl);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_ZOOM_CONTROL, zoomCtl);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_MINI_CONTROL, miniCtl);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_ZOOM_CONTROL, zoomCtl);
+ }
+ }
+
+
+ /* Colorkey*/
+ if (dwColorKey) {
+ DBG_DD(ErrorF("Overlay colorkey= low:%08lx high:%08lx\n", dwKeyLow, dwKeyHigh));
+
+ dwKeyLow &= 0x00FFFFFF;
+ /*Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_COLOR_KEY, dwKeyLow);*/
+
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_COLOR_KEY, dwKeyLow);
+ }
+ else
+ {
+ if ( lpVideoHWDifference->dwSupportTwoColorKey ) /*CLE_C0*/
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_COLOR_KEY, dwKeyLow);
+ }
+
+ /*dwCompose = (dwCompose & ~0x0f) | SELECT_VIDEO_IF_COLOR_KEY;*/
+ /*CLE_C0*/
+ dwCompose = (dwCompose & ~0x0f) | SELECT_VIDEO_IF_COLOR_KEY | SELECT_VIDEO3_IF_COLOR_KEY;
+ /*dwCompose = (dwCompose & ~0x0f) ;*/
+ }
+
+ if (dwChromaKey) {
+ DBG_DD(ErrorF("Overlay Chromakey= low:%08lx high:%08lx\n", dwKeyLow, dwKeyHigh));
+
+ dwChromaLow &= CHROMA_KEY_LOW;
+ dwChromaHigh &= CHROMA_KEY_HIGH;
+
+ dwChromaLow |= (VIDInD(V_CHROMAKEY_LOW)&(~CHROMA_KEY_LOW));
+ dwChromaHigh |= (VIDInD(V_CHROMAKEY_HIGH)&(~CHROMA_KEY_HIGH));
+
+ /*Added by Scottie[2001.12.5] for Chroma Key*/
+ if (lpDPFsrc->dwFlags & DDPF_FOURCC)
+ {
+ switch (lpDPFsrc->dwFourCC) {
+ case FOURCC_YV12:
+ /*to be continued...*/
+ break;
+ case FOURCC_YUY2:
+ /*to be continued...*/
+ break;
+ default:
+ /*TOINT3;*/
+ break;
+ }
+ }
+ else if (lpDPFsrc->dwFlags & DDPF_RGB)
+ {
+ unsigned long dwtmpLowR;
+ unsigned long dwtmpLowG;
+ unsigned long dwtmpLowB;
+ unsigned long dwtmpChromaLow;
+ unsigned long dwtmpHighR;
+ unsigned long dwtmpHighG;
+ unsigned long dwtmpHighB;
+ unsigned long dwtmpChromaHigh;
+
+ switch (lpDPFsrc->dwRGBBitCount) {
+ case 16:
+ if (lpDPFsrc->dwGBitMask==0x07E0) /*RGB16(5:6:5)*/
+ {
+ dwtmpLowR = (((dwChromaLow >> 11) << 3) | ((dwChromaLow >> 13) & 0x07)) & 0xFF;
+ dwtmpLowG = (((dwChromaLow >> 5) << 2) | ((dwChromaLow >> 9) & 0x03)) & 0xFF;
+
+ dwtmpHighR = (((dwChromaHigh >> 11) << 3) | ((dwChromaHigh >> 13) & 0x07)) & 0xFF;
+ dwtmpHighG = (((dwChromaHigh >> 5) << 2) | ((dwChromaHigh >> 9) & 0x03)) & 0xFF;
+ }
+ else /*RGB15(5:5:5)*/
+ {
+ dwtmpLowR = (((dwChromaLow >> 10) << 3) | ((dwChromaLow >> 12) & 0x07)) & 0xFF;
+ dwtmpLowG = (((dwChromaLow >> 5) << 3) | ((dwChromaLow >> 7) & 0x07)) & 0xFF;
+
+ dwtmpHighR = (((dwChromaHigh >> 10) << 3) | ((dwChromaHigh >> 12) & 0x07)) & 0xFF;
+ dwtmpHighG = (((dwChromaHigh >> 5) << 3) | ((dwChromaHigh >> 7) & 0x07)) & 0xFF;
+ }
+ dwtmpLowB = (((dwChromaLow << 3) | (dwChromaLow >> 2)) & 0x07) & 0xFF;
+ dwtmpChromaLow = (dwtmpLowG << 16) | (dwtmpLowR << 8) | dwtmpLowB;
+ dwChromaLow = ((dwChromaLow >> 24) << 24) | dwtmpChromaLow;
+
+ dwtmpHighB = (((dwChromaHigh << 3) | (dwChromaHigh >> 2)) & 0x07) & 0xFF;
+ dwtmpChromaHigh = (dwtmpHighG << 16) | (dwtmpHighR << 8) | dwtmpHighB;
+ dwChromaHigh = ((dwChromaHigh >> 24) << 24) | dwtmpChromaHigh;
+ break;
+
+ case 32: /*32 bit RGB*/
+ dwtmpLowR = (dwChromaLow >> 16) & 0xFF;
+ dwtmpLowG = (dwChromaLow >> 8) & 0xFF;
+ dwtmpLowB = dwChromaLow & 0xFF;
+ dwtmpChromaLow = (dwtmpLowG << 16) | (dwtmpLowR << 8) | dwtmpLowB;
+ dwChromaLow = ((dwChromaLow >> 24) << 24) | dwtmpChromaLow;
+
+ dwtmpHighR = (dwChromaHigh >> 16) & 0xFF;
+ dwtmpHighG = (dwChromaHigh >> 8) & 0xFF;
+ dwtmpHighB = dwChromaHigh & 0xFF;
+ dwtmpChromaHigh = (dwtmpHighG << 16) | (dwtmpHighR << 8) | dwtmpHighB;
+ dwChromaHigh = ((dwChromaHigh >> 24) << 24) | dwtmpChromaHigh;
+ break;
+
+ default:
+ /*TOINT3;*/
+ break;
+ }
+ }/*End of DDPF_FOURCC*/
+
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_CHROMAKEY_HIGH,dwChromaHigh);
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_CHROMAKEY_LOW, dwChromaLow);
+ /*Temporarily solve the H/W Interpolation error when using Chroma Key*/
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_MINI_CONTROL, miniCtl & 0xFFFFFFF8);
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_CHROMAKEY_LOW, dwChromaLow|V_CHROMAKEY_V3);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_MINI_CONTROL, miniCtl & 0xFFFFFFF8);
+ }
+
+ /*Modified by Scottie[2001.12.5] for select video if (color key & chroma key)*/
+ if (dwCompose==SELECT_VIDEO_IF_COLOR_KEY)
+ dwCompose = SELECT_VIDEO_IF_COLOR_KEY | SELECT_VIDEO_IF_CHROMA_KEY;
+ else
+ dwCompose = (dwCompose & ~0x0f) | SELECT_VIDEO_IF_CHROMA_KEY;
+ }
+
+ /* determine which video stream is on top */
+ /*
+ DBG_DD(ErrorF(" dwFlags= 0x%08lx\n", dwFlags));
+ if (dwFlags & DDOVER_CLIP)
+ dwCompose |= COMPOSE_V3_TOP;
+ else
+ dwCompose |= COMPOSE_V1_TOP;
+ */
+ DBG_DD(ErrorF(" lpVideoControl->dwCompose 0x%lx\n", lpVideoControl->dwCompose));
+
+ if (lpVideoControl->dwCompose & (VW_TV1_TOP | VW_TV_TOP) )
+ dwCompose |= COMPOSE_V3_TOP;
+ else if (lpVideoControl->dwCompose & (VW_TV2_TOP | VW_DVD_TOP) )
+ dwCompose &= ~COMPOSE_V3_TOP;
+
+ DBG_DD(ErrorF(" dwCompose 0x%8lx\n", dwCompose));
+
+ /* Setup video control*/
+ if (dwVideoFlag & VIDEO_HQV_INUSE)
+ {
+ if (!SWVideo_ON)
+ /*if (0)*/
+ {
+ DBG_DD(ErrorF(" First HQV\n"));
+
+ Macro_VidREGFlush();
+
+ if ( lpVideoHWDifference->dwHQVInitPatch )
+ {
+ WaitHQVFlipClear(((dwHQVCtl&~HQV_SW_FLIP)|HQV_FLIP_STATUS)&~HQV_ENABLE);
+ VIDOutD( HQV_CONTROL, dwHQVCtl);
+ WaitHQVFlip();
+ WaitHQVFlipClear(((dwHQVCtl&~HQV_SW_FLIP)|HQV_FLIP_STATUS)&~HQV_ENABLE);
+ VIDOutD( HQV_CONTROL, dwHQVCtl);
+ WaitHQVFlip();
+ }
+ else /* CLE_C0 */
+ {
+ VIDOutD( HQV_CONTROL, dwHQVCtl & ~HQV_SW_FLIP);
+ VIDOutD( HQV_CONTROL, dwHQVCtl | HQV_SW_FLIP);
+ WaitHQVFlip();
+ }
+
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ VIDOutD(V1_CONTROL, dwVidCtl);
+ VIDOutD(V_COMPOSE_MODE, (dwCompose|V1_COMMAND_FIRE ));
+ if (gdwUseExtendedFIFO)
+ {
+ /*Set Display FIFO*/
+ WaitVBI();
+ /*outb(0x17, 0x3C4); outb(0x2f, 0x3C5);
+ outb(0x16, 0x3C4); outb((Save_3C4_16&0xf0)|0x14, 0x3C5);
+ outb(0x18, 0x3C4); outb(0x56, 0x3C5);*/
+
+ VGAOUT8(0x3C4, 0x17); VGAOUT8(0x3C5, 0x2f);
+ VGAOUT8(0x3C4, 0x16); VGAOUT8(0x3C5, (Save_3C4_16&0xf0)|0x14);
+ VGAOUT8(0x3C4, 0x18); VGAOUT8(0x3C5, 0x56);
+ }
+ }
+ else
+ {
+ VIDOutD(V3_CONTROL, dwVidCtl);
+ VIDOutD(V_COMPOSE_MODE, (dwCompose|V3_COMMAND_FIRE ));
+ }
+ }
+ else
+ {
+ DBG_DD(ErrorF(" Normal called\n"));
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_CONTROL, dwVidCtl);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (dwCompose|V1_COMMAND_FIRE ));
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_CONTROL, dwVidCtl);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (dwCompose|V3_COMMAND_FIRE ));
+ }
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER, HQV_CONTROL, dwHQVCtl|HQV_FLIP_STATUS);
+ WaitHQVDone();
+ Macro_VidREGFlush();
+ }
+ }
+ else
+ {
+ if (dwVideoFlag & VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_CONTROL, dwVidCtl);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (dwCompose|V1_COMMAND_FIRE ));
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_CONTROL, dwVidCtl);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (dwCompose|V3_COMMAND_FIRE ));
+ }
+ WaitHQVDone();
+ Macro_VidREGFlush();
+ }
+ SWVideo_ON = TRUE;
+ }
+ else
+ {
+ /*Hide overlay*/
+
+ if ( lpVideoHWDifference->dwHQVDisablePatch ) /*CLE_C0*/
+ {
+ VGAOUT8(0x3C4, 0x2E);
+ VGAOUT8(0x3C5, 0xEF);
+ }
+
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_FIFO_CONTROL,V1_FIFO_PRETHRESHOLD12 |
+ V1_FIFO_THRESHOLD8 |V1_FIFO_DEPTH16);
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,ALPHA_V3_FIFO_CONTROL, ALPHA_FIFO_THRESHOLD4
+ | ALPHA_FIFO_DEPTH8 | V3_FIFO_THRESHOLD24 | V3_FIFO_DEPTH32 );
+
+ if (dwVideoFlag&VIDEO_HQV_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,HQV_CONTROL, (VIDInD(HQV_CONTROL) & (~HQV_ENABLE)));
+ }
+
+ if (dwVideoFlag&VIDEO_1_INUSE)
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V1_CONTROL, (VIDInD(V1_CONTROL) & (~V1_ENABLE)));
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (VIDInD(V_COMPOSE_MODE)|V1_COMMAND_FIRE));
+ }
+ else
+ {
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V3_CONTROL, (VIDInD(V3_CONTROL) & (~V3_ENABLE)));
+ Macro_VidREGRec(VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (VIDInD(V_COMPOSE_MODE)|V3_COMMAND_FIRE));
+ }
+
+ Macro_VidREGFlush();
+
+ if ( lpVideoHWDifference->dwHQVDisablePatch ) /*CLE_C0*/
+ {
+ VGAOUT8(0x3C4, 0x2E);
+ VGAOUT8(0x3C5, 0xFF);
+ }
+
+ }
+
+ return PI_OK;
+
+} /* Upd_Video */
+
+/*************************************************************************
+ * VIAVidUpdateOverlay
+ * Parameters: src rectangle, dst rectangle, colorkey...
+ * Return Value: unsigned long of state
+ * note: Update the overlay image param.
+*************************************************************************/
+unsigned long VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY lpUpdate)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ unsigned long dwFlags = lpUpdate->dwFlags;
+ unsigned long dwKeyLow=0, dwKeyHigh=0;
+ unsigned long dwChromaLow=0, dwChromaHigh=0;
+ unsigned long dwVideoFlag=0;
+ unsigned long dwColorKey=0, dwChromaKey=0;
+ /*DDUPDATEOVERLAY UpdateOverlayTemp;*/
+ int nDstTop, nDstBottom, nDstLeft, nDstRight, nTopBak=0;
+
+ DBG_DD(ErrorF("// VIAVidUpdateOverlay: %08lx\n", dwFlags));
+
+ /* Adjust to fix panning mode bug */
+ lpUpdate->rDest.left = lpUpdate->rDest.left - (panning_x - panning_old_x);
+ lpUpdate->rDest.top = lpUpdate->rDest.top - (panning_y - panning_old_y);
+ lpUpdate->rDest.right = lpUpdate->rDest.right - (panning_x - panning_old_x);
+ lpUpdate->rDest.bottom = lpUpdate->rDest.bottom - (panning_y - panning_old_y);
+
+ DBG_DD(ErrorF("Raw rSrc X (%ld,%ld) Y (%ld,%ld)\n",
+ lpUpdate->rSrc.left, lpUpdate->rSrc.right, lpUpdate->rSrc.top, lpUpdate->rSrc.bottom));
+ DBG_DD(ErrorF("Raw rDest X (%ld,%ld) Y (%ld,%ld)\n",
+ lpUpdate->rDest.left, lpUpdate->rDest.right, lpUpdate->rDest.top, lpUpdate->rDest.bottom));
+
+/* if (gdwVideoFlagTV1 && !gdwOverlaySupport)
+ return PI_OK;
+*/
+ if ( (lpDPFsrc->dwFourCC == FOURCC_YUY2)||( lpDPFsrc->dwFourCC == FOURCC_YV12 ) )
+ dwVideoFlag = gdwVideoFlagSW;
+
+ dwFlags |= DDOVER_INTERLEAVED;
+
+ /* For Alpha windows setting */
+ if (gdwAlphaEnabled)
+ dwFlags &= ~DDOVER_KEYDEST;
+
+ Macro_VidREGRec(VIDREGREC_RESET_COUNTER, 0,0);
+
+ if ( dwFlags & DDOVER_HIDE )
+ {
+ DBG_DD(ErrorF("// :DDOVER_HIDE \n"));
+
+ dwVideoFlag &= ~VIDEO_SHOW;
+
+ if (Upd_Video(pScrn, dwVideoFlag,0,lpUpdate->rSrc,lpUpdate->rDest,0,0,0,lpDPFsrc,0,
+ 0,0,0,0,0,0, dwFlags)== PI_ERR)
+ {
+ return PI_ERR;
+ }
+ SWVideo_ON = FALSE;
+ UpdateOverlayBackup.rDest.left = 0;
+ UpdateOverlayBackup.rDest.top = 0;
+ UpdateOverlayBackup.rDest.right = 0;
+ UpdateOverlayBackup.rDest.bottom = 0;
+
+ if (gdwUseExtendedFIFO)
+ {
+ /*Restore Display fifo*/
+ /*outb(0x16, 0x3C4); outb(Save_3C4_16, 0x3C5);*/
+ VGAOUT8(0x3C4, 0x16); VGAOUT8(0x3C5, Save_3C4_16);
+ DBG_DD(ErrorF("Restore 3c4.16 : %08x \n",VGAIN8(0x3C5)));
+
+ /*outb(0x17, 0x3C4); outb(Save_3C4_17, 0x3C5);*/
+ VGAOUT8(0x3C4, 0x17); VGAOUT8(0x3C5, Save_3C4_17);
+ DBG_DD(ErrorF(" 3c4.17 : %08x \n",VGAIN8(0x3C5)));
+
+ /*outb(0x18, 0x3C4); outb(Save_3C4_18, 0x3C5);*/
+ VGAOUT8(0x3C4, 0x18); VGAOUT8(0x3C5, Save_3C4_18);
+ DBG_DD(ErrorF(" 3c4.18 : %08x \n",VGAIN8(0x3C5)));
+ gdwUseExtendedFIFO = 0;
+ }
+ return PI_OK;
+ }
+
+ /* If the dest rectangle doesn't change, we can return directly */
+ /*
+ if ( (UpdateOverlayBackup.rDest.left == lpUpdate->rDest.left) &&
+ (UpdateOverlayBackup.rDest.top == lpUpdate->rDest.top) &&
+ (UpdateOverlayBackup.rDest.right == lpUpdate->rDest.right) &&
+ (UpdateOverlayBackup.rDest.bottom == lpUpdate->rDest.bottom) )
+ return PI_OK;
+ */
+ UpdateOverlayBackup = * (LPDDUPDATEOVERLAY) lpUpdate;
+
+ if ( dwFlags & DDOVER_KEYDEST )
+ {
+ DBG_DD(ErrorF("// :DDOVER_KEYDEST \n"));
+
+ dwColorKey = 1;
+ dwKeyLow = lpUpdate->dwColorSpaceLowValue;
+ }
+
+ if (dwFlags & DDOVER_SHOW)
+ {
+ unsigned long dwStartAddr=0, dwDeinterlaceMode=0;
+ unsigned long dwScnWidth, dwScnHeight;
+
+ DBG_DD(ErrorF("// :DDOVER_SHOW \n"));
+
+ /*for SW decode HW overlay use*/
+ dwStartAddr = VIDInD(HQV_SRC_STARTADDR_Y);
+ DBG_DD(ErrorF("dwStartAddr= 0x%lx\n", dwStartAddr));
+
+ if (dwFlags & DDOVER_INTERLEAVED)
+ {
+ dwDeinterlaceMode |= DDOVER_INTERLEAVED;
+ DBG_DD(ErrorF("DDOVER_INTERLEAVED\n"));
+ }
+ if (dwFlags & DDOVER_BOB)
+ {
+ dwDeinterlaceMode |= DDOVER_BOB;
+ DBG_DD(ErrorF("DDOVER_BOB\n"));
+ }
+
+ if ((gVIAGraphicInfo.dwWidth > 1024))
+ {
+ DBG_DD(ErrorF("UseExtendedFIFO\n"));
+ gdwUseExtendedFIFO = 1;
+ }
+ /*
+ else
+ {
+ //Set Display FIFO
+ outb(0x16, 0x3C4); outb((Save_3C4_16&0xf0)|0x0c, 0x3C5);
+ DBG_DD(ErrorF("set 3c4.16 : %08x \n",inb(0x3C5)));
+ outb(0x18, 0x3C4); outb(0x4c, 0x3C5);
+ DBG_DD(ErrorF(" 3c4.18 : %08x \n",inb(0x3C5)));
+ }
+ */
+ dwVideoFlag |= VIDEO_SHOW;
+
+
+ /*
+ // Figure out actual rSrc rectangle
+ // Coz the Src rectangle AP sent is always original, ex:size(720,480) at (0,0)
+ // so the driver need to re-calc
+ //
+ // transfer unsigned long to signed int for calc*/
+ nDstLeft = lpUpdate->rDest.left;
+ nDstTop = lpUpdate->rDest.top;
+ nDstRight= lpUpdate->rDest.right;
+ nDstBottom=lpUpdate->rDest.bottom;
+
+ dwScnWidth = gVIAGraphicInfo.dwWidth;
+ dwScnHeight = gVIAGraphicInfo.dwHeight;
+
+ if (nDstLeft<0)
+ lpUpdate->rSrc.left = (((-nDstLeft) * overlayRecordV1.dwV1OriWidth) + ((nDstRight-nDstLeft)>>1)) / (nDstRight-nDstLeft);
+ else
+ lpUpdate->rSrc.left = 0;
+
+ if (nDstRight>dwScnWidth)
+ lpUpdate->rSrc.right = (((dwScnWidth-nDstLeft) * overlayRecordV1.dwV1OriWidth) + ((nDstRight-nDstLeft)>>1)) / (nDstRight-nDstLeft);
+ else
+ lpUpdate->rSrc.right = overlayRecordV1.dwV1OriWidth;
+
+ if (nDstTop<0)
+ {
+ lpUpdate->rSrc.top = (((-nDstTop) * overlayRecordV1.dwV1OriHeight) + ((nDstBottom-nDstTop)>>1))/ (nDstBottom-nDstTop);
+ nTopBak = (-nDstTop);
+ }
+ else
+ lpUpdate->rSrc.top = 0;
+
+ if (nDstBottom >dwScnHeight)
+ lpUpdate->rSrc.bottom = (((dwScnHeight-nDstTop) * overlayRecordV1.dwV1OriHeight) + ((nDstBottom-nDstTop)>>1)) / (nDstBottom-nDstTop);
+ else
+ lpUpdate->rSrc.bottom = overlayRecordV1.dwV1OriHeight;
+
+ /* save modified src & original dest rectangle param.*/
+ if ( (lpDPFsrc->dwFourCC == FOURCC_YUY2)||( lpDPFsrc->dwFourCC == FOURCC_YV12 ) )
+ {
+ SWDevice.gdwSWDstLeft = lpUpdate->rDest.left + (panning_x - panning_old_x);
+ SWDevice.gdwSWDstTop = lpUpdate->rDest.top + (panning_y - panning_old_y);
+ SWDevice.gdwSWDstWidth = lpUpdate->rDest.right - lpUpdate->rDest.left;
+ SWDevice.gdwSWDstHeight = lpUpdate->rDest.bottom - lpUpdate->rDest.top;
+
+ SWDevice.gdwSWSrcWidth = overlayRecordV1.dwV1SrcWidth = lpUpdate->rSrc.right - lpUpdate->rSrc.left;
+ SWDevice.gdwSWSrcHeight = overlayRecordV1.dwV1SrcHeight = lpUpdate->rSrc.bottom - lpUpdate->rSrc.top;
+ }
+
+ overlayRecordV1.dwV1SrcLeft = lpUpdate->rSrc.left;
+ overlayRecordV1.dwV1SrcRight = lpUpdate->rSrc.right;
+ overlayRecordV1.dwV1SrcTop = lpUpdate->rSrc.top;
+ overlayRecordV1.dwV1SrcBot = lpUpdate->rSrc.bottom;
+
+ /*
+ // Figure out actual rDest rectangle
+ */
+ lpUpdate->rDest.left= nDstLeft<0 ? 0 : nDstLeft;
+ lpUpdate->rDest.top= nDstTop<0 ? 0 : nDstTop;
+ if ( lpUpdate->rDest.top >= dwScnHeight)
+ lpUpdate->rDest.top = dwScnHeight-1;
+ /*lpUpdate->rDest.top= top>=dwScnHeight ? dwScnHeight-1: top;*/
+ lpUpdate->rDest.right= nDstRight>dwScnWidth ? dwScnWidth: nDstRight;
+ lpUpdate->rDest.bottom= nDstBottom>dwScnHeight ? dwScnHeight: nDstBottom;
+
+ /*check which update func. (upd_MPEG, upd_video, upd_capture) to call*/
+ if (Upd_Video(pScrn, dwVideoFlag,dwStartAddr,lpUpdate->rSrc,lpUpdate->rDest,SWDevice.dwPitch,
+ overlayRecordV1.dwV1OriWidth,overlayRecordV1.dwV1OriHeight,lpDPFsrc,
+ dwDeinterlaceMode,dwColorKey,dwChromaKey,
+ dwKeyLow,dwKeyHigh,dwChromaLow,dwChromaHigh, dwFlags)== PI_ERR)
+ {
+ return PI_ERR;
+ }
+ SWVideo_ON = FALSE;
+
+ return PI_OK;
+
+ } /*end of DDOVER_SHOW*/
+
+ panning_old_x = panning_x;
+ panning_old_y = panning_y;
+
+ return PI_OK;
+
+} /*VIAVidUpdateOverlay*/
+
+
+
+/*************************************************************************
+ * ADJUST FRAME
+*************************************************************************/
+unsigned long VIAVidAdjustFrame(LPADJUSTFRAME lpAdjustFrame)
+{
+ DBG_DD(ErrorF("//VIAVidAdjustFrame\n"));
+
+ panning_x = lpAdjustFrame->x;
+ panning_y = lpAdjustFrame->y;
+
+ return PI_OK;
+}
+
+
+
+
+
+
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_swov.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_swov.h new file mode 100644 index 000000000..2c30ae2ea --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_swov.h @@ -0,0 +1,53 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_SWOV_H
+#define _VIA_SWOV_H
+
+/*#define XV_DEBUG 1*/ /* write log msg to /var/log/XFree86.0.log */
+
+#ifdef XV_DEBUG
+ #define DBG_DD(x) (x)
+#else
+ #define DBG_DD(x)
+#endif
+
+#include "ddmpeg.h"
+#include "via_xvpriv.h"
+
+/* Definition for VideoStatus */
+#define VIDEO_NULL 0x00000000
+
+unsigned long VIAVidCreateSurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC lpDDSurfaceDesc);
+unsigned long VIAVidLockSurface(ScrnInfoPtr pScrn, LPDDLOCK lpLock);
+unsigned long VIAVidDestroySurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC lpDDSurfaceDesc);
+
+unsigned long Upd_MPEG(ScrnInfoPtr pScrn, unsigned long dwVideoFlag,unsigned long dwStartAddr,RECTL rSrc,RECTL rDest,unsigned long dwSrcPitch,
+ unsigned long dwOriSrcWidth,unsigned long dwOriSrcHeight,LPDDPIXELFORMAT lpDPFsrc,
+ unsigned long dwDeinterlaceMode,unsigned long dwColorKey,unsigned long dwChromaKey,
+ unsigned long dwKeyLow,unsigned long dwKeyHigh,unsigned long dwChromaLow,unsigned long dwChromaHigh);
+
+unsigned long VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY lpUpdate);
+unsigned long VIAVidAdjustFrame(LPADJUSTFRAME lpAdjustFrame);
+#endif /* _VIA_SWOV_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_tv2.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_tv2.h new file mode 100644 index 000000000..fa51abe81 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_tv2.h @@ -0,0 +1,125 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_TV2MODETABLE_H
+#define _VIA_TV2MODETABLE_H
+
+VIABIOSTVMASKTableRec tv2MaskTable = {
+ { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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X6F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X71, 0X63, 0X63, 0X95, 0X67, 0X90, 0X6F, 0XF0, 0, 0X60, 0, 0, 0, 0, 0, 0, 0X57, 0, 0X57, 0, 0, 0X57, 0X70, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X20, 0X40, 0X80, 0X1, 0X47, 0X1C, 0, 0 },
+ { 0, 0, 0, 0X47, 0X1C, 0, 0, 0 },
+ { 0XAF, 0X1F, 0X1F, 0XAF, 0XDB, 0X33, 0X35, 0X7D, 0X70, 0X57, 0X57, 0X70, 0X52, 0X12, 0X58, 0X5B, 0, 0, 0, 0, 0, 0X32, 0X64, 0, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XAF, 0X1F, 0X1F, 0XAF, 0XDB, 0X33, 0X35, 0X7D, 0X70, 0X57, 0X57, 0X70, 0X52, 0X12, 0X58, 0X5B, 0, 0, 0, 0, 0, 0X64, 0XC8, 0X40, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XAF, 0X1F, 0X1F, 0XAF, 0XDB, 0X33, 0X35, 0X7D, 0X70, 0X57, 0X57, 0X70, 0X52, 0X12, 0X58, 0X5B, 0, 0, 0, 0, 0, 0XC8, 0X90, 0X81, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0X7E07, 0, 0, 0, 0, 0, 0, 0 }
+ }
+};
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_tv3.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_tv3.h new file mode 100644 index 000000000..9a914d33b --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_tv3.h @@ -0,0 +1,365 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_TV3MODETABLE_H
+#define _VIA_TV3MODETABLE_H
+
+VIABIOSTVMASKTableRec tv3MaskTable = {
+ { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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
+ { 0XE7, 0XCF, 0XCF, 0XE7, 0XDA, 0X23, 0XF, 0X37, 0XA2, 0X3F, 0X3F, 0XA2, 0X52, 0X12, 0X5A, 0X48, 0, 0, 0, 0, 0, 0X2D, 0X5A, 0, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XE7, 0XCF, 0XCF, 0XE7, 0XDA, 0X23, 0XF, 0X37, 0XA2, 0X3F, 0X3F, 0XA2, 0X52, 0X12, 0X5A, 0X48, 0, 0, 0, 0, 0, 0X5A, 0XB4, 0X40, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XE7, 0XCF, 0XCF, 0XE7, 0XDA, 0X23, 0XF, 0X37, 0XA2, 0X3F, 0X3F, 0XA2, 0X52, 0X12, 0X5A, 0X48, 0, 0, 0, 0, 0, 0XB4, 0X68, 0X81, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XDF07, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X6, 0X2A02, 0XBA65, 0XB866, 0XB867, 0X9027, 0X992B, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X4, 0X302, 0X5865, 0X4866, 0X4967, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+ }
+};
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_utility.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_utility.c new file mode 100644 index 000000000..0a1ed53fd --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_utility.c @@ -0,0 +1,2553 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * I N C L U D E S
+ */
+#include "via_driver.h"
+#include "via_utility.h"
+
+
+void VIAXVUtilityProc(ScrnInfoPtr pScrn, unsigned char* buf)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ UTUSERSETTINGptr pUTUSERSETTING = pBIOSInfo->pUTUSERSETTING;
+ VIAModeTablePtr pViaModeTable = pBIOSInfo->pModeTable;
+ CARD8 *TV=NULL;
+ CARD16 *DotCrawl=NULL;
+ int i, HPos, VPos, ADWHS, ADWHE;
+ unsigned int tvIndx = pBIOSInfo->resTVMode;
+ CARD32 dwFunc, dwAction=0, dwInData=0;
+ UTBIOSVERSION pUTBIOSVERSION;
+ UTBIOSDATE pUTBIOSDATE;
+ UTDriverVersion pUTDriverVersion;
+ UTPANELINFO pUTPANELINFO;
+ UTXYVALUE MaxViewSizeValue, ViewSizeValue, MaxViewPosValue, ViewPosValue;
+ UTSETTVTUNINGINFO pUTSETTVTUNINGINFO;
+ UTSETTVITEMSTATE pUTSETTVITEMSTATE;
+ UTGAMMAINFO pUTGAMMAINFO;
+ char DISPLAY_DRIVER_NAME[] = "via_drv.o\0";
+ char VDO_CAPTURE_DRIVER_NAME[] = "via_v4l_drv.o\0";
+ char HWOVERLAY_DRIVER_NAME[] = "libddmpeg.a\0";
+ CARD32 dwVideoRam, dwSupportState=0, dwConnectState=0, dwActiveState=0;
+ CARD32 dwSAMMState, dwRotateState=0, dwExpandState, dwStandard=0;
+ CARD32 dwSignalType, dwMaxValue, dwItemID=0, dwValue, dwState;
+ CARD32 value;
+ CARD16 szDriverName[16];
+ long dwUTRetOK = 1, dwUTRetFail = 0, dwUTRetNoFunc = -1;
+ unsigned char *InParam;
+ I2CDevPtr dev=NULL;
+ unsigned char W_Buffer[3];
+ unsigned char R_Buffer[3];
+
+ WaitIdle();
+
+ if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) && (!pUTUSERSETTING->DefaultSetting)) {
+ UTGetInfo(pBIOSInfo);
+ }
+
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE)
+ TV = pViaModeTable->tv2Table[tvIndx].TVPALC;
+ else
+ TV = pViaModeTable->tv2Table[tvIndx].TVPALS;
+ break;
+ case VIA_TVOVER:
+ if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE)
+ TV = pViaModeTable->tv2OverTable[tvIndx].TVPALC;
+ else
+ TV = pViaModeTable->tv2OverTable[tvIndx].TVPALS;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ DotCrawl = pViaModeTable->tv2Table[tvIndx].DotCrawlNTSC;
+ if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE)
+ TV = pViaModeTable->tv2Table[tvIndx].TVNTSCC;
+ else
+ TV = pViaModeTable->tv2Table[tvIndx].TVNTSCS;
+ break;
+ case VIA_TVOVER:
+ DotCrawl = pViaModeTable->tv2OverTable[tvIndx].DotCrawlNTSC;
+ if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE)
+ TV = pViaModeTable->tv2OverTable[tvIndx].TVNTSCC;
+ else
+ TV = pViaModeTable->tv2OverTable[tvIndx].TVNTSCS;
+ break;
+ }
+ }
+ break;
+ case VIA_TV3:
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->tv3Table[tvIndx].TVPAL;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->tv3OverTable[tvIndx].TVPAL;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->tv3Table[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->tv3Table[tvIndx].DotCrawlNTSC;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->tv3OverTable[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->tv3OverTable[tvIndx].DotCrawlNTSC;
+ break;
+ }
+ }
+ break;
+ case VIA_VT1622A:
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->vt1622aTable[tvIndx].TVPAL;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->vt1622aOverTable[tvIndx].TVPAL;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->vt1622aTable[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->vt1622aTable[tvIndx].DotCrawlNTSC;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->vt1622aOverTable[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->vt1622aOverTable[tvIndx].DotCrawlNTSC;
+ break;
+ }
+ }
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->ch7019Table[tvIndx].TVPAL;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->ch7019OverTable[tvIndx].TVPAL;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->ch7019Table[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->ch7019Table[tvIndx].DotCrawlNTSC;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->ch7019OverTable[tvIndx].TVNTSC;
+ DotCrawl = pViaModeTable->ch7019OverTable[tvIndx].DotCrawlNTSC;
+ break;
+ }
+ }
+ break;
+ case VIA_SAA7108:
+ if (pBIOSInfo->TVType == TVTYPE_PAL) {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->saa7108Table[tvIndx].TVPAL;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->saa7108OverTable[tvIndx].TVPAL;
+ break;
+ }
+ }
+ else {
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->saa7108Table[tvIndx].TVNTSC;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->saa7108OverTable[tvIndx].TVNTSC;
+ break;
+ }
+ }
+ break;
+ /*case VIA_FS454:
+ switch (pBIOSInfo->TVVScan) {
+ case VIA_TVNORMAL:
+ TV = pViaModeTable->fs454Table[tvIndx].TVNTSC;
+ break;
+ case VIA_TVOVER:
+ TV = pViaModeTable->fs454OverTable[tvIndx].TVNTSC;
+ break;
+ }
+ break;*/
+ }
+
+ InParam = buf;
+ dwFunc = *((CARD32 *)InParam);
+ InParam += 4;
+
+ dwAction =*((CARD32 *)InParam);
+ InParam += 4;
+
+ switch(dwFunc)
+ {
+ case UT_XV_FUNC_BIOS :
+ switch(dwAction)
+ {
+ case UT_XV_FUNC_BIOS_GetChipID :
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &pVia->ChipId, sizeof(CARD32));
+ InParam += 4;
+ break;
+ case UT_XV_FUNC_BIOS_GetVersion :
+ pUTBIOSVERSION.dwVersion = pBIOSInfo->BIOSMajorVersion;
+ pUTBIOSVERSION.dwRevision = pBIOSInfo->BIOSMinorVersion;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(long));
+ InParam += 4;
+ memcpy((void *)InParam, &pUTBIOSVERSION, sizeof(UTBIOSVERSION));
+ break;
+ case UT_XV_FUNC_BIOS_GetDate :
+ if (!pBIOSInfo->BIOSDateYear) {
+ BIOS_GetBIOSDate(pScrn);
+ }
+ pUTBIOSDATE.dwYear = (CARD32)pBIOSInfo->BIOSDateYear + 2000;
+ pUTBIOSDATE.dwMonth = (CARD32)pBIOSInfo->BIOSDateMonth;
+ pUTBIOSDATE.dwDay = (CARD32)pBIOSInfo->BIOSDateDay;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(long));
+ InParam += 4;
+ memcpy((void *)InParam, &pUTBIOSDATE, sizeof(UTBIOSDATE));
+ break;
+ case UT_XV_FUNC_BIOS_GetVideoMemSizeMB :
+ dwVideoRam = pScrn->videoRam >> 10;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwVideoRam, sizeof(CARD32));
+ break;
+ default:
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ InParam += 4;
+ ErrorF(" via_utility.c : dwAction not supported\n");
+ break;
+ }
+ break;
+ case UT_XV_FUNC_DRIVER :
+ switch(dwAction)
+ {
+ case UT_XV_FUNC_DRIVER_GetFileName :
+ InParam += 4;
+ dwInData = *((CARD32 *)InParam);
+ switch(dwInData)
+ {
+ case DISPLAY_DRIVER :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ memcpy((void *)szDriverName, (void *)DISPLAY_DRIVER_NAME, sizeof(DISPLAY_DRIVER_NAME));
+ InParam += 4;
+ memcpy((void *)InParam, &szDriverName, sizeof(szDriverName));
+ break;
+ case VIDEO_CAPTURE_DRIVER :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ memcpy((void *)szDriverName, (void *)VDO_CAPTURE_DRIVER_NAME, sizeof(VDO_CAPTURE_DRIVER_NAME));
+ InParam += 4;
+ memcpy((void *)InParam, &szDriverName, sizeof(szDriverName));
+ break;
+ case HWOVERLAY_DRIVER :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ memcpy((void *)szDriverName, (void *)HWOVERLAY_DRIVER_NAME, sizeof(HWOVERLAY_DRIVER_NAME));
+ InParam += 4;
+ memcpy((void *)InParam, &szDriverName, sizeof(szDriverName));
+ break;
+ default:
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ break;
+ }
+ break;
+ case UT_XV_FUNC_DRIVER_GetFileVersion :
+ InParam += 4;
+ dwInData = *((CARD32 *)InParam);
+ switch(dwInData)
+ {
+ case DISPLAY_DRIVER :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ pUTDriverVersion.dwMajorNum = VERSION_MAJOR;
+ pUTDriverVersion.dwMinorNum = VERSION_MINOR;
+ pUTDriverVersion.dwReversionNum = PATCHLEVEL;
+ InParam += 4;
+ memcpy((void *)InParam, &pUTDriverVersion, sizeof(UTDriverVersion));
+ break;
+ case VIDEO_CAPTURE_DRIVER :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ pUTDriverVersion.dwMajorNum = 4;
+ pUTDriverVersion.dwMinorNum = 1;
+ pUTDriverVersion.dwReversionNum = 28;
+ InParam += 4;
+ memcpy((void *)InParam, &pUTDriverVersion, sizeof(UTDriverVersion));
+ break;
+ case HWOVERLAY_DRIVER :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ pUTDriverVersion.dwMajorNum = 4;
+ pUTDriverVersion.dwMinorNum = 1;
+ pUTDriverVersion.dwReversionNum = 28;
+ InParam += 4;
+ memcpy((void *)InParam, &pUTDriverVersion, sizeof(UTDriverVersion));
+ break;
+ default:
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ break;
+ }
+ break;
+ default:
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ ErrorF(" via_utility.c : dwAction not supported\n");
+ break;
+ }
+ break;
+ case UT_XV_FUNC_DEVICE :
+ switch(dwAction)
+ {
+ case UT_XV_FUNC_DEVICE_GetSupportState :
+ dwSupportState = UT_DEVICE_CRT1;
+ if (pBIOSInfo->TVEncoder)
+ dwSupportState |= UT_DEVICE_TV;
+ if (pBIOSInfo->TMDS) {
+ dwSupportState |= UT_DEVICE_DFP;
+ }
+ if (pBIOSInfo->LVDS) {
+ dwSupportState |= UT_DEVICE_LCD;
+ }
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwSupportState, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_DEVICE_GetConnectState :
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ dwConnectState = VIAGetDeviceDetect(pBIOSInfo);
+ memcpy((void *)InParam, &dwConnectState, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_DEVICE_GetActiveState :
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ if (pBIOSInfo->HasSecondary) /* if SAMM */
+ dwActiveState = pVia->ActiveDevice;
+ else
+ dwActiveState = pBIOSInfo->ActiveDevice;
+ memcpy((void *)InParam, &dwActiveState, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_DEVICE_SetActiveState :
+ InParam += 4;
+ dwInData = *((CARD32 *)InParam);
+ /* DuoView not implement yet, we do nothing */
+ if ((dwInData == (VIA_DEVICE_TV | VIA_DEVICE_LCD)) ||
+ (dwInData == (VIA_DEVICE_TV | VIA_DEVICE_DFP))) {
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ }
+ pBIOSInfo->ActiveDevice = (unsigned char)dwInData;
+ /* Avoid device switch in panning mode or expansion */
+ pBIOSInfo->scaleY = FALSE;
+ pScrn->frameX1 = pBIOSInfo->SaveframeX1;
+ pScrn->frameY1 = pBIOSInfo->SaveframeY1;
+ pScrn->currentMode->HDisplay = pBIOSInfo->SaveHDisplay;
+ pScrn->currentMode->VDisplay = pBIOSInfo->SaveVDisplay;
+ pScrn->currentMode->CrtcHDisplay = pBIOSInfo->SaveCrtcHDisplay;
+ pScrn->currentMode->CrtcVDisplay = pBIOSInfo->SaveCrtcVDisplay;
+
+ /*BIOS_SetActiveDevice(pScrn);*/
+ VIASwitchMode(0, pScrn->currentMode, 0);
+ VIASaveUserSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_DEVICE_GetSAMMState :
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ if (!pBIOSInfo->HasSecondary)
+ dwSAMMState = UT_STATE_SAMM_OFF;
+ else
+ dwSAMMState = UT_STATE_SAMM_ON;
+ memcpy((void *)InParam, &dwSAMMState, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_DEVICE_GetRoateState :
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ dwRotateState = UT_ROTATE_NONE;
+ memcpy((void *)InParam, &dwRotateState, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_DEVICE_SetRoateState :
+ memcpy((void *)InParam, &dwUTRetNoFunc, sizeof(CARD32));
+ break;
+ default :
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ ErrorF(" via_utility.c : dwAction not supported\n");
+ break;
+ }
+ break;
+ case UT_XV_FUNC_PANEL :
+ switch(dwAction)
+ {
+ case UT_XV_FUNC_DEVICE_SetTargetPanel :
+ memcpy((void *)InParam, &dwUTRetNoFunc, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_DEVICE_GetPanelInfo :
+ pUTPANELINFO.dwType = UT_PANEL_TYPE_TFT;
+ pUTPANELINFO.dwResX = pBIOSInfo->panelX;
+ pUTPANELINFO.dwResY = pBIOSInfo->panelY;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &pUTPANELINFO, sizeof(UTPANELINFO));
+ break;
+ case UT_XV_FUNC_DEVICE_GetExpandState :
+ if (pBIOSInfo->Center)
+ dwExpandState = UT_STATE_EXPAND_OFF;
+ else
+ dwExpandState = UT_STATE_EXPAND_ON;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwExpandState, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_DEVICE_SetExpandState :
+ InParam += 4;
+ dwInData = *((CARD32 *)InParam);
+ if (dwInData == UT_STATE_EXPAND_OFF) {
+ pBIOSInfo->Center = TRUE;
+ VIASaveUserSetting(pBIOSInfo);
+ VIASwitchMode(0, pScrn->currentMode, 0);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else if (dwInData == UT_STATE_EXPAND_ON) {
+ pBIOSInfo->Center = FALSE;
+ VIASaveUserSetting(pBIOSInfo);
+ VIASwitchMode(0, pScrn->currentMode, 0);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_XV_FUNC_DEVICE_GetSupportExpand :
+ InParam += 4;
+ dwInData = *((CARD32 *)InParam);
+ if (pBIOSInfo->LVDS) {
+ switch (pBIOSInfo->PanelSize) {
+ case VIA_PANEL6X4:
+ if (pBIOSInfo->SaveHDisplay < 640 &&
+ pBIOSInfo->SaveVDisplay < 480) {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_ON;
+ }
+ else {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_OFF;
+ }
+ break;
+ case VIA_PANEL8X6:
+ if (pBIOSInfo->SaveHDisplay < 800 &&
+ pBIOSInfo->SaveVDisplay < 600) {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_ON;
+ }
+ else {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_OFF;
+ }
+ break;
+ case VIA_PANEL10X7:
+ if (pBIOSInfo->SaveHDisplay < 1024 &&
+ pBIOSInfo->SaveVDisplay < 768) {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_ON;
+ }
+ else {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_OFF;
+ }
+ break;
+ case VIA_PANEL12X7:
+ if (pBIOSInfo->SaveHDisplay < 1280 &&
+ pBIOSInfo->SaveVDisplay < 768) {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_ON;
+ }
+ else {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_OFF;
+ }
+ break;
+ case VIA_PANEL12X10:
+ if (pBIOSInfo->SaveHDisplay < 1280 &&
+ pBIOSInfo->SaveVDisplay < 1024) {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_ON;
+ }
+ else {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_OFF;
+ }
+ break;
+ case VIA_PANEL14X10:
+ if (pBIOSInfo->SaveHDisplay < 1400 &&
+ pBIOSInfo->SaveVDisplay < 1050) {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_ON;
+ }
+ else {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_OFF;
+ }
+ break;
+ case VIA_PANEL16X12:
+ if (pBIOSInfo->SaveHDisplay < 1600 &&
+ pBIOSInfo->SaveVDisplay < 1200) {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_ON;
+ }
+ else {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_OFF;
+ }
+ break;
+ default:
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_OFF;
+ break;
+ }
+ }
+ else {
+ dwSupportState = UT_PANEL_SUPPORT_EXPAND_OFF;
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwSupportState, sizeof(CARD32));
+ break;
+ default :
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ InParam += 4;
+ ErrorF(" via_utility.c : dwAction not supported\n");
+ break;
+ }
+ break;
+ case UT_XV_FUNC_TV :
+ switch(dwAction)
+ {
+ case UT_XV_FUNC_TV_GetSupportStandardState :
+ dwSupportState = UT_TV_STD_NTSC | UT_TV_STD_PAL;
+ if (pBIOSInfo->TVEncoder == VIA_FS454)
+ dwSupportState = UT_TV_STD_NTSC;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwSupportState, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_TV_GetStandard :
+ dwStandard = pBIOSInfo->TVType;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwStandard, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_TV_SetStandard :
+ InParam += 4;
+ dwInData = *((CARD32 *)InParam);
+ switch (dwInData) {
+ case UT_TV_STD_NTSC :
+ pBIOSInfo->TVType = TVTYPE_NTSC;
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ VIASaveUserSetting(pBIOSInfo);
+ VIASwitchMode(0, pScrn->currentMode, 0);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_STD_PAL :
+ pBIOSInfo->TVType = TVTYPE_PAL;
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ VIASaveUserSetting(pBIOSInfo);
+ VIASwitchMode(0, pScrn->currentMode, 0);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ default :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ break;
+ }
+ break;
+ case UT_XV_FUNC_TV_GetSupportSignalTypeState :
+ VIAGetActiveDisplay(pBIOSInfo);
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ dwSupportState = UT_TV_SGNL_COMPOSITE | UT_TV_SGNL_S_VIDEO;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ dwSupportState = UT_TV_SGNL_COMPOSITE | UT_TV_SGNL_S_VIDEO |
+ UT_TV_SGNL_SCART | UT_TV_SGNL_COMP_OUTPUT;
+ break;
+ case VIA_SAA7108:
+ dwSupportState = UT_TV_SGNL_COMPOSITE | UT_TV_SGNL_S_VIDEO |
+ UT_TV_SGNL_SCART | UT_TV_SGNL_COMP_OUTPUT;
+ break;
+ case VIA_FS454:
+ dwSupportState = UT_TV_SGNL_COMPOSITE | UT_TV_SGNL_S_VIDEO |
+ UT_TV_SGNL_SCART;
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ dwSupportState = UT_TV_SGNL_COMPOSITE | UT_TV_SGNL_S_VIDEO;
+ break;
+ default:
+ dwSupportState = 0;
+ break;
+ }
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwSupportState, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_TV_GetSignalType :
+ dwSignalType = pBIOSInfo->TVOutput;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwSignalType, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_TV_SetSignalType :
+ InParam += 4;
+ dwInData = *((CARD32 *)InParam);
+ switch (dwInData) {
+ case UT_TV_SGNL_COMPOSITE :
+ pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE;
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ VIASaveUserSetting(pBIOSInfo);
+ VIASwitchMode(0, pScrn->currentMode, 0);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_SGNL_S_VIDEO :
+ pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO;
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ VIASaveUserSetting(pBIOSInfo);
+ VIASwitchMode(0, pScrn->currentMode, 0);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_SGNL_SCART :
+ pBIOSInfo->TVOutput = TVOUTPUT_RGB;
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ VIASaveUserSetting(pBIOSInfo);
+ VIASwitchMode(0, pScrn->currentMode, 0);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_SGNL_COMP_OUTPUT :
+ pBIOSInfo->TVOutput = TVOUTPUT_YCBCR;
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ VIASaveUserSetting(pBIOSInfo);
+ VIASwitchMode(0, pScrn->currentMode, 0);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ default :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ break;
+ }
+ break;
+ case UT_XV_FUNC_TV_GetMaxViewSizeValue :
+ switch (pBIOSInfo->TVEncoder){
+ case VIA_TV2PLUS :
+ case VIA_TV3:
+ case VIA_VT1622A:
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ MaxViewSizeValue.dwX = 0;
+ MaxViewSizeValue.dwY = 2;
+ break;
+ default :
+ MaxViewSizeValue.dwX = 0;
+ MaxViewSizeValue.dwY = 0;
+ break;
+ }
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &MaxViewSizeValue, sizeof(UTXYVALUE));
+ break;
+ case UT_XV_FUNC_TV_GetViewSizeValue :
+ ViewSizeValue.dwX = 0;
+ ViewSizeValue.dwY = pBIOSInfo->TVVScan + 1;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &ViewSizeValue, sizeof(UTXYVALUE));
+ break;
+ case UT_XV_FUNC_TV_SetViewSizeValue :
+ InParam = buf + 12;
+ memcpy(&ViewSizeValue, (void *)InParam, sizeof(UTXYVALUE));
+ if (ViewSizeValue.dwY == 0xFFFF) {
+ pBIOSInfo->TVVScan = VIA_TVNORMAL;
+ }
+ else {
+ pBIOSInfo->TVVScan = (int)ViewSizeValue.dwY - 1;
+ }
+ VIASaveUserSetting(pBIOSInfo);
+ VIASwitchMode(0, pScrn->currentMode, 0);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+
+ /*switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS :
+ if (ViewSizeValue.dwY == 0xFFFF)
+ pBIOSInfo->TVVScan = VIA_TVNORMAL;
+ else
+ pBIOSInfo->TVVScan = (int)ViewSizeValue.dwY - 1;
+ VIAPreSetTV2Mode(pBIOSInfo);
+ VIAPostSetTV2Mode(pBIOSInfo);
+ VIASaveUserSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case VIA_TV3 :
+ if (ViewSizeValue.dwY == 0xFFFF)
+ pBIOSInfo->TVVScan = VIA_TVNORMAL;
+ else
+ pBIOSInfo->TVVScan = (int)ViewSizeValue.dwY - 1;
+ VIAPreSetTV3Mode(pBIOSInfo);
+ VIAPostSetTV3Mode(pBIOSInfo);
+ VIASaveUserSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ if (ViewSizeValue.dwY == 0xFFFF)
+ pBIOSInfo->TVVScan = VIA_TVNORMAL;
+ else
+ pBIOSInfo->TVVScan = (int)ViewSizeValue.dwY - 1;
+ VIAPreSetCH7019Mode(pBIOSInfo);
+ VIAPostSetCH7019Mode(pBIOSInfo);
+ VIASaveUserSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case VIA_SAA7108:
+ if (ViewSizeValue.dwY == 0xFFFF)
+ pBIOSInfo->TVVScan = VIA_TVNORMAL;
+ else
+ pBIOSInfo->TVVScan = (int)ViewSizeValue.dwY - 1;
+ VIAPreSetSAA7108Mode(pBIOSInfo);
+ VIAPostSetSAA7108Mode(pBIOSInfo);
+ VIASaveUserSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ default :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ break;
+ }*/
+ case UT_XV_FUNC_TV_GetMaxViewPositionValue :
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ MaxViewPosValue.dwX = 0;
+ MaxViewPosValue.dwY = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ MaxViewPosValue.dwX = 11; /* 9 bit, [0:7]08H, [2]1CH */
+ MaxViewPosValue.dwY = 11; /* 9 bit, [0:7]09H, [1]1CH */
+ break;
+ case VIA_SAA7108:
+ MaxViewPosValue.dwX = 11;
+ MaxViewPosValue.dwY = 11;
+ break;
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ MaxViewPosValue.dwX = 0;
+ MaxViewPosValue.dwY = 0;
+ break;
+ }
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &MaxViewPosValue, sizeof(UTXYVALUE));
+ break;
+ case UT_XV_FUNC_TV_GetViewPositionValue :
+ InParam = buf + 12;
+ memcpy(&ViewPosValue, (void *)InParam, sizeof(UTXYVALUE));
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ ViewPosValue.dwX = 0;
+ ViewPosValue.dwY = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ if (ViewPosValue.dwX == 0xFFFF && ViewPosValue.dwY == 0xFFFF) {
+ /*value = TV[0x1C];
+ ViewPosValue.dwX = (CARD32)(TV[0x08] & 0xFF);
+ ViewPosValue.dwX |= (CARD32)((value & 0x04) << 6);
+ ViewPosValue.dwY = (CARD32)(TV[0x09] & 0xFF);
+ ViewPosValue.dwY |= (CARD32)((value & 0x02) << 7);*/
+ ViewPosValue.dwX = 6;
+ ViewPosValue.dwY = 6;
+ }
+ else {
+ ViewPosValue.dwX = pUTUSERSETTING->UT_TV_HPOSITION;
+ ViewPosValue.dwY = pUTUSERSETTING->UT_TV_VPOSITION;
+ }
+ break;
+ case VIA_SAA7108:
+ if (ViewPosValue.dwX == 0xFFFF && ViewPosValue.dwY == 0xFFFF) {
+ ViewPosValue.dwX = 6;
+ ViewPosValue.dwY = 6;
+ }
+ else {
+ ViewPosValue.dwX = pUTUSERSETTING->UT_TV_HPOSITION;
+ ViewPosValue.dwY = pUTUSERSETTING->UT_TV_VPOSITION;
+ }
+ break;
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ ViewPosValue.dwX = 0;
+ ViewPosValue.dwY = 0;
+ break;
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &ViewPosValue, sizeof(UTXYVALUE));
+ break;
+ case UT_XV_FUNC_TV_SetViewPositionValue :
+ InParam = buf + 12;
+ memcpy(&ViewPosValue, (void *)InParam, sizeof(UTXYVALUE));
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ pUTUSERSETTING->UT_TV_HPOSITION = 0;
+ pUTUSERSETTING->UT_TV_VPOSITION = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ if (ViewPosValue.dwX == 0xFFFF && ViewPosValue.dwX == 0xFFFF) {
+ W_Buffer[0] = 0x1C;
+ W_Buffer[1] = TV[0x1C];
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x08;
+ W_Buffer[1] = TV[0x08];
+ W_Buffer[2] = TV[0x09];
+ xf86I2CWriteRead(dev, W_Buffer,3, NULL,0);
+ /*value = TV[0x1C];
+ pUTUSERSETTING->UT_TV_HPOSITION = TV[0x08] & 0xFF;
+ pUTUSERSETTING->UT_TV_HPOSITION |= (value & 0x04) << 6;
+ pUTUSERSETTING->UT_TV_VPOSITION = TV[0x09] & 0xFF;
+ pUTUSERSETTING->UT_TV_VPOSITION |= (value & 0x02) << 7;*/
+ pUTUSERSETTING->UT_TV_HPOSITION = 6;
+ pUTUSERSETTING->UT_TV_VPOSITION = 6;
+ }
+ else {
+ W_Buffer[0] = 0x08;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,2);
+ HPos = R_Buffer[0];
+ VPos = R_Buffer[1];
+ W_Buffer[0] = 0x1C;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ HPos |= (R_Buffer[0] & 0x04) << 6;
+ VPos |= (R_Buffer[0] & 0x02) << 7;
+
+ HPos += ViewPosValue.dwX - pUTUSERSETTING->UT_TV_HPOSITION;
+ VPos += ViewPosValue.dwY - pUTUSERSETTING->UT_TV_VPOSITION;
+
+ W_Buffer[0] = 0x08;
+ W_Buffer[1] = HPos & 0xFF;
+ W_Buffer[2] = VPos & 0xFF;
+ xf86I2CWriteRead(dev, W_Buffer,3, NULL,0);
+
+ W_Buffer[0] = 0x1C;
+ W_Buffer[1] = R_Buffer[0] & ~0x06; /* [2]1CH, [1]1CH */
+ W_Buffer[1] |= (HPos >> 6) & 0x04;
+ W_Buffer[1] |= (VPos >> 7) & 0x02;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+
+ pUTUSERSETTING->UT_TV_HPOSITION = ViewPosValue.dwX;
+ pUTUSERSETTING->UT_TV_VPOSITION = ViewPosValue.dwY;
+ }
+ break;
+ case VIA_SAA7108:
+ if (ViewPosValue.dwX == 0xFFFF && ViewPosValue.dwX == 0xFFFF) {
+ for (i = 0; i < 3; i++) {
+ W_Buffer[0] = VIASAA7108PostionOffset[i];
+ if (pBIOSInfo->TVVScan == VIA_TVNORMAL)
+ W_Buffer[1] = VIASAA7108PostionNormalTabRec[pBIOSInfo->TVType - 1][tvIndx][5][i];
+ else
+ W_Buffer[1] = VIASAA7108PostionOverTabRec[pBIOSInfo->TVType - 1][tvIndx][5][i];
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ }
+ W_Buffer[0] = 0x72;
+ W_Buffer[1] = TV[0x72];
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x70;
+ W_Buffer[1] = TV[0x70];
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x72;
+ W_Buffer[1] = TV[0x72];
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x71;
+ W_Buffer[1] = TV[0x71];
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ pUTUSERSETTING->UT_TV_HPOSITION = 6;
+ pUTUSERSETTING->UT_TV_VPOSITION = 6;
+ }
+ else {
+ for (i = 0; i < 3; i++) {
+ W_Buffer[0] = VIASAA7108PostionOffset[i];
+ if (pBIOSInfo->TVVScan == VIA_TVNORMAL)
+ W_Buffer[1] = VIASAA7108PostionNormalTabRec[pBIOSInfo->TVType - 1][tvIndx][ViewPosValue.dwY][i];
+ else
+ W_Buffer[1] = VIASAA7108PostionOverTabRec[pBIOSInfo->TVType - 1][tvIndx][ViewPosValue.dwY][i];
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ }
+ W_Buffer[0] = 0x70;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,3);
+ ADWHS = R_Buffer[0] | ((R_Buffer[2] & 0x07) << 8);
+ ADWHE = R_Buffer[1] | ((R_Buffer[2] & 0x70) << 4);
+ switch (ViewPosValue.dwX - pUTUSERSETTING->UT_TV_HPOSITION) {
+ case 1: /* Moving Right by 1 unit */
+ ADWHS++;
+ ADWHE++;
+ W_Buffer[0] = 0x72;
+ W_Buffer[1] = (R_Buffer[2] & ~0x77) | ((ADWHS & 0x700) >> 8) | ((ADWHE & 0x700) >> 4);
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x70;
+ W_Buffer[1] = ADWHS & 0xFF;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x72;
+ W_Buffer[1] = (R_Buffer[2] & ~0x77) | ((ADWHS & 0x700) >> 8) | ((ADWHE & 0x700) >> 4);
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x71;
+ W_Buffer[1] = ADWHE & 0xFF;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case -1: /* Moving Left by 1 unit */
+ ADWHS--;
+ ADWHE--;
+ W_Buffer[0] = 0x72;
+ W_Buffer[1] = (R_Buffer[2] & ~0x77) | ((ADWHS & 0x700) >> 8) | ((ADWHE & 0x700) >> 4);
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x71;
+ W_Buffer[1] = ADWHE & 0xFF;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x72;
+ W_Buffer[1] = (R_Buffer[2] & ~0x77) | ((ADWHS & 0x700) >> 8) | ((ADWHE & 0x700) >> 4);
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x70;
+ W_Buffer[1] = ADWHS & 0xFF;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ default:
+ break;
+ }
+ pUTUSERSETTING->UT_TV_HPOSITION = ViewPosValue.dwX;
+ pUTUSERSETTING->UT_TV_VPOSITION = ViewPosValue.dwY;
+ }
+ break;
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ pUTUSERSETTING->UT_TV_HPOSITION = 0;
+ pUTUSERSETTING->UT_TV_VPOSITION = 0;
+ break;
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ VIASaveUserSetting(pBIOSInfo);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ }
+ break;
+ case UT_XV_FUNC_TV_GetSupportTuningState :
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ dwSupportState = UT_TV_TUNING_FFILTER |
+ UT_TV_TUNING_BRIGHTNESS |
+ UT_TV_TUNING_CONTRAST |
+ UT_TV_TUNING_SATURATION |
+ UT_TV_TUNING_TINT;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ dwSupportState = UT_TV_TUNING_FFILTER |
+ UT_TV_TUNING_ADAPTIVE_FFILTER |
+ UT_TV_TUNING_BRIGHTNESS |
+ UT_TV_TUNING_CONTRAST |
+ UT_TV_TUNING_SATURATION |
+ UT_TV_TUNING_TINT;
+ break;
+ case VIA_SAA7108:
+ dwSupportState = UT_TV_TUNING_FFILTER;
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ dwSupportState = UT_TV_TUNING_FFILTER |
+ UT_TV_TUNING_ADAPTIVE_FFILTER |
+ UT_TV_TUNING_BRIGHTNESS |
+ UT_TV_TUNING_CONTRAST;
+ break;
+ case VIA_FS454:
+ default:
+ dwSupportState = 0;
+ break;
+ }
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwSupportState, sizeof(UTXYVALUE));
+ break;
+ case UT_XV_FUNC_TV_GetTuningItemMaxValue : /* 0 BASE */
+ InParam += 4;
+ dwInData = *((CARD32 *)InParam);
+ switch (dwInData) {
+ case UT_TV_TUNING_FFILTER :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ switch (pBIOSInfo->TVEncoder){
+ case VIA_TV2PLUS:
+ dwMaxValue = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ dwMaxValue = 3; /* 2bit, [1:0]03H */
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ case VIA_SAA7108:
+ dwMaxValue = 3;
+ break;
+ default :
+ dwMaxValue = 0;
+ break;
+ }
+ break;
+ case UT_TV_TUNING_ADAPTIVE_FFILTER :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ switch (pBIOSInfo->TVEncoder){
+ case VIA_TV2PLUS :
+ dwMaxValue = 0; /* TV2Plus No Adaptive Flicker */
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ dwMaxValue = 255; /* 8bit, [7:0]61H */
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default :
+ dwMaxValue = 0;
+ break;
+ }
+ break;
+ case UT_TV_TUNING_BRIGHTNESS :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ switch (pBIOSInfo->TVEncoder){
+ case VIA_TV2PLUS :
+ dwMaxValue = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ dwMaxValue = 255; /* 8bit, [7:0]0BH */
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default :
+ dwMaxValue = 0;
+ break;
+ }
+ break;
+ case UT_TV_TUNING_CONTRAST :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ switch (pBIOSInfo->TVEncoder){
+ case VIA_TV2PLUS :
+ dwMaxValue = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ dwMaxValue = 255; /* 8bit, [7:0]0CH */
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default :
+ dwMaxValue = 0;
+ break;
+ }
+ break;
+ case UT_TV_TUNING_SATURATION :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ switch (pBIOSInfo->TVEncoder){
+ case VIA_TV2PLUS :
+ dwMaxValue = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ dwMaxValue = 65535; /* 16bit, [7:0]0AH, [7:0]0DH */
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default :
+ dwMaxValue = 0;
+ break;
+ }
+ break;
+ case UT_TV_TUNING_TINT :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ switch (pBIOSInfo->TVEncoder){
+ case VIA_TV2PLUS :
+ dwMaxValue = 2047; /* 11bit, [7:0]10H, [7:5]11H */
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ dwMaxValue = 2047; /* 11bit, [7:0]10H, [2:0]11H */
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default :
+ dwMaxValue = 0;
+ break;
+ }
+ break;
+ default :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ dwMaxValue = 0;
+ break;
+ }
+ InParam += 4;
+ memcpy((void *)InParam, &dwMaxValue, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_TV_GetTuningItemValue :
+ InParam += 4;
+ dwInData = *((CARD32 *)InParam);
+ switch (dwInData) {
+ case UT_TV_TUNING_FFILTER :
+ dwValue = pUTUSERSETTING->UT_TV_FFILTER;
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_TUNING_ADAPTIVE_FFILTER :
+ dwValue = pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER;
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_TUNING_BRIGHTNESS :
+ dwValue = pUTUSERSETTING->UT_TV_BRIGHTNESS;
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_TUNING_CONTRAST :
+ dwValue = pUTUSERSETTING->UT_TV_CONTRAST;
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_TUNING_SATURATION :
+ dwValue = pUTUSERSETTING->UT_TV_SATURATION;
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_TUNING_TINT :
+ dwValue = pUTUSERSETTING->UT_TV_TINT;
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ default :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ dwValue = 0;
+ break;
+ }
+ InParam += 4;
+ memcpy((void *)InParam, &dwValue, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_TV_SetTuningItemValue :
+ InParam = buf + 12;
+ memcpy(&pUTSETTVTUNINGINFO, (void *)InParam, sizeof(UTSETTVTUNINGINFO));
+ switch (pUTSETTVTUNINGINFO.dwItemID) {
+ case UT_TV_TUNING_FFILTER :
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ pUTUSERSETTING->UT_TV_FFILTER = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ if (pUTSETTVTUNINGINFO.dwValue == 0xFFFF) {
+ W_Buffer[0] = 0x03;
+ W_Buffer[1] = TV[0x03];
+ pUTUSERSETTING->UT_TV_FFILTER = TV[0x03] & 0x03;
+ if(pUTUSERSETTING->UT_TV_FFILTER == 0)
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = TRUE;
+ }
+ else {
+ W_Buffer[0] = 0x03;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] & ~0x03;
+ W_Buffer[1] |= pUTSETTVTUNINGINFO.dwValue;
+ pUTUSERSETTING->UT_TV_FFILTER = pUTSETTVTUNINGINFO.dwValue;
+ }
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_SAA7108:
+ if (pUTSETTVTUNINGINFO.dwValue == 0xFFFF) {
+ W_Buffer[0] = 0x37;
+ W_Buffer[1] = TV[0x37];
+ pUTUSERSETTING->UT_TV_FFILTER = (TV[0x37] & 0x30) + 1;
+ }
+ else {
+ W_Buffer[0] = 0x37;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] & ~0x30;
+ W_Buffer[1] |= (unsigned char)(pUTSETTVTUNINGINFO.dwValue - 1);
+ pUTUSERSETTING->UT_TV_FFILTER = pUTSETTVTUNINGINFO.dwValue;
+ }
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ pUTUSERSETTING->UT_TV_FFILTER = 0;
+ break;
+ }
+
+ VIASaveUserSetting(pBIOSInfo);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_TV_TUNING_ADAPTIVE_FFILTER :
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ if (pUTSETTVTUNINGINFO.dwValue == 0xFFFF) {
+ W_Buffer[0] = 0x61;
+ W_Buffer[1] = TV[0x61];
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER = TV[0x61] & 0xFF;
+ }
+ else {
+ W_Buffer[0] = 0x61;
+ W_Buffer[1] = (unsigned char)pUTSETTVTUNINGINFO.dwValue;
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER = pUTSETTVTUNINGINFO.dwValue;
+ }
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER = 0;
+ break;
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ VIASaveUserSetting(pBIOSInfo);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_TV_TUNING_BRIGHTNESS :
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ pUTUSERSETTING->UT_TV_BRIGHTNESS = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ W_Buffer[0] = 0x0B;
+ if (pUTSETTVTUNINGINFO.dwValue == 0xFFFF) {
+ W_Buffer[1] = TV[0x0B];
+ pUTUSERSETTING->UT_TV_BRIGHTNESS = TV[0x0B] & 0xFF;
+ }
+ else {
+ W_Buffer[1] = (unsigned char)pUTSETTVTUNINGINFO.dwValue;
+ pUTUSERSETTING->UT_TV_BRIGHTNESS = pUTSETTVTUNINGINFO.dwValue;
+ }
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ pUTUSERSETTING->UT_TV_BRIGHTNESS = 0;
+ break;
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+ VIASaveUserSetting(pBIOSInfo);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_TV_TUNING_CONTRAST :
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ pUTUSERSETTING->UT_TV_CONTRAST = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ W_Buffer[0] = 0x0C;
+ if (pUTSETTVTUNINGINFO.dwValue == 0xFFFF) {
+ W_Buffer[1] = TV[0x0C];
+ pUTUSERSETTING->UT_TV_CONTRAST = TV[0x0C] & 0xFF;
+ }
+ else {
+ W_Buffer[1] = (unsigned char)pUTSETTVTUNINGINFO.dwValue;
+ pUTUSERSETTING->UT_TV_CONTRAST = pUTSETTVTUNINGINFO.dwValue;
+ }
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ pUTUSERSETTING->UT_TV_CONTRAST = 0;
+ break;
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+ VIASaveUserSetting(pBIOSInfo);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_TV_TUNING_SATURATION :
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ pUTUSERSETTING->UT_TV_SATURATION = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ if (pUTSETTVTUNINGINFO.dwValue == 0xFFFF) {
+ W_Buffer[0] = 0x0D;
+ W_Buffer[1] = TV[0x0D];
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x0A;
+ W_Buffer[1] = TV[0x0A];
+ value = TV[0x0D];
+ pUTUSERSETTING->UT_TV_SATURATION = TV[0x0A] & 0xFF;
+ pUTUSERSETTING->UT_TV_SATURATION |= value << 8;
+ }
+ else {
+ W_Buffer[0] = 0x0D;
+ W_Buffer[1] = (unsigned char)((pUTSETTVTUNINGINFO.dwValue >> 8) & 0xFF);
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x0A;
+ W_Buffer[1] = (unsigned char)(pUTSETTVTUNINGINFO.dwValue & 0xFF);
+ pUTUSERSETTING->UT_TV_SATURATION = pUTSETTVTUNINGINFO.dwValue;
+ }
+ xf86I2CWriteRead(dev, W_Buffer,3, NULL,0);
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ pUTUSERSETTING->UT_TV_SATURATION = 0;
+ break;
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+ VIASaveUserSetting(pBIOSInfo);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_TV_TUNING_TINT :
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ if (pUTSETTVTUNINGINFO.dwValue == 0xFFFF) {
+ W_Buffer[0] = 0x10;
+ W_Buffer[1] = TV[0x10];
+ W_Buffer[2] = TV[0x11];
+ pUTUSERSETTING->UT_TV_TINT = TV[0x10] & 0xFF;
+ pUTUSERSETTING->UT_TV_TINT |= (TV[0x11] & 0xE0) << 3;
+ }
+ else {
+ W_Buffer[0] = 0x11;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[2] = R_Buffer[0] & ~0xE0;
+ W_Buffer[2] |= (unsigned char)((pUTSETTVTUNINGINFO.dwValue >> 3) & 0xFF);
+ W_Buffer[0] = 0x10;
+ W_Buffer[1] = (unsigned char)(pUTSETTVTUNINGINFO.dwValue & 0xFF);
+ pUTUSERSETTING->UT_TV_TINT = pUTSETTVTUNINGINFO.dwValue;
+ }
+ xf86I2CWriteRead(dev, W_Buffer,3, NULL,0);
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ if (pUTSETTVTUNINGINFO.dwValue == 0xFFFF) {
+ W_Buffer[0] = 0x10;
+ W_Buffer[1] = TV[0x10];
+ W_Buffer[2] = TV[0x11];
+ value = TV[0x11];
+ pUTUSERSETTING->UT_TV_TINT = TV[0x10] & 0xFF;
+ pUTUSERSETTING->UT_TV_TINT |= TV[0x11] << 8;
+ }
+ else {
+ W_Buffer[0] = 0x11;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[2] = R_Buffer[0] & ~0x07;
+ W_Buffer[2] |= (unsigned char)(pUTSETTVTUNINGINFO.dwValue >> 8) & 0xFF;
+ W_Buffer[0] = 0x10;
+ W_Buffer[1] = (unsigned char)(pUTSETTVTUNINGINFO.dwValue & 0xFF);
+ pUTUSERSETTING->UT_TV_TINT = pUTSETTVTUNINGINFO.dwValue;
+ }
+ xf86I2CWriteRead(dev, W_Buffer,3, NULL,0);
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ pUTUSERSETTING->UT_TV_TINT = 0;
+ break;
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+ VIASaveUserSetting(pBIOSInfo);
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ }
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ default :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ break;
+ }
+ break;
+ case UT_XV_FUNC_TV_GetSupportSettingState :
+ dwItemID |= UT_TV_SETTING_FFILTER;
+ switch (pBIOSInfo->TVEncoder){
+ case VIA_TV3:
+ case VIA_VT1622A:
+ dwItemID |= UT_TV_SETTING_ADAPTIVE_FFILTER;
+ if (pBIOSInfo->TVType == TVTYPE_NTSC)
+ dwItemID |= UT_TV_SETTING_DOT_CRAWL;
+ break;
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ if (pBIOSInfo->TVType == TVTYPE_NTSC)
+ dwItemID |= UT_TV_SETTING_DOT_CRAWL;
+ break;
+ default :
+ break;
+ }
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwItemID, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_TV_GetSettingItemState :
+ InParam += 4;
+ dwInData = *((CARD32 *)InParam);
+ switch (dwInData) {
+ case UT_TV_SETTING_FFILTER :
+ if (pUTUSERSETTING->UT_TV_FFILTER)
+ dwState = UT_STATE_ON;
+ else
+ dwState = UT_STATE_OFF;
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_SETTING_ADAPTIVE_FFILTER :
+ if (pUTUSERSETTING->UT_TV_FFILTER)
+ dwState = UT_STATE_OFF;
+ else
+ dwState = UT_STATE_ON;
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_SETTING_DOT_CRAWL :
+ if(pBIOSInfo->TVDotCrawl)
+ dwState = UT_STATE_ON;
+ else
+ dwState = UT_STATE_OFF;
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ break;
+ case UT_TV_SETTING_LOCK_ASPECT_RATIO :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetNoFunc, sizeof(CARD32));
+ dwState = UT_STATE_OFF;
+ break;
+ default :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ dwState = UT_STATE_OFF;
+ break;
+ }
+ InParam += 4;
+ memcpy((void *)InParam, &dwState, sizeof(CARD32));
+ break;
+ case UT_XV_FUNC_TV_SetSettingItemState :
+ InParam = buf + 12;
+ memcpy(&pUTSETTVITEMSTATE, (void *)InParam, sizeof(UTSETTVITEMSTATE));
+ switch (pUTSETTVITEMSTATE.dwItemID) {
+ case UT_TV_SETTING_FFILTER :
+ if (pUTSETTVITEMSTATE.dwState == UT_STATE_OFF) {
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ case VIA_TV3:
+ case VIA_VT1622A:
+ W_Buffer[0] = 0x03;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] & ~0x03;
+ break;
+ case VIA_SAA7108:
+ W_Buffer[0] = 0x37;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] & ~0x30;
+ break;
+ }
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = TRUE;
+ VIASaveUserSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ }
+ }
+ else if (pUTSETTVITEMSTATE.dwState == UT_STATE_ON) {
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ case VIA_TV3:
+ case VIA_VT1622A:
+ W_Buffer[0] = 0x03;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] & ~0x03;
+ W_Buffer[1] |= (unsigned char)(pUTUSERSETTING->UT_TV_FFILTER - 1);
+ break;
+ case VIA_SAA7108:
+ W_Buffer[0] = 0x37;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] & ~0x30;
+ W_Buffer[1] |= (unsigned char)((pUTUSERSETTING->UT_TV_FFILTER - 1) << 4);
+ break;
+ }
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = FALSE;
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ }
+ }
+ else {
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_TV_SETTING_ADAPTIVE_FFILTER :
+ if (pUTSETTVITEMSTATE.dwState == UT_STATE_OFF) {
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = FALSE;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ W_Buffer[0] = 0x61;
+ W_Buffer[1] = 0x00;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ xf86DestroyI2CDevRec(dev,TRUE);
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = FALSE;
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = FALSE;
+ break;
+ }
+ VIASaveUserSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ }
+ }
+ else if (pUTSETTVITEMSTATE.dwState == UT_STATE_ON) {
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = FALSE;
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER = 0;
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ W_Buffer[0] = 0x03;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] & ~0x03;
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x61;
+ W_Buffer[1] = (unsigned char)pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER;
+ xf86DestroyI2CDevRec(dev,TRUE);
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = TRUE;
+ break;
+ case VIA_SAA7108:
+ case VIA_FS454:
+ case VIA_CH7009:
+ case VIA_CH7019:
+ default:
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = FALSE;
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER = 0;
+ break;
+ }
+ VIASaveUserSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ }
+ }
+ else {
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_TV_SETTING_DOT_CRAWL :
+ if (pUTSETTVITEMSTATE.dwState == UT_STATE_OFF) {
+ pBIOSInfo->TVDotCrawl = FALSE;
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ VIAPreSetTV2Mode(pBIOSInfo);
+ VIAPostSetTV2Mode(pBIOSInfo);
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ VIAPreSetTV3Mode(pBIOSInfo);
+ VIAPostSetTV3Mode(pBIOSInfo);
+ break;
+ case VIA_FS454:
+ VIAPreSetFS454Mode(pBIOSInfo);
+ VIAPostSetFS454Mode(pBIOSInfo);
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ VIAPreSetCH7019Mode(pBIOSInfo);
+ VIAPostSetCH7019Mode(pBIOSInfo);
+ break;
+ }
+ VIASaveUserSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else if (pUTSETTVITEMSTATE.dwState == UT_STATE_ON) {
+ pBIOSInfo->TVDotCrawl = TRUE;
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ VIAPreSetTV2Mode(pBIOSInfo);
+ VIAPostSetTV2Mode(pBIOSInfo);
+ break;
+ case VIA_TV3:
+ case VIA_VT1622A:
+ VIAPreSetTV3Mode(pBIOSInfo);
+ VIAPostSetTV3Mode(pBIOSInfo);
+ break;
+ case VIA_FS454:
+ VIAPreSetFS454Mode(pBIOSInfo);
+ VIAPostSetFS454Mode(pBIOSInfo);
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ VIAPreSetCH7019Mode(pBIOSInfo);
+ VIAPostSetCH7019Mode(pBIOSInfo);
+ break;
+ }
+ VIASaveUserSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_TV_SETTING_LOCK_ASPECT_RATIO :
+ if (pUTSETTVITEMSTATE.dwState == UT_STATE_OFF) {
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetNoFunc, sizeof(CARD32));
+ }
+ else if (pUTSETTVITEMSTATE.dwState == UT_STATE_ON) {
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetNoFunc, sizeof(CARD32));
+ }
+ else {
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ default :
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ break;
+ }
+ break;
+ default :
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ InParam += 4;
+ ErrorF(" via_utility.c : dwAction not supported\n");
+ break;
+ }
+ break;
+ case UT_XV_FUNC_GAMMA :
+ switch(dwAction)
+ {
+ case UT_ESC_FUNC_GAMMA_GetDeviceSupportState :
+ if (pScrn->bitsPerPixel == 8)
+ dwSupportState = UT_DEVICE_NONE;
+ else
+ dwSupportState = UT_DEVICE_CRT1 | UT_DEVICE_TV | UT_DEVICE_DFP | UT_DEVICE_LCD;
+ /*dwSupportState = UT_DEVICE_NONE;*/
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, &dwSupportState, sizeof(CARD32));
+ break;
+ case UT_ESC_FUNC_GAMMA_GetLookUpTable :
+ if (VIASavePalette(pScrn, pBIOSInfo->colors)) {
+ for (i=0; i<256; i++) {
+ pUTGAMMAINFO.LookUpTable[i] = ((CARD32)pBIOSInfo->colors[i].red) << 16;
+ pUTGAMMAINFO.LookUpTable[i] |= ((CARD32)pBIOSInfo->colors[i].green) << 8;
+ pUTGAMMAINFO.LookUpTable[i] |= (CARD32)pBIOSInfo->colors[i].blue;
+ }
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, pUTGAMMAINFO.LookUpTable, sizeof(pUTGAMMAINFO.LookUpTable));
+ }
+ else {
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_ESC_FUNC_GAMMA_SetLookUpTable :
+ InParam = buf + 12;
+ memcpy(&pUTGAMMAINFO, (void *)InParam, sizeof(UTGAMMAINFO));
+ if(pUTGAMMAINFO.LookUpTable[0] == 0xFFFFFFFF) { /* Set default gamma value */
+ for (i=0; i<256; i++) {
+ pBIOSInfo->colors[i].red = i;
+ pBIOSInfo->colors[i].green = i;
+ pBIOSInfo->colors[i].blue = i;
+ }
+ }
+ else {
+ for (i=0; i<256; i++) {
+ pBIOSInfo->colors[i].red = (unsigned short)(pUTGAMMAINFO.LookUpTable[i] >> 16);
+ pBIOSInfo->colors[i].green = (unsigned short)(pUTGAMMAINFO.LookUpTable[i] >> 8) & 0x00FF;
+ pBIOSInfo->colors[i].blue = (unsigned short)(pUTGAMMAINFO.LookUpTable[i] & 0x000000FF);
+ }
+ }
+ if (VIARestorePalette(pScrn, pBIOSInfo->colors)) {
+ VIASaveGammaSetting(pBIOSInfo);
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ }
+ else {
+ InParam = buf + 8;
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ }
+ break;
+ case UT_ESC_FUNC_GAMMA_GetDefaultLookUpTable :
+ for (i=0; i<256; i++) {
+ pUTGAMMAINFO.LookUpTable[i] = (CARD32)i << 16;
+ pUTGAMMAINFO.LookUpTable[i] |= (CARD32)i << 8;
+ pUTGAMMAINFO.LookUpTable[i] |= (CARD32)i;
+ }
+ memcpy((void *)InParam, &dwUTRetOK, sizeof(CARD32));
+ InParam += 4;
+ memcpy((void *)InParam, pUTGAMMAINFO.LookUpTable, sizeof(pUTGAMMAINFO.LookUpTable));
+ break;
+ default :
+ memcpy((void *)InParam, &dwUTRetNoFunc, sizeof(CARD32));
+ InParam += 4;
+ ErrorF(" via_utility.c : dwAction not supported\n");
+ break;
+ }
+ break;
+ default:
+ ErrorF(" via_utility.c : dwFunc not supported\n");
+ memcpy((void *)InParam, &dwUTRetFail, sizeof(CARD32));
+ InParam += 4;
+ break;
+ } /* end of switch */
+}
+
+Bool UTGetInfo(VIABIOSInfoPtr pBIOSInfo)
+{
+ UTUSERSETTINGptr pUTUSERSETTING = pBIOSInfo->pUTUSERSETTING;
+ I2CDevPtr dev;
+ unsigned char W_Buffer[3];
+ unsigned char R_Buffer[2];
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "UTGetInfo\n"));
+ if (pBIOSInfo->TVEncoder) {
+ if (xf86I2CProbeAddress(pBIOSInfo->I2C_Port2, pBIOSInfo->TVI2CAdd)) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+
+ if (xf86I2CDevInit(dev)) {
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV2PLUS:
+ case VIA_TV3:
+ case VIA_VT1622A:
+ pUTUSERSETTING->UT_TV_HPOSITION = 6;
+ pUTUSERSETTING->UT_TV_VPOSITION = 6;
+
+ W_Buffer[0] = 0x03;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_FFILTER = (R_Buffer[0] & 0x03) + 1;
+
+ W_Buffer[0] = 0x0B;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_BRIGHTNESS = R_Buffer[0];
+
+ W_Buffer[0] = 0x0C;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_CONTRAST = R_Buffer[0];
+
+ W_Buffer[0] = 0x0D;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_SATURATION = R_Buffer[0] << 8;
+ W_Buffer[0] = 0x0A;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_SATURATION += R_Buffer[0];
+
+ break;
+ case VIA_SAA7108:
+ pUTUSERSETTING->UT_TV_HPOSITION = 6;
+ pUTUSERSETTING->UT_TV_VPOSITION = 6;
+
+ W_Buffer[0] = 0x37;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_FFILTER = ((R_Buffer[0] & 0x30) >> 4) + 1;
+
+ pUTUSERSETTING->UT_TV_BRIGHTNESS = 0;
+ pUTUSERSETTING->UT_TV_CONTRAST = 0;
+ pUTUSERSETTING->UT_TV_SATURATION = 0;
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER = 0;
+ pUTUSERSETTING->UT_TV_TINT = 0;
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = FALSE;
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ case VIA_FS454:
+ default:
+ pUTUSERSETTING->UT_TV_HPOSITION = 0;
+ pUTUSERSETTING->UT_TV_VPOSITION = 0;
+ pUTUSERSETTING->UT_TV_FFILTER = 0;
+ pUTUSERSETTING->UT_TV_BRIGHTNESS = 0;
+ pUTUSERSETTING->UT_TV_CONTRAST = 0;
+ pUTUSERSETTING->UT_TV_SATURATION = 0;
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER = 0;
+ pUTUSERSETTING->UT_TV_TINT = 0;
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = FALSE;
+ break;
+ }
+ if (pBIOSInfo->TVEncoder == VIA_TV2PLUS) {
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER = 0;
+
+ W_Buffer[0] = 0x10;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_TINT = R_Buffer[0];
+ W_Buffer[0] = 0x11;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_TINT += (R_Buffer[0] & 0xE0) << 8;
+ }
+ else if (pBIOSInfo->TVEncoder == VIA_TV3
+ || pBIOSInfo->TVEncoder == VIA_VT1622A) {
+ W_Buffer[0] = 0x61;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER = R_Buffer[0];
+ W_Buffer[0] = 0x10;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_TINT = R_Buffer[0];
+ W_Buffer[0] = 0x11;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ pUTUSERSETTING->UT_TV_TINT += (R_Buffer[0] & 0x07) << 8;
+ if (pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER && !pUTUSERSETTING->UT_TV_FFILTER)
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = TRUE;
+ else
+ pUTUSERSETTING->ADAPTIVE_FFILTER_ON = FALSE;
+ }
+ xf86DestroyI2CDevRec(dev,TRUE);
+ pUTUSERSETTING->DefaultSetting = TRUE;
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ DEBUG(xf86Msg(X_DEFAULT, "DevInit fail!\n"));
+ }
+ }
+ else
+ DEBUG(xf86Msg(X_DEFAULT, "Probe I2C Address fail!\n"));
+ }
+ else
+ DEBUG(xf86Msg(X_DEFAULT, "No TVEncoder Exist!\n"));
+ return TRUE;
+}
+
+Bool VIALoadGammaSetting(VIABIOSInfoPtr pBIOSInfo)
+{
+ FILE *VIARC = NULL;
+ char filename[40], *home = NULL;
+ Bool ret = FALSE;
+ int HDisplay, VDisplay, bitsPerPixel;
+ unsigned int i;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIALoadGammaSetting\n"));
+ home = getenv("HOME");
+ if (home){
+ filename[0] = '\0';
+ strcpy(filename, home);
+ strcat(filename, "/.VIAGAMMARC");
+ if ((VIARC = fopen(filename, "r")) == NULL){
+ DEBUG(xf86Msg(X_WARNING, "No Gamma setting file exist, Create new ones\n"));
+ if ((VIARC = fopen(filename, "a")) == NULL)
+ DEBUG(xf86Msg(X_ERROR, "Create .VIAGAMMARC failure!\n"));
+ }
+ else {
+ /*while (fgets(buffer, 4096, VIARC) != NULL) {
+ sscanf(buffer,"%d %d", &HDisplay, &VDisplay);
+ if (HDisplay == pBIOSInfo->SaveHDisplay && VDisplay == pBIOSInfo->SaveVDisplay) {
+ fscanf(VIARC, "%d", &tmp);
+ fscanf(VIARC, "%d", &tmp);
+ for (i=0; i<256; i++) {
+ fscanf(VIARC, "%hu", &pBIOSInfo->colors[i].red);
+ fscanf(VIARC, "%hu", &pBIOSInfo->colors[i].green);
+ fscanf(VIARC, "%hu", &pBIOSInfo->colors[i].blue);
+ }
+ ret = TRUE;
+ }
+ }*/
+ fseek(VIARC, 0L, SEEK_SET);
+ while (fscanf(VIARC, "%d %d %d", &HDisplay, &VDisplay, &bitsPerPixel) != EOF) {
+ if (HDisplay == pBIOSInfo->SaveHDisplay &&
+ VDisplay == pBIOSInfo->SaveVDisplay &&
+ bitsPerPixel == pBIOSInfo->bitsPerPixel) {
+ for (i=0; i<256; i++) {
+ fscanf(VIARC, "%hu", &pBIOSInfo->colors[i].red);
+ fscanf(VIARC, "%hu", &pBIOSInfo->colors[i].green);
+ fscanf(VIARC, "%hu", &pBIOSInfo->colors[i].blue);
+ /*DEBUG(xf86Msg(X_INFO, "%hu, %hu, %hu\n",
+ pBIOSInfo->colors[i].red, pBIOSInfo->colors[i].green,
+ pBIOSInfo->colors[i].blue));*/
+ }
+ ret = TRUE;
+ }
+ else {
+ if(fseek(VIARC, 1L, SEEK_CUR))
+ break;
+ }
+ }
+ fclose(VIARC);
+ }
+ }
+ return ret;
+}
+
+Bool VIARestoreUserSetting(VIABIOSInfoPtr pBIOSInfo)
+{
+ UTUSERSETTINGptr pUTUSERSETTING = pBIOSInfo->pUTUSERSETTING;
+ I2CDevPtr dev;
+ int i, HPos, VPos, ADWHS, ADWHE;
+ unsigned char W_Buffer[4], R_Buffer[3];
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "TV";
+ dev->SlaveAddr = pBIOSInfo->TVI2CAdd;
+ dev->pI2CBus = pBIOSInfo->I2C_Port2;
+ if (xf86I2CDevInit(dev)) {
+
+ switch (pBIOSInfo->TVEncoder) {
+ case VIA_TV3:
+ case VIA_VT1622A:
+ if ((pUTUSERSETTING->UT_TV_HPOSITION != 6)
+ || (pUTUSERSETTING->UT_TV_VPOSITION != 6)) {
+ W_Buffer[0] = 0x08;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,2);
+ HPos = R_Buffer[0];
+ VPos = R_Buffer[1];
+ W_Buffer[0] = 0x1C;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ HPos |= (R_Buffer[0] & 0x04) << 6;
+ VPos |= (R_Buffer[0] & 0x02) << 7;
+
+ HPos += pUTUSERSETTING->UT_TV_HPOSITION - 6;
+ VPos += pUTUSERSETTING->UT_TV_VPOSITION - 6;
+
+ W_Buffer[0] = 0x08;
+ W_Buffer[1] = (unsigned char)(HPos & 0xFF);
+ W_Buffer[2] = (unsigned char)(VPos & 0xFF);
+ xf86I2CWriteRead(dev, W_Buffer,3, NULL,0);
+
+ W_Buffer[1] = R_Buffer[0] & ~0x06; /* [2]1CH, [1]1CH */
+ W_Buffer[1] |= (unsigned char)((HPos >> 6) & 0x04);
+ W_Buffer[1] |= (unsigned char)((VPos >> 7) & 0x02);
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ }
+
+ W_Buffer[0] = 0x03; /* Fflick */
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ if (pUTUSERSETTING->ADAPTIVE_FFILTER_ON) {
+ W_Buffer[1] = R_Buffer[0] & ~0x03;
+ }
+ else {
+ W_Buffer[1] = R_Buffer[0] & ~0x03;
+ W_Buffer[1] |= (unsigned char)(pUTUSERSETTING->UT_TV_FFILTER - 1);
+ }
+ xf86I2CWriteRead(dev, W_Buffer,2, R_Buffer,0);
+
+ W_Buffer[0] = 0x61; /* Adaptive Fflick */
+ W_Buffer[1] = (unsigned char)pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER;
+ xf86I2CWriteRead(dev, W_Buffer,2, R_Buffer,0);
+
+ W_Buffer[0] = 0x0B; /* BRIGHTNESS */
+ W_Buffer[1] = (unsigned char)pUTUSERSETTING->UT_TV_BRIGHTNESS;
+ xf86I2CWriteRead(dev, W_Buffer,2, R_Buffer,0);
+
+ W_Buffer[0] = 0x0C; /* CONTRAST */
+ W_Buffer[1] = (unsigned char)pUTUSERSETTING->UT_TV_CONTRAST;
+ xf86I2CWriteRead(dev, W_Buffer,2, R_Buffer,0);
+
+ W_Buffer[0] = 0x0D; /* SATURATION highbyte */
+ W_Buffer[1] = (unsigned char)(pUTUSERSETTING->UT_TV_SATURATION >> 8);
+ xf86I2CWriteRead(dev, W_Buffer,2, R_Buffer,0);
+ W_Buffer[0] = 0x0A; /* SATURATION lowbyte */
+ W_Buffer[1] = (unsigned char)pUTUSERSETTING->UT_TV_SATURATION & 0xFF;
+ xf86I2CWriteRead(dev, W_Buffer,2, R_Buffer,0);
+
+ W_Buffer[0] = 0x11; /* TINT highbyte */
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[2] = R_Buffer[0] & ~0xE0;
+ W_Buffer[2] |= (unsigned char)(pUTUSERSETTING->UT_TV_TINT >> 8);
+ W_Buffer[0] = 0x10; /* TINT lowbyte */
+ W_Buffer[1] = (unsigned char)pUTUSERSETTING->UT_TV_TINT & 0xFF;
+ xf86I2CWriteRead(dev, W_Buffer,3, R_Buffer,0);
+ break;
+ case VIA_SAA7108:
+ if ((pUTUSERSETTING->UT_TV_HPOSITION - 6) != 0) {
+ W_Buffer[0] = 0x70;
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,3);
+ ADWHS = (R_Buffer[0] | ((R_Buffer[2] & 0x07) << 8))
+ + (pUTUSERSETTING->UT_TV_HPOSITION - 6);
+ ADWHE = (R_Buffer[1] | ((R_Buffer[2] & 0x70) << 4))
+ + (pUTUSERSETTING->UT_TV_HPOSITION - 6);
+ W_Buffer[0] = 0x70;
+ W_Buffer[1] = ADWHS & 0xFF;
+ W_Buffer[2] = ADWHE & 0xFF;
+ W_Buffer[3] = (R_Buffer[2] & ~0x77) | ((ADWHS & 0x700) >> 8)
+ | ((ADWHE & 0x700) >> 4);
+ xf86I2CWriteRead(dev, W_Buffer,4, NULL,0);
+ }
+ for (i = 0; i < 3; i++) {
+ W_Buffer[0] = VIASAA7108PostionOffset[i];
+ if (pBIOSInfo->TVVScan == VIA_TVNORMAL)
+ W_Buffer[1] = VIASAA7108PostionNormalTabRec[pBIOSInfo->TVType - 1][pBIOSInfo->resTVMode][pUTUSERSETTING->UT_TV_VPOSITION][i];
+ else
+ W_Buffer[1] = VIASAA7108PostionOverTabRec[pBIOSInfo->TVType - 1][pBIOSInfo->resTVMode][pUTUSERSETTING->UT_TV_VPOSITION][i];
+ xf86I2CWriteRead(dev, W_Buffer,2, NULL,0);
+ }
+ W_Buffer[0] = 0x37;
+ W_Buffer[1] = R_Buffer[0] & ~0x30;
+ if (!pUTUSERSETTING->ADAPTIVE_FFILTER_ON) {
+ W_Buffer[1] |= (unsigned char)((pUTUSERSETTING->UT_TV_FFILTER - 1) << 4);
+ }
+ xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1);
+ break;
+ case VIA_CH7009:
+ case VIA_CH7019:
+ case VIA_FS454:
+ default:
+ break;
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+ return TRUE;
+ }
+ else {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ return FALSE;
+ }
+}
+
+Bool VIASaveGammaSetting(VIABIOSInfoPtr pBIOSInfo)
+{
+ FILE *VIARC = NULL, *VIAtmp = NULL;
+ char filename[40], tmpname[40], buffer[4096], *home = NULL;
+ int HDisplay, VDisplay, bitsPerPixel;
+ Bool ret = FALSE;
+ unsigned int found = 0, i;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASaveGammaSetting\n"));
+ home = getenv("HOME");
+ if (home){
+ filename[0] = '\0';
+ strcpy(filename, home);
+ strcat(filename, "/.VIAGAMMARC");
+ if ((VIARC = fopen(filename, "r")) == NULL){
+ xf86Msg(X_DEFAULT, "Open GAMMA setting file failed.\n");
+ if ((VIARC = fopen(filename, "a")) == NULL)
+ DEBUG(xf86Msg(X_ERROR, "Create .VIAGAMMARC failure!\n"));
+ fclose(VIARC);
+ }
+ else {
+ strcpy(tmpname, home);
+ strcat(tmpname, "/.VIAtmp");
+ VIAtmp = fopen(tmpname, "w+");
+ while (fgets(buffer, 4096, VIARC) != NULL) {
+ sscanf(buffer,"%d %d %d", &HDisplay, &VDisplay, &bitsPerPixel);
+ if (HDisplay == pBIOSInfo->SaveHDisplay &&
+ VDisplay == pBIOSInfo->SaveVDisplay &&
+ bitsPerPixel == pBIOSInfo->bitsPerPixel) {
+ fprintf(VIAtmp, "%d %d %d", HDisplay, VDisplay, bitsPerPixel);
+ for (i=0; i<256; i++) {
+ fprintf(VIAtmp, " %hu %hu %hu", pBIOSInfo->colors[i].red,
+ pBIOSInfo->colors[i].green, pBIOSInfo->colors[i].blue);
+ }
+ fprintf(VIAtmp, "\n");
+ found = 1;
+ }
+ else {
+ fputs(buffer, VIAtmp);
+ }
+ }
+ if (!found) {
+ fprintf(VIAtmp, "%d %d %d", pBIOSInfo->SaveHDisplay,
+ pBIOSInfo->SaveVDisplay, pBIOSInfo->bitsPerPixel);
+ for (i=0; i<256; i++) {
+ fprintf(VIAtmp, " %hu %hu %hu", pBIOSInfo->colors[i].red,
+ pBIOSInfo->colors[i].green, pBIOSInfo->colors[i].blue);
+ }
+ fprintf(VIAtmp, "\n");
+ }
+ fclose(VIARC);
+ fclose(VIAtmp);
+ if(remove(filename) != -1) {
+ if(rename(tmpname, filename) == 0) {
+ ret = TRUE;
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+Bool VIASaveUserSetting(VIABIOSInfoPtr pBIOSInfo)
+{
+ UTUSERSETTINGptr pUTUSERSETTING = pBIOSInfo->pUTUSERSETTING;
+ FILE *VIARC=NULL, *VIAtmp=NULL;
+ char filename[40], tmpname[40], buffer[200], *home = NULL;
+ int HDisplay, VDisplay, bitsPerPixel;
+ unsigned int found=0;
+ Bool ret=FALSE;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIASaveUserSetting\n"));
+ home = getenv("HOME");
+ if (home){
+ filename[0] = '\0';
+ strcpy(filename, home);
+ strcat(filename, "/.VIARC");
+ if ((VIARC = fopen(filename, "r")) == NULL){
+ xf86Msg(X_DEFAULT, "Open user setting file failed.\n");
+ if ((VIARC = fopen(filename, "a")) == NULL)
+ DEBUG(xf86Msg(X_ERROR, "Create .VIARC failure!\n"));
+ }
+ else {
+ strcpy(tmpname, home);
+ strcat(tmpname, "/.VIAtmp");
+ VIAtmp = fopen(tmpname, "w+");
+ while (fgets(buffer, 40, VIARC) != NULL) {
+ sscanf(buffer,"%d %d %d", &HDisplay, &VDisplay, &bitsPerPixel);
+ if (HDisplay == pBIOSInfo->SaveHDisplay &&
+ VDisplay == pBIOSInfo->SaveVDisplay &&
+ bitsPerPixel == pBIOSInfo->bitsPerPixel) {
+ fprintf(VIAtmp, "%d %d %d %d %ld\n",
+ pBIOSInfo->SaveHDisplay, pBIOSInfo->SaveVDisplay,
+ pBIOSInfo->bitsPerPixel, pBIOSInfo->ActiveDevice,
+ pBIOSInfo->Center);
+ found = 1;
+ }
+ else {
+ fputs(buffer, VIAtmp);
+ }
+ }
+ if (!found) {
+ fprintf(VIAtmp, "%d %d %d %d %ld\n",
+ pBIOSInfo->SaveHDisplay, pBIOSInfo->SaveVDisplay,
+ pBIOSInfo->bitsPerPixel, pBIOSInfo->ActiveDevice,
+ pBIOSInfo->Center);
+ }
+ }
+ fclose(VIARC);
+ fclose(VIAtmp);
+ if(remove(filename) != -1) {
+ if(rename(tmpname, filename) == 0) {
+ ret = TRUE;
+ }
+ }
+ if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) {
+ filename[0] = '\0';
+ strcpy(filename, home);
+ strcat(filename, "/.VIATVRC");
+ if ((VIARC = fopen(filename, "r")) == NULL){
+ xf86Msg(X_DEFAULT, "Open user TV setting file failed.\n");
+ if ((VIARC = fopen(filename, "a")) == NULL)
+ DEBUG(xf86Msg(X_ERROR, "Create .VIARC failure!\n"));
+ }
+ else {
+ VIAtmp = fopen(tmpname, "w+");
+ while (fgets(buffer, 200, VIARC) != NULL) {
+ sscanf(buffer,"%d %d %d", &HDisplay, &VDisplay, &bitsPerPixel);
+ if (HDisplay == pBIOSInfo->SaveHDisplay &&
+ VDisplay == pBIOSInfo->SaveVDisplay &&
+ bitsPerPixel == pBIOSInfo->bitsPerPixel) {
+ fprintf(VIAtmp, "%d %d %d %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %ld\n",
+ pBIOSInfo->SaveHDisplay, pBIOSInfo->SaveVDisplay,
+ pBIOSInfo->bitsPerPixel, pUTUSERSETTING->ADAPTIVE_FFILTER_ON,
+ pBIOSInfo->TVVScan, pBIOSInfo->TVType, pBIOSInfo->TVOutput,
+ pUTUSERSETTING->UT_TV_HPOSITION, pUTUSERSETTING->UT_TV_VPOSITION,
+ pUTUSERSETTING->UT_TV_FFILTER,
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER,
+ pUTUSERSETTING->UT_TV_BRIGHTNESS, pUTUSERSETTING->UT_TV_CONTRAST,
+ pUTUSERSETTING->UT_TV_SATURATION, pUTUSERSETTING->UT_TV_TINT,
+ pBIOSInfo->TVDotCrawl);
+ found = 1;
+ }
+ else {
+ fputs(buffer, VIAtmp);
+ }
+ }
+ if (!found) {
+ fprintf(VIAtmp, "%d %d %d %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %ld\n",
+ pBIOSInfo->SaveHDisplay, pBIOSInfo->SaveVDisplay,
+ pBIOSInfo->bitsPerPixel, pUTUSERSETTING->ADAPTIVE_FFILTER_ON,
+ pBIOSInfo->TVVScan, pBIOSInfo->TVType, pBIOSInfo->TVOutput,
+ pUTUSERSETTING->UT_TV_HPOSITION, pUTUSERSETTING->UT_TV_VPOSITION,
+ pUTUSERSETTING->UT_TV_FFILTER,
+ pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER,
+ pUTUSERSETTING->UT_TV_BRIGHTNESS, pUTUSERSETTING->UT_TV_CONTRAST,
+ pUTUSERSETTING->UT_TV_SATURATION, pUTUSERSETTING->UT_TV_TINT,
+ pBIOSInfo->TVDotCrawl);
+ }
+ }
+ fclose(VIARC);
+ fclose(VIAtmp);
+ if(remove(filename) != -1) {
+ if(rename(tmpname, filename) == 0) {
+ ret = TRUE;
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+Bool VIALoadUserSetting(VIABIOSInfoPtr pBIOSInfo)
+{
+ UTUSERSETTINGptr pUTUSERSETTING = pBIOSInfo->pUTUSERSETTING;
+ FILE *VIARC=NULL;
+ char filename[40], buffer[200], *home = NULL;
+ int HDisplay, VDisplay, bitsPerPixel, tmp;
+ unsigned char ActiveDevice;
+ Bool UT_TV_DOTCRAWL, Center, ret=FALSE;
+ CARD32 UT_TV_VSCAL=0, UT_TV_STD=0, UT_TV_SGNL=0;
+
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIALoadUserSetting\n"));
+ DEBUG(xf86Msg(X_INFO, "pBIOSInfo->HDisplay = %d, pBIOSInfo->VDisplay = %d\n"
+ , pBIOSInfo->HDisplay, pBIOSInfo->VDisplay));
+ pUTUSERSETTING->DefaultSetting = FALSE;
+ home = getenv("HOME");
+ if (home){
+ filename[0] = '\0';
+ strcpy(filename, home);
+ strcat(filename, "/.VIARC");
+ if ((VIARC = fopen(filename, "r")) == NULL){
+ DEBUG(xf86Msg(X_WARNING, "No user setting file exist, Create new ones\n"));
+ if ((VIARC = fopen(filename, "a")) == NULL)
+ DEBUG(xf86Msg(X_ERROR, "Create .VIARC failure!\n"));
+ }
+ else {
+ while (fgets(buffer, 40, VIARC) != NULL) {
+ sscanf(buffer,"%d %d %d", &HDisplay, &VDisplay, &bitsPerPixel);
+ /*DEBUG(xf86Msg(X_INFO, "Read: HDisplay = %d, VDisplay = %d, bitsPerPixel = %d\n"
+ , HDisplay, VDisplay, bitsPerPixel));*/
+ if (HDisplay == pBIOSInfo->HDisplay &&
+ VDisplay == pBIOSInfo->VDisplay &&
+ bitsPerPixel == pBIOSInfo->bitsPerPixel) {
+ sscanf(buffer,"%d %d %d %d %ld",
+ &tmp, &tmp, &tmp, &ActiveDevice, &Center);
+ if (pBIOSInfo->FirstInit)
+ pBIOSInfo->ActiveDevice = ActiveDevice & pBIOSInfo->ConnectedDevice;
+ pBIOSInfo->Center = Center;
+ ret = TRUE;
+ break;
+ }
+ }
+ fclose(VIARC);
+ }
+ if (pBIOSInfo->TVEncoder) {
+ filename[0] = '\0';
+ strcpy(filename, home);
+ strcat(filename, "/.VIATVRC");
+ if ((VIARC = fopen(filename, "r")) == NULL){
+ DEBUG(xf86Msg(X_WARNING, "No user TV setting file exist, Create new ones\n"));
+ if ((VIARC = fopen(filename, "a")) == NULL)
+ DEBUG(xf86Msg(X_ERROR, "Create .VIATVRC failure!\n"));
+ }
+ else {
+ while (fgets(buffer, 200, VIARC) != NULL) {
+ sscanf(buffer,"%d %d %d", &HDisplay, &VDisplay, &bitsPerPixel);
+ /*DEBUG(xf86Msg(X_INFO, "Read: HDisplay = %d, VDisplay = %d, bitsPerPixel = %d\n"
+ , HDisplay, VDisplay, bitsPerPixel));*/
+ if (HDisplay == pBIOSInfo->HDisplay &&
+ VDisplay == pBIOSInfo->VDisplay &&
+ bitsPerPixel == pBIOSInfo->bitsPerPixel) {
+ sscanf(buffer,"%d %d %d %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %ld",
+ &tmp, &tmp, &tmp, &pUTUSERSETTING->ADAPTIVE_FFILTER_ON,
+ &UT_TV_VSCAL, &UT_TV_STD, &UT_TV_SGNL,
+ &pUTUSERSETTING->UT_TV_HPOSITION,
+ &pUTUSERSETTING->UT_TV_VPOSITION,
+ &pUTUSERSETTING->UT_TV_FFILTER,
+ &pUTUSERSETTING->UT_TV_ADAPTIVE_FFILTER,
+ &pUTUSERSETTING->UT_TV_BRIGHTNESS,
+ &pUTUSERSETTING->UT_TV_CONTRAST,
+ &pUTUSERSETTING->UT_TV_SATURATION,
+ &pUTUSERSETTING->UT_TV_TINT, &UT_TV_DOTCRAWL);
+ pBIOSInfo->TVVScan = UT_TV_VSCAL;
+ pBIOSInfo->TVType = UT_TV_STD;
+ pBIOSInfo->TVOutput = UT_TV_SGNL;
+ pBIOSInfo->TVDotCrawl = UT_TV_DOTCRAWL;
+ pUTUSERSETTING->DefaultSetting = TRUE;
+ ret = TRUE;
+ break;
+ }
+ }
+ fclose(VIARC);
+ }
+ }
+ }
+ return ret;
+}
+
+/* Remove restart flag file for utility */
+void UTRemoveRestartFlag(VIABIOSInfoPtr pBIOSInfo) {
+ char filename[40], *home = NULL;
+
+ filename[0] = '\0';
+ home = getenv("HOME");
+ if (home){
+ filename[0] = '\0';
+ strcpy(filename, home);
+ strcat(filename, "/.XWindowNeedtobeRestart");
+ if (remove(filename) == -1)
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "Restart flag file not exist!\n"));
+ else
+ DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "Restart flag file has been remove!\n"));
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_utility.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_utility.h new file mode 100644 index 000000000..0c360e8c0 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_utility.h @@ -0,0 +1,453 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Define for Utility functions using XvPutImage.
+ */
+
+/* Primary ID */
+#define UT_XV_FUNC_BIOS 0x11 /* Primary ID */
+#define UT_XV_FUNC_DRIVER 0x12
+#define UT_XV_FUNC_DEVICE 0x13
+#define UT_XV_FUNC_PANEL 0x14
+#define UT_XV_FUNC_TV 0x15
+#define UT_XV_FUNC_GAMMA 0x16
+
+/* Secondary ID */
+#define UT_XV_FUNC_BIOS_GetChipID 0x01 /* Get Chip ID */
+#define UT_XV_FUNC_BIOS_GetVersion 0x02 /* Get the version of the BIOS */
+#define UT_XV_FUNC_BIOS_GetDate 0x03 /* Get the date (year, month, day) of the BIOS. */
+#define UT_XV_FUNC_BIOS_GetVideoMemSizeMB 0x04 /* Get the video memory size, in MB */
+
+#define UT_XV_FUNC_DRIVER_GetFileName 0x01
+#define UT_XV_FUNC_DRIVER_GetFileVersion 0x02
+
+#define UT_XV_FUNC_DEVICE_GetSupportState 1
+#define UT_XV_FUNC_DEVICE_GetConnectState 2
+#define UT_XV_FUNC_DEVICE_GetActiveState 3
+#define UT_XV_FUNC_DEVICE_SetActiveState 4
+#define UT_XV_FUNC_DEVICE_GetSAMMState 5
+#define UT_XV_FUNC_DEVICE_GetRoateState 6
+#define UT_XV_FUNC_DEVICE_SetRoateState 7
+
+#define UT_XV_FUNC_DEVICE_SetTargetPanel 1
+#define UT_XV_FUNC_DEVICE_GetPanelInfo 2
+#define UT_XV_FUNC_DEVICE_GetExpandState 3
+#define UT_XV_FUNC_DEVICE_SetExpandState 4
+#define UT_XV_FUNC_DEVICE_GetSupportExpand 5
+
+#define UT_XV_FUNC_TV_GetSupportStandardState 1
+#define UT_XV_FUNC_TV_GetStandard 2
+#define UT_XV_FUNC_TV_SetStandard 3
+#define UT_XV_FUNC_TV_GetSupportSignalTypeState 4
+#define UT_XV_FUNC_TV_GetSignalType 5
+#define UT_XV_FUNC_TV_SetSignalType 6
+#define UT_XV_FUNC_TV_GetMaxViewSizeValue 7
+#define UT_XV_FUNC_TV_GetViewSizeValue 8
+#define UT_XV_FUNC_TV_SetViewSizeValue 9
+#define UT_XV_FUNC_TV_GetMaxViewPositionValue 10
+#define UT_XV_FUNC_TV_GetViewPositionValue 11
+#define UT_XV_FUNC_TV_SetViewPositionValue 12
+#define UT_XV_FUNC_TV_GetSupportTuningState 13
+#define UT_XV_FUNC_TV_GetTuningItemMaxValue 14
+#define UT_XV_FUNC_TV_GetTuningItemValue 15
+#define UT_XV_FUNC_TV_SetTuningItemValue 16
+#define UT_XV_FUNC_TV_GetSupportSettingState 17
+#define UT_XV_FUNC_TV_GetSettingItemState 18
+#define UT_XV_FUNC_TV_SetSettingItemState 19
+
+#define UT_ESC_FUNC_GAMMA_GetDeviceSupportState 1
+#define UT_ESC_FUNC_GAMMA_GetLookUpTable 2
+#define UT_ESC_FUNC_GAMMA_SetLookUpTable 3
+#define UT_ESC_FUNC_GAMMA_GetDefaultLookUpTable 4
+
+/* Input & Output Data */
+#define DISPLAY_DRIVER 1
+#define VIDEO_CAPTURE_DRIVER 2
+#define HWOVERLAY_DRIVER 3
+#define UT_DEVICE_NONE 0x00
+#define UT_DEVICE_CRT1 0x01
+#define UT_DEVICE_LCD 0x02
+#define UT_DEVICE_TV 0x04
+#define UT_DEVICE_DFP 0x08
+#define UT_DEVICE_CRT2 0x16
+#define UT_STATE_SAMM_OFF 0 /* Not in SAMM mode. */
+#define UT_STATE_SAMM_ON 1 /* In SAMM mode. */
+#define UT_ROTATE_NONE 0 /* Normal. */
+#define UT_ROTATE_90_DEG 1 /* Rotate 90 deg. clockwise. */
+#define UT_ROTATE_180_DEG 2 /* Rotate 180 deg. clockwise. */
+#define UT_ROTATE_270_DEG 3 /* Rotate 270 deg. clockwise. */
+#define UT_PANEL_TYPE_STN 0 /* STN. */
+#define UT_PANEL_TYPE_TFT 1 /* TFT. */
+#define UT_STATE_EXPAND_OFF 0 /* Not expanded; centered. */
+#define UT_STATE_EXPAND_ON 1 /* Expanded. */
+#define UT_PANEL_SUPPORT_EXPAND_OFF 0
+#define UT_PANEL_SUPPORT_EXPAND_ON 1
+#define UT_TV_STD_NTSC 0x0001 /* NTSC. */
+#define UT_TV_STD_PAL 0x0002 /* PAL. */
+#define UT_TV_STD_PAL_M 0x0004 /* PAL M. */
+#define UT_TV_STD_PAL_N 0x0008 /* PAL N. */
+#define UT_TV_STD_PAL_NC 0x0010 /* PAL N combination. */
+#define UT_TV_SGNL_COMPOSITE 0x0001 /* Composite. */
+#define UT_TV_SGNL_S_VIDEO 0x0002 /* S-Video. */
+#define UT_TV_SGNL_SCART 0x0004 /* SCART. */
+#define UT_TV_SGNL_COMP_OUTPUT 0x0008 /* Component Output. */
+#define UT_TV_TUNING_FFILTER 0x0001 /* Flicker Filter. */
+#define UT_TV_TUNING_ADAPTIVE_FFILTER 0x0002 /* Adaptive Flicker Filter. */
+#define UT_TV_TUNING_BRIGHTNESS 0x0004 /* Brightness. */
+#define UT_TV_TUNING_CONTRAST 0x0008 /* Contrast. */
+#define UT_TV_TUNING_SATURATION 0x0010 /* Saturation. */
+#define UT_TV_TUNING_TINT 0x0020 /* Tint. */
+#define UT_TV_SETTING_FFILTER 0x0001
+#define UT_TV_SETTING_ADAPTIVE_FFILTER 0x0002
+#define UT_TV_SETTING_DOT_CRAWL 0x0004
+#define UT_TV_SETTING_LOCK_ASPECT_RATIO 0x0008
+#define UT_STATE_OFF 0
+#define UT_STATE_ON 1
+
+
+typedef struct _UTBIOSVERSION
+{
+ CARD32 dwVersion; /* The version. */
+ CARD32 dwRevision; /* The revision. */
+} UTBIOSVERSION;
+
+typedef struct _UTBIOSDATE
+{
+ CARD32 dwYear; /* Year, like 2001. */
+ CARD32 dwMonth; /* Month, like 5, 12. */
+ CARD32 dwDay; /* Day, like 7, 30. */
+} UTBIOSDATE;
+
+typedef struct _UTDriverVersion
+{
+ CARD32 dwMajorNum;
+ CARD32 dwMinorNum;
+ CARD32 dwReversionNum;
+} UTDriverVersion;
+
+typedef struct _UTXYVALUE
+{
+ CARD32 dwX;
+ CARD32 dwY;
+} UTXYVALUE;
+
+typedef struct _UTDEVICEINFO
+{
+ CARD32 dwDeviceType;
+ CARD32 dwResX;
+ CARD32 dwResY;
+ CARD32 dwColorDepth;
+} UTDEVICEINFO;
+
+typedef struct _UTPANELINFO
+{
+ CARD32 dwType; /* Panel type */
+ CARD32 dwResX; /* X Resolution of the panel. */
+ CARD32 dwResY; /* Y Resolution of the panel. */
+} UTPANELINFO;
+
+typedef struct _UTSETTVTUNINGINFO
+{
+ CARD32 dwItemID;
+ CARD32 dwValue;
+} UTSETTVTUNINGINFO;
+
+typedef struct _UTSETTVITEMSTATE
+{
+ CARD32 dwItemID;
+ CARD32 dwState; /* Value defined in TV Setting state. */
+} UTSETTVITEMSTATE;
+
+typedef struct _UTGAMMAINFO
+{
+ UTDEVICEINFO DeviceInfo; /* E.g., if we want the table of CRT1, we should set */
+ CARD32 LookUpTable[256]; /* the dwDeviceType as UT_DEVICE_CRT1. */
+} UTGAMMAINFO;
+
+
+/* Functions protype */
+Bool VIASaveUserSetting(VIABIOSInfoPtr pBIOSInfo);
+Bool VIASaveGammaSetting(VIABIOSInfoPtr pBIOSInfo);
+
+/* Philips SAA7108 TV Position Table Rec. */
+unsigned char VIASAA7108PostionOffset[3] = { 0x6D, 0x92, 0x93 };
+unsigned char VIASAA7108PostionNormalTabRec[2][4][11][3] = {
+ /* NTSC */
+ {
+ /* 640x480 */
+ {
+ { 0x30, 0x1E, 0x1E },
+ { 0x2E, 0x20, 0x20 },
+ { 0x2C, 0x22, 0x22 },
+ { 0x2A, 0x24, 0x24 },
+ { 0x28, 0x26, 0x26 },
+ /* default BIOS setting */
+ { 0x26, 0x28, 0x28 },
+ { 0x24, 0x2A, 0x2A },
+ { 0x22, 0x2C, 0x2C },
+ { 0x22, 0x30, 0x30 },
+ { 0x20, 0x32, 0x32 },
+ { 0x20, 0x33, 0x33 }
+ },
+ /* 800x600 */
+ {
+ { 0x32, 0x2E, 0x2E },
+ { 0x30, 0x31, 0x31 },
+ { 0x2E, 0x34, 0x34 },
+ { 0x2C, 0x37, 0x37 },
+ { 0x2A, 0x3A, 0x3A },
+ /* default BIOS setting */
+ { 0x28, 0x3D, 0x3D },
+ { 0x26, 0x40, 0x40 },
+ { 0x24, 0x43, 0x43 },
+ { 0x22, 0x46, 0x46 },
+ { 0x20, 0x48, 0x48 },
+ { 0x20, 0x49, 0x49 }
+ },
+ /* 1024x768 */
+ {
+ { 0x2E, 0x4F, 0x4F },
+ { 0x2C, 0x55, 0x55 },
+ { 0x2A, 0x5A, 0x5A },
+ { 0x28, 0x60, 0x60 },
+ { 0x26, 0x65, 0x65 },
+ /* default BIOS setting */
+ { 0x24, 0x69, 0x69 },
+ { 0x22, 0x6D, 0x6D },
+ { 0x20, 0x71, 0x71 },
+ { 0x20, 0x73, 0x73 },
+ { 0x20, 0x74, 0x74 },
+ { 0x20, 0x76, 0x76 }
+ },
+ /* 848x480 */
+ {
+ { 0x30, 0x1E, 0x1E },
+ { 0x2E, 0x20, 0x20 },
+ { 0x2C, 0x22, 0x22 },
+ { 0x2A, 0x24, 0x24 },
+ { 0x28, 0x26, 0x26 },
+ /* default BIOS setting */
+ { 0x26, 0x28, 0x28 },
+ { 0x24, 0x2A, 0x2A },
+ { 0x22, 0x2C, 0x2C },
+ { 0x22, 0x30, 0x30 },
+ { 0x20, 0x32, 0x32 },
+ { 0x20, 0x33, 0x33 }
+ }
+ },
+ /* PAL */
+ {
+ /* 640x480 */
+ {
+ { 0x21, 0x42, 0x42 },
+ { 0x23, 0x44, 0x44 },
+ { 0x23, 0x45, 0x45 },
+ { 0x23, 0x46, 0x46 },
+ { 0x25, 0x47, 0x47 },
+ /* default BIOS setting */
+ { 0x25, 0x48, 0x48 },
+ { 0x25, 0x49, 0x49 },
+ { 0x27, 0x4B, 0x4B },
+ { 0x2B, 0x4E, 0x4E },
+ { 0x2D, 0x50, 0x50 },
+ { 0x2F, 0x52, 0x52 }
+ },
+ /* 800x600 */
+ {
+ { 0x30, 0x3F, 0x3F },
+ { 0x2E, 0x41, 0x41 },
+ { 0x2C, 0x43, 0x43 },
+ { 0x2A, 0x45, 0x45 },
+ { 0x28, 0x47, 0x47 },
+ /* default BIOS setting */
+ { 0x26, 0x49, 0x49 },
+ { 0x24, 0x4B, 0x4B },
+ { 0x22, 0x4D, 0x4D },
+ { 0x20, 0x51, 0x51 },
+ { 0x20, 0x52, 0x52 },
+ { 0x20, 0x53, 0x53 }
+ },
+ /* 1024x768 */
+ {
+ { 0x26, 0x5F, 0x5F },
+ { 0x24, 0x61, 0x61 },
+ { 0x24, 0x62, 0x62 },
+ { 0x22, 0x64, 0x64 },
+ { 0x22, 0x65, 0x65 },
+ /* default BIOS setting */
+ { 0x22, 0x66, 0x66 },
+ { 0x22, 0x67, 0x67 },
+ { 0x22, 0x68, 0x68 },
+ { 0x22, 0x69, 0x69 },
+ { 0x22, 0x6A, 0x6A },
+ { 0x20, 0x6D, 0x6D }
+ },
+ /* 848x480 */
+ {
+ { 0x21, 0x42, 0x42 },
+ { 0x23, 0x44, 0x44 },
+ { 0x23, 0x45, 0x45 },
+ { 0x23, 0x46, 0x46 },
+ { 0x25, 0x47, 0x47 },
+ /* default BIOS setting */
+ { 0x25, 0x48, 0x48 },
+ { 0x25, 0x49, 0x49 },
+ { 0x27, 0x4B, 0x4B },
+ { 0x2B, 0x4E, 0x4E },
+ { 0x2D, 0x50, 0x50 },
+ { 0x2F, 0x52, 0x52 }
+ }
+ }
+};
+
+unsigned char VIASAA7108PostionOverTabRec[2][4][11][3] = {
+ /* NTSC */
+ {
+ /* 640x480 */
+ {
+ { 0x34, 0x0C, 0x0C },
+ { 0x32, 0x0E, 0x0E },
+ { 0x30, 0x10, 0x10 },
+ { 0x2E, 0x12, 0x12 },
+ { 0x2C, 0x14, 0x14 },
+ /* default BIOS setting */
+ { 0x2A, 0x16, 0x16 },
+ { 0x28, 0x18, 0x18 },
+ { 0x26, 0x1A, 0x1A },
+ { 0x24, 0x1C, 0x1C },
+ { 0x24, 0x1D, 0x1D },
+ { 0x22, 0x1F, 0x1F }
+ },
+ /* 800x600 */
+ {
+ { 0x2C, 0x1A, 0x1A },
+ { 0x2A, 0x1C, 0x1C },
+ { 0x28, 0x1E, 0x1E },
+ { 0x28, 0x1F, 0x1F },
+ { 0x26, 0x22, 0x22 },
+ /* default BIOS setting */
+ { 0x24, 0x24, 0x24 },
+ { 0x24, 0x25, 0x25 },
+ { 0x22, 0x27, 0x27 },
+ { 0x22, 0x28, 0x28 },
+ { 0x20, 0x2A, 0x2A },
+ { 0x20, 0x2B, 0x2B }
+ },
+ /* 1024x768 */
+ {
+ { 0x2A, 0x24, 0x24 },
+ { 0x28, 0x27, 0x27 },
+ { 0x26, 0x2A, 0x2A },
+ { 0x26, 0x2B, 0x2B },
+ { 0x24, 0x2E, 0x2E },
+ /* default BIOS setting */
+ { 0x22, 0x31, 0x31 },
+ { 0x22, 0x32, 0x32 },
+ { 0x22, 0x33, 0x33 },
+ { 0x22, 0x34, 0x34 },
+ { 0x20, 0x37, 0x37 },
+ { 0x20, 0x39, 0x39 }
+ },
+ /* 848x480 */
+ {
+ { 0x34, 0x0C, 0x0C },
+ { 0x32, 0x0E, 0x0E },
+ { 0x30, 0x10, 0x10 },
+ { 0x2E, 0x12, 0x12 },
+ { 0x2C, 0x14, 0x14 },
+ /* default BIOS setting */
+ { 0x2A, 0x16, 0x16 },
+ { 0x28, 0x18, 0x18 },
+ { 0x26, 0x1A, 0x1A },
+ { 0x24, 0x1C, 0x1C },
+ { 0x24, 0x1D, 0x1D },
+ { 0x22, 0x1F, 0x1F }
+ }
+ },
+ /* PAL */
+ {
+ /* 640x480 */
+ {
+ { 0x3C, 0x0B, 0x0B },
+ { 0x3A, 0x0C, 0x0C },
+ { 0x38, 0x0E, 0x0E },
+ { 0x34, 0x11, 0x11 },
+ { 0x32, 0x13, 0x13 },
+ /* default BIOS setting */
+ { 0x2E, 0x16, 0x16 },
+ { 0x2C, 0x18, 0x18 },
+ { 0x28, 0x1B, 0x1B },
+ { 0x26, 0x1D, 0x1D },
+ { 0x22, 0x20, 0x20 },
+ { 0x22, 0x21, 0x21 }
+ },
+ /* 800x600 */
+ {
+ { 0x34, 0x17, 0x17 },
+ { 0x32, 0x19, 0x19 },
+ { 0x30, 0x1B, 0x1B },
+ { 0x2E, 0x1D, 0x1D },
+ { 0x2E, 0x1E, 0x1E },
+ /* default BIOS setting */
+ { 0x2C, 0x20, 0x20 },
+ { 0x2C, 0x21, 0x21 },
+ { 0x2C, 0x22, 0x22 },
+ { 0x2A, 0x24, 0x24 },
+ { 0x2A, 0x25, 0x25 },
+ { 0x28, 0x27, 0x27 }
+ },
+ /* 1024x768 */
+ {
+ { 0x2C, 0x27, 0x27 },
+ { 0x2C, 0x28, 0x28 },
+ { 0x2A, 0x2A, 0x2A },
+ { 0x28, 0x2C, 0x2C },
+ { 0x28, 0x2D, 0x2D },
+ /* default BIOS setting */
+ { 0x26, 0x2F, 0x2F },
+ { 0x26, 0x30, 0x30 },
+ { 0x26, 0x31, 0x31 },
+ { 0x26, 0x32, 0x32 },
+ { 0x24, 0x35, 0x35 },
+ { 0x22, 0x37, 0x37 }
+ },
+ /* 848x480 */
+ {
+ { 0x3C, 0x0B, 0x0B },
+ { 0x3A, 0x0C, 0x0C },
+ { 0x38, 0x0E, 0x0E },
+ { 0x34, 0x11, 0x11 },
+ { 0x32, 0x13, 0x13 },
+ /* default BIOS setting */
+ { 0x2E, 0x16, 0x16 },
+ { 0x2C, 0x18, 0x18 },
+ { 0x28, 0x1B, 0x1B },
+ { 0x26, 0x1D, 0x1D },
+ { 0x22, 0x20, 0x20 },
+ { 0x22, 0x21, 0x21 }
+ }
+ }
+};
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_video.c b/xc/programs/Xserver/hw/xfree86/drivers/via/via_video.c new file mode 100644 index 000000000..e9376e042 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_video.c @@ -0,0 +1,2121 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * I N C L U D E S
+ */
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86Resources.h"
+#include "xf86_ansic.h"
+#include "compiler.h"
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+#include "xf86fbman.h"
+#include "regionstr.h"
+#include "via_driver.h"
+#include "via_video.h"
+
+#include "via_privIoctl.h" /* for VIAGRAPHICINFO & custom ioctl command */
+#include "ddmpeg.h"
+#include "capture.h"
+#include "via.h"
+
+#include "xf86xv.h"
+#include "Xv.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "dixstruct.h"
+#include "via_xvpriv.h"
+#include "via_swov.h"
+
+
+/*
+ * D E F I N E
+ */
+#define OFF_DELAY 200 /* milliseconds */
+#define FREE_DELAY 60000
+#define PARAMSIZE 1024
+#define SLICESIZE 65536
+#define OFF_TIMER 0x01
+#define FREE_TIMER 0x02
+#define TIMER_MASK (OFF_TIMER | FREE_TIMER)
+
+#define LOW_BAND 0x0CB0
+#define MID_BAND 0x1f10
+
+#define XV_IMAGE 0
+#define NTSC_COMPOSITE 1
+#define NTSC_TUNER 2
+#define NTSC_SVIDEO 3
+#define PAL_SVIDEO 4
+#define PAL_60_COMPOSITE 5
+#define PAL_60_TUNER 6
+#define PAL_60_SVIDEO 7
+#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
+
+#define IN_FLIP ( ((vmmtr)viaVidEng)->ramtab & 0x00000003)
+#define IN_DISPLAY ( ((vmmtr)viaVidEng)->interruptflag & 0x00000200)
+#define IN_VBLANK ( !IN_DISPLAY )
+
+#ifndef XvExtension
+void viaInitVideo(ScreenPtr pScreen) {}
+#else
+
+/*
+ * F U N C T I O N D E C L A R A T I O N
+ */
+XF86VideoAdaptorPtr viaSetupImageVideoG(ScreenPtr);
+static void viaStopVideoG(ScrnInfoPtr, pointer, Bool);
+static int viaSetPortAttributeG(ScrnInfoPtr, Atom, INT32, pointer);
+static int viaGetPortAttributeG(ScrnInfoPtr, Atom ,INT32 *, pointer);
+static void viaQueryBestSizeG(ScrnInfoPtr, Bool,
+ short, short, short, short, unsigned int *, unsigned int *, pointer);
+static int viaPutImageG( ScrnInfoPtr,
+ short, short, short, short, short, short, short, short,
+ int, unsigned char*, short, short, Bool, RegionPtr, pointer);
+static int viaReputImageG( ScrnInfoPtr,
+ short, short, RegionPtr, pointer );
+static int viaPutVideo(ScrnInfoPtr ,
+ short , short , short , short ,short , short , short , short ,
+ RegionPtr , pointer );
+static int viaPutStill(ScrnInfoPtr ,
+ short , short , short , short ,short , short , short , short ,
+ RegionPtr , pointer );
+static int viaGetVideo(ScrnInfoPtr ,
+ short , short , short , short ,short , short , short , short ,
+ RegionPtr , pointer );
+static int viaGetStill(ScrnInfoPtr ,
+ short , short , short , short ,short , short , short , short ,
+ RegionPtr , pointer );
+
+static int viaQueryImageAttributesG(ScrnInfoPtr,
+ int, unsigned short *, unsigned short *, int *, int *);
+
+
+/*
+ * E X T E R N F U N C T I O N S
+ */
+
+/*
+ * G L O B A L S
+ */
+unsigned long gdwOverlaySupportFlag;
+static Atom xvBrightness, xvContrast, xvColorKey,xvGivenMpg,xvHue,xvSaturation
+ ,xvLuminance,xvNTSC,xvPAL,xvPort,xvCompose,xvAV,xvSVIDEO,xvTV,xvEncoding
+ ,xvTVChannel,xvTVPAL,xvTVNTSC ,xvMute, xvVolume, xvFreq, xvAudioCtrl,xvHQV
+ ,xvBOB,xvExitTV, xvExitSWOVerlay;
+
+VIAGRAPHICINFO gVIAGraphicInfo;
+volatile unsigned char * lpVidMEMIO; /* Pointer to video MMIO Address */
+
+VIAVIDCTRL VideoControl;
+LPVIAVIDCTRL lpVideoControl=&VideoControl;
+
+static unsigned long dwFrameNum = 0; /* for startaddr select */
+
+/*
+ * S T R U C T S
+ */
+/* client libraries expect an encoding */
+static XF86VideoEncodingRec DummyEncoding[8] =
+{
+ { XV_IMAGE , "XV_IMAGE",-1, -1,{1, 1}},
+ { NTSC_COMPOSITE , "ntsc-composite",720, 480, { 1001, 60000 }},
+ { NTSC_TUNER , "ntsc-tuner",720, 480, { 1001, 60000 }},
+ { NTSC_SVIDEO , "ntsc-svideo",720, 480, { 1001, 60000 }},
+ { PAL_SVIDEO , "pal-svideo",720, 576, { 1, 50 }},
+ { PAL_60_COMPOSITE, "pal_60-composite", 704, 576, { 1, 50 }},
+ { PAL_60_TUNER , "pal_60-tuner", 720, 576, { 1, 50 }},
+ { PAL_60_SVIDEO , "pal_60-svideo",720, 576, { 1, 50 }}
+};
+
+#define NUM_FORMATS_G 9
+
+static XF86VideoFormatRec FormatsG[NUM_FORMATS_G] =
+{
+ { 8, TrueColor }, /* Dithered */
+ { 8, PseudoColor }, /* Using .. */
+ { 8, StaticColor },
+ { 8, GrayScale },
+ { 8, StaticGray }, /* .. TexelLUT */
+ {16, TrueColor},
+ {24, TrueColor},
+ {16, DirectColor},
+ {24, DirectColor}
+};
+
+#define NUM_ATTRIBUTES_G 26
+
+static XF86AttributeRec AttributesG[NUM_ATTRIBUTES_G] =
+{
+ {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
+ {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"},
+ {XvSettable | XvGettable, -1000, 1000, "XV_CONTRAST"},
+ {XvSettable | XvGettable, 0, 2, "XV_GIVENMPG"},
+ {XvSettable | XvGettable,-1000,1000,"XV_SATURATION"},
+ {XvSettable | XvGettable,-1000,1000,"XV_HUE"},
+ {XvSettable | XvGettable,-1000,1000,"XV_LUMINANCE"},
+ {XvSettable | XvGettable,0,255,"XV_MUTE"},
+ {XvSettable | XvGettable,0,255,"XV_VOLUME"},
+ {XvSettable | XvGettable,0,2,"XV_NTSC"},
+ {XvSettable | XvGettable,0,2,"XV_PAL"},
+ {XvSettable,0,2,"XV_PORT"},
+ {XvSettable,0,2,"XV_COMPOSE"},
+ {XvSettable,0,2,"XV_AV"},
+ {XvSettable,0,2,"XV_SVIDEO"},
+ {XvSettable | XvGettable,0, 255,"XV_ENCODING"},
+ {XvSettable | XvGettable,0, 255, "XV_CHANNEL"},
+ {XvSettable,0,2,"XV_TVPAL"},
+ {XvSettable,0,2,"XV_TVNTSC"},
+ {XvSettable,0,2,"XV_TV"},
+ {XvSettable,0,-1,"XV_FREQ"},
+ {XvSettable,0,2,"XV_AUDIOCTRL"},
+ {XvSettable,0,2,"XV_HIGHQVDO"},
+ {XvSettable,0,2,"XV_BOB"},
+ {XvSettable,0,2,"XV_EXITTV"},
+ {XvSettable,0,2,"XV_EXITSWOV"},
+};
+
+#define NUM_IMAGES_G 2
+
+static XF86ImageRec ImagesG[NUM_IMAGES_G] =
+{
+ {
+ 0x32595559,
+ XvYUV,
+ LSBFirst,
+ {'Y','U','Y','2',
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71},
+ 16,
+ XvPacked,
+ 1,
+ 0, 0, 0, 0 ,
+ 8, 8, 8,
+ 1, 2, 2,
+ 1, 2, 2,
+ {'Y','U','Y','V',
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ XvTopToBottom
+ } ,
+ {
+ 0x32315659,
+ XvYUV,
+ LSBFirst,
+ {'Y','V','1','2',
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71},
+ 12,
+ XvPlanar,
+ 3,
+ 0, 0, 0, 0 ,
+ 8, 8, 8,
+ 1, 2, 2,
+ 1, 2, 2,
+ {'Y','V','U',
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ XvTopToBottom
+ }/*,
+ {
+ 0x59565955,
+ XvYUV,
+ LSBFirst,
+ {'U','Y','V','Y',
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71},
+ 16,
+ XvPacked,
+ 1,
+ 0, 0, 0, 0 ,
+ 8, 8, 8,
+ 1, 2, 2,
+ 1, 1, 1,
+ {'U','Y','V','Y',
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ XvTopToBottom
+ }
+*/
+};
+
+static char * XVPORTNAME[5] =
+{
+ "XV_SWOV",
+ "XV_TV1" ,
+ "XV_TV2" ,
+ "XV_UTCTRL",
+ "XV_DUMMY"
+};
+
+
+#define DDR100SUPPORTMODECOUNT 24
+#define DDR133UNSUPPORTMODECOUNT 19
+MODEINFO SupportDDR100[DDR100SUPPORTMODECOUNT]=
+ {{640,480,8,60}, {640,480,8,75}, {640,480,8,85}, {640,480,8,100}, {640,480,8,120},
+ {640,480,16,60}, {640,480,16,75}, {640,480,16,85}, {640,480,16,100}, {640,480,16,120},
+ {640,480,32,60}, {640,480,32,75}, {640,480,32,85}, {640,480,16,100}, {640,480,32,120},
+ {800,600,8,60}, {800,600,8,75}, {800,600,8,85}, {800,600,8,100}, {800,600,16,60},
+ {800,600,16,75}, {800,600,16,85}, {800,600,32,60}, {1024,768,8,60}};
+
+MODEINFO UnSupportDDR133[DDR133UNSUPPORTMODECOUNT]=
+ {{1152,864,32,75}, {1280,768,32,75}, {1280,768,32,85}, {1280,960,32,60}, {1280,960,32,75},
+ {1280,960,32,85}, {1280,1024,16,85}, {1280,1024,32,60}, {1280,1024,32,75}, {1280,1024,32,85},
+ {1400,1050,16,85}, {1400,1050,32,60}, {1400,1050,32,75}, {1400,1050,32,85}, {1600,1200,8,75},
+ {1600,1200,8,85}, {1600,1200,16,75}, {1600,1200,16,85}, {1600,1200,32,60}};
+
+
+/*
+ * F U N C T I O N
+ */
+static __inline void waitVBLANK(int viaVidEng)
+{
+ while (IN_DISPLAY);
+}
+
+static __inline void waitIfFlip(int viaVidEng)
+{
+ while( IN_FLIP );
+}
+
+
+static __inline void waitDISPLAYBEGIN(int viaVidEng)
+{
+ while (IN_VBLANK);
+}
+
+/* Decide if the mode support video overlay */
+Bool DecideOverlaySupport(VIAPtr pVia)
+{
+ unsigned long iCount;
+
+ VGAOUT8(0x3D4, 0x3D);
+ switch ((VGAIN8(0x3D5) & 0x70) >> 4)
+ {
+ case 0:
+ case SDR100:
+ break;
+
+ case SDR133:
+ break;
+
+ case DDR100:
+ for (iCount=0; iCount < DDR100SUPPORTMODECOUNT; iCount++)
+ {
+ if ( (gVIAGraphicInfo.dwWidth == SupportDDR100[iCount].dwWidth) &&
+ (gVIAGraphicInfo.dwHeight == SupportDDR100[iCount].dwHeight) &&
+ (gVIAGraphicInfo.dwBPP == SupportDDR100[iCount].dwBPP) &&
+ (gVIAGraphicInfo.dwRefreshRate == SupportDDR100[iCount].dwRefreshRate) )
+ {
+ return TRUE;
+ break;
+ }
+ }
+
+ return FALSE;
+ break;
+
+ case DDR133:
+ for (iCount=0; iCount < DDR133UNSUPPORTMODECOUNT; iCount++)
+ {
+ if ( (gVIAGraphicInfo.dwWidth == UnSupportDDR133[iCount].dwWidth) &&
+ (gVIAGraphicInfo.dwHeight == UnSupportDDR133[iCount].dwHeight) &&
+ (gVIAGraphicInfo.dwBPP == UnSupportDDR133[iCount].dwBPP) &&
+ (gVIAGraphicInfo.dwRefreshRate == UnSupportDDR133[iCount].dwRefreshRate) )
+ {
+ return FALSE;
+ break;
+ }
+ }
+
+ return TRUE;
+ break;
+ }
+
+ return FALSE;
+}
+
+
+void viaResetVideo(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int viaVidEng = (int) pVia->VidMapBase;
+
+ DBG_DD(ErrorF(" via_video.c : viaResetVideo: \n"));
+
+ waitVBLANK(viaVidEng);
+
+ ((vmmtr)viaVidEng)->compose = 0;
+ ((vmmtr)viaVidEng)->video1_ctl = 0;
+ ((vmmtr)viaVidEng)->video3_ctl = 0;
+
+}
+
+static unsigned long dwV1, dwV3;
+void viaSaveVideo(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int viaVidEng = (int) pVia->VidMapBase;
+
+ dwV1 = ((vmmtr)viaVidEng)->video1_ctl;
+ dwV3 = ((vmmtr)viaVidEng)->video3_ctl;
+ waitVBLANK(viaVidEng);
+ ((vmmtr)viaVidEng)->video1_ctl = 0;
+ ((vmmtr)viaVidEng)->video3_ctl = 0;
+}
+
+void viaRestoreVideo(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int viaVidEng = (int) pVia->VidMapBase;
+
+ waitVBLANK(viaVidEng);
+ ((vmmtr)viaVidEng)->video1_ctl = dwV1 ;
+ ((vmmtr)viaVidEng)->video3_ctl = dwV3 ;
+}
+
+void viaExitVideo(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int viaVidEng = (int) pVia->VidMapBase;
+
+ DBG_DD(ErrorF(" via_video.c : viaExitVideo : \n"));
+
+ waitVBLANK(viaVidEng);
+ ((vmmtr)viaVidEng)->video1_ctl = 0;
+ ((vmmtr)viaVidEng)->video3_ctl = 0;
+}
+
+/*
+XF86VideoAdaptorRec adaptRec[XV_PORT_NUM];
+*/
+XF86VideoAdaptorPtr adaptPtr[XV_PORT_NUM];
+void viaInitVideo(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VIAPtr pVia = VIAPTR(pScrn);
+ XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL;
+ XF86VideoAdaptorPtr newAdaptor = NULL;
+ int num_adaptors;
+
+ DBG_DD(ErrorF(" via_video.c : viaInitVideo : \n"));
+
+ if((pVia->Chipset == VIA_CLE266))
+ {
+ newAdaptor = viaSetupImageVideoG(pScreen);
+ }
+
+ num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
+
+ DBG_DD(ErrorF(" via_video.c : num_adaptors : %d\n",num_adaptors));
+ if(newAdaptor) {
+ if(!num_adaptors) {
+ num_adaptors = 1;
+ adaptors = &newAdaptor; /* Now ,useless */
+ } else {
+ DBG_DD(ErrorF(" via_video.c : viaInitVideo : Warning !!! MDS not supported yet !\n"));
+ newAdaptors = /* need to free this someplace */
+ xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
+ if(newAdaptors) {
+ memcpy(newAdaptors, adaptors, num_adaptors *
+ sizeof(XF86VideoAdaptorPtr));
+ newAdaptors[num_adaptors] = newAdaptor;
+ adaptors = newAdaptors;
+ num_adaptors++;
+ }
+ }
+ }
+
+ if(num_adaptors)
+ xf86XVScreenInit(pScreen, adaptPtr, XV_PORT_NUM);
+
+ if(newAdaptors)
+ xfree(newAdaptors);
+
+
+ /* Driver init */
+ /* DriverProc(CREATEDRIVER,NULL); */
+ lpVidMEMIO = pVia->VidMapBase;
+
+ /* 3rd party Device Init */
+ /*
+ InitializeVDEC();
+ InitializeTUNER();
+ InitializeAudio();
+ */
+}
+
+
+XF86VideoAdaptorPtr
+viaSetupImageVideoG(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ /* XF86VideoAdaptorPtr adaptPtr[XV_PORT_NUM]; */
+ viaPortPrivRec *gviaPortPriv[XV_PORT_NUM];
+ DevUnion * pdevUnion[XV_PORT_NUM];
+ int i;
+
+ DBG_DD(ErrorF(" via_video.c : viaSetupImageVideoG: \n"));
+
+
+ xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
+ xvContrast = MAKE_ATOM("XV_CONTRAST");
+ xvColorKey = MAKE_ATOM("XV_COLORKEY");
+ xvGivenMpg = MAKE_ATOM("XV_GIVENMPG");
+ xvHue = MAKE_ATOM("XV_HUE");
+ xvSaturation = MAKE_ATOM("XV_SATURATION");
+ xvLuminance = MAKE_ATOM("XV_LUMINANCE");
+ xvMute = MAKE_ATOM("XV_MUTE");
+ xvVolume = MAKE_ATOM("XV_VOLUME");
+ xvNTSC = MAKE_ATOM("XV_NTSC");
+ xvPAL = MAKE_ATOM("XV_PAL");
+ xvPort = MAKE_ATOM("XV_PORT");
+ xvCompose = MAKE_ATOM("XV_COMPOSE");
+ xvAV = MAKE_ATOM("XV_AV");
+ xvTV = MAKE_ATOM("XV_TV");
+ xvTVChannel = MAKE_ATOM("XV_CHANNEL");
+ xvTVNTSC = MAKE_ATOM("XV_TVNTSC");
+ xvTVPAL = MAKE_ATOM("XV_TVPAL");
+ xvSVIDEO = MAKE_ATOM("XV_SVIDEO");
+ xvEncoding = MAKE_ATOM("XV_ENCODING");
+ xvFreq = MAKE_ATOM("XV_FREQ");
+ xvAudioCtrl = MAKE_ATOM("XV_AUDIOCTRL");
+ xvHQV = MAKE_ATOM("XV_HIGHQVDO");
+ xvBOB = MAKE_ATOM("XV_BOB");
+ xvExitTV = MAKE_ATOM("XV_EXITTV");
+ xvExitSWOVerlay = MAKE_ATOM("XV_EXITSWOV");
+
+ /* AllocatePortPriv();*/
+ for ( i = 0; i< XV_PORT_NUM; i ++ ) {
+ if(!(adaptPtr[i] = xf86XVAllocateVideoAdaptorRec(pScrn)))
+ return NULL;
+
+ gviaPortPriv[i] = (viaPortPrivPtr)xcalloc(1, sizeof(viaPortPrivRec) );
+ if ( ! gviaPortPriv[i] ){
+ DBG_DD(ErrorF(" via_xvpriv.c : Fail to allocate gviaPortPriv: \n"));
+ }
+ else{
+ DBG_DD(ErrorF(" via_xvpriv.c : gviaPortPriv[%d] = 0x%08x \n", i,gviaPortPriv[i]));
+ }
+ /*
+ if(!(pPriv[i] = xcalloc(1, sizeof(viaPortPrivPtr))))
+ {
+ xfree(adaptPtr[i]);
+ return NULL;
+ }
+ */
+
+ pdevUnion[i] = (DevUnion *)xcalloc(1, sizeof(DevUnion) );
+
+ adaptPtr[i]->type = XvInputMask | XvWindowMask | XvImageMask | XvVideoMask | XvStillMask;
+ adaptPtr[i]->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
+ adaptPtr[i]->name = XVPORTNAME[i];
+ adaptPtr[i]->nEncodings = 8;
+ adaptPtr[i]->pEncodings = DummyEncoding;
+ adaptPtr[i]->nFormats = sizeof(FormatsG) / sizeof(FormatsG[0]);
+ adaptPtr[i]->pFormats = FormatsG;
+
+ /* The adapter can handle 3 ports simultaneously */
+ adaptPtr[i]->nPorts = 3;
+ adaptPtr[i]->pPortPrivates = pdevUnion[i];
+ adaptPtr[i]->pPortPrivates->ptr = (pointer) gviaPortPriv[i];
+/*
+ adaptPtr[i]->pPortPrivates = (DevUnion*)(&pPriv[1]);
+ adaptPtr[i]->pPortPrivates[0].ptr = (pointer)pPriv;
+*/
+ if (i == 3) /* Utility port doesn't need attribute */
+ {
+ adaptPtr[i]->nAttributes = 0;
+ adaptPtr[i]->pAttributes = NULL;
+ }
+ else
+ {
+ adaptPtr[i]->nAttributes = NUM_ATTRIBUTES_G;
+ adaptPtr[i]->pAttributes = AttributesG;
+ }
+ adaptPtr[i]->nImages = NUM_IMAGES_G;
+ adaptPtr[i]->pImages = ImagesG;
+ adaptPtr[i]->PutVideo = viaPutVideo;
+ adaptPtr[i]->PutStill = viaPutStill;
+ adaptPtr[i]->GetVideo = viaGetVideo;
+ adaptPtr[i]->GetStill = viaGetStill;
+ adaptPtr[i]->StopVideo = viaStopVideoG;
+ adaptPtr[i]->SetPortAttribute = viaSetPortAttributeG;
+ adaptPtr[i]->GetPortAttribute = viaGetPortAttributeG;
+ adaptPtr[i]->QueryBestSize = viaQueryBestSizeG;
+ adaptPtr[i]->PutImage = viaPutImageG;
+ adaptPtr[i]->ReputImage= viaReputImageG;
+ adaptPtr[i]->QueryImageAttributes = viaQueryImageAttributesG;
+
+ #ifdef COLOR_KEY
+ gviaPortPriv[i]->colorKey = 0x0821;
+ #endif
+ gviaPortPriv[i]->brightness = 0;
+ gviaPortPriv[i]->saturation = 0;
+ gviaPortPriv[i]->contrast = 0;
+ gviaPortPriv[i]->hue = 0;
+ gviaPortPriv[i]->xv_portnum = i;
+
+ /* gotta uninit this someplace */
+ REGION_INIT(pScreen, &gviaPortPriv[i]->clip, NullBox, 0);
+ } /* End of for */
+
+
+ viaResetVideo(pScrn);
+
+ return adaptPtr[0];
+
+}
+
+
+static Bool
+RegionsEqual(RegionPtr A, RegionPtr B)
+{
+ int *dataA, *dataB;
+ int num;
+
+ num = REGION_NUM_RECTS(A);
+ if(num != REGION_NUM_RECTS(B))
+ return FALSE;
+
+ if((A->extents.x1 != B->extents.x1) ||
+ (A->extents.x2 != B->extents.x2) ||
+ (A->extents.y1 != B->extents.y1) ||
+ (A->extents.y2 != B->extents.y2))
+ return FALSE;
+
+ dataA = (int*)REGION_RECTS(A);
+ dataB = (int*)REGION_RECTS(B);
+
+ while(num--) {
+ if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1]))
+ return FALSE;
+ dataA += 2;
+ dataB += 2;
+ }
+
+ return TRUE;
+}
+
+
+unsigned long CreateSWOVSurface(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv, int fd, int fourcc, short width, short height)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ LPDDSURFACEDESC lpSurfaceDesc = &pPriv->SurfaceDesc;
+
+ if (pVia->V4LEnabled == 1) {
+ if ( -1 == ioctl(fd, VIA_VID_GET_VIDCTL, lpVideoControl) )
+ {
+ DBG_DD(ErrorF(" via_video.c : get video control fail \n"));
+ }
+
+ if (lpVideoControl->VideoStatus & SWOV_SURFACE_CREATED)
+ return TRUE;
+
+ lpSurfaceDesc->dwWidth = (unsigned long)width;
+ lpSurfaceDesc->dwHeight = (unsigned long)height;
+ lpSurfaceDesc->dwBackBufferCount =1;
+
+ lpSurfaceDesc->dwFourCC = (unsigned long)fourcc;
+/* lpSurfaceDesc->dwFourCC = FOURCC_YUY2; */
+
+ if ( -1 == ioctl(fd, VIA_VID_CREATESURFACE, lpSurfaceDesc))
+ DBG_DD(ErrorF(" Couldn't Create SW surface through V4L.\n"));
+
+ pPriv->ddLock.dwFourCC = (unsigned long)fourcc;
+/* pPriv->ddLock.dwFourCC = FOURCC_YUY2; */
+
+ if ( -1 == ioctl(fd, VIA_VID_LOCKSURFACE, &pPriv->ddLock))
+ DBG_DD(ErrorF(" Couldn't lock SW surface through V4L.\n"));
+
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[0] = (unsigned char *)pVia->FBStart + pPriv->ddLock.SWDevice.dwSWPhysicalAddr[0];
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[1] = (unsigned char *)pVia->FBStart + pPriv->ddLock.SWDevice.dwSWPhysicalAddr[1];
+
+ DBG_DD(ErrorF(" ScreenAddress: %p\n", pVia->FBStart));
+ DBG_DD(ErrorF(" dwSWPhysicalAddr[0]: %p\n", pPriv->ddLock.SWDevice.dwSWPhysicalAddr[0]));
+ DBG_DD(ErrorF(" dwSWPhysicalAddr[1]: %p\n", pPriv->ddLock.SWDevice.dwSWPhysicalAddr[1]));
+
+ lpVideoControl->VideoStatus |= SWOV_SURFACE_CREATED|SW_VIDEO_ON;
+ lpVideoControl->dwAction = ACTION_SET_VIDEOSTATUS;
+ if ( -1 == ioctl(fd, VIA_VID_SET_VIDCTL, lpVideoControl) )
+ {
+ DBG_DD(ErrorF(" via_video.c : set video control fail \n"));
+ }
+ }
+ else { /* if (pVia->V4LEnabled == 1) */
+ if (lpVideoControl->VideoStatus & SWOV_SURFACE_CREATED)
+ return TRUE;
+
+ lpSurfaceDesc->dwWidth = (unsigned long)width;
+ lpSurfaceDesc->dwHeight = (unsigned long)height;
+ lpSurfaceDesc->dwBackBufferCount =1;
+
+ lpSurfaceDesc->dwFourCC = (unsigned long)fourcc;
+
+ VIAVidCreateSurface(pScrn, lpSurfaceDesc);
+
+ pPriv->ddLock.dwFourCC = (unsigned long)fourcc;
+
+ VIAVidLockSurface(pScrn, &pPriv->ddLock);
+
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[0] = pVia->FBBase + pPriv->ddLock.SWDevice.dwSWPhysicalAddr[0];
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[1] = pVia->FBBase + pPriv->ddLock.SWDevice.dwSWPhysicalAddr[1];
+
+ DBG_DD(ErrorF(" lpSWOverlaySurface[0]: %p\n", pPriv->ddLock.SWDevice.lpSWOverlaySurface[0]));
+ DBG_DD(ErrorF(" lpSWOverlaySurface[1]: %p\n", pPriv->ddLock.SWDevice.lpSWOverlaySurface[1]));
+
+ lpVideoControl->VideoStatus |= SWOV_SURFACE_CREATED|SW_VIDEO_ON;
+ lpVideoControl->dwAction = ACTION_SET_VIDEOSTATUS;
+ } /* else (pVia->V4LEnabled == 1) */
+ return TRUE;
+}
+
+
+void DestroySWOVSurface(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv, int fd)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ LPDDSURFACEDESC lpSurfaceDesc = &pPriv->SurfaceDesc;
+
+ DBG_DD(ErrorF(" via_video.c : Destroy SW Overlay Surface, fourcc =0x%08x : \n",
+ lpSurfaceDesc->dwFourCC));
+
+ if (pVia->V4LEnabled == 1) {
+ if ( -1 == ioctl(fd, VIA_VID_GET_VIDCTL, lpVideoControl) )
+ {
+ DBG_DD(ErrorF(" via_video.c : get video control fail \n"));
+ }
+
+ if (lpVideoControl->VideoStatus & SWOV_SURFACE_CREATED)
+ {
+ DBG_DD(ErrorF(" via_video.c : Destroy SW Overlay Surface, VideoStatus =0x%08x : \n",
+ lpVideoControl->VideoStatus));
+ }
+ else
+ {
+ DBG_DD(ErrorF(" via_video.c : No SW Overlay Surface Destroyed, VideoStatus =0x%08x : \n",
+ lpVideoControl->VideoStatus));
+ return;
+ }
+
+ if ( -1 == ioctl(fd, VIA_VID_DESTROYSURFACE, lpSurfaceDesc))
+ DBG_DD(ErrorF(" Couldn't destroy SW surface through V4L.\n"));
+
+ lpVideoControl->VideoStatus &= ~SWOV_SURFACE_CREATED;
+ lpVideoControl->dwAction = ACTION_SET_VIDEOSTATUS;
+ if ( -1 == ioctl(fd, VIA_VID_SET_VIDCTL, lpVideoControl) )
+ {
+ DBG_DD(ErrorF(" via_video.c : set video control fail \n"));
+ }
+ }
+ else { /* if (pVia->V4LEnabled == 1) */
+ if (lpVideoControl->VideoStatus & SWOV_SURFACE_CREATED)
+ {
+ DBG_DD(ErrorF(" via_video.c : Destroy SW Overlay Surface, VideoStatus =0x%08x : \n",
+ lpVideoControl->VideoStatus));
+ }
+ else
+ {
+ DBG_DD(ErrorF(" via_video.c : No SW Overlay Surface Destroyed, VideoStatus =0x%08x : \n",
+ lpVideoControl->VideoStatus));
+ return;
+ }
+
+ VIAVidDestroySurface(pScrn, lpSurfaceDesc);
+
+ lpVideoControl->VideoStatus &= ~SWOV_SURFACE_CREATED;
+ lpVideoControl->dwAction = ACTION_SET_VIDEOSTATUS;
+ } /* else (pVia->V4LEnabled == 1) */
+ return;
+}
+
+
+void StopSWOVerlay(ScrnInfoPtr pScrn, int fd)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ DDUPDATEOVERLAY UpdateOverlay_Video;
+ LPDDUPDATEOVERLAY lpUpdateOverlay = &UpdateOverlay_Video;
+
+ lpVideoControl->VideoStatus &= ~SW_VIDEO_ON;
+ lpVideoControl->dwAction = ACTION_SET_VIDEOSTATUS;
+
+ if (pVia->V4LEnabled == 1) {
+ if ( -1 == ioctl(fd, VIA_VID_SET_VIDCTL, lpVideoControl) )
+ {
+ DBG_DD(ErrorF(" via_video.c : set video control fail \n"));
+ }
+
+ lpUpdateOverlay->dwFlags = DDOVER_HIDE;
+ if ( -1 == ioctl(fd, VIA_VID_UPDATEOVERLAY, lpUpdateOverlay))
+ {
+ DBG_DD(ErrorF(" via_video.c : StopOverlay: call v4l updateoverlay fail. \n"));
+ }
+ }
+ else {
+ lpUpdateOverlay->dwFlags = DDOVER_HIDE;
+ VIAVidUpdateOverlay(pScrn, lpUpdateOverlay);
+ }
+
+}
+
+
+static void
+viaStopVideoG(ScrnInfoPtr pScrn, pointer data, Bool exit)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ viaPortPrivPtr pPriv = (viaPortPrivPtr)data;
+ int fd = -1;
+ int zero=0;
+
+ DBG_DD(ErrorF(" via_video.c : viaStopVideoG: exit=%d\n", exit));
+
+ if (pVia->V4LEnabled == 1) {
+ switch ( pPriv->xv_portnum )
+ {
+ case COMMAND_FOR_TV1 :
+ REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
+
+ if(exit) {
+ fd = open("/dev/video0",O_RDWR);
+
+ if (-1 == ioctl(fd, VIDIOCCAPTURE, &zero))
+ perror("ioctl VIDIOCCAPTURE(0)");
+ } else {
+ /* StopTVVideo(pScrn, pPriv,exit); */
+ }
+ break;
+
+ case COMMAND_FOR_TV2 :
+ REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
+
+ if(exit) {
+ fd = open("/dev/video1",O_RDWR);
+
+ if (-1 == ioctl(fd, VIDIOCCAPTURE, &zero))
+ perror("ioctl VIDIOCCAPTURE(0)");
+ } else {
+ /* StopTVVideo(pScrn, pPriv,exit); */
+ }
+ break;
+
+ case COMMAND_FOR_SWOV :
+ case COMMAND_FOR_DUMMY :
+ fd = open("/dev/video2",O_RDWR);
+ REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
+ if(exit) {
+ StopSWOVerlay(pScrn, fd);
+ DestroySWOVSurface(pScrn, pPriv, fd);
+
+ dwFrameNum = 0; /* for startaddr select */
+ pPriv->old_drw_x= 0;
+ pPriv->old_drw_y= 0;
+ pPriv->old_drw_w= 0;
+ pPriv->old_drw_h= 0;
+ } else {
+ StopSWOVerlay(pScrn, fd);
+ }
+ close(fd);
+ break;
+
+ default:
+ DBG_DD(ErrorF(" via_video.c : viaStopVideoG: Shall not happen! \n"));
+ break;
+ }
+ }
+ else { /* if (pVia->V4LEnabled == 1) */
+ REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
+ if(exit) {
+ StopSWOVerlay(pScrn, fd);
+ DestroySWOVSurface(pScrn, pPriv, fd);
+
+ dwFrameNum = 0;
+ pPriv->old_drw_x= 0;
+ pPriv->old_drw_y= 0;
+ pPriv->old_drw_w= 0;
+ pPriv->old_drw_h= 0;
+ } else {
+ StopSWOVerlay(pScrn, fd);
+ }
+
+} /* else (pVia->V4LEnabled == 1) */
+
+}
+
+/* App "xawtv" attribute from -1000 to 1000 */
+/* But SAA7113H needs 0 to 255 */
+#define Attr_Mapping(x) x = ( (x + 1000) >> 3 )
+
+
+/****************************************************************************
+ * SetTunerChannel *
+ * Function: Sets the tuner to a requested channel *
+ * Inputs: CARD16 channel - the tuner channel to be set. *
+ * Outputs: NONE *
+ ****************************************************************************/
+void SetTunerChannel (viaPortPrivPtr pChanPriv, INT32 frequency)
+{
+
+ LPVIASETTUNERDATA lpTunerParam = (LPVIASETTUNERDATA)xalloc(sizeof(VIASETTUNERDATA));
+ short divider = 0;
+
+ switch(pChanPriv->dwEncoding)
+ {
+ case PAL_60_COMPOSITE :
+ case PAL_60_TUNER :
+ case PAL_60_SVIDEO :
+ divider=633+(short)frequency;
+ break;
+ case NTSC_COMPOSITE :
+ case NTSC_TUNER :
+ case NTSC_SVIDEO :
+ divider=733+(short)frequency;
+ break;
+ default:
+ divider=frequency;
+ }
+
+ lpTunerParam->divider = divider;
+ lpTunerParam->control = 0x8E00;
+
+ if ( divider <= LOW_BAND )
+ {
+ lpTunerParam->control = lpTunerParam->control | 0xA0;
+ }
+ else{
+ if ( divider <= MID_BAND )
+ lpTunerParam->control = lpTunerParam->control | 0x90;
+ else
+ lpTunerParam->control = lpTunerParam->control | 0x30;
+ }
+
+
+
+ DBG_DD(ErrorF(" via_video.c : SetTunerChannel : Divider = 0x%08x, Control= 0x%08x, \n",
+ lpTunerParam->divider,lpTunerParam->control));
+ /* DriverProc( TUNER_SETCHANNEL , lpTunerParam); */
+
+ if ( lpTunerParam )
+ xfree(lpTunerParam);
+
+
+} /* SetTunerChannel ()... */
+
+/* v4l uses range 0 - 65535; Xv uses -1000 - 1000 */
+static int
+v4l_to_xv(int val) {
+ val = val * 2000 / 65536 - 1000;
+ if (val < -1000) val = -1000;
+ if (val > 1000) val = 1000;
+ return val;
+}
+static int
+xv_to_v4l(int val) {
+ val = val * 65536 / 2000 + 32768;
+ if (val < -0) val = 0;
+ if (val > 65535) val = 65535;
+ return val;
+}
+
+
+static int
+viaSetPortAttributeG(
+ ScrnInfoPtr pScrn,
+ Atom attribute,
+ INT32 value,
+ pointer data
+){
+ VIAPtr pVia = VIAPTR(pScrn);
+ int viaVidEng = (int) pVia->VidMapBase;
+ viaPortPrivPtr pPriv = (viaPortPrivPtr)data;
+ LPVIAAUDCTRL lpAudCtrl = &(pPriv->AudCtrl);
+ LPVIASETPORTATTR lpParam = (LPVIASETPORTATTR)xalloc(sizeof(VIASETPORTATTR));
+ struct video_channel chan;
+ int fd = -1;
+
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : \n"));
+
+ gdwOverlaySupportFlag = DecideOverlaySupport(pVia);
+
+ if (pVia->V4LEnabled == 1) {
+ switch ( pPriv->xv_portnum )
+ {
+ case COMMAND_FOR_TV1 :
+ fd = open("/dev/video0",O_RDWR);
+ break;
+ case COMMAND_FOR_TV2 :
+ fd = open("/dev/video1",O_RDWR);
+ break;
+ case COMMAND_FOR_SWOV :
+ case COMMAND_FOR_DUMMY :
+ fd = open("/dev/video2",O_RDWR);
+ break;
+ case COMMAND_FOR_UTCTRL :
+ break;
+ default:
+ DBG_DD(ErrorF(" via_video.c : Error port access.\n"));
+ return XvBadAlloc;
+ }
+
+ /* Color Key */
+ if(attribute == xvColorKey) {
+ DBG_DD(ErrorF(" V4L Enable xvColorKey = %08x\n",value));
+
+ pPriv->colorKey = value;
+ /* All assume color depth is 16 */
+ value &= 0x00FFFFFF;
+ ((vmmtr)viaVidEng)->color_key = value;
+ ((vmmtr)viaVidEng)->snd_color_key = value;
+ REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
+
+ /* Color Control */
+ } else if (attribute == xvBrightness ||
+ attribute == xvContrast ||
+ attribute == xvSaturation ||
+ attribute == xvHue) {
+ ioctl(fd,VIDIOCGPICT,&pPriv->pict);
+ if (attribute == xvBrightness)
+ {
+ DBG_DD(ErrorF(" xvBrightness = %08d\n",value));
+ pPriv->pict.brightness = xv_to_v4l(value);
+ }
+ if (attribute == xvContrast)
+ {
+ DBG_DD(ErrorF(" xvContrast = %08d\n",value));
+ pPriv->pict.contrast = xv_to_v4l(value);
+ }
+ if (attribute == xvSaturation)
+ {
+ DBG_DD(ErrorF(" xvSaturation = %08d\n",value));
+ pPriv->pict.colour = xv_to_v4l(value);
+ }
+ if (attribute == xvHue)
+ {
+ DBG_DD(ErrorF(" xvHue = %08d\n",value));
+ pPriv->pict.hue = xv_to_v4l(value);
+ }
+ if (-1 == ioctl(fd,VIDIOCSPICT,&pPriv->pict))
+ perror("ioctl VIDIOCSPICT");
+
+ /* Audio control */
+ } else if (attribute == xvMute){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvMute = %08d\n",value));
+ if ( value )
+ {
+ lpAudCtrl->dwAudioMode = ATTR_MUTE_ON;
+ lpParam->attribute = ATTR_MUTE_ON;
+ }
+ else{
+ lpAudCtrl->dwAudioMode = ATTR_MUTE_OFF;
+ lpParam->attribute = ATTR_STEREO;
+ /* DriverProc( AUDIOCONTROL , lpParam); */
+ lpParam->attribute = ATTR_MUTE_OFF;
+ }
+ /* DriverProc( AUDIOCONTROL , lpParam); */
+
+ } else if (attribute == xvVolume){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvVolume = %08d\n",value));
+ lpAudCtrl->nVolume = value;
+ lpParam->attribute = ATTR_VOLUME;
+ lpParam->value = value;
+ /* DriverProc( AUDIOCONTROL , lpParam); */
+
+ /* Tuner control. Channel switch */
+ } else if (attribute == xvFreq){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvFreq = %08x\n",value));
+ SetTunerChannel(pPriv, value );
+
+ /* Video decoder control. NTSC/PAL, SVIDEO/COMPOSITIVE/TV */
+ } else if (attribute == xvEncoding){
+ DBG_DD(ErrorF(" xvEncoding = %d. \n",value));
+
+ pPriv->dwEncoding = value;
+ switch ( value )
+ {
+ case NTSC_COMPOSITE :
+
+ chan.channel = 0; /* Composite input */
+ chan.norm = VIDEO_MODE_NTSC;
+ if (-1 == ioctl(fd,VIDIOCSCHAN,&chan))
+ perror("ioctl VIDIOCSCHAN");
+ break;
+
+ case NTSC_TUNER :
+
+ chan.channel = 1; /* Tuner input */
+ chan.norm = VIDEO_MODE_NTSC;
+ if (-1 == ioctl(fd,VIDIOCSCHAN,&chan))
+ perror("ioctl VIDIOCSCHAN");
+ break;
+
+ case NTSC_SVIDEO :
+ chan.channel = 2; /* S-Video input */
+ chan.norm = VIDEO_MODE_NTSC;
+ if (-1 == ioctl(fd,VIDIOCSCHAN,&chan))
+ perror("ioctl VIDIOCSCHAN");
+ break;
+
+ case PAL_SVIDEO :
+ chan.channel = 2; /* S-Video input */
+ chan.norm = VIDEO_MODE_PAL;
+ if (-1 == ioctl(fd,VIDIOCSCHAN,&chan))
+ perror("ioctl VIDIOCSCHAN");
+ break;
+
+ case PAL_60_COMPOSITE :
+ chan.channel = 0; /* Composite input */
+ chan.norm = VIDEO_MODE_PAL;
+ if (-1 == ioctl(fd,VIDIOCSCHAN,&chan))
+ perror("ioctl VIDIOCSCHAN");
+ break;
+
+ case PAL_60_TUNER :
+ chan.channel = 1; /* Tuner input */
+ chan.norm = VIDEO_MODE_PAL;
+ if (-1 == ioctl(fd,VIDIOCSCHAN,&chan))
+ perror("ioctl VIDIOCSCHAN");
+ break;
+
+ case PAL_60_SVIDEO :
+ chan.channel = 2; /* S-Video input */
+ chan.norm = VIDEO_MODE_PAL;
+ if (-1 == ioctl(fd,VIDIOCSCHAN,&chan))
+ perror("ioctl VIDIOCSCHAN");
+ break;
+
+ default :
+ break;
+ }
+
+ /* VIA Proprietary Attribute for Video control */
+ } else if (attribute == xvPort ){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvPort=%d\n", value));
+
+ } else if (attribute == xvCompose){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvCompose=%08x\n",value));
+
+ } else if (attribute == xvHQV){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvHQV=%08x\n",value));
+
+ } else if (attribute == xvBOB){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvBOB=%08x\n",value));
+
+ } else if (attribute == xvExitTV){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvExitTV=%08x\n",value));
+
+ /* VIA Proprietary Attribute for AUDIO control */
+ } else if (attribute == xvAudioCtrl ){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvAudioSwitch=%d\n", value));
+
+ lpParam->attribute = ATTR_AUDIO_CONTROLByAP;
+ lpParam->value = value;
+ /* DriverProc( AUDIOCONTROL , lpParam); */
+ }else{
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : is not supported the attribute"));
+
+ return BadMatch;
+ }
+
+ if ( lpParam )
+ xfree(lpParam);
+
+ close(fd);
+ }
+ else { /* pVia->V4LEnabled == 1 */
+
+ /* Color Key */
+ if(attribute == xvColorKey) {
+ DBG_DD(ErrorF(" V4L Disable xvColorKey = %08x\n",value));
+
+ pPriv->colorKey = value;
+ /* All assume color depth is 16 */
+ value &= 0x00FFFFFF;
+ ((vmmtr)viaVidEng)->color_key = value;
+ ((vmmtr)viaVidEng)->snd_color_key = value;
+ REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
+
+ /* Color Control */
+ } else if (attribute == xvBrightness ||
+ attribute == xvContrast ||
+ attribute == xvSaturation ||
+ attribute == xvHue) {
+ if (attribute == xvBrightness)
+ {
+ DBG_DD(ErrorF(" xvBrightness = %08d\n",value));
+ pPriv->pict.brightness = xv_to_v4l(value);
+ }
+ if (attribute == xvContrast)
+ {
+ DBG_DD(ErrorF(" xvContrast = %08d\n",value));
+ pPriv->pict.contrast = xv_to_v4l(value);
+ }
+ if (attribute == xvSaturation)
+ {
+ DBG_DD(ErrorF(" xvSaturation = %08d\n",value));
+ pPriv->pict.colour = xv_to_v4l(value);
+ }
+ if (attribute == xvHue)
+ {
+ DBG_DD(ErrorF(" xvHue = %08d\n",value));
+ pPriv->pict.hue = xv_to_v4l(value);
+ }
+
+ /* Audio control */
+ } else if (attribute == xvMute){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvMute = %08d\n",value));
+ if ( value )
+ {
+ lpAudCtrl->dwAudioMode = ATTR_MUTE_ON;
+ lpParam->attribute = ATTR_MUTE_ON;
+ }
+ else{
+ lpAudCtrl->dwAudioMode = ATTR_MUTE_OFF;
+ lpParam->attribute = ATTR_STEREO;
+ lpParam->attribute = ATTR_MUTE_OFF;
+ }
+
+ } else if (attribute == xvVolume){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvVolume = %08d\n",value));
+ lpAudCtrl->nVolume = value;
+ lpParam->attribute = ATTR_VOLUME;
+ lpParam->value = value;
+
+ /* Tuner control. Channel switch */
+ } else if (attribute == xvFreq){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvFreq = %08x\n",value));
+ SetTunerChannel(pPriv, value );
+
+ /* Video decoder control. NTSC/PAL, SVIDEO/COMPOSITIVE/TV */
+ } else if (attribute == xvEncoding){
+ DBG_DD(ErrorF(" xvEncoding = %d. \n",value));
+
+ pPriv->dwEncoding = value;
+ switch ( value )
+ {
+ case NTSC_COMPOSITE :
+
+ chan.channel = 0; /* Composite input */
+ chan.norm = VIDEO_MODE_NTSC;
+ break;
+
+ case NTSC_TUNER :
+
+ chan.channel = 1; /* Tuner input */
+ chan.norm = VIDEO_MODE_NTSC;
+ break;
+
+ case NTSC_SVIDEO :
+ chan.channel = 2; /* S-Video input */
+ chan.norm = VIDEO_MODE_NTSC;
+ break;
+
+ case PAL_SVIDEO :
+ chan.channel = 2; /* S-Video input */
+ chan.norm = VIDEO_MODE_PAL;
+ break;
+
+ case PAL_60_COMPOSITE :
+ chan.channel = 0; /* Composite input */
+ chan.norm = VIDEO_MODE_PAL;
+ break;
+
+ case PAL_60_TUNER :
+ chan.channel = 1; /* Tuner input */
+ chan.norm = VIDEO_MODE_PAL;
+ break;
+
+ case PAL_60_SVIDEO :
+ chan.channel = 2; /* S-Video input */
+ chan.norm = VIDEO_MODE_PAL;
+ break;
+
+ default :
+ break;
+ }
+
+ /* VIA Proprietary Attribute for Video control */
+ } else if (attribute == xvPort ){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvPort=%d\n", value));
+
+ } else if (attribute == xvCompose){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvCompose=%08x\n",value));
+
+ } else if (attribute == xvHQV){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvHQV=%08x\n",value));
+
+ } else if (attribute == xvBOB){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvBOB=%08x\n",value));
+
+ } else if (attribute == xvExitTV){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvExitTV=%08x\n",value));
+
+ /* VIA Proprietary Attribute for AUDIO control */
+ } else if (attribute == xvAudioCtrl ){
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvAudioSwitch=%d\n", value));
+
+ lpParam->attribute = ATTR_AUDIO_CONTROLByAP;
+ lpParam->value = value;
+
+ }else{
+ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : is not supported the attribute"));
+
+ return BadMatch;
+ }
+
+ if ( lpParam )
+ xfree(lpParam);
+ } /* else (pVia->V4LEnabled == 1) */
+
+ return Success;
+}
+
+static int
+viaGetPortAttributeG(
+ ScrnInfoPtr pScrn,
+ Atom attribute,
+ INT32 *value,
+ pointer data
+){
+ VIAPtr pVia = VIAPTR(pScrn);
+ viaPortPrivPtr pPriv = (viaPortPrivPtr)data;
+ int fd = -1;
+
+ DBG_DD(ErrorF(" via_video.c : viaGetPortAttributeG : port %d\n",pPriv->xv_portnum));
+
+ *value = 0;
+
+ if (pVia->V4LEnabled == 1) {
+ switch ( pPriv->xv_portnum )
+ {
+ case COMMAND_FOR_TV1 :
+ fd = open("/dev/video0",O_RDWR);
+ break;
+ case COMMAND_FOR_TV2 :
+ fd = open("/dev/video1",O_RDWR);
+ break;
+ case COMMAND_FOR_SWOV :
+ case COMMAND_FOR_DUMMY :
+ fd = open("/dev/video2",O_RDWR);
+ break;
+
+ case COMMAND_FOR_UTCTRL :
+ break;
+ default:
+ DBG_DD(ErrorF(" via_video.c : Error port access.\n"));
+ return XvBadAlloc;
+ }
+
+ if (attribute == xvColorKey ) {
+ *value =(INT32) pPriv->colorKey;
+ DBG_DD(ErrorF(" via_video.c : ColorKey 0x%x\n",pPriv->colorKey));
+
+ /* Color Control */
+ } else if (attribute == xvBrightness ||
+ attribute == xvContrast ||
+ attribute == xvSaturation ||
+ attribute == xvHue) {
+ ioctl(fd,VIDIOCGPICT,&pPriv->pict);
+ if (attribute == xvBrightness)
+ {
+ *value = v4l_to_xv(pPriv->pict.brightness);
+ DBG_DD(ErrorF(" xvBrightness = %08d\n", *value));
+ }
+ if (attribute == xvContrast)
+ {
+ *value = v4l_to_xv(pPriv->pict.contrast);
+ DBG_DD(ErrorF(" xvContrast = %08d\n", *value));
+ }
+ if (attribute == xvSaturation)
+ {
+ *value = v4l_to_xv(pPriv->pict.colour);
+ DBG_DD(ErrorF(" xvSaturation = %08d\n", *value));
+ }
+ if (attribute == xvHue)
+ {
+ *value = v4l_to_xv(pPriv->pict.hue);
+ DBG_DD(ErrorF(" xvHue = %08d\n", *value));
+ }
+
+ }else {
+ /*return BadMatch*/ ;
+ }
+ close(fd);
+ }
+ else { /* pVia->V4LEnabled == 1 */
+
+ if (attribute == xvColorKey ) {
+ *value =(INT32) pPriv->colorKey;
+ DBG_DD(ErrorF(" via_video.c : ColorKey 0x%x\n",pPriv->colorKey));
+
+ /* Color Control */
+ } else if (attribute == xvBrightness ||
+ attribute == xvContrast ||
+ attribute == xvSaturation ||
+ attribute == xvHue) {
+ if (attribute == xvBrightness)
+ {
+ *value = v4l_to_xv(pPriv->pict.brightness);
+ DBG_DD(ErrorF(" xvBrightness = %08d\n", *value));
+ }
+ if (attribute == xvContrast)
+ {
+ *value = v4l_to_xv(pPriv->pict.contrast);
+ DBG_DD(ErrorF(" xvContrast = %08d\n", *value));
+ }
+ if (attribute == xvSaturation)
+ {
+ *value = v4l_to_xv(pPriv->pict.colour);
+ DBG_DD(ErrorF(" xvSaturation = %08d\n", *value));
+ }
+ if (attribute == xvHue)
+ {
+ *value = v4l_to_xv(pPriv->pict.hue);
+ DBG_DD(ErrorF(" xvHue = %08d\n", *value));
+ }
+
+ }else {
+ /*return BadMatch*/ ;
+ }
+ } /* else (pVia->V4LEnabled == 1) */
+ return Success;
+}
+
+static void
+viaQueryBestSizeG(
+ ScrnInfoPtr pScrn,
+ Bool motion,
+ short vid_w, short vid_h,
+ short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h,
+ pointer data
+){
+ DBG_DD(ErrorF(" via_video.c : viaQueryBestSizeG :\n"));
+ *p_w = drw_w;
+ *p_h = drw_h;
+
+ if(*p_w > 2048 )
+ *p_w = 2048;
+}
+
+/*
+ * To do SW Flip
+ */
+static void Flip(viaPortPrivPtr pPriv, int fourcc, unsigned long DisplayBufferIndex)
+{
+ switch(fourcc)
+ {
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ while ((VIDInD(HQV_CONTROL) & HQV_SW_FLIP) );
+ VIDOutD(HQV_SRC_STARTADDR_Y, pPriv->ddLock.SWDevice.dwSWPhysicalAddr[DisplayBufferIndex]);
+ VIDOutD(HQV_CONTROL,( VIDInD(HQV_CONTROL)&~HQV_FLIP_ODD) |HQV_SW_FLIP|HQV_FLIP_STATUS);
+ break;
+
+ case FOURCC_YV12:
+ default:
+ while ((VIDInD(HQV_CONTROL) & HQV_SW_FLIP) );
+ VIDOutD(HQV_SRC_STARTADDR_Y, pPriv->ddLock.SWDevice.dwSWPhysicalAddr[DisplayBufferIndex]);
+ VIDOutD(HQV_SRC_STARTADDR_U, pPriv->ddLock.SWDevice.dwSWCbPhysicalAddr[DisplayBufferIndex]);
+ VIDOutD(HQV_SRC_STARTADDR_V, pPriv->ddLock.SWDevice.dwSWCrPhysicalAddr[DisplayBufferIndex]);
+ VIDOutD(HQV_CONTROL,( VIDInD(HQV_CONTROL)&~HQV_FLIP_ODD) |HQV_SW_FLIP|HQV_FLIP_STATUS);
+ break;
+ }
+}
+
+static void CopyDataYUV422(
+ ScrnInfoPtr pScrn,
+ VIAPtr pVia,
+ unsigned char * src,
+ unsigned char * dst,
+ int srcPitch,
+ int dstPitch,
+ int h,
+ int w )
+{
+ int count;
+
+ /* copy YUY2 data to video memory,
+ * do 32 bits alignment.
+ */
+ count = h;
+ while(count--) {
+ memcpy(dst, src, w);
+ src += srcPitch;
+ dst += dstPitch;
+ }
+}
+
+
+static void
+CopyDataYUV420(
+ ScrnInfoPtr pScrn,
+ VIAPtr pVia,
+ unsigned char *src1,
+ unsigned char *src2,
+ unsigned char *src3,
+ unsigned char *dst1,
+ unsigned char *dst2,
+ unsigned char *dst3,
+ int srcPitch,
+ int dstPitch,
+ int h,
+ int w
+){
+ int count;
+
+ /* copy Y component to video memory */
+ count = h;
+ while(count--) {
+ memcpy(dst1, src1, w);
+ src1 += srcPitch;
+ dst1 += dstPitch;
+ }
+
+ /* UV component is 1/4 of Y */
+ w >>= 1;
+ h >>= 1;
+ srcPitch >>= 1;
+ dstPitch >>= 1;
+
+ /* copy V(Cr) component to video memory */
+ count = h;
+ while(count--) {
+ memcpy(dst2, src2, w);
+ src2 += srcPitch;
+ dst2 += dstPitch;
+ }
+
+ /* copy U(Cb) component to video memory */
+ count = h;
+ while(count--) {
+ memcpy(dst3, src3, w);
+ src3 += srcPitch;
+ dst3 += dstPitch;
+ }
+
+}
+
+
+static int
+viaPutImageG(
+ ScrnInfoPtr pScrn,
+ short src_x, short src_y,
+ short drw_x, short drw_y,
+ short src_w, short src_h,
+ short drw_w, short drw_h,
+ int id, unsigned char* buf,
+ short width, short height,
+ Bool sync,
+ RegionPtr clipBoxes, pointer data
+){
+ VIAPtr pVia = VIAPTR(pScrn);
+ viaPortPrivPtr pPriv = (viaPortPrivPtr)data;
+ int viaVidEng = (int) pVia->VidMapBase;
+ int fd = -1, i;
+ BoxPtr pbox;
+
+ #ifdef XV_DEBUG
+ ErrorF(" via_video.c : viaPutImageG : called\n");
+ ErrorF(" via_video.c : FourCC=0x%x width=%d height=%d sync=%d\n",id,width,height,sync);
+ ErrorF(" via_video.c : src_x=%d src_y=%d src_w=%d src_h=%d colorkey=0x%x\n",src_x, src_y, src_w, src_h, pPriv->colorKey);
+ ErrorF(" via_video.c : drw_x=%d drw_y=%d drw_w=%d drw_h=%d\n",drw_x,drw_y,drw_w,drw_h);
+ #endif
+
+ if (pVia->V4LEnabled == 1) {
+ switch ( pPriv->xv_portnum )
+ {
+ case COMMAND_FOR_TV1 :
+ case COMMAND_FOR_TV2 :
+ DBG_DD(ErrorF(" via_video.c : : Shall not happen! \n"));
+ break;
+
+ case COMMAND_FOR_SWOV :
+ case COMMAND_FOR_DUMMY :
+ {
+ DDUPDATEOVERLAY UpdateOverlay_Video;
+ LPDDUPDATEOVERLAY lpUpdateOverlay = &UpdateOverlay_Video;
+
+ int srcPitch, dstPitch;
+ int srcYSize, srcUVSize;
+ int dstYSize, dstUVSize;
+ unsigned long dwUseExtendedFIFO=0;
+ unsigned long dwStartAddr = 0; /* for startaddr select */
+ static unsigned long old_dwUseExtendedFIFO=0;
+
+ DBG_DD(ErrorF(" via_video.c : : S/W Overlay! \n"));
+
+ fd = open("/dev/video2",O_RDWR);
+
+ /* Allocate video memory(CreateSurface),
+ * add codes to judge if need to re-create surface
+ */
+ if ( (pPriv->old_src_w != src_w) || (pPriv->old_src_h != src_h) )
+ DestroySWOVSurface(pScrn, pPriv, fd);
+
+ if ( !CreateSWOVSurface(pScrn, pPriv, fd, id, width, height) )
+ {
+ DBG_DD(ErrorF(" : Fail to Create SW Video Surface\n"));
+ }
+
+
+ /* Copy image data from system memory to video memory
+ * TODO: use DRM's DMA feature to accelerate data copy
+ */
+ srcPitch = width;
+ srcYSize = width * height;
+ srcUVSize = srcYSize >>2;
+ dstPitch = pPriv->ddLock.SWDevice.dwPitch;
+ dstYSize = dstPitch * height;
+ dstUVSize = dstYSize >>2;
+
+ switch(id)
+ {
+ case FOURCC_YV12:
+ CopyDataYUV420(pScrn, pVia, buf , buf + srcYSize, buf + srcYSize + srcUVSize,
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[dwFrameNum&1],
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[dwFrameNum&1] + dstYSize,
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[dwFrameNum&1] + dstYSize + dstUVSize,
+ srcPitch, dstPitch, height, width);
+ break;
+
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ CopyDataYUV422(pScrn, pVia, buf,
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[dwFrameNum&1],
+ srcPitch, dstPitch, height, width);
+ break;
+ }
+
+ /* If there is bandwidth issue, block the H/W overlay */
+ if ((((vmmtr)viaVidEng)->video3_ctl & 0x00000001) && !gdwOverlaySupportFlag)
+ return BadAlloc;
+
+ /*
+ * fill video overlay parameter
+ */
+ lpUpdateOverlay->rSrc.left = src_x;
+ lpUpdateOverlay->rSrc.top = src_y;
+ lpUpdateOverlay->rSrc.right = src_x + width;
+ lpUpdateOverlay->rSrc.bottom = src_y + height;
+
+ /* temp solve LinDVD AP bug */
+ /* When y<0, lindvd will send wrong x */
+ if (drw_y<0)
+ lpUpdateOverlay->rDest.left = drw_x/2;
+ else
+ lpUpdateOverlay->rDest.left = drw_x;
+ lpUpdateOverlay->rDest.top = drw_y;
+ lpUpdateOverlay->rDest.right = lpUpdateOverlay->rDest.left + drw_w;
+ lpUpdateOverlay->rDest.bottom = drw_y + drw_h;
+
+ lpUpdateOverlay->dwFlags = DDOVER_SHOW | DDOVER_KEYDEST;
+ if (pScrn->bitsPerPixel == 8)
+ {
+ lpUpdateOverlay->dwColorSpaceLowValue = pPriv->colorKey & 0xff;
+ }
+ else
+ {
+ lpUpdateOverlay->dwColorSpaceLowValue = pPriv->colorKey;
+ }
+ lpUpdateOverlay->dwFourcc = id;
+
+ /* If use extend FIFO mode */
+ if ((gVIAGraphicInfo.dwWidth > 1024))
+ {
+ dwUseExtendedFIFO = 1;
+ }
+
+
+ dwStartAddr = pPriv->ddLock.SWDevice.dwSWPhysicalAddr[dwFrameNum&1];
+
+ DBG_DD(ErrorF(" : dwStartAddr: %x\n", dwStartAddr));
+ DBG_DD(ErrorF(" : Flip\n"));
+ Flip(pPriv, id, dwFrameNum&1);
+
+ dwFrameNum ++;
+
+ /* If the dest rec. & extendFIFO doesn't change, don't do UpdateOverlay */
+ if ( (pPriv->old_drw_x == drw_x) && (pPriv->old_drw_y == drw_y)
+ && (pPriv->old_drw_w == drw_w) && (pPriv->old_drw_h == drw_h)
+ && (pPriv->old_src_w == src_w) && (pPriv->old_src_h == src_h)
+ && (old_dwUseExtendedFIFO == dwUseExtendedFIFO)
+ && (lpVideoControl->VideoStatus & SW_VIDEO_ON) )
+ {
+ close(fd);
+ return Success;
+ }
+
+ pPriv->old_drw_x = drw_x;
+ pPriv->old_drw_y = drw_y;
+ pPriv->old_drw_w = drw_w;
+ pPriv->old_drw_h = drw_h;
+ old_dwUseExtendedFIFO = dwUseExtendedFIFO;
+
+ /* add to judge if need to re-create surface */
+ pPriv->old_src_w = src_w;
+ pPriv->old_src_h = src_h;
+
+ /* BitBlt: Draw the colorkey rectangle */
+ if(!RegionsEqual(&pPriv->clip, clipBoxes)) {
+ REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
+ /* draw these */
+ /* FillSolidRects function cause segment fail in SAMM mode
+ * So I change to use SetupForSolidFill
+ */
+ /*
+ (pVia->AccelInfoRec->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy,
+ (CARD32)~0,
+ REGION_NUM_RECTS(clipBoxes),
+ REGION_RECTS(clipBoxes));
+ */
+ pVia->AccelInfoRec->SetupForSolidFill(pScrn,pPriv->colorKey,GXcopy,~0);
+ pbox=REGION_RECTS(clipBoxes);
+ for(i=REGION_NUM_RECTS(clipBoxes);i;i--,pbox++){
+ pVia->AccelInfoRec->SubsequentSolidFillRect(pScrn,pbox->x1,pbox->y1,
+ pbox->x2-pbox->x1,pbox->y2-pbox->y1);
+ }
+ }
+
+ /*
+ * Call v4l to do update video overlay
+ */
+ if ( -1 == ioctl(fd, VIA_VID_UPDATEOVERLAY, lpUpdateOverlay))
+ {
+ DBG_DD(ErrorF(" via_video.c : : call v4l updateoverlay fail. \n"));
+ }
+ else
+ {
+ close(fd);
+ return Success;
+ }
+ }
+ break;
+
+ case COMMAND_FOR_UTCTRL :{
+ VIAXVUtilityProc(pScrn, buf);
+ break;
+ }
+ default:
+ DBG_DD(ErrorF(" via_video.c : XVPort not supported\n"));
+ break;
+ }
+ }
+ else { /* pVia->V4LEnabled == 1 */
+ switch ( pPriv->xv_portnum )
+ {
+ case COMMAND_FOR_TV1 :
+ case COMMAND_FOR_TV2 :
+ DBG_DD(ErrorF(" via_video.c : : Shall not happen! \n"));
+ break;
+
+ case COMMAND_FOR_SWOV :
+ case COMMAND_FOR_DUMMY :
+ {
+ DDUPDATEOVERLAY UpdateOverlay_Video;
+ LPDDUPDATEOVERLAY lpUpdateOverlay = &UpdateOverlay_Video;
+
+ int srcPitch, dstPitch;
+ int srcYSize, srcUVSize;
+ int dstYSize, dstUVSize;
+ unsigned long dwUseExtendedFIFO=0;
+ unsigned long dwStartAddr = 0; /* for startaddr select */
+ static unsigned long old_dwUseExtendedFIFO=0;
+
+ DBG_DD(ErrorF(" via_video.c : : S/W Overlay! \n"));
+
+ /* Allocate video memory(CreateSurface),
+ * add codes to judge if need to re-create surface
+ */
+ if ( (pPriv->old_src_w != src_w) || (pPriv->old_src_h != src_h) )
+ DestroySWOVSurface(pScrn, pPriv, fd);
+
+ if ( !CreateSWOVSurface(pScrn, pPriv, fd, id, width, height) )
+ {
+ DBG_DD(ErrorF(" : Fail to Create SW Video Surface\n"));
+ }
+
+
+ /* Copy image data from system memory to video memory
+ * TODO: use DRM's DMA feature to accelerate data copy
+ */
+ srcPitch = width;
+ srcYSize = width * height;
+ srcUVSize = srcYSize >>2;
+ dstPitch = pPriv->ddLock.SWDevice.dwPitch;
+ dstYSize = dstPitch * height;
+ dstUVSize = dstYSize >>2;
+
+ switch(id)
+ {
+ case FOURCC_YV12:
+ CopyDataYUV420(pScrn, pVia, buf , buf + srcYSize, buf + srcYSize + srcUVSize,
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[dwFrameNum&1],
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[dwFrameNum&1] + dstYSize,
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[dwFrameNum&1] + dstYSize + dstUVSize,
+ srcPitch, dstPitch, height, width);
+ break;
+
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ CopyDataYUV422(pScrn, pVia, buf,
+ pPriv->ddLock.SWDevice.lpSWOverlaySurface[dwFrameNum&1],
+ srcPitch, dstPitch, height, width);
+ break;
+ }
+
+ /* If there is bandwidth issue, block the H/W overlay */
+ if ((((vmmtr)viaVidEng)->video3_ctl & 0x00000001) && !gdwOverlaySupportFlag)
+ return BadAlloc;
+
+ /*
+ * fill video overlay parameter
+ */
+ lpUpdateOverlay->rSrc.left = src_x;
+ lpUpdateOverlay->rSrc.top = src_y;
+ lpUpdateOverlay->rSrc.right = src_x + width;
+ lpUpdateOverlay->rSrc.bottom = src_y + height;
+
+ /* temp solve LinDVD AP bug */
+ /* When y<0, lindvd will send wrong x */
+ if (drw_y<0)
+ lpUpdateOverlay->rDest.left = drw_x/2;
+ else
+ lpUpdateOverlay->rDest.left = drw_x;
+ lpUpdateOverlay->rDest.top = drw_y;
+ lpUpdateOverlay->rDest.right = lpUpdateOverlay->rDest.left + drw_w;
+ lpUpdateOverlay->rDest.bottom = drw_y + drw_h;
+
+ lpUpdateOverlay->dwFlags = DDOVER_SHOW | DDOVER_KEYDEST;
+ if (pScrn->bitsPerPixel == 8)
+ {
+ lpUpdateOverlay->dwColorSpaceLowValue = pPriv->colorKey & 0xff;
+ }
+ else
+ {
+ lpUpdateOverlay->dwColorSpaceLowValue = pPriv->colorKey;
+ }
+ lpUpdateOverlay->dwFourcc = id;
+
+ /* If use extend FIFO mode */
+ if ((gVIAGraphicInfo.dwWidth > 1024))
+ {
+ dwUseExtendedFIFO = 1;
+ }
+
+
+ dwStartAddr = pPriv->ddLock.SWDevice.dwSWPhysicalAddr[dwFrameNum&1];
+
+ DBG_DD(ErrorF(" : dwStartAddr: %x\n", dwStartAddr));
+ DBG_DD(ErrorF(" : Flip\n"));
+ Flip(pPriv, id, dwFrameNum&1);
+
+ dwFrameNum ++;
+
+ /* If the dest rec. & extendFIFO doesn't change, don't do UpdateOverlay */
+ if ( (pPriv->old_drw_x == drw_x) && (pPriv->old_drw_y == drw_y)
+ && (pPriv->old_drw_w == drw_w) && (pPriv->old_drw_h == drw_h)
+ && (pPriv->old_src_w == src_w) && (pPriv->old_src_h == src_h)
+ && (old_dwUseExtendedFIFO == dwUseExtendedFIFO)
+ && (lpVideoControl->VideoStatus & SW_VIDEO_ON) )
+ {
+ return Success;
+ }
+
+ pPriv->old_drw_x = drw_x;
+ pPriv->old_drw_y = drw_y;
+ pPriv->old_drw_w = drw_w;
+ pPriv->old_drw_h = drw_h;
+ old_dwUseExtendedFIFO = dwUseExtendedFIFO;
+
+ /* add to judge if need to re-create surface */
+ pPriv->old_src_w = src_w;
+ pPriv->old_src_h = src_h;
+
+ /* BitBlt: Draw the colorkey rectangle */
+ if(!RegionsEqual(&pPriv->clip, clipBoxes)) {
+ REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
+ /* draw these */
+ /* FillSolidRects function cause segment fail in SAMM mode
+ * So I change to use SetupForSolidFill
+ */
+ /*
+ (pVia->AccelInfoRec->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy,
+ (CARD32)~0,
+ REGION_NUM_RECTS(clipBoxes),
+ REGION_RECTS(clipBoxes));
+ */
+ pVia->AccelInfoRec->SetupForSolidFill(pScrn,pPriv->colorKey,GXcopy,~0);
+ pbox=REGION_RECTS(clipBoxes);
+ for(i=REGION_NUM_RECTS(clipBoxes);i;i--,pbox++){
+ pVia->AccelInfoRec->SubsequentSolidFillRect(pScrn,pbox->x1,pbox->y1,
+ pbox->x2-pbox->x1,pbox->y2-pbox->y1);
+ }
+ }
+
+ /*
+ * Call v4l to do update video overlay
+ */
+ if ( -1 == VIAVidUpdateOverlay(pScrn, lpUpdateOverlay))
+ {
+ DBG_DD(ErrorF(" via_video.c : : call v4l updateoverlay fail. \n"));
+ }
+ else
+ {
+ return Success;
+ }
+ }
+ break;
+
+ case COMMAND_FOR_UTCTRL :{
+ VIAXVUtilityProc(pScrn, buf);
+ break;
+ }
+ default:
+ DBG_DD(ErrorF(" via_video.c : XVPort not supported\n"));
+ break;
+ }
+ } /* else (pVia->V4LEnabled == 1) */
+
+ return Success;
+}
+
+
+int viaReputImageG( ScrnInfoPtr pScrn, short drw_x, short drw_y,
+ RegionPtr clipBoxes, pointer data )
+{
+
+ DBG_DD(ErrorF(" via_video.c : viaReputImageG\n "));
+
+ return Success;
+}
+
+static int
+viaQueryImageAttributesG(
+ ScrnInfoPtr pScrn,
+ int id,
+ unsigned short *w, unsigned short *h,
+ int *pitches, int *offsets
+){
+ int size, tmp;
+
+ DBG_DD(ErrorF(" via_video.c : viaQueryImageAttributesG : FourCC=0x%x, ", id));
+
+ if ( (!w) || (!h) )
+ return 0;
+
+ if(*w > 1024) *w = 1024;
+ if(*h > 1024) *h = 1024;
+
+ *w = (*w + 1) & ~1;
+ if(offsets)
+ offsets[0] = 0;
+
+ switch(id) {
+ case 0x32315659: /*Planar format : YV12 -4:2:0*/
+ *h = (*h + 1) & ~1;
+ size = (*w + 3) & ~3;
+ if(pitches) pitches[0] = size;
+ size *= *h;
+ if(offsets) offsets[1] = size;
+ tmp = ((*w >> 1) + 3) & ~3;
+ if(pitches) pitches[1] = pitches[2] = tmp;
+ tmp *= (*h >> 1);
+ size += tmp;
+ if(offsets) offsets[2] = size;
+ size += tmp;
+ break;
+
+ case 0x59565955: /*Packed format : UYVY -4:2:2*/
+ case 0x32595559: /*Packed format : YUY2 -4:2:2*/
+ default:
+ size = *w << 1;
+ if(pitches)
+ pitches[0] = size;
+ size *= *h;
+ break;
+ }
+
+ if ( pitches )
+ DBG_DD(ErrorF(" pitches[0]=%d, pitches[1]=%d, pitches[2]=%d, ", pitches[0], pitches[1], pitches[2]));
+ if ( offsets )
+ DBG_DD(ErrorF(" offsets[0]=%d, offsets[1]=%d, offsets[2]=%d, ", offsets[0], offsets[1], offsets[2]));
+ DBG_DD(ErrorF(" width=%d, height=%d \n", *w, *h));
+
+ return size;
+}
+
+
+static int
+viaPutVideo(ScrnInfoPtr pScrn,
+ short src_x, short src_y, short drw_x, short drw_y,
+ short src_w, short src_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data)
+{
+
+ VIAPtr pVia = VIAPTR(pScrn);
+ viaPortPrivPtr pPriv=(viaPortPrivPtr)data;
+ int fd = -1;
+
+ #ifdef XV_DEBUG
+ ErrorF(" via_video.c : viaPutVideo : Src %dx%d, %d, %d, %p\n",src_w,src_h,src_x,src_y,clipBoxes);
+ ErrorF(" via_video.c : Dst %dx%d, %d, %d \n",drw_w,drw_h,drw_x,drw_y);
+ ErrorF(" via_video.c : colorkey : 0x%x \n",pPriv->colorKey);
+ #endif
+
+
+ /* BitBlt: Color fill */
+ if(!RegionsEqual(&pPriv->clip, clipBoxes)) {
+ REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
+ XAAFillSolidRects(pScrn,pPriv->colorKey,GXcopy, ~0,
+ REGION_NUM_RECTS(clipBoxes),
+ REGION_RECTS(clipBoxes));
+ }
+
+ if (pVia->V4LEnabled == 1) {
+ switch ( pPriv->xv_portnum )
+ {
+ case COMMAND_FOR_TV1 :
+ fd = open("/dev/video0",O_RDWR);
+
+ if ( -1 == ioctl(fd, VIA_VID_GET_VIDCTL, lpVideoControl) )
+ {
+ DBG_DD(ErrorF(" via_video.c : get video control fail \n"));
+ }
+
+ pPriv->yuv_win.x = drw_x;
+ pPriv->yuv_win.y = drw_y;
+ pPriv->yuv_win.width = drw_w;
+ pPriv->yuv_win.height = drw_h;
+
+ pPriv->yuv_win.chromakey = pPriv->colorKey;
+
+ if (-1 == ioctl(fd, VIDIOCSWIN, &pPriv->yuv_win))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Can't PutVideo from cap1 via V4L\n");
+ }
+
+ close(fd);
+ break;
+
+ case COMMAND_FOR_TV2 :
+ fd = open("/dev/video1",O_RDWR);
+
+ if ( -1 == ioctl(fd, VIA_VID_GET_VIDCTL, lpVideoControl) )
+ {
+ DBG_DD(ErrorF(" via_video.c : get video control fail \n"));
+ }
+
+ pPriv->yuv_win.x = drw_x;
+ pPriv->yuv_win.y = drw_y;
+ pPriv->yuv_win.width = drw_w;
+ pPriv->yuv_win.height = drw_h;
+
+ pPriv->yuv_win.chromakey = pPriv->colorKey;
+
+ if (-1 == ioctl(fd, VIDIOCSWIN, &pPriv->yuv_win))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Can't PutVideo from cap0 via V4L\n");
+ }
+
+ close(fd);
+ break;
+
+ case COMMAND_FOR_SWOV :
+ case COMMAND_FOR_DUMMY :
+ case COMMAND_FOR_UTCTRL :
+ DBG_DD(ErrorF(" via_video.c : This port doesn't support PutVideo.\n"));
+ return XvBadAlloc;
+ default:
+ DBG_DD(ErrorF(" via_video.c : Error port access.\n"));
+ return XvBadAlloc;
+ }
+ }
+
+ else { /* pVia->V4LEnabled == 1 */
+ switch ( pPriv->xv_portnum )
+ {
+ case COMMAND_FOR_TV1 :
+ pPriv->yuv_win.x = drw_x;
+ pPriv->yuv_win.y = drw_y;
+ pPriv->yuv_win.width = drw_w;
+ pPriv->yuv_win.height = drw_h;
+ pPriv->yuv_win.chromakey = pPriv->colorKey;
+ break;
+
+ case COMMAND_FOR_TV2 :
+ pPriv->yuv_win.x = drw_x;
+ pPriv->yuv_win.y = drw_y;
+ pPriv->yuv_win.width = drw_w;
+ pPriv->yuv_win.height = drw_h;
+ pPriv->yuv_win.chromakey = pPriv->colorKey;
+ break;
+
+ case COMMAND_FOR_SWOV :
+ case COMMAND_FOR_DUMMY :
+ case COMMAND_FOR_UTCTRL :
+ DBG_DD(ErrorF(" via_video.c : This port doesn't support PutVideo.\n"));
+ return XvBadAlloc;
+ default:
+ DBG_DD(ErrorF(" via_video.c : Error port access.\n"));
+ return XvBadAlloc;
+ }
+ } /* else (pVia->V4LEnabled == 1) */
+
+ return Success;
+}
+
+static int
+viaPutStill(ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data)
+{
+ DBG_DD(ErrorF(" via_video.c : viaPutStill :\n"));
+
+ return Success;
+}
+
+static int
+viaGetVideo(ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data)
+{
+ DBG_DD(ErrorF(" via_video.c : viaGetVideo :\n"));
+
+ return Success;
+
+}
+
+static int
+viaGetStill(ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data)
+{
+
+ DBG_DD(ErrorF(" via_video.c : viaGetStill :\n"));
+
+ return Success;
+}
+
+#endif /* !XvExtension */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_video.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_video.h new file mode 100644 index 000000000..086479474 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_video.h @@ -0,0 +1,134 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_VIDEO_H
+#define _VIA_VIDEO_H
+
+/*
+ * I N C L U D E S
+ */
+
+/* #define XV_DEBUG 1 */ /* write log msg to /var/log/XFree86.0.log */
+#define COLOR_KEY 1 /* set color key value from driver layer*/
+
+#ifdef XV_DEBUG
+# define DBG_DD(x) (x)
+#else
+# define DBG_DD(x)
+#endif
+
+#define HW_3123
+
+#define TRUE 1
+#define FALSE 0
+
+/* Definition for VideoStatus */
+#define VIDEO_NULL 0x00000000
+#define TV1SURFACE_CREATED 0x00000001
+#define TV2SURFACE_CREATED 0x00000002
+#define SWOV_SURFACE_CREATED 0x00000004
+#define HW_MPEG_ON 0x00000010
+#define TV1_VIDEO_ON 0x00000020
+#define TV2_VIDEO_ON 0x00000040
+#define SW_VIDEO_ON 0x00000080
+
+typedef struct {
+ unsigned long dwWidth; /* On screen Width */
+ unsigned long dwHeight; /* On screen Height */
+ unsigned long dwBPP; /* Bits Per Pixel */
+ unsigned long dwRefreshRate; /* Refresh rate of the mode */
+}MODEINFO, * LPMODEINFO;
+
+#define SDR100 1
+#define SDR133 2
+#define DDR100 3
+#define DDR133 4
+
+
+typedef struct{
+ unsigned long interruptflag; /* 200 */
+ unsigned long ramtab; /* 204 */
+ unsigned long alphawin_hvstart; /* 208 */
+ unsigned long alphawin_size; /* 20c */
+ unsigned long alphawin_ctl; /* 210 */
+ unsigned long crt_startaddr; /* 214 */
+ unsigned long crt_startaddr_2; /* 218 */
+ unsigned long alphafb_stride ; /* 21c */
+ unsigned long color_key; /* 220 */
+ unsigned long alphafb_addr; /* 224 */
+ unsigned long chroma_low; /* 228 */
+ unsigned long chroma_up; /* 22c */
+ unsigned long video1_ctl; /* 230 */
+ unsigned long video1_fetch; /* 234 */
+ unsigned long video1y_addr1; /* 238 */
+ unsigned long video1_stride; /* 23c */
+ unsigned long video1_hvstart; /* 240 */
+ unsigned long video1_size; /* 244 */
+ unsigned long video1y_addr2; /* 248 */
+ unsigned long video1_zoom; /* 24c */
+ unsigned long video1_mictl; /* 250 */
+ unsigned long video1y_addr0; /* 254 */
+ unsigned long video1_fifo; /* 258 */
+ unsigned long video1y_addr3; /* 25c */
+ unsigned long hi_control; /* 260 */
+ unsigned long snd_color_key; /* 264 */
+ unsigned long v3alpha_prefifo; /* 268 */
+ unsigned long v1_source_w_h; /* 26c */
+ unsigned long hi_transparent_color; /* 270 */
+ unsigned long v_display_temp; /* 274 :No use */
+ unsigned long v3alpha_fifo; /* 278 */
+ unsigned long v3_source_width; /* 27c */
+ unsigned long dummy1; /* 280 */
+ unsigned long video1_CSC1; /* 284 */
+ unsigned long video1_CSC2; /* 288 */
+ unsigned long video1u_addr0; /* 28c */
+ unsigned long video1_opqctl; /* 290 */
+ unsigned long video3_opqctl; /* 294 */
+ unsigned long compose; /* 298 */
+ unsigned long dummy2; /* 29c */
+ unsigned long video3_ctl; /* 2a0 */
+ unsigned long video3_addr0; /* 2a4 */
+ unsigned long video3_addr1; /* 2a8 */
+ unsigned long video3_stribe; /* 2ac */
+ unsigned long video3_hvstart; /* 2b0 */
+ unsigned long video3_size; /* 2b4 */
+ unsigned long v3alpha_fetch; /* 2b8 */
+ unsigned long video3_zoom; /* 2bc */
+ unsigned long video3_mictl; /* 2c0 */
+ unsigned long video3_CSC1; /* 2c4 */
+ unsigned long video3_CSC2; /* 2c8 */
+ unsigned long v3_display_temp; /* 2cc */
+ unsigned long reserved[5]; /* 2d0 */
+ unsigned long video1u_addr1; /* 2e4 */
+ unsigned long video1u_addr2; /* 2e8 */
+ unsigned long video1u_addr3; /* 2ec */
+ unsigned long video1v_addr0; /* 2f0 */
+ unsigned long video1v_addr1; /* 2f4 */
+ unsigned long video1v_addr2; /* 2f8 */
+ unsigned long video1v_addr3; /* 2fc */
+} video_via_regs;
+
+#define vmmtr volatile video_via_regs *
+
+#endif /* _VIA_VIDEO_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_vt1622a.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_vt1622a.h new file mode 100644 index 000000000..0085d4f1e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_vt1622a.h @@ -0,0 +1,365 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_VT1622AMODETABLE_H
+#define _VIA_VT1622AMODETABLE_H
+
+VIABIOSTVMASKTableRec vt1622aMaskTable = {
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1, 0XF0, 0, 0X60, 0, 0, 0, 0, 0, 0, 0X5A, 0, 0X3F, 0, 0, 0X3F, 0XA2, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X20, 0X40, 0X80, 0, 0X47, 0X1C, 0, 0 },
+ { 0, 0, 0, 0X47, 0X1C, 0, 0, 0 },
+ { 0XE7, 0XCF, 0XCF, 0XE7, 0XDA, 0X23, 0XF, 0X37, 0XA2, 0X3F, 0X3F, 0XA2, 0X52, 0X12, 0X5A, 0X48, 0, 0, 0, 0, 0, 0X2D, 0X5A, 0, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XE7, 0XCF, 0XCF, 0XE7, 0XDA, 0X23, 0XF, 0X37, 0XA2, 0X3F, 0X3F, 0XA2, 0X52, 0X12, 0X5A, 0X48, 0, 0, 0, 0, 0, 0X5A, 0XB4, 0X40, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0XE7, 0XCF, 0XCF, 0XE7, 0XDA, 0X23, 0XF, 0X37, 0XA2, 0X3F, 0X3F, 0XA2, 0X52, 0X12, 0X5A, 0X48, 0, 0, 0, 0, 0, 0XB4, 0X68, 0X81, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X6, 0X2A02, 0X6A65, 0X6266, 0X6567, 0X9027, 0X992B, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0X4, 0X302, 0X5865, 0X4866, 0X4967, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+ }
+};
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/via_xvpriv.h b/xc/programs/Xserver/hw/xfree86/drivers/via/via_xvpriv.h new file mode 100644 index 000000000..2709472db --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/via_xvpriv.h @@ -0,0 +1,95 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __VIA_XVPRIV_H
+#define __VIA_XVPRIV_H
+
+#include "videodev.h"
+
+#define XV_PORT_NUM 5
+#define XV_SWOV_PORTID 0
+#define XV_TV1_PORTID 1
+#define XV_TV2_PORTID 2
+#define XV_UTCTRL_PORTID 3
+#define XV_DUMMY_PORTID 4
+
+#define COMMAND_FOR_SWOV XV_SWOV_PORTID
+#define COMMAND_FOR_TV1 XV_TV1_PORTID
+#define COMMAND_FOR_TV2 XV_TV2_PORTID
+#define COMMAND_FOR_UTCTRL XV_UTCTRL_PORTID
+#define COMMAND_FOR_DUMMY XV_DUMMY_PORTID
+
+typedef struct {
+ unsigned char xv_portnum;
+ unsigned char brightness;
+ unsigned char saturation;
+ unsigned char contrast;
+ unsigned char hue;
+ unsigned long dwEncoding;
+ RegionRec clip;
+ CARD32 colorKey;
+ Time offTime;
+ Time freeTime;
+ VIACAPINFO CapInfo;
+ VIAAUDCTRL AudCtrl;
+
+ /* Surface structure */
+ DDSURFACEDESC SurfaceDesc;
+ DDLOCK ddLock;
+
+ /* file handle */
+ int nr;
+ struct video_capability cap;
+
+ /* attributes */
+ struct video_picture pict;
+ struct video_audio audio;
+
+ int *input;
+ int *norm;
+ int nenc,cenc;
+
+ /* yuv to offscreen */
+ struct video_window yuv_win;
+
+ /* store old video source & dst data */
+ short old_src_w;
+ short old_src_h;
+
+ short old_drw_x;
+ short old_drw_y;
+ short old_drw_w;
+ short old_drw_h;
+
+} viaPortPrivRec, *viaPortPrivPtr;
+
+#if 0
+__inline void AllocatePortPriv();
+__inline void FreePortPriv();
+__inline void ClearPortPriv(int);
+viaPortPrivPtr GetPortPriv(int);
+void SetPortPriv(int nIndex, unsigned long dwAction, unsigned long dwValue);
+unsigned long IdentifyPort(viaPortPrivPtr);
+#endif
+#endif /* end of __VIA_XVPRIV_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/videodev.h b/xc/programs/Xserver/hw/xfree86/drivers/via/videodev.h new file mode 100644 index 000000000..467262d6a --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/videodev.h @@ -0,0 +1,255 @@ +#ifndef __LINUX_VIDEODEV_H
+#define __LINUX_VIDEODEV_H
+
+/* Linux V4L API, Version 1
+ * videodev.h from v4l driver in Linux 2.2.3
+ *
+ * Used here with the explicit permission of the original author, Alan Cox.
+ * <alan@lxorguk.ukuu.org.uk>
+ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h,v 1.7tsi Exp $ */
+
+#include "Xmd.h"
+
+#define VID_TYPE_CAPTURE 1 /* Can capture */
+#define VID_TYPE_TUNER 2 /* Can tune */
+#define VID_TYPE_TELETEXT 4 /* Does teletext */
+#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
+#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
+#define VID_TYPE_CLIPPING 32 /* Can clip */
+#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
+#define VID_TYPE_SCALES 128 /* Scalable */
+#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
+#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
+
+struct video_capability
+{
+ char name[32];
+ int type;
+ int channels; /* Num channels */
+ int audios; /* Num audio devices */
+ int maxwidth; /* Supported width */
+ int maxheight; /* And height */
+ int minwidth; /* Supported width */
+ int minheight; /* And height */
+};
+
+
+struct video_channel
+{
+ int channel;
+ char name[32];
+ int tuners;
+ CARD32 flags;
+#define VIDEO_VC_TUNER 1 /* Channel has a tuner */
+#define VIDEO_VC_AUDIO 2 /* Channel has audio */
+ CARD16 type;
+#define VIDEO_TYPE_TV 1
+#define VIDEO_TYPE_CAMERA 2
+ CARD16 norm; /* Norm set by channel */
+};
+
+struct video_tuner
+{
+ int tuner;
+ char name[32];
+ unsigned long rangelow, rangehigh; /* Tuner range */
+ CARD32 flags;
+#define VIDEO_TUNER_PAL 1
+#define VIDEO_TUNER_NTSC 2
+#define VIDEO_TUNER_SECAM 4
+#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
+#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
+#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
+ CARD16 mode; /* PAL/NTSC/SECAM/OTHER */
+#define VIDEO_MODE_PAL 0
+#define VIDEO_MODE_NTSC 1
+#define VIDEO_MODE_SECAM 2
+#define VIDEO_MODE_AUTO 3
+ CARD16 signal; /* Signal strength 16bit scale */
+};
+
+struct video_picture
+{
+ CARD16 brightness;
+ CARD16 hue;
+ CARD16 colour;
+ CARD16 contrast;
+ CARD16 whiteness; /* Black and white only */
+ CARD16 depth; /* Capture depth */
+ CARD16 palette; /* Palette in use */
+#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
+#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
+#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
+#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
+#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
+#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
+#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
+#define VIDEO_PALETTE_YUYV 8
+#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
+#define VIDEO_PALETTE_YUV420 10
+#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
+#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
+#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
+#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
+#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
+#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
+#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
+#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
+};
+
+struct video_audio
+{
+ int audio; /* Audio channel */
+ CARD16 volume; /* If settable */
+ CARD16 bass, treble;
+ CARD32 flags;
+#define VIDEO_AUDIO_MUTE 1
+#define VIDEO_AUDIO_MUTABLE 2
+#define VIDEO_AUDIO_VOLUME 4
+#define VIDEO_AUDIO_BASS 8
+#define VIDEO_AUDIO_TREBLE 16
+ char name[16];
+#define VIDEO_SOUND_MONO 1
+#define VIDEO_SOUND_STEREO 2
+#define VIDEO_SOUND_LANG1 4
+#define VIDEO_SOUND_LANG2 8
+ CARD16 mode;
+ CARD16 balance; /* Stereo balance */
+ CARD16 step; /* Step actual volume uses */
+};
+
+struct video_clip
+{
+ INT32 x,y;
+ INT32 width, height;
+ struct video_clip *next; /* For user use/driver use only */
+};
+
+struct video_window
+{
+ CARD32 x,y; /* Position of window */
+ CARD32 width,height; /* Its size */
+ CARD32 chromakey;
+ CARD32 flags;
+ struct video_clip *clips; /* Set only */
+ int clipcount;
+#define VIDEO_WINDOW_INTERLACE 1
+#define VIDEO_CLIP_BITMAP -1
+/* bitmap is 1024x625, a '1' bit represents a clipped pixel */
+#define VIDEO_CLIPMAP_SIZE (128 * 625)
+};
+
+struct video_capture
+{
+ CARD32 x,y; /* Offsets into image */
+ CARD32 width, height; /* Area to capture */
+ CARD16 decimation; /* Decimation divder */
+ CARD16 flags; /* Flags for capture */
+#define VIDEO_CAPTURE_ODD 0 /* Temporal */
+#define VIDEO_CAPTURE_EVEN 1
+};
+
+struct video_buffer
+{
+ void *base;
+ int height,width;
+ int depth;
+ int bytesperline;
+};
+
+struct video_mmap
+{
+ unsigned int frame; /* Frame (0 - n) for double buffer */
+ int height,width;
+ unsigned int format; /* should be VIDEO_PALETTE_* */
+};
+
+struct video_key
+{
+ CARD8 key[8];
+ CARD32 flags;
+};
+
+
+#define VIDEO_MAX_FRAME 32
+
+struct video_mbuf
+{
+ int size; /* Total memory to map */
+ int frames; /* Frames */
+ int offsets[VIDEO_MAX_FRAME];
+};
+
+
+#define VIDEO_NO_UNIT (-1)
+
+
+struct video_unit
+{
+ int video; /* Video minor */
+ int vbi; /* VBI minor */
+ int radio; /* Radio minor */
+ int audio; /* Audio minor */
+ int teletext; /* Teletext minor */
+};
+
+#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
+#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
+#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
+#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
+#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
+#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
+#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
+#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
+#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Set the video overlay window */
+#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
+#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
+#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
+#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
+#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
+#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
+#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
+#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
+#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
+#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
+#define VIDIOCGMBUF _IOR('v', 20, struct video_mbuf) /* Memory map buffer info */
+#define VIDIOCGUNIT _IOR('v', 21, struct video_unit) /* Get attached units */
+#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get frame buffer */
+#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set frame buffer - root only */
+
+#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
+
+
+#define VID_HARDWARE_BT848 1
+#define VID_HARDWARE_QCAM_BW 2
+#define VID_HARDWARE_PMS 3
+#define VID_HARDWARE_QCAM_C 4
+#define VID_HARDWARE_PSEUDO 5
+#define VID_HARDWARE_SAA5249 6
+#define VID_HARDWARE_AZTECH 7
+#define VID_HARDWARE_SF16MI 8
+#define VID_HARDWARE_RTRACK 9
+#define VID_HARDWARE_ZOLTRIX 10
+#define VID_HARDWARE_SAA7146 11
+#define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */
+#define VID_HARDWARE_RTRACK2 13
+#define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */
+#define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */
+#define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */
+#define VID_HARDWARE_BROADWAY 17 /* Broadway project */
+#define VID_HARDWARE_GEMTEK 18
+#define VID_HARDWARE_TYPHOON 19
+#define VID_HARDWARE_VINO 20 /* Reserved for SGI Indy Vino */
+
+/*
+ * Initialiser list
+ */
+
+struct video_init
+{
+ char *name;
+ int (*init)(struct video_init *);
+};
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/xf86drmVIA.c b/xc/programs/Xserver/hw/xfree86/drivers/via/xf86drmVIA.c new file mode 100644 index 000000000..3f4981293 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/xf86drmVIA.c @@ -0,0 +1,120 @@ +#ifdef XFree86Server
+# include "xf86.h"
+# include "xf86_OSproc.h"
+# include "xf86_ansic.h"
+# define _DRM_MALLOC xalloc
+# define _DRM_FREE xfree
+# ifndef XFree86LOADER
+# include <sys/mman.h>
+# endif
+#else
+# include <stdio.h>
+# include <stdlib.h>
+# include <unistd.h>
+# include <string.h>
+# include <ctype.h>
+# include <fcntl.h>
+# include <errno.h>
+# include <signal.h>
+# include <sys/types.h>
+# include <sys/ioctl.h>
+# include <sys/mman.h>
+# include <sys/time.h>
+# ifdef DRM_USE_MALLOC
+# define _DRM_MALLOC malloc
+# define _DRM_FREE free
+extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *);
+extern int xf86RemoveSIGIOHandler(int fd);
+# else
+# include <X11/Xlibint.h>
+# define _DRM_MALLOC Xmalloc
+# define _DRM_FREE Xfree
+# endif
+#endif
+
+/* Not all systems have MAP_FAILED defined */
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+#ifdef __linux__
+#include <sys/sysmacros.h> /* for makedev() */
+#endif
+#include "xf86drm.h"
+#include "xf86drmVIA.h"
+#include "drm.h"
+
+int drmVIAAgpInit(int fd, int offset, int size)
+{
+ drm_via_agp_t agp;
+ agp.offset = offset;
+ agp.size = size;
+
+ if (ioctl(fd, DRM_IOCTL_VIA_AGP_INIT, &agp) < 0) {
+ return -errno;
+ }
+ else {
+ return 0;
+ }
+}
+
+int drmVIAFBInit(int fd, int offset, int size)
+{
+ drm_via_fb_t fb;
+ fb.offset = offset;
+ fb.size = size;
+
+ if (ioctl(fd, DRM_IOCTL_VIA_FB_INIT, &fb) < 0) {
+ return -errno;
+ }
+ else
+ return 0;
+}
+
+int drmVIAInitMAP(int fd, drmVIAInit *info)
+{
+ drm_via_init_t init;
+
+ memset(&init, 0, sizeof(drm_via_init_t));
+
+ init.func = VIA_INIT_MAP;
+
+ init.sarea_priv_offset = info->sarea_priv_offset;
+ init.fb_offset = info->fb_offset;
+ init.mmio_offset = info->mmio_offset;
+ init.agpAddr = info->agpAddr;
+
+ if (ioctl(fd, DRM_IOCTL_VIA_MAP_INIT, &init ) < 0) {
+ return -errno;
+ }
+ else
+ return 0;
+}
+
+int drmVIAAllocateDMA(int fd, drmVIADMABuf *buf)
+{
+ if (drmAddMap(fd, 0, buf->size,
+ DRM_SHM, 0,
+ &buf->index) < 0) {
+ return -errno;
+ }
+
+ if (drmMap(fd,
+(drmHandle)buf->index,
+ buf->size,
+(drmAddressPtr)(&buf->address)) < 0) {
+ return -errno;
+ }
+
+ memset(buf->address, 0, buf->size);
+
+ return 0;
+}
+
+int drmVIAReleaseDMA(int fd, drmVIADMABuf *buf)
+{
+ if (drmUnmap((drmAddress)(buf->address), buf->size) < 0)
+ return -errno;
+
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/via/xf86drmVIA.h b/xc/programs/Xserver/hw/xfree86/drivers/via/xf86drmVIA.h new file mode 100644 index 000000000..26e32f738 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/via/xf86drmVIA.h @@ -0,0 +1,30 @@ +#ifndef __XF86DRI_VIA_H__
+#define __XF86DRI_VIA_H__
+
+typedef struct {
+ unsigned long sarea_priv_offset;
+ unsigned long fb_offset;
+ unsigned long mmio_offset;
+ unsigned long agpAddr;
+} drmVIAInit;
+
+typedef struct {
+ unsigned int offset;
+ unsigned int size;
+ unsigned int index;
+} drmVIAAGPBuf;
+
+typedef struct {
+ unsigned int offset;
+ unsigned int size;
+ unsigned long index;
+ unsigned long *address;
+} drmVIADMABuf;
+
+extern int drmVIAAgpInit(int fd, int offset, int size);
+extern int drmVIAFBInit(int fd, int offset, int size);
+extern int drmVIAInitMAP(int fd, drmVIAInit *info);
+extern int drmVIAAllocateDMA(int fd, drmVIADMABuf *buf);
+extern int drmVIAReleaseDMA(int fd, drmVIADMABuf *buf);
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via.h new file mode 100644 index 000000000..55908f047 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via.h @@ -0,0 +1,46 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __VIA_H__
+#define __VIA_H__
+
+
+#define DRM(x) viadrv_##x
+
+
+#define __HAVE_AGP 1
+#define __MUST_HAVE_AGP 0
+#define __HAVE_MTRR 1
+#define __HAVE_CTX_BITMAP 1
+
+
+#define DRIVER_AGP_BUFFERS_MAP( dev ) \
+ ((drm_via_private_t *)((dev)->dev_private))->buffers
+
+extern int via_init_context(int context);
+extern int via_final_context(int context);
+
+#define DRIVER_CTX_CTOR via_init_context
+#define DRIVER_CTX_DTOR via_final_context
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_drm.h new file mode 100644 index 000000000..38eb4647a --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_drm.h @@ -0,0 +1,155 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#ifndef _VIA_DRM_H_
+#define _VIA_DRM_H_
+
+/* WARNING: These defines must be the same as what the Xserver uses.
+ * if you change them, you must change the defines in the Xserver.
+ */
+
+#ifndef _VIA_DEFINES_
+#define _VIA_DEFINES_
+
+#define VIA_DMA_BUF_ORDER 12
+#define VIA_DMA_BUF_SZ (1 << VIA_DMA_BUF_ORDER)
+#define VIA_DMA_BUF_NR 256
+#define VIA_NR_SAREA_CLIPRECTS 8
+
+/* Each region is a minimum of 64k, and there are at most 64 of them.
+ */
+#define VIA_NR_TEX_REGIONS 64
+#define VIA_LOG_MIN_TEX_REGION_SIZE 16
+#endif
+
+#define VIA_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */
+#define VIA_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */
+#define VIA_UPLOAD_CTX 0x4
+#define VIA_UPLOAD_BUFFERS 0x8
+#define VIA_UPLOAD_TEX0 0x10
+#define VIA_UPLOAD_TEX1 0x20
+#define VIA_UPLOAD_CLIPRECTS 0x40
+#define VIA_UPLOAD_ALL 0xff
+
+/* VIA specific ioctls */
+#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(0x40, drm_via_mem_t)
+#define DRM_IOCTL_VIA_FREEMEM DRM_IOW(0x41, drm_via_mem_t)
+#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(0x42, drm_via_agp_t)
+#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(0x43, drm_via_fb_t)
+#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(0x44, drm_via_init_t)
+
+/* Indices into buf.Setup where various bits of state are mirrored per
+ * context and per buffer. These can be fired at the card as a unit,
+ * or in a piecewise fashion as required.
+ */
+
+#define VIA_TEX_SETUP_SIZE 8
+
+/* Flags for clear ioctl
+ */
+#define VIA_FRONT 0x1
+#define VIA_BACK 0x2
+#define VIA_DEPTH 0x4
+#define VIA_STENCIL 0x8
+#define VIDEO 0
+#define AGP 1
+typedef struct {
+ unsigned int offset;
+ unsigned int size;
+} drm_via_agp_t;
+
+typedef struct {
+ unsigned int offset;
+ unsigned int size;
+} drm_via_fb_t;
+
+typedef struct {
+ unsigned int context;
+ unsigned int type;
+ unsigned int size;
+ unsigned long index;
+ unsigned long offset;
+} drm_via_mem_t;
+
+typedef struct _drm_via_init {
+ enum {
+ VIA_INIT_MAP = 0x01,
+ VIA_CLEANUP_MAP = 0x02
+ } func;
+
+ unsigned long sarea_priv_offset;
+ unsigned long fb_offset;
+ unsigned long mmio_offset;
+ unsigned long agpAddr;
+} drm_via_init_t;
+
+/* Warning: If you change the SAREA structure you must change the Xserver
+ * structure as well */
+
+typedef struct _drm_via_tex_region {
+ unsigned char next, prev; /* indices to form a circular LRU */
+ unsigned char inUse; /* owned by a client, or free? */
+ int age; /* tracked by clients to update local LRU's */
+} drm_via_tex_region_t;
+
+typedef struct _drm_via_sarea {
+ unsigned int dirty;
+ unsigned int nbox;
+ drm_clip_rect_t boxes[VIA_NR_SAREA_CLIPRECTS];
+ drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1];
+ int texAge; /* last time texture was uploaded */
+ int ctxOwner; /* last context to upload state */
+ int vertexPrim;
+} drm_via_sarea_t;
+
+typedef struct _drm_via_flush_agp {
+ unsigned int offset;
+ unsigned int size;
+ unsigned int index;
+ int discard; /* client is finished with the buffer? */
+} drm_via_flush_agp_t;
+
+typedef struct _drm_via_flush_sys {
+ unsigned int offset;
+ unsigned int size;
+ unsigned long index;
+ int discard; /* client is finished with the buffer? */
+} drm_via_flush_sys_t;
+
+#ifdef __KERNEL__
+int via_fb_init(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg);
+int via_mem_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg);
+int via_mem_free(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg);
+int via_agp_init(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg);
+int via_dma_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg);
+int via_dma_free(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg);
+int via_map_init(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg);
+#endif
+#endif /* _VIA_DRM_H_ */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_drv.c new file mode 100644 index 000000000..6bd1bd79e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_drv.c @@ -0,0 +1,66 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#include <linux/config.h>
+#include "via.h"
+#include "drmP.h"
+#include "via_drm.h"
+#include "via_drv.h"
+
+#define DRIVER_AUTHOR "VIA"
+
+#define DRIVER_NAME "via"
+#define DRIVER_DESC "VIA CLE 266"
+#define DRIVER_DATE "20020814"
+
+#define DRIVER_MAJOR 1
+#define DRIVER_MINOR 1
+#define DRIVER_PATCHLEVEL 0
+
+
+#define DRIVER_IOCTLS \
+ [DRM_IOCTL_NR(DRM_IOCTL_VIA_ALLOCMEM)] = { via_mem_alloc, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_VIA_FREEMEM)] = { via_mem_free, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_VIA_AGP_INIT)] = { via_agp_init, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_VIA_FB_INIT)] = { via_fb_init, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_VIA_MAP_INIT)] = { via_map_init, 1, 0 }
+
+
+#define __HAVE_COUNTERS 0
+
+#include "drm_auth.h"
+#include "drm_agpsupport.h"
+#include "drm_bufs.h"
+#include "drm_context.h"
+#include "drm_dma.h"
+#include "drm_drawable.h"
+#include "drm_drv.h"
+#include "drm_fops.h"
+#include "drm_init.h"
+#include "drm_ioctl.h"
+#include "drm_lists.h"
+#include "drm_lock.h"
+#include "drm_memory.h"
+#include "drm_proc.h"
+#include "drm_vm.h"
+#include "drm_stub.h"
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_drv.h new file mode 100644 index 000000000..1b731437d --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_drv.h @@ -0,0 +1,149 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#ifndef _VIA_DRV_H_
+#define _VIA_DRV_H_
+
+typedef struct drm_via_private {
+ drm_via_sarea_t *sarea_priv;
+ drm_map_t *sarea;
+ drm_map_t *fb;
+ drm_map_t *mmio;
+ unsigned long agpAddr;
+} drm_via_private_t;
+
+extern int via_do_init_map(drm_device_t *dev, drm_via_init_t *init);
+extern int via_do_cleanup_map(drm_device_t *dev);
+extern int via_map_init(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+
+/*=* [DBG] For RedHat7.3 insert kernel module has unresolved symbol
+ cmpxchg() *=*/
+
+/* Include this here so that driver can be used with older kernels. */
+#ifndef __HAVE_ARCH_CMPXCHG
+
+#ifdef CONFIG_SMP
+#define LOCK_PREFIX "lock ; "
+#else
+#define LOCK_PREFIX ""
+#endif
+
+#if defined(__alpha__)
+static __inline__ unsigned long
+__cmpxchg_u32(volatile int *m, int old, int new)
+{
+ unsigned long prev, cmp;
+
+ __asm__ __volatile__(
+ "1: ldl_l %0,%2\n"
+ " cmpeq %0,%3,%1\n"
+ " beq %1,2f\n"
+ " mov %4,%1\n"
+ " stl_c %1,%2\n"
+ " beq %1,3f\n"
+ "2: mb\n"
+ ".subsection 2\n"
+ "3: br 1b\n"
+ ".previous"
+ : "=&r"(prev), "=&r"(cmp), "=m"(*m)
+ : "r"((long) old), "r"(new), "m"(*m));
+
+ return prev;
+}
+
+static __inline__ unsigned long
+__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
+{
+ unsigned long prev, cmp;
+
+ __asm__ __volatile__(
+ "1: ldq_l %0,%2\n"
+ " cmpeq %0,%3,%1\n"
+ " beq %1,2f\n"
+ " mov %4,%1\n"
+ " stq_c %1,%2\n"
+ " beq %1,3f\n"
+ "2: mb\n"
+ ".subsection 2\n"
+ "3: br 1b\n"
+ ".previous"
+ : "=&r"(prev), "=&r"(cmp), "=m"(*m)
+ : "r"((long) old), "r"(new), "m"(*m));
+
+ return prev;
+}
+
+static __inline__ unsigned long
+__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
+{
+ switch (size) {
+ case 4:
+ return __cmpxchg_u32(ptr, old, new);
+ case 8:
+ return __cmpxchg_u64(ptr, old, new);
+ }
+ return old;
+}
+#define cmpxchg(ptr,o,n) \
+ ({ \
+ __typeof__(*(ptr)) _o_ = (o); \
+ __typeof__(*(ptr)) _n_ = (n); \
+ (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
+ (unsigned long)_n_, sizeof(*(ptr))); \
+ })
+
+#elif __i386__
+static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
+ unsigned long new, int size)
+{
+ unsigned long prev;
+ switch (size) {
+ case 1:
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*__xg(ptr)), "0"(old)
+ : "memory");
+ return prev;
+ case 2:
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*__xg(ptr)), "0"(old)
+ : "memory");
+ return prev;
+ case 4:
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*__xg(ptr)), "0"(old)
+ : "memory");
+ return prev;
+ }
+ return old;
+}
+
+#define cmpxchg(ptr,o,n) \
+ ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \
+ (unsigned long)(n),sizeof(*(ptr))))
+#endif /* i386 & alpha */
+#endif
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_ds.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_ds.c new file mode 100644 index 000000000..b45416486 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_ds.c @@ -0,0 +1,399 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#define __NO_VERSION__
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/poll.h>
+#include <asm/io.h>
+#include <linux/pci.h>
+
+#include "via_ds.h"
+extern unsigned int VIA_DEBUG;
+
+set_t *setInit(void)
+{
+ int i;
+ set_t *set;
+ set = (set_t *)MALLOC(sizeof(set_t));
+ for (i = 0; i < SET_SIZE; i++) {
+ set->list[i].free_next = i+1;
+ set->list[i].alloc_next = -1;
+ }
+ set->list[SET_SIZE-1].free_next = -1;
+ set->free = 0;
+ set->alloc = -1;
+ set->trace = -1;
+ return set;
+}
+
+int setAdd(set_t *set, ITEM_TYPE item)
+{
+ int free = set->free;
+ if (free != -1) {
+ set->list[free].val = item;
+ set->free = set->list[free].free_next;
+ }
+ else {
+ return 0;
+ }
+ set->list[free].alloc_next = set->alloc;
+ set->alloc = free;
+ set->list[free].free_next = -1;
+ return 1;
+}
+
+int setDel(set_t *set, ITEM_TYPE item)
+{
+ int alloc = set->alloc;
+ int prev = -1;
+
+ while (alloc != -1) {
+ if (set->list[alloc].val == item) {
+ if (prev != -1)
+ set->list[prev].alloc_next = set->list[alloc].alloc_next;
+ else
+ set->alloc = set->list[alloc].alloc_next;
+ break;
+ }
+ prev = alloc;
+ alloc = set->list[alloc].alloc_next;
+ }
+
+ if (alloc == -1)
+ return 0;
+
+ set->list[alloc].free_next = set->free;
+ set->free = alloc;
+ set->list[alloc].alloc_next = -1;
+
+ return 1;
+}
+
+/* setFirst -> setAdd -> setNext is wrong */
+
+int setFirst(set_t *set, ITEM_TYPE *item)
+{
+ if (set->alloc == -1)
+ return 0;
+
+ *item = set->list[set->alloc].val;
+ set->trace = set->list[set->alloc].alloc_next;
+
+
+ return 1;
+}
+
+int setNext(set_t *set, ITEM_TYPE *item)
+{
+ if (set->trace == -1)
+ return 0;
+
+ *item = set->list[set->trace].val;
+ set->trace = set->list[set->trace].alloc_next;
+
+ return 1;
+}
+
+int setDestroy(set_t *set)
+{
+ FREE(set);
+
+ return 1;
+}
+
+#define ISFREE(bptr) ((bptr)->free)
+
+#define PRINTF(fmt, arg...) do{}while(0)
+#define fprintf(fmt, arg...) do{}while(0)
+
+static void *calloc(size_t nmemb, size_t size)
+{
+ void *addr;
+ addr = kmalloc(nmemb*size, GFP_KERNEL);
+ memset(addr, 0, nmemb*size);
+ return addr;
+}
+#define free(n) kfree(n)
+
+void mmDumpMemInfo( memHeap_t *heap )
+{
+ TMemBlock *p;
+
+ PRINTF ("Memory heap %p:\n", heap);
+
+ if (heap == 0)
+ PRINTF (" heap == 0\n");
+ else {
+ p = (TMemBlock *)heap;
+
+ while (p) {
+ PRINTF (" Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
+ p->free ? '.':'U',
+ p->reserved ? 'R':'.');
+ p = p->next;
+ }
+ }
+
+ PRINTF ("End of memory blocks\n");
+}
+
+memHeap_t *mmInit(int ofs,
+ int size)
+{
+ PMemBlock blocks;
+
+ if (size <= 0)
+ return 0;
+
+
+ blocks = (TMemBlock *)calloc(1,sizeof(TMemBlock));
+
+ if (blocks) {
+ blocks->ofs = ofs;
+ blocks->size = size;
+ blocks->free = 1;
+ return (memHeap_t *)blocks;
+ } else
+ return 0;
+}
+
+memHeap_t *mmAddRange(memHeap_t *heap,
+ int ofs,
+ int size)
+{
+ PMemBlock blocks;
+ blocks = (TMemBlock *) calloc(2,sizeof(TMemBlock));
+
+ if (blocks) {
+ blocks[0].size = size;
+ blocks[0].free = 1;
+ blocks[0].ofs = ofs;
+ blocks[0].next = &blocks[1];
+
+ /* Discontinuity - stops JoinBlock from trying to join non-adjacent
+ * ranges.
+ */
+ blocks[1].size = 0;
+ blocks[1].free = 0;
+ blocks[1].ofs = ofs+size;
+ blocks[1].next = (PMemBlock) heap;
+ return (memHeap_t *)blocks;
+ }
+else
+ return heap;
+}
+
+static TMemBlock* SliceBlock(TMemBlock *p,
+ int startofs, int size,
+ int reserved, int alignment)
+{
+ TMemBlock *newblock;
+
+ /* break left */
+ if (startofs > p->ofs) {
+ newblock = (TMemBlock*)calloc(1,sizeof(TMemBlock));
+ newblock->ofs = startofs;
+ newblock->size = p->size - (startofs - p->ofs);
+ newblock->free = 1;
+ newblock->next = p->next;
+ p->size -= newblock->size;
+ p->next = newblock;
+ p = newblock;
+ }
+
+ /* break right */
+ if (size < p->size) {
+ newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock));
+ newblock->ofs = startofs + size;
+ newblock->size = p->size - size;
+ newblock->free = 1;
+ newblock->next = p->next;
+ p->size = size;
+ p->next = newblock;
+ }
+
+ /* p = middle block */
+ p->align = alignment;
+ p->free = 0;
+ p->reserved = reserved;
+ return p;
+}
+
+PMemBlock mmAllocMem(memHeap_t *heap, int size, int align2, int startSearch)
+{
+ int mask,startofs,endofs;
+ TMemBlock *p;
+
+ if (!heap || align2 < 0 || size <= 0)
+ return NULL;
+
+ mask = (1 << align2)-1;
+ startofs = 0;
+ p = (TMemBlock *)heap;
+
+ while (p) {
+ if (ISFREE(p)) {
+ startofs = (p->ofs + mask) & ~mask;
+
+ if ( startofs < startSearch )
+ startofs = startSearch;
+
+ endofs = startofs+size;
+
+ if (endofs <= (p->ofs+p->size))
+ break;
+ }
+
+ p = p->next;
+ }
+
+ if (!p)
+ return NULL;
+
+ p = SliceBlock(p,startofs,size,0,mask+1);
+ p->heap = heap;
+
+ return p;
+}
+
+static __inline__ int Join2Blocks(TMemBlock *p)
+{
+ if (p->free && p->next && p->next->free) {
+ TMemBlock *q = p->next;
+ p->size += q->size;
+ p->next = q->next;
+ free(q);
+
+ return 1;
+ }
+
+ return 0;
+}
+
+int mmFreeMem(PMemBlock b)
+{
+ TMemBlock *p,*prev;
+
+ if (!b)
+ return 0;
+
+ if (!b->heap) {
+ fprintf(stderr, "no heap\n");
+
+ return -1;
+ }
+
+ p = b->heap;
+ prev = NULL;
+
+ while (p && p != b) {
+ prev = p;
+ p = p->next;
+ }
+
+ if (!p || p->free || p->reserved) {
+ if (!p)
+ fprintf(stderr, "block not found in heap\n");
+ else if (p->free)
+ fprintf(stderr, "block already free\n");
+ else
+ fprintf(stderr, "block is reserved\n");
+
+
+ return -1;
+ }
+
+ p->free = 1;
+ Join2Blocks(p);
+
+ if (prev)
+ Join2Blocks(prev);
+
+ return 0;
+}
+
+int mmReserveMem(memHeap_t *heap, int offset,int size)
+{
+ int endofs;
+ TMemBlock *p;
+
+ if (!heap || size <= 0)
+ return -1;
+ endofs = offset+size;
+ p = (TMemBlock *)heap;
+
+ while (p && p->ofs <= offset) {
+ if (ISFREE(p) && endofs <= (p->ofs+p->size)) {
+ SliceBlock(p,offset,size,1,1);
+ return 0;
+ }
+ p = p->next;
+ }
+ return -1;
+}
+
+int mmFreeReserved(memHeap_t *heap, int offset)
+{
+ TMemBlock *p,*prev;
+
+ if (!heap)
+ return -1;
+
+ p = (TMemBlock *)heap;
+ prev = NULL;
+
+ while (p && p->ofs != offset) {
+ prev = p;
+ p = p->next;
+ }
+
+ if (!p || !p->reserved)
+ return -1;
+ p->free = 1;
+ p->reserved = 0;
+ Join2Blocks(p);
+
+ if (prev)
+ Join2Blocks(prev);
+
+ return 0;
+}
+
+void mmDestroy(memHeap_t *heap)
+{
+ TMemBlock *p,*q;
+
+ if (!heap)
+ return;
+ p = (TMemBlock *)heap;
+
+ while (p) {
+ q = p->next;
+ free(p);
+ p = q;
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_ds.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_ds.h new file mode 100644 index 000000000..ab4e19b72 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_ds.h @@ -0,0 +1,133 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#ifndef _via_ds_h_
+#define _via_ds_h_
+
+/* Set Data Structure */
+
+#define SET_SIZE 5000
+#define MALLOC(s) kmalloc(s, GFP_KERNEL)
+#define FREE(s) kfree(s)
+
+typedef unsigned int ITEM_TYPE;
+
+typedef struct {
+ ITEM_TYPE val;
+ int alloc_next, free_next;
+} list_item_t;
+
+typedef struct {
+ int alloc;
+ int free;
+ int trace;
+ list_item_t list[SET_SIZE];
+} set_t;
+
+set_t *setInit(void);
+int setAdd(set_t *set, ITEM_TYPE item);
+int setDel(set_t *set, ITEM_TYPE item);
+int setFirst(set_t *set, ITEM_TYPE *item);
+int setNext(set_t *set, ITEM_TYPE *item);
+int setDestroy(set_t *set);
+
+#endif
+
+
+#ifndef MM_INC
+#define MM_INC
+
+struct mem_block_t {
+ struct mem_block_t *next;
+ struct mem_block_t *heap;
+ int ofs,size;
+ int align;
+ int free:1;
+ int reserved:1;
+};
+typedef struct mem_block_t TMemBlock;
+typedef struct mem_block_t *PMemBlock;
+
+/* a heap is just the first block in a chain */
+typedef struct mem_block_t memHeap_t;
+
+static __inline__ int mmBlockSize(PMemBlock b)
+{ return b->size; }
+
+static __inline__ int mmOffset(PMemBlock b)
+{ return b->ofs; }
+
+static __inline__ void mmMarkReserved(PMemBlock b)
+{ b->reserved = 1; }
+
+/*
+ * input: total size in bytes
+ * return: a heap pointer if OK, NULL if error
+ */
+memHeap_t *mmInit(int ofs, int size);
+
+
+
+memHeap_t *mmAddRange(memHeap_t *heap,
+ int ofs,
+ int size);
+
+
+/*
+ * Allocate 'size' bytes with 2^align2 bytes alignment,
+ * restrict the search to free memory after 'startSearch'
+ * depth and back buffers should be in different 4mb banks
+ * to get better page hits if possible
+ * input: size = size of block
+ * align2 = 2^align2 bytes alignment
+ * startSearch = linear offset from start of heap to begin search
+ * return: pointer to the allocated block, 0 if error
+ */
+PMemBlock mmAllocMem(memHeap_t *heap, int size, int align2, int startSearch);
+
+/*
+ * Free block starts at offset
+ * input: pointer to a block
+ * return: 0 if OK, -1 if error
+ */
+int mmFreeMem(PMemBlock b);
+
+/*
+ * Reserve 'size' bytes block start at offset
+ * This is used to prevent allocation of memory already used
+ * by the X server for the front buffer, pixmaps, and cursor
+ * input: size, offset
+ * output: 0 if OK, -1 if error
+ */
+int mmReserveMem(memHeap_t *heap, int offset,int size);
+int mmFreeReserved(memHeap_t *heap, int offset);
+
+/*
+ * destroy MM
+ */
+void mmDestroy(memHeap_t *mmInit);
+
+/* For debuging purpose. */
+void mmDumpMemInfo(memHeap_t *mmInit);
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_map.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_map.c new file mode 100644 index 000000000..9e42a0b1f --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_map.c @@ -0,0 +1,119 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#define __NO_VERSION__
+#include "via.h"
+#include "drmP.h"
+#include "via_drv.h"
+
+int via_do_init_map(drm_device_t *dev, drm_via_init_t *init)
+{
+ drm_via_private_t *dev_priv;
+ struct list_head *list;
+
+ DRM_DEBUG("%s\n", __FUNCTION__);
+
+ dev_priv = DRM(alloc)(sizeof(drm_via_private_t), DRM_MEM_DRIVER);
+ if (dev_priv == NULL)
+ return -ENOMEM;
+
+ memset(dev_priv, 0, sizeof(drm_via_private_t));
+
+ list_for_each(list, &dev->maplist->head) {
+ drm_map_list_t *r_list = (drm_map_list_t *)list;
+ if ( r_list->map &&
+ r_list->map->type == _DRM_SHM &&
+ r_list->map->flags & _DRM_CONTAINS_LOCK) {
+ dev_priv->sarea = r_list->map;
+ break;
+ }
+ }
+ if (!dev_priv->sarea) {
+ DRM_ERROR("could not find sarea!\n");
+ dev->dev_private = (void *)dev_priv;
+ via_do_cleanup_map(dev);
+ return -EINVAL;
+ }
+
+ DRM_FIND_MAP(dev_priv->fb, init->fb_offset);
+ if (!dev_priv->fb) {
+ DRM_ERROR("could not find framebuffer!\n");
+ dev->dev_private = (void *)dev_priv;
+ via_do_cleanup_map(dev);
+ return -EINVAL;
+ }
+ DRM_FIND_MAP(dev_priv->mmio, init->mmio_offset);
+ if (!dev_priv->mmio) {
+ DRM_ERROR("could not find mmio region!\n");
+ dev->dev_private = (void *)dev_priv;
+ via_do_cleanup_map(dev);
+ return -EINVAL;
+ }
+
+ dev_priv->sarea_priv =
+ (drm_via_sarea_t *)((u8 *)dev_priv->sarea->handle +
+ init->sarea_priv_offset);
+
+ dev_priv->agpAddr = init->agpAddr;
+
+ dev->dev_private = (void *)dev_priv;
+
+ return 0;
+}
+
+int via_do_cleanup_map(drm_device_t *dev)
+{
+ if (dev->dev_private) {
+
+ drm_via_private_t *dev_priv = dev->dev_private;
+
+ DRM(free)(dev_priv, sizeof(drm_via_private_t),
+ DRM_MEM_DRIVER);
+ dev->dev_private = NULL;
+ }
+
+ return 0;
+}
+
+int via_map_init(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_via_init_t init;
+
+ DRM_DEBUG("%s\n", __FUNCTION__);
+
+ if (copy_from_user(&init, (drm_via_init_t *)arg, sizeof(init)))
+ return -EFAULT;
+
+ switch (init.func) {
+ case VIA_INIT_MAP:
+ return via_do_init_map(dev, &init);
+ case VIA_CLEANUP_MAP:
+ return via_do_cleanup_map(dev);
+ }
+
+ return -EINVAL;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_mm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_mm.c new file mode 100644 index 000000000..9bf7624d6 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_mm.c @@ -0,0 +1,346 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#define __NO_VERSION__
+#include "via.h"
+#include "drmP.h"
+#include "via_drm.h"
+#include "via_drv.h"
+#include "via_ds.h"
+#include "via_mm.h"
+
+#define MAX_CONTEXT 100
+
+unsigned int VIA_DEBUG = 1;
+
+typedef struct {
+ int used;
+ int context;
+ set_t *sets[2]; /* 0 for frame buffer, 1 for AGP , 2 for System*/
+} via_context_t;
+
+static via_context_t global_ppriv[MAX_CONTEXT];
+
+static int add_alloc_set(int context, int type, unsigned int val)
+{
+ int i, retval = 0;
+
+ for (i = 0; i < MAX_CONTEXT; i++)
+ {
+ if (global_ppriv[i].used && global_ppriv[i].context == context) {
+ retval = setAdd(global_ppriv[i].sets[type], val);
+ break;
+ }
+ }
+
+ return retval;
+}
+
+static int del_alloc_set(int context, int type, unsigned int val)
+{
+ int i, retval = 0;
+
+ for (i = 0; i < MAX_CONTEXT; i++)
+ if (global_ppriv[i].used && global_ppriv[i].context == context) {
+ retval = setDel(global_ppriv[i].sets[type], val);
+ break;
+ }
+
+ return retval;
+}
+
+/* agp memory management */
+static memHeap_t *AgpHeap = NULL;
+
+int via_agp_init(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_via_agp_t agp;
+
+ if (copy_from_user(&agp, (drm_via_agp_t *)arg, sizeof(agp)))
+ return -EFAULT;
+
+ AgpHeap = mmInit(agp.offset, agp.size);
+
+ DRM_DEBUG("offset = %u, size = %u", agp.offset, agp.size);
+
+ return 0;
+}
+
+/* fb memory management */
+static memHeap_t *FBHeap = NULL;
+
+int via_fb_init(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_via_fb_t fb;
+
+
+ if (copy_from_user(&fb, (drm_via_fb_t *)arg, sizeof(fb)))
+ return -EFAULT;
+
+ FBHeap = mmInit(fb.offset, fb.size);
+
+ DRM_DEBUG("offset = %u, size = %u", fb.offset, fb.size);
+
+ return 0;
+}
+
+int via_init_context(int context)
+{
+ int i;
+
+ for (i = 0; i < MAX_CONTEXT ; i++)
+ if (global_ppriv[i].used && (global_ppriv[i].context == context))
+ break;
+
+ if (i >= MAX_CONTEXT) {
+ for (i = 0; i < MAX_CONTEXT ; i++) {
+ if (!global_ppriv[i].used) {
+ global_ppriv[i].context = context;
+ global_ppriv[i].used = 1;
+ global_ppriv[i].sets[0] = setInit();
+ global_ppriv[i].sets[1] = setInit();
+ DRM_DEBUG("init allocation set, socket=%d, context = %d\n",
+ i, context);
+ break;
+ }
+ }
+
+ if ((i >= MAX_CONTEXT) || (global_ppriv[i].sets[0] == NULL) ||
+ (global_ppriv[i].sets[1] == NULL)) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+int via_final_context(int context)
+{
+ int i;
+ for (i=0; i<MAX_CONTEXT; i++)
+ if (global_ppriv[i].used && (global_ppriv[i].context == context))
+ break;
+
+ if (i < MAX_CONTEXT) {
+ set_t *set;
+ unsigned int item;
+ int retval;
+
+ DRM_DEBUG("find socket %d, context = %d\n", i, context);
+
+ /* Video Memory */
+ set = global_ppriv[i].sets[0];
+ retval = setFirst(set, &item);
+ while (retval) {
+ DRM_DEBUG("free video memory 0x%x\n", item);
+ mmFreeMem((PMemBlock)item);
+ retval = setNext(set, &item);
+ }
+ setDestroy(set);
+
+ /* AGP Memory */
+ set = global_ppriv[i].sets[1];
+ retval = setFirst(set, &item);
+ while (retval) {
+ DRM_DEBUG("free agp memory 0x%x\n", item);
+ mmFreeMem((PMemBlock)item);
+ retval = setNext(set, &item);
+ }
+ setDestroy(set);
+
+ global_ppriv[i].used = 0;
+ }
+
+ return 1;
+}
+int via_mem_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_via_mem_t mem;
+
+ if (copy_from_user(&mem, (drm_via_mem_t *)arg, sizeof(mem)))
+ return -EFAULT;
+
+ switch (mem.type) {
+ case VIDEO :
+ if (via_fb_alloc(&mem) < 0)
+ return -EFAULT;
+ if (copy_to_user((drm_via_mem_t *)arg, &mem, sizeof(mem)))
+ return -EFAULT;
+ return 0;
+ case AGP :
+ if (via_agp_alloc(&mem) < 0)
+ return -EFAULT;
+ if (copy_to_user((drm_via_mem_t *)arg, &mem, sizeof(mem)))
+ return -EFAULT;
+ return 0;
+ }
+
+ return -EFAULT;
+}
+int via_fb_alloc(drm_via_mem_t* mem)
+{
+ drm_via_mm_t fb;
+ PMemBlock block;
+ int retval = 0;
+
+ if (!FBHeap)
+ return -1;
+
+ fb.size = mem->size;
+ fb.context = mem->context;
+
+ block = mmAllocMem(FBHeap, fb.size, 5, 0);
+ if (block) {
+ fb.offset = block->ofs;
+ fb.free = (unsigned int)block;
+ if (!add_alloc_set(fb.context, VIDEO, fb.free)) {
+ DRM_DEBUG("adding to allocation set fails\n");
+ mmFreeMem((PMemBlock)fb.free);
+ retval = -1;
+ }
+ }
+ else {
+ fb.offset = 0;
+ fb.size = 0;
+ fb.free = 0;
+ }
+
+ mem->offset = fb.offset;
+ mem->index = fb.free;
+
+ DRM_DEBUG("alloc fb, size = %d, offset = %d\n", fb.size, (int)fb.offset);
+
+ return retval;
+}
+int via_agp_alloc(drm_via_mem_t* mem)
+{
+ drm_via_mm_t agp;
+ PMemBlock block;
+ int retval = 0;
+
+ if (!AgpHeap)
+ return -1;
+
+ agp.size = mem->size;
+ agp.context = mem->context;
+
+ block = mmAllocMem(AgpHeap, agp.size, 5, 0);
+ if (block) {
+ agp.offset = block->ofs;
+ agp.free = (unsigned int)block;
+ if (!add_alloc_set(agp.context, AGP, agp.free)) {
+ DRM_DEBUG("adding to allocation set fails\n");
+ mmFreeMem((PMemBlock)agp.free);
+ retval = -1;
+ }
+ }
+ else {
+ agp.offset = 0;
+ agp.size = 0;
+ agp.free = 0;
+ }
+
+ mem->offset = agp.offset;
+ mem->index = agp.free;
+
+ DRM_DEBUG("alloc agp, size = %d, offset = %d\n", agp.size, (unsigned int)agp.offset);
+ return retval;
+}
+int via_mem_free(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_via_mem_t mem;
+
+ if (copy_from_user(&mem, (drm_via_mem_t *)arg, sizeof(mem)))
+ return -EFAULT;
+
+ switch (mem.type) {
+
+ case VIDEO :
+ if (via_fb_free(&mem) == 0)
+ return 0;
+ break;
+ case AGP :
+ if (via_agp_free(&mem) == 0)
+ return 0;
+ break;
+ }
+
+ return -EFAULT;
+}
+int via_fb_free(drm_via_mem_t* mem)
+{
+ drm_via_mm_t fb;
+ int retval = 0;
+
+
+ if (!FBHeap) {
+ return -1;
+ }
+
+ fb.free = mem->index;
+ fb.context = mem->context;
+
+ if (!fb.free)
+ {
+ return -1;
+
+ }
+
+ mmFreeMem((PMemBlock)fb.free);
+
+ if (!del_alloc_set(fb.context, VIDEO, fb.free))
+ {
+ retval = -1;
+ }
+
+ DRM_DEBUG("free fb, free = %d\n", fb.free);
+
+ return retval;
+}
+int via_agp_free(drm_via_mem_t* mem)
+{
+ drm_via_mm_t agp;
+
+ int retval = 0;
+
+ agp.free = mem->index;
+ agp.context = mem->context;
+
+ if (!agp.free)
+ return -1;
+
+ mmFreeMem((PMemBlock)agp.free);
+
+ if (!del_alloc_set(agp.context, AGP, agp.free))
+ {
+ retval = -1;
+ }
+
+ DRM_DEBUG("free agp, free = %d\n", agp.free);
+
+ return retval;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_mm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_mm.h new file mode 100644 index 000000000..faa4bf7e0 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/via_mm.h @@ -0,0 +1,45 @@ +/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#ifndef _via_drm_mm_h_
+#define _via_drm_mm_h_
+
+typedef struct {
+ unsigned int context;
+ unsigned int size;
+ unsigned long offset;
+ unsigned int free;
+} drm_via_mm_t;
+
+typedef struct {
+ unsigned int size;
+ unsigned long handle;
+ void *virtual;
+} drm_via_dma_t;
+
+int via_fb_alloc(drm_via_mem_t *mem);
+int via_fb_free(drm_via_mem_t *mem);
+int via_agp_alloc(drm_via_mem_t *mem);
+int via_agp_free(drm_via_mem_t *mem);
+
+#endif
|