igs_accel.c revision 2e72e74d
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 242e72e74dSmacallan/* $NetBSD: igs_accel.c,v 1.8 2011/12/14 23:58:54 macallan Exp $ */ 25be1ef3d3Smacallan 26be1ef3d3Smacallan#include <sys/types.h> 27be1ef3d3Smacallan 28b4c928c7Schristos/* all driver need this */ 29b4c928c7Schristos#include "xf86.h" 30b4c928c7Schristos#include "xf86_OSproc.h" 3180c47f9aSchristos#include "compiler.h" 32b4c928c7Schristos 33be1ef3d3Smacallan#include "igs.h" 34be1ef3d3Smacallan 35be1ef3d3Smacallan/*#define DEBUG*/ 36be1ef3d3Smacallan 37be1ef3d3Smacallan#ifdef DEBUG 38be1ef3d3Smacallan#define ENTER xf86Msg(X_ERROR, "%s\n", __func__) 39be1ef3d3Smacallan#define LEAVE xf86Msg(X_ERROR, "%s done\n", __func__) 40be1ef3d3Smacallan#else 41be1ef3d3Smacallan#define ENTER 42be1ef3d3Smacallan#define LEAVE 43be1ef3d3Smacallan#endif 44be1ef3d3Smacallan 45be1ef3d3Smacallanstatic inline void IgsWrite1(IgsPtr fPtr, int offset, uint8_t val) 46be1ef3d3Smacallan{ 47be1ef3d3Smacallan *(fPtr->reg + offset) = val; 48be1ef3d3Smacallan} 49be1ef3d3Smacallan 50be1ef3d3Smacallan 51be1ef3d3Smacallanstatic inline void IgsWrite2(IgsPtr fPtr, int offset, uint16_t val) 52be1ef3d3Smacallan{ 53d88e62d8Smacallan *(volatile uint16_t *)(fPtr->reg + offset) = val; 54be1ef3d3Smacallan} 55be1ef3d3Smacallan 56be1ef3d3Smacallanstatic inline void IgsWrite4(IgsPtr fPtr, int offset, uint32_t val) 57be1ef3d3Smacallan{ 58d88e62d8Smacallan *(volatile uint32_t *)(fPtr->reg + offset) = val; 59be1ef3d3Smacallan} 60be1ef3d3Smacallan 61be1ef3d3Smacallanstatic inline uint8_t IgsRead1(IgsPtr fPtr, int offset) 62be1ef3d3Smacallan{ 63be1ef3d3Smacallan return *(fPtr->reg + offset); 64be1ef3d3Smacallan} 65be1ef3d3Smacallan 66be1ef3d3Smacallanstatic inline uint16_t IgsRead2(IgsPtr fPtr, int offset) 67be1ef3d3Smacallan{ 68d88e62d8Smacallan return *(volatile uint16_t *)(fPtr->reg + offset); 69be1ef3d3Smacallan} 70be1ef3d3Smacallan 71be1ef3d3Smacallanstatic void 72be1ef3d3SmacallanIgsWaitMarker(ScreenPtr pScreen, int Marker) 73be1ef3d3Smacallan{ 74be1ef3d3Smacallan ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 75be1ef3d3Smacallan IgsPtr fPtr = IGSPTR(pScrn); 76be1ef3d3Smacallan int bail = 0x0fffffff; 779a5ed1c5Smacallan 78be1ef3d3Smacallan ENTER; 79727ce256Smacallan IgsWrite1(fPtr, IGS_COP_MAP_FMT_REG, fPtr->mapfmt); 80be1ef3d3Smacallan while ((IgsRead1(fPtr, 81be1ef3d3Smacallan IGS_COP_CTL_REG) & (IGS_COP_CTL_BUSY | IGS_COP_CTL_HFEMPTZ) != 0) 82be1ef3d3Smacallan && (bail > 0)) { 83be1ef3d3Smacallan bail--; 84727ce256Smacallan IgsWrite1(fPtr, IGS_COP_MAP_FMT_REG, fPtr->mapfmt); 85be1ef3d3Smacallan } 86be1ef3d3Smacallan 87be1ef3d3Smacallan /* reset the coprocessor if we run into a timeout */ 88be1ef3d3Smacallan if (bail == 0) { 89be1ef3d3Smacallan xf86Msg(X_ERROR, "%s: timeout\n", __func__); 90be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_CTL_REG, 0); 91be1ef3d3Smacallan } 92be1ef3d3Smacallan LEAVE; 93be1ef3d3Smacallan} 94be1ef3d3Smacallan 95be1ef3d3Smacallanstatic void 96be1ef3d3SmacallanIgsWaitReady(IgsPtr fPtr) 97be1ef3d3Smacallan{ 98be1ef3d3Smacallan int bail = 0x0fffffff; 999a5ed1c5Smacallan 100be1ef3d3Smacallan ENTER; 101727ce256Smacallan IgsWrite1(fPtr, IGS_COP_MAP_FMT_REG, fPtr->mapfmt); 102be1ef3d3Smacallan while (((IgsRead1(fPtr, 103be1ef3d3Smacallan IGS_COP_CTL_REG) & (IGS_COP_CTL_BUSY | IGS_COP_CTL_HFEMPTZ)) != 0) 104be1ef3d3Smacallan && (bail > 0)) { 105be1ef3d3Smacallan bail--; 106727ce256Smacallan IgsWrite1(fPtr, IGS_COP_MAP_FMT_REG, fPtr->mapfmt); 107be1ef3d3Smacallan } 108be1ef3d3Smacallan 109be1ef3d3Smacallan /* reset the coprocessor if we run into a timeout */ 110be1ef3d3Smacallan if (bail == 0) { 111be1ef3d3Smacallan xf86Msg(X_ERROR, "%s: timeout\n", __func__); 112be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_CTL_REG, 0); 113be1ef3d3Smacallan } 114be1ef3d3Smacallan LEAVE; 115be1ef3d3Smacallan} 116be1ef3d3Smacallan 117be1ef3d3Smacallanstatic Bool 118be1ef3d3SmacallanIgsPrepareCopy 119be1ef3d3Smacallan( 120be1ef3d3Smacallan PixmapPtr pSrcPixmap, 121be1ef3d3Smacallan PixmapPtr pDstPixmap, 122be1ef3d3Smacallan int xdir, 123be1ef3d3Smacallan int ydir, 124be1ef3d3Smacallan int alu, 125be1ef3d3Smacallan Pixel planemask 126be1ef3d3Smacallan) 127be1ef3d3Smacallan{ 128be1ef3d3Smacallan ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; 129be1ef3d3Smacallan IgsPtr fPtr = IGSPTR(pScrn); 130be1ef3d3Smacallan 131be1ef3d3Smacallan ENTER; 132be1ef3d3Smacallan fPtr->cmd = IGS_COP_OP_PXBLT | IGS_COP_OP_FG_FROM_SRC | 133be1ef3d3Smacallan IGS_COP_PPM_FIXED_FG; 134be1ef3d3Smacallan if (xdir < 0) 135be1ef3d3Smacallan fPtr->cmd |= IGS_COP_OCTANT_X_NEG; 136be1ef3d3Smacallan if (ydir < 0) 137be1ef3d3Smacallan fPtr->cmd |= IGS_COP_OCTANT_Y_NEG; 138be1ef3d3Smacallan 139be1ef3d3Smacallan IgsWaitReady(fPtr); 140be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_CTL_REG, 0); 141be1ef3d3Smacallan fPtr->srcoff = exaGetPixmapOffset(pSrcPixmap) >> fPtr->shift; 142be1ef3d3Smacallan fPtr->srcpitch = exaGetPixmapPitch(pSrcPixmap) >> fPtr->shift; 143be1ef3d3Smacallan 144be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_SRC_MAP_WIDTH_REG, fPtr->srcpitch - 1); 145be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_DST_MAP_WIDTH_REG, 146be1ef3d3Smacallan (exaGetPixmapPitch(pDstPixmap) >> fPtr->shift) - 1); 147be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_FG_MIX_REG, alu); 148be1ef3d3Smacallan IgsWrite4(fPtr, IGS_PLANE_MASK_REG, planemask); 149be1ef3d3Smacallan LEAVE; 150be1ef3d3Smacallan return TRUE; 151be1ef3d3Smacallan} 152be1ef3d3Smacallan 153be1ef3d3Smacallanstatic void 154be1ef3d3SmacallanIgsCopy 155be1ef3d3Smacallan( 156be1ef3d3Smacallan PixmapPtr pDstPixmap, 157be1ef3d3Smacallan int srcX, 158be1ef3d3Smacallan int srcY, 159be1ef3d3Smacallan int dstX, 160be1ef3d3Smacallan int dstY, 161be1ef3d3Smacallan int w, 162be1ef3d3Smacallan int h 163be1ef3d3Smacallan) 164be1ef3d3Smacallan{ 165be1ef3d3Smacallan ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; 166be1ef3d3Smacallan IgsPtr fPtr = IGSPTR(pScrn); 167be1ef3d3Smacallan int dstpitch, dstoff; 168be1ef3d3Smacallan 169be1ef3d3Smacallan if (fPtr->cmd & IGS_COP_OCTANT_X_NEG) { 170be1ef3d3Smacallan srcX += (w - 1); 171be1ef3d3Smacallan dstX += (w - 1); 172be1ef3d3Smacallan } 173be1ef3d3Smacallan 174be1ef3d3Smacallan if (fPtr->cmd & IGS_COP_OCTANT_Y_NEG) { 175be1ef3d3Smacallan srcY += (h - 1); 176be1ef3d3Smacallan dstY += (h - 1); 177be1ef3d3Smacallan } 178be1ef3d3Smacallan IgsWaitReady(fPtr); 179be1ef3d3Smacallan IgsWrite4(fPtr, IGS_COP_SRC_START_REG, fPtr->srcoff + srcX + 180be1ef3d3Smacallan fPtr->srcpitch * srcY); 181be1ef3d3Smacallan dstpitch = exaGetPixmapPitch(pDstPixmap) >> fPtr->shift; 182be1ef3d3Smacallan dstoff = exaGetPixmapOffset(pDstPixmap) >> fPtr->shift; 183be1ef3d3Smacallan IgsWrite4(fPtr, IGS_COP_DST_START_REG, dstoff + dstX + 184be1ef3d3Smacallan dstpitch * dstY); 185be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_WIDTH_REG, w - 1); 186be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_HEIGHT_REG, h - 1); 187be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_PIXEL_OP_REG, fPtr->cmd & 0xffff); 188be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_PIXEL_OP_REG + 2, (fPtr->cmd >> 16) & 0xffff); 1892e72e74dSmacallan exaMarkSync(pDstPixmap->drawable.pScreen); 190be1ef3d3Smacallan LEAVE; 191be1ef3d3Smacallan} 192be1ef3d3Smacallan 193be1ef3d3Smacallanstatic void 194be1ef3d3SmacallanIgsDoneCopy(PixmapPtr pDstPixmap) 195be1ef3d3Smacallan{ 196be1ef3d3Smacallan ENTER; 197be1ef3d3Smacallan LEAVE; 198be1ef3d3Smacallan} 199be1ef3d3Smacallan 200be1ef3d3Smacallanstatic Bool 201be1ef3d3SmacallanIgsPrepareSolid( 202be1ef3d3Smacallan PixmapPtr pPixmap, 203be1ef3d3Smacallan int alu, 204be1ef3d3Smacallan Pixel planemask, 205be1ef3d3Smacallan Pixel fg) 206be1ef3d3Smacallan{ 207be1ef3d3Smacallan ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; 208be1ef3d3Smacallan IgsPtr fPtr = IGSPTR(pScrn); 209be1ef3d3Smacallan 210be1ef3d3Smacallan ENTER; 211be1ef3d3Smacallan fPtr->cmd = IGS_COP_OP_PXBLT | IGS_COP_PPM_FIXED_FG; 212be1ef3d3Smacallan 213be1ef3d3Smacallan IgsWaitReady(fPtr); 214be1ef3d3Smacallan 215be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_CTL_REG, 0); 216be1ef3d3Smacallan 217be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_DST_MAP_WIDTH_REG, 218be1ef3d3Smacallan (exaGetPixmapPitch(pPixmap) >> fPtr->shift) - 1); 219be1ef3d3Smacallan IgsWrite1(fPtr, IGS_COP_FG_MIX_REG, alu); 220be1ef3d3Smacallan IgsWrite4(fPtr, IGS_PLANE_MASK_REG, planemask); 221be1ef3d3Smacallan IgsWrite4(fPtr, IGS_COP_FG_REG, fg); 222be1ef3d3Smacallan LEAVE; 223be1ef3d3Smacallan return TRUE; 224be1ef3d3Smacallan} 225be1ef3d3Smacallan 226be1ef3d3Smacallanstatic void 227be1ef3d3SmacallanIgsSolid( 228be1ef3d3Smacallan PixmapPtr pPixmap, 229be1ef3d3Smacallan int x1, 230be1ef3d3Smacallan int y1, 231be1ef3d3Smacallan int x2, 232be1ef3d3Smacallan int y2) 233be1ef3d3Smacallan{ 234be1ef3d3Smacallan ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; 235be1ef3d3Smacallan IgsPtr fPtr = IGSPTR(pScrn); 236be1ef3d3Smacallan int w = x2 - x1, h = y2 - y1, dstoff, dstpitch; 237be1ef3d3Smacallan 238be1ef3d3Smacallan ENTER; 239be1ef3d3Smacallan IgsWaitReady(fPtr); 240be1ef3d3Smacallan dstpitch = exaGetPixmapPitch(pPixmap) >> fPtr->shift; 241be1ef3d3Smacallan dstoff = exaGetPixmapOffset(pPixmap) >> fPtr->shift; 242be1ef3d3Smacallan IgsWrite4(fPtr, IGS_COP_DST_START_REG, dstoff + x1 + 243be1ef3d3Smacallan dstpitch * y1); 244be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_WIDTH_REG, w - 1); 245be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_HEIGHT_REG, h - 1); 246be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_PIXEL_OP_REG, fPtr->cmd & 0xffff); 247be1ef3d3Smacallan IgsWrite2(fPtr, IGS_COP_PIXEL_OP_REG + 2, (fPtr->cmd >> 16) & 0xffff); 2482e72e74dSmacallan exaMarkSync(pPixmap->drawable.pScreen); 249be1ef3d3Smacallan} 250be1ef3d3Smacallan 251be1ef3d3Smacallan/* 252be1ef3d3Smacallan * Memcpy-based UTS. 253be1ef3d3Smacallan */ 254be1ef3d3Smacallanstatic Bool 255be1ef3d3SmacallanIgsUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, 256be1ef3d3Smacallan char *src, int src_pitch) 257be1ef3d3Smacallan{ 2589a5ed1c5Smacallan ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; 2599a5ed1c5Smacallan IgsPtr fPtr = IGSPTR(pScrn); 2609a5ed1c5Smacallan char *dst = fPtr->fbmem + exaGetPixmapOffset(pDst); 2619a5ed1c5Smacallan int dst_pitch = exaGetPixmapPitch(pDst); 262be1ef3d3Smacallan 2639a5ed1c5Smacallan int bpp = pDst->drawable.bitsPerPixel; 264727ce256Smacallan int cpp = (bpp + 7) >> 3; 2659a5ed1c5Smacallan int wBytes = w * cpp; 266be1ef3d3Smacallan 2679a5ed1c5Smacallan ENTER; 2689a5ed1c5Smacallan dst += (x * cpp) + (y * dst_pitch); 269be1ef3d3Smacallan 270727ce256Smacallan IgsWaitReady(fPtr); 271727ce256Smacallan 2729a5ed1c5Smacallan while (h--) { 2739a5ed1c5Smacallan memcpy(dst, src, wBytes); 2749a5ed1c5Smacallan src += src_pitch; 2759a5ed1c5Smacallan dst += dst_pitch; 2769a5ed1c5Smacallan } 2779a5ed1c5Smacallan LEAVE; 2789a5ed1c5Smacallan return TRUE; 279be1ef3d3Smacallan} 280be1ef3d3Smacallan 281be1ef3d3Smacallan/* 282be1ef3d3Smacallan * Memcpy-based DFS. 283be1ef3d3Smacallan */ 284be1ef3d3Smacallanstatic Bool 285be1ef3d3SmacallanIgsDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, 286be1ef3d3Smacallan char *dst, int dst_pitch) 287be1ef3d3Smacallan{ 2889a5ed1c5Smacallan ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum]; 2899a5ed1c5Smacallan IgsPtr fPtr = IGSPTR(pScrn); 2909a5ed1c5Smacallan char *src = fPtr->fbmem + exaGetPixmapOffset(pSrc); 2919a5ed1c5Smacallan int src_pitch = exaGetPixmapPitch(pSrc); 292be1ef3d3Smacallan 2939a5ed1c5Smacallan int bpp = pSrc->drawable.bitsPerPixel; 294727ce256Smacallan int cpp = (bpp + 7) >> 3; 2959a5ed1c5Smacallan int wBytes = w * cpp; 296be1ef3d3Smacallan 2979a5ed1c5Smacallan ENTER; 2989a5ed1c5Smacallan src += (x * cpp) + (y * src_pitch); 299be1ef3d3Smacallan 300727ce256Smacallan IgsWaitReady(fPtr); 301727ce256Smacallan 3029a5ed1c5Smacallan while (h--) { 3039a5ed1c5Smacallan memcpy(dst, src, wBytes); 3049a5ed1c5Smacallan src += src_pitch; 3059a5ed1c5Smacallan dst += dst_pitch; 3069a5ed1c5Smacallan } 3079a5ed1c5Smacallan LEAVE; 3089a5ed1c5Smacallan return TRUE; 309be1ef3d3Smacallan} 310be1ef3d3Smacallan 31183616484Smacallan#ifdef __arm__ 31283616484Smacallanstatic Bool 31383616484SmacallanIgsPrepareAccess(PixmapPtr pPix, int index) 31483616484Smacallan{ 31583616484Smacallan ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum]; 31683616484Smacallan IgsPtr fPtr = IGSPTR(pScrn); 31783616484Smacallan 31883616484Smacallan IgsWaitReady(fPtr); 31983616484Smacallan return TRUE; 32083616484Smacallan} 32183616484Smacallan 32283616484Smacallanstatic void 32383616484SmacallanIgsFinishAccess(PixmapPtr pPix, int index) 32483616484Smacallan{ 32583616484Smacallan} 32683616484Smacallan#endif 32783616484Smacallan 328be1ef3d3SmacallanBool 329be1ef3d3SmacallanIgsInitAccel(ScreenPtr pScreen) 330be1ef3d3Smacallan{ 3319a5ed1c5Smacallan ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 3329a5ed1c5Smacallan IgsPtr fPtr = IGSPTR(pScrn); 3339a5ed1c5Smacallan ExaDriverPtr pExa; 3349a5ed1c5Smacallan 3359a5ed1c5Smacallan pExa = exaDriverAlloc(); 3369a5ed1c5Smacallan if (!pExa) 3379a5ed1c5Smacallan return FALSE; 3389a5ed1c5Smacallan 3399a5ed1c5Smacallan fPtr->pExa = pExa; 3409a5ed1c5Smacallan 3419a5ed1c5Smacallan pExa->exa_major = EXA_VERSION_MAJOR; 3429a5ed1c5Smacallan pExa->exa_minor = EXA_VERSION_MINOR; 3439a5ed1c5Smacallan 3449a5ed1c5Smacallan pExa->memoryBase = fPtr->fbmem; 345be1ef3d3Smacallan pExa->memorySize = fPtr->fbmem_len; 346be1ef3d3Smacallan pExa->offScreenBase = fPtr->linebytes * fPtr->info.height; 347be1ef3d3Smacallan pExa->pixmapOffsetAlign = 4; 348be1ef3d3Smacallan pExa->pixmapPitchAlign = 4; 349be1ef3d3Smacallan 3509a5ed1c5Smacallan pExa->flags = EXA_OFFSCREEN_PIXMAPS; 351be1ef3d3Smacallan 3529a5ed1c5Smacallan pExa->maxX = 2048; 3539a5ed1c5Smacallan pExa->maxY = 2048; 354be1ef3d3Smacallan 3559a5ed1c5Smacallan pExa->WaitMarker = IgsWaitMarker; 3569a5ed1c5Smacallan pExa->PrepareSolid = IgsPrepareSolid; 3579a5ed1c5Smacallan pExa->Solid = IgsSolid; 3589a5ed1c5Smacallan pExa->DoneSolid = IgsDoneCopy; 3599a5ed1c5Smacallan pExa->PrepareCopy = IgsPrepareCopy; 3609a5ed1c5Smacallan pExa->Copy = IgsCopy; 3619a5ed1c5Smacallan pExa->DoneCopy = IgsDoneCopy; 362be1ef3d3Smacallan 363be1ef3d3Smacallan switch(fPtr->info.depth) { 364be1ef3d3Smacallan case 8: 365be1ef3d3Smacallan fPtr->shift = 0; 366727ce256Smacallan fPtr->mapfmt = IGS_COP_MAP_8BPP; 367be1ef3d3Smacallan break; 368be1ef3d3Smacallan case 16: 369be1ef3d3Smacallan fPtr->shift = 1; 370727ce256Smacallan fPtr->mapfmt = IGS_COP_MAP_16BPP; 371be1ef3d3Smacallan break; 372727ce256Smacallan case 24: 373be1ef3d3Smacallan case 32: 374be1ef3d3Smacallan fPtr->shift = 2; 375727ce256Smacallan fPtr->mapfmt = IGS_COP_MAP_32BPP; 376be1ef3d3Smacallan break; 377727ce256Smacallan default: 378727ce256Smacallan ErrorF("Unsupported depth: %d\n", fPtr->info.depth); 379be1ef3d3Smacallan } 380727ce256Smacallan IgsWrite1(fPtr, IGS_COP_MAP_FMT_REG, fPtr->mapfmt); 381727ce256Smacallan 3829a5ed1c5Smacallan /* EXA hits more optimized paths when it does not have to fallback 3839a5ed1c5Smacallan * because of missing UTS/DFS, hook memcpy-based UTS/DFS. 3849a5ed1c5Smacallan */ 3859a5ed1c5Smacallan pExa->UploadToScreen = IgsUploadToScreen; 3869a5ed1c5Smacallan pExa->DownloadFromScreen = IgsDownloadFromScreen; 38783616484Smacallan#ifdef __arm__ 38883616484Smacallan pExa->PrepareAccess = IgsPrepareAccess; 38983616484Smacallan pExa->FinishAccess = IgsFinishAccess; 39083616484Smacallan#endif 3919a5ed1c5Smacallan return exaDriverInit(pScreen, pExa); 392be1ef3d3Smacallan} 393