17e6fb56fSmrg/* 27e6fb56fSmrg * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] 37e6fb56fSmrg * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. 47e6fb56fSmrg * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. 57e6fb56fSmrg * 67e6fb56fSmrg * Permission is hereby granted, free of charge, to any person obtaining a 77e6fb56fSmrg * copy of this software and associated documentation files (the "Software"), 87e6fb56fSmrg * to deal in the Software without restriction, including without limitation 97e6fb56fSmrg * the rights to use, copy, modify, merge, publish, distribute, sub license, 107e6fb56fSmrg * and/or sell copies of the Software, and to permit persons to whom the 117e6fb56fSmrg * Software is furnished to do so, subject to the following conditions: 127e6fb56fSmrg * 137e6fb56fSmrg * The above copyright notice and this permission notice (including the 147e6fb56fSmrg * next paragraph) shall be included in all copies or substantial portions 157e6fb56fSmrg * of the Software. 167e6fb56fSmrg * 177e6fb56fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 187e6fb56fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 197e6fb56fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 207e6fb56fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 217e6fb56fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 227e6fb56fSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 237e6fb56fSmrg * DEALINGS IN THE SOFTWARE. 247e6fb56fSmrg */ 257e6fb56fSmrg 267e6fb56fSmrg#ifndef _VIA_DRIVER_H_ 277e6fb56fSmrg#define _VIA_DRIVER_H_ 1 287e6fb56fSmrg 298aedb4f6Smrg//#define VIA_DEBUG_COMPOSITE 1 307e6fb56fSmrg#define HAVE_DEBUG 1 317e6fb56fSmrg 327e6fb56fSmrg#ifdef HAVE_DEBUG 337e6fb56fSmrg#define DEBUG(x) x 347e6fb56fSmrg#else 357e6fb56fSmrg#define DEBUG(x) 367e6fb56fSmrg#endif 377e6fb56fSmrg 387e6fb56fSmrg#include "vgaHW.h" 397e6fb56fSmrg#include "xf86.h" 407e6fb56fSmrg 418aedb4f6Smrg#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 427e6fb56fSmrg#include "xf86Resources.h" 437e6fb56fSmrg#endif 447e6fb56fSmrg 457e6fb56fSmrg#include "xf86Pci.h" 467e6fb56fSmrg#include "xf86_OSproc.h" 477e6fb56fSmrg#include "compiler.h" 487e6fb56fSmrg#include "xf86Cursor.h" 497e6fb56fSmrg#include "mipointer.h" 507e6fb56fSmrg#include "micmap.h" 517e6fb56fSmrg#include "fourcc.h" 527e6fb56fSmrg#include "fb.h" 537e6fb56fSmrg 548aedb4f6Smrg#include "xf86Crtc.h" 5503bd066fSmrg#include "xf86fbman.h" 568aedb4f6Smrg#include "xf86RandR12.h" 577e6fb56fSmrg#include "xf86cmap.h" 587e6fb56fSmrg 598aedb4f6Smrg#ifdef HAVE_DRI 607e6fb56fSmrg#define _XF86DRI_SERVER_ 618aedb4f6Smrg#include "xf86dri.h" 627e6fb56fSmrg#include "sarea.h" 637e6fb56fSmrg#include "dri.h" 648aedb4f6Smrg#include "drm_fourcc.h" 657e6fb56fSmrg#include "GL/glxint.h" 667e6fb56fSmrg#include "via_dri.h" 678aedb4f6Smrg#include "via_drmclient.h" 688aedb4f6Smrg#include "via_drm.h" 697e6fb56fSmrg#endif 707e6fb56fSmrg#include "exa.h" 718aedb4f6Smrg#include "via_memmgr.h" 728aedb4f6Smrg 738aedb4f6Smrg#include "via_regs.h" 748aedb4f6Smrg#include "via_kms.h" 758aedb4f6Smrg#include "via_ums.h" 768aedb4f6Smrg#include "via_dmabuffer.h" 778aedb4f6Smrg#include "via_3d.h" 788aedb4f6Smrg#include "via_xv.h" 798aedb4f6Smrg#include "via_xv_overlay.h" 808aedb4f6Smrg#include "via_eng_regs.h" 818aedb4f6Smrg 828aedb4f6Smrg#ifdef HAVE_PCIACCESS 838aedb4f6Smrg#include <pciaccess.h> 848aedb4f6Smrg#else 858aedb4f6Smrg#include "xf86PciInfo.h" 868aedb4f6Smrg#endif 878aedb4f6Smrg#include <errno.h> 888aedb4f6Smrg 8944802259Smrg#include "via_vt1632.h" 9044802259Smrg 918aedb4f6Smrg#include "compat-api.h" 927e6fb56fSmrg#define VIA_AGP_UPL_SIZE (1024*128) 937e6fb56fSmrg#define VIA_DMA_DL_SIZE (1024*128) 947e6fb56fSmrg#define VIA_SCRATCH_SIZE (4*1024*1024) 957e6fb56fSmrg 967e6fb56fSmrg/* 977e6fb56fSmrg * Pixmap sizes below which we don't try to do hw accel. 987e6fb56fSmrg */ 997e6fb56fSmrg 1007e6fb56fSmrg#define VIA_MIN_COMPOSITE 400 1017e6fb56fSmrg#define VIA_MIN_UPLOAD 4000 1027e6fb56fSmrg#define VIA_MIN_TEX_UPLOAD 200 1037e6fb56fSmrg#define VIA_MIN_DOWNLOAD 200 1047e6fb56fSmrg 1057e6fb56fSmrg#define AGP_PAGE_SIZE 4096 1067e6fb56fSmrg#define AGP_PAGES 8192 1077e6fb56fSmrg#define AGP_SIZE (AGP_PAGE_SIZE * AGP_PAGES) 1087e6fb56fSmrg 1097e6fb56fSmrg#define DRIVER_NAME "openchrome" 1108aedb4f6Smrg#define VIA_VERSION ((VIA_MAJOR_VERSION << 24) | (VIA_MINOR_VERSION << 16) | VIA_PATCHLEVEL) 1117e6fb56fSmrg 1128aedb4f6Smrg#define VIA_VQ_SIZE (256 * 1024) 1137e6fb56fSmrg 1148aedb4f6Smrg#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 1157e6fb56fSmrg#define VIA_RES_SHARED RES_SHARED_VGA 1167e6fb56fSmrg#define VIA_RES_UNDEF RES_UNDEFINED 1177e6fb56fSmrg#else 1187e6fb56fSmrg#define VIA_RES_SHARED NULL 1197e6fb56fSmrg#define VIA_RES_UNDEF NULL 1207e6fb56fSmrg#endif 1217e6fb56fSmrg 1228aedb4f6Smrg/* Video Engines */ 1238aedb4f6Smrg#define VIDEO_ENGINE_UNK 0 /* Unknown video engine */ 1248aedb4f6Smrg#define VIDEO_ENGINE_CLE 1 /* CLE First generation video engine */ 1258aedb4f6Smrg#define VIDEO_ENGINE_CME 2 /* CME Second generation video engine */ 1268aedb4f6Smrg 1278aedb4f6Smrgstatic int gVIAEntityIndex = -1; 1288aedb4f6Smrg 1297e6fb56fSmrgtypedef struct { 1301090d90aSmrg CARD8 SR[256]; 1311090d90aSmrg CARD8 CR[256]; 1327e6fb56fSmrg} VIARegRec, *VIARegPtr; 1337e6fb56fSmrg 1347e6fb56fSmrg/* 1358aedb4f6Smrg * variables that need to be shared among different screens. 1367e6fb56fSmrg */ 1377e6fb56fSmrgtypedef struct { 1387e6fb56fSmrg Bool b3DRegsInitialized; 1397e6fb56fSmrg} ViaSharedRec, *ViaSharedPtr; 1407e6fb56fSmrg 1418aedb4f6Smrgenum dri_type { 1428aedb4f6Smrg DRI_NONE, 1438aedb4f6Smrg DRI_1, 1448aedb4f6Smrg DRI_2 1458aedb4f6Smrg}; 1468aedb4f6Smrg 1478aedb4f6Smrg#ifdef HAVE_DRI 1487e6fb56fSmrg 1497e6fb56fSmrg#define VIA_XVMC_MAX_BUFFERS 2 1507e6fb56fSmrg#define VIA_XVMC_MAX_CONTEXTS 4 1517e6fb56fSmrg#define VIA_XVMC_MAX_SURFACES 20 1527e6fb56fSmrg 1537e6fb56fSmrgtypedef struct { 1548aedb4f6Smrg struct buffer_object *memory_ref; 1557e6fb56fSmrg unsigned long offsets[VIA_XVMC_MAX_BUFFERS]; 1567e6fb56fSmrg} ViaXvMCSurfacePriv; 1577e6fb56fSmrg 1587e6fb56fSmrgtypedef struct { 1597e6fb56fSmrg drm_context_t drmCtx; 1607e6fb56fSmrg} ViaXvMCContextPriv; 1617e6fb56fSmrg 1627e6fb56fSmrgtypedef struct { 1637e6fb56fSmrg XID contexts[VIA_XVMC_MAX_CONTEXTS]; 1647e6fb56fSmrg XID surfaces[VIA_XVMC_MAX_SURFACES]; 1657e6fb56fSmrg ViaXvMCSurfacePriv *sPrivs[VIA_XVMC_MAX_SURFACES]; 1667e6fb56fSmrg ViaXvMCContextPriv *cPrivs[VIA_XVMC_MAX_CONTEXTS]; 1677e6fb56fSmrg int nContexts,nSurfaces; 1687e6fb56fSmrg drm_handle_t mmioBase,fbBase,sAreaBase; 1697e6fb56fSmrg unsigned sAreaSize; 1707e6fb56fSmrg drmAddress sAreaAddr; 1717e6fb56fSmrg unsigned activePorts; 1727e6fb56fSmrg}ViaXvMC, *ViaXvMCPtr; 1737e6fb56fSmrg 1747e6fb56fSmrg#endif 1757e6fb56fSmrg 1767e6fb56fSmrgtypedef struct _twodContext { 1777e6fb56fSmrg CARD32 mode; 1787e6fb56fSmrg CARD32 cmd; 1797e6fb56fSmrg CARD32 fgColor; 1807e6fb56fSmrg CARD32 bgColor; 1817e6fb56fSmrg CARD32 pattern0; 1827e6fb56fSmrg CARD32 pattern1; 1837e6fb56fSmrg CARD32 patternAddr; 1847e6fb56fSmrg CARD32 keyControl; 1857e6fb56fSmrg unsigned srcOffset; 1867e6fb56fSmrg unsigned srcPitch; 1877e6fb56fSmrg unsigned Bpp; 1887e6fb56fSmrg unsigned bytesPPShift; 1897e6fb56fSmrg Bool clipping; 1907e6fb56fSmrg Bool dashed; 1917e6fb56fSmrg int clipX1; 1927e6fb56fSmrg int clipX2; 1937e6fb56fSmrg int clipY1; 1947e6fb56fSmrg int clipY2; 1957e6fb56fSmrg} ViaTwodContext; 1967e6fb56fSmrg 1977e6fb56fSmrgtypedef struct _VIA { 1987e6fb56fSmrg VIARegRec SavedReg; 1997e6fb56fSmrg int Bpp, Bpl; 2007e6fb56fSmrg 2018aedb4f6Smrg Bool KMS; 2027e6fb56fSmrg Bool FirstInit; 2037e6fb56fSmrg unsigned long videoRambytes; 2047e6fb56fSmrg int FBFreeStart; 2057e6fb56fSmrg int FBFreeEnd; 2067e6fb56fSmrg int driSize; 2077e6fb56fSmrg int maxDriSize; 2088aedb4f6Smrg struct buffer_object *vq_bo; 2097e6fb56fSmrg int VQStart; 2107e6fb56fSmrg int VQEnd; 2117e6fb56fSmrg 2127e6fb56fSmrg /* These are physical addresses. */ 2137e6fb56fSmrg unsigned long FrameBufferBase; 2147e6fb56fSmrg unsigned long MmioBase; 2157e6fb56fSmrg 2167e6fb56fSmrg /* These are linear addresses. */ 2177e6fb56fSmrg unsigned char* MapBase; 2187e6fb56fSmrg unsigned char* MpegMapBase; 2197e6fb56fSmrg unsigned char* BltBase; 2207e6fb56fSmrg unsigned char* MapBaseDense; 2217e6fb56fSmrg unsigned char* FBBase; 2227e6fb56fSmrg CARD8 MemClk; 2237e6fb56fSmrg 2247e6fb56fSmrg /* Here are all the Options */ 2257e6fb56fSmrg Bool VQEnable; 2267e6fb56fSmrg Bool NoAccel; 2277e6fb56fSmrg Bool shadowFB; 2287e6fb56fSmrg Rotation rotate; 2297e6fb56fSmrg int agpMem; 2307e6fb56fSmrg 2318aedb4f6Smrg CreateScreenResourcesProcPtr CreateScreenResources; 2327e6fb56fSmrg CloseScreenProcPtr CloseScreen; 2338aedb4f6Smrg#ifdef HAVE_PCIACCESS 2348aedb4f6Smrg struct pci_device *PciInfo; 2357e6fb56fSmrg#else 2368aedb4f6Smrg pciVideoPtr PciInfo; 2377e6fb56fSmrg PCITAG PciTag; 2387e6fb56fSmrg#endif 2397e6fb56fSmrg int Chipset; 2407e6fb56fSmrg int ChipId; 2417e6fb56fSmrg int ChipRev; 2427e6fb56fSmrg int EntityIndex; 2437e6fb56fSmrg 2447e6fb56fSmrg /* Support for shadowFB and rotation */ 2457e6fb56fSmrg unsigned char* ShadowPtr; 2467e6fb56fSmrg 2478aedb4f6Smrg /* Support for EXA acceleration */ 2487e6fb56fSmrg ViaTwodContext td; 2497e6fb56fSmrg Via3DState v3d; 2507e6fb56fSmrg Via3DState *lastToUpload; 2517e6fb56fSmrg ViaCommandBuffer cb; 2527e6fb56fSmrg int accelMarker; 2538aedb4f6Smrg struct buffer_object *exa_sync_bo; 2548aedb4f6Smrg struct buffer_object *exaMem; 2557e6fb56fSmrg CARD32 markerOffset; 2568aedb4f6Smrg void *markerBuf; 2577e6fb56fSmrg CARD32 curMarker; 2587e6fb56fSmrg CARD32 lastMarkerRead; 2597e6fb56fSmrg Bool agpDMA; 2607e6fb56fSmrg Bool nPOT[VIA_NUM_TEXUNITS]; 2618aedb4f6Smrg const unsigned *HqvCmeRegs; 2627e6fb56fSmrg ExaDriverPtr exaDriverPtr; 2637e6fb56fSmrg ExaOffscreenArea *exa_scratch; 2647e6fb56fSmrg unsigned int exa_scratch_next; 2657e6fb56fSmrg Bool useEXA; 2667e6fb56fSmrg void *maskP; 2677e6fb56fSmrg CARD32 maskFormat; 2687e6fb56fSmrg Bool componentAlpha; 2697e6fb56fSmrg void *srcP; 2707e6fb56fSmrg CARD32 srcFormat; 2717e6fb56fSmrg unsigned scratchOffset; 2727e6fb56fSmrg int exaScratchSize; 2737e6fb56fSmrg char * scratchAddr; 2747e6fb56fSmrg Bool noComposite; 2758aedb4f6Smrg struct buffer_object *scratchBuffer; 2768aedb4f6Smrg#ifdef HAVE_DRI 2778aedb4f6Smrg struct buffer_object *texAGPBuffer; 2787e6fb56fSmrg char * dBounce; 2797e6fb56fSmrg#endif 2807e6fb56fSmrg 2817e6fb56fSmrg /* Rotation */ 2827e6fb56fSmrg Bool RandRRotation; 2837e6fb56fSmrg 2847e6fb56fSmrg /* BIOS Info Ptr */ 2857e6fb56fSmrg VIABIOSInfoPtr pBIOSInfo; 28644802259Smrg 2871090d90aSmrg /* VIA Technologies NanoBook reference design. 2881090d90aSmrg Examples include Everex CloudBook and Sylvania g netbook. 2891090d90aSmrg It is also called FIC CE260 and CE261 by its ODM (Original 2901090d90aSmrg Design Manufacturer) name. */ 2911090d90aSmrg Bool isVIANanoBook; 2921090d90aSmrg 29344802259Smrg /* OLPC XO-1.5 */ 29444802259Smrg Bool IsOLPCXO15; 2957e6fb56fSmrg 2967e6fb56fSmrg /* I2C & DDC */ 2978aedb4f6Smrg I2CBusPtr pI2CBus1; 2988aedb4f6Smrg I2CBusPtr pI2CBus2; 2997e6fb56fSmrg I2CBusPtr pI2CBus3; 3007e6fb56fSmrg 3017e6fb56fSmrg /* MHS */ 3027e6fb56fSmrg Bool IsSecondary; 3037e6fb56fSmrg Bool HasSecondary; 3047e6fb56fSmrg Bool SAMM; 3057e6fb56fSmrg 3068aedb4f6Smrg drmmode_rec drmmode; 3078aedb4f6Smrg enum dri_type directRenderingType; 3088aedb4f6Smrg#ifdef HAVE_DRI 3097e6fb56fSmrg Bool XvMCEnabled; 3108aedb4f6Smrg DRIInfoPtr pDRIInfo; 3118aedb4f6Smrg int numVisualConfigs; 3128aedb4f6Smrg __GLXvisualConfig* pVisualConfigs; 3138aedb4f6Smrg VIAConfigPrivPtr pVisualConfigsPriv; 3148aedb4f6Smrg drm_handle_t agpHandle; 3158aedb4f6Smrg drm_handle_t registerHandle; 3167e6fb56fSmrg drm_handle_t frameBufferHandle; 3178aedb4f6Smrg unsigned long agpAddr; 3187e6fb56fSmrg drmAddress agpMappedAddr; 3198aedb4f6Smrg unsigned int agpSize; 3208aedb4f6Smrg Bool IsPCI; 3217e6fb56fSmrg ViaXvMC xvmc; 3227e6fb56fSmrg int drmVerMajor; 3237e6fb56fSmrg int drmVerMinor; 3247e6fb56fSmrg int drmVerPL; 3258aedb4f6Smrg struct buffer_object *driOffScreenMem; 3267e6fb56fSmrg void * driOffScreenSave; 3277e6fb56fSmrg#endif 3288aedb4f6Smrg Bool DRIIrqEnable; 3297e6fb56fSmrg Bool agpEnable; 3307e6fb56fSmrg Bool dma2d; 3317e6fb56fSmrg Bool dmaXV; 3327e6fb56fSmrg 3337e6fb56fSmrg /* Video */ 3347e6fb56fSmrg int VideoEngine; 3358aedb4f6Smrg swovRec swov; 3367e6fb56fSmrg CARD32 VideoStatus; 3378aedb4f6Smrg VIAHWDiff HWDiff; 3388aedb4f6Smrg unsigned long dwV1, dwV3; 3398aedb4f6Smrg unsigned long dwFrameNum; 3407e6fb56fSmrg 3418aedb4f6Smrg CARD32* VidRegBuffer; /* Temporary buffer for video overlay registers. */ 3428aedb4f6Smrg unsigned long VidRegCursor; /* Write cursor for VidRegBuffer. */ 3437e6fb56fSmrg 3448aedb4f6Smrg unsigned long old_dwUseExtendedFIFO; 3458aedb4f6Smrg 3468aedb4f6Smrg ViaSharedPtr sharedData; 3477e6fb56fSmrg Bool useDmaBlit; 3487e6fb56fSmrg 3497e6fb56fSmrg void *displayMap; 3507e6fb56fSmrg CARD32 displayOffset; 3518aedb4f6Smrg 3528aedb4f6Smrg CARD8 I2CDevices; /* Option */ 3537e6fb56fSmrg 3547e6fb56fSmrg#ifdef HAVE_DEBUG 3557e6fb56fSmrg Bool disableXvBWCheck; 3567e6fb56fSmrg Bool DumpVGAROM; 3577e6fb56fSmrg Bool PrintVGARegs; 3587e6fb56fSmrg Bool PrintTVRegs; 3597e6fb56fSmrg Bool I2CScan; 3607e6fb56fSmrg#endif /* HAVE_DEBUG */ 3618aedb4f6Smrg 3628aedb4f6Smrg video_via_regs* VideoRegs; 3631090d90aSmrg 3641090d90aSmrg /* Keeping track of the number of analog VGA connectors. */ 3651090d90aSmrg unsigned int numberVGA; 3661090d90aSmrg 3671090d90aSmrg /* Keeping track of the number of DVI connectors. */ 3681090d90aSmrg unsigned int numberDVI; 3691090d90aSmrg 3701090d90aSmrg /* Keeping track of the number of FP (Flat Panel) connectors. */ 3711090d90aSmrg unsigned int numberFP; 3721090d90aSmrg 3731090d90aSmrg /* Shadow copy of CR3B through CR3F. */ 3741090d90aSmrg CARD8 originalCR3B, originalCR3C, originalCR3D, 3751090d90aSmrg originalCR3E, originalCR3F; 3767e6fb56fSmrg} VIARec, *VIAPtr; 3777e6fb56fSmrg 3787e6fb56fSmrg#define VIAPTR(p) ((VIAPtr)((p)->driverPrivate)) 3797e6fb56fSmrg 3807e6fb56fSmrgtypedef struct 3817e6fb56fSmrg{ 3827e6fb56fSmrg Bool IsDRIEnabled; 3837e6fb56fSmrg 3847e6fb56fSmrg Bool HasSecondary; 3857e6fb56fSmrg Bool BypassSecondary; 3867e6fb56fSmrg /*These two registers are used to make sure the CRTC2 is 3878aedb4f6Smrg restored before CRTC_EXT, otherwise it could lead to blank screen.*/ 3887e6fb56fSmrg Bool IsSecondaryRestored; 3897e6fb56fSmrg Bool RestorePrimary; 3907e6fb56fSmrg 3917e6fb56fSmrg ScrnInfoPtr pSecondaryScrn; 3927e6fb56fSmrg ScrnInfoPtr pPrimaryScrn; 3937e6fb56fSmrg} VIAEntRec, *VIAEntPtr; 3947e6fb56fSmrg 39503bd066fSmrg 39603bd066fSmrg/* In via_display.c. */ 397ad01e365Sjoergextern const xf86CrtcFuncsRec iga1_crtc_funcs; 398ad01e365Sjoergextern const xf86CrtcFuncsRec iga2_crtc_funcs; 39903bd066fSmrg 4008aedb4f6Smrg/* In via_exa.c. */ 4018aedb4f6SmrgBool viaInitExa(ScreenPtr pScreen); 4028aedb4f6SmrgBool viaAccelSetMode(int bpp, ViaTwodContext * tdc); 4037e6fb56fSmrgvoid viaAccelSync(ScrnInfoPtr); 4047e6fb56fSmrgvoid viaExitAccel(ScreenPtr); 4057e6fb56fSmrgvoid viaFinishInitAccel(ScreenPtr); 4068aedb4f6SmrgBool viaOrder(CARD32 val, CARD32 * shift); 4078aedb4f6SmrgCARD32 viaBitExpandHelper(CARD32 pixel, CARD32 bits); 4088aedb4f6SmrgBool viaCheckUpload(ScrnInfoPtr pScrn, Via3DState * v3d); 4098aedb4f6Smrgvoid viaPixelARGB8888(unsigned format, void *pixelP, CARD32 * argb8888); 4108aedb4f6SmrgBool viaExpandablePixel(int format); 4118aedb4f6Smrgvoid viaAccelFillPixmap(ScrnInfoPtr, unsigned long, unsigned long, 4127e6fb56fSmrg int, int, int, int, int, unsigned long); 4138aedb4f6Smrgvoid viaAccelTextureBlit(ScrnInfoPtr, unsigned long, unsigned, unsigned, 4147e6fb56fSmrg unsigned, unsigned, unsigned, unsigned, 4157e6fb56fSmrg unsigned long, unsigned, unsigned, 4167e6fb56fSmrg unsigned, unsigned, int); 4178aedb4f6Smrg#ifdef VIA_DEBUG_COMPOSITE 4188aedb4f6Smrgvoid viaExaCompositePictDesc(PicturePtr pict, char *string, int n); 4198aedb4f6Smrgvoid viaExaPrintCompositeInfo(char *info, CARD8 op, PicturePtr pSrc, PicturePtr pMask, 4208aedb4f6Smrg PicturePtr pDst); 4218aedb4f6Smrg#endif 4227e6fb56fSmrg 4238aedb4f6Smrg/* In via_exa_h2.c */ 4248aedb4f6SmrgBool viaExaPrepareSolid_H2(PixmapPtr pPixmap, int alu, Pixel planeMask, 4258aedb4f6Smrg Pixel fg); 4268aedb4f6Smrgvoid viaExaSolid_H2(PixmapPtr pPixmap, int x1, int y1, int x2, int y2); 4278aedb4f6Smrgvoid viaExaDoneSolidCopy_H2(PixmapPtr pPixmap); 4288aedb4f6SmrgBool viaExaPrepareCopy_H2(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, 4298aedb4f6Smrg int xdir, int ydir, int alu, Pixel planeMask); 4308aedb4f6Smrgvoid viaExaCopy_H2(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, 4318aedb4f6Smrg int dstY, int width, int height); 4328aedb4f6SmrgBool viaExaCheckComposite_H2(int op, PicturePtr pSrcPicture, 4338aedb4f6Smrg PicturePtr pMaskPicture, PicturePtr pDstPicture); 4348aedb4f6SmrgBool viaExaPrepareComposite_H2(int op, PicturePtr pSrcPicture, 4358aedb4f6Smrg PicturePtr pMaskPicture, PicturePtr pDstPicture, 4368aedb4f6Smrg PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst); 4378aedb4f6Smrgvoid viaExaComposite_H2(PixmapPtr pDst, int srcX, int srcY, 4388aedb4f6Smrg int maskX, int maskY, int dstX, int dstY, 4398aedb4f6Smrg int width, int height); 4408aedb4f6Smrgint viaAccelMarkSync_H2(ScreenPtr); 4418aedb4f6Smrg 4428aedb4f6Smrg/* In via_exa_h6.c */ 4438aedb4f6SmrgBool viaExaPrepareSolid_H6(PixmapPtr pPixmap, int alu, Pixel planeMask, 4448aedb4f6Smrg Pixel fg); 4458aedb4f6Smrgvoid viaExaSolid_H6(PixmapPtr pPixmap, int x1, int y1, int x2, int y2); 4468aedb4f6Smrgvoid viaExaDoneSolidCopy_H6(PixmapPtr pPixmap); 4478aedb4f6SmrgBool viaExaPrepareCopy_H6(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, 4488aedb4f6Smrg int xdir, int ydir, int alu, Pixel planeMask); 4498aedb4f6Smrgvoid viaExaCopy_H6(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, 4508aedb4f6Smrg int dstY, int width, int height); 4518aedb4f6SmrgBool viaExaCheckComposite_H6(int op, PicturePtr pSrcPicture, 4528aedb4f6Smrg PicturePtr pMaskPicture, PicturePtr pDstPicture); 4538aedb4f6SmrgBool viaExaPrepareComposite_H6(int op, PicturePtr pSrcPicture, 4548aedb4f6Smrg PicturePtr pMaskPicture, PicturePtr pDstPicture, 4558aedb4f6Smrg PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst); 4568aedb4f6Smrgvoid viaExaComposite_H6(PixmapPtr pDst, int srcX, int srcY, 4578aedb4f6Smrg int maskX, int maskY, int dstX, int dstY, 4588aedb4f6Smrg int width, int height); 4598aedb4f6Smrgint viaAccelMarkSync_H6(ScreenPtr); 4608aedb4f6Smrg 4618aedb4f6Smrg/* In via_xv.c */ 4628aedb4f6Smrgvoid viaInitVideo(ScreenPtr pScreen); 4638aedb4f6Smrgvoid viaExitVideo(ScrnInfoPtr pScrn); 4648aedb4f6Smrgvoid viaSaveVideo(ScrnInfoPtr pScrn); 4658aedb4f6Smrgvoid viaRestoreVideo(ScrnInfoPtr pScrn); 4668aedb4f6Smrgvoid viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness, int contrast, 4678aedb4f6Smrg Bool reset); 4687e6fb56fSmrg 4697e6fb56fSmrg 4708aedb4f6Smrg/* In via_xv.c */ 4717e6fb56fSmrgvoid viaInitVideo(ScreenPtr pScreen); 4727e6fb56fSmrgvoid viaExitVideo(ScrnInfoPtr pScrn); 4737e6fb56fSmrgvoid viaSaveVideo(ScrnInfoPtr pScrn); 4747e6fb56fSmrgvoid viaRestoreVideo(ScrnInfoPtr pScrn); 4757e6fb56fSmrgvoid viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness, int contrast, 4767e6fb56fSmrg Bool reset); 4777e6fb56fSmrgvoid VIAVidAdjustFrame(ScrnInfoPtr pScrn, int x, int y); 4787e6fb56fSmrg 4798aedb4f6Smrg/* In via_memcpy.c */ 4808aedb4f6Smrgtypedef void (*vidCopyFunc)(unsigned char *, const unsigned char *, 4818aedb4f6Smrg int, int, int, int); 4828aedb4f6Smrgextern vidCopyFunc viaVidCopyInit( char *copyType, ScreenPtr pScreen ); 4837e6fb56fSmrg 4847e6fb56fSmrg/* In via_xwmc.c */ 4857e6fb56fSmrg 4868aedb4f6Smrg#ifdef HAVE_DRI 4877e6fb56fSmrg/* Basic init and exit functions */ 4888aedb4f6Smrgvoid ViaInitXVMC(ScreenPtr pScreen); 4897e6fb56fSmrgvoid ViaCleanupXVMC(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr *XvAdaptors, int XvAdaptorCount); 4907e6fb56fSmrgint viaXvMCInitXv(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr XvAdapt); 4917e6fb56fSmrg 4927e6fb56fSmrg/* Returns the size of the fake Xv Image used as XvMC command buffer to the X server*/ 4937e6fb56fSmrgunsigned long viaXvMCPutImageSize(ScrnInfoPtr pScrn); 4947e6fb56fSmrg#endif 4957e6fb56fSmrg 4967e6fb56fSmrg/* via_i2c.c */ 4977e6fb56fSmrgvoid ViaI2CInit(ScrnInfoPtr pScrn); 4981090d90aSmrgBool xf86I2CMaskByte(I2CDevPtr d, I2CByte subaddr, 4991090d90aSmrg I2CByte value, I2CByte mask); 5007e6fb56fSmrg 5018aedb4f6Smrg#ifdef HAVE_DRI 5028aedb4f6SmrgBool VIADRI1ScreenInit(ScreenPtr pScreen); 5037e6fb56fSmrgvoid VIADRICloseScreen(ScreenPtr pScreen); 5047e6fb56fSmrgBool VIADRIFinishScreenInit(ScreenPtr pScreen); 5057e6fb56fSmrgvoid VIADRIRingBufferCleanup(ScrnInfoPtr pScrn); 5067e6fb56fSmrgBool VIADRIRingBufferInit(ScrnInfoPtr pScrn); 5077e6fb56fSmrgvoid viaDRIOffscreenRestore(ScrnInfoPtr pScrn); 5087e6fb56fSmrgvoid viaDRIOffscreenSave(ScrnInfoPtr pScrn); 5098aedb4f6SmrgBool VIADRIBufferInit(ScrnInfoPtr pScrn); 5107e6fb56fSmrg 5118aedb4f6Smrg#endif /* HAVE_DRI */ 5127e6fb56fSmrg 5137024fa79Smrgint viaOffScreenLinear(struct buffer_object *obj, ScrnInfoPtr pScrn, unsigned long size); 51444802259Smrgvoid viaShowCursor(ScrnInfoPtr pScrn); 51544802259Smrgvoid viaHideCursor(ScrnInfoPtr pScrn); 51644802259SmrgBool viaHWCursorInit(ScreenPtr pScreen); 51744802259Smrgvoid ViaDisplaySetStreamOnCRT(ScrnInfoPtr pScrn, Bool primary); 518d89f4815Schristosvoid ViaDisplaySetStreamOnDFP(ScrnInfoPtr pScrn, Bool primary); 519d89f4815Schristos 5207e6fb56fSmrg#endif /* _VIA_DRIVER_H_ */ 521