move display resolution and device path to Makefile; dump FIFO content to console...
[ps3freebsd_ps3gpu_test.git] / reset_gpu_state.c
blob6bff9dc99964dd29f68439ead4b4fa0deff3986c
1 /*-
2 * Copyright (C) 2011, 2012 glevand <geoffrey.levand@mail.ru>
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer,
10 * without modification, immediately at the beginning of the file.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * $FreeBSD$
29 #include <stdint.h>
31 uint32_t reset_gpu_state[] = {
32 0x00042000,
33 0x31337303,
35 0x00042180,
36 0x66604200,
38 0x00082184,
39 0xfeed0001,
40 0xfeed0000,
42 0x00044000,
43 0x3137c0de,
45 0x00044180,
46 0x66604200,
48 0x00084184,
49 0xfeed0000,
50 0xfeed0001,
52 0x00046000,
53 0x313371c3,
55 0x00046180,
56 0x66604200,
58 0x00046184,
59 0xfeed0000,
61 0x00046188,
62 0xfeed0000,
64 0x0004a000,
65 0x31337808,
67 0x0020a180,
68 0x66604200,
69 0x00000000,
70 0x00000000,
71 0x00000000,
72 0x00000000,
73 0x00000000,
74 0x00000000,
75 0x313371c3,
77 0x0008a2fc,
78 0x00000003,
79 0x00000004,
81 0x00048000,
82 0x31337a73,
84 0x00048180,
85 0x66604200,
87 0x00048184,
88 0xfeed0000,
90 0x0004c000,
91 0x3137af00,
93 0x0004c180,
94 0x66604200,
96 0x00000000,
98 0x00020000,
101 int reset_gpu_state_size = sizeof(reset_gpu_state);
103 uint32_t reset_gpu_state_3d[] = {
104 /* These commands are executed every time after flip to reset GPU state !!! */
106 /* program 1 */
108 0x00040000,
109 0x31337000,
111 0x003c0180,
112 0x66604200,
113 0xfeed0000,
114 0xfeed0001,
115 0xfeed0000,
116 0x00000000,
117 0xfeed0000,
118 0xfeed0000,
119 0xfeed0000,
120 0xfeed0001,
121 0x66606660,
122 0x66626660,
123 0x00000000,
124 0x00000000,
125 0xfeed0000,
126 0xfeed0000,
128 0x00040060,
129 0x66616661,
131 0x00340200,
132 0x00000000,
133 0x00000000,
134 0x00000121,
135 0x00000040,
136 0x00000000,
137 0x00000000,
138 0x00000000,
139 0x00000040,
140 0x00000001,
141 0x00000080,
142 0x00000100,
143 0x00000040,
144 0x00000000,
146 0x00100280,
147 0x00000040,
148 0x00000040,
149 0x00000000,
150 0x00000000,
152 0x00041d80,
153 0x00000003,
155 0x004802b8,
156 0x00000000,
157 0x00000000,
158 0x0fff0000,
159 0x0fff0000,
160 0x0fff0000,
161 0x0fff0000,
162 0x0fff0000,
163 0x0fff0000,
164 0x0fff0000,
165 0x0fff0000,
166 0x0fff0000,
167 0x0fff0000,
168 0x0fff0000,
169 0x0fff0000,
170 0x0fff0000,
171 0x0fff0000,
172 0x0fff0000,
173 0x0fff0000,
175 0x00081d98,
176 0x0fff0000,
177 0x0fff0000,
179 0x00041da4,
180 0x00000000,
182 0x000403b0,
183 0x00100000,
185 0x00041454,
186 0x00000000,
188 0x00041ff4,
189 0x003fffff,
191 0x00181fc0,
192 0x00000000,
193 0x06144321,
194 0xedcba987,
195 0x0000006f,
196 0x00171615,
197 0x001b1a19,
199 0x00280b40,
200 0x00000000,
201 0x00000000,
202 0x00000000,
203 0x00000000,
204 0x00000000,
205 0x00000000,
206 0x00000000,
207 0x00000000,
208 0x00000000,
209 0x00000000,
211 0x00040a0c,
212 0x00000000,
214 0x000c0a60,
215 0x00000000,
216 0x00000000,
217 0x00000000,
219 0x00080a78,
220 0x00000000,
221 0x00000000,
223 0x00041428,
224 0x00000001,
226 0x00041d88,
227 0x00001000,
229 0x00041e94,
230 0x00000011,
232 0x00041450,
233 0x00080003,
235 0x00041d64,
236 0x02000000,
238 0x0004145c,
239 0x00000001,
241 0x00041fe0,
242 0x00000001,
244 0x00400b00,
245 0x00002dc8,
246 0x00002dc8,
247 0x00002dc8,
248 0x00002dc8,
249 0x00002dc8,
250 0x00002dc8,
251 0x00002dc8,
252 0x00002dc8,
253 0x00002dc8,
254 0x00002dc8,
255 0x00002dc8,
256 0x00002dc8,
257 0x00002dc8,
258 0x00002dc8,
259 0x00002dc8,
260 0x00002dc8,
262 0x001008cc,
263 0x00000800,
264 0x00000000,
265 0x00000000,
266 0x00000000,
268 0x00100240,
269 0x0000ffff,
270 0x00000000,
271 0x00000000,
272 0x00000000,
274 0x00c003c0,
275 0x00010101,
276 0x00010101,
277 0x00010101,
278 0x00010101,
279 0x00010101,
280 0x00010101,
281 0x00010101,
282 0x00010101,
283 0x00010101,
284 0x00010101,
285 0x00010101,
286 0x00010101,
287 0x00010101,
288 0x00010101,
289 0x00010101,
290 0x00010101,
291 0x00007421,
292 0x00007421,
293 0x00007421,
294 0x00007421,
295 0x00007421,
296 0x00007421,
297 0x00007421,
298 0x00007421,
299 0x00007421,
300 0x00007421,
301 0x00007421,
302 0x00007421,
303 0x00007421,
304 0x00007421,
305 0x00007421,
306 0x00007421,
307 0x9aabaa98,
308 0x66666789,
309 0x98766666,
310 0x89aabaa9,
311 0x99999999,
312 0x88888889,
313 0x98888888,
314 0x99999999,
315 0x56676654,
316 0x33333345,
317 0x54333333,
318 0x45667665,
319 0xaabbba99,
320 0x66667899,
321 0x99876666,
322 0x99abbbaa,
324 0x00081738,
325 0x00000000,
326 0x00000000,
328 0x0004e000,
329 0xcafebabe,
331 /* program 2 */
333 0x00080308,
334 0x00000207,
335 0x00000000,
337 0x00040304,
338 0x00000000,
340 0x000c0350,
341 0x00000207,
342 0x00000000,
343 0x000000ff,
345 0x0004034c,
346 0x000000ff,
348 0x000c035c,
349 0x00001e00,
350 0x00001e00,
351 0x00001e00,
353 0x0004031c,
354 0x00000000,
356 0x0004037c,
357 0x00000000,
359 0x00040310, /* blend control */
360 0x00000000, /* disable */
362 0x0004036c,
363 0x00000000,
365 0x00040320,
366 0x80068006,
368 0x00080314,
369 0x00010001,
370 0x00000000,
372 0x00041d8c,
373 0xffffff00,
375 0x00041d94,
376 0x00000000,
378 0x00040100,
379 0x00000000,
381 0x00040324,
382 0x01010101,
384 0x0004183c,
385 0x00000000,
387 0x00041830,
388 0x00000405,
390 0x00080384,
391 0x00000000,
392 0x3f800000,
394 0x00040380,
395 0x00000000,
397 0x00040a6c,
398 0x00000201,
400 0x00040a70,
401 0x00000001,
403 0x00040a74,
404 0x00000000,
406 0x00040300,
407 0x00000001,
409 0x00041fec,
410 0x00000000,
412 0x00041fc0,
413 0x00000000,
415 0x00041834, /* set front face mode */
416 0x00000901, /* ccw */
418 0x000403b8,
419 0x00000008,
421 0x00040374, /* logic op control */
422 0x00000000, /* disable */
424 0x00040378, /* set logic op */
425 0x00001503, /* copy */
427 0x00041ee0,
428 0x3f800000,
430 0x00040a68,
431 0x00000000,
433 0x00080a78,
434 0x00000000,
435 0x00000000,
437 0x00041dac,
438 0x00000000,
440 0x00041db0,
441 0xffffffff,
443 0x000808c0,
444 0x10000000,
445 0x10000000,
447 0x00040368, /* set shade model */
448 0x00001d01, /* smooth */
450 0x000c0330,
451 0x00000207,
452 0x00000000,
453 0x000000ff,
455 0x0004032c,
456 0x000000ff,
458 0x000c033c,
459 0x00001e00,
460 0x00001e00,
461 0x00001e00,
463 0x00040328,
464 0x00000000,
466 0x00041a08,
467 0x00030101,
469 0x00041a1c,
470 0x00000000,
472 0x00041a0c,
473 0x00060000,
475 0x00041a14,
476 0x02052000,
478 0x00041a28,
479 0x00030101,
481 0x00041a3c,
482 0x00000000,
484 0x00041a2c,
485 0x00060000,
487 0x00041a34,
488 0x02052000,
490 0x00041a48,
491 0x00030101,
493 0x00041a5c,
494 0x00000000,
496 0x00041a4c,
497 0x00060000,
499 0x00041a54,
500 0x02052000,
502 0x00041a68,
503 0x00030101,
505 0x00041a7c,
506 0x00000000,
508 0x00041a6c,
509 0x00060000,
511 0x00041a74,
512 0x02052000,
514 0x00041a88,
515 0x00030101,
517 0x00041a9c,
518 0x00000000,
520 0x00041a8c,
521 0x00060000,
523 0x00041a94,
524 0x02052000,
526 0x00041aa8,
527 0x00030101,
529 0x00041abc,
530 0x00000000,
532 0x00041aac,
533 0x00060000,
535 0x00041ab4,
536 0x02052000,
538 0x00041ac8,
539 0x00030101,
541 0x00041adc,
542 0x00000000,
544 0x00041acc,
545 0x00060000,
547 0x00041ad4,
548 0x02052000,
550 0x00041ae8,
551 0x00030101,
553 0x00041afc,
554 0x00000000,
556 0x00041aec,
557 0x00060000,
559 0x00041af4,
560 0x02052000,
562 0x00041b08,
563 0x00030101,
565 0x00041b1c,
566 0x00000000,
568 0x00041b0c,
569 0x00060000,
571 0x00041b14,
572 0x02052000,
574 0x00041b28,
575 0x00030101,
577 0x00041b3c,
578 0x00000000,
580 0x00041b2c,
581 0x00060000,
583 0x00041b34,
584 0x02052000,
586 0x00041b48,
587 0x00030101,
589 0x00041b5c,
590 0x00000000,
592 0x00041b4c,
593 0x00060000,
595 0x00041b54,
596 0x02052000,
598 0x00041b68,
599 0x00030101,
601 0x00041b7c,
602 0x00000000,
604 0x00041b6c,
605 0x00060000,
607 0x00041b74,
608 0x02052000,
610 0x00041b88,
611 0x00030101,
613 0x00041b9c,
614 0x00000000,
616 0x00041b8c,
617 0x00060000,
619 0x00041b94,
620 0x02052000,
622 0x00041ba8,
623 0x00030101,
625 0x00041bbc,
626 0x00000000,
628 0x00041bac,
629 0x00060000,
631 0x00041bb4,
632 0x02052000,
634 0x00041bc8,
635 0x00030101,
637 0x00041bdc,
638 0x00000000,
640 0x00041bcc,
641 0x00060000,
643 0x00041bd4,
644 0x02052000,
646 0x00041be8,
647 0x00030101,
649 0x00041bfc,
650 0x00000000,
652 0x00041bec,
653 0x00060000,
655 0x00041bf4,
656 0x02052000,
658 0x00040348,
659 0x00000000,
661 0x00041740,
662 0x00000002,
664 0x00041680,
665 0x00000000,
667 0x00041744,
668 0x00000002,
670 0x00041684,
671 0x00000000,
673 0x00041748,
674 0x00000002,
676 0x00041688,
677 0x00000000,
679 0x0004174c,
680 0x00000002,
682 0x0004168c,
683 0x00000000,
685 0x00041750,
686 0x00000002,
688 0x00041690,
689 0x00000000,
691 0x00041754,
692 0x00000002,
694 0x00041694,
695 0x00000000,
697 0x00041758,
698 0x00000002,
700 0x00041698,
701 0x00000000,
703 0x0004175c,
704 0x00000002,
706 0x0004169c,
707 0x00000000,
709 0x00041760,
710 0x00000002,
712 0x000416a0,
713 0x00000000,
715 0x00041764,
716 0x00000002,
718 0x000416a4,
719 0x00000000,
721 0x00041768,
722 0x00000002,
724 0x000416a8,
725 0x00000000,
727 0x0004176c,
728 0x00000002,
730 0x000416ac,
731 0x00000000,
733 0x00041770,
734 0x00000002,
736 0x000416b0,
737 0x00000000,
739 0x00041774,
740 0x00000002,
742 0x000416b4,
743 0x00000000,
745 0x00041778,
746 0x00000002,
748 0x000416b8,
749 0x00000000,
751 0x0004177c,
752 0x00000002,
754 0x000416bc,
755 0x00000000,
757 0x00080a00,
758 0x10000000,
759 0x10000000,
760 0x00080394,
761 0x00000000,
762 0x3f800000,
764 0x00200a20,
765 0x45000000,
766 0x45000000,
767 0x3f000000,
768 0x00000000,
769 0x45000000,
770 0x45000000,
771 0x3f000000,
772 0x00000000,
774 0x00200a20,
775 0x45000000,
776 0x45000000,
777 0x3f000000,
778 0x00000000,
779 0x45000000,
780 0x45000000,
781 0x3f000000,
782 0x00000000,
784 0x00041d7c,
785 0xffff0000,
787 0x0004182c,
788 0x00001b02,
790 0x00041d90,
791 0x00000000,
793 0x00040370,
794 0x00000000,
796 0x00041828,
797 0x00001b02,
799 0x000403bc,
800 0x00000000,
802 0x00041db4,
803 0x00000000,
805 0x00041ee4,
806 0x00000000,
808 0x00041ee8,
809 0x00000000,
811 0x00041838,
812 0x00000000,
814 0x0004147c,
815 0x00000000,
817 0x00041e98,
818 0x01000000,
820 0x00041478,
821 0x00000000,
823 0x00041ff0,
824 0x0000ffff,
826 0x000417cc,
827 0x00000000,
829 0x00040908,
830 0x00000101,
832 0x0004091c,
833 0x00000000,
835 0x0004090c,
836 0x00060000,
838 0x00040914,
839 0x00000000,
841 0x00040928,
842 0x00000101,
844 0x0004093c,
845 0x00000000,
847 0x0004092c,
848 0x00060000,
850 0x00040934,
851 0x00000000,
853 0x00040948,
854 0x00000101,
856 0x0004095c,
857 0x00000000,
859 0x0004094c,
860 0x00060000,
862 0x00040954,
863 0x00000000,
865 0x00040968,
866 0x00000101,
868 0x0004097c,
869 0x00000000,
871 0x0004096c,
872 0x00060000,
874 0x00040974,
875 0x00000000,
877 0x00040238,
878 0x00000000,
880 0x00041d78,
881 0x00000001,
883 0x0004142c,
884 0x00000000,
886 0x00041ff8,
887 0x00000000,
889 0x00041fe8,
890 0x00000000,
892 /* program 3 */
894 0x00042000,
895 0x31337303,
897 0x000c2180,
898 0x66604200,
899 0xfeed0001,
900 0xfeed0000,
902 0x00046000,
903 0x313371c3,
905 0x000c6180,
906 0x66604200,
907 0xfeed0000,
908 0xfeed0000,
910 0x0004a000,
911 0x31337808,
913 0x0020a180,
914 0x66604200,
915 0x00000000,
916 0x00000000,
917 0x00000000,
918 0x00000000,
919 0x00000000,
920 0x00000000,
921 0x313371c3,
923 0x0008a2fc,
924 0x00000003,
925 0x00000004,
927 0x00048000,
928 0x31337a73,
930 0x00088180,
931 0x66604200,
932 0xfeed0000,
934 0x0004c000,
935 0x3137af00,
937 0x0004c180,
938 0x66604200,
940 0x00020000, /* return */
943 int reset_gpu_state_3d_size = sizeof(reset_gpu_state_3d);