1be1ef3d3Smacallan/* 2be1ef3d3Smacallan * IGS CyberPro - hardware acceleration. 3be1ef3d3Smacallan * 4be1ef3d3Smacallan * Copyright (C) 2009 Michael Lorenz 5be1ef3d3Smacallan * 6be1ef3d3Smacallan * Permission is hereby granted, free of charge, to any person obtaining a copy 7be1ef3d3Smacallan * of this software and associated documentation files (the "Software"), to deal 8be1ef3d3Smacallan * in the Software without restriction, including without limitation the rights 9be1ef3d3Smacallan * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10be1ef3d3Smacallan * copies of the Software, and to permit persons to whom the Software is 11be1ef3d3Smacallan * furnished to do so, subject to the following conditions: 12be1ef3d3Smacallan * 13be1ef3d3Smacallan * The above copyright notice and this permission notice shall be included in 14be1ef3d3Smacallan * all copies or substantial portions of the Software. 15be1ef3d3Smacallan * 16be1ef3d3Smacallan * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17be1ef3d3Smacallan * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18be1ef3d3Smacallan * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19be1ef3d3Smacallan * MICHAEL LORENZ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20be1ef3d3Smacallan * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21be1ef3d3Smacallan * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22be1ef3d3Smacallan */ 23be1ef3d3Smacallan 24ca0efe20Smrg/* $NetBSD: igs_accel.c,v 1.10 2016/08/18 09:32:26 mrg Exp $ */ 25be1ef3d3Smacallan 26be1ef3d3Smacallan#include <sys/types.h> 27be1ef3d3Smacallan 28be1ef3d3Smacallan#include "igs.h" 29be1ef3d3Smacallan 30be1ef3d3Smacallan/*#define DEBUG*/ 31be1ef3d3Smacallan 32be1ef3d3Smacallan#ifdef DEBUG 33be1ef3d3Smacallan#define ENTER xf86Msg(X_ERROR, "%s\n", __func__) 34be1ef3d3Smacallan#define LEAVE xf86Msg(X_ERROR, "%s done\n", __func__) 35be1ef3d3Smacallan#else 36be1ef3d3Smacallan#define ENTER 37be1ef3d3Smacallan#define LEAVE 38be1ef3d3Smacallan#endif 39be1ef3d3Smacallan 40be1ef3d3Smacallanstatic inline void IgsWrite1(IgsPtr fPtr, int offset, uint8_t val) 41be1ef3d3Smacallan{ 42be1ef3d3Smacallan *(fPtr->reg + offset) = val; 43be1ef3d3Smacallan} 44be1ef3d3Smacallan 45be1ef3d3Smacallan 46be1ef3d3Smacallanstatic inline void IgsWrite2(IgsPtr fPtr, int offset, uint16_t val) 47be1ef3d3Smacallan{ 48d88e62d8Smacallan *(volatile uint16_t *)(fPtr->reg + offset) = val; 49be1ef3d3Smacallan} 50be1ef3d3Smacallan 51be1ef3d3Smacallanstatic inline void IgsWrite4(IgsPtr fPtr, int offset, uint32_t val) 52be1ef3d3Smacallan{ 53d88e62d8Smacallan *(volatile uint32_t *)(fPtr->reg + offset) = val; 54be1ef3d3Smacallan} 55be1ef3d3Smacallan 56be1ef3d3Smacallanstatic inline uint8_t IgsRead1(IgsPtr fPtr, int offset) 57be1ef3d3Smacallan{ 58be1ef3d3Smacallan return *(fPtr->reg + offset); 59be1ef3d3Smacallan} 60be1ef3d3Smacallan 61be1ef3d3Smacallanstatic inline uint16_t IgsRead2(IgsPtr fPtr, int offset) 62be1ef3d3Smacallan{ 63d88e62d8Smacallan return *(volatile uint16_t *)(fPtr->reg + offset); 64be1ef3d3Smacallan} 65be1ef3d3Smacallan 66be1ef3d3Smacallanstatic void 67be1ef3d3SmacallanIgsWaitMarker(ScreenPtr pScreen, int Marker) 68be1ef3d3Smacallan{ 69be1ef3d3Smacallan ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 70be1ef3d3Smacallan IgsPtr fPtr = IGSPTR(pScrn); 71be1ef3d3Smacallan int bail = 0x0fffffff; 729a5ed1c5Smacallan 73be1ef3d3Smacallan ENTER; 74727ce256Smacallan IgsWrite1(fPtr, IGS_COP_MAP_FMT_REG, fPtr->mapfmt); 75db0f996aSmacallan while (((IgsRead1(fPtr, 76db0f996aSmacallan IGS_COP_CTL_REG) & (IGS_COP_CTL_BUSY | IGS_COP_CTL_HFEMPTZ)) != 0) 77be1ef3d3Smacallan && (bail > 0)) { 78be1ef3d3Smacallan bail--; 79727ce256Smacallan IgsWrite1(fPtr, IGS_COP_MAP_FMT_REG, fPtr->mapfmt); 80be1ef3d3Smacallan } 81be1ef3d3Smacallan 82be1ef3d3Smacallan /* reset the coprocessor if we run into a timeout */ 83be1ef3d3Smacallan if (bail == 0) { 84be1ef3d3Smacallan xf86Msg(X_ERROR, "%s: timeout\n", __func__); 85be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_CTL_REG, 0); 86be1ef3d3Smacallan } 87be1ef3d3Smacallan LEAVE; 88be1ef3d3Smacallan} 89be1ef3d3Smacallan 90be1ef3d3Smacallanstatic void 91be1ef3d3SmacallanIgsWaitReady(IgsPtr fPtr) 92be1ef3d3Smacallan{ 93be1ef3d3Smacallan int bail = 0x0fffffff; 949a5ed1c5Smacallan 95be1ef3d3Smacallan ENTER; 96727ce256Smacallan IgsWrite1(fPtr, IGS_COP_MAP_FMT_REG, fPtr->mapfmt); 97be1ef3d3Smacallan while (((IgsRead1(fPtr, 98be1ef3d3Smacallan IGS_COP_CTL_REG) & (IGS_COP_CTL_BUSY | IGS_COP_CTL_HFEMPTZ)) != 0) 99be1ef3d3Smacallan && (bail > 0)) { 100be1ef3d3Smacallan bail--; 101727ce256Smacallan IgsWrite1(fPtr, IGS_COP_MAP_FMT_REG, fPtr->mapfmt); 102be1ef3d3Smacallan } 103be1ef3d3Smacallan 104be1ef3d3Smacallan /* reset the coprocessor if we run into a timeout */ 105be1ef3d3Smacallan if (bail == 0) { 106be1ef3d3Smacallan xf86Msg(X_ERROR, "%s: timeout\n", __func__); 107be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_CTL_REG, 0); 108be1ef3d3Smacallan } 109be1ef3d3Smacallan LEAVE; 110be1ef3d3Smacallan} 111be1ef3d3Smacallan 112be1ef3d3Smacallanstatic Bool 113be1ef3d3SmacallanIgsPrepareCopy 114be1ef3d3Smacallan( 115be1ef3d3Smacallan PixmapPtr pSrcPixmap, 116be1ef3d3Smacallan PixmapPtr pDstPixmap, 117be1ef3d3Smacallan int xdir, 118be1ef3d3Smacallan int ydir, 119be1ef3d3Smacallan int alu, 120be1ef3d3Smacallan Pixel planemask 121be1ef3d3Smacallan) 122be1ef3d3Smacallan{ 123be1ef3d3Smacallan ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; 124be1ef3d3Smacallan IgsPtr fPtr = IGSPTR(pScrn); 125be1ef3d3Smacallan 126be1ef3d3Smacallan ENTER; 127be1ef3d3Smacallan fPtr->cmd = IGS_COP_OP_PXBLT | IGS_COP_OP_FG_FROM_SRC | 128be1ef3d3Smacallan IGS_COP_PPM_FIXED_FG; 129be1ef3d3Smacallan if (xdir < 0) 130be1ef3d3Smacallan fPtr->cmd |= IGS_COP_OCTANT_X_NEG; 131be1ef3d3Smacallan if (ydir < 0) 132be1ef3d3Smacallan fPtr->cmd |= IGS_COP_OCTANT_Y_NEG; 133be1ef3d3Smacallan 134be1ef3d3Smacallan IgsWaitReady(fPtr); 135be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_CTL_REG, 0); 136be1ef3d3Smacallan fPtr->srcoff = exaGetPixmapOffset(pSrcPixmap) >> fPtr->shift; 137be1ef3d3Smacallan fPtr->srcpitch = exaGetPixmapPitch(pSrcPixmap) >> fPtr->shift; 138be1ef3d3Smacallan 139be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_SRC_MAP_WIDTH_REG, fPtr->srcpitch - 1); 140be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_DST_MAP_WIDTH_REG, 141be1ef3d3Smacallan (exaGetPixmapPitch(pDstPixmap) >> fPtr->shift) - 1); 142be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_FG_MIX_REG, alu); 143be1ef3d3Smacallan IgsWrite4(fPtr, IGS_PLANE_MASK_REG, planemask); 144be1ef3d3Smacallan LEAVE; 145be1ef3d3Smacallan return TRUE; 146be1ef3d3Smacallan} 147be1ef3d3Smacallan 148be1ef3d3Smacallanstatic void 149be1ef3d3SmacallanIgsCopy 150be1ef3d3Smacallan( 151be1ef3d3Smacallan PixmapPtr pDstPixmap, 152be1ef3d3Smacallan int srcX, 153be1ef3d3Smacallan int srcY, 154be1ef3d3Smacallan int dstX, 155be1ef3d3Smacallan int dstY, 156be1ef3d3Smacallan int w, 157be1ef3d3Smacallan int h 158be1ef3d3Smacallan) 159be1ef3d3Smacallan{ 160be1ef3d3Smacallan ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; 161be1ef3d3Smacallan IgsPtr fPtr = IGSPTR(pScrn); 162be1ef3d3Smacallan int dstpitch, dstoff; 163be1ef3d3Smacallan 164be1ef3d3Smacallan if (fPtr->cmd & IGS_COP_OCTANT_X_NEG) { 165be1ef3d3Smacallan srcX += (w - 1); 166be1ef3d3Smacallan dstX += (w - 1); 167be1ef3d3Smacallan } 168be1ef3d3Smacallan 169be1ef3d3Smacallan if (fPtr->cmd & IGS_COP_OCTANT_Y_NEG) { 170be1ef3d3Smacallan srcY += (h - 1); 171be1ef3d3Smacallan dstY += (h - 1); 172be1ef3d3Smacallan } 173be1ef3d3Smacallan IgsWaitReady(fPtr); 174be1ef3d3Smacallan IgsWrite4(fPtr, IGS_COP_SRC_START_REG, fPtr->srcoff + srcX + 175be1ef3d3Smacallan fPtr->srcpitch * srcY); 176be1ef3d3Smacallan dstpitch = exaGetPixmapPitch(pDstPixmap) >> fPtr->shift; 177be1ef3d3Smacallan dstoff = exaGetPixmapOffset(pDstPixmap) >> fPtr->shift; 178be1ef3d3Smacallan IgsWrite4(fPtr, IGS_COP_DST_START_REG, dstoff + dstX + 179be1ef3d3Smacallan dstpitch * dstY); 180be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_WIDTH_REG, w - 1); 181be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_HEIGHT_REG, h - 1); 182be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_PIXEL_OP_REG, fPtr->cmd & 0xffff); 183be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_PIXEL_OP_REG + 2, (fPtr->cmd >> 16) & 0xffff); 1842e72e74dSmacallan exaMarkSync(pDstPixmap->drawable.pScreen); 185be1ef3d3Smacallan LEAVE; 186be1ef3d3Smacallan} 187be1ef3d3Smacallan 188be1ef3d3Smacallanstatic void 189be1ef3d3SmacallanIgsDoneCopy(PixmapPtr pDstPixmap) 190be1ef3d3Smacallan{ 191be1ef3d3Smacallan ENTER; 192be1ef3d3Smacallan LEAVE; 193be1ef3d3Smacallan} 194be1ef3d3Smacallan 195be1ef3d3Smacallanstatic Bool 196be1ef3d3SmacallanIgsPrepareSolid( 197be1ef3d3Smacallan PixmapPtr pPixmap, 198be1ef3d3Smacallan int alu, 199be1ef3d3Smacallan Pixel planemask, 200be1ef3d3Smacallan Pixel fg) 201be1ef3d3Smacallan{ 202be1ef3d3Smacallan ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; 203be1ef3d3Smacallan IgsPtr fPtr = IGSPTR(pScrn); 204be1ef3d3Smacallan 205be1ef3d3Smacallan ENTER; 206be1ef3d3Smacallan fPtr->cmd = IGS_COP_OP_PXBLT | IGS_COP_PPM_FIXED_FG; 207be1ef3d3Smacallan 208be1ef3d3Smacallan IgsWaitReady(fPtr); 209be1ef3d3Smacallan 210be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_CTL_REG, 0); 211be1ef3d3Smacallan 212be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_DST_MAP_WIDTH_REG, 213be1ef3d3Smacallan (exaGetPixmapPitch(pPixmap) >> fPtr->shift) - 1); 214be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_FG_MIX_REG, alu); 215be1ef3d3Smacallan IgsWrite4(fPtr, IGS_PLANE_MASK_REG, planemask); 216be1ef3d3Smacallan IgsWrite4(fPtr, IGS_COP_FG_REG, fg); 217be1ef3d3Smacallan LEAVE; 218be1ef3d3Smacallan return TRUE; 219be1ef3d3Smacallan} 220be1ef3d3Smacallan 221be1ef3d3Smacallanstatic void 222be1ef3d3SmacallanIgsSolid( 223be1ef3d3Smacallan PixmapPtr pPixmap, 224be1ef3d3Smacallan int x1, 225be1ef3d3Smacallan int y1, 226be1ef3d3Smacallan int x2, 227be1ef3d3Smacallan int y2) 228be1ef3d3Smacallan{ 229be1ef3d3Smacallan ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; 230be1ef3d3Smacallan IgsPtr fPtr = IGSPTR(pScrn); 231be1ef3d3Smacallan int w = x2 - x1, h = y2 - y1, dstoff, dstpitch; 232be1ef3d3Smacallan 233be1ef3d3Smacallan ENTER; 234be1ef3d3Smacallan IgsWaitReady(fPtr); 235be1ef3d3Smacallan dstpitch = exaGetPixmapPitch(pPixmap) >> fPtr->shift; 236be1ef3d3Smacallan dstoff = exaGetPixmapOffset(pPixmap) >> fPtr->shift; 237be1ef3d3Smacallan IgsWrite4(fPtr, IGS_COP_DST_START_REG, dstoff + x1 + 238be1ef3d3Smacallan dstpitch * y1); 239be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_WIDTH_REG, w - 1); 240be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_HEIGHT_REG, h - 1); 241be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_PIXEL_OP_REG, fPtr->cmd & 0xffff); 242be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_PIXEL_OP_REG + 2, (fPtr->cmd >> 16) & 0xffff); 2432e72e74dSmacallan exaMarkSync(pPixmap->drawable.pScreen); 244be1ef3d3Smacallan} 245be1ef3d3Smacallan 246be1ef3d3Smacallan/* 247be1ef3d3Smacallan * Memcpy-based UTS. 248be1ef3d3Smacallan */ 249be1ef3d3Smacallanstatic Bool 250be1ef3d3SmacallanIgsUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, 251be1ef3d3Smacallan char *src, int src_pitch) 252be1ef3d3Smacallan{ 2539a5ed1c5Smacallan ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; 2549a5ed1c5Smacallan IgsPtr fPtr = IGSPTR(pScrn); 255db0f996aSmacallan unsigned char *dst = fPtr->fbmem + exaGetPixmapOffset(pDst); 256db0f996aSmacallan int dst_pitch = exaGetPixmapPitch(pDst); 257be1ef3d3Smacallan 2589a5ed1c5Smacallan int bpp = pDst->drawable.bitsPerPixel; 259727ce256Smacallan int cpp = (bpp + 7) >> 3; 2609a5ed1c5Smacallan int wBytes = w * cpp; 261be1ef3d3Smacallan 2629a5ed1c5Smacallan ENTER; 2639a5ed1c5Smacallan dst += (x * cpp) + (y * dst_pitch); 264be1ef3d3Smacallan 265727ce256Smacallan IgsWaitReady(fPtr); 266727ce256Smacallan 2679a5ed1c5Smacallan while (h--) { 2689a5ed1c5Smacallan memcpy(dst, src, wBytes); 2699a5ed1c5Smacallan src += src_pitch; 2709a5ed1c5Smacallan dst += dst_pitch; 2719a5ed1c5Smacallan } 2729a5ed1c5Smacallan LEAVE; 2739a5ed1c5Smacallan return TRUE; 274be1ef3d3Smacallan} 275be1ef3d3Smacallan 276be1ef3d3Smacallan/* 277be1ef3d3Smacallan * Memcpy-based DFS. 278be1ef3d3Smacallan */ 279be1ef3d3Smacallanstatic Bool 280be1ef3d3SmacallanIgsDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, 281be1ef3d3Smacallan char *dst, int dst_pitch) 282be1ef3d3Smacallan{ 2839a5ed1c5Smacallan ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum]; 2849a5ed1c5Smacallan IgsPtr fPtr = IGSPTR(pScrn); 285db0f996aSmacallan unsigned char *src = fPtr->fbmem + exaGetPixmapOffset(pSrc); 286db0f996aSmacallan int src_pitch = exaGetPixmapPitch(pSrc); 287be1ef3d3Smacallan 2889a5ed1c5Smacallan int bpp = pSrc->drawable.bitsPerPixel; 289727ce256Smacallan int cpp = (bpp + 7) >> 3; 2909a5ed1c5Smacallan int wBytes = w * cpp; 291be1ef3d3Smacallan 2929a5ed1c5Smacallan ENTER; 2939a5ed1c5Smacallan src += (x * cpp) + (y * src_pitch); 294be1ef3d3Smacallan 295727ce256Smacallan IgsWaitReady(fPtr); 296727ce256Smacallan 2979a5ed1c5Smacallan while (h--) { 2989a5ed1c5Smacallan memcpy(dst, src, wBytes); 2999a5ed1c5Smacallan src += src_pitch; 3009a5ed1c5Smacallan dst += dst_pitch; 3019a5ed1c5Smacallan } 3029a5ed1c5Smacallan LEAVE; 3039a5ed1c5Smacallan return TRUE; 304be1ef3d3Smacallan} 305be1ef3d3Smacallan 30683616484Smacallan#ifdef __arm__ 30783616484Smacallanstatic Bool 30883616484SmacallanIgsPrepareAccess(PixmapPtr pPix, int index) 30983616484Smacallan{ 31083616484Smacallan ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum]; 31183616484Smacallan IgsPtr fPtr = IGSPTR(pScrn); 31283616484Smacallan 31383616484Smacallan IgsWaitReady(fPtr); 31483616484Smacallan return TRUE; 31583616484Smacallan} 31683616484Smacallan 31783616484Smacallanstatic void 31883616484SmacallanIgsFinishAccess(PixmapPtr pPix, int index) 31983616484Smacallan{ 32083616484Smacallan} 32183616484Smacallan#endif 32283616484Smacallan 323be1ef3d3SmacallanBool 324be1ef3d3SmacallanIgsInitAccel(ScreenPtr pScreen) 325be1ef3d3Smacallan{ 3269a5ed1c5Smacallan ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 3279a5ed1c5Smacallan IgsPtr fPtr = IGSPTR(pScrn); 3289a5ed1c5Smacallan ExaDriverPtr pExa; 3299a5ed1c5Smacallan 3309a5ed1c5Smacallan pExa = exaDriverAlloc(); 3319a5ed1c5Smacallan if (!pExa) 3329a5ed1c5Smacallan return FALSE; 3339a5ed1c5Smacallan 3349a5ed1c5Smacallan fPtr->pExa = pExa; 3359a5ed1c5Smacallan 3369a5ed1c5Smacallan pExa->exa_major = EXA_VERSION_MAJOR; 3379a5ed1c5Smacallan pExa->exa_minor = EXA_VERSION_MINOR; 3389a5ed1c5Smacallan 3399a5ed1c5Smacallan pExa->memoryBase = fPtr->fbmem; 340be1ef3d3Smacallan pExa->memorySize = fPtr->fbmem_len; 341be1ef3d3Smacallan pExa->offScreenBase = fPtr->linebytes * fPtr->info.height; 342be1ef3d3Smacallan pExa->pixmapOffsetAlign = 4; 343be1ef3d3Smacallan pExa->pixmapPitchAlign = 4; 344be1ef3d3Smacallan 345db0f996aSmacallan pExa->flags = EXA_OFFSCREEN_PIXMAPS | 346db0f996aSmacallan EXA_SUPPORTS_OFFSCREEN_OVERLAPS | 347db0f996aSmacallan EXA_MIXED_PIXMAPS; 348be1ef3d3Smacallan 3499a5ed1c5Smacallan pExa->maxX = 2048; 3509a5ed1c5Smacallan pExa->maxY = 2048; 351be1ef3d3Smacallan 3529a5ed1c5Smacallan pExa->WaitMarker = IgsWaitMarker; 3539a5ed1c5Smacallan pExa->PrepareSolid = IgsPrepareSolid; 3549a5ed1c5Smacallan pExa->Solid = IgsSolid; 3559a5ed1c5Smacallan pExa->DoneSolid = IgsDoneCopy; 3569a5ed1c5Smacallan pExa->PrepareCopy = IgsPrepareCopy; 3579a5ed1c5Smacallan pExa->Copy = IgsCopy; 3589a5ed1c5Smacallan pExa->DoneCopy = IgsDoneCopy; 359be1ef3d3Smacallan 360be1ef3d3Smacallan switch(fPtr->info.depth) { 361be1ef3d3Smacallan case 8: 362be1ef3d3Smacallan fPtr->shift = 0; 363727ce256Smacallan fPtr->mapfmt = IGS_COP_MAP_8BPP; 364be1ef3d3Smacallan break; 365be1ef3d3Smacallan case 16: 366be1ef3d3Smacallan fPtr->shift = 1; 367727ce256Smacallan fPtr->mapfmt = IGS_COP_MAP_16BPP; 368be1ef3d3Smacallan break; 369727ce256Smacallan case 24: 370be1ef3d3Smacallan case 32: 371be1ef3d3Smacallan fPtr->shift = 2; 372727ce256Smacallan fPtr->mapfmt = IGS_COP_MAP_32BPP; 373be1ef3d3Smacallan break; 374727ce256Smacallan default: 375727ce256Smacallan ErrorF("Unsupported depth: %d\n", fPtr->info.depth); 376be1ef3d3Smacallan } 377727ce256Smacallan IgsWrite1(fPtr, IGS_COP_MAP_FMT_REG, fPtr->mapfmt); 378727ce256Smacallan 3799a5ed1c5Smacallan /* EXA hits more optimized paths when it does not have to fallback 3809a5ed1c5Smacallan * because of missing UTS/DFS, hook memcpy-based UTS/DFS. 3819a5ed1c5Smacallan */ 3829a5ed1c5Smacallan pExa->UploadToScreen = IgsUploadToScreen; 3839a5ed1c5Smacallan pExa->DownloadFromScreen = IgsDownloadFromScreen; 38483616484Smacallan#ifdef __arm__ 38583616484Smacallan pExa->PrepareAccess = IgsPrepareAccess; 38683616484Smacallan pExa->FinishAccess = IgsFinishAccess; 38783616484Smacallan#endif 3889a5ed1c5Smacallan return exaDriverInit(pScreen, pExa); 389be1ef3d3Smacallan} 390