Subversion Repositories Kolibri OS

Rev

Rev 813 | 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
 
815 serge 178
 
179
{
180
  u32_t width;
181
  u32_t height;
182
  u32_t format;
183
  u32_t pitch;
184
  u32_t offset;
185
  u32_t pitch_offset;
186
  u32_t *raw;
187
}pixmap_t;
188
189
 
190
 
808 serge 191
    int			token;		/* id of the token */
192
    const char *	name;		/* token name */
193
} SymTabRec, *SymTabPtr;
194
195
 
813 serge 196
 
197
 
198
OUTREG8(CARD16 offset, u8 value)
199
{
200
  *(volatile CARD8 *)((CARD8 *)(rhd.MMIOBase + offset)) = value;
201
}
202
203
 
204
 
808 serge 205
{
206
  return *(volatile CARD32 *)((CARD8*)(rhd.MMIOBase + offset));
207
}
208
209
 
210
211
 
212
OUTREG(CARD16 offset, CARD32 value)
213
{
214
  *(volatile CARD32 *)((CARD8 *)(rhd.MMIOBase + offset)) = value;
215
}
216
217
 
218
{
219
  return *(volatile CARD32 *)((CARD8*)(rhdPtr->MMIOBase + offset));
220
}
221
222
 
223
MASKREG(CARD16 offset, CARD32 value, CARD32 mask)
224
{
225
  CARD32 tmp;
226
227
 
228
  tmp &= ~mask;
229
  tmp |= (value & mask);
230
  OUTREG(offset, tmp);
231
};
232
233
 
234
_RHDRegWrite(RHDPtr rhdPtr, CARD16 offset, CARD32 value)
235
{
236
  *(volatile CARD32 *)((CARD8 *)(rhdPtr->MMIOBase + offset)) = value;
237
}
238
239
 
240
_RHDRegMask(RHDPtr rhdPtr, CARD16 offset, CARD32 value, CARD32 mask)
241
{
242
  CARD32 tmp;
243
244
 
245
  tmp &= ~mask;
246
  tmp |= (value & mask);
247
  _RHDRegWrite(rhdPtr, offset, tmp);
248
};
249
250
 
251
252
 
253
#define RHDRegWrite(ptr, offset, value) _RHDRegWrite((ptr)->rhdPtr, (offset), (value))
254
#define RHDRegMask(ptr, offset, value, mask) _RHDRegMask((ptr)->rhdPtr, (offset), (value), (mask))
255
256
 
257
 
258
259
 
260
int rhdInitHeap(RHDPtr rhdPtr);
261
262
 
263
264
 
265
//  #define DBG(x)
266
267
 
268
typedef struct s_cursor
269
{
270
   u32   magic;                           // 'CURS'
271
   void  (*destroy)(struct s_cursor*);    // destructor
272
   u32   fd;                              // next object in list
273
   u32   bk;                              // prev object in list
274
   u32   pid;                             // owner id
275
276
 
277
   u32   hot_x;                           // hotspot coords
278
   u32   hot_y;
279
}cursor_t;
280
#pragma pack (pop)
281
282
 
283
#define LOAD_FROM_MEM    1
284
#define LOAD_INDIRECT    2
285
286
 
287
void __stdcall copy_cursor(void *img, void *src);
288
void destroy_cursor(cursor_t *cursor);
289
void __destroy_cursor(cursor_t *cursor);                // wrap
290
291
 
292
void __stdcall r500_SetCursor(cursor_t *cursor, int x, int y);
293
void __stdcall r500_CursorRestore(int x, int y);
294
295
 
296
813 serge 297
 
298
 
299
    u32_t x ;
300
    u32_t y ;
301
} xPointFixed;
302
303
 
304
305
 
306
307
 
308
309
 
310
#define IntToxFixed(i)  ((xFixed) (i) << XFIXED_BITS)
311
312
 
313
314
 
315
					 ((type) << 16) | \
316
					 ((a) << 12) | \
317
					 ((r) << 8) | \
318
					 ((g) << 4) | \
319
					 ((b)))
320
321
 
322
#define PICT_FORMAT_RGB(f)  (((f)      ) & 0xfff)
323
324
 
325
#define PICT_TYPE_A     1
326
#define PICT_TYPE_ARGB	2
327
#define PICT_TYPE_ABGR	3
328
#define PICT_TYPE_COLOR	4
329
#define PICT_TYPE_GRAY	5
330
331
 
332
   PICT_a8r8g8b8 =	PICT_FORMAT(32,PICT_TYPE_ARGB,8,8,8,8),
333
   PICT_x8r8g8b8 =	PICT_FORMAT(32,PICT_TYPE_ARGB,0,8,8,8),
334
   PICT_a8b8g8r8 =	PICT_FORMAT(32,PICT_TYPE_ABGR,8,8,8,8),
335
   PICT_x8b8g8r8 =	PICT_FORMAT(32,PICT_TYPE_ABGR,0,8,8,8),
336
337
 
338
   PICT_r8g8b8 =	PICT_FORMAT(24,PICT_TYPE_ARGB,0,8,8,8),
339
   PICT_b8g8r8 =	PICT_FORMAT(24,PICT_TYPE_ABGR,0,8,8,8),
340
341
 
342
   PICT_r5g6b5 =	PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,6,5),
343
   PICT_b5g6r5 =	PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,6,5),
344
345
 
346
   PICT_x1r5g5b5 =	PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,5,5),
347
   PICT_a1b5g5r5 =	PICT_FORMAT(16,PICT_TYPE_ABGR,1,5,5,5),
348
   PICT_x1b5g5r5 =	PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,5,5),
349
   PICT_a4r4g4b4 =	PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4),
350
   PICT_x4r4g4b4 =	PICT_FORMAT(16,PICT_TYPE_ARGB,0,4,4,4),
351
   PICT_a4b4g4r4 =	PICT_FORMAT(16,PICT_TYPE_ABGR,4,4,4,4),
352
   PICT_x4b4g4r4 =	PICT_FORMAT(16,PICT_TYPE_ABGR,0,4,4,4),
353
354
 
355
   PICT_a8 =		PICT_FORMAT(8,PICT_TYPE_A,8,0,0,0),
356
   PICT_r3g3b2 =	PICT_FORMAT(8,PICT_TYPE_ARGB,0,3,3,2),
357
   PICT_b2g3r3 =	PICT_FORMAT(8,PICT_TYPE_ABGR,0,3,3,2),
358
   PICT_a2r2g2b2 =	PICT_FORMAT(8,PICT_TYPE_ARGB,2,2,2,2),
359
   PICT_a2b2g2r2 =	PICT_FORMAT(8,PICT_TYPE_ABGR,2,2,2,2),
360
361
 
362
   PICT_g8 =		PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0),
363
364
 
365
366
 
367
   PICT_x4g4 =		PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0),
368
369
 
370
   PICT_a4 =		PICT_FORMAT(4,PICT_TYPE_A,4,0,0,0),
371
   PICT_r1g2b1 =	PICT_FORMAT(4,PICT_TYPE_ARGB,0,1,2,1),
372
   PICT_b1g2r1 =	PICT_FORMAT(4,PICT_TYPE_ABGR,0,1,2,1),
373
   PICT_a1r1g1b1 =	PICT_FORMAT(4,PICT_TYPE_ARGB,1,1,1,1),
374
   PICT_a1b1g1r1 =	PICT_FORMAT(4,PICT_TYPE_ABGR,1,1,1,1),
375
376
 
377
   PICT_g4 =		PICT_FORMAT(4,PICT_TYPE_GRAY,0,0,0,0),
378
379
 
380
   PICT_a1 =		PICT_FORMAT(1,PICT_TYPE_A,1,0,0,0),
381
382
 
383
} PictFormatShort;
384