Subversion Repositories Kolibri OS

Rev

Rev 868 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 868 Rev 876
Line 2... Line 2...
2
#define DRAW_RECT    2
2
#define DRAW_RECT    2
3
#define LINE_2P      3
3
#define LINE_2P      3
4
#define BLIT         4
4
#define BLIT         4
5
#define COMPIZ       5
5
#define COMPIZ       5
6
#define PIXMAP       6
6
#define PX_CREATE    6
7
#define PIXBLIT      7
7
#define PIXBLIT      7
8
#define PIXLOCK      8
8
#define PIXLOCK      8
9
#define PIXUNLOCK    9
9
#define PIXUNLOCK    9
10
#define PIXDESTROY  10
10
#define PIXDESTROY  10
11
#define TRANSBLIT   11
11
#define TRANSBLIT   11
12
 
12
 
Line 14... Line 14...
14
typedef unsigned int color_t;
14
typedef unsigned int color_t;
Line 15... Line 15...
15
 
15
 
16
typedef struct
16
typedef struct
17
{
-
 
18
  pixmap_t  *dstpix;
-
 
19
 
17
{
20
  int     x;
18
  int x;
-
 
19
  int y;
-
 
20
}pt_t;
-
 
21
 
-
 
22
/***********               Clipping             **********/
-
 
23
 
-
 
24
typedef struct
-
 
25
{
-
 
26
  int xmin;
-
 
27
  int ymin;
-
 
28
  int xmax;
-
 
29
  int ymax;
-
 
30
}clip_t, *PTRclip;
-
 
31
 
-
 
32
#define CLIP_TOP          1
-
 
33
#define CLIP_BOTTOM       2
-
 
34
#define CLIP_RIGHT        4
-
 
35
#define CLIP_LEFT         8
-
 
36
 
-
 
37
int LineClip ( clip_t *clip, int *x1, int *y1, int *x2, int *y2 );
-
 
38
 
-
 
39
int BlockClip( clip_t *clip, int *x1, int *y1, int *x2, int* y2 );
-
 
40
 
-
 
41
typedef struct
-
 
42
{
-
 
43
  unsigned  width;
-
 
44
  unsigned  height;
21
  int     y;
45
  u32_t     format;
-
 
46
  u32_t     flags;
-
 
47
  unsigned  pitch;
22
  u32_t   w;
48
  void      *mapped;
-
 
49
  u32_t     handle;
-
 
50
}pixmap_t;
-
 
51
 
-
 
52
 
-
 
53
typedef struct
-
 
54
{
-
 
55
  unsigned  width;
-
 
56
  unsigned  height;
-
 
57
  u32_t     format;
-
 
58
  u32_t     flags;
-
 
59
 
-
 
60
  unsigned  pitch;
-
 
61
  void      *mapped;
-
 
62
 
-
 
63
  unsigned  pitch_offset;
-
 
64
  void      *local;
-
 
65
}local_pixmap_t;
-
 
66
 
-
 
67
//int CreatePixmap(userpixmap_t *io);
-
 
68
//int DestroyPixmap(userpixmap_t *io);
-
 
69
//int LockPixmap(userpixmap_t *io);
-
 
70
//int UnlockPixmap(userpixmap_t *io);
-
 
71
 
-
 
72
#define   PX_LOCK            1
-
 
73
 
-
 
74
typedef struct
-
 
75
{
-
 
76
  local_pixmap_t  *dstpix;
-
 
77
 
-
 
78
  struct
-
 
79
  {
-
 
80
    int x0;
-
 
81
    int y0;
-
 
82
  };
-
 
83
  union
-
 
84
  {
-
 
85
    struct
-
 
86
    {
-
 
87
      int x1;
-
 
88
      int y1;
-
 
89
    };
-
 
90
    struct
-
 
91
    {
-
 
92
      int w;
-
 
93
      int h;
-
 
94
    };
23
  u32_t   h;
95
  };
24
  color_t color;
96
  color_t color;
Line 25... Line 97...
25
}draw_t;
97
}draw_t;
26
 
98
 
27
typedef struct
99
typedef struct
Line 28... Line 100...
28
{
100
{
29
  pixmap_t  *dstpix;
101
  local_pixmap_t  *dstpix;
30
 
102
 
31
  int x;
103
  int x;
Line 51... Line 123...
51
}blit_t;
123
}blit_t;
52
 
124
 
Line 53... Line 125...
53
typedef struct
125
typedef struct
54
{
126
{
55
  int x0;
-
 
56
  int y0;
-
 
57
  int x1;
-
 
58
  int y1;
-
 
59
  u32 color;
-
 
60
}line2p_t;
-
 
61
 
-
 
62
typedef struct
-
 
63
{
-
 
64
  pixmap_t  *pixmap;
-
 
65
  void      *usermap;
-
 
66
  u32_t      format;
-
 
67
  u32_t      pitch;
-
 
68
 
-
 
69
  u32_t      width;
-
 
70
  u32_t      height;
-
 
71
}userpixmap_t;
-
 
72
 
-
 
73
typedef struct
-
 
74
{
-
 
75
  pixmap_t  *dstpix;
127
  local_pixmap_t  *dstpix;
76
  int        dst_x;
128
  int        dst_x;
77
  int        dst_y;
129
  int        dst_y;
Line 78... Line 130...
78
 
130
 
79
  pixmap_t  *srcpix;
131
  local_pixmap_t  *srcpix;
80
  int        src_x;
132
  int        src_x;
81
  int        src_y;
133
  int        src_y;
82
  int        w;
134
  int        w;
83
  int        h;
135
  int        h;
Line 84... Line 136...
84
}pixblit_t;
136
}pixblit_t;
85
 
-
 
Line 86... Line 137...
86
 
137
 
87
int LineClip( int *x1, int *y1, int *x2, int *y2 );
138
 
Line 88... Line -...
88
int BlockClip( int *x1, int *y1, int *x2, int* y2);
-
 
89
 
-
 
90
int DrawRect(draw_t * draw);
139
int Line2P(draw_t *draw);
Line 91... Line 140...
91
int FillRect(fill_t * fill);
140
 
Line 92... Line -...
92
 
-
 
93
int Line2P(line2p_t *draw);
-
 
94
 
-
 
95
int Blit(blit_t *blit);
-
 
Line 96... Line 141...
96
 
141
int DrawRect(draw_t * draw);
Line 97... Line -...
97
int RadeonComposite( blit_t *blit);
-
 
98
 
-
 
99
int CreatePixmap(userpixmap_t *io);
-
 
100
int DestroyPixmap(userpixmap_t *io);
-
 
101
int LockPixmap(userpixmap_t *io);
-
 
102
int UnlockPixmap(userpixmap_t *io);
-
 
103
 
-
 
104
int PixBlit(pixblit_t* blit);
-
 
105
 
-
 
106
 
-
 
107
# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
-
 
108
#	define RADEON_GMC_DST_PITCH_OFFSET_CNTL	(1 << 1)
-
 
109
# define RADEON_GMC_BRUSH_SOLID_COLOR     (13 << 4)
-
 
110
# define RADEON_GMC_BRUSH_NONE            (15 << 4)
-
 
111
# define RADEON_GMC_DST_16BPP             (4 << 8)
-
 
112
# define RADEON_GMC_DST_24BPP             (5 << 8)
-
 
113
# define RADEON_GMC_DST_32BPP             (6 << 8)
-
 
114
# define RADEON_GMC_DST_DATATYPE_SHIFT     8
-
 
115
# define RADEON_GMC_SRC_DATATYPE_COLOR    (3 << 12)
-
 
116
# define RADEON_DP_SRC_SOURCE_MEMORY      (2 << 24)
-
 
117
# define RADEON_DP_SRC_SOURCE_HOST_DATA   (3 << 24)
-
 
118
# define RADEON_GMC_CLR_CMP_CNTL_DIS      (1 << 28)
-
 
119
# define RADEON_GMC_WR_MSK_DIS            (1 << 30)
-
 
120
# define RADEON_ROP3_S                 0x00cc0000
-
 
121
# define RADEON_ROP3_P                 0x00f00000
-
 
122
 
-
 
123
#define RADEON_CP_PACKET0              0x00000000
-
 
124
#define RADEON_CP_PACKET1              0x40000000
-
 
125
#define RADEON_CP_PACKET2              0x80000000
-
 
126
#define RADEON_CP_PACKET3              0xC0000000
-
 
127
 
-
 
128
# define RADEON_CNTL_PAINT             0x00009100
-
 
129
# define RADEON_CNTL_BITBLT            0x00009200
-
 
130
# define RADEON_CNTL_TRANBLT           0x00009C00
-
 
131
 
-
 
132
 
-
 
133
# define RADEON_CNTL_PAINT_POLYLINE    0x00009500
-
 
134
# define RADEON_CNTL_PAINT_MULTI       0x00009A00
-
 
135
 
-
 
136
#define CP_PACKET0(reg, n)            \
-
 
137
	(RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
-
 
138
 
-
 
139
#define CP_PACKET1(reg0, reg1)            \
-
 
140
	(RADEON_CP_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2))
-
 
141
 
-
 
142
#define CP_PACKET2()              \
-
 
143
  (RADEON_CP_PACKET2)
-
 
144
 
-
 
145
#define CP_PACKET3( pkt, n )            \
-
 
146
	(RADEON_CP_PACKET3 | (pkt) | ((n) << 16))
-
 
147
 
-
 
148
#define BEGIN_RING( n ) do {            \
-
 
149
  ring = rhd.ring_base;                 \
-
 
150
  write = rhd.ring_wp;                  \
-
 
151
} while (0)
-
 
152
 
-
 
153
#define ADVANCE_RING()
-
 
154
 
-
 
155
#define OUT_RING( x ) do {        \
-
 
156
	ring[write++] = (x);						\
-
 
157
} while (0)
-
 
158
 
-
 
159
#define OUT_RING_REG(reg, val)            \
-
 
160
do {									\
-
 
161
    OUT_RING(CP_PACKET0(reg, 0));					\
-
 
162
    OUT_RING(val);							\
-
 
163
} while (0)
-
 
164
 
-
 
165
#define DRM_MEMORYBARRIER()  __asm volatile("lock; addl $0,0(%%esp)" : : : "memory");
-