vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / accelerants / nvidia / Acceleration.c
blob893de5150c1910c1e309c0f2502087a7d36710cd
1 /*
2 Copyright 1999, Be Incorporated. All Rights Reserved.
3 This file may be used under the terms of the Be Sample Code License.
5 Other authors:
6 Rudolf Cornelissen 9/2003-2/2005.
7 */
9 /*
10 note:
11 moved DMA acceleration 'top-level' routines to be integrated in the engine:
12 it is costly to call the engine for every single function within a loop!
13 (measured with BeRoMeter 1.2.6: upto 15% speed increase on all CPU's.)
14 Leaving PIO acceleration as it is for now, for the purpose of benchmarking :-)
16 note also:
17 attempting DMA on NV40 and higher because without it I can't get them going ATM.
18 Maybe later we can forget about PIO mode acceleration totally (depends on 3D
19 acceleration attempts).
22 #define MODULE_BIT 0x40000000
24 #include "acc_std.h"
26 void SCREEN_TO_SCREEN_BLIT_PIO(engine_token *et, blit_params *list, uint32 count)
28 int i;
30 /* init acc engine for blit function */
31 nv_acc_setup_blit();
33 /* do each blit */
34 i=0;
35 while (count--)
37 nv_acc_blit
39 list[i].src_left,
40 list[i].src_top,
41 list[i].dest_left,
42 list[i].dest_top,
43 list[i].width,
44 list[i].height
46 i++;
50 void SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT_PIO(engine_token *et, scaled_blit_params *list, uint32 count)
52 int i;
54 /* do each blit */
55 i=0;
56 while (count--)
58 nv_acc_video_blit
60 list[i].src_left,
61 list[i].src_top,
62 list[i].src_width,
63 list[i].src_height,
64 list[i].dest_left,
65 list[i].dest_top,
66 list[i].dest_width,
67 list[i].dest_height
69 i++;
73 void SCREEN_TO_SCREEN_TRANSPARENT_BLIT_PIO(engine_token *et, uint32 transparent_colour, blit_params *list, uint32 count)
75 int i;
77 /* do each blit */
78 i=0;
79 while (count--)
81 nv_acc_transparent_blit
83 list[i].src_left,
84 list[i].src_top,
85 list[i].dest_left,
86 list[i].dest_top,
87 list[i].width,
88 list[i].height,
89 transparent_colour
91 i++;
95 void FILL_RECTANGLE_PIO(engine_token *et, uint32 colorIndex, fill_rect_params *list, uint32 count)
97 int i;
99 /* init acc engine for fill function */
100 nv_acc_setup_rectangle(colorIndex);
102 /* draw each rectangle */
103 i=0;
104 while (count--)
106 nv_acc_rectangle
108 list[i].left,
109 (list[i].right)+1,
110 list[i].top,
111 (list[i].bottom-list[i].top)+1
113 i++;
117 void INVERT_RECTANGLE_PIO(engine_token *et, fill_rect_params *list, uint32 count)
119 int i;
121 /* init acc engine for invert function */
122 nv_acc_setup_rect_invert();
124 /* invert each rectangle */
125 i=0;
126 while (count--)
128 nv_acc_rectangle_invert
130 list[i].left,
131 (list[i].right)+1,
132 list[i].top,
133 (list[i].bottom-list[i].top)+1
135 i++;
139 void FILL_SPAN_PIO(engine_token *et, uint32 colorIndex, uint16 *list, uint32 count)
141 int i;
143 /* init acc engine for fill function */
144 nv_acc_setup_rectangle(colorIndex);
146 /* draw each span */
147 i=0;
148 while (count--)
150 nv_acc_rectangle
152 list[i+1],
153 list[i+2]+1,
154 list[i],
157 i+=3;