6 #include "intel_driver.h"
7 #include "intel_batchbuffer_dump.h"
11 #define BUFFER_FAIL(_count, _len, _name) do { \
12 fprintf(gout, "Buffer size too small in %s (%d < %d)\n", \
13 (_name), (_count), (_len)); \
21 instr_out(unsigned int *data, unsigned int offset, unsigned int index, char *fmt, ...)
25 fprintf(gout, "0x%08x: 0x%08x:%s ", offset + index * 4, data[index],
26 index == 0 ? "" : " ");
28 vfprintf(gout, fmt, va);
34 dump_mi(unsigned int *data, unsigned int offset, int count, unsigned int device, int *failures)
46 { 0x00, 0, 1, 1, "MI_NOOP" },
47 { 0x04, 0, 1, 1, "MI_FLUSH" },
48 { 0x0a, 0, 1, 1, "MI_BATCH_BUFFER_END" },
49 { 0x26, 0x3f, 4, 5, "MI_FLUSH_DW" },
52 opcode = ((data[0] & MASK_MI_OPCODE) >> SHIFT_MI_OPCODE);
54 for (i = 0; i < sizeof(mi_commands) / sizeof(mi_commands[0]); i++) {
55 if (opcode == mi_commands[i].opcode) {
59 instr_out(data, offset, 0, "%s\n", mi_commands[i].name);
61 if (mi_commands[i].max_len > 1) {
62 length = (data[0] & mi_commands[i].mask_length) + 2;
64 if (length < mi_commands[i].min_len ||
65 length > mi_commands[i].max_len) {
66 fprintf(gout, "Bad length (%d) in %s, [%d, %d]\n",
67 length, mi_commands[i].name,
68 mi_commands[i].min_len,
69 mi_commands[i].max_len);
73 for (index = 1; index < length; index++) {
75 BUFFER_FAIL(count, length, mi_commands[i].name);
77 instr_out(data, offset, index, "dword %d\n", index);
84 instr_out(data, offset, 0, "UNKNOWN MI COMMAND\n");
90 dump_gfxpipe_3d(unsigned int *data, unsigned int offset, int count, unsigned int device, int *failures)
92 instr_out(data, offset, 0, "UNKNOWN 3D COMMAND\n");
99 dump_avc_bsd_img_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
101 int img_struct = ((data[3] >> 8) & 0x3);
103 instr_out(data, offset, 1, "frame size: %d\n", (data[1] & 0xffff));
104 instr_out(data, offset, 2, "width: %d, height: %d\n", (data[2] & 0xff), (data[2] >> 16) & 0xff);
105 instr_out(data, offset, 3,
106 "second_chroma_qp_offset: %d,"
107 "chroma_qp_offset: %d,"
108 "QM present flag: %d,"
110 "img_dec_fs_idc: %d,"
112 (data[3] >> 24) & 0x1f,
113 (data[3] >> 16) & 0x1f,
114 (data[3] >> 10) & 0x1,
115 (img_struct == 0) ? "frame" : (img_struct == 2) ? "invalid" : (img_struct == 1) ? "top field" : "bottom field",
117 instr_out(data, offset, 4,
118 "residual off: 0x%x,"
123 "constrained intra: %d,"
129 (data[4] >> 24) & 0xff,
130 (data[4] >> 12) & 0x1,
131 (data[4] >> 10) & 0x3,
132 (data[4] >> 7) & 0x1,
133 (data[4] >> 6) & 0x1,
134 (data[4] >> 5) & 0x1,
135 (data[4] >> 4) & 0x1,
136 (data[4] >> 3) & 0x1,
137 (data[4] >> 2) & 0x1,
138 (data[4] >> 1) & 0x1);
139 instr_out(data, offset, 5, "AVC-IT Command Header\n");
143 dump_avc_bsd_qm_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
145 unsigned int length = ((data[0] & MASK_GFXPIPE_LENGTH) >> SHIFT_GFXPIPE_LENGTH) + 2;
148 instr_out(data, offset, 1, "user default: %02x, QM list present: %02x\n",
149 (data[1] >> 8) & 0xff, data[1] & 0xff);
151 for (i = 2; i < length; i++) {
152 instr_out(data, offset, i, "dword %d\n", i);
157 dump_avc_bsd_slice_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
163 dump_avc_bsd_buf_base_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
167 instr_out(data, offset, 1, "BSD row store base address\n");
168 instr_out(data, offset, 2, "MPR row store base address\n");
169 instr_out(data, offset, 3, "AVC-IT command buffer base address\n");
170 instr_out(data, offset, 4, "AVC-IT data buffer: 0x%08x, write offset: 0x%x\n",
171 data[4] & 0xFFFFF000, data[4] & 0xFC0);
172 instr_out(data, offset, 5, "ILDB data buffer\n");
174 for (i = 6; i < 38; i++) {
175 instr_out(data, offset, i, "Direct MV read base address for reference frame %d\n", i - 6);
178 instr_out(data, offset, 38, "direct mv wr0 top\n");
179 instr_out(data, offset, 39, "direct mv wr0 bottom\n");
181 for (i = 40; i < 74; i++) {
182 instr_out(data, offset, i, "POC List %d\n", i - 40);
187 dump_bsd_ind_obj_base_addr(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
189 instr_out(data, offset, 1, "AVC indirect object base address\n");
190 instr_out(data, offset, 2, "AVC Indirect Object Access Upper Bound\n");
194 dump_ironlake_avc_bsd_object(unsigned int *data, unsigned int offset, int *failures)
196 int slice_type = data[3] & 0xf;
197 int i, is_phantom = ((data[1] & 0x3fffff) == 0);
200 instr_out(data, offset, 1, "Encrypted: %d, bitsteam length: %d\n", data[1] >> 31, data[1] & 0x3fffff);
201 instr_out(data, offset, 2, "Indirect Data Start Address: %d\n", data[2] & 0x1fffffff);
202 instr_out(data, offset, 3, "%s Slice\n", slice_type == 0 ? "P" : slice_type == 1 ? "B" : "I");
203 instr_out(data, offset, 4,
204 "Num_Ref_Idx_L1: %d,"
205 "Num_Ref_Idx_L0: %d,"
206 "Log2WeightDenomChroma: %d,"
207 "Log2WeightDenomLuma: %d"
209 (data[4] >> 24) & 0x3f,
210 (data[4] >> 16) & 0x3f,
211 (data[4] >> 8) & 0x3,
212 (data[4] >> 0) & 0x3);
213 instr_out(data, offset, 5,
214 "WeightedPredIdc: %d,"
215 "DirectPredType: %d,"
216 "DisableDeblockingFilter: %d,"
219 "SliceBetaOffsetDiv2: %d,"
220 "SliceAlphaC0OffsetDiv2: %d"
222 (data[5] >> 30) & 0x3,
223 (data[5] >> 29) & 0x1,
224 (data[5] >> 27) & 0x3,
225 (data[5] >> 24) & 0x3,
226 (data[5] >> 16) & 0x3f,
227 (data[5] >> 8) & 0xf,
228 (data[5] >> 0) & 0xf);
229 instr_out(data, offset, 6,
230 "Slice_MB_Start_Vert_Pos: %d,"
231 "Slice_MB_Start_Hor_Pos: %d,"
232 "Slice_Start_Mb_Num: %d"
234 (data[6] >> 24) & 0xff,
235 (data[6] >> 16) & 0xff,
236 (data[6] >> 0) & 0x7fff);
237 instr_out(data, offset, 7,
238 "Fix_Prev_Mb_Skipped: %d,"
239 "First_MB_Bit_Offset: %d"
241 (data[7] >> 7) & 0x1,
242 (data[7] >> 0) & 0x7);
244 for (i = 8; i < 16; i++)
245 instr_out(data, offset, i, "dword %d\n", i);
247 instr_out(data, offset, 1, "phantom slice\n");
249 for (i = 2; i < 6; i++)
250 instr_out(data, offset, i, "dword %d\n", i);
252 instr_out(data, offset, 6,
253 "Slice_Start_Mb_Num: %d"
255 (data[6] >> 0) & 0x7fff);
257 for (i = 7; i < 16; i++)
258 instr_out(data, offset, i, "dword %d\n", i);
264 dump_g4x_avc_bsd_object(unsigned int *data, unsigned int offset, int *failures)
270 dump_avc_bsd_object(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
272 if (IS_IRONLAKE(device))
273 dump_ironlake_avc_bsd_object(data, offset, failures);
275 dump_g4x_avc_bsd_object(data, offset, failures);
279 dump_bsd_avc(unsigned int *data, unsigned int offset, int count, unsigned int device, int *failures)
281 unsigned int subopcode;
285 unsigned int subopcode;
289 void (*detail)(unsigned int *data, unsigned int offset, unsigned int device, int *failures);
291 { 0x00, 0x06, 0x06, "AVC_BSD_IMG_STATE", dump_avc_bsd_img_state },
292 { 0x01, 0x02, 0x3a, "AVC_BSD_QM_STATE", dump_avc_bsd_qm_state },
293 { 0x02, 0x02, 0xd2, "AVC_BSD_SLICE_STATE", NULL },
294 { 0x03, 0x4a, 0x4a, "AVC_BSD_BUF_BASE_STATE", dump_avc_bsd_buf_base_state },
295 { 0x04, 0x03, 0x03, "BSD_IND_OBJ_BASE_ADDR", dump_bsd_ind_obj_base_addr },
296 { 0x08, 0x08, 0x10, "AVC_BSD_OBJECT", dump_avc_bsd_object },
299 subopcode = ((data[0] & MASK_GFXPIPE_SUBOPCODE) >> SHIFT_GFXPIPE_SUBOPCODE);
301 for (i = 0; i < sizeof(avc_commands) / sizeof(avc_commands[0]); i++) {
302 if (subopcode == avc_commands[i].subopcode) {
305 length = (data[0] & MASK_GFXPIPE_LENGTH) >> SHIFT_GFXPIPE_LENGTH;
307 instr_out(data, offset, 0, "%s\n", avc_commands[i].name);
309 if (length < avc_commands[i].min_len ||
310 length > avc_commands[i].max_len) {
311 fprintf(gout, "Bad length(%d) in %s [%d, %d]\n",
312 length, avc_commands[i].name,
313 avc_commands[i].min_len,
314 avc_commands[i].max_len);
317 if (length - 1 >= count)
318 BUFFER_FAIL(count, length, avc_commands[i].name);
320 if (avc_commands[i].detail)
321 avc_commands[i].detail(data, offset, device, failures);
323 for (index = 1; index < length; index++)
324 instr_out(data, offset, index, "dword %d\n", index);
331 instr_out(data, offset, 0, "UNKNOWN AVC COMMAND\n");
337 dump_gfxpipe_bsd(unsigned int *data, unsigned int offset, int count, unsigned int device, int *failures)
341 switch ((data[0] & MASK_GFXPIPE_OPCODE) >> SHIFT_GFXPIPE_OPCODE) {
343 length = dump_bsd_avc(data, offset, count, device, failures);
349 instr_out(data, offset, 0, "UNKNOWN BSD OPCODE\n");
357 dump_mfx_mode_select(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
359 instr_out(data, offset, 1,
360 "decoder mode: %d(%s),"
361 "post deblocking output enable %d,"
362 "pre deblocking output enable %d,"
363 "codec select: %d(%s),"
364 "standard select: %d(%s)"
366 (data[1] >> 16) & 0x1, ((data[1] >> 16) & 0x1) ? "IT" : "VLD",
367 (data[1] >> 9) & 0x1,
368 (data[1] >> 8) & 0x1,
369 (data[1] >> 4) & 0x1, ((data[1] >> 4) & 0x1) ? "Encode" : "Decode",
370 (data[1] >> 0) & 0x3, ((data[1] >> 0) & 0x3) == 0 ? "MPEG2" :
371 ((data[1] >> 0) & 0x3) == 1 ? "VC1" :
372 ((data[1] >> 0) & 0x3) == 2 ? "AVC" : "Reserved");
373 instr_out(data, offset, 2, "dword 02\n");
374 instr_out(data, offset, 3, "dword 03\n");
378 dump_mfx_surface_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
380 instr_out(data, offset, 1, "dword 01\n");
381 instr_out(data, offset, 2, "dword 02\n");
382 instr_out(data, offset, 3, "dword 03\n");
383 instr_out(data, offset, 4, "dword 04\n");
384 instr_out(data, offset, 5, "dword 05\n");
388 dump_mfx_pipe_buf_addr_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
390 instr_out(data, offset, 1, "dword 01\n");
391 instr_out(data, offset, 2, "dword 02\n");
392 instr_out(data, offset, 3, "dword 03\n");
393 instr_out(data, offset, 4, "dword 04\n");
394 instr_out(data, offset, 5, "dword 05\n");
395 instr_out(data, offset, 6, "dword 06\n");
396 instr_out(data, offset, 7, "dword 07\n");
397 instr_out(data, offset, 8, "dword 08\n");
398 instr_out(data, offset, 9, "dword 09\n");
399 instr_out(data, offset, 10, "dword 10\n");
400 instr_out(data, offset, 11, "dword 11\n");
401 instr_out(data, offset, 12, "dword 12\n");
402 instr_out(data, offset, 13, "dword 13\n");
403 instr_out(data, offset, 14, "dword 14\n");
404 instr_out(data, offset, 15, "dword 15\n");
405 instr_out(data, offset, 16, "dword 16\n");
406 instr_out(data, offset, 17, "dword 17\n");
407 instr_out(data, offset, 18, "dword 18\n");
408 instr_out(data, offset, 19, "dword 19\n");
409 instr_out(data, offset, 20, "dword 20\n");
410 instr_out(data, offset, 21, "dword 21\n");
411 instr_out(data, offset, 22, "dword 22\n");
412 instr_out(data, offset, 24, "dword 23\n");
416 dump_mfx_ind_obj_base_addr_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
418 instr_out(data, offset, 1, "dword 01\n");
419 instr_out(data, offset, 2, "dword 02\n");
420 instr_out(data, offset, 3, "dword 03\n");
421 instr_out(data, offset, 4, "dword 04\n");
422 instr_out(data, offset, 5, "dword 05\n");
423 instr_out(data, offset, 6, "dword 06\n");
424 instr_out(data, offset, 7, "dword 07\n");
425 instr_out(data, offset, 8, "dword 08\n");
426 instr_out(data, offset, 9, "dword 09\n");
427 instr_out(data, offset, 10, "dword 10\n");
431 dump_mfx_bsp_buf_base_addr_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
433 instr_out(data, offset, 1, "dword 01\n");
434 instr_out(data, offset, 2, "dword 02\n");
435 instr_out(data, offset, 3, "dword 03\n");
439 dump_mfx_aes_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
441 instr_out(data, offset, 1, "dword 01\n");
442 instr_out(data, offset, 2, "dword 02\n");
443 instr_out(data, offset, 3, "dword 03\n");
444 instr_out(data, offset, 4, "dword 04\n");
445 instr_out(data, offset, 5, "dword 05\n");
446 instr_out(data, offset, 6, "dword 06\n");
450 dump_mfx_state_pointer(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
452 instr_out(data, offset, 1, "dword 01\n");
456 dump_mfx_common(unsigned int *data, unsigned int offset, int count, unsigned int device, int *failures)
458 unsigned int subopcode;
462 unsigned int subopcode;
466 void (*detail)(unsigned int *data, unsigned int offset, unsigned int device, int *failures);
467 } mfx_common_commands[] = {
468 { SUBOPCODE_MFX(0, 0), 0x04, 0x04, "MFX_PIPE_MODE_SELECT", dump_mfx_mode_select },
469 { SUBOPCODE_MFX(0, 1), 0x06, 0x06, "MFX_SURFACE_STATE", dump_mfx_surface_state },
470 { SUBOPCODE_MFX(0, 2), 0x18, 0x18, "MFX_PIPE_BUF_ADDR_STATE", dump_mfx_pipe_buf_addr_state },
471 { SUBOPCODE_MFX(0, 3), 0x0b, 0x0b, "MFX_IND_OBJ_BASE_ADDR_STATE", dump_mfx_ind_obj_base_addr_state },
472 { SUBOPCODE_MFX(0, 4), 0x04, 0x04, "MFX_BSP_BUF_BASE_ADDR_STATE", dump_mfx_bsp_buf_base_addr_state },
473 { SUBOPCODE_MFX(0, 5), 0x07, 0x07, "MFX_AES_STATE", dump_mfx_aes_state },
474 { SUBOPCODE_MFX(0, 6), 0x00, 0x00, "MFX_STATE_POINTER", dump_mfx_state_pointer },
477 subopcode = ((data[0] & MASK_GFXPIPE_SUBOPCODE) >> SHIFT_GFXPIPE_SUBOPCODE);
479 for (i = 0; i < ARRAY_ELEMS(mfx_common_commands); i++) {
480 if (subopcode == mfx_common_commands[i].subopcode) {
483 length = (data[0] & MASK_GFXPIPE_LENGTH) >> SHIFT_GFXPIPE_LENGTH;
485 instr_out(data, offset, 0, "%s\n", mfx_common_commands[i].name);
487 if (length < mfx_common_commands[i].min_len ||
488 length > mfx_common_commands[i].max_len) {
489 fprintf(gout, "Bad length(%d) in %s [%d, %d]\n",
490 length, mfx_common_commands[i].name,
491 mfx_common_commands[i].min_len,
492 mfx_common_commands[i].max_len);
495 if (length - 1 >= count)
496 BUFFER_FAIL(count, length, mfx_common_commands[i].name);
498 if (mfx_common_commands[i].detail)
499 mfx_common_commands[i].detail(data, offset, device, failures);
501 for (index = 1; index < length; index++)
502 instr_out(data, offset, index, "dword %d\n", index);
509 instr_out(data, offset, 0, "UNKNOWN MFX COMMON COMMAND\n");
515 dump_mfx_avc_img_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
517 instr_out(data, offset, 1, "dword 01\n");
518 instr_out(data, offset, 2, "dword 02\n");
519 instr_out(data, offset, 3, "dword 03\n");
520 instr_out(data, offset, 4, "dword 04\n");
521 instr_out(data, offset, 5, "dword 05\n");
522 instr_out(data, offset, 6, "dword 06\n");
523 instr_out(data, offset, 7, "dword 07\n");
524 instr_out(data, offset, 8, "dword 08\n");
525 instr_out(data, offset, 9, "dword 09\n");
526 instr_out(data, offset, 10, "dword 10\n");
527 instr_out(data, offset, 11, "dword 11\n");
528 instr_out(data, offset, 12, "dword 12\n");
532 dump_mfx_avc_qm_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
534 unsigned int length = ((data[0] & MASK_GFXPIPE_LENGTH) >> SHIFT_GFXPIPE_LENGTH) + 2;
537 instr_out(data, offset, 1, "user default: %02x, QM list present: %02x\n",
538 (data[1] >> 8) & 0xff, data[1] & 0xff);
540 for (i = 2; i < length; i++) {
541 instr_out(data, offset, i, "dword %d\n", i);
546 dump_mfx_avc_directmode_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
550 for (i = 1; i < 33; i++) {
551 instr_out(data, offset, i, "Direct MV Buffer Base Address for Picture %d\n", i - 1);
554 for (i = 33; i < 35; i++) {
555 instr_out(data, offset, i, "Direct MV Buffer Base Address for Current Decoding Frame/Field\n");
558 for (i = 35; i < 69; i++) {
559 instr_out(data, offset, i, "POC List\n");
564 dump_mfx_avc_slice_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
566 instr_out(data, offset, 1, "dword 01\n");
567 instr_out(data, offset, 2, "dword 02\n");
568 instr_out(data, offset, 3, "dword 03\n");
569 instr_out(data, offset, 4, "dword 04\n");
570 instr_out(data, offset, 5, "dword 05\n");
571 instr_out(data, offset, 6, "dword 06\n");
572 instr_out(data, offset, 7, "dword 07\n");
573 instr_out(data, offset, 8, "dword 08\n");
574 instr_out(data, offset, 9, "dword 09\n");
578 dump_mfx_avc_ref_idx_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
580 instr_out(data, offset, 1, "dword 01\n");
581 instr_out(data, offset, 2, "dword 02\n");
582 instr_out(data, offset, 3, "dword 03\n");
583 instr_out(data, offset, 4, "dword 04\n");
584 instr_out(data, offset, 5, "dword 05\n");
585 instr_out(data, offset, 6, "dword 06\n");
586 instr_out(data, offset, 7, "dword 07\n");
587 instr_out(data, offset, 8, "dword 08\n");
588 instr_out(data, offset, 9, "dword 09\n");
592 dump_mfx_avc_weightoffset_state(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
596 instr_out(data, offset, 1,
597 "Weight and Offset L%d table\n",
598 (data[1] >> 0) & 0x1);
600 for (i = 2; i < 31; i++) {
601 instr_out(data, offset, i, "dword %d\n", i);
606 dump_mfd_bsd_object(unsigned int *data, unsigned int offset, unsigned int device, int *failures)
608 int is_phantom_slice = ((data[1] & 0x3fffff) == 0);
610 if (is_phantom_slice) {
611 instr_out(data, offset, 1, "phantom slice\n");
612 instr_out(data, offset, 2, "dword 02\n");
613 instr_out(data, offset, 3, "dword 03\n");
614 instr_out(data, offset, 4, "dword 04\n");
615 instr_out(data, offset, 5, "dword 05\n");
617 instr_out(data, offset, 1, "Indirect BSD Data Length: %d\n", data[1] & 0x3fffff);
618 instr_out(data, offset, 2, "Indirect BSD Data Start Address: 0x%08x\n", data[2] & 0x1fffffff);
619 instr_out(data, offset, 3, "dword 03\n");
620 instr_out(data, offset, 4,
621 "First_MB_Byte_Offset of Slice Data from Slice Header: 0x%08x,"
622 "slice header skip mode: %d"
625 (data[4] >> 6) & 0x1);
626 instr_out(data, offset, 5, "dword 05\n");
631 dump_mfx_avc(unsigned int *data, unsigned int offset, int count, unsigned int device, int *failures)
633 unsigned int subopcode;
637 unsigned int subopcode;
641 void (*detail)(unsigned int *data, unsigned int offset, unsigned int device, int *failures);
642 } mfx_avc_commands[] = {
643 { SUBOPCODE_MFX(0, 0), 0x0d, 0x0d, "MFX_AVC_IMG_STATE", dump_mfx_avc_img_state },
644 { SUBOPCODE_MFX(0, 1), 0x02, 0x3a, "MFX_AVC_QM_STATE", dump_mfx_avc_qm_state },
645 { SUBOPCODE_MFX(0, 2), 0x45, 0x45, "MFX_AVC_DIRECTMODE_STATE", dump_mfx_avc_directmode_state },
646 { SUBOPCODE_MFX(0, 3), 0x0b, 0x0b, "MFX_AVC_SLICE_STATE", dump_mfx_avc_slice_state },
647 { SUBOPCODE_MFX(0, 4), 0x0a, 0x0a, "MFX_AVC_REF_IDX_STATE", dump_mfx_avc_ref_idx_state },
648 { SUBOPCODE_MFX(0, 5), 0x32, 0x32, "MFX_AVC_WEIGHTOFFSET_STATE", dump_mfx_avc_weightoffset_state },
649 { SUBOPCODE_MFX(1, 8), 0x06, 0x06, "MFD_AVC_BSD_OBJECT", dump_mfd_bsd_object },
652 subopcode = ((data[0] & MASK_GFXPIPE_SUBOPCODE) >> SHIFT_GFXPIPE_SUBOPCODE);
654 for (i = 0; i < ARRAY_ELEMS(mfx_avc_commands); i++) {
655 if (subopcode == mfx_avc_commands[i].subopcode) {
658 length = (data[0] & MASK_GFXPIPE_LENGTH) >> SHIFT_GFXPIPE_LENGTH;
660 instr_out(data, offset, 0, "%s\n", mfx_avc_commands[i].name);
662 if (length < mfx_avc_commands[i].min_len ||
663 length > mfx_avc_commands[i].max_len) {
664 fprintf(gout, "Bad length(%d) in %s [%d, %d]\n",
665 length, mfx_avc_commands[i].name,
666 mfx_avc_commands[i].min_len,
667 mfx_avc_commands[i].max_len);
670 if (length - 1 >= count)
671 BUFFER_FAIL(count, length, mfx_avc_commands[i].name);
673 if (mfx_avc_commands[i].detail)
674 mfx_avc_commands[i].detail(data, offset, device, failures);
676 for (index = 1; index < length; index++)
677 instr_out(data, offset, index, "dword %d\n", index);
684 instr_out(data, offset, 0, "UNKNOWN MFX AVC COMMAND\n");
690 dump_gfxpipe_mfx(unsigned int *data, unsigned int offset, int count, unsigned int device, int *failures)
694 switch ((data[0] & MASK_GFXPIPE_OPCODE) >> SHIFT_GFXPIPE_OPCODE) {
695 case OPCODE_MFX_COMMON:
696 length = dump_mfx_common(data, offset, count, device, failures);
700 length = dump_mfx_avc(data, offset, count, device, failures);
706 instr_out(data, offset, 0, "UNKNOWN MFX OPCODE\n");
714 dump_gfxpipe(unsigned int *data, unsigned int offset, int count, unsigned int device, int *failures)
718 switch ((data[0] & MASK_GFXPIPE_SUBTYPE) >> SHIFT_GFXPIPE_SUBTYPE) {
720 length = dump_gfxpipe_3d(data, offset, count, device, failures);
725 length = dump_gfxpipe_mfx(data, offset, count, device, failures);
727 length = dump_gfxpipe_bsd(data, offset, count, device, failures);
734 instr_out(data, offset, 0, "UNKNOWN GFXPIPE COMMAND\n");
741 int intel_batchbuffer_dump(unsigned int *data, unsigned int offset, int count, unsigned int device)
746 gout = fopen("/tmp/bsd_command_dump.txt", "w+");
748 while (index < count) {
749 switch ((data[index] & MASK_CMD_TYPE) >> SHIFT_CMD_TYPE) {
751 index += dump_mi(data + index, offset + index * 4,
752 count - index, device, &failures);
755 case CMD_TYPE_GFXPIPE:
756 index += dump_gfxpipe(data + index, offset + index * 4,
757 count - index, device, &failures);
761 instr_out(data, offset, index, "UNKNOWN COMMAND\n");