| 1 | /* |
| 2 | * Copyright © 1998 Keith Packard |
| 3 | * Copyright © 2012 Intel Corporation |
| 4 | * |
| 5 | * Permission to use, copy, modify, distribute, and sell this software and its |
| 6 | * documentation for any purpose is hereby granted without fee, provided that |
| 7 | * the above copyright notice appear in all copies and that both that |
| 8 | * copyright notice and this permission notice appear in supporting |
| 9 | * documentation, and that the name of Keith Packard not be used in |
| 10 | * advertising or publicity pertaining to distribution of the software without |
| 11 | * specific, written prior permission. Keith Packard makes no |
| 12 | * representations about the suitability of this software for any purpose. It |
| 13 | * is provided "as is" without express or implied warranty. |
| 14 | * |
| 15 | * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
| 17 | * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
| 18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
| 19 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 20 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 21 | * PERFORMANCE OF THIS SOFTWARE. |
| 22 | */ |
| 23 | |
| 24 | #include "fb.h"cxx . . $ `<file>/src/sna/fb/fb.h`/ |
| 25 | |
| 26 | /* |
| 27 | * Accelerated tile fill -- tile width is a power of two not greater |
| 28 | * than FB_UNIT |
| 29 | */ |
| 30 | |
| 31 | static void |
| 32 | fbEvenTilecxx . . $ fbEvenTile(c6eed7bd6f904618).(FbBitscxx . . $ FbBits# *dst, FbStridecxx . . $ FbStride# dstStride, int dstX, int width, int height, |
| 33 | FbBitscxx . . $ FbBits# *tile, FbStridecxx . . $ FbStride# tileStride, int tileHeight, |
| 34 | int alu, FbBitscxx . . $ FbBits# pm, |
| 35 | int xRot, int yRot) |
| 36 | { |
| 37 | FbBitscxx . . $ FbBits# *t, *tileEnd, bits; |
| 38 | FbBitscxx . . $ FbBits# startmask, endmask; |
| 39 | FbBitscxx . . $ FbBits# and, xor; |
| 40 | int n, nmiddle; |
| 41 | int tileX, tileY; |
| 42 | int rot; |
| 43 | int startbyte, endbyte; |
| 44 | |
| 45 | dst += dstX >> FB_SHIFTcxx . . $ `src/sna/fb/fb.h:49:9`!; |
| 46 | dstX &= FB_MASKcxx . . $ `src/sna/fb/fb.h:53:9`!; |
| 47 | FbMaskBitsBytescxx . . $ `src/sna/fb/fb.h:139:9`!(dstX, width, FbDestInvarientRopcxx . . $ `src/sna/fb/fbrop.h:27:9`!(alu, pm), |
| 48 | startmask, startbyte, nmiddle, endmask, endbyte); |
| 49 | if (startmask) |
| 50 | dstStride--; |
| 51 | dstStride -= nmiddle; |
| 52 | |
| 53 | /* |
| 54 | * Compute tile start scanline and rotation parameters |
| 55 | */ |
| 56 | tileEnd = tile + tileHeight * tileStride; |
| 57 | moduluscxx . . $ `<external>/18388808314464358495/misc.h:144:9`!(-yRot, tileHeight, tileY); |
| 58 | t = tile + tileY * tileStride; |
| 59 | moduluscxx . . $ `<external>/18388808314464358495/misc.h:144:9`!(-xRot, FB_UNITcxx . . $ `src/sna/fb/fb.h:51:9`!, tileX); |
| 60 | rot = tileX; |
| 61 | |
| 62 | while (height--) { |
| 63 | /* |
| 64 | * Pick up bits for this scanline |
| 65 | */ |
| 66 | bits = READcxx . . $ `src/sna/fb/fb.h:43:9`!(t); |
| 67 | t += tileStride; |
| 68 | if (t >= tileEnd) |
| 69 | t = tile; |
| 70 | bits = FbRotLeftcxx . . $ `src/sna/fb/fb.h:90:9`!(bits, rot); |
| 71 | and = fbAndcxx . . $ `src/sna/fb/fbrop.h:71:9`!(alu, bits, pm); |
| 72 | xor = fbXorcxx . . $ `src/sna/fb/fbrop.h:69:9`!(alu, bits, pm); |
| 73 | |
| 74 | if (startmask) { |
| 75 | FbDoLeftMaskByteRRopcxx . . $ `src/sna/fb/fb.h:179:9`!(dst, startbyte, startmask, and, xor); |
| 76 | dst++; |
| 77 | } |
| 78 | n = nmiddle; |
| 79 | if (!and) |
| 80 | while (n--) |
| 81 | WRITEcxx . . $ `src/sna/fb/fb.h:42:9`!(dst++, xor); |
| 82 | else |
| 83 | while (n--) { |
| 84 | WRITEcxx . . $ `src/sna/fb/fb.h:42:9`!(dst, FbDoRRopcxx . . $ `src/sna/fb/fbrop.h:52:9`!(READcxx . . $ `src/sna/fb/fb.h:43:9`!(dst), and, xor)); |
| 85 | dst++; |
| 86 | } |
| 87 | if (endmask) |
| 88 | FbDoRightMaskByteRRopcxx . . $ `src/sna/fb/fb.h:207:9`!(dst, endbyte, endmask, and, xor); |
| 89 | dst += dstStride; |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | static void |
| 94 | fbOddTilecxx . . $ fbOddTile(9bfd7bd18a7d1ce2).(FbBitscxx . . $ FbBits# *dst, FbStridecxx . . $ FbStride# dstStride, int dstX, |
| 95 | int width, int height, |
| 96 | FbBitscxx . . $ FbBits# *tile, FbStridecxx . . $ FbStride# tileStride, |
| 97 | int tileWidth, int tileHeight, |
| 98 | int alu, FbBitscxx . . $ FbBits# pm, int bpp, |
| 99 | int xRot, int yRot) |
| 100 | { |
| 101 | int tileX, tileY; |
| 102 | int x, y; |
| 103 | |
| 104 | DBGcxx . . $ `src/sna/debug.h:35:9`!(("%s tile=%dx%d, size=%dx%d\n", __FUNCTION__, |
| 105 | tileWidth, tileHeight, width, height)); |
| 106 | |
| 107 | moduluscxx . . $ `<external>/18388808314464358495/misc.h:144:9`!(-yRot, tileHeight, tileY); |
| 108 | y = 0; |
| 109 | while (height) { |
| 110 | int ww = width; |
| 111 | int h = tileHeight - tileY; |
| 112 | if (h > height) |
| 113 | h = height; |
| 114 | height -= h; |
| 115 | x = dstX; |
| 116 | moduluscxx . . $ `<external>/18388808314464358495/misc.h:144:9`!(dstX - xRot, tileWidth, tileX); |
| 117 | while (ww) { |
| 118 | int w = tileWidth - tileX; |
| 119 | if (w > ww) |
| 120 | w = ww; |
| 121 | ww -= w; |
| 122 | fbBltcxx . . $ `src/sna/fb/sfb.h:3:9`!(tile + tileY * tileStride, tileStride, tileX, |
| 123 | dst + y * dstStride, dstStride, |
| 124 | x, w, h, alu, pm, bpp, FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!, FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!); |
| 125 | x += w; |
| 126 | tileX = 0; |
| 127 | } |
| 128 | y += h; |
| 129 | tileY = 0; |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | void |
| 134 | fbTilecxx . . $ `src/sna/fb/sfb.h:35:9`!(FbBitscxx . . $ FbBits# *dst, FbStridecxx . . $ FbStride# dstStride, int dstX, |
| 135 | int width, int height, |
| 136 | FbBitscxx . . $ FbBits# *tile, FbStridecxx . . $ FbStride# tileStride, |
| 137 | int tileWidth, int tileHeight, |
| 138 | int alu, FbBitscxx . . $ FbBits# pm, int bpp, |
| 139 | int xRot, int yRot) |
| 140 | { |
| 141 | DBGcxx . . $ `src/sna/debug.h:35:9`!(("%s tile=%dx%d, size=%dx%d\n", __FUNCTION__, |
| 142 | tileWidth, tileHeight, width, height)); |
| 143 | |
| 144 | if (FbEvenTilecxx . . $ `src/sna/fb/fb.h:375:9`!(tileWidth)) |
| 145 | fbEvenTilecxx . . $ fbEvenTile(c6eed7bd6f904618).(dst, dstStride, dstX, width, height, |
| 146 | tile, tileStride, tileHeight, alu, pm, xRot, yRot); |
| 147 | else |
| 148 | fbOddTilecxx . . $ fbOddTile(9bfd7bd18a7d1ce2).(dst, dstStride, dstX, width, height, |
| 149 | tile, tileStride, tileWidth, tileHeight, |
| 150 | alu, pm, bpp, xRot, yRot); |
| 151 | } |