1 /* 2 Copyright 1999, Be Incorporated. All Rights Reserved. 3 This file may be used under the terms of the Be Sample Code License. 4 5 Other authors: 6 Rudolf Cornelissen 9/2003-1/2005. 7 */ 8 9 /* 10 note: 11 attempting DMA on NV40 and higher because without it I can't get it going ATM. 12 Later on this can become a nv.settings switch, and maybe later we can even 13 forget about non-DMA completely (depends on 3D acceleration attempts). 14 */ 15 16 #define MODULE_BIT 0x40000000 17 18 #include "acc_std.h" 19 20 void SCREEN_TO_SCREEN_BLIT(engine_token *et, blit_params *list, uint32 count) 21 { 22 int i; 23 24 if(si->ps.card_arch < NV40A) 25 { 26 /* init acc engine for blit function */ 27 nv_acc_setup_blit(); 28 29 /* do each blit */ 30 i=0; 31 while (count--) 32 { 33 nv_acc_blit 34 ( 35 list[i].src_left, 36 list[i].src_top, 37 list[i].dest_left, 38 list[i].dest_top, 39 list[i].width, 40 list[i].height 41 ); 42 i++; 43 } 44 } 45 else 46 { 47 /* init acc engine for blit function */ 48 nv_acc_setup_blit_dma(); 49 50 /* do each blit */ 51 i=0; 52 while (count--) 53 { 54 nv_acc_blit_dma 55 ( 56 list[i].src_left, 57 list[i].src_top, 58 list[i].dest_left, 59 list[i].dest_top, 60 list[i].width, 61 list[i].height 62 ); 63 i++; 64 } 65 } 66 } 67 68 void SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT(engine_token *et, scaled_blit_params *list, uint32 count) 69 { 70 int i; 71 72 /* do each blit */ 73 i=0; 74 while (count--) 75 { 76 nv_acc_video_blit 77 ( 78 list[i].src_left, 79 list[i].src_top, 80 list[i].src_width, 81 list[i].src_height, 82 list[i].dest_left, 83 list[i].dest_top, 84 list[i].dest_width, 85 list[i].dest_height 86 ); 87 i++; 88 } 89 } 90 91 void SCREEN_TO_SCREEN_TRANSPARENT_BLIT(engine_token *et, uint32 transparent_colour, blit_params *list, uint32 count) 92 { 93 int i; 94 95 /* do each blit */ 96 i=0; 97 while (count--) 98 { 99 nv_acc_transparent_blit 100 ( 101 list[i].src_left, 102 list[i].src_top, 103 list[i].dest_left, 104 list[i].dest_top, 105 list[i].width, 106 list[i].height, 107 transparent_colour 108 ); 109 i++; 110 } 111 } 112 113 void FILL_RECTANGLE(engine_token *et, uint32 colorIndex, fill_rect_params *list, uint32 count) 114 { 115 int i; 116 117 if(si->ps.card_arch < NV40A) 118 { 119 /* init acc engine for fill function */ 120 nv_acc_setup_rectangle(colorIndex); 121 122 /* draw each rectangle */ 123 i=0; 124 while (count--) 125 { 126 nv_acc_rectangle 127 ( 128 list[i].left, 129 (list[i].right)+1, 130 list[i].top, 131 (list[i].bottom-list[i].top)+1 132 ); 133 i++; 134 } 135 } 136 else 137 { 138 /* init acc engine for fill function */ 139 nv_acc_setup_rectangle_dma(colorIndex); 140 141 /* draw each rectangle */ 142 i=0; 143 while (count--) 144 { 145 nv_acc_rectangle_dma 146 ( 147 list[i].left, 148 (list[i].right)+1, 149 list[i].top, 150 (list[i].bottom-list[i].top)+1 151 ); 152 i++; 153 } 154 } 155 } 156 157 void INVERT_RECTANGLE(engine_token *et, fill_rect_params *list, uint32 count) 158 { 159 int i; 160 161 if(si->ps.card_arch < NV40A) 162 { 163 /* init acc engine for invert function */ 164 nv_acc_setup_rect_invert(); 165 166 /* invert each rectangle */ 167 i=0; 168 while (count--) 169 { 170 nv_acc_rectangle_invert 171 ( 172 list[i].left, 173 (list[i].right)+1, 174 list[i].top, 175 (list[i].bottom-list[i].top)+1 176 ); 177 i++; 178 } 179 } 180 else 181 { 182 /* init acc engine for invert function */ 183 nv_acc_setup_rect_invert_dma(); 184 185 /* invert each rectangle */ 186 i=0; 187 while (count--) 188 { 189 nv_acc_rectangle_invert_dma 190 ( 191 list[i].left, 192 (list[i].right)+1, 193 list[i].top, 194 (list[i].bottom-list[i].top)+1 195 ); 196 i++; 197 } 198 } 199 } 200 201 void FILL_SPAN(engine_token *et, uint32 colorIndex, uint16 *list, uint32 count) 202 { 203 int i; 204 205 if(si->ps.card_arch < NV40A) 206 { 207 /* init acc engine for fill function */ 208 nv_acc_setup_rectangle(colorIndex); 209 210 /* draw each span */ 211 i=0; 212 while (count--) 213 { 214 nv_acc_rectangle 215 ( 216 list[i+1], 217 list[i+2]+1, 218 list[i], 219 1 220 ); 221 i+=3; 222 } 223 } 224 else 225 { 226 /* init acc engine for fill function */ 227 nv_acc_setup_rectangle_dma(colorIndex); 228 229 /* draw each span */ 230 i=0; 231 while (count--) 232 { 233 nv_acc_rectangle_dma 234 ( 235 list[i+1], 236 list[i+2]+1, 237 list[i], 238 1 239 ); 240 i+=3; 241 } 242 } 243 } 244