2 * Copyright © 2007 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * Eric Anholt <eric@anholt.net>
28 #include "main/mtypes.h"
29 #include "intel_batchbuffer.h"
31 #include "brw_context.h"
32 #include "brw_defines.h"
35 batch_out(struct brw_context
*brw
, const char *name
, uint32_t offset
,
36 int index
, char *fmt
, ...) PRINTFLIKE(5, 6);
39 batch_out(struct brw_context
*brw
, const char *name
, uint32_t offset
,
40 int index
, char *fmt
, ...)
42 uint32_t *data
= brw
->batch
.bo
->virtual + offset
;
45 fprintf(stderr
, "0x%08x: 0x%08x: %8s: ",
46 offset
+ index
* 4, data
[index
], name
);
48 vfprintf(stderr
, fmt
, va
);
53 get_965_surfacetype(unsigned int surfacetype
)
55 switch (surfacetype
) {
59 case 3: return "CUBE";
60 case 4: return "BUFFER";
61 case 7: return "NULL";
62 default: return "unknown";
67 get_965_surface_format(unsigned int surface_format
)
69 switch (surface_format
) {
70 case 0x000: return "r32g32b32a32_float";
71 case 0x0c1: return "b8g8r8a8_unorm";
72 case 0x100: return "b5g6r5_unorm";
73 case 0x102: return "b5g5r5a1_unorm";
74 case 0x104: return "b4g4r4a4_unorm";
75 default: return "unknown";
79 static void dump_vs_state(struct brw_context
*brw
, uint32_t offset
)
81 const char *name
= "VS_STATE";
82 struct brw_vs_unit_state
*vs
= brw
->batch
.bo
->virtual + offset
;
84 batch_out(brw
, name
, offset
, 0, "thread0\n");
85 batch_out(brw
, name
, offset
, 1, "thread1\n");
86 batch_out(brw
, name
, offset
, 2, "thread2\n");
87 batch_out(brw
, name
, offset
, 3, "thread3\n");
88 batch_out(brw
, name
, offset
, 4, "thread4: %d threads\n",
89 vs
->thread4
.max_threads
+ 1);
90 batch_out(brw
, name
, offset
, 5, "vs5\n");
91 batch_out(brw
, name
, offset
, 6, "vs6\n");
94 static void dump_gs_state(struct brw_context
*brw
, uint32_t offset
)
96 const char *name
= "GS_STATE";
97 struct brw_gs_unit_state
*gs
= brw
->batch
.bo
->virtual + offset
;
99 batch_out(brw
, name
, offset
, 0, "thread0\n");
100 batch_out(brw
, name
, offset
, 1, "thread1\n");
101 batch_out(brw
, name
, offset
, 2, "thread2\n");
102 batch_out(brw
, name
, offset
, 3, "thread3\n");
103 batch_out(brw
, name
, offset
, 4, "thread4: %d threads\n",
104 gs
->thread4
.max_threads
+ 1);
105 batch_out(brw
, name
, offset
, 5, "vs5\n");
106 batch_out(brw
, name
, offset
, 6, "vs6\n");
109 static void dump_clip_state(struct brw_context
*brw
, uint32_t offset
)
111 const char *name
= "CLIP_STATE";
112 struct brw_clip_unit_state
*clip
= brw
->batch
.bo
->virtual + offset
;
114 batch_out(brw
, name
, offset
, 0, "thread0\n");
115 batch_out(brw
, name
, offset
, 1, "thread1\n");
116 batch_out(brw
, name
, offset
, 2, "thread2\n");
117 batch_out(brw
, name
, offset
, 3, "thread3\n");
118 batch_out(brw
, name
, offset
, 4, "thread4: %d threads\n",
119 clip
->thread4
.max_threads
+ 1);
120 batch_out(brw
, name
, offset
, 5, "clip5\n");
121 batch_out(brw
, name
, offset
, 6, "clip6\n");
122 batch_out(brw
, name
, offset
, 7, "vp xmin %f\n", clip
->viewport_xmin
);
123 batch_out(brw
, name
, offset
, 8, "vp xmax %f\n", clip
->viewport_xmax
);
124 batch_out(brw
, name
, offset
, 9, "vp ymin %f\n", clip
->viewport_ymin
);
125 batch_out(brw
, name
, offset
, 10, "vp ymax %f\n", clip
->viewport_ymax
);
128 static void dump_sf_state(struct brw_context
*brw
, uint32_t offset
)
130 const char *name
= "SF_STATE";
131 struct brw_sf_unit_state
*sf
= brw
->batch
.bo
->virtual + offset
;
133 batch_out(brw
, name
, offset
, 0, "thread0\n");
134 batch_out(brw
, name
, offset
, 1, "thread1\n");
135 batch_out(brw
, name
, offset
, 2, "thread2\n");
136 batch_out(brw
, name
, offset
, 3, "thread3\n");
137 batch_out(brw
, name
, offset
, 4, "thread4: %d threads\n",
138 sf
->thread4
.max_threads
+ 1);
139 batch_out(brw
, name
, offset
, 5, "sf5: viewport offset\n");
140 batch_out(brw
, name
, offset
, 6, "sf6\n");
141 batch_out(brw
, name
, offset
, 7, "sf7\n");
144 static void dump_wm_state(struct brw_context
*brw
, uint32_t offset
)
146 const char *name
= "WM_STATE";
147 struct brw_wm_unit_state
*wm
= brw
->batch
.bo
->virtual + offset
;
149 batch_out(brw
, name
, offset
, 0, "thread0\n");
150 batch_out(brw
, name
, offset
, 1, "thread1\n");
151 batch_out(brw
, name
, offset
, 2, "thread2\n");
152 batch_out(brw
, name
, offset
, 3, "thread3\n");
153 batch_out(brw
, name
, offset
, 4, "wm4\n");
154 batch_out(brw
, name
, offset
, 5, "wm5: %s%s%s%s%s%s, %d threads\n",
155 wm
->wm5
.enable_8_pix
? "8pix" : "",
156 wm
->wm5
.enable_16_pix
? "16pix" : "",
157 wm
->wm5
.program_uses_depth
? ", uses depth" : "",
158 wm
->wm5
.program_computes_depth
? ", computes depth" : "",
159 wm
->wm5
.program_uses_killpixel
? ", kills" : "",
160 wm
->wm5
.thread_dispatch_enable
? "" : ", no dispatch",
161 wm
->wm5
.max_threads
+ 1);
162 batch_out(brw
, name
, offset
, 6, "depth offset constant %f\n",
163 wm
->global_depth_offset_constant
);
164 batch_out(brw
, name
, offset
, 7, "depth offset scale %f\n",
165 wm
->global_depth_offset_scale
);
166 batch_out(brw
, name
, offset
, 8, "wm8: kernel 1 (gen5+)\n");
167 batch_out(brw
, name
, offset
, 9, "wm9: kernel 2 (gen5+)\n");
168 batch_out(brw
, name
, offset
, 10, "wm10: kernel 3 (gen5+)\n");
171 static void dump_surface_state(struct brw_context
*brw
, uint32_t offset
)
173 const char *name
= "SURF";
174 uint32_t *surf
= brw
->batch
.bo
->virtual + offset
;
176 batch_out(brw
, name
, offset
, 0, "%s %s\n",
177 get_965_surfacetype(GET_FIELD(surf
[0], BRW_SURFACE_TYPE
)),
178 get_965_surface_format(GET_FIELD(surf
[0], BRW_SURFACE_FORMAT
)));
179 batch_out(brw
, name
, offset
, 1, "offset\n");
180 batch_out(brw
, name
, offset
, 2, "%dx%d size, %d mips\n",
181 GET_FIELD(surf
[2], BRW_SURFACE_WIDTH
) + 1,
182 GET_FIELD(surf
[2], BRW_SURFACE_HEIGHT
) + 1,
183 GET_FIELD(surf
[2], BRW_SURFACE_LOD
));
184 batch_out(brw
, name
, offset
, 3, "pitch %d, %s tiled\n",
185 GET_FIELD(surf
[3], BRW_SURFACE_PITCH
) + 1,
186 (surf
[3] & BRW_SURFACE_TILED
) ?
187 ((surf
[3] & BRW_SURFACE_TILED_Y
) ? "Y" : "X") : "not");
188 batch_out(brw
, name
, offset
, 4, "mip base %d\n",
189 GET_FIELD(surf
[4], BRW_SURFACE_MIN_LOD
));
190 batch_out(brw
, name
, offset
, 5, "x,y offset: %d,%d\n",
191 GET_FIELD(surf
[5], BRW_SURFACE_X_OFFSET
),
192 GET_FIELD(surf
[5], BRW_SURFACE_Y_OFFSET
));
195 static void dump_gen7_surface_state(struct brw_context
*brw
, uint32_t offset
)
197 const char *name
= "SURF";
198 uint32_t *surf
= brw
->batch
.bo
->virtual + offset
;
200 batch_out(brw
, name
, offset
, 0, "%s %s\n",
201 get_965_surfacetype(GET_FIELD(surf
[0], BRW_SURFACE_TYPE
)),
202 get_965_surface_format(GET_FIELD(surf
[0], BRW_SURFACE_FORMAT
)));
203 batch_out(brw
, name
, offset
, 1, "offset\n");
204 batch_out(brw
, name
, offset
, 2, "%dx%d size, %d mips\n",
205 GET_FIELD(surf
[2], GEN7_SURFACE_WIDTH
) + 1,
206 GET_FIELD(surf
[2], GEN7_SURFACE_HEIGHT
) + 1,
207 surf
[5] & INTEL_MASK(3, 0));
208 batch_out(brw
, name
, offset
, 3, "pitch %d, %stiled\n",
209 (surf
[3] & INTEL_MASK(17, 0)) + 1,
210 (surf
[0] & (1 << 14)) ? "" : "not ");
211 batch_out(brw
, name
, offset
, 4, "mip base %d\n",
212 GET_FIELD(surf
[5], GEN7_SURFACE_MIN_LOD
));
213 batch_out(brw
, name
, offset
, 5, "x,y offset: %d,%d\n",
214 GET_FIELD(surf
[5], BRW_SURFACE_X_OFFSET
),
215 GET_FIELD(surf
[5], BRW_SURFACE_Y_OFFSET
));
219 dump_sdc(struct brw_context
*brw
, uint32_t offset
)
221 const char *name
= "SDC";
223 if (brw
->gen
>= 5 && brw
->gen
<= 6) {
224 struct gen5_sampler_default_color
*sdc
= (brw
->batch
.bo
->virtual +
226 batch_out(brw
, name
, offset
, 0, "unorm rgba\n");
227 batch_out(brw
, name
, offset
, 1, "r %f\n", sdc
->f
[0]);
228 batch_out(brw
, name
, offset
, 2, "b %f\n", sdc
->f
[1]);
229 batch_out(brw
, name
, offset
, 3, "g %f\n", sdc
->f
[2]);
230 batch_out(brw
, name
, offset
, 4, "a %f\n", sdc
->f
[3]);
231 batch_out(brw
, name
, offset
, 5, "half float rg\n");
232 batch_out(brw
, name
, offset
, 6, "half float ba\n");
233 batch_out(brw
, name
, offset
, 7, "u16 rg\n");
234 batch_out(brw
, name
, offset
, 8, "u16 ba\n");
235 batch_out(brw
, name
, offset
, 9, "s16 rg\n");
236 batch_out(brw
, name
, offset
, 10, "s16 ba\n");
237 batch_out(brw
, name
, offset
, 11, "s8 rgba\n");
239 struct brw_sampler_default_color
*sdc
= (brw
->batch
.bo
->virtual +
241 batch_out(brw
, name
, offset
, 0, "r %f\n", sdc
->color
[0]);
242 batch_out(brw
, name
, offset
, 1, "g %f\n", sdc
->color
[1]);
243 batch_out(brw
, name
, offset
, 2, "b %f\n", sdc
->color
[2]);
244 batch_out(brw
, name
, offset
, 3, "a %f\n", sdc
->color
[3]);
248 static void dump_sampler_state(struct brw_context
*brw
,
249 uint32_t offset
, uint32_t size
)
252 struct brw_sampler_state
*samp
= brw
->batch
.bo
->virtual + offset
;
254 assert(brw
->gen
< 7);
256 for (i
= 0; i
< size
/ sizeof(*samp
); i
++) {
259 sprintf(name
, "WM SAMP%d", i
);
260 batch_out(brw
, name
, offset
, 0, "filtering\n");
261 batch_out(brw
, name
, offset
, 1, "wrapping, lod\n");
262 batch_out(brw
, name
, offset
, 2, "default color pointer\n");
263 batch_out(brw
, name
, offset
, 3, "chroma key, aniso\n");
266 offset
+= sizeof(*samp
);
270 static void dump_gen7_sampler_state(struct brw_context
*brw
,
271 uint32_t offset
, uint32_t size
)
273 struct gen7_sampler_state
*samp
= brw
->batch
.bo
->virtual + offset
;
276 assert(brw
->gen
>= 7);
278 for (i
= 0; i
< size
/ sizeof(*samp
); i
++) {
281 sprintf(name
, "WM SAMP%d", i
);
282 batch_out(brw
, name
, offset
, 0, "filtering\n");
283 batch_out(brw
, name
, offset
, 1, "wrapping, lod\n");
284 batch_out(brw
, name
, offset
, 2, "default color pointer\n");
285 batch_out(brw
, name
, offset
, 3, "chroma key, aniso\n");
288 offset
+= sizeof(*samp
);
293 static void dump_sf_viewport_state(struct brw_context
*brw
,
296 const char *name
= "SF VP";
297 struct brw_sf_viewport
*vp
= brw
->batch
.bo
->virtual + offset
;
299 assert(brw
->gen
< 7);
301 batch_out(brw
, name
, offset
, 0, "m00 = %f\n", vp
->viewport
.m00
);
302 batch_out(brw
, name
, offset
, 1, "m11 = %f\n", vp
->viewport
.m11
);
303 batch_out(brw
, name
, offset
, 2, "m22 = %f\n", vp
->viewport
.m22
);
304 batch_out(brw
, name
, offset
, 3, "m30 = %f\n", vp
->viewport
.m30
);
305 batch_out(brw
, name
, offset
, 4, "m31 = %f\n", vp
->viewport
.m31
);
306 batch_out(brw
, name
, offset
, 5, "m32 = %f\n", vp
->viewport
.m32
);
308 batch_out(brw
, name
, offset
, 6, "top left = %d,%d\n",
309 vp
->scissor
.xmin
, vp
->scissor
.ymin
);
310 batch_out(brw
, name
, offset
, 7, "bottom right = %d,%d\n",
311 vp
->scissor
.xmax
, vp
->scissor
.ymax
);
314 static void dump_clip_viewport_state(struct brw_context
*brw
,
317 const char *name
= "CLIP VP";
318 struct brw_clipper_viewport
*vp
= brw
->batch
.bo
->virtual + offset
;
320 assert(brw
->gen
< 7);
322 batch_out(brw
, name
, offset
, 0, "xmin = %f\n", vp
->xmin
);
323 batch_out(brw
, name
, offset
, 1, "xmax = %f\n", vp
->xmax
);
324 batch_out(brw
, name
, offset
, 2, "ymin = %f\n", vp
->ymin
);
325 batch_out(brw
, name
, offset
, 3, "ymax = %f\n", vp
->ymax
);
328 static void dump_sf_clip_viewport_state(struct brw_context
*brw
,
331 const char *name
= "SF_CLIP VP";
332 struct gen7_sf_clip_viewport
*vp
= brw
->batch
.bo
->virtual + offset
;
334 assert(brw
->gen
>= 7);
336 batch_out(brw
, name
, offset
, 0, "m00 = %f\n", vp
->viewport
.m00
);
337 batch_out(brw
, name
, offset
, 1, "m11 = %f\n", vp
->viewport
.m11
);
338 batch_out(brw
, name
, offset
, 2, "m22 = %f\n", vp
->viewport
.m22
);
339 batch_out(brw
, name
, offset
, 3, "m30 = %f\n", vp
->viewport
.m30
);
340 batch_out(brw
, name
, offset
, 4, "m31 = %f\n", vp
->viewport
.m31
);
341 batch_out(brw
, name
, offset
, 5, "m32 = %f\n", vp
->viewport
.m32
);
342 batch_out(brw
, name
, offset
, 6, "guardband xmin = %f\n", vp
->guardband
.xmin
);
343 batch_out(brw
, name
, offset
, 7, "guardband xmax = %f\n", vp
->guardband
.xmax
);
344 batch_out(brw
, name
, offset
, 8, "guardband ymin = %f\n", vp
->guardband
.ymin
);
345 batch_out(brw
, name
, offset
, 9, "guardband ymax = %f\n", vp
->guardband
.ymax
);
349 static void dump_cc_viewport_state(struct brw_context
*brw
, uint32_t offset
)
351 const char *name
= "CC VP";
352 struct brw_cc_viewport
*vp
= brw
->batch
.bo
->virtual + offset
;
354 batch_out(brw
, name
, offset
, 0, "min_depth = %f\n", vp
->min_depth
);
355 batch_out(brw
, name
, offset
, 1, "max_depth = %f\n", vp
->max_depth
);
358 static void dump_depth_stencil_state(struct brw_context
*brw
, uint32_t offset
)
360 const char *name
= "D_S";
361 struct gen6_depth_stencil_state
*ds
= brw
->batch
.bo
->virtual + offset
;
363 batch_out(brw
, name
, offset
, 0,
364 "stencil %sable, func %d, write %sable\n",
365 ds
->ds0
.stencil_enable
? "en" : "dis",
366 ds
->ds0
.stencil_func
,
367 ds
->ds0
.stencil_write_enable
? "en" : "dis");
368 batch_out(brw
, name
, offset
, 1,
369 "stencil test mask 0x%x, write mask 0x%x\n",
370 ds
->ds1
.stencil_test_mask
, ds
->ds1
.stencil_write_mask
);
371 batch_out(brw
, name
, offset
, 2,
372 "depth test %sable, func %d, write %sable\n",
373 ds
->ds2
.depth_test_enable
? "en" : "dis",
374 ds
->ds2
.depth_test_func
,
375 ds
->ds2
.depth_write_enable
? "en" : "dis");
378 static void dump_cc_state_gen4(struct brw_context
*brw
, uint32_t offset
)
380 const char *name
= "CC";
382 batch_out(brw
, name
, offset
, 0, "cc0\n");
383 batch_out(brw
, name
, offset
, 1, "cc1\n");
384 batch_out(brw
, name
, offset
, 2, "cc2\n");
385 batch_out(brw
, name
, offset
, 3, "cc3\n");
386 batch_out(brw
, name
, offset
, 4, "cc4: viewport offset\n");
387 batch_out(brw
, name
, offset
, 5, "cc5\n");
388 batch_out(brw
, name
, offset
, 6, "cc6\n");
389 batch_out(brw
, name
, offset
, 7, "cc7\n");
392 static void dump_cc_state_gen6(struct brw_context
*brw
, uint32_t offset
)
394 const char *name
= "CC";
395 struct gen6_color_calc_state
*cc
= brw
->batch
.bo
->virtual + offset
;
397 batch_out(brw
, name
, offset
, 0,
398 "alpha test format %s, round disable %d, stencil ref %d, "
399 "bf stencil ref %d\n",
400 cc
->cc0
.alpha_test_format
? "FLOAT32" : "UNORM8",
401 cc
->cc0
.round_disable
,
403 cc
->cc0
.bf_stencil_ref
);
404 batch_out(brw
, name
, offset
, 1, "\n");
405 batch_out(brw
, name
, offset
, 2, "constant red %f\n", cc
->constant_r
);
406 batch_out(brw
, name
, offset
, 3, "constant green %f\n", cc
->constant_g
);
407 batch_out(brw
, name
, offset
, 4, "constant blue %f\n", cc
->constant_b
);
408 batch_out(brw
, name
, offset
, 5, "constant alpha %f\n", cc
->constant_a
);
411 static void dump_blend_state(struct brw_context
*brw
, uint32_t offset
)
413 const char *name
= "BLEND";
415 batch_out(brw
, name
, offset
, 0, "\n");
416 batch_out(brw
, name
, offset
, 1, "\n");
420 dump_scissor(struct brw_context
*brw
, uint32_t offset
)
422 const char *name
= "SCISSOR";
423 struct gen6_scissor_rect
*scissor
= brw
->batch
.bo
->virtual + offset
;
425 batch_out(brw
, name
, offset
, 0, "xmin %d, ymin %d\n",
426 scissor
->xmin
, scissor
->ymin
);
427 batch_out(brw
, name
, offset
, 1, "xmax %d, ymax %d\n",
428 scissor
->xmax
, scissor
->ymax
);
432 dump_vs_constants(struct brw_context
*brw
, uint32_t offset
, uint32_t size
)
434 const char *name
= "VS_CONST";
435 uint32_t *as_uint
= brw
->batch
.bo
->virtual + offset
;
436 float *as_float
= brw
->batch
.bo
->virtual + offset
;
439 for (i
= 0; i
< size
/ 4; i
+= 4) {
440 batch_out(brw
, name
, offset
, i
, "%3d: (% f % f % f % f) (0x%08x 0x%08x 0x%08x 0x%08x)\n",
442 as_float
[i
], as_float
[i
+ 1], as_float
[i
+ 2], as_float
[i
+ 3],
443 as_uint
[i
], as_uint
[i
+ 1], as_uint
[i
+ 2], as_uint
[i
+ 3]);
448 dump_wm_constants(struct brw_context
*brw
, uint32_t offset
, uint32_t size
)
450 const char *name
= "WM_CONST";
451 uint32_t *as_uint
= brw
->batch
.bo
->virtual + offset
;
452 float *as_float
= brw
->batch
.bo
->virtual + offset
;
455 for (i
= 0; i
< size
/ 4; i
+= 4) {
456 batch_out(brw
, name
, offset
, i
, "%3d: (% f % f % f % f) (0x%08x 0x%08x 0x%08x 0x%08x)\n",
458 as_float
[i
], as_float
[i
+ 1], as_float
[i
+ 2], as_float
[i
+ 3],
459 as_uint
[i
], as_uint
[i
+ 1], as_uint
[i
+ 2], as_uint
[i
+ 3]);
463 static void dump_binding_table(struct brw_context
*brw
, uint32_t offset
,
468 uint32_t *data
= brw
->batch
.bo
->virtual + offset
;
470 for (i
= 0; i
< size
/ 4; i
++) {
474 sprintf(name
, "BIND%d", i
);
475 batch_out(brw
, name
, offset
, i
, "surface state address\n");
480 dump_prog_cache(struct brw_context
*brw
)
482 struct brw_cache
*cache
= &brw
->cache
;
486 drm_intel_bo_map(brw
->cache
.bo
, false);
488 for (b
= 0; b
< cache
->size
; b
++) {
489 struct brw_cache_item
*item
;
491 for (item
= cache
->items
[b
]; item
; item
= item
->next
) {
493 uint32_t offset
= item
->offset
;
495 data
= brw
->cache
.bo
->virtual + item
->offset
;
497 switch (item
->cache_id
) {
502 name
= "Fixed-function GS kernel";
505 name
= "CLIP kernel";
518 for (i
= 0; i
< item
->size
/ 4 / 4; i
++) {
519 fprintf(stderr
, "0x%08x: %8s: 0x%08x 0x%08x 0x%08x 0x%08x ",
522 data
[i
* 4], data
[i
* 4 + 1], data
[i
* 4 + 2], data
[i
* 4 + 3]);
524 brw_disasm(stderr
, (void *)(data
+ i
* 4), brw
->gen
);
529 drm_intel_bo_unmap(brw
->cache
.bo
);
533 dump_state_batch(struct brw_context
*brw
)
537 for (i
= 0; i
< brw
->state_batch_count
; i
++) {
538 uint32_t offset
= brw
->state_batch_list
[i
].offset
;
539 uint32_t size
= brw
->state_batch_list
[i
].size
;
541 switch (brw
->state_batch_list
[i
].type
) {
542 case AUB_TRACE_VS_STATE
:
543 dump_vs_state(brw
, offset
);
545 case AUB_TRACE_GS_STATE
:
546 dump_gs_state(brw
, offset
);
548 case AUB_TRACE_CLIP_STATE
:
549 dump_clip_state(brw
, offset
);
551 case AUB_TRACE_SF_STATE
:
552 dump_sf_state(brw
, offset
);
554 case AUB_TRACE_WM_STATE
:
555 dump_wm_state(brw
, offset
);
557 case AUB_TRACE_CLIP_VP_STATE
:
558 dump_clip_viewport_state(brw
, offset
);
560 case AUB_TRACE_SF_VP_STATE
:
562 dump_sf_clip_viewport_state(brw
, offset
);
564 dump_sf_viewport_state(brw
, offset
);
567 case AUB_TRACE_CC_VP_STATE
:
568 dump_cc_viewport_state(brw
, offset
);
570 case AUB_TRACE_DEPTH_STENCIL_STATE
:
571 dump_depth_stencil_state(brw
, offset
);
573 case AUB_TRACE_CC_STATE
:
575 dump_cc_state_gen6(brw
, offset
);
577 dump_cc_state_gen4(brw
, offset
);
579 case AUB_TRACE_BLEND_STATE
:
580 dump_blend_state(brw
, offset
);
582 case AUB_TRACE_BINDING_TABLE
:
583 dump_binding_table(brw
, offset
, size
);
585 case AUB_TRACE_SURFACE_STATE
:
587 dump_surface_state(brw
, offset
);
589 dump_gen7_surface_state(brw
, offset
);
592 case AUB_TRACE_SAMPLER_STATE
:
594 dump_sampler_state(brw
, offset
, size
);
596 dump_gen7_sampler_state(brw
, offset
, size
);
599 case AUB_TRACE_SAMPLER_DEFAULT_COLOR
:
600 dump_sdc(brw
, offset
);
602 case AUB_TRACE_SCISSOR_STATE
:
603 dump_scissor(brw
, offset
);
605 case AUB_TRACE_VS_CONSTANTS
:
606 dump_vs_constants(brw
, offset
, size
);
608 case AUB_TRACE_WM_CONSTANTS
:
609 dump_wm_constants(brw
, offset
, size
);
618 * Print additional debug information associated with the batchbuffer
619 * when DEBUG_BATCH is set.
621 * For 965, this means mapping the state buffers that would have been referenced
622 * by the batchbuffer and dumping them.
624 * The buffer offsets printed rely on the buffer containing the last offset
625 * it was validated at.
627 void brw_debug_batch(struct brw_context
*brw
)
629 drm_intel_bo_map(brw
->batch
.bo
, false);
630 dump_state_batch(brw
);
631 drm_intel_bo_unmap(brw
->batch
.bo
);
634 dump_prog_cache(brw
);