16747b715Smrg/* 26747b715Smrg * This code was stolen from RAC and adapted to control the legacy vga 36747b715Smrg * interface. 46747b715Smrg * 56747b715Smrg * 66747b715Smrg * Copyright (c) 2007 Paulo R. Zanoni, Tiago Vignatti 76747b715Smrg * 86747b715Smrg * Permission is hereby granted, free of charge, to any person 96747b715Smrg * obtaining a copy of this software and associated documentation 106747b715Smrg * files (the "Software"), to deal in the Software without 116747b715Smrg * restriction, including without limitation the rights to use, 126747b715Smrg * copy, modify, merge, publish, distribute, sublicense, and/or sell 136747b715Smrg * copies of the Software, and to permit persons to whom the 146747b715Smrg * Software is furnished to do so, subject to the following 156747b715Smrg * conditions: 166747b715Smrg * 176747b715Smrg * The above copyright notice and this permission notice shall be 186747b715Smrg * included in all copies or substantial portions of the Software. 196747b715Smrg * 206747b715Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 216747b715Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 226747b715Smrg * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 236747b715Smrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 246747b715Smrg * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 256747b715Smrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 266747b715Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 276747b715Smrg * OTHER DEALINGS IN THE SOFTWARE. 286747b715Smrg * 296747b715Smrg */ 306747b715Smrg 316747b715Smrg#include "xorg-config.h" 326747b715Smrg 336747b715Smrg#include "xf86VGAarbiter.h" 346747b715Smrg#include "xf86VGAarbiterPriv.h" 356747b715Smrg#include "xf86Bus.h" 366747b715Smrg#include "xf86Priv.h" 376747b715Smrg#include "pciaccess.h" 386747b715Smrg 396747b715Smrgstatic GCFuncs VGAarbiterGCFuncs = { 406747b715Smrg VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC, 416747b715Smrg VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip, 426747b715Smrg VGAarbiterCopyClip 436747b715Smrg}; 446747b715Smrg 456747b715Smrgstatic GCOps VGAarbiterGCOps = { 466747b715Smrg VGAarbiterFillSpans, VGAarbiterSetSpans, VGAarbiterPutImage, 476747b715Smrg VGAarbiterCopyArea, VGAarbiterCopyPlane, VGAarbiterPolyPoint, 486747b715Smrg VGAarbiterPolylines, VGAarbiterPolySegment, VGAarbiterPolyRectangle, 496747b715Smrg VGAarbiterPolyArc, VGAarbiterFillPolygon, VGAarbiterPolyFillRect, 506747b715Smrg VGAarbiterPolyFillArc, VGAarbiterPolyText8, VGAarbiterPolyText16, 516747b715Smrg VGAarbiterImageText8, VGAarbiterImageText16, VGAarbiterImageGlyphBlt, 526747b715Smrg VGAarbiterPolyGlyphBlt, VGAarbiterPushPixels, 536747b715Smrg}; 546747b715Smrg 556747b715Smrgstatic miPointerSpriteFuncRec VGAarbiterSpriteFuncs = { 566747b715Smrg VGAarbiterSpriteRealizeCursor, VGAarbiterSpriteUnrealizeCursor, 576747b715Smrg VGAarbiterSpriteSetCursor, VGAarbiterSpriteMoveCursor, 586747b715Smrg VGAarbiterDeviceCursorInitialize, VGAarbiterDeviceCursorCleanup 596747b715Smrg}; 606747b715Smrg 616747b715Smrgstatic DevPrivateKeyRec VGAarbiterScreenKeyRec; 6235c4bbdfSmrg 636747b715Smrg#define VGAarbiterScreenKey (&VGAarbiterScreenKeyRec) 646747b715Smrgstatic DevPrivateKeyRec VGAarbiterGCKeyRec; 6535c4bbdfSmrg 666747b715Smrg#define VGAarbiterGCKey (&VGAarbiterGCKeyRec) 676747b715Smrg 686747b715Smrgstatic int vga_no_arb = 0; 696747b715Smrgvoid 706747b715Smrgxf86VGAarbiterInit(void) 716747b715Smrg{ 726747b715Smrg if (pci_device_vgaarb_init() != 0) { 7335c4bbdfSmrg vga_no_arb = 1; 7435c4bbdfSmrg xf86Msg(X_WARNING, 7535c4bbdfSmrg "VGA arbiter: cannot open kernel arbiter, no multi-card support\n"); 766747b715Smrg } 776747b715Smrg} 786747b715Smrg 796747b715Smrgvoid 806747b715Smrgxf86VGAarbiterFini(void) 816747b715Smrg{ 826747b715Smrg if (vga_no_arb) 8335c4bbdfSmrg return; 846747b715Smrg pci_device_vgaarb_fini(); 856747b715Smrg} 866747b715Smrg 876747b715Smrgvoid 886747b715Smrgxf86VGAarbiterLock(ScrnInfoPtr pScrn) 896747b715Smrg{ 906747b715Smrg if (vga_no_arb) 9135c4bbdfSmrg return; 926747b715Smrg pci_device_vgaarb_set_target(pScrn->vgaDev); 936747b715Smrg pci_device_vgaarb_lock(); 946747b715Smrg} 956747b715Smrg 966747b715Smrgvoid 976747b715Smrgxf86VGAarbiterUnlock(ScrnInfoPtr pScrn) 986747b715Smrg{ 996747b715Smrg if (vga_no_arb) 10035c4bbdfSmrg return; 1016747b715Smrg pci_device_vgaarb_unlock(); 1026747b715Smrg} 1036747b715Smrg 10435c4bbdfSmrgBool 10535c4bbdfSmrgxf86VGAarbiterAllowDRI(ScreenPtr pScreen) 1066747b715Smrg{ 1076747b715Smrg int vga_count; 1081b5d61b8Smrg int rsrc_decodes = 0; 10935c4bbdfSmrg ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); 1106747b715Smrg 1116747b715Smrg if (vga_no_arb) 11235c4bbdfSmrg return TRUE; 1136747b715Smrg 1146747b715Smrg pci_device_vgaarb_get_info(pScrn->vgaDev, &vga_count, &rsrc_decodes); 1156747b715Smrg if (vga_count > 1) { 1166747b715Smrg if (rsrc_decodes) { 1176747b715Smrg return FALSE; 1186747b715Smrg } 1196747b715Smrg } 1206747b715Smrg return TRUE; 1216747b715Smrg} 1226747b715Smrg 1236747b715Smrgvoid 1246747b715Smrgxf86VGAarbiterScrnInit(ScrnInfoPtr pScrn) 1256747b715Smrg{ 1266747b715Smrg struct pci_device *dev; 1276747b715Smrg EntityPtr pEnt; 1286747b715Smrg 1296747b715Smrg if (vga_no_arb) 13035c4bbdfSmrg return; 1316747b715Smrg 1326747b715Smrg pEnt = xf86Entities[pScrn->entityList[0]]; 1336747b715Smrg if (pEnt->bus.type != BUS_PCI) 13435c4bbdfSmrg return; 1356747b715Smrg 1366747b715Smrg dev = pEnt->bus.id.pci; 1376747b715Smrg pScrn->vgaDev = dev; 1386747b715Smrg} 1396747b715Smrg 1406747b715Smrgvoid 1419ace9065Smrgxf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn, int rsrc) 1426747b715Smrg{ 1436747b715Smrg if (vga_no_arb) 14435c4bbdfSmrg return; 1459ace9065Smrg pci_device_vgaarb_set_target(pScrn->vgaDev); 1469ace9065Smrg pci_device_vgaarb_decodes(rsrc); 1476747b715Smrg} 1486747b715Smrg 1496747b715SmrgBool 1506747b715Smrgxf86VGAarbiterWrapFunctions(void) 1516747b715Smrg{ 1526747b715Smrg ScrnInfoPtr pScrn; 1536747b715Smrg VGAarbiterScreenPtr pScreenPriv; 1546747b715Smrg miPointerScreenPtr PointPriv; 15535c4bbdfSmrg PictureScreenPtr ps; 1566747b715Smrg ScreenPtr pScreen; 1576747b715Smrg int vga_count, i; 1586747b715Smrg 1596747b715Smrg if (vga_no_arb) 1606747b715Smrg return FALSE; 1616747b715Smrg 1626747b715Smrg /* 1636747b715Smrg * we need to wrap the arbiter if we have more than 1646747b715Smrg * one VGA card - hotplug cries. 1656747b715Smrg */ 1666747b715Smrg pci_device_vgaarb_get_info(NULL, &vga_count, NULL); 1676747b715Smrg if (vga_count < 2 || !xf86Screens) 1686747b715Smrg return FALSE; 1696747b715Smrg 17035c4bbdfSmrg xf86Msg(X_INFO, "Found %d VGA devices: arbiter wrapping enabled\n", 1716747b715Smrg vga_count); 1726747b715Smrg 1736747b715Smrg for (i = 0; i < xf86NumScreens; i++) { 1746747b715Smrg pScreen = xf86Screens[i]->pScreen; 1756747b715Smrg ps = GetPictureScreenIfSet(pScreen); 17635c4bbdfSmrg pScrn = xf86ScreenToScrn(pScreen); 1776747b715Smrg PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); 1786747b715Smrg 17935c4bbdfSmrg if (!dixRegisterPrivateKey 18035c4bbdfSmrg (&VGAarbiterGCKeyRec, PRIVATE_GC, sizeof(VGAarbiterGCRec))) 1816747b715Smrg return FALSE; 1826747b715Smrg 18335c4bbdfSmrg if (!dixRegisterPrivateKey(&VGAarbiterScreenKeyRec, PRIVATE_SCREEN, 0)) 18435c4bbdfSmrg return FALSE; 1856747b715Smrg 1866747b715Smrg if (!(pScreenPriv = malloc(sizeof(VGAarbiterScreenRec)))) 1876747b715Smrg return FALSE; 1886747b715Smrg 1896747b715Smrg dixSetPrivate(&pScreen->devPrivates, VGAarbiterScreenKey, pScreenPriv); 1906747b715Smrg 1916747b715Smrg WRAP_SCREEN(CloseScreen, VGAarbiterCloseScreen); 1926747b715Smrg WRAP_SCREEN(SaveScreen, VGAarbiterSaveScreen); 1936747b715Smrg WRAP_SCREEN(WakeupHandler, VGAarbiterWakeupHandler); 1946747b715Smrg WRAP_SCREEN(BlockHandler, VGAarbiterBlockHandler); 1956747b715Smrg WRAP_SCREEN(CreateGC, VGAarbiterCreateGC); 1966747b715Smrg WRAP_SCREEN(GetImage, VGAarbiterGetImage); 1976747b715Smrg WRAP_SCREEN(GetSpans, VGAarbiterGetSpans); 1986747b715Smrg WRAP_SCREEN(SourceValidate, VGAarbiterSourceValidate); 1996747b715Smrg WRAP_SCREEN(CopyWindow, VGAarbiterCopyWindow); 2006747b715Smrg WRAP_SCREEN(ClearToBackground, VGAarbiterClearToBackground); 2016747b715Smrg WRAP_SCREEN(CreatePixmap, VGAarbiterCreatePixmap); 2026747b715Smrg WRAP_SCREEN(StoreColors, VGAarbiterStoreColors); 2036747b715Smrg WRAP_SCREEN(DisplayCursor, VGAarbiterDisplayCursor); 2046747b715Smrg WRAP_SCREEN(RealizeCursor, VGAarbiterRealizeCursor); 2056747b715Smrg WRAP_SCREEN(UnrealizeCursor, VGAarbiterUnrealizeCursor); 2066747b715Smrg WRAP_SCREEN(RecolorCursor, VGAarbiterRecolorCursor); 2076747b715Smrg WRAP_SCREEN(SetCursorPosition, VGAarbiterSetCursorPosition); 20835c4bbdfSmrg WRAP_PICT(Composite, VGAarbiterComposite); 20935c4bbdfSmrg WRAP_PICT(Glyphs, VGAarbiterGlyphs); 21035c4bbdfSmrg WRAP_PICT(CompositeRects, VGAarbiterCompositeRects); 2116747b715Smrg WRAP_SCREEN_INFO(AdjustFrame, VGAarbiterAdjustFrame); 2126747b715Smrg WRAP_SCREEN_INFO(SwitchMode, VGAarbiterSwitchMode); 2136747b715Smrg WRAP_SCREEN_INFO(EnterVT, VGAarbiterEnterVT); 2146747b715Smrg WRAP_SCREEN_INFO(LeaveVT, VGAarbiterLeaveVT); 2156747b715Smrg WRAP_SCREEN_INFO(FreeScreen, VGAarbiterFreeScreen); 2166747b715Smrg WRAP_SPRITE; 2176747b715Smrg } 2186747b715Smrg 2196747b715Smrg return TRUE; 2206747b715Smrg} 2216747b715Smrg 2226747b715Smrg/* Screen funcs */ 2236747b715Smrgstatic Bool 22435c4bbdfSmrgVGAarbiterCloseScreen(ScreenPtr pScreen) 2256747b715Smrg{ 2266747b715Smrg Bool val; 22735c4bbdfSmrg ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); 22835c4bbdfSmrg VGAarbiterScreenPtr pScreenPriv = 22935c4bbdfSmrg (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, 23035c4bbdfSmrg VGAarbiterScreenKey); 23135c4bbdfSmrg miPointerScreenPtr PointPriv = 23235c4bbdfSmrg (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates, 23335c4bbdfSmrg miPointerScreenKey); 23435c4bbdfSmrg PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); 2356747b715Smrg 2366747b715Smrg UNWRAP_SCREEN(CreateGC); 2376747b715Smrg UNWRAP_SCREEN(CloseScreen); 2386747b715Smrg UNWRAP_SCREEN(GetImage); 2396747b715Smrg UNWRAP_SCREEN(GetSpans); 2406747b715Smrg UNWRAP_SCREEN(SourceValidate); 2416747b715Smrg UNWRAP_SCREEN(CopyWindow); 2426747b715Smrg UNWRAP_SCREEN(ClearToBackground); 2436747b715Smrg UNWRAP_SCREEN(SaveScreen); 2446747b715Smrg UNWRAP_SCREEN(StoreColors); 2456747b715Smrg UNWRAP_SCREEN(DisplayCursor); 2466747b715Smrg UNWRAP_SCREEN(RealizeCursor); 2476747b715Smrg UNWRAP_SCREEN(UnrealizeCursor); 2486747b715Smrg UNWRAP_SCREEN(RecolorCursor); 2496747b715Smrg UNWRAP_SCREEN(SetCursorPosition); 2506747b715Smrg UNWRAP_PICT(Composite); 2516747b715Smrg UNWRAP_PICT(Glyphs); 2526747b715Smrg UNWRAP_PICT(CompositeRects); 2536747b715Smrg UNWRAP_SCREEN_INFO(AdjustFrame); 2546747b715Smrg UNWRAP_SCREEN_INFO(SwitchMode); 2556747b715Smrg UNWRAP_SCREEN_INFO(EnterVT); 2566747b715Smrg UNWRAP_SCREEN_INFO(LeaveVT); 2576747b715Smrg UNWRAP_SCREEN_INFO(FreeScreen); 2586747b715Smrg UNWRAP_SPRITE; 2596747b715Smrg 26035c4bbdfSmrg free((void *) pScreenPriv); 26135c4bbdfSmrg xf86VGAarbiterLock(xf86ScreenToScrn(pScreen)); 26235c4bbdfSmrg val = (*pScreen->CloseScreen) (pScreen); 26335c4bbdfSmrg xf86VGAarbiterUnlock(xf86ScreenToScrn(pScreen)); 2646747b715Smrg return val; 2656747b715Smrg} 2666747b715Smrg 2676747b715Smrgstatic void 2681b5d61b8SmrgVGAarbiterBlockHandler(ScreenPtr pScreen, void *pTimeout) 2696747b715Smrg{ 2706747b715Smrg SCREEN_PROLOG(BlockHandler); 2719ace9065Smrg VGAGet(pScreen); 2721b5d61b8Smrg pScreen->BlockHandler(pScreen, pTimeout); 2736747b715Smrg VGAPut(); 2746747b715Smrg SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler); 2756747b715Smrg} 2766747b715Smrg 2776747b715Smrgstatic void 2781b5d61b8SmrgVGAarbiterWakeupHandler(ScreenPtr pScreen, int result) 2796747b715Smrg{ 2806747b715Smrg SCREEN_PROLOG(WakeupHandler); 2819ace9065Smrg VGAGet(pScreen); 2821b5d61b8Smrg pScreen->WakeupHandler(pScreen, result); 2836747b715Smrg VGAPut(); 2846747b715Smrg SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler); 2856747b715Smrg} 2866747b715Smrg 2876747b715Smrgstatic void 28835c4bbdfSmrgVGAarbiterGetImage(DrawablePtr pDrawable, 28935c4bbdfSmrg int sx, int sy, int w, int h, 29035c4bbdfSmrg unsigned int format, unsigned long planemask, char *pdstLine) 2916747b715Smrg{ 2926747b715Smrg ScreenPtr pScreen = pDrawable->pScreen; 29335c4bbdfSmrg 2946747b715Smrg SCREEN_PROLOG(GetImage); 2959ace9065Smrg VGAGet(pScreen); 29635c4bbdfSmrg (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); 2976747b715Smrg VGAPut(); 29835c4bbdfSmrg SCREEN_EPILOG(GetImage, VGAarbiterGetImage); 2996747b715Smrg} 3006747b715Smrg 3016747b715Smrgstatic void 30235c4bbdfSmrgVGAarbiterGetSpans(DrawablePtr pDrawable, 30335c4bbdfSmrg int wMax, 30435c4bbdfSmrg DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart) 30535c4bbdfSmrg{ 30635c4bbdfSmrg ScreenPtr pScreen = pDrawable->pScreen; 30735c4bbdfSmrg 30835c4bbdfSmrg SCREEN_PROLOG(GetSpans); 3099ace9065Smrg VGAGet(pScreen); 3106747b715Smrg (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); 3116747b715Smrg VGAPut(); 31235c4bbdfSmrg SCREEN_EPILOG(GetSpans, VGAarbiterGetSpans); 3136747b715Smrg} 3146747b715Smrg 3156747b715Smrgstatic void 31635c4bbdfSmrgVGAarbiterSourceValidate(DrawablePtr pDrawable, 31735c4bbdfSmrg int x, int y, int width, int height, 31835c4bbdfSmrg unsigned int subWindowMode) 3196747b715Smrg{ 32035c4bbdfSmrg ScreenPtr pScreen = pDrawable->pScreen; 32135c4bbdfSmrg 32235c4bbdfSmrg SCREEN_PROLOG(SourceValidate); 3239ace9065Smrg VGAGet(pScreen); 324ed6184dfSmrg (*pScreen->SourceValidate) (pDrawable, x, y, width, height, 325ed6184dfSmrg subWindowMode); 3266747b715Smrg VGAPut(); 32735c4bbdfSmrg SCREEN_EPILOG(SourceValidate, VGAarbiterSourceValidate); 3286747b715Smrg} 3296747b715Smrg 3306747b715Smrgstatic void 33135c4bbdfSmrgVGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) 3326747b715Smrg{ 3336747b715Smrg ScreenPtr pScreen = pWin->drawable.pScreen; 3346747b715Smrg 33535c4bbdfSmrg SCREEN_PROLOG(CopyWindow); 3369ace9065Smrg VGAGet(pScreen); 3376747b715Smrg (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); 3386747b715Smrg VGAPut(); 33935c4bbdfSmrg SCREEN_EPILOG(CopyWindow, VGAarbiterCopyWindow); 3406747b715Smrg} 3416747b715Smrg 3426747b715Smrgstatic void 34335c4bbdfSmrgVGAarbiterClearToBackground(WindowPtr pWin, 34435c4bbdfSmrg int x, int y, int w, int h, Bool generateExposures) 3456747b715Smrg{ 3466747b715Smrg ScreenPtr pScreen = pWin->drawable.pScreen; 3476747b715Smrg 34835c4bbdfSmrg SCREEN_PROLOG(ClearToBackground); 3499ace9065Smrg VGAGet(pScreen); 3506747b715Smrg (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures); 3516747b715Smrg VGAPut(); 35235c4bbdfSmrg SCREEN_EPILOG(ClearToBackground, VGAarbiterClearToBackground); 3536747b715Smrg} 3546747b715Smrg 3556747b715Smrgstatic PixmapPtr 35635c4bbdfSmrgVGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, 35735c4bbdfSmrg unsigned usage_hint) 3586747b715Smrg{ 3596747b715Smrg PixmapPtr pPix; 3606747b715Smrg 36135c4bbdfSmrg SCREEN_PROLOG(CreatePixmap); 3629ace9065Smrg VGAGet(pScreen); 3636747b715Smrg pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint); 3646747b715Smrg VGAPut(); 36535c4bbdfSmrg SCREEN_EPILOG(CreatePixmap, VGAarbiterCreatePixmap); 3666747b715Smrg 3676747b715Smrg return pPix; 3686747b715Smrg} 3696747b715Smrg 3706747b715Smrgstatic Bool 3716747b715SmrgVGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank) 3726747b715Smrg{ 3736747b715Smrg Bool val; 3746747b715Smrg 37535c4bbdfSmrg SCREEN_PROLOG(SaveScreen); 3769ace9065Smrg VGAGet(pScreen); 3776747b715Smrg val = (*pScreen->SaveScreen) (pScreen, unblank); 3786747b715Smrg VGAPut(); 37935c4bbdfSmrg SCREEN_EPILOG(SaveScreen, VGAarbiterSaveScreen); 3806747b715Smrg 3816747b715Smrg return val; 3826747b715Smrg} 3836747b715Smrg 3846747b715Smrgstatic void 38535c4bbdfSmrgVGAarbiterStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs) 3866747b715Smrg{ 3876747b715Smrg ScreenPtr pScreen = pmap->pScreen; 3886747b715Smrg 38935c4bbdfSmrg SCREEN_PROLOG(StoreColors); 3909ace9065Smrg VGAGet(pScreen); 39135c4bbdfSmrg (*pScreen->StoreColors) (pmap, ndef, pdefs); 3926747b715Smrg VGAPut(); 39335c4bbdfSmrg SCREEN_EPILOG(StoreColors, VGAarbiterStoreColors); 3946747b715Smrg} 3956747b715Smrg 3966747b715Smrgstatic void 39735c4bbdfSmrgVGAarbiterRecolorCursor(DeviceIntPtr pDev, 39835c4bbdfSmrg ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) 39935c4bbdfSmrg{ 40035c4bbdfSmrg SCREEN_PROLOG(RecolorCursor); 4019ace9065Smrg VGAGet(pScreen); 4026747b715Smrg (*pScreen->RecolorCursor) (pDev, pScreen, pCurs, displayed); 4036747b715Smrg VGAPut(); 40435c4bbdfSmrg SCREEN_EPILOG(RecolorCursor, VGAarbiterRecolorCursor); 4056747b715Smrg} 4066747b715Smrg 4076747b715Smrgstatic Bool 40835c4bbdfSmrgVGAarbiterRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) 4096747b715Smrg{ 4106747b715Smrg Bool val; 4116747b715Smrg 41235c4bbdfSmrg SCREEN_PROLOG(RealizeCursor); 4139ace9065Smrg VGAGet(pScreen); 41435c4bbdfSmrg val = (*pScreen->RealizeCursor) (pDev, pScreen, pCursor); 4156747b715Smrg VGAPut(); 41635c4bbdfSmrg SCREEN_EPILOG(RealizeCursor, VGAarbiterRealizeCursor); 4176747b715Smrg return val; 4186747b715Smrg} 4196747b715Smrg 4206747b715Smrgstatic Bool 42135c4bbdfSmrgVGAarbiterUnrealizeCursor(DeviceIntPtr pDev, 42235c4bbdfSmrg ScreenPtr pScreen, CursorPtr pCursor) 4236747b715Smrg{ 4246747b715Smrg Bool val; 4256747b715Smrg 42635c4bbdfSmrg SCREEN_PROLOG(UnrealizeCursor); 4279ace9065Smrg VGAGet(pScreen); 4286747b715Smrg val = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor); 4296747b715Smrg VGAPut(); 43035c4bbdfSmrg SCREEN_EPILOG(UnrealizeCursor, VGAarbiterUnrealizeCursor); 4316747b715Smrg return val; 4326747b715Smrg} 4336747b715Smrg 4346747b715Smrgstatic Bool 43535c4bbdfSmrgVGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) 4366747b715Smrg{ 4376747b715Smrg Bool val; 4386747b715Smrg 43935c4bbdfSmrg SCREEN_PROLOG(DisplayCursor); 4409ace9065Smrg VGAGet(pScreen); 4416747b715Smrg val = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor); 4426747b715Smrg VGAPut(); 44335c4bbdfSmrg SCREEN_EPILOG(DisplayCursor, VGAarbiterDisplayCursor); 4446747b715Smrg return val; 4456747b715Smrg} 4466747b715Smrg 4476747b715Smrgstatic Bool 44835c4bbdfSmrgVGAarbiterSetCursorPosition(DeviceIntPtr pDev, 44935c4bbdfSmrg ScreenPtr pScreen, int x, int y, Bool generateEvent) 4506747b715Smrg{ 4516747b715Smrg Bool val; 4526747b715Smrg 45335c4bbdfSmrg SCREEN_PROLOG(SetCursorPosition); 4549ace9065Smrg VGAGet(pScreen); 4556747b715Smrg val = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent); 4566747b715Smrg VGAPut(); 45735c4bbdfSmrg SCREEN_EPILOG(SetCursorPosition, VGAarbiterSetCursorPosition); 4586747b715Smrg return val; 4596747b715Smrg} 4606747b715Smrg 4616747b715Smrgstatic void 46235c4bbdfSmrgVGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y) 4636747b715Smrg{ 46435c4bbdfSmrg ScreenPtr pScreen = xf86ScrnToScreen(pScrn); 46535c4bbdfSmrg VGAarbiterScreenPtr pScreenPriv = 46635c4bbdfSmrg (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, 46735c4bbdfSmrg VGAarbiterScreenKey); 4686747b715Smrg 4699ace9065Smrg VGAGet(pScreen); 47035c4bbdfSmrg (*pScreenPriv->AdjustFrame) (pScrn, x, y); 4716747b715Smrg VGAPut(); 4726747b715Smrg} 4736747b715Smrg 4746747b715Smrgstatic Bool 47535c4bbdfSmrgVGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) 4766747b715Smrg{ 4776747b715Smrg Bool val; 47835c4bbdfSmrg ScreenPtr pScreen = xf86ScrnToScreen(pScrn); 47935c4bbdfSmrg VGAarbiterScreenPtr pScreenPriv = 48035c4bbdfSmrg (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, 48135c4bbdfSmrg VGAarbiterScreenKey); 4826747b715Smrg 4839ace9065Smrg VGAGet(pScreen); 48435c4bbdfSmrg val = (*pScreenPriv->SwitchMode) (pScrn, mode); 4856747b715Smrg VGAPut(); 4866747b715Smrg return val; 4876747b715Smrg} 4886747b715Smrg 4896747b715Smrgstatic Bool 49035c4bbdfSmrgVGAarbiterEnterVT(ScrnInfoPtr pScrn) 4916747b715Smrg{ 4926747b715Smrg Bool val; 49335c4bbdfSmrg ScreenPtr pScreen = xf86ScrnToScreen(pScrn); 49435c4bbdfSmrg VGAarbiterScreenPtr pScreenPriv = 49535c4bbdfSmrg (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, 49635c4bbdfSmrg VGAarbiterScreenKey); 4976747b715Smrg 4989ace9065Smrg VGAGet(pScreen); 4996747b715Smrg pScrn->EnterVT = pScreenPriv->EnterVT; 50035c4bbdfSmrg val = (*pScrn->EnterVT) (pScrn); 5016747b715Smrg pScreenPriv->EnterVT = pScrn->EnterVT; 5026747b715Smrg pScrn->EnterVT = VGAarbiterEnterVT; 5036747b715Smrg VGAPut(); 5046747b715Smrg return val; 5056747b715Smrg} 5066747b715Smrg 5076747b715Smrgstatic void 50835c4bbdfSmrgVGAarbiterLeaveVT(ScrnInfoPtr pScrn) 5096747b715Smrg{ 51035c4bbdfSmrg ScreenPtr pScreen = xf86ScrnToScreen(pScrn); 51135c4bbdfSmrg VGAarbiterScreenPtr pScreenPriv = 51235c4bbdfSmrg (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, 51335c4bbdfSmrg VGAarbiterScreenKey); 5146747b715Smrg 5159ace9065Smrg VGAGet(pScreen); 5166747b715Smrg pScrn->LeaveVT = pScreenPriv->LeaveVT; 51735c4bbdfSmrg (*pScreenPriv->LeaveVT) (pScrn); 5186747b715Smrg pScreenPriv->LeaveVT = pScrn->LeaveVT; 5196747b715Smrg pScrn->LeaveVT = VGAarbiterLeaveVT; 5206747b715Smrg VGAPut(); 5216747b715Smrg} 5226747b715Smrg 5236747b715Smrgstatic void 52435c4bbdfSmrgVGAarbiterFreeScreen(ScrnInfoPtr pScrn) 5256747b715Smrg{ 52635c4bbdfSmrg ScreenPtr pScreen = xf86ScrnToScreen(pScrn); 52735c4bbdfSmrg VGAarbiterScreenPtr pScreenPriv = 52835c4bbdfSmrg (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, 52935c4bbdfSmrg VGAarbiterScreenKey); 5306747b715Smrg 5319ace9065Smrg VGAGet(pScreen); 53235c4bbdfSmrg (*pScreenPriv->FreeScreen) (pScrn); 5336747b715Smrg VGAPut(); 5346747b715Smrg} 5356747b715Smrg 5366747b715Smrgstatic Bool 5376747b715SmrgVGAarbiterCreateGC(GCPtr pGC) 5386747b715Smrg{ 53935c4bbdfSmrg ScreenPtr pScreen = pGC->pScreen; 54035c4bbdfSmrg VGAarbiterGCPtr pGCPriv = 54135c4bbdfSmrg (VGAarbiterGCPtr) dixLookupPrivate(&pGC->devPrivates, VGAarbiterGCKey); 54235c4bbdfSmrg Bool ret; 5436747b715Smrg 5446747b715Smrg SCREEN_PROLOG(CreateGC); 54535c4bbdfSmrg ret = (*pScreen->CreateGC) (pGC); 5466747b715Smrg GC_WRAP(pGC); 54735c4bbdfSmrg SCREEN_EPILOG(CreateGC, VGAarbiterCreateGC); 5486747b715Smrg 5496747b715Smrg return ret; 5506747b715Smrg} 5516747b715Smrg 5526747b715Smrg/* GC funcs */ 5536747b715Smrgstatic void 55435c4bbdfSmrgVGAarbiterValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) 5556747b715Smrg{ 5566747b715Smrg GC_UNWRAP(pGC); 55735c4bbdfSmrg (*pGC->funcs->ValidateGC) (pGC, changes, pDraw); 5586747b715Smrg GC_WRAP(pGC); 5596747b715Smrg} 5606747b715Smrg 5616747b715Smrgstatic void 5626747b715SmrgVGAarbiterDestroyGC(GCPtr pGC) 5636747b715Smrg{ 56435c4bbdfSmrg GC_UNWRAP(pGC); 56535c4bbdfSmrg (*pGC->funcs->DestroyGC) (pGC); 56635c4bbdfSmrg GC_WRAP(pGC); 5676747b715Smrg} 5686747b715Smrg 5696747b715Smrgstatic void 57035c4bbdfSmrgVGAarbiterChangeGC(GCPtr pGC, unsigned long mask) 5716747b715Smrg{ 57235c4bbdfSmrg GC_UNWRAP(pGC); 5736747b715Smrg (*pGC->funcs->ChangeGC) (pGC, mask); 57435c4bbdfSmrg GC_WRAP(pGC); 5756747b715Smrg} 5766747b715Smrg 5776747b715Smrgstatic void 57835c4bbdfSmrgVGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) 5796747b715Smrg{ 58035c4bbdfSmrg GC_UNWRAP(pGCDst); 5816747b715Smrg (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); 58235c4bbdfSmrg GC_WRAP(pGCDst); 5836747b715Smrg} 5846747b715Smrg 5856747b715Smrgstatic void 58635c4bbdfSmrgVGAarbiterChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) 5876747b715Smrg{ 58835c4bbdfSmrg GC_UNWRAP(pGC); 5896747b715Smrg (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); 59035c4bbdfSmrg GC_WRAP(pGC); 5916747b715Smrg} 5926747b715Smrg 5936747b715Smrgstatic void 5946747b715SmrgVGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc) 5956747b715Smrg{ 59635c4bbdfSmrg GC_UNWRAP(pgcDst); 59735c4bbdfSmrg (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc); 59835c4bbdfSmrg GC_WRAP(pgcDst); 5996747b715Smrg} 6006747b715Smrg 6016747b715Smrgstatic void 6026747b715SmrgVGAarbiterDestroyClip(GCPtr pGC) 6036747b715Smrg{ 60435c4bbdfSmrg GC_UNWRAP(pGC); 60535c4bbdfSmrg (*pGC->funcs->DestroyClip) (pGC); 60635c4bbdfSmrg GC_WRAP(pGC); 6076747b715Smrg} 6086747b715Smrg 6096747b715Smrg/* GC Ops */ 6106747b715Smrgstatic void 61135c4bbdfSmrgVGAarbiterFillSpans(DrawablePtr pDraw, 61235c4bbdfSmrg GC * pGC, 61335c4bbdfSmrg int nInit, 61435c4bbdfSmrg DDXPointPtr pptInit, int *pwidthInit, int fSorted) 6156747b715Smrg{ 6169ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 61735c4bbdfSmrg 6186747b715Smrg GC_UNWRAP(pGC); 6199ace9065Smrg VGAGet(pScreen); 62035c4bbdfSmrg (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); 6219ace9065Smrg VGAPut(); 6226747b715Smrg GC_WRAP(pGC); 6236747b715Smrg} 6246747b715Smrg 6256747b715Smrgstatic void 62635c4bbdfSmrgVGAarbiterSetSpans(DrawablePtr pDraw, 62735c4bbdfSmrg GCPtr pGC, 62835c4bbdfSmrg char *pcharsrc, 62935c4bbdfSmrg register DDXPointPtr ppt, 63035c4bbdfSmrg int *pwidth, int nspans, int fSorted) 6316747b715Smrg{ 6329ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 63335c4bbdfSmrg 6346747b715Smrg GC_UNWRAP(pGC); 6359ace9065Smrg VGAGet(pScreen); 63635c4bbdfSmrg (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted); 6379ace9065Smrg VGAPut(); 6386747b715Smrg GC_WRAP(pGC); 6396747b715Smrg} 6406747b715Smrg 6416747b715Smrgstatic void 64235c4bbdfSmrgVGAarbiterPutImage(DrawablePtr pDraw, 64335c4bbdfSmrg GCPtr pGC, 64435c4bbdfSmrg int depth, 64535c4bbdfSmrg int x, int y, int w, int h, 64635c4bbdfSmrg int leftPad, int format, char *pImage) 6476747b715Smrg{ 6489ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 64935c4bbdfSmrg 6506747b715Smrg GC_UNWRAP(pGC); 6519ace9065Smrg VGAGet(pScreen); 65235c4bbdfSmrg (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h, 65335c4bbdfSmrg leftPad, format, pImage); 6549ace9065Smrg VGAPut(); 6556747b715Smrg GC_WRAP(pGC); 6566747b715Smrg} 6576747b715Smrg 6586747b715Smrgstatic RegionPtr 65935c4bbdfSmrgVGAarbiterCopyArea(DrawablePtr pSrc, 66035c4bbdfSmrg DrawablePtr pDst, 66135c4bbdfSmrg GC * pGC, 66235c4bbdfSmrg int srcx, int srcy, 66335c4bbdfSmrg int width, int height, int dstx, int dsty) 6646747b715Smrg{ 6656747b715Smrg RegionPtr ret; 6669ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 66735c4bbdfSmrg 6686747b715Smrg GC_UNWRAP(pGC); 6699ace9065Smrg VGAGet(pScreen); 67035c4bbdfSmrg ret = (*pGC->ops->CopyArea) (pSrc, pDst, 67135c4bbdfSmrg pGC, srcx, srcy, width, height, dstx, dsty); 6729ace9065Smrg VGAPut(); 6736747b715Smrg GC_WRAP(pGC); 6746747b715Smrg return ret; 6756747b715Smrg} 6766747b715Smrg 6776747b715Smrgstatic RegionPtr 67835c4bbdfSmrgVGAarbiterCopyPlane(DrawablePtr pSrc, 67935c4bbdfSmrg DrawablePtr pDst, 68035c4bbdfSmrg GCPtr pGC, 68135c4bbdfSmrg int srcx, int srcy, 68235c4bbdfSmrg int width, int height, 68335c4bbdfSmrg int dstx, int dsty, unsigned long bitPlane) 6846747b715Smrg{ 6856747b715Smrg RegionPtr ret; 6869ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 68735c4bbdfSmrg 6886747b715Smrg GC_UNWRAP(pGC); 6899ace9065Smrg VGAGet(pScreen); 69035c4bbdfSmrg ret = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, 69135c4bbdfSmrg width, height, dstx, dsty, bitPlane); 6929ace9065Smrg VGAPut(); 6936747b715Smrg GC_WRAP(pGC); 6946747b715Smrg return ret; 6956747b715Smrg} 6966747b715Smrg 6976747b715Smrgstatic void 69835c4bbdfSmrgVGAarbiterPolyPoint(DrawablePtr pDraw, 69935c4bbdfSmrg GCPtr pGC, int mode, int npt, xPoint * pptInit) 7006747b715Smrg{ 7019ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 70235c4bbdfSmrg 7036747b715Smrg GC_UNWRAP(pGC); 7049ace9065Smrg VGAGet(pScreen); 70535c4bbdfSmrg (*pGC->ops->PolyPoint) (pDraw, pGC, mode, npt, pptInit); 7069ace9065Smrg VGAPut(); 7076747b715Smrg GC_WRAP(pGC); 7086747b715Smrg} 7096747b715Smrg 7106747b715Smrgstatic void 71135c4bbdfSmrgVGAarbiterPolylines(DrawablePtr pDraw, 71235c4bbdfSmrg GCPtr pGC, int mode, int npt, DDXPointPtr pptInit) 7136747b715Smrg{ 7149ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 71535c4bbdfSmrg 7166747b715Smrg GC_UNWRAP(pGC); 7179ace9065Smrg VGAGet(pScreen); 71835c4bbdfSmrg (*pGC->ops->Polylines) (pDraw, pGC, mode, npt, pptInit); 7199ace9065Smrg VGAPut(); 7206747b715Smrg GC_WRAP(pGC); 7216747b715Smrg} 7226747b715Smrg 7236747b715Smrgstatic void 72435c4bbdfSmrgVGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSeg) 7256747b715Smrg{ 7269ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 72735c4bbdfSmrg 7286747b715Smrg GC_UNWRAP(pGC); 7299ace9065Smrg VGAGet(pScreen); 73035c4bbdfSmrg (*pGC->ops->PolySegment) (pDraw, pGC, nseg, pSeg); 7319ace9065Smrg VGAPut(); 7326747b715Smrg GC_WRAP(pGC); 7336747b715Smrg} 7346747b715Smrg 7356747b715Smrgstatic void 73635c4bbdfSmrgVGAarbiterPolyRectangle(DrawablePtr pDraw, 73735c4bbdfSmrg GCPtr pGC, int nRectsInit, xRectangle *pRectsInit) 7386747b715Smrg{ 7399ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 74035c4bbdfSmrg 7416747b715Smrg GC_UNWRAP(pGC); 7429ace9065Smrg VGAGet(pScreen); 74335c4bbdfSmrg (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit); 7449ace9065Smrg VGAPut(); 7456747b715Smrg GC_WRAP(pGC); 7466747b715Smrg} 7476747b715Smrg 7486747b715Smrgstatic void 74935c4bbdfSmrgVGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) 7506747b715Smrg{ 7519ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 75235c4bbdfSmrg 7536747b715Smrg GC_UNWRAP(pGC); 7549ace9065Smrg VGAGet(pScreen); 75535c4bbdfSmrg (*pGC->ops->PolyArc) (pDraw, pGC, narcs, parcs); 7569ace9065Smrg VGAPut(); 7576747b715Smrg GC_WRAP(pGC); 7586747b715Smrg} 7596747b715Smrg 7606747b715Smrgstatic void 76135c4bbdfSmrgVGAarbiterFillPolygon(DrawablePtr pDraw, 76235c4bbdfSmrg GCPtr pGC, 76335c4bbdfSmrg int shape, int mode, int count, DDXPointPtr ptsIn) 7646747b715Smrg{ 7659ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 76635c4bbdfSmrg 7676747b715Smrg GC_UNWRAP(pGC); 7689ace9065Smrg VGAGet(pScreen); 76935c4bbdfSmrg (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn); 7709ace9065Smrg VGAPut(); 7716747b715Smrg GC_WRAP(pGC); 7726747b715Smrg} 7736747b715Smrg 7746747b715Smrgstatic void 77535c4bbdfSmrgVGAarbiterPolyFillRect(DrawablePtr pDraw, 77635c4bbdfSmrg GCPtr pGC, int nrectFill, xRectangle *prectInit) 7776747b715Smrg{ 7789ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 77935c4bbdfSmrg 7806747b715Smrg GC_UNWRAP(pGC); 7819ace9065Smrg VGAGet(pScreen); 78235c4bbdfSmrg (*pGC->ops->PolyFillRect) (pDraw, pGC, nrectFill, prectInit); 7839ace9065Smrg VGAPut(); 7846747b715Smrg GC_WRAP(pGC); 7856747b715Smrg} 7866747b715Smrg 7876747b715Smrgstatic void 78835c4bbdfSmrgVGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) 7896747b715Smrg{ 7909ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 79135c4bbdfSmrg 7926747b715Smrg GC_UNWRAP(pGC); 7939ace9065Smrg VGAGet(pScreen); 79435c4bbdfSmrg (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, parcs); 7959ace9065Smrg VGAPut(); 7966747b715Smrg GC_WRAP(pGC); 7976747b715Smrg} 7986747b715Smrg 7996747b715Smrgstatic int 80035c4bbdfSmrgVGAarbiterPolyText8(DrawablePtr pDraw, 80135c4bbdfSmrg GCPtr pGC, int x, int y, int count, char *chars) 8026747b715Smrg{ 8036747b715Smrg int ret; 8049ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 80535c4bbdfSmrg 8066747b715Smrg GC_UNWRAP(pGC); 8079ace9065Smrg VGAGet(pScreen); 80835c4bbdfSmrg ret = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars); 8099ace9065Smrg VGAPut(); 8106747b715Smrg GC_WRAP(pGC); 8116747b715Smrg return ret; 8126747b715Smrg} 8136747b715Smrg 8146747b715Smrgstatic int 81535c4bbdfSmrgVGAarbiterPolyText16(DrawablePtr pDraw, 81635c4bbdfSmrg GCPtr pGC, int x, int y, int count, unsigned short *chars) 8176747b715Smrg{ 8186747b715Smrg int ret; 8199ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 82035c4bbdfSmrg 8216747b715Smrg GC_UNWRAP(pGC); 8229ace9065Smrg VGAGet(pScreen); 82335c4bbdfSmrg ret = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars); 8249ace9065Smrg VGAPut(); 8256747b715Smrg GC_WRAP(pGC); 8266747b715Smrg return ret; 8276747b715Smrg} 8286747b715Smrg 8296747b715Smrgstatic void 83035c4bbdfSmrgVGAarbiterImageText8(DrawablePtr pDraw, 83135c4bbdfSmrg GCPtr pGC, int x, int y, int count, char *chars) 8326747b715Smrg{ 8339ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 83435c4bbdfSmrg 8356747b715Smrg GC_UNWRAP(pGC); 8369ace9065Smrg VGAGet(pScreen); 83735c4bbdfSmrg (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars); 8389ace9065Smrg VGAPut(); 8396747b715Smrg GC_WRAP(pGC); 8406747b715Smrg} 8416747b715Smrg 8426747b715Smrgstatic void 84335c4bbdfSmrgVGAarbiterImageText16(DrawablePtr pDraw, 84435c4bbdfSmrg GCPtr pGC, int x, int y, int count, unsigned short *chars) 8456747b715Smrg{ 8469ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 84735c4bbdfSmrg 8486747b715Smrg GC_UNWRAP(pGC); 8499ace9065Smrg VGAGet(pScreen); 85035c4bbdfSmrg (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars); 8519ace9065Smrg VGAPut(); 8526747b715Smrg GC_WRAP(pGC); 8536747b715Smrg} 8546747b715Smrg 8556747b715Smrgstatic void 85635c4bbdfSmrgVGAarbiterImageGlyphBlt(DrawablePtr pDraw, 85735c4bbdfSmrg GCPtr pGC, 85835c4bbdfSmrg int xInit, int yInit, 85935c4bbdfSmrg unsigned int nglyph, 86035c4bbdfSmrg CharInfoPtr * ppci, void *pglyphBase) 8616747b715Smrg{ 8629ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 86335c4bbdfSmrg 8646747b715Smrg GC_UNWRAP(pGC); 8659ace9065Smrg VGAGet(pScreen); 86635c4bbdfSmrg (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, xInit, yInit, 86735c4bbdfSmrg nglyph, ppci, pglyphBase); 8689ace9065Smrg VGAPut(); 8696747b715Smrg GC_WRAP(pGC); 8706747b715Smrg} 8716747b715Smrg 8726747b715Smrgstatic void 87335c4bbdfSmrgVGAarbiterPolyGlyphBlt(DrawablePtr pDraw, 87435c4bbdfSmrg GCPtr pGC, 87535c4bbdfSmrg int xInit, int yInit, 87635c4bbdfSmrg unsigned int nglyph, 87735c4bbdfSmrg CharInfoPtr * ppci, void *pglyphBase) 8786747b715Smrg{ 8799ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 88035c4bbdfSmrg 8816747b715Smrg GC_UNWRAP(pGC); 8829ace9065Smrg VGAGet(pScreen); 88335c4bbdfSmrg (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, xInit, yInit, 88435c4bbdfSmrg nglyph, ppci, pglyphBase); 8859ace9065Smrg VGAPut(); 8866747b715Smrg GC_WRAP(pGC); 8876747b715Smrg} 8886747b715Smrg 8896747b715Smrgstatic void 89035c4bbdfSmrgVGAarbiterPushPixels(GCPtr pGC, 89135c4bbdfSmrg PixmapPtr pBitMap, 89235c4bbdfSmrg DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg) 8936747b715Smrg{ 8949ace9065Smrg ScreenPtr pScreen = pGC->pScreen; 89535c4bbdfSmrg 8966747b715Smrg GC_UNWRAP(pGC); 8979ace9065Smrg VGAGet(pScreen); 89835c4bbdfSmrg (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); 8999ace9065Smrg VGAPut(); 9006747b715Smrg GC_WRAP(pGC); 9016747b715Smrg} 9026747b715Smrg 9036747b715Smrg/* miSpriteFuncs */ 9046747b715Smrgstatic Bool 90535c4bbdfSmrgVGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, 90635c4bbdfSmrg CursorPtr pCur) 9076747b715Smrg{ 9086747b715Smrg Bool val; 90935c4bbdfSmrg 9106747b715Smrg SPRITE_PROLOG; 9119ace9065Smrg VGAGet(pScreen); 9126747b715Smrg val = PointPriv->spriteFuncs->RealizeCursor(pDev, pScreen, pCur); 9136747b715Smrg VGAPut(); 9146747b715Smrg SPRITE_EPILOG; 9156747b715Smrg return val; 9166747b715Smrg} 9176747b715Smrg 9186747b715Smrgstatic Bool 91935c4bbdfSmrgVGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, 92035c4bbdfSmrg CursorPtr pCur) 9216747b715Smrg{ 9226747b715Smrg Bool val; 92335c4bbdfSmrg 9246747b715Smrg SPRITE_PROLOG; 9259ace9065Smrg VGAGet(pScreen); 9266747b715Smrg val = PointPriv->spriteFuncs->UnrealizeCursor(pDev, pScreen, pCur); 9276747b715Smrg VGAPut(); 9286747b715Smrg SPRITE_EPILOG; 9296747b715Smrg return val; 9306747b715Smrg} 9316747b715Smrg 9326747b715Smrgstatic void 93335c4bbdfSmrgVGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur, 93435c4bbdfSmrg int x, int y) 9356747b715Smrg{ 9366747b715Smrg SPRITE_PROLOG; 9379ace9065Smrg VGAGet(pScreen); 9386747b715Smrg PointPriv->spriteFuncs->SetCursor(pDev, pScreen, pCur, x, y); 9396747b715Smrg VGAPut(); 9406747b715Smrg SPRITE_EPILOG; 9416747b715Smrg} 9426747b715Smrg 9436747b715Smrgstatic void 9446747b715SmrgVGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) 9456747b715Smrg{ 9466747b715Smrg SPRITE_PROLOG; 9479ace9065Smrg VGAGet(pScreen); 9486747b715Smrg PointPriv->spriteFuncs->MoveCursor(pDev, pScreen, x, y); 9496747b715Smrg VGAPut(); 9506747b715Smrg SPRITE_EPILOG; 9516747b715Smrg} 9526747b715Smrg 9536747b715Smrgstatic Bool 9546747b715SmrgVGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) 9556747b715Smrg{ 9566747b715Smrg Bool val; 95735c4bbdfSmrg 9586747b715Smrg SPRITE_PROLOG; 9599ace9065Smrg VGAGet(pScreen); 9606747b715Smrg val = PointPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen); 9616747b715Smrg VGAPut(); 9626747b715Smrg SPRITE_EPILOG; 9636747b715Smrg return val; 9646747b715Smrg} 9656747b715Smrg 9666747b715Smrgstatic void 9676747b715SmrgVGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) 9686747b715Smrg{ 9696747b715Smrg SPRITE_PROLOG; 9709ace9065Smrg VGAGet(pScreen); 9716747b715Smrg PointPriv->spriteFuncs->DeviceCursorCleanup(pDev, pScreen); 9726747b715Smrg VGAPut(); 9736747b715Smrg SPRITE_EPILOG; 9746747b715Smrg} 9756747b715Smrg 9766747b715Smrgstatic void 9776747b715SmrgVGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, 97835c4bbdfSmrg PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, 97935c4bbdfSmrg INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, 98035c4bbdfSmrg CARD16 height) 9816747b715Smrg{ 98235c4bbdfSmrg ScreenPtr pScreen = pDst->pDrawable->pScreen; 98335c4bbdfSmrg PictureScreenPtr ps = GetPictureScreen(pScreen); 9846747b715Smrg 9856747b715Smrg PICTURE_PROLOGUE(Composite); 9866747b715Smrg 9879ace9065Smrg VGAGet(pScreen); 9886747b715Smrg (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, 98935c4bbdfSmrg yDst, width, height); 9906747b715Smrg VGAPut(); 9916747b715Smrg PICTURE_EPILOGUE(Composite, VGAarbiterComposite); 9926747b715Smrg} 9936747b715Smrg 9946747b715Smrgstatic void 9956747b715SmrgVGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, 99635c4bbdfSmrg PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, 99735c4bbdfSmrg GlyphListPtr list, GlyphPtr * glyphs) 9986747b715Smrg{ 99935c4bbdfSmrg ScreenPtr pScreen = pDst->pDrawable->pScreen; 100035c4bbdfSmrg PictureScreenPtr ps = GetPictureScreen(pScreen); 10016747b715Smrg 10026747b715Smrg PICTURE_PROLOGUE(Glyphs); 10036747b715Smrg 10049ace9065Smrg VGAGet(pScreen); 100535c4bbdfSmrg (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); 10066747b715Smrg VGAPut(); 100735c4bbdfSmrg PICTURE_EPILOGUE(Glyphs, VGAarbiterGlyphs); 10086747b715Smrg} 10096747b715Smrg 10106747b715Smrgstatic void 101135c4bbdfSmrgVGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor * color, 101235c4bbdfSmrg int nRect, xRectangle *rects) 10136747b715Smrg{ 101435c4bbdfSmrg ScreenPtr pScreen = pDst->pDrawable->pScreen; 101535c4bbdfSmrg PictureScreenPtr ps = GetPictureScreen(pScreen); 10166747b715Smrg 10176747b715Smrg PICTURE_PROLOGUE(CompositeRects); 10186747b715Smrg 10199ace9065Smrg VGAGet(pScreen); 102035c4bbdfSmrg (*ps->CompositeRects) (op, pDst, color, nRect, rects); 10216747b715Smrg VGAPut(); 102235c4bbdfSmrg PICTURE_EPILOGUE(CompositeRects, VGAarbiterCompositeRects); 10236747b715Smrg} 1024