Subversion Repositories Kolibri OS

Rev

Rev 812 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
813 serge 1
 
808 serge 2
#include "rhd_regs.h"
3
4
 
813 serge 5
#define IS_R500_3D   1
6
7
 
8
9
 
808 serge 10
    RHD_UNKNOWN = 0,
11
    RHD_R300,
812 serge 12
    RHD_R350,
13
    RHD_RV350,
14
    RHD_RV370,
15
    RHD_RV380,
16
    /* R500 */
808 serge 17
    RHD_RV505,
18
    RHD_RV515,
19
    RHD_RV516,
20
    RHD_R520,
21
    RHD_RV530,
22
    RHD_RV535,
23
    RHD_RV550,
24
    RHD_RV560,
25
    RHD_RV570,
26
    RHD_R580,
27
    /* R500 Mobility */
28
    RHD_M52,
29
    RHD_M54,
30
    RHD_M56,
31
    RHD_M58,
32
    RHD_M62,
33
    RHD_M64,
34
    RHD_M66,
35
    RHD_M68,
36
    RHD_M71,
37
    /* R500 integrated */
38
    RHD_RS600,
39
    RHD_RS690,
40
    RHD_RS740,
41
    /* R600 */
42
    RHD_R600,
43
    RHD_RV610,
44
    RHD_RV630,
45
    /* R600 Mobility */
46
    RHD_M72,
47
    RHD_M74,
48
    RHD_M76,
49
    /* RV670 came into existence after RV6x0 and M7x */
50
    RHD_RV670,
51
    RHD_R680,
52
    RHD_RV620,
53
    RHD_M82,
54
    RHD_RV635,
55
    RHD_M86,
56
    RHD_RS780,
812 serge 57
    RHD_CHIP_END
808 serge 58
};
59
60
 
61
    RHD_FAMILY_UNKNOWN = 0,
62
812 serge 63
 
64
65
 
66
    RHD_FAMILY_RS100,    /* U1 (IGP320M) or A3 (IGP320)*/
67
    RHD_FAMILY_RV200,
68
    RHD_FAMILY_RS200,    /* U2 (IGP330M/340M/350M) or A4 (IGP330/340/345/350), RS250 (IGP 7000) */
69
    RHD_FAMILY_R200,
70
    RHD_FAMILY_RV250,
71
    RHD_FAMILY_RS300,    /* RS300/RS350 */
72
    RHD_FAMILY_RV280,
73
74
 
75
    RHD_FAMILY_R350,
76
    RHD_FAMILY_RV350,
77
    RHD_FAMILY_RV380,    /* RV370/RV380/M22/M24 */
78
    RHD_FAMILY_R420,     /* R420/R423/M18 */
79
    RHD_FAMILY_RV410,    /* RV410, M26 */
80
    RHD_FAMILY_RS400,    /* xpress 200, 200m (RS400) Intel */
81
    RHD_FAMILY_RS480,    /* xpress 200, 200m (RS410/480/482/485) AMD */
82
83
 
808 serge 84
    RHD_FAMILY_R520,
85
    RHD_FAMILY_RV530,
86
    RHD_FAMILY_RV560,
87
    RHD_FAMILY_RV570,
88
    RHD_FAMILY_R580,
89
    RHD_FAMILY_RS690,
90
    RHD_FAMILY_R600,
91
    RHD_FAMILY_RV610,
92
    RHD_FAMILY_RV630,
93
    RHD_FAMILY_RV670,
94
    RHD_FAMILY_RV620,
95
    RHD_FAMILY_RV635,
812 serge 96
    RHD_FAMILY_RS780
97
};
808 serge 98
99
 
100
#define RHD_MMIO_BAR       2
101
102
 
103
#define RHD_MEM_FB         2
104
105
 
106
{
107
  CARD32            MMIOBase;
108
  CARD32            MMIOMapSize;
109
  CARD32            videoRam;
110
111
 
112
  CARD32            PhisBase;
113
  CARD32            FbIntAddress;      /* card internal address of FB */
114
  CARD32            FbMapSize;
115
116
 
117
  CARD32            FbFreeSize;
118
119
 
120
  unsigned int      FbScanoutStart;
121
  unsigned int      FbScanoutSize;
122
123
 
124
  enum RHD_FAMILIES ChipFamily;
812 serge 125
126
 
808 serge 127
128
 
129
130
 
131
  CARD32            devfn;
132
133
 
134
  CARD16            PciDeviceID;
135
136
 
137
  CARD16            subdevice_id;
138
139
 
140
  CARD32            ioBase[6];
141
  CARD32            memtype[6];
142
  CARD32            memsize[6];
143
144
 
145
  struct mem_block  *gart_heap;
146
147
 
148
  CARD32            displayHeight;
149
150
 
151
  CARD32            __ymin;
152
  CARD32            __xmax;
153
  CARD32            __ymax;
154
155
 
156
  CARD32            dst_pitch_offset;
157
  CARD32            surface_cntl;
158
159
 
160
  u32               ring_rp;
161
  u32               ring_wp;
162
163
 
811 serge 164
  Bool              has_tcl;
165
}RHD_t, *RHDPtr;
808 serge 166
167
 
168
169
 
170
{
171
  int xmin;
172
  int ymin;
173
  int xmax;
174
  int ymax;
175
}clip_t, *PTRclip;
176
177
 
178
    int			token;		/* id of the token */
179
    const char *	name;		/* token name */
180
} SymTabRec, *SymTabPtr;
181
182
 
813 serge 183
 
184
 
185
OUTREG8(CARD16 offset, u8 value)
186
{
187
  *(volatile CARD8 *)((CARD8 *)(rhd.MMIOBase + offset)) = value;
188
}
189
190
 
191
 
808 serge 192
{
193
  return *(volatile CARD32 *)((CARD8*)(rhd.MMIOBase + offset));
194
}
195
196
 
197
198
 
199
OUTREG(CARD16 offset, CARD32 value)
200
{
201
  *(volatile CARD32 *)((CARD8 *)(rhd.MMIOBase + offset)) = value;
202
}
203
204
 
205
{
206
  return *(volatile CARD32 *)((CARD8*)(rhdPtr->MMIOBase + offset));
207
}
208
209
 
210
MASKREG(CARD16 offset, CARD32 value, CARD32 mask)
211
{
212
  CARD32 tmp;
213
214
 
215
  tmp &= ~mask;
216
  tmp |= (value & mask);
217
  OUTREG(offset, tmp);
218
};
219
220
 
221
_RHDRegWrite(RHDPtr rhdPtr, CARD16 offset, CARD32 value)
222
{
223
  *(volatile CARD32 *)((CARD8 *)(rhdPtr->MMIOBase + offset)) = value;
224
}
225
226
 
227
_RHDRegMask(RHDPtr rhdPtr, CARD16 offset, CARD32 value, CARD32 mask)
228
{
229
  CARD32 tmp;
230
231
 
232
  tmp &= ~mask;
233
  tmp |= (value & mask);
234
  _RHDRegWrite(rhdPtr, offset, tmp);
235
};
236
237
 
238
239
 
240
#define RHDRegWrite(ptr, offset, value) _RHDRegWrite((ptr)->rhdPtr, (offset), (value))
241
#define RHDRegMask(ptr, offset, value, mask) _RHDRegMask((ptr)->rhdPtr, (offset), (value), (mask))
242
243
 
244
 
245
246
 
247
int rhdInitHeap(RHDPtr rhdPtr);
248
249
 
250
251
 
252
//  #define DBG(x)
253
254
 
255
typedef struct s_cursor
256
{
257
   u32   magic;                           // 'CURS'
258
   void  (*destroy)(struct s_cursor*);    // destructor
259
   u32   fd;                              // next object in list
260
   u32   bk;                              // prev object in list
261
   u32   pid;                             // owner id
262
263
 
264
   u32   hot_x;                           // hotspot coords
265
   u32   hot_y;
266
}cursor_t;
267
#pragma pack (pop)
268
269
 
270
#define LOAD_FROM_MEM    1
271
#define LOAD_INDIRECT    2
272
273
 
274
void __stdcall copy_cursor(void *img, void *src);
275
void destroy_cursor(cursor_t *cursor);
276
void __destroy_cursor(cursor_t *cursor);                // wrap
277
278
 
279
void __stdcall r500_SetCursor(cursor_t *cursor, int x, int y);
280
void __stdcall r500_CursorRestore(int x, int y);
281
282
 
283
813 serge 284
 
285
 
286
    u32_t x ;
287
    u32_t y ;
288
} xPointFixed;
289
290
 
291
292
 
293
294
 
295
296
 
297
#define IntToxFixed(i)  ((xFixed) (i) << XFIXED_BITS)
298
299
 
300
301
 
302
					 ((type) << 16) | \
303
					 ((a) << 12) | \
304
					 ((r) << 8) | \
305
					 ((g) << 4) | \
306
					 ((b)))
307
308
 
309
#define PICT_FORMAT_RGB(f)  (((f)      ) & 0xfff)
310
311
 
312
#define PICT_TYPE_A     1
313
#define PICT_TYPE_ARGB	2
314
#define PICT_TYPE_ABGR	3
315
#define PICT_TYPE_COLOR	4
316
#define PICT_TYPE_GRAY	5
317
318
 
319
   PICT_a8r8g8b8 =	PICT_FORMAT(32,PICT_TYPE_ARGB,8,8,8,8),
320
   PICT_x8r8g8b8 =	PICT_FORMAT(32,PICT_TYPE_ARGB,0,8,8,8),
321
   PICT_a8b8g8r8 =	PICT_FORMAT(32,PICT_TYPE_ABGR,8,8,8,8),
322
   PICT_x8b8g8r8 =	PICT_FORMAT(32,PICT_TYPE_ABGR,0,8,8,8),
323
324
 
325
   PICT_r8g8b8 =	PICT_FORMAT(24,PICT_TYPE_ARGB,0,8,8,8),
326
   PICT_b8g8r8 =	PICT_FORMAT(24,PICT_TYPE_ABGR,0,8,8,8),
327
328
 
329
   PICT_r5g6b5 =	PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,6,5),
330
   PICT_b5g6r5 =	PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,6,5),
331
332
 
333
   PICT_x1r5g5b5 =	PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,5,5),
334
   PICT_a1b5g5r5 =	PICT_FORMAT(16,PICT_TYPE_ABGR,1,5,5,5),
335
   PICT_x1b5g5r5 =	PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,5,5),
336
   PICT_a4r4g4b4 =	PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4),
337
   PICT_x4r4g4b4 =	PICT_FORMAT(16,PICT_TYPE_ARGB,0,4,4,4),
338
   PICT_a4b4g4r4 =	PICT_FORMAT(16,PICT_TYPE_ABGR,4,4,4,4),
339
   PICT_x4b4g4r4 =	PICT_FORMAT(16,PICT_TYPE_ABGR,0,4,4,4),
340
341
 
342
   PICT_a8 =		PICT_FORMAT(8,PICT_TYPE_A,8,0,0,0),
343
   PICT_r3g3b2 =	PICT_FORMAT(8,PICT_TYPE_ARGB,0,3,3,2),
344
   PICT_b2g3r3 =	PICT_FORMAT(8,PICT_TYPE_ABGR,0,3,3,2),
345
   PICT_a2r2g2b2 =	PICT_FORMAT(8,PICT_TYPE_ARGB,2,2,2,2),
346
   PICT_a2b2g2r2 =	PICT_FORMAT(8,PICT_TYPE_ABGR,2,2,2,2),
347
348
 
349
   PICT_g8 =		PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0),
350
351
 
352
353
 
354
   PICT_x4g4 =		PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0),
355
356
 
357
   PICT_a4 =		PICT_FORMAT(4,PICT_TYPE_A,4,0,0,0),
358
   PICT_r1g2b1 =	PICT_FORMAT(4,PICT_TYPE_ARGB,0,1,2,1),
359
   PICT_b1g2r1 =	PICT_FORMAT(4,PICT_TYPE_ABGR,0,1,2,1),
360
   PICT_a1r1g1b1 =	PICT_FORMAT(4,PICT_TYPE_ARGB,1,1,1,1),
361
   PICT_a1b1g1r1 =	PICT_FORMAT(4,PICT_TYPE_ABGR,1,1,1,1),
362
363
 
364
   PICT_g4 =		PICT_FORMAT(4,PICT_TYPE_GRAY,0,0,0,0),
365
366
 
367
   PICT_a1 =		PICT_FORMAT(1,PICT_TYPE_A,1,0,0,0),
368
369
 
370
} PictFormatShort;
371