Debian Codegraph @

src/legacy/i810/i810_cursor.c

raw symbols SCIP
1
2 /**************************************************************************
3
4 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
5 All Rights Reserved.
6
7 Permission is hereby granted, free of charge, to any person obtaining a
8 copy of this software and associated documentation files (the
9 "Software"), to deal in the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, sub license, and/or sell copies of the Software, and to
12 permit persons to whom the Software is furnished to do so, subject to
13 the following conditions:
14
15 The above copyright notice and this permission notice (including the
16 next paragraph) shall be included in all copies or substantial portions
17 of the Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27 **************************************************************************/
28
29 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:410:9`!
30 #include "config.h"cxx . . $ `<file>/config.h`/
31 #endif
32
33 /*
34 * Authors:
35 * Keith Whitwell <[email protected]>
36 *
37 * Add ARGB HW cursor support:
38 * Alan Hourihane <[email protected]>
39 *
40 */
41
42 #include "xorg-server.h"
43 #include "xf86.h"
44 #include "xf86_OSproc.h"
45 #include "compiler.h"
46
47 #include "xf86fbman.h"
48
49 #include "i810.h"cxx . . $ `<file>/src/legacy/i810/i810.h`/
50
51 static Boolcxx . . $ Bool# I810UseHWCursorARGBcxx . . $ I810UseHWCursorARGB(2e75d4dc26c3f855).(ScreenPtrcxx . . $ ScreenPtr# pScreen, CursorPtrcxx . . $ CursorPtr# pCurs);
52 static void I810LoadCursorARGBcxx . . $ I810LoadCursorARGB(42c1441f958dee56).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn, CursorPtrcxx . . $ CursorPtr# pCurs);
53 static void I810LoadCursorImagecxx . . $ I810LoadCursorImage(5e83977386480fb7).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn, unsigned char *src);
54 static void I810ShowCursorcxx . . $ I810ShowCursor(f1d66590ec36ebe6).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn);
55 static void I810HideCursorcxx . . $ I810HideCursor(f1d66590ec36ebe6).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn);
56 static void I810SetCursorColorscxx . . $ I810SetCursorColors(48b75b380e0d3ac6).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn, int bg, int fb);
57 static void I810SetCursorPositioncxx . . $ I810SetCursorPosition(48b75b380e0d3ac6).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn, int x, int y);
58 static Boolcxx . . $ Bool# I810UseHWCursorcxx . . $ I810UseHWCursor(2e75d4dc26c3f855).(ScreenPtrcxx . . $ ScreenPtr# pScrn, CursorPtrcxx . . $ CursorPtr# pCurs);
59
60 Boolcxx . . $ Bool#
61 I810CursorInitcxx . . $ I810CursorInit(d38b7d3414297794).(ScreenPtrcxx . . $ ScreenPtr# pScreen)
62 {
63 ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn;
64 I810Ptrcxx . . $ I810Ptr# pI810;
65 xf86CursorInfoPtrcxx . . $ xf86CursorInfoPtr# infoPtr;
66
67 pScrn = xf86ScreenToScrncxx . . $ xf86ScreenToScrn(9f15ec202845c37c).(pScreen);
68 pI810 = I810PTRcxx . . $ `src/legacy/i810/i810.h:265:9`!(pScrn);
69 pI810->CursorInfoReccxx . . $ _I810Rec#CursorInfoRec. = infoPtr = xf86CreateCursorInfoReccxx . . $ xf86CreateCursorInfoRec(c703839470f3f6c5).();
70 if (!infoPtr)
71 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
72
73 infoPtr->MaxWidthcxx . . $ _xf86CursorInfoRec#MaxWidth. = 64;
74 infoPtr->MaxHeightcxx . . $ _xf86CursorInfoRec#MaxHeight. = 64;
75 infoPtr->Flagscxx . . $ _xf86CursorInfoRec#Flags. = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPPcxx . . $ `<external>/16846091375295328767/xf86Cursor.h:91:9`! |
76 HARDWARE_CURSOR_BIT_ORDER_MSBFIRSTcxx . . $ `<external>/16846091375295328767/xf86Cursor.h:92:9`! |
77 HARDWARE_CURSOR_INVERT_MASKcxx . . $ `<external>/16846091375295328767/xf86Cursor.h:82:9`! |
78 HARDWARE_CURSOR_SWAP_SOURCE_AND_MASKcxx . . $ `<external>/16846091375295328767/xf86Cursor.h:84:9`! |
79 HARDWARE_CURSOR_AND_SOURCE_WITH_MASKcxx . . $ `<external>/16846091375295328767/xf86Cursor.h:83:9`! |
80 HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64cxx . . $ `<external>/16846091375295328767/xf86Cursor.h:90:9`! | 0);
81
82 infoPtr->SetCursorColorscxx . . $ _xf86CursorInfoRec#SetCursorColors. = I810SetCursorColorscxx . . $ I810SetCursorColors(48b75b380e0d3ac6).;
83 infoPtr->SetCursorPositioncxx . . $ _xf86CursorInfoRec#SetCursorPosition. = I810SetCursorPositioncxx . . $ I810SetCursorPosition(48b75b380e0d3ac6).;
84 infoPtr->LoadCursorImagecxx . . $ _xf86CursorInfoRec#LoadCursorImage. = I810LoadCursorImagecxx . . $ I810LoadCursorImage(5e83977386480fb7).;
85 infoPtr->HideCursorcxx . . $ _xf86CursorInfoRec#HideCursor. = I810HideCursorcxx . . $ I810HideCursor(f1d66590ec36ebe6).;
86 infoPtr->ShowCursorcxx . . $ _xf86CursorInfoRec#ShowCursor. = I810ShowCursorcxx . . $ I810ShowCursor(f1d66590ec36ebe6).;
87 infoPtr->UseHWCursorcxx . . $ _xf86CursorInfoRec#UseHWCursor. = I810UseHWCursorcxx . . $ I810UseHWCursor(2e75d4dc26c3f855).;
88 #ifdef ARGB_CURSORcxx . . $ `<external>/14202178262103637588/cursor.h:58:9`!
89 pI810->CursorIsARGBcxx . . $ _I810Rec#CursorIsARGB. = FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
90
91 if (!pI810->CursorARGBPhysicalcxx . . $ _I810Rec#CursorARGBPhysical.) {
92 infoPtr->UseHWCursorARGBcxx . . $ _xf86CursorInfoRec#UseHWCursorARGB. = I810UseHWCursorARGBcxx . . $ I810UseHWCursorARGB(2e75d4dc26c3f855).;
93 infoPtr->LoadCursorARGBcxx . . $ _xf86CursorInfoRec#LoadCursorARGB. = I810LoadCursorARGBcxx . . $ I810LoadCursorARGB(42c1441f958dee56).;
94 }
95 #endif
96
97 return xf86InitCursorcxx . . $ xf86InitCursor(259b40070345681c).(pScreen, infoPtr);
98 }
99
100 #ifdef ARGB_CURSORcxx . . $ `<external>/14202178262103637588/cursor.h:58:9`!
101 #include "cursorstr.h"
102
103 static Boolcxx . . $ Bool# I810UseHWCursorARGBcxx . . $ I810UseHWCursorARGB(2e75d4dc26c3f855). (ScreenPtrcxx . . $ ScreenPtr# pScreen, CursorPtrcxx . . $ CursorPtr# pCurs)
104 {
105 ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn = xf86ScreenToScrncxx . . $ xf86ScreenToScrn(9f15ec202845c37c).(pScreen);
106 I810Ptrcxx . . $ I810Ptr# pI810 = I810PTRcxx . . $ `src/legacy/i810/i810.h:265:9`!(pScrn);
107
108 if (!pI810->CursorARGBPhysicalcxx . . $ _I810Rec#CursorARGBPhysical.)
109 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
110
111 if (pCurs->bitscxx . . $ _Cursor#bits.->heightcxx . . $ _CursorBits#height. <= 64 && pCurs->bitscxx . . $ _Cursor#bits.->widthcxx . . $ _CursorBits#width. <= 64)
112 return TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
113
114 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
115 }
116
117 static void I810LoadCursorARGBcxx . . $ I810LoadCursorARGB(42c1441f958dee56). (ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn, CursorPtrcxx . . $ CursorPtr# pCurs)
118 {
119 I810Ptrcxx . . $ I810Ptr# pI810 = I810PTRcxx . . $ `src/legacy/i810/i810.h:265:9`!(pScrn);
120 uint32_tcxx . . $ uint32_t# *pcurs = (uint32_tcxx . . $ uint32_t# *) (pI810->FbBasecxx . . $ _I810Rec#FbBase. + pI810->CursorStartcxx . . $ _I810Rec#CursorStart.);
121 uint32_tcxx . . $ uint32_t# *image = (uint32_tcxx . . $ uint32_t# *) pCurs->bitscxx . . $ _Cursor#bits.->argbcxx . . $ _CursorBits#argb.;
122 int x, y, w, h;
123
124 #ifdef ARGB_CURSORcxx . . $ `<external>/14202178262103637588/cursor.h:58:9`!
125 pI810->CursorIsARGBcxx . . $ _I810Rec#CursorIsARGB. = TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
126 #endif
127
128 w = pCurs->bitscxx . . $ _Cursor#bits.->widthcxx . . $ _CursorBits#width.;
129 h = pCurs->bitscxx . . $ _Cursor#bits.->heightcxx . . $ _CursorBits#height.;
130
131 for (y = 0; y < h; y++)
132 {
133 for (x = 0; x < w; x++)
134 *pcurs++ = *image++;
135 for (; x < 64; x++)
136 *pcurs++ = 0;
137 }
138
139 for (; y < 64; y++)
140 for (x = 0; x < 64; x++)
141 *pcurs++ = 0;
142 }
143 #endif
144
145 static Boolcxx . . $ Bool#
146 I810UseHWCursorcxx . . $ I810UseHWCursor(2e75d4dc26c3f855).(ScreenPtrcxx . . $ ScreenPtr# pScreen, CursorPtrcxx . . $ CursorPtr# pCurs)
147 {
148 ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn = xf86ScreenToScrncxx . . $ xf86ScreenToScrn(9f15ec202845c37c).(pScreen);
149 I810Ptrcxx . . $ I810Ptr# pI810 = I810PTRcxx . . $ `src/legacy/i810/i810.h:265:9`!(pScrn);
150
151 if (!pI810->CursorPhysicalcxx . . $ _I810Rec#CursorPhysical.)
152 return FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
153 else
154 return TRUEcxx . . $ `<external>/18388808314464358495/misc.h:107:9`!;
155 }
156
157 static void
158 I810LoadCursorImagecxx . . $ I810LoadCursorImage(5e83977386480fb7).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn, unsigned char *src)
159 {
160 I810Ptrcxx . . $ I810Ptr# pI810 = I810PTRcxx . . $ `src/legacy/i810/i810.h:265:9`!(pScrn);
161 uint8_tcxx . . $ uint8_t# *pcurs = (uint8_tcxx . . $ uint8_t# *) (pI810->FbBasecxx . . $ _I810Rec#FbBase. + pI810->CursorStartcxx . . $ _I810Rec#CursorStart.);
162 int x, y;
163
164 #ifdef ARGB_CURSORcxx . . $ `<external>/14202178262103637588/cursor.h:58:9`!
165 pI810->CursorIsARGBcxx . . $ _I810Rec#CursorIsARGB. = FALSEcxx . . $ `<external>/18388808314464358495/misc.h:108:9`!;
166 #endif
167
168 for (y = 0; y < 64; y++) {
169 for (x = 0; x < 64 / 4; x++) {
170 *pcurs++ = *src++;
171 }
172 }
173 }
174
175 static void
176 I810SetCursorPositioncxx . . $ I810SetCursorPosition(48b75b380e0d3ac6).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn, int x, int y)
177 {
178 I810Ptrcxx . . $ I810Ptr# pI810 = I810PTRcxx . . $ `src/legacy/i810/i810.h:265:9`!(pScrn);
179 int flag;
180
181 x += pI810->CursorOffsetcxx . . $ _I810Rec#CursorOffset.;
182
183 if (x >= 0)
184 flag = CURSOR_X_POScxx . . $ `src/legacy/i810/i810_reg.h:218:9`!;
185 else {
186 flag = CURSOR_X_NEGcxx . . $ `src/legacy/i810/i810_reg.h:219:9`!;
187 x = -x;
188 }
189
190 OUTREG8cxx . . $ `src/legacy/i810/i810_common.h:90:9`!(CURSOR_X_LOcxx . . $ `src/legacy/i810/i810_reg.h:216:9`!, x & 0xFF);
191 OUTREG8cxx . . $ `src/legacy/i810/i810_common.h:90:9`!(CURSOR_X_HIcxx . . $ `src/legacy/i810/i810_reg.h:217:9`!, (((x >> 8) & 0x07) | flag));
192
193 if (y >= 0)
194 flag = CURSOR_Y_POScxx . . $ `src/legacy/i810/i810_reg.h:222:9`!;
195 else {
196 flag = CURSOR_Y_NEGcxx . . $ `src/legacy/i810/i810_reg.h:223:9`!;
197 y = -y;
198 }
199 OUTREG8cxx . . $ `src/legacy/i810/i810_common.h:90:9`!(CURSOR_Y_LOcxx . . $ `src/legacy/i810/i810_reg.h:220:9`!, y & 0xFF);
200 OUTREG8cxx . . $ `src/legacy/i810/i810_common.h:90:9`!(CURSOR_Y_HIcxx . . $ `src/legacy/i810/i810_reg.h:221:9`!, (((y >> 8) & 0x07) | flag));
201
202 if (pI810->CursorIsARGBcxx . . $ _I810Rec#CursorIsARGB.)
203 OUTREGcxx . . $ `src/legacy/i810/i810_common.h:106:9`!(CURSOR_BASEADDRcxx . . $ `src/legacy/i810/i810_reg.h:208:9`!, pI810->CursorARGBPhysical);
204 else
205 OUTREGcxx . . $ `src/legacy/i810/i810_common.h:106:9`!(CURSOR_BASEADDRcxx . . $ `src/legacy/i810/i810_reg.h:208:9`!, pI810->CursorPhysical);
206 }
207
208 static void
209 I810ShowCursorcxx . . $ I810ShowCursor(f1d66590ec36ebe6).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn)
210 {
211 I810Ptrcxx . . $ I810Ptr# pI810 = I810PTRcxx . . $ `src/legacy/i810/i810.h:265:9`!(pScrn);
212 unsigned char tmp;
213
214 if (pI810->CursorIsARGBcxx . . $ _I810Rec#CursorIsARGB.) {
215 OUTREGcxx . . $ `src/legacy/i810/i810_common.h:106:9`!(CURSOR_BASEADDRcxx . . $ `src/legacy/i810/i810_reg.h:208:9`!, pI810->CursorARGBPhysical);
216 OUTREG8cxx . . $ `src/legacy/i810/i810_common.h:90:9`!(CURSOR_CONTROLcxx . . $ `src/legacy/i810/i810_reg.h:177:9`!, CURSOR_ORIGIN_DISPLAYcxx . . $ `src/legacy/i810/i810_reg.h:192:9`! | CURSOR_MODE_64_ARGB_AXcxx . . $ `src/legacy/i810/i810_reg.h:200:9`!);
217 } else {
218 OUTREGcxx . . $ `src/legacy/i810/i810_common.h:106:9`!(CURSOR_BASEADDRcxx . . $ `src/legacy/i810/i810_reg.h:208:9`!, pI810->CursorPhysical);
219 OUTREG8cxx . . $ `src/legacy/i810/i810_common.h:90:9`!(CURSOR_CONTROLcxx . . $ `src/legacy/i810/i810_reg.h:177:9`!, CURSOR_ORIGIN_DISPLAYcxx . . $ `src/legacy/i810/i810_reg.h:192:9`! | CURSOR_MODE_64_3Ccxx . . $ `src/legacy/i810/i810_reg.h:196:9`!);
220 }
221
222 tmp = INREG8cxx . . $ `src/legacy/i810/i810_common.h:84:9`!(PIXPIPE_CONFIG_0cxx . . $ `src/legacy/i810/i810_reg.h:142:9`!);
223 tmp |= HW_CURSOR_ENABLEcxx . . $ `src/legacy/i810/i810_reg.h:145:9`!;
224 OUTREG8cxx . . $ `src/legacy/i810/i810_common.h:90:9`!(PIXPIPE_CONFIG_0cxx . . $ `src/legacy/i810/i810_reg.h:142:9`!, tmp);
225 }
226
227 static void
228 I810HideCursorcxx . . $ I810HideCursor(f1d66590ec36ebe6).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn)
229 {
230 unsigned char tmp;
231 I810Ptrcxx . . $ I810Ptr# pI810 = I810PTRcxx . . $ `src/legacy/i810/i810.h:265:9`!(pScrn);
232
233 tmp = INREG8cxx . . $ `src/legacy/i810/i810_common.h:84:9`!(PIXPIPE_CONFIG_0cxx . . $ `src/legacy/i810/i810_reg.h:142:9`!);
234 tmp &= ~HW_CURSOR_ENABLEcxx . . $ `src/legacy/i810/i810_reg.h:145:9`!;
235 OUTREG8cxx . . $ `src/legacy/i810/i810_common.h:90:9`!(PIXPIPE_CONFIG_0cxx . . $ `src/legacy/i810/i810_reg.h:142:9`!, tmp);
236 }
237
238 static void
239 I810SetCursorColorscxx . . $ I810SetCursorColors(48b75b380e0d3ac6).(ScrnInfoPtrcxx . . $ ScrnInfoPtr# pScrn, int bg, int fg)
240 {
241 int tmp;
242 I810Ptrcxx . . $ I810Ptr# pI810 = I810PTRcxx . . $ `src/legacy/i810/i810.h:265:9`!(pScrn);
243 vgaHWPtrcxx . . $ vgaHWPtr# hwp;
244
245 #ifdef ARGB_CURSORcxx . . $ `<external>/14202178262103637588/cursor.h:58:9`!
246 if (pI810->CursorIsARGBcxx . . $ _I810Rec#CursorIsARGB.)
247 return;
248 #endif
249
250 hwp = VGAHWPTRcxx . . $ `<external>/16318509353989860240/vgaHW.h:34:9`!(pScrn);
251
252 tmp = INREG8cxx . . $ `src/legacy/i810/i810_common.h:84:9`!(PIXPIPE_CONFIG_0cxx . . $ `src/legacy/i810/i810_reg.h:142:9`!);
253 tmp |= EXTENDED_PALETTEcxx . . $ `src/legacy/i810/i810_reg.h:146:9`!;
254 OUTREG8cxx . . $ `src/legacy/i810/i810_common.h:90:9`!(PIXPIPE_CONFIG_0cxx . . $ `src/legacy/i810/i810_reg.h:142:9`!, tmp);
255
256 hwp->writeDacMaskcxx . . $ _vgaHWRec#writeDacMask.(hwp, 0xFF);
257 hwp->writeDacWriteAddrcxx . . $ _vgaHWRec#writeDacWriteAddr.(hwp, 0x04);
258
259 hwp->writeDacDatacxx . . $ _vgaHWRec#writeDacData.(hwp, (bg & 0x00FF0000) >> 16);
260 hwp->writeDacDatacxx . . $ _vgaHWRec#writeDacData.(hwp, (bg & 0x0000FF00) >> 8);
261 hwp->writeDacDatacxx . . $ _vgaHWRec#writeDacData.(hwp, (bg & 0x000000FF));
262
263 hwp->writeDacDatacxx . . $ _vgaHWRec#writeDacData.(hwp, (fg & 0x00FF0000) >> 16);
264 hwp->writeDacDatacxx . . $ _vgaHWRec#writeDacData.(hwp, (fg & 0x0000FF00) >> 8);
265 hwp->writeDacDatacxx . . $ _vgaHWRec#writeDacData.(hwp, (fg & 0x000000FF));
266
267 tmp = INREG8cxx . . $ `src/legacy/i810/i810_common.h:84:9`!(PIXPIPE_CONFIG_0cxx . . $ `src/legacy/i810/i810_reg.h:142:9`!);
268 tmp &= ~EXTENDED_PALETTEcxx . . $ `src/legacy/i810/i810_reg.h:146:9`!;
269 OUTREG8cxx . . $ `src/legacy/i810/i810_common.h:90:9`!(PIXPIPE_CONFIG_0cxx . . $ `src/legacy/i810/i810_reg.h:142:9`!, tmp);
270 }