2 #define R100_TRACK_MAX_TEXTURE 3
3 #define R200_TRACK_MAX_TEXTURE 6
4 #define R300_TRACK_MAX_TEXTURE 16
12 struct r100_cs_track_cb
{
13 struct radeon_bo
*robj
;
19 struct r100_cs_track_array
{
20 struct radeon_bo
*robj
;
24 struct r100_cs_cube_info
{
25 struct radeon_bo
*robj
;
31 #define R100_TRACK_COMP_NONE 0
32 #define R100_TRACK_COMP_DXT1 1
33 #define R100_TRACK_COMP_DXT35 2
35 struct r100_cs_track_texture
{
36 struct radeon_bo
*robj
;
37 struct r100_cs_cube_info cube_info
[5]; /* info for 5 non-primary faces */
43 unsigned tex_coord_type
;
51 unsigned compress_format
;
54 struct r100_cs_track_limits
{
60 struct r100_cs_track
{
61 struct radeon_device
*rdev
;
70 unsigned color_channel_mask
;
71 struct r100_cs_track_array arrays
[11];
72 struct r100_cs_track_cb cb
[R300_MAX_CB
];
73 struct r100_cs_track_cb zb
;
74 struct r100_cs_track_texture textures
[R300_TRACK_MAX_TEXTURE
];
78 bool blend_read_enable
;
81 int r100_cs_track_check(struct radeon_device
*rdev
, struct r100_cs_track
*track
);
82 void r100_cs_track_clear(struct radeon_device
*rdev
, struct r100_cs_track
*track
);
83 int r100_cs_packet_next_reloc(struct radeon_cs_parser
*p
,
84 struct radeon_cs_reloc
**cs_reloc
);
85 void r100_cs_dump_packet(struct radeon_cs_parser
*p
,
86 struct radeon_cs_packet
*pkt
);
88 int r100_cs_packet_parse_vline(struct radeon_cs_parser
*p
);
90 int r200_packet0_check(struct radeon_cs_parser
*p
,
91 struct radeon_cs_packet
*pkt
,
92 unsigned idx
, unsigned reg
);
96 static inline int r100_reloc_pitch_offset(struct radeon_cs_parser
*p
,
97 struct radeon_cs_packet
*pkt
,
104 struct radeon_cs_reloc
*reloc
;
107 r
= r100_cs_packet_next_reloc(p
, &reloc
);
109 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
111 r100_cs_dump_packet(p
, pkt
);
114 value
= radeon_get_ib_value(p
, idx
);
115 tmp
= value
& 0x003fffff;
116 tmp
+= (((u32
)reloc
->lobj
.gpu_offset
) >> 10);
118 if (reloc
->lobj
.tiling_flags
& RADEON_TILING_MACRO
)
119 tile_flags
|= RADEON_DST_TILE_MACRO
;
120 if (reloc
->lobj
.tiling_flags
& RADEON_TILING_MICRO
) {
121 if (reg
== RADEON_SRC_PITCH_OFFSET
) {
122 DRM_ERROR("Cannot src blit from microtiled surface\n");
123 r100_cs_dump_packet(p
, pkt
);
126 tile_flags
|= RADEON_DST_TILE_MICRO
;
130 p
->ib
->ptr
[idx
] = (value
& 0x3fc00000) | tmp
;
134 static inline int r100_packet3_load_vbpntr(struct radeon_cs_parser
*p
,
135 struct radeon_cs_packet
*pkt
,
139 struct radeon_cs_reloc
*reloc
;
140 struct r100_cs_track
*track
;
142 volatile uint32_t *ib
;
146 track
= (struct r100_cs_track
*)p
->track
;
147 c
= radeon_get_ib_value(p
, idx
++) & 0x1F;
148 track
->num_arrays
= c
;
149 for (i
= 0; i
< (c
- 1); i
+=2, idx
+=3) {
150 r
= r100_cs_packet_next_reloc(p
, &reloc
);
152 DRM_ERROR("No reloc for packet3 %d\n",
154 r100_cs_dump_packet(p
, pkt
);
157 idx_value
= radeon_get_ib_value(p
, idx
);
158 ib
[idx
+1] = radeon_get_ib_value(p
, idx
+ 1) + ((u32
)reloc
->lobj
.gpu_offset
);
160 track
->arrays
[i
+ 0].esize
= idx_value
>> 8;
161 track
->arrays
[i
+ 0].robj
= reloc
->robj
;
162 track
->arrays
[i
+ 0].esize
&= 0x7F;
163 r
= r100_cs_packet_next_reloc(p
, &reloc
);
165 DRM_ERROR("No reloc for packet3 %d\n",
167 r100_cs_dump_packet(p
, pkt
);
170 ib
[idx
+2] = radeon_get_ib_value(p
, idx
+ 2) + ((u32
)reloc
->lobj
.gpu_offset
);
171 track
->arrays
[i
+ 1].robj
= reloc
->robj
;
172 track
->arrays
[i
+ 1].esize
= idx_value
>> 24;
173 track
->arrays
[i
+ 1].esize
&= 0x7F;
176 r
= r100_cs_packet_next_reloc(p
, &reloc
);
178 DRM_ERROR("No reloc for packet3 %d\n",
180 r100_cs_dump_packet(p
, pkt
);
183 idx_value
= radeon_get_ib_value(p
, idx
);
184 ib
[idx
+1] = radeon_get_ib_value(p
, idx
+ 1) + ((u32
)reloc
->lobj
.gpu_offset
);
185 track
->arrays
[i
+ 0].robj
= reloc
->robj
;
186 track
->arrays
[i
+ 0].esize
= idx_value
>> 8;
187 track
->arrays
[i
+ 0].esize
&= 0x7F;