mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
Compare commits
716 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8a1d07cdc | ||
|
|
574f95a35b | ||
|
|
cefcd843fc | ||
|
|
279c84f8e1 | ||
|
|
b69cfad8ef | ||
|
|
0bdc4394aa | ||
|
|
9e720d1e2b | ||
|
|
9a932e7dd5 | ||
|
|
62c0148472 | ||
|
|
97cedb311a | ||
|
|
776cdd60fa | ||
|
|
234b3df332 | ||
|
|
fa0744fb8e | ||
|
|
376216a2c0 | ||
|
|
88989bfbfd | ||
|
|
acb45459f5 | ||
|
|
8a93c5696f | ||
|
|
33a6948e68 | ||
|
|
cdd5bd538a | ||
|
|
15082d7777 | ||
|
|
5d2177d929 | ||
|
|
31642ceca9 | ||
|
|
e84335742d | ||
|
|
6d31ef8849 | ||
|
|
2fd24277c1 | ||
|
|
a60c30155e | ||
|
|
041d26670f | ||
|
|
0891a27f75 | ||
|
|
d25246a212 | ||
|
|
7853843b0b | ||
|
|
7cc6af8f85 | ||
|
|
7fcc47dd86 | ||
|
|
bca4f15f9d | ||
|
|
b644957cee | ||
|
|
2806b3a3c3 | ||
|
|
b166615067 | ||
|
|
ae2860d03d | ||
|
|
21b3464212 | ||
|
|
5c1f280988 | ||
|
|
7ec57692b1 | ||
|
|
d096fed8db | ||
|
|
15091cea54 | ||
|
|
7715d122c7 | ||
|
|
f18964ad44 | ||
|
|
b79edf1cb5 | ||
|
|
67c5509524 | ||
|
|
0770249da1 | ||
|
|
0ebc1ce7b2 | ||
|
|
90e9b60287 | ||
|
|
9a6e5458c9 | ||
|
|
3333553b24 | ||
|
|
1565c59714 | ||
|
|
92a1eda82a | ||
|
|
84e24a0142 | ||
|
|
d235c2d899 | ||
|
|
a26d7f615b | ||
|
|
3411729ca5 | ||
|
|
62c35753aa | ||
|
|
6967e66f74 | ||
|
|
9d96e23cb3 | ||
|
|
91fa8426f1 | ||
|
|
4af89576aa | ||
|
|
b5f8ef0106 | ||
|
|
3ca7d2d626 | ||
|
|
d37cd2e26d | ||
|
|
46527cab53 | ||
|
|
09d15c4bce | ||
|
|
68f7df6a52 | ||
|
|
4714a2fccb | ||
|
|
72145f4914 | ||
|
|
7247a1e5a4 | ||
|
|
343315c587 | ||
|
|
c557ea1b6f | ||
|
|
e9a4d9702c | ||
|
|
5e48e0d8c0 | ||
|
|
fa5aedc906 | ||
|
|
a3eb1655c6 | ||
|
|
8e9fd91cee | ||
|
|
e3d4b0e56a | ||
|
|
8d7227b1f9 | ||
|
|
d07b190322 | ||
|
|
e2d8b9d06b | ||
|
|
fecee19e1a | ||
|
|
f04efead96 | ||
|
|
b13ecb7cfd | ||
|
|
0fc9fa541f | ||
|
|
b824c2d31a | ||
|
|
65d4baa944 | ||
|
|
cd5a916f99 | ||
|
|
66b779a77d | ||
|
|
c62bd4ce97 | ||
|
|
2f95dc20c6 | ||
|
|
a284d49692 | ||
|
|
68c73c5be1 | ||
|
|
4fcbee9594 | ||
|
|
e9afe396b0 | ||
|
|
927d8ce237 | ||
|
|
461f3bd89f | ||
|
|
ed1791ab02 | ||
|
|
8b9af2c21b | ||
|
|
50872438e9 | ||
|
|
9b9e70e7e8 | ||
|
|
f832a07755 | ||
|
|
c3a632e612 | ||
|
|
bad7a94b6d | ||
|
|
7e9fbabd83 | ||
|
|
f5750628bf | ||
|
|
692ca763a1 | ||
|
|
9eb1731516 | ||
|
|
93776707a9 | ||
|
|
ebe6d3cbee | ||
|
|
46a0c2d5b6 | ||
|
|
85539c7bb9 | ||
|
|
78bc0a52ea | ||
|
|
13784d3576 | ||
|
|
d0371b0ff7 | ||
|
|
ae490125e9 | ||
|
|
bb9e1c5dbc | ||
|
|
f350f9905a | ||
|
|
040cf41468 | ||
|
|
e016e3280d | ||
|
|
3850227605 | ||
|
|
06e80f0c31 | ||
|
|
bb7e08cdce | ||
|
|
3b3fb28412 | ||
|
|
ba27d3ff79 | ||
|
|
6ac8ac6ae6 | ||
|
|
802081c3f8 | ||
|
|
2a2cd0dbca | ||
|
|
75a824e164 | ||
|
|
27d71f530a | ||
|
|
b53ffb65af | ||
|
|
e9ead0d33d | ||
|
|
be405eb705 | ||
|
|
95d1dcc521 | ||
|
|
96895a80c1 | ||
|
|
132726bc45 | ||
|
|
593f977621 | ||
|
|
582c23bae8 | ||
|
|
e1bfd95f63 | ||
|
|
715bc94bd9 | ||
|
|
e19c9a967d | ||
|
|
83c18d0cb6 | ||
|
|
bfd1a4c341 | ||
|
|
3878e94253 | ||
|
|
af07ee9abb | ||
|
|
22590754fd | ||
|
|
7205f10ec2 | ||
|
|
f7750f04a6 | ||
|
|
d58d84dbcf | ||
|
|
f025261ddf | ||
|
|
dcf57093f8 | ||
|
|
3c8591d371 | ||
|
|
d27ad8e23a | ||
|
|
3ecfb5b073 | ||
|
|
e9777cf325 | ||
|
|
7aa46e7eeb | ||
|
|
775f1a042d | ||
|
|
82f09bdb81 | ||
|
|
489fdc5566 | ||
|
|
3e4be2c800 | ||
|
|
f61bb99d3a | ||
|
|
0a8f71e76e | ||
|
|
833cb48050 | ||
|
|
09574b3937 | ||
|
|
e2d4e384e3 | ||
|
|
6bff6016ff | ||
|
|
09cb84f617 | ||
|
|
d920fe6c5e | ||
|
|
676402854b | ||
|
|
5eacc7c327 | ||
|
|
f29346f0b7 | ||
|
|
facada5d04 | ||
|
|
d945477369 | ||
|
|
f96e7a9156 | ||
|
|
fc22268fc2 | ||
|
|
7dbb9931ec | ||
|
|
b14145f3dc | ||
|
|
5a414d5711 | ||
|
|
7cc6f635fc | ||
|
|
a90695ef1f | ||
|
|
0e99c9b9a4 | ||
|
|
93becd5629 | ||
|
|
b13b398204 | ||
|
|
f531c0a405 | ||
|
|
3e8e1ed596 | ||
|
|
b90c2ec385 | ||
|
|
9ad85288a9 | ||
|
|
54858dffdb | ||
|
|
86597ab2da | ||
|
|
92e246a574 | ||
|
|
2a596bc2cc | ||
|
|
b28c11cb54 | ||
|
|
4ed9ade4fc | ||
|
|
2d474b3d3a | ||
|
|
ee4d0bf4b5 | ||
|
|
f8e8bd03cd | ||
|
|
509613d2e5 | ||
|
|
cf3395b9ce | ||
|
|
16a11b75a8 | ||
|
|
07d4a65a45 | ||
|
|
7bf8f6115f | ||
|
|
43e700036d | ||
|
|
ad1f5fc18d | ||
|
|
51f9ab8498 | ||
|
|
592e356932 | ||
|
|
e6f1f6eeb1 | ||
|
|
86782e7f3e | ||
|
|
4136545b6b | ||
|
|
c9099f3a2f | ||
|
|
a28328dd96 | ||
|
|
485f8a6d3a | ||
|
|
3c05d000f5 | ||
|
|
4850615327 | ||
|
|
5702b525d1 | ||
|
|
b2e57e1bde | ||
|
|
c987c62819 | ||
|
|
4aa8c756c2 | ||
|
|
37aa481dd0 | ||
|
|
0b5c070ad1 | ||
|
|
7b1412004f | ||
|
|
3270a38d69 | ||
|
|
1bc77620d9 | ||
|
|
2ef5490297 | ||
|
|
19b3bd151e | ||
|
|
d8774d2f5a | ||
|
|
e5cb313d92 | ||
|
|
ac0138a7e1 | ||
|
|
6e5fbe8991 | ||
|
|
56ec842c00 | ||
|
|
c3420a0a6e | ||
|
|
8d13877002 | ||
|
|
065f7d6cc7 | ||
|
|
03a7c745c9 | ||
|
|
4269f16bcd | ||
|
|
55c9cb45ac | ||
|
|
4f825641ce | ||
|
|
ade2b4baea | ||
|
|
1e1091b365 | ||
|
|
93e1a7047c | ||
|
|
99554f5622 | ||
|
|
b09240702e | ||
|
|
fbf7f91e4f | ||
|
|
9a0d655788 | ||
|
|
aa77d156a9 | ||
|
|
493e95d9d6 | ||
|
|
4aaf6ba69e | ||
|
|
88f8ef0244 | ||
|
|
312a583092 | ||
|
|
c8e0390aaf | ||
|
|
8e2af39c06 | ||
|
|
606cbb3883 | ||
|
|
377746f155 | ||
|
|
5f11ba0445 | ||
|
|
be7d4c3c93 | ||
|
|
ec53e8949a | ||
|
|
f04cc7aa08 | ||
|
|
b994d0ad70 | ||
|
|
68b2fee9be | ||
|
|
82b9c9781c | ||
|
|
6d15eac2c6 | ||
|
|
faa740a8dd | ||
|
|
872faf2abe | ||
|
|
bc85d6518b | ||
|
|
15e7a94640 | ||
|
|
810295aafa | ||
|
|
ffd45d58fe | ||
|
|
852923ea34 | ||
|
|
979b34d717 | ||
|
|
34f92fe4e5 | ||
|
|
10b217e0c2 | ||
|
|
2b0593e5ff | ||
|
|
2b329e6899 | ||
|
|
5b0bf40508 | ||
|
|
210a936483 | ||
|
|
813e2d5b2c | ||
|
|
a18c940503 | ||
|
|
329d8acca7 | ||
|
|
bf2cdc3c9b | ||
|
|
61ce0d1117 | ||
|
|
e8201b115f | ||
|
|
5690742937 | ||
|
|
9f29f41288 | ||
|
|
828c0bcb99 | ||
|
|
fe0d31ae94 | ||
|
|
175d10c5d1 | ||
|
|
02b5349db2 | ||
|
|
a64d69560c | ||
|
|
e18205e6c7 | ||
|
|
0f542809a4 | ||
|
|
d171fb1570 | ||
|
|
b913523066 | ||
|
|
16588ab0bf | ||
|
|
5dc27ed275 | ||
|
|
63826f5567 | ||
|
|
0d3d115d67 | ||
|
|
a9959bcd62 | ||
|
|
93a4e67813 | ||
|
|
0e79db6cf7 | ||
|
|
7b1f6d7ce3 | ||
|
|
8c452288f4 | ||
|
|
bf5137ed6b | ||
|
|
c8e4f9160c | ||
|
|
fae4f7c8b4 | ||
|
|
2148d3d3ab | ||
|
|
8ccd442647 | ||
|
|
d44a7fc23a | ||
|
|
5c63d75c86 | ||
|
|
fef282fcd5 | ||
|
|
ec9e5402c0 | ||
|
|
a45378cadf | ||
|
|
a5127c7c07 | ||
|
|
0197aeeb4b | ||
|
|
8b84b0403b | ||
|
|
6a671a5cd1 | ||
|
|
1be4eee674 | ||
|
|
1eed8a2a86 | ||
|
|
e782ddc143 | ||
|
|
d91e3f568b | ||
|
|
98eb006cdd | ||
|
|
60154b7c26 | ||
|
|
dab9e7aaa2 | ||
|
|
0f8dceed89 | ||
|
|
affa091ccb | ||
|
|
8a022f877e | ||
|
|
579a542815 | ||
|
|
080d021fb3 | ||
|
|
10ec91065e | ||
|
|
25a3ea98bc | ||
|
|
5555e334af | ||
|
|
3c41c286c7 | ||
|
|
bf9fbc46fd | ||
|
|
824ef9a9d3 | ||
|
|
8a84d4812f | ||
|
|
ffe456ea7c | ||
|
|
a997845604 | ||
|
|
f887eae0f7 | ||
|
|
508c209270 | ||
|
|
4027304ece | ||
|
|
0ac59b4152 | ||
|
|
2272134442 | ||
|
|
1c828bd680 | ||
|
|
499867255b | ||
|
|
dc142a5531 | ||
|
|
2115e92520 | ||
|
|
c3d31f11e4 | ||
|
|
bf4d908eab | ||
|
|
2a3ba03226 | ||
|
|
5c6f72ac57 | ||
|
|
bfcf2d98b5 | ||
|
|
0b01e7edea | ||
|
|
84a4d114c4 | ||
|
|
44b47f4d88 | ||
|
|
1175a22d53 | ||
|
|
5aa8761c7e | ||
|
|
1668ec2fc6 | ||
|
|
eaf3b7943c | ||
|
|
1551b413fb | ||
|
|
05a1b0203b | ||
|
|
c83667e432 | ||
|
|
9203ae20cd | ||
|
|
43f658a82b | ||
|
|
3dcc6dc299 | ||
|
|
fe79c0d294 | ||
|
|
1f0a91c313 | ||
|
|
ae5cd7b3c3 | ||
|
|
2947e11b9b | ||
|
|
85670dd4a1 | ||
|
|
5d88c1a19e | ||
|
|
3004007f96 | ||
|
|
58244d5a3d | ||
|
|
ac97e0c6e9 | ||
|
|
d9bdb0d7e1 | ||
|
|
83da1773b5 | ||
|
|
44e4e0a2b3 | ||
|
|
9dad1d79d7 | ||
|
|
3a3a9af284 | ||
|
|
c2a7fbaadc | ||
|
|
b2789bea6b | ||
|
|
807e8642fa | ||
|
|
c9008bf78b | ||
|
|
a641d2a2de | ||
|
|
6186f39068 | ||
|
|
6bd1209146 | ||
|
|
2a9c379a1c | ||
|
|
1b983111f6 | ||
|
|
cf5dd8b822 | ||
|
|
069d2b275a | ||
|
|
368e35abb6 | ||
|
|
81a51d750c | ||
|
|
d93b137b85 | ||
|
|
d15f2a0cbe | ||
|
|
bd54729257 | ||
|
|
6123ef12bd | ||
|
|
14cf008a19 | ||
|
|
da8db72328 | ||
|
|
30e3a3a958 | ||
|
|
b384a2fff6 | ||
|
|
8dd866a35e | ||
|
|
b36e2eb5f4 | ||
|
|
9c4fdc18b8 | ||
|
|
357a90db71 | ||
|
|
8c65d4e131 | ||
|
|
07971d25a6 | ||
|
|
ce538a804d | ||
|
|
d480f19b24 | ||
|
|
5deb1d35e3 | ||
|
|
140514b408 | ||
|
|
34d40364a3 | ||
|
|
a4d7f5e7d1 | ||
|
|
b3aa3d3b83 | ||
|
|
3f9e4731b8 | ||
|
|
3e79a86008 | ||
|
|
126c6e1b6c | ||
|
|
90c6e4cd1b | ||
|
|
e1616af98c | ||
|
|
388e488bc1 | ||
|
|
b601c49f6c | ||
|
|
d9587e20c0 | ||
|
|
f5684c43dd | ||
|
|
d25700e241 | ||
|
|
9dde599e00 | ||
|
|
96f0d65f7d | ||
|
|
abe64ae8fb | ||
|
|
5df6fc4c1b | ||
|
|
a4a6929ca4 | ||
|
|
cc221f590c | ||
|
|
ec1b782f2c | ||
|
|
48549ff790 | ||
|
|
5633053655 | ||
|
|
92acbd006b | ||
|
|
8552a89838 | ||
|
|
ce90d81a2f | ||
|
|
f250b006b1 | ||
|
|
f46c3b36cc | ||
|
|
217999912a | ||
|
|
82e6192c05 | ||
|
|
03abfa9c59 | ||
|
|
97155c50c4 | ||
|
|
7b45e9296a | ||
|
|
c16836e7c0 | ||
|
|
1f88072eae | ||
|
|
858ea9c3de | ||
|
|
1248858303 | ||
|
|
a472a95945 | ||
|
|
c8af57c65d | ||
|
|
d00eb38bbc | ||
|
|
f8e1b9b11b | ||
|
|
bbb807d860 | ||
|
|
355c68f687 | ||
|
|
b74ae9fabf | ||
|
|
17d2fb1858 | ||
|
|
222fad315d | ||
|
|
124ba2a124 | ||
|
|
9b8dc448f6 | ||
|
|
0a44a81d18 | ||
|
|
c4ec841c0f | ||
|
|
6fe5d9a9e9 | ||
|
|
18c74a245d | ||
|
|
2fb311e090 | ||
|
|
d6822b85b3 | ||
|
|
d08461bd4c | ||
|
|
f4d63877e4 | ||
|
|
43335cd729 | ||
|
|
0678bb03d7 | ||
|
|
b15102d45a | ||
|
|
fb26842046 | ||
|
|
e703baf295 | ||
|
|
94670baa64 | ||
|
|
62c67435e6 | ||
|
|
1e492721ba | ||
|
|
2fe635a958 | ||
|
|
c1bdbffc87 | ||
|
|
a654f5bf13 | ||
|
|
7a8d99304a | ||
|
|
7e0ce1fa48 | ||
|
|
b84d3a5612 | ||
|
|
81b110feb6 | ||
|
|
4556f7b8a4 | ||
|
|
a9b6f8976e | ||
|
|
dfa6165662 | ||
|
|
ee3ee63ff5 | ||
|
|
3567d8913f | ||
|
|
8276054671 | ||
|
|
220117f07c | ||
|
|
728ca8aa9d | ||
|
|
e3a1125e84 | ||
|
|
02b64f4027 | ||
|
|
2ae44ca493 | ||
|
|
afdd63521f | ||
|
|
bced0b91a0 | ||
|
|
2a6f2939be | ||
|
|
13880354cf | ||
|
|
5df0c95e51 | ||
|
|
447054a14f | ||
|
|
5f348a8ea3 | ||
|
|
1d69411eba | ||
|
|
fb24a8fdb1 | ||
|
|
827fb7fa82 | ||
|
|
c6365bebac | ||
|
|
c7b94d0a42 | ||
|
|
86f82951d5 | ||
|
|
72b865b50e | ||
|
|
b2f7e4b16b | ||
|
|
2f01299472 | ||
|
|
5cc851e175 | ||
|
|
66986e66e3 | ||
|
|
9292bbcd1b | ||
|
|
dfba3c51fb | ||
|
|
da7e501e3a | ||
|
|
42ae23f279 | ||
|
|
c43775f7b2 | ||
|
|
86ee1270e2 | ||
|
|
b8cfd83d33 | ||
|
|
bfd56bf904 | ||
|
|
df2311cdaf | ||
|
|
d609c2b0ff | ||
|
|
70e1d2bf3d | ||
|
|
1697c2160c | ||
|
|
c28301bb7e | ||
|
|
b5eadb158c | ||
|
|
e94912cdb9 | ||
|
|
dfb967834f | ||
|
|
98f7c29683 | ||
|
|
0998c5539a | ||
|
|
1a79e23b12 | ||
|
|
d49323c7c4 | ||
|
|
98eb3cb7f0 | ||
|
|
c75ae73814 | ||
|
|
07519b7c28 | ||
|
|
4c62c82dab | ||
|
|
92a9554240 | ||
|
|
324a700fb7 | ||
|
|
a6b934758b | ||
|
|
cd5ec59f6a | ||
|
|
80fe813116 | ||
|
|
1262afef63 | ||
|
|
987489b34a | ||
|
|
9310861cc2 | ||
|
|
53f0db99ca | ||
|
|
2eb125f6e2 | ||
|
|
f805d9432e | ||
|
|
054cb9e9fa | ||
|
|
1f77e7d90a | ||
|
|
7ed33832b8 | ||
|
|
d19e9cc662 | ||
|
|
846c9cec6a | ||
|
|
460e4b8bb3 | ||
|
|
2e6bd23f22 | ||
|
|
7763948fe4 | ||
|
|
2a0f001902 | ||
|
|
14df69e180 | ||
|
|
28b6389b36 | ||
|
|
905c0b8c7a | ||
|
|
b674cc95ac | ||
|
|
bccb2509b5 | ||
|
|
cd980c6604 | ||
|
|
ddff4ec083 | ||
|
|
5bf97be8ef | ||
|
|
7fadb6ed05 | ||
|
|
89688d67dd | ||
|
|
279007544a | ||
|
|
1c0f0e1423 | ||
|
|
1ab909addc | ||
|
|
99dfd15469 | ||
|
|
be18ecf74e | ||
|
|
713bd132dc | ||
|
|
20f03e237e | ||
|
|
7d3c3911ea | ||
|
|
ccfee2be83 | ||
|
|
1193b0b990 | ||
|
|
5a3ba4e563 | ||
|
|
e9c342ef74 | ||
|
|
8927ffa035 | ||
|
|
fdb0312326 | ||
|
|
2f21caa41c | ||
|
|
51a35d40e5 | ||
|
|
6ec524adec | ||
|
|
7d4a7ec8c7 | ||
|
|
0256c4521d | ||
|
|
be3ed181c1 | ||
|
|
38cf7884fe | ||
|
|
25d426e8b2 | ||
|
|
edff9ae684 | ||
|
|
a622e3bda6 | ||
|
|
4d54e28e63 | ||
|
|
c89d023f91 | ||
|
|
c7cfea1daa | ||
|
|
beb07365a0 | ||
|
|
0787c65e51 | ||
|
|
d48dea7273 | ||
|
|
2432cc6ed2 | ||
|
|
cf523d4215 | ||
|
|
906d87c4b8 | ||
|
|
9c4a92c015 | ||
|
|
0c056ba691 | ||
|
|
424158b28d | ||
|
|
57f118a5b5 | ||
|
|
65e75f3da2 | ||
|
|
41174cde45 | ||
|
|
cb7d01fb36 | ||
|
|
3e78f8e87d | ||
|
|
f2c032ba07 | ||
|
|
2ef1589e76 | ||
|
|
5c394557e3 | ||
|
|
5c4a5b0a61 | ||
|
|
be22b7349d | ||
|
|
023e4774a1 | ||
|
|
56b706f25e | ||
|
|
9d07ee43eb | ||
|
|
147a6c81a1 | ||
|
|
5972f4947d | ||
|
|
9c99a624d7 | ||
|
|
d812d83dda | ||
|
|
f81c5c2455 | ||
|
|
dc8c5e6209 | ||
|
|
14833582b2 | ||
|
|
cca813fd1d | ||
|
|
d4102e75c5 | ||
|
|
76a04efc5c | ||
|
|
a34e139843 | ||
|
|
a1727a2ac7 | ||
|
|
7ac224adf3 | ||
|
|
d5e3d02a98 | ||
|
|
68ad3e8db4 | ||
|
|
31029b2fe4 | ||
|
|
8b0c101768 | ||
|
|
50b66f526b | ||
|
|
f3fcf010fb | ||
|
|
4da53bd00d | ||
|
|
c6cef45f0e | ||
|
|
e36cd7fe5c | ||
|
|
0c24f2db7b | ||
|
|
8866faa8d5 | ||
|
|
b2dc31ba80 | ||
|
|
061ea30199 | ||
|
|
0e9e94d090 | ||
|
|
3321cb37ef | ||
|
|
d60a818791 | ||
|
|
3937a52b4f | ||
|
|
2c3902b1a1 | ||
|
|
f43b5ee76f | ||
|
|
bab16a5251 | ||
|
|
08c734d7fd | ||
|
|
36126a3ad9 | ||
|
|
ce505d33bd | ||
|
|
de0d859502 | ||
|
|
ce96d4bcc5 | ||
|
|
fb242274d5 | ||
|
|
938bc7cdd7 | ||
|
|
36865f2930 | ||
|
|
12e79cccf6 | ||
|
|
6180f12ba3 | ||
|
|
c00b6c6237 | ||
|
|
dbdc74fdef | ||
|
|
5bb0a07164 | ||
|
|
543f09999f | ||
|
|
812f32efdd | ||
|
|
784264eba4 | ||
|
|
ff9ca059c7 | ||
|
|
d4b0c39485 | ||
|
|
87c42aeaf4 | ||
|
|
5ba6e57c71 | ||
|
|
6d2ba5c2d0 | ||
|
|
0d42b81285 | ||
|
|
9ce2ae613b | ||
|
|
13c9e0e666 | ||
|
|
784118e9c1 | ||
|
|
df32a32d99 | ||
|
|
655241aed3 | ||
|
|
60a2b246e2 | ||
|
|
ebd60d93f3 | ||
|
|
cc4ba935b5 | ||
|
|
824147fd7d | ||
|
|
c3446a16cc | ||
|
|
82135d1892 | ||
|
|
1cff63bc01 | ||
|
|
e488e74313 | ||
|
|
1a17c9da86 | ||
|
|
20e1f773fc | ||
|
|
56d80ff293 | ||
|
|
80e176136a | ||
|
|
0ae66d3e24 | ||
|
|
802ab8238e | ||
|
|
ec9c07a646 | ||
|
|
b75ad663f2 | ||
|
|
e4a017fc00 | ||
|
|
5b486ca6b8 | ||
|
|
1c39ed6130 | ||
|
|
a47563b12f | ||
|
|
84491ff655 | ||
|
|
e5991a4379 | ||
|
|
0b3d4615b8 | ||
|
|
a8f6336b47 | ||
|
|
0b33df3341 | ||
|
|
744cc4b705 | ||
|
|
9d3cd5784f | ||
|
|
06ea58198a | ||
|
|
3692d7d090 | ||
|
|
460a2dbbd3 | ||
|
|
228f4f1010 | ||
|
|
2703b91e41 | ||
|
|
24171787f8 | ||
|
|
49d3338d4a | ||
|
|
a9d693e1c3 | ||
|
|
4ef69248d0 | ||
|
|
247b3ed740 | ||
|
|
1edca6235c | ||
|
|
ab5c03b1d9 | ||
|
|
d4cb35469d | ||
|
|
fd1b1d0c24 | ||
|
|
bf96ceeacc | ||
|
|
2c08b385e5 | ||
|
|
051d13ec7a | ||
|
|
a2a9643123 | ||
|
|
1286bfe75b |
10
.github/CONTRIBUTING.md
vendored
10
.github/CONTRIBUTING.md
vendored
@@ -10,9 +10,9 @@ As a first step, please review these links as they'll help you understand how th
|
||||
|
||||
## Just Starting Out
|
||||
|
||||
* If you're unfamilar with git, check out this [brief introduction to Git](https://github.com/PCSX2/pcsx2/wiki/Git-survival-guide)
|
||||
* [How to build PCSX2 for Windows](https://github.com/PCSX2/pcsx2/wiki/Setting-up-the-PCSX2-repository-on-Windows-\(WIP---maybe-more-useful-as-a-manpage-instead%3F\))
|
||||
* [How to build PCSX2 for Linux](https://github.com/PCSX2/pcsx2/wiki/Installing-on-Linux)
|
||||
* If you're unfamilar with git, check out this [brief introduction to Git](https://github.com/PCSX2/pcsx2/wiki/07-Git-survival-guide)
|
||||
* [How to build PCSX2 for Windows](https://github.com/PCSX2/pcsx2/wiki/12-Building-on-Windows)
|
||||
* [How to build PCSX2 for Linux](https://github.com/PCSX2/pcsx2/wiki/10-Building-on-Linux)
|
||||
|
||||
## Issue Reporting
|
||||
|
||||
@@ -44,13 +44,11 @@ The following is a list of *general* style recommendations that will make review
|
||||
|
||||
## General Documentation And Coding Strategies
|
||||
|
||||
* [Commenting Etiquette](https://github.com/PCSX2/pcsx2/wiki/Commenting-Etiquette)
|
||||
* [Commenting Etiquette](https://github.com/PCSX2/pcsx2/wiki/06-Commenting-Etiquette)
|
||||
|
||||
* [Coding style](https://github.com/PCSX2/pcsx2/wiki/Code-Formatting-Guidelines)
|
||||
* [More comprehensive style-guide (Currently in Draft)](https://github.com/tadanokojin/pcsx2/blob/coding-guide/pcsx2/Docs/Coding_Guidelines.md)
|
||||
|
||||
## Tasks
|
||||
|
||||
* [Todo List](https://github.com/PCSX2/pcsx2/wiki/Contributing-\(TODO-List\))
|
||||
* [Issues](https://github.com/PCSX2/pcsx2/issues)
|
||||
* [A collection of ideas to improve GS OGL](https://github.com/PCSX2/pcsx2/wiki/Todo-List)
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/app_bug_report.yaml
vendored
2
.github/ISSUE_TEMPLATE/app_bug_report.yaml
vendored
@@ -18,6 +18,8 @@ body:
|
||||
|
||||
Please make an effort to make sure your issue isn't already reported.
|
||||
|
||||
Do not create issues involving software piracy of BIOS or ISO files, our rules specifically prohibit this and your issue will be closed.
|
||||
|
||||
### Please Avoid Issues Pertaining to the Following:
|
||||
- We are **not** accepting bug reports for **PSX mode** at this time.
|
||||
- If you are interested in helping contribute to PSX mode please do so on the forums. Otherwise our recommendation is that you use [Duckstation](https://github.com/stenzek/duckstation/releases/tag/latest).
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/emu_bug_report.yaml
vendored
2
.github/ISSUE_TEMPLATE/emu_bug_report.yaml
vendored
@@ -18,6 +18,8 @@ body:
|
||||
|
||||
Please make an effort to make sure your issue isn't already reported.
|
||||
|
||||
Do not create issues involving software piracy of BIOS or ISO files, our rules specifically prohibit this and your issue will be closed.
|
||||
|
||||
### Please Avoid Issues Pertaining to the Following:
|
||||
- We are **not** accepting bug reports for **PSX mode** at this time.
|
||||
- If you are interested in helping contribute to PSX mode please do so on the forums. Otherwise our recommendation is that you use [Duckstation](https://github.com/stenzek/duckstation/releases/tag/latest).
|
||||
|
||||
9
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
9
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
@@ -6,6 +6,15 @@ labels: ["Enhancement / Feature Request"]
|
||||
# assignees:
|
||||
# - octocat
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## Important: Read First
|
||||
|
||||
Please make an effort to make sure your issue isn't already reported.
|
||||
|
||||
Do not create issues involving software piracy of BIOS or ISO files, our rules specifically prohibit this and your issue will be closed.
|
||||
|
||||
- type: textarea
|
||||
id: desc
|
||||
attributes:
|
||||
|
||||
1
.github/workflows/cron_publish_flatpak.yml
vendored
1
.github/workflows/cron_publish_flatpak.yml
vendored
@@ -37,5 +37,6 @@ jobs:
|
||||
cmakeflags: ""
|
||||
publish: true
|
||||
branch: stable
|
||||
fetchTags: true
|
||||
secrets: inherit
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
name: "Update Base Translation"
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Update Base Translation
|
||||
run: ./.github/workflows/scripts/common/update_base_translation.sh
|
||||
|
||||
@@ -9,7 +9,7 @@ jobs:
|
||||
if: github.repository == 'PCSX2/pcsx2'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get Latest DB and Prepare DB File
|
||||
run: |
|
||||
|
||||
20
.github/workflows/lint_gamedb.yml
vendored
20
.github/workflows/lint_gamedb.yml
vendored
@@ -18,14 +18,26 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Packages
|
||||
run: |
|
||||
npm install -g ajv-cli prettier
|
||||
sudo apt-get -y install yamllint
|
||||
|
||||
- name: Validate YAML
|
||||
run: |
|
||||
yamllint -sd "{extends: relaxed, rules: {line-length: disable}}" ./bin/resources/GameIndex.yaml
|
||||
|
||||
- name: Validate Contents
|
||||
run: |
|
||||
npm install -g ajv-cli
|
||||
ajv validate -s ./pcsx2/Docs/gamedb-schema.json --spec=draft2020 -d ./bin/resources/GameIndex.yaml
|
||||
|
||||
- name: Check Formatting
|
||||
run: |
|
||||
npm install -g prettier
|
||||
prettier --check ./bin/resources/GameIndex.yaml
|
||||
if ! prettier --check bin/resources/GameIndex.yaml; then
|
||||
prettier --write bin/resources/GameIndex.yaml
|
||||
echo "Prettier failed, diff:"
|
||||
git diff bin/resources/GameIndex.yaml
|
||||
exit 1
|
||||
fi
|
||||
|
||||
20
.github/workflows/linux_build_flatpak.yml
vendored
20
.github/workflows/linux_build_flatpak.yml
vendored
@@ -45,7 +45,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -85,8 +85,12 @@ jobs:
|
||||
cat .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml
|
||||
flatpak run org.freedesktop.appstream-glib validate .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml
|
||||
|
||||
- name: Validate manifest
|
||||
run: |
|
||||
flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json
|
||||
|
||||
- name: Build Flatpak
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.1
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.3
|
||||
with:
|
||||
bundle: ${{ steps.artifact-metadata.outputs.artifact-name }}.flatpak
|
||||
manifest-path: .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json
|
||||
@@ -103,9 +107,17 @@ jobs:
|
||||
run: |
|
||||
ostree commit --repo=repo --canonical-permissions --branch=screenshots/x86_64 flatpak_app/screenshots
|
||||
|
||||
#- name: Validate build directory
|
||||
# run: |
|
||||
# flatpak run --command=flatpak-builder-lint org.flatpak.Builder builddir flatpak_app
|
||||
#
|
||||
#- name: Validate repo
|
||||
# run: |
|
||||
# flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo repo
|
||||
|
||||
- name: Push to Flathub beta
|
||||
if: inputs.publish == true && inputs.branch == 'beta'
|
||||
uses: flatpak/flatpak-github-actions/flat-manager@v6.1
|
||||
uses: flatpak/flatpak-github-actions/flat-manager@v6.3
|
||||
with:
|
||||
flat-manager-url: https://hub.flathub.org/
|
||||
repository: beta
|
||||
@@ -113,7 +125,7 @@ jobs:
|
||||
|
||||
- name: Push to Flathub stable
|
||||
if: inputs.publish == true && inputs.branch == 'stable'
|
||||
uses: flatpak/flatpak-github-actions/flat-manager@v6.1
|
||||
uses: flatpak/flatpak-github-actions/flat-manager@v6.3
|
||||
with:
|
||||
flat-manager-url: https://hub.flathub.org/
|
||||
repository: stable
|
||||
|
||||
16
.github/workflows/linux_build_qt.yml
vendored
16
.github/workflows/linux_build_qt.yml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
name: ${{ inputs.jobName }}
|
||||
runs-on: ${{ inputs.os }}
|
||||
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
|
||||
timeout-minutes: 60
|
||||
timeout-minutes: 90
|
||||
env:
|
||||
CCACHE_BASEDIR: ${{ github.workspace }}
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
@@ -51,8 +51,16 @@ jobs:
|
||||
CCACHE_MAXSIZE: 100M
|
||||
|
||||
steps:
|
||||
# Work around https://github.com/actions/runner-images/issues/8659
|
||||
- name: Remove GCC 13 from runner image
|
||||
shell: bash
|
||||
run: |
|
||||
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --allow-downgrades libc6=2.35-0ubuntu3.4 libc6-dev=2.35-0ubuntu3.4 libstdc++6=12.3.0-1ubuntu1~22.04 libgcc-s1=12.3.0-1ubuntu1~22.04
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -110,8 +118,8 @@ jobs:
|
||||
env:
|
||||
COMPILER: ${{ inputs.compiler }}
|
||||
ADDITIONAL_CMAKE_ARGS: ${{ inputs.cmakeflags }}
|
||||
CLANG_PATH: /usr/bin/clang-16
|
||||
CLANGXX_PATH: /usr/bin/clang++-16
|
||||
CLANG_PATH: /usr/bin/clang-17
|
||||
CLANGXX_PATH: /usr/bin/clang++-17
|
||||
run: |
|
||||
DEPS_PREFIX="$HOME/deps" .github/workflows/scripts/linux/generate-cmake-qt.sh
|
||||
|
||||
|
||||
4
.github/workflows/macos_build.yml
vendored
4
.github/workflows/macos_build.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -64,8 +64,6 @@ jobs:
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
HOMEBREW_NO_ANALYTICS: 1
|
||||
run: |
|
||||
brew unlink libjpeg || true # Conflicts with our self-built dependencies
|
||||
brew unlink libpng || true
|
||||
# Unlike other packages, brew's MoltenVK build uses MoltenVK's minimum macOS version of 10.13 so we can use it
|
||||
if ! brew install molten-vk ccache nasm; then
|
||||
brew update
|
||||
|
||||
24
.github/workflows/release_announce.yml
vendored
24
.github/workflows/release_announce.yml
vendored
@@ -1,24 +0,0 @@
|
||||
name: 📢 Announce Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
announce:
|
||||
if: github.repository == 'PCSX2/pcsx2'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Announce Release
|
||||
env:
|
||||
DISCORD_BUILD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
|
||||
run: |
|
||||
cd ./.github/workflows/scripts/releases/announce-release
|
||||
npm ci
|
||||
node index.js
|
||||
33
.github/workflows/release_cut_new.yml
vendored
33
.github/workflows/release_cut_new.yml
vendored
@@ -27,10 +27,12 @@ permissions:
|
||||
jobs:
|
||||
cut-release:
|
||||
if: github.repository == 'PCSX2/pcsx2'
|
||||
runs-on: ubuntu-latest
|
||||
name: "Create Tag and Release"
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
new_tag: ${{ steps.tag_version.outputs.new_tag }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Docs - https://github.com/mathieudutour/github-tag-action
|
||||
- name: Bump Version and Push Tag
|
||||
@@ -131,6 +133,7 @@ jobs:
|
||||
upload_artifacts:
|
||||
if: github.repository == 'PCSX2/pcsx2'
|
||||
needs:
|
||||
- cut-release
|
||||
- build_linux_flatpak
|
||||
- build_linux_qt
|
||||
- build_windows_qt
|
||||
@@ -138,11 +141,7 @@ jobs:
|
||||
name: "Upload Artifacts"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
# actions/checkout elides tags, fetch them primarily for releases
|
||||
- name: Fetch Tags
|
||||
run: git fetch --tags --no-recurse-submodules
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Prepare Artifact Folder
|
||||
run: mkdir ./ci-artifacts/
|
||||
@@ -169,7 +168,7 @@ jobs:
|
||||
SCAN_DIR: ${{ github.WORKSPACE }}/ci-artifacts
|
||||
OUT_DIR: ${{ github.WORKSPACE }}/ci-artifacts/out
|
||||
run: |
|
||||
TAG_VAL=$(git tag --points-at HEAD)
|
||||
TAG_VAL=${{needs.cut-release.outputs.new_tag}}
|
||||
echo "TAG_VAL=${TAG_VAL}"
|
||||
gh release list --repo PCSX2/pcsx2
|
||||
mkdir -p ${{ github.WORKSPACE }}/ci-artifacts/out
|
||||
@@ -181,6 +180,22 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
TAG_VAL=$(git tag --points-at HEAD)
|
||||
TAG_VAL=${{needs.cut-release.outputs.new_tag}}
|
||||
echo "TAG_VAL=${TAG_VAL}"
|
||||
gh release edit ${TAG_VAL} --draft=false --repo PCSX2/pcsx2
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Announce Release
|
||||
env:
|
||||
OWNER: PCSX2
|
||||
REPO: pcsx2
|
||||
DISCORD_BUILD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
TAG_VAL=${{needs.cut-release.outputs.new_tag}}
|
||||
cd ./.github/workflows/scripts/releases/announce-release
|
||||
npm ci
|
||||
TAG_VAL=${TAG_VAL} node index.js
|
||||
|
||||
15
.github/workflows/scripts/linux/appimage-qt.sh
vendored
15
.github/workflows/scripts/linux/appimage-qt.sh
vendored
@@ -75,7 +75,6 @@ if [ ! -f "$APPIMAGETOOL" ]; then
|
||||
fi
|
||||
|
||||
OUTDIR=$(realpath "./$APPDIRNAME")
|
||||
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
rm -fr "$OUTDIR"
|
||||
|
||||
# Why the nastyness? linuxdeploy strips our main binary, and there's no option to turn it off.
|
||||
@@ -142,8 +141,7 @@ rm -fr "$DEPSDIR"
|
||||
mv "$DEPSDIR.bak" "$DEPSDIR"
|
||||
|
||||
# Fix up translations.
|
||||
rm -fr "$OUTDIR/usr/bin/translations"
|
||||
mv "$OUTDIR/usr/translations" "$OUTDIR/usr/bin"
|
||||
rm -fr "$OUTDIR/usr/bin/translations" "$OUTDIR/usr/translations"
|
||||
cp -a "$BUILDDIR/bin/translations" "$OUTDIR/usr/bin"
|
||||
|
||||
# Generate AppStream meta-info.
|
||||
@@ -151,6 +149,17 @@ echo "Generating AppStream metainfo..."
|
||||
mkdir -p "$OUTDIR/usr/share/metainfo"
|
||||
"$SCRIPTDIR/generate-metainfo.sh" "$OUTDIR/usr/share/metainfo/net.pcsx2.PCSX2.appdata.xml"
|
||||
|
||||
# Copy in AppRun hooks.
|
||||
# Unfortunately linuxdeploy is a bit lame and doesn't let us provide our own AppRun hooks, instead
|
||||
# they have to come from plugins.. and screw writing one of those just to disable Wayland.
|
||||
echo "Copying AppRun hooks..."
|
||||
mkdir -p "$OUTDIR/apprun-hooks"
|
||||
for hookpath in "$SCRIPTDIR/apprun-hooks"/*; do
|
||||
hookname=$(basename "$hookpath")
|
||||
cp -v "$hookpath" "$OUTDIR/apprun-hooks/$hookname"
|
||||
sed -i -e 's/exec /source "$this_dir"\/apprun-hooks\/"'"$hookname"'"\nexec /' "$OUTDIR/AppRun"
|
||||
done
|
||||
|
||||
echo "Generating AppImage..."
|
||||
rm -f "$NAME.AppImage"
|
||||
$APPIMAGETOOL -v "$OUTDIR" "$NAME.AppImage"
|
||||
|
||||
9
.github/workflows/scripts/linux/apprun-hooks/default-to-x11.sh
vendored
Normal file
9
.github/workflows/scripts/linux/apprun-hooks/default-to-x11.sh
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
if [[ -z "$I_WANT_A_BROKEN_WAYLAND_UI" ]]; then
|
||||
echo "Forcing X11 instead of Wayland, due to various protocol limitations"
|
||||
echo "and Qt issues. If you want to use Wayland, launch PCSX2 with"
|
||||
echo "I_WANT_A_BROKEN_WAYLAND_UI=YES set."
|
||||
export QT_QPA_PLATFORM=xcb
|
||||
else
|
||||
echo "Wayland is not being disabled. Do not complain when things break."
|
||||
fi
|
||||
|
||||
@@ -4,22 +4,22 @@ set -e
|
||||
|
||||
INSTALLDIR="$HOME/deps"
|
||||
NPROCS="$(getconf _NPROCESSORS_ONLN)"
|
||||
SDL=SDL2-2.28.1
|
||||
QT=6.5.2
|
||||
SDL=SDL2-2.28.4
|
||||
QT=6.6.0
|
||||
LIBBACKTRACE=ad106d5fdd5d960bd33fae1c48a351af567fd075
|
||||
|
||||
mkdir -p deps-build
|
||||
cd deps-build
|
||||
|
||||
cat > SHASUMS <<EOF
|
||||
4977ceba5c0054dbe6c2f114641aced43ce3bf2b41ea64b6a372d6ba129cb15d $SDL.tar.gz
|
||||
888b8c39f36ae2035d023d1b14ab0191eb1d26403c3cf4d4d5ede30e66a4942c $SDL.tar.gz
|
||||
fd6f417fe9e3a071cf1424a5152d926a34c4a3c5070745470be6cf12a404ed79 $LIBBACKTRACE.zip
|
||||
3db4c729b4d80a9d8fda8dd77128406353baff4755ca619177eda4cddae71269 qtbase-everywhere-src-$QT.tar.xz
|
||||
aae0c08924c6a5e47f9d57e031673d611ffff7aab2bee2e1cc460471ecac6743 qtimageformats-everywhere-src-$QT.tar.xz
|
||||
48b4cc1093af2e0ab3bea30f60651bddd877a2335d16e7207879a2e9e81963a3 qtsvg-everywhere-src-$QT.tar.xz
|
||||
551ffb22751d8fd4d88e9ebd55b9131f4ca55341ee497fdbbba4da8d10d94341 qttools-everywhere-src-$QT.tar.xz
|
||||
337c45637e757e754c2f0ea65c20de3e6e53a841dda1253db15baa622515beeb qttranslations-everywhere-src-$QT.tar.xz
|
||||
3020be86fb7fd0abb8509906ca6583cadcaee168159abceaeb5b3e9d42563c9a qtwayland-everywhere-src-$QT.tar.xz
|
||||
039d53312acb5897a9054bd38c9ccbdab72500b71fdccdb3f4f0844b0dd39e0e qtbase-everywhere-src-$QT.tar.xz
|
||||
e1542cb50176e237809895c6549598c08587c63703d100be54ac2d806834e384 qtimageformats-everywhere-src-$QT.tar.xz
|
||||
33da25fef51102f564624a7ea3e57cb4a0a31b7b44783d1af5749ac36d3c72de qtsvg-everywhere-src-$QT.tar.xz
|
||||
4e9feebc142bbb6e453e1dc3277e09ec45c8ef081b5ee2a029e6684b5905ba99 qttools-everywhere-src-$QT.tar.xz
|
||||
a0d89a236f64b810eb0fe4ae1e90db22b0e86263521b35f89e69f1392815078c qttranslations-everywhere-src-$QT.tar.xz
|
||||
30c3d82d85d050c83370710a26d12c802199c51eba5c2726e9d6243edd03b7e8 qtwayland-everywhere-src-$QT.tar.xz
|
||||
EOF
|
||||
|
||||
curl -L \
|
||||
@@ -37,7 +37,7 @@ shasum -a 256 --check SHASUMS
|
||||
echo "Building SDL..."
|
||||
tar xf "$SDL.tar.gz"
|
||||
cd "$SDL"
|
||||
./configure --prefix "$INSTALLDIR" --disable-dbus --without-x --disable-video-opengl --disable-video-opengles --disable-video-vulkan --disable-wayland-shared --disable-ime --disable-oss --disable-alsa --disable-jack --disable-esd --disable-pipewire --disable-pulseaudio --disable-arts --disable-nas --disable-sndio --disable-fusionsound --disable-diskaudio
|
||||
./configure --prefix "$INSTALLDIR" --enable-dbus --without-x --disable-video-opengl --disable-video-opengles --disable-video-vulkan --disable-wayland-shared --disable-ime --disable-oss --disable-alsa --disable-jack --disable-esd --disable-pipewire --disable-pulseaudio --disable-arts --disable-nas --disable-sndio --disable-fusionsound --disable-diskaudio
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ..
|
||||
@@ -60,7 +60,7 @@ tar xf "qtbase-everywhere-src-$QT.tar.xz"
|
||||
cd "qtbase-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
../configure -prefix "$INSTALLDIR" -release -no-dbus -gui -widgets -fontconfig -qt-doubleconversion -ssl -openssl-runtime -opengl desktop -qpa xcb,wayland -xkbcommon -- -DFEATURE_dbus=OFF -DFEATURE_icu=OFF -DFEATURE_printsupport=OFF -DFEATURE_sql=OFF
|
||||
../configure -prefix "$INSTALLDIR" -release -dbus-linked -gui -widgets -fontconfig -qt-doubleconversion -ssl -openssl-runtime -opengl desktop -qpa xcb,wayland -xkbcommon -- -DFEATURE_dbus=ON -DFEATURE_icu=OFF -DFEATURE_printsupport=OFF -DFEATURE_sql=OFF
|
||||
cmake --build . --parallel
|
||||
cmake --install .
|
||||
cd ../../
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://libsdl.org/release/SDL2-2.28.1.tar.gz",
|
||||
"sha256": "4977ceba5c0054dbe6c2f114641aced43ce3bf2b41ea64b6a372d6ba129cb15d"
|
||||
"url": "https://libsdl.org/release/SDL2-2.28.4.tar.gz",
|
||||
"sha256": "888b8c39f36ae2035d023d1b14ab0191eb1d26403c3cf4d4d5ede30e66a4942c"
|
||||
}
|
||||
],
|
||||
"cleanup": [
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"app-id": "net.pcsx2.PCSX2",
|
||||
"runtime": "org.kde.Platform",
|
||||
"runtime-version": "6.5",
|
||||
"runtime-version": "6.6",
|
||||
"sdk": "org.kde.Sdk",
|
||||
"sdk-extensions": [
|
||||
"org.freedesktop.Sdk.Extension.llvm16"
|
||||
"org.freedesktop.Sdk.Extension.llvm17"
|
||||
],
|
||||
"add-extensions": {
|
||||
"org.freedesktop.Platform.ffmpeg-full": {
|
||||
@@ -19,11 +19,10 @@
|
||||
"--device=all",
|
||||
"--share=network",
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--socket=x11",
|
||||
"--socket=pulseaudio",
|
||||
"--filesystem=host:ro",
|
||||
"--talk-name=org.freedesktop.ScreenSaver"
|
||||
"--talk-name=org.freedesktop.ScreenSaver",
|
||||
"--env=QT_QPA_PLATFORM=xcb"
|
||||
],
|
||||
"modules": [
|
||||
"modules/10-libpcap.json",
|
||||
@@ -39,8 +38,8 @@
|
||||
"env": {
|
||||
"DEPS_PREFIX": "/app",
|
||||
"COMPILER": "clang",
|
||||
"CLANG_PATH": "/usr/lib/sdk/llvm16/bin/clang",
|
||||
"CLANGXX_PATH": "/usr/lib/sdk/llvm16/bin/clang++",
|
||||
"CLANG_PATH": "/usr/lib/sdk/llvm17/bin/clang",
|
||||
"CLANGXX_PATH": "/usr/lib/sdk/llvm17/bin/clang++",
|
||||
"ADDITIONAL_CMAKE_ARGS": "-DUSE_LINKED_FFMPEG=ON"
|
||||
}
|
||||
},
|
||||
@@ -60,7 +59,8 @@
|
||||
"install -Dm644 bin/resources/icons/AppIconLarge.png ${FLATPAK_DEST}/share/icons/hicolor/512x512/apps/net.pcsx2.PCSX2.png",
|
||||
"install -Dm644 .github/workflows/scripts/linux/pcsx2-qt.desktop ${FLATPAK_DEST}/share/applications/net.pcsx2.PCSX2.desktop",
|
||||
"desktop-file-edit --set-key=Icon --set-value=net.pcsx2.PCSX2 ${FLATPAK_DEST}/share/applications/net.pcsx2.PCSX2.desktop",
|
||||
"install -Dm644 .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.pcsx2.PCSX2.metainfo.xml"
|
||||
"install -Dm644 .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.pcsx2.PCSX2.metainfo.xml",
|
||||
"mkdir -p ${FLATPAK_DEST}/lib/ffmpeg"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -6,8 +6,8 @@ source "$SCRIPTDIR/functions.sh"
|
||||
set -e
|
||||
|
||||
ARCH=x86_64
|
||||
KDE_BRANCH=6.5
|
||||
BRANCH=22.08
|
||||
KDE_BRANCH=6.6
|
||||
BRANCH=23.08
|
||||
FLAT_MANAGER_CLIENT_DIR="$HOME/.local/bin"
|
||||
|
||||
# Build packages. Mostly needed for flat-manager-client.
|
||||
@@ -30,7 +30,7 @@ declare -a FLATPAK_PACKAGES=(
|
||||
"org.kde.Platform/${ARCH}/${KDE_BRANCH}"
|
||||
"org.kde.Sdk/${ARCH}/${KDE_BRANCH}"
|
||||
"org.freedesktop.Platform.ffmpeg-full/${ARCH}/${BRANCH}"
|
||||
"org.freedesktop.Sdk.Extension.llvm16/${ARCH}/${BRANCH}"
|
||||
"org.freedesktop.Sdk.Extension.llvm17/${ARCH}/${BRANCH}"
|
||||
"org.freedesktop.appstream-glib/${ARCH}/stable"
|
||||
)
|
||||
|
||||
@@ -46,6 +46,9 @@ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub
|
||||
echo "Will install the following packages for building - ${FLATPAK_PACKAGES[*]}"
|
||||
retry_command sudo flatpak -y install "${FLATPAK_PACKAGES[@]}"
|
||||
|
||||
echo "Installing Flatpak Builder"
|
||||
retry_command sudo flatpak -y install flathub org.flatpak.builder
|
||||
|
||||
echo "Downloading flat-manager-client"
|
||||
mkdir -p "$FLAT_MANAGER_CLIENT_DIR"
|
||||
pushd "$FLAT_MANAGER_CLIENT_DIR"
|
||||
|
||||
@@ -41,6 +41,7 @@ declare -a PCSX2_PACKAGES=(
|
||||
"libasound2-dev"
|
||||
"libbz2-dev"
|
||||
"libcurl4-openssl-dev"
|
||||
"libdbus-1-dev"
|
||||
"libegl1-mesa-dev"
|
||||
"libgl1-mesa-dev"
|
||||
"libgtk-3-dev"
|
||||
@@ -64,11 +65,11 @@ declare -a PCSX2_PACKAGES=(
|
||||
)
|
||||
|
||||
if [ "${COMPILER}" = "clang" ]; then
|
||||
BUILD_PACKAGES+=("llvm-16" "lld-16" "clang-16")
|
||||
BUILD_PACKAGES+=("llvm-17" "lld-17" "clang-17")
|
||||
|
||||
# Ubuntu 22.04 doesn't ship with LLVM 16, so we need to pull it from the llvm.org repos.
|
||||
retry_command wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo apt-add-repository -n 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
|
||||
sudo apt-add-repository -n 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main'
|
||||
fi
|
||||
|
||||
retry_command sudo apt-get -qq update && break
|
||||
|
||||
@@ -2,16 +2,15 @@
|
||||
|
||||
set -e
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.14
|
||||
export MACOSX_DEPLOYMENT_TARGET=11.0
|
||||
|
||||
INSTALLDIR="$HOME/deps"
|
||||
NPROCS="$(getconf _NPROCESSORS_ONLN)"
|
||||
SDL=SDL2-2.28.1
|
||||
SDL=SDL2-2.28.4
|
||||
PNG=1.6.37
|
||||
JPG=9e
|
||||
SOUNDTOUCH=soundtouch-2.3.1
|
||||
FFMPEG=6.0
|
||||
QT=6.4.3 # Currently stuck on Qt 6.4 due to 6.5 requiring macOS 11.0.
|
||||
QT=6.6.0
|
||||
|
||||
mkdir deps-build
|
||||
cd deps-build
|
||||
@@ -22,23 +21,19 @@ export CFLAGS="-I$INSTALLDIR/include -Os $CFLAGS"
|
||||
export CXXFLAGS="-I$INSTALLDIR/include -Os $CXXFLAGS"
|
||||
|
||||
cat > SHASUMS <<EOF
|
||||
4977ceba5c0054dbe6c2f114641aced43ce3bf2b41ea64b6a372d6ba129cb15d $SDL.tar.gz
|
||||
888b8c39f36ae2035d023d1b14ab0191eb1d26403c3cf4d4d5ede30e66a4942c $SDL.tar.gz
|
||||
505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca libpng-$PNG.tar.xz
|
||||
4077d6a6a75aeb01884f708919d25934c93305e49f7e3f36db9129320e6f4f3d jpegsrc.v$JPG.tar.gz
|
||||
6900996607258496ce126924a19fe9d598af9d892cf3f33d1e4daaa9b42ae0b1 $SOUNDTOUCH.tar.gz
|
||||
57be87c22d9b49c112b6d24bc67d42508660e6b718b3db89c44e47e289137082 ffmpeg-$FFMPEG.tar.xz
|
||||
5087c9e5b0165e7bc3c1a4ab176b35d0cd8f52636aea903fa377bdba00891a60 qtbase-everywhere-src-$QT.tar.xz
|
||||
0aff58062e74b84617c5da8325d8cdad5368d8f4d2a11ceafcd58329fe99b798 qtimageformats-everywhere-src-$QT.tar.xz
|
||||
88315f886cf81898705e487cedba6e6160724359d23c518c92c333c098879a4a qtsvg-everywhere-src-$QT.tar.xz
|
||||
867df829cd5cd3ae8efe62e825503123542764b13c96953511e567df70c5a091 qttools-everywhere-src-$QT.tar.xz
|
||||
79e56b7800d49649a8a8010818538c367a829e0b7a09d5f60bd3aecf5abe972c qttranslations-everywhere-src-$QT.tar.xz
|
||||
039d53312acb5897a9054bd38c9ccbdab72500b71fdccdb3f4f0844b0dd39e0e qtbase-everywhere-src-$QT.tar.xz
|
||||
e1542cb50176e237809895c6549598c08587c63703d100be54ac2d806834e384 qtimageformats-everywhere-src-$QT.tar.xz
|
||||
33da25fef51102f564624a7ea3e57cb4a0a31b7b44783d1af5749ac36d3c72de qtsvg-everywhere-src-$QT.tar.xz
|
||||
4e9feebc142bbb6e453e1dc3277e09ec45c8ef081b5ee2a029e6684b5905ba99 qttools-everywhere-src-$QT.tar.xz
|
||||
a0d89a236f64b810eb0fe4ae1e90db22b0e86263521b35f89e69f1392815078c qttranslations-everywhere-src-$QT.tar.xz
|
||||
EOF
|
||||
|
||||
curl -L \
|
||||
-O "https://libsdl.org/release/$SDL.tar.gz" \
|
||||
-O "https://downloads.sourceforge.net/project/libpng/libpng16/$PNG/libpng-$PNG.tar.xz" \
|
||||
-O "https://www.ijg.org/files/jpegsrc.v$JPG.tar.gz" \
|
||||
-O "https://www.surina.net/soundtouch/$SOUNDTOUCH.tar.gz" \
|
||||
-O "https://ffmpeg.org/releases/ffmpeg-$FFMPEG.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtbase-everywhere-src-$QT.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtimageformats-everywhere-src-$QT.tar.xz" \
|
||||
@@ -51,9 +46,27 @@ shasum -a 256 --check SHASUMS
|
||||
echo "Installing SDL..."
|
||||
tar xf "$SDL.tar.gz"
|
||||
cd "$SDL"
|
||||
./configure --prefix "$INSTALLDIR" --without-x
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
|
||||
# MFI causes multiple joystick connection events, I'm guessing because both the HIDAPI and MFI interfaces
|
||||
# race each other, and sometimes both end up getting through. So, just force MFI off.
|
||||
patch -u CMakeLists.txt <<EOF
|
||||
--- CMakeLists.txt 2023-08-03 01:33:11
|
||||
+++ CMakeLists.txt 2023-08-26 12:58:53
|
||||
@@ -2105,7 +2105,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreHaptics/CoreHaptics.h>
|
||||
int main() { return 0; }" HAVE_FRAMEWORK_COREHAPTICS)
|
||||
- if(HAVE_FRAMEWORK_GAMECONTROLLER AND HAVE_FRAMEWORK_COREHAPTICS)
|
||||
+ if(HAVE_FRAMEWORK_GAMECONTROLLER AND HAVE_FRAMEWORK_COREHAPTICS AND FALSE)
|
||||
# Only enable MFI if we also have CoreHaptics to ensure rumble works
|
||||
set(SDL_JOYSTICK_MFI 1)
|
||||
set(SDL_FRAMEWORK_GAMECONTROLLER 1)
|
||||
|
||||
EOF
|
||||
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DSDL_X11=OFF
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Installing libpng..."
|
||||
@@ -64,22 +77,6 @@ make "-j$NPROCS"
|
||||
make install
|
||||
cd ..
|
||||
|
||||
echo "Installing libjpeg..."
|
||||
tar xf "jpegsrc.v$JPG.tar.gz"
|
||||
cd "jpeg-$JPG"
|
||||
./configure --prefix "$INSTALLDIR" --disable-dependency-tracking
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ..
|
||||
|
||||
echo "Installing soundtouch..."
|
||||
tar xf "$SOUNDTOUCH.tar.gz"
|
||||
cd "$SOUNDTOUCH"
|
||||
cmake -B build -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=MinSizeRel
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Installing FFmpeg..."
|
||||
tar xf "ffmpeg-$FFMPEG.tar.xz"
|
||||
cd "ffmpeg-$FFMPEG"
|
||||
@@ -96,90 +93,6 @@ cd ..
|
||||
echo "Installing Qt Base..."
|
||||
tar xf "qtbase-everywhere-src-$QT.tar.xz"
|
||||
cd "qtbase-everywhere-src-$QT"
|
||||
# Qt's panel:shouldEnableURL: implementation does a whole bunch of things that activate macOS's sandbox permissions dialog
|
||||
# Since this is called on every file being displayed in the open/save panel, that spams users with permissions dialogs
|
||||
# Simple solution: Hopefully no one needs any filters that aren't simple file extension filters, remove all other handling
|
||||
patch -u src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm <<EOF
|
||||
--- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
|
||||
+++ src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
|
||||
@@ -133,7 +133,5 @@
|
||||
NSURL *url = [NSURL fileURLWithPath:filepath isDirectory:info.isDir()];
|
||||
- bool selectable = (m_options->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||
- || [self panel:m_panel shouldEnableURL:url];
|
||||
|
||||
m_panel.directoryURL = [NSURL fileURLWithPath:m_currentDirectory];
|
||||
- m_panel.nameFieldStringValue = selectable ? info.fileName().toNSString() : @"";
|
||||
+ m_panel.nameFieldStringValue = info.fileName().toNSString();
|
||||
|
||||
@@ -203,61 +201,2 @@
|
||||
return hidden;
|
||||
-}
|
||||
-
|
||||
-- (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url
|
||||
-{
|
||||
- Q_UNUSED(sender);
|
||||
-
|
||||
- NSString *filename = url.path;
|
||||
- if (!filename.length)
|
||||
- return NO;
|
||||
-
|
||||
- // Always accept directories regardless of their names (unless it is a bundle):
|
||||
- NSFileManager *fm = NSFileManager.defaultManager;
|
||||
- NSDictionary *fileAttrs = [fm attributesOfItemAtPath:filename error:nil];
|
||||
- if (!fileAttrs)
|
||||
- return NO; // Error accessing the file means 'no'.
|
||||
- NSString *fileType = fileAttrs.fileType;
|
||||
- bool isDir = [fileType isEqualToString:NSFileTypeDirectory];
|
||||
- if (isDir) {
|
||||
- if (!m_panel.treatsFilePackagesAsDirectories) {
|
||||
- if ([NSWorkspace.sharedWorkspace isFilePackageAtPath:filename] == NO)
|
||||
- return YES;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- // Treat symbolic links and aliases to directories like directories
|
||||
- QFileInfo fileInfo(QString::fromNSString(filename));
|
||||
- if (fileInfo.isSymLink() && QFileInfo(fileInfo.symLinkTarget()).isDir())
|
||||
- return YES;
|
||||
-
|
||||
- QString qtFileName = fileInfo.fileName();
|
||||
- // No filter means accept everything
|
||||
- bool nameMatches = m_selectedNameFilter->isEmpty();
|
||||
- // Check if the current file name filter accepts the file:
|
||||
- for (int i = 0; !nameMatches && i < m_selectedNameFilter->size(); ++i) {
|
||||
- if (QDir::match(m_selectedNameFilter->at(i), qtFileName))
|
||||
- nameMatches = true;
|
||||
- }
|
||||
- if (!nameMatches)
|
||||
- return NO;
|
||||
-
|
||||
- QDir::Filters filter = m_options->filter();
|
||||
- if ((!(filter & (QDir::Dirs | QDir::AllDirs)) && isDir)
|
||||
- || (!(filter & QDir::Files) && [fileType isEqualToString:NSFileTypeRegular])
|
||||
- || ((filter & QDir::NoSymLinks) && [fileType isEqualToString:NSFileTypeSymbolicLink]))
|
||||
- return NO;
|
||||
-
|
||||
- bool filterPermissions = ((filter & QDir::PermissionMask)
|
||||
- && (filter & QDir::PermissionMask) != QDir::PermissionMask);
|
||||
- if (filterPermissions) {
|
||||
- if ((!(filter & QDir::Readable) && [fm isReadableFileAtPath:filename])
|
||||
- || (!(filter & QDir::Writable) && [fm isWritableFileAtPath:filename])
|
||||
- || (!(filter & QDir::Executable) && [fm isExecutableFileAtPath:filename]))
|
||||
- return NO;
|
||||
- }
|
||||
- if (!(filter & QDir::Hidden)
|
||||
- && (qtFileName.startsWith(u'.') || [self isHiddenFileAtURL:url]))
|
||||
- return NO;
|
||||
-
|
||||
- return YES;
|
||||
}
|
||||
@@ -406,5 +345,2 @@
|
||||
{
|
||||
- if (m_options->acceptMode() != QFileDialogOptions::AcceptSave)
|
||||
- return nil; // panel:shouldEnableURL: does the file filtering for NSOpenPanel
|
||||
-
|
||||
QStringList fileTypes;
|
||||
EOF
|
||||
cmake -B build -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release -DFEATURE_optimize_size=ON -DFEATURE_dbus=OFF -DFEATURE_framework=OFF -DFEATURE_icu=OFF -DFEATURE_opengl=OFF -DFEATURE_printsupport=OFF -DFEATURE_sql=OFF -DFEATURE_gssapi=OFF
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
|
||||
@@ -1,7 +1,58 @@
|
||||
import { MessageEmbed, WebhookClient } from "discord.js";
|
||||
import * as github from '@actions/github';
|
||||
import { Octokit } from "@octokit/rest";
|
||||
import { throttling } from "@octokit/plugin-throttling";
|
||||
import { retry } from "@octokit/plugin-retry";
|
||||
|
||||
const releaseInfo = github.context.payload.release;
|
||||
let owner = process.env.OWNER;
|
||||
let repo = process.env.REPO;
|
||||
|
||||
Octokit.plugin(throttling);
|
||||
Octokit.plugin(retry);
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.GITHUB_TOKEN,
|
||||
userAgent: `${owner}/${repo}`,
|
||||
log: {
|
||||
debug: () => { },
|
||||
info: () => { },
|
||||
warn: console.warn,
|
||||
error: console.error
|
||||
},
|
||||
throttle: {
|
||||
onRateLimit: (retryAfter, options) => {
|
||||
octokit.log.warn(
|
||||
`Request quota exhausted for request ${options.method} ${options.url}`
|
||||
);
|
||||
|
||||
// Retry twice after hitting a rate limit error, then give up
|
||||
if (options.request.retryCount <= 2) {
|
||||
console.log(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onAbuseLimit: (retryAfter, options) => {
|
||||
// does not retry, only logs a warning
|
||||
octokit.log.warn(
|
||||
`Abuse detected for request ${options.method} ${options.url}`
|
||||
);
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
if (process.env.TAG_VAL === undefined || process.env.TAG_VAL === "") {
|
||||
console.log(`Not announcing - TAG_VAL not defined`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const { data: releaseInfo } = await octokit.rest.repos.getReleaseByTag({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
tag: process.env.TAG_VAL,
|
||||
});
|
||||
|
||||
if (releaseInfo === undefined) {
|
||||
console.log(`Not announcing - could not locate release with tag ${process.env.TAG_VAL}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!releaseInfo.prerelease) {
|
||||
console.log("Not announcing - release was not a pre-release (aka a Nightly)");
|
||||
@@ -18,6 +69,7 @@ const embed = new MessageEmbed()
|
||||
{ name: 'Installation Steps', value: '[See Here](https://github.com/PCSX2/pcsx2/wiki/Nightly-Build-Usage-Guide)', inline: true },
|
||||
{ name: 'Included Changes', value: releaseInfo.body, inline: false }
|
||||
);
|
||||
console.log(embed);
|
||||
|
||||
// Get all webhooks, simple comma-sep string
|
||||
const webhookUrls = process.env.DISCORD_BUILD_WEBHOOK.split(",");
|
||||
|
||||
141
.github/workflows/scripts/releases/announce-release/package-lock.json
generated
vendored
141
.github/workflows/scripts/releases/announce-release/package-lock.json
generated
vendored
@@ -5,32 +5,16 @@
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "announce-release",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@actions/github": "^5.0.0",
|
||||
"@octokit/plugin-retry": "^3.0.9",
|
||||
"@octokit/plugin-throttling": "^3.5.2",
|
||||
"@octokit/rest": "^18.12.0",
|
||||
"discord.js": "^13.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/github": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.0.tgz",
|
||||
"integrity": "sha512-QvE9eAAfEsS+yOOk0cylLBIO/d6WyWIOvsxxzdrPFaud39G6BOkUwScXZn1iBzQzHyu9SBkkLSWlohDWdsasAQ==",
|
||||
"dependencies": {
|
||||
"@actions/http-client": "^1.0.11",
|
||||
"@octokit/core": "^3.4.0",
|
||||
"@octokit/plugin-paginate-rest": "^2.13.3",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^5.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/http-client": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
|
||||
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
|
||||
"dependencies": {
|
||||
"tunnel": "0.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/builders": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.6.0.tgz",
|
||||
@@ -131,6 +115,14 @@
|
||||
"@octokit/types": "^6.33.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/plugin-request-log": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz",
|
||||
"integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==",
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=3"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/plugin-rest-endpoint-methods": {
|
||||
"version": "5.12.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.12.1.tgz",
|
||||
@@ -140,6 +132,27 @@
|
||||
"deprecation": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/plugin-retry": {
|
||||
"version": "3.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-3.0.9.tgz",
|
||||
"integrity": "sha512-r+fArdP5+TG6l1Rv/C9hVoty6tldw6cE2pRHNGmFPdyfrc696R6JjrQ3d7HdVqGwuzfyrcaLAKD7K8TX8aehUQ==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^6.0.3",
|
||||
"bottleneck": "^2.15.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/plugin-throttling": {
|
||||
"version": "3.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-3.7.0.tgz",
|
||||
"integrity": "sha512-qrKT1Yl/KuwGSC6/oHpLBot3ooC9rq0/ryDYBCpkRtoj+R8T47xTMDT6Tk2CxWopFota/8Pi/2SqArqwC0JPow==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^6.0.1",
|
||||
"bottleneck": "^2.15.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": "^3.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/request": {
|
||||
"version": "5.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.2.tgz",
|
||||
@@ -163,6 +176,17 @@
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/rest": {
|
||||
"version": "18.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.12.0.tgz",
|
||||
"integrity": "sha512-gDPiOHlyGavxr72y0guQEhLsemgVjwRePayJ+FcKc2SJqKUbxbkvf5kAZEWA/MKvsfYlQAMVzNJE3ezQcxMJ2Q==",
|
||||
"dependencies": {
|
||||
"@octokit/core": "^3.5.1",
|
||||
"@octokit/plugin-paginate-rest": "^2.16.8",
|
||||
"@octokit/plugin-request-log": "^1.0.4",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^5.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/types": {
|
||||
"version": "6.33.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.33.0.tgz",
|
||||
@@ -214,6 +238,11 @@
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz",
|
||||
"integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ=="
|
||||
},
|
||||
"node_modules/bottleneck": {
|
||||
"version": "2.19.5",
|
||||
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
|
||||
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw=="
|
||||
},
|
||||
"node_modules/callsites": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
||||
@@ -388,14 +417,6 @@
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
},
|
||||
"node_modules/tunnel": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
|
||||
"engines": {
|
||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||
}
|
||||
},
|
||||
"node_modules/type-fest": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz",
|
||||
@@ -461,25 +482,6 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/github": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.0.tgz",
|
||||
"integrity": "sha512-QvE9eAAfEsS+yOOk0cylLBIO/d6WyWIOvsxxzdrPFaud39G6BOkUwScXZn1iBzQzHyu9SBkkLSWlohDWdsasAQ==",
|
||||
"requires": {
|
||||
"@actions/http-client": "^1.0.11",
|
||||
"@octokit/core": "^3.4.0",
|
||||
"@octokit/plugin-paginate-rest": "^2.13.3",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^5.1.1"
|
||||
}
|
||||
},
|
||||
"@actions/http-client": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
|
||||
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
|
||||
"requires": {
|
||||
"tunnel": "0.0.6"
|
||||
}
|
||||
},
|
||||
"@discordjs/builders": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.6.0.tgz",
|
||||
@@ -569,6 +571,12 @@
|
||||
"@octokit/types": "^6.33.0"
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-request-log": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz",
|
||||
"integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==",
|
||||
"requires": {}
|
||||
},
|
||||
"@octokit/plugin-rest-endpoint-methods": {
|
||||
"version": "5.12.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.12.1.tgz",
|
||||
@@ -578,6 +586,24 @@
|
||||
"deprecation": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-retry": {
|
||||
"version": "3.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-3.0.9.tgz",
|
||||
"integrity": "sha512-r+fArdP5+TG6l1Rv/C9hVoty6tldw6cE2pRHNGmFPdyfrc696R6JjrQ3d7HdVqGwuzfyrcaLAKD7K8TX8aehUQ==",
|
||||
"requires": {
|
||||
"@octokit/types": "^6.0.3",
|
||||
"bottleneck": "^2.15.3"
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-throttling": {
|
||||
"version": "3.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-3.7.0.tgz",
|
||||
"integrity": "sha512-qrKT1Yl/KuwGSC6/oHpLBot3ooC9rq0/ryDYBCpkRtoj+R8T47xTMDT6Tk2CxWopFota/8Pi/2SqArqwC0JPow==",
|
||||
"requires": {
|
||||
"@octokit/types": "^6.0.1",
|
||||
"bottleneck": "^2.15.3"
|
||||
}
|
||||
},
|
||||
"@octokit/request": {
|
||||
"version": "5.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.2.tgz",
|
||||
@@ -601,6 +627,17 @@
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"@octokit/rest": {
|
||||
"version": "18.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.12.0.tgz",
|
||||
"integrity": "sha512-gDPiOHlyGavxr72y0guQEhLsemgVjwRePayJ+FcKc2SJqKUbxbkvf5kAZEWA/MKvsfYlQAMVzNJE3ezQcxMJ2Q==",
|
||||
"requires": {
|
||||
"@octokit/core": "^3.5.1",
|
||||
"@octokit/plugin-paginate-rest": "^2.16.8",
|
||||
"@octokit/plugin-request-log": "^1.0.4",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^5.12.0"
|
||||
}
|
||||
},
|
||||
"@octokit/types": {
|
||||
"version": "6.33.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.33.0.tgz",
|
||||
@@ -642,6 +679,11 @@
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz",
|
||||
"integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ=="
|
||||
},
|
||||
"bottleneck": {
|
||||
"version": "2.19.5",
|
||||
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
|
||||
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw=="
|
||||
},
|
||||
"callsites": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
||||
@@ -765,11 +807,6 @@
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
},
|
||||
"tunnel": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
|
||||
},
|
||||
"type-fest": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz",
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@actions/github": "^5.0.0",
|
||||
"@octokit/plugin-retry": "^3.0.9",
|
||||
"@octokit/plugin-throttling": "^3.5.2",
|
||||
"@octokit/rest": "^18.12.0",
|
||||
"discord.js": "^13.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
162
.github/workflows/scripts/windows/build-dependencies.bat
vendored
Normal file
162
.github/workflows/scripts/windows/build-dependencies.bat
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
echo Setting environment...
|
||||
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" (
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
||||
) else if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" (
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
) else (
|
||||
echo Visual Studio 2022 not found.
|
||||
goto error
|
||||
)
|
||||
|
||||
set SEVENZIP="C:\Program Files\7-Zip\7z.exe"
|
||||
|
||||
if defined DEBUG (
|
||||
echo DEBUG=%DEBUG%
|
||||
) else (
|
||||
set DEBUG=1
|
||||
)
|
||||
|
||||
pushd %~dp0
|
||||
set "SCRIPTDIR=%CD%"
|
||||
cd ..\..\..\..
|
||||
mkdir deps-build
|
||||
cd deps-build || goto error
|
||||
set "BUILDDIR=%CD%"
|
||||
cd ..
|
||||
mkdir deps
|
||||
cd deps || goto error
|
||||
set "INSTALLDIR=%CD%"
|
||||
popd
|
||||
|
||||
echo SCRIPTDIR=%SCRIPTDIR%
|
||||
echo BUILDDIR=%BUILDDIR%
|
||||
echo INSTALLDIR=%INSTALLDIR%
|
||||
|
||||
cd "%BUILDDIR%"
|
||||
|
||||
set QT=6.6.0
|
||||
set QTMINOR=6.6
|
||||
set SDL=SDL2-2.28.4
|
||||
|
||||
call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" b53b9b42e731a33552d0a533316a88009b423c16a8a3a418df9ffe498c37da3d || goto error
|
||||
call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" 0b9dafd9a42deeb55fd4b74a6caaa6871a03d0051ddb54ea4ea448f28cb90ecc || goto error
|
||||
call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" ae31eadd81da19e1bba0d72e16d29fdce0b98e991c4dcbf6351acf09967fd175 || goto error
|
||||
call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtsvg-everywhere-src-%QT%.zip" 88b4b1a8224465cb04feed2a37823e95e959164cf824e9969648335614a4c855 || goto error
|
||||
call :downloadfile "qttools-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttools-everywhere-src-%QT%.zip" 051787f12e2457425f35f31e642163f0d481cdd687b4b164ca41ddb84d5ea3a6 || goto error
|
||||
call :downloadfile "qttranslations-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttranslations-everywhere-src-%QT%.zip" 5d04b33336d3d49512eedfa85b378f0805dc4d8770365db318234b125deef9dc || goto error
|
||||
|
||||
if %DEBUG%==1 (
|
||||
echo Building debug and release libraries...
|
||||
) else (
|
||||
echo Building release libraries...
|
||||
)
|
||||
|
||||
echo Building SDL...
|
||||
rmdir /S /Q "%SDL%"
|
||||
%SEVENZIP% x "%SDL%.zip" || goto error
|
||||
cd "%SDL%" || goto error
|
||||
if %DEBUG%==1 (
|
||||
cmake -B build-debug -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DSDL_SHARED=ON -DSDL_STATIC=OFF -G Ninja || goto error
|
||||
cmake --build build-debug --parallel || goto error
|
||||
ninja -C build-debug install || goto error
|
||||
)
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DSDL_SHARED=ON -DSDL_STATIC=OFF -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
if %DEBUG%==1 (
|
||||
set QTBUILDSPEC=-DCMAKE_CONFIGURATION_TYPES="Release;Debug" -G "Ninja Multi-Config"
|
||||
) else (
|
||||
set QTBUILDSPEC=-DCMAKE_BUILD_TYPE=Release -G Ninja
|
||||
)
|
||||
|
||||
echo Building Qt base...
|
||||
rmdir /S /Q "qtbase-everywhere-src-%QT%"
|
||||
%SEVENZIP% x "qtbase-everywhere-src-%QT%.zip" || goto error
|
||||
cd "qtbase-everywhere-src-%QT%" || goto error
|
||||
cmake -B build -DFEATURE_sql=OFF -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DINPUT_gui=yes -DINPUT_widgets=yes -DINPUT_ssl=yes -DINPUT_openssl=no -DINPUT_schannel=yes %QTBUILDSPEC% || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building Qt SVG...
|
||||
rmdir /S /Q "qtsvg-everywhere-src-%QT%"
|
||||
%SEVENZIP% x "qtsvg-everywhere-src-%QT%.zip" || goto error
|
||||
cd "qtsvg-everywhere-src-%QT%" || goto error
|
||||
mkdir build || goto error
|
||||
cd build || goto error
|
||||
call "%INSTALLDIR%\bin\qt-configure-module.bat" .. || goto error
|
||||
cmake --build . --parallel || goto error
|
||||
ninja install || goto error
|
||||
cd ..\.. || goto error
|
||||
|
||||
echo Building Qt Image Formats...
|
||||
rmdir /S /Q "qtimageformats-everywhere-src-%QT%"
|
||||
%SEVENZIP% x "qtimageformats-everywhere-src-%QT%.zip" || goto error
|
||||
cd "qtimageformats-everywhere-src-%QT%" || goto error
|
||||
mkdir build || goto error
|
||||
cd build || goto error
|
||||
call "%INSTALLDIR%\bin\qt-configure-module.bat" .. || goto error
|
||||
cmake --build . --parallel || goto error
|
||||
ninja install || goto error
|
||||
cd ..\.. || goto error
|
||||
|
||||
echo Building Qt Tools...
|
||||
rmdir /S /Q "qtimageformats-everywhere-src-%QT%"
|
||||
%SEVENZIP% x "qttools-everywhere-src-%QT%.zip" || goto error
|
||||
cd "qttools-everywhere-src-%QT%" || goto error
|
||||
mkdir build || goto error
|
||||
cd build || goto error
|
||||
call "%INSTALLDIR%\bin\qt-configure-module.bat" .. -- -DFEATURE_assistant=OFF -DFEATURE_clang=OFF -DFEATURE_designer=OFF -DFEATURE_kmap2qmap=OFF -DFEATURE_pixeltool=OFF -DFEATURE_pkg_config=OFF -DFEATURE_qev=OFF -DFEATURE_qtattributionsscanner=OFF -DFEATURE_qtdiag=OFF -DFEATURE_qtplugininfo=OFF || goto error
|
||||
cmake --build . --parallel || goto error
|
||||
ninja install || goto error
|
||||
cd ..\.. || goto error
|
||||
|
||||
echo Building Qt Translations...
|
||||
rmdir /S /Q "qttranslations-everywhere-src-%QT%"
|
||||
%SEVENZIP% x "qttranslations-everywhere-src-%QT%.zip" || goto error
|
||||
cd "qttranslations-everywhere-src-%QT%" || goto error
|
||||
mkdir build || goto error
|
||||
cd build || goto error
|
||||
call "%INSTALLDIR%\bin\qt-configure-module.bat" .. || goto error
|
||||
cmake --build . --parallel || goto error
|
||||
ninja install || goto error
|
||||
cd ..\.. || goto error
|
||||
|
||||
echo Cleaning up...
|
||||
cd ..
|
||||
rd /S /Q deps-build
|
||||
|
||||
echo Exiting with success.
|
||||
exit 0
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
pause
|
||||
exit %errorlevel%
|
||||
|
||||
:downloadfile
|
||||
if not exist "%~1" (
|
||||
echo Downloading %~1 from %~2...
|
||||
curl -L -o "%~1" "%~2" || goto error
|
||||
)
|
||||
|
||||
rem based on https://gist.github.com/gsscoder/e22daefaff9b5d8ac16afb070f1a7971
|
||||
set idx=0
|
||||
for /f %%F in ('certutil -hashfile "%~1" SHA256') do (
|
||||
set "out!idx!=%%F"
|
||||
set /a idx += 1
|
||||
)
|
||||
set filechecksum=%out1%
|
||||
|
||||
if /i %~3==%filechecksum% (
|
||||
echo Validated %~1.
|
||||
exit /B 0
|
||||
) else (
|
||||
echo Expected %~3 got %filechecksum%.
|
||||
exit /B 1
|
||||
)
|
||||
2
.github/workflows/windows_build_matrix.yml
vendored
2
.github/workflows/windows_build_matrix.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Verify VS Project Files
|
||||
run: .github\workflows\scripts\windows\validate-vs-filters.ps1
|
||||
|
||||
|
||||
35
.github/workflows/windows_build_qt.yml
vendored
35
.github/workflows/windows_build_qt.yml
vendored
@@ -29,14 +29,6 @@ on:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
qt_binary_url:
|
||||
required: false
|
||||
type: string
|
||||
default: https://github.com/PCSX2/pcsx2-windows-dependencies/releases/download/2023-04-25/qt-6.5.0-x64.7z
|
||||
qt_dir:
|
||||
required: false
|
||||
type: string
|
||||
default: 3rdparty\qt\6.5.0\msvc2022_64
|
||||
patchesUrl:
|
||||
required: false
|
||||
type: string
|
||||
@@ -51,13 +43,13 @@ jobs:
|
||||
name: ${{ inputs.jobName }}
|
||||
runs-on: ${{ inputs.os }}
|
||||
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
|
||||
timeout-minutes: 60
|
||||
timeout-minutes: 90
|
||||
env:
|
||||
POWERSHELL_TELEMETRY_OPTOUT: 1
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -84,27 +76,32 @@ jobs:
|
||||
if: inputs.configuration != 'CMake'
|
||||
uses: microsoft/setup-msbuild@v1
|
||||
|
||||
- name: Download Qt build files
|
||||
shell: cmd
|
||||
run: |
|
||||
cd 3rdparty\qt
|
||||
aria2c ${{ inputs.qt_binary_url }}
|
||||
7z x qt-*-x64.7z
|
||||
del qt-*-x64.7z
|
||||
|
||||
- name: Download patches
|
||||
shell: cmd
|
||||
run: |
|
||||
cd bin/resources
|
||||
aria2c -Z "${{ inputs.patchesUrl }}/patches.zip"
|
||||
|
||||
- name: Cache Dependencies
|
||||
id: cache-deps
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: deps
|
||||
key: ${{ inputs.os }} ${{ inputs.platform }} deps ${{ hashFiles('.github/workflows/scripts/windows/build-dependencies.bat') }}
|
||||
|
||||
- name: Build Dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
env:
|
||||
DEBUG: 0
|
||||
run: .github/workflows/scripts/windows/build-dependencies.bat
|
||||
|
||||
- name: Generate CMake
|
||||
if: inputs.configuration == 'CMake'
|
||||
id: cmake
|
||||
shell: cmd
|
||||
run: |
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
||||
cmake . -B build ${{ inputs.cmakeFlags }} "-DCMAKE_PREFIX_PATH=%cd%\${{ inputs.qt_dir }}" -DQT_BUILD=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DDISABLE_ADVANCE_SIMD=ON -G Ninja
|
||||
cmake . -B build ${{ inputs.cmakeFlags }} "-DCMAKE_PREFIX_PATH=%cd%\deps" -DQT_BUILD=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DDISABLE_ADVANCE_SIMD=ON -G Ninja
|
||||
|
||||
- name: Build PCSX2
|
||||
shell: cmd
|
||||
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -23,13 +23,6 @@
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
**/Win32/Release*
|
||||
**/Win32/Debug*
|
||||
**/Win32/Devel*
|
||||
**/x64/Release*
|
||||
**/x64/Debug*
|
||||
**/x64/Devel*
|
||||
|
||||
_ReSharper.*
|
||||
pcsx2.snapshot_*
|
||||
svnrev.h
|
||||
@@ -44,6 +37,7 @@ Thumbs.db
|
||||
Debug.txt
|
||||
install_log.txt
|
||||
bad_shader_*
|
||||
crash-*.txt
|
||||
|
||||
Debug
|
||||
Release
|
||||
|
||||
12
.gitmodules
vendored
12
.gitmodules
vendored
@@ -7,9 +7,6 @@
|
||||
[submodule "3rdparty/fmt/fmt"]
|
||||
path = 3rdparty/fmt/fmt
|
||||
url = https://github.com/fmtlib/fmt.git
|
||||
[submodule "3rdparty/libchdr/libchdr"]
|
||||
path = 3rdparty/libchdr/libchdr
|
||||
url = https://github.com/rtissera/libchdr.git
|
||||
[submodule "3rdparty/wil"]
|
||||
path = 3rdparty/wil
|
||||
url = https://github.com/microsoft/wil.git
|
||||
@@ -24,15 +21,12 @@
|
||||
[submodule "3rdparty/vulkan-headers"]
|
||||
path = 3rdparty/vulkan-headers
|
||||
url = https://github.com/KhronosGroup/Vulkan-Headers.git
|
||||
[submodule "3rdparty/sdl2/SDL"]
|
||||
path = 3rdparty/sdl2/SDL
|
||||
url = https://github.com/libsdl-org/SDL.git
|
||||
[submodule "3rdparty/libzip/libzip"]
|
||||
path = 3rdparty/libzip/libzip
|
||||
url = https://github.com/nih-at/libzip.git
|
||||
[submodule "3rdparty/zstd/zstd"]
|
||||
path = 3rdparty/zstd/zstd
|
||||
url = https://github.com/facebook/zstd.git
|
||||
[submodule "3rdparty/rcheevos/rcheevos"]
|
||||
path = 3rdparty/rcheevos/rcheevos
|
||||
url = https://github.com/RetroAchievements/rcheevos.git
|
||||
[submodule "3rdparty/libwebp/libwebp"]
|
||||
path = 3rdparty/libwebp/libwebp
|
||||
url = https://github.com/webmproject/libwebp
|
||||
|
||||
4
3rdparty/3rdparty.props
vendored
4
3rdparty/3rdparty.props
vendored
@@ -2,8 +2,8 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30128.1</_ProjectFileVersion>
|
||||
<OutDir>$(SolutionDir)deps\$(PlatformName)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformName)\$(Configuration)\</IntDir>
|
||||
<OutDir>$(SolutionDir)build\3rdparty\lib-$(PlatformName)-$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)build\3rdparty\obj-$(ProjectName)-$(PlatformName)-$(Configuration)\</IntDir>
|
||||
<ExtensionsToDeleteOnClean>*.bsc;*.idb;*.sbr;*.res;*.pch;*.pdb;*.obj;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;$(TargetPath);$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
|
||||
770
3rdparty/cpuinfo/CMakeLists.txt
vendored
770
3rdparty/cpuinfo/CMakeLists.txt
vendored
@@ -3,7 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.5 FATAL_ERROR)
|
||||
# ---[ Setup project
|
||||
PROJECT(
|
||||
cpuinfo
|
||||
LANGUAGES C CXX
|
||||
LANGUAGES C
|
||||
)
|
||||
|
||||
# ---[ Options.
|
||||
@@ -13,6 +13,26 @@ SET(CPUINFO_RUNTIME_TYPE "default" CACHE STRING "Type of runtime library (shared
|
||||
SET_PROPERTY(CACHE CPUINFO_RUNTIME_TYPE PROPERTY STRINGS default static shared)
|
||||
SET(CPUINFO_LOG_LEVEL "default" CACHE STRING "Minimum logging level (info with lower severity will be ignored)")
|
||||
SET_PROPERTY(CACHE CPUINFO_LOG_LEVEL PROPERTY STRINGS default debug info warning error fatal none)
|
||||
IF(ANDROID)
|
||||
OPTION(CPUINFO_LOG_TO_STDIO "Log errors, warnings, and information to stdout/stderr" OFF)
|
||||
ELSE()
|
||||
OPTION(CPUINFO_LOG_TO_STDIO "Log errors, warnings, and information to stdout/stderr" ON)
|
||||
ENDIF()
|
||||
OPTION(CPUINFO_BUILD_TOOLS "Build command-line tools" OFF)
|
||||
OPTION(CPUINFO_BUILD_UNIT_TESTS "Build cpuinfo unit tests" OFF)
|
||||
OPTION(CPUINFO_BUILD_MOCK_TESTS "Build cpuinfo mock tests" OFF)
|
||||
OPTION(CPUINFO_BUILD_BENCHMARKS "Build cpuinfo micro-benchmarks" OFF)
|
||||
OPTION(CPUINFO_BUILD_PKG_CONFIG "Build pkg-config manifest" OFF)
|
||||
OPTION(USE_SYSTEM_LIBS "Use system libraries instead of downloading and building them" OFF)
|
||||
OPTION(USE_SYSTEM_GOOGLEBENCHMARK "Use system Google Benchmark library instead of downloading and building it" ${USE_SYSTEM_LIBS})
|
||||
OPTION(USE_SYSTEM_GOOGLETEST "Use system Google Test library instead of downloading and building it" ${USE_SYSTEM_LIBS})
|
||||
|
||||
# ---[ CMake options
|
||||
INCLUDE(GNUInstallDirs)
|
||||
|
||||
IF(CPUINFO_BUILD_UNIT_TESTS OR CPUINFO_BUILD_MOCK_TESTS)
|
||||
ENABLE_TESTING()
|
||||
ENDIF()
|
||||
|
||||
MACRO(CPUINFO_TARGET_ENABLE_C99 target)
|
||||
SET_TARGET_PROPERTIES(${target} PROPERTIES
|
||||
@@ -22,7 +42,7 @@ ENDMACRO()
|
||||
|
||||
MACRO(CPUINFO_TARGET_ENABLE_CXX11 target)
|
||||
SET_TARGET_PROPERTIES(${target} PROPERTIES
|
||||
CXX_STANDARD 11
|
||||
CXX_STANDARD 14
|
||||
CXX_EXTENSIONS NO)
|
||||
ENDMACRO()
|
||||
|
||||
@@ -38,10 +58,29 @@ MACRO(CPUINFO_TARGET_RUNTIME_LIBRARY target)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# -- [ Determine whether building for Apple's desktop or mobile OSes
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "^(Darwin|iOS|tvOS|watchOS)$")
|
||||
SET(IS_APPLE_OS TRUE)
|
||||
ELSE()
|
||||
SET(IS_APPLE_OS FALSE)
|
||||
ENDIF()
|
||||
|
||||
# -- [ Determine target processor
|
||||
SET(CPUINFO_TARGET_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_ARCHITECTURES MATCHES "^(x86_64|arm64)$")
|
||||
IF(IS_APPLE_OS AND CMAKE_OSX_ARCHITECTURES MATCHES "^(x86_64|arm64.*)$")
|
||||
SET(CPUINFO_TARGET_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}")
|
||||
ELSEIF(CMAKE_GENERATOR MATCHES "^Visual Studio " AND CMAKE_VS_PLATFORM_NAME)
|
||||
IF(CMAKE_VS_PLATFORM_NAME STREQUAL "Win32")
|
||||
SET(CPUINFO_TARGET_PROCESSOR "x86")
|
||||
ELSEIF(CMAKE_VS_PLATFORM_NAME STREQUAL "x64")
|
||||
SET(CPUINFO_TARGET_PROCESSOR "x86_64")
|
||||
ELSEIF(CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
|
||||
SET(CPUINFO_TARGET_PROCESSOR "arm64")
|
||||
ELSEIF(CMAKE_VS_PLATFORM_NAME MATCHES "^(ARM64EC|arm64ec|ARM64E|arm64e)")
|
||||
SET(CPUINFO_TARGET_PROCESSOR "arm64")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unsupported Visual Studio architecture \"${CMAKE_VS_PLATFORM_NAME}\"")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# ---[ Build flags
|
||||
@@ -53,20 +92,21 @@ IF(NOT CMAKE_SYSTEM_PROCESSOR)
|
||||
"cpuinfo will compile, but cpuinfo_initialize() will always fail.")
|
||||
SET(CPUINFO_SUPPORTED_PLATFORM FALSE)
|
||||
ENDIF()
|
||||
ELSEIF(NOT CPUINFO_TARGET_PROCESSOR MATCHES "^(i[3-6]86|AMD64|x86(_64)?|armv[5-8].*|aarch64|arm64)$")
|
||||
ELSEIF(NOT CPUINFO_TARGET_PROCESSOR MATCHES "^(i[3-6]86|AMD64|x86(_64)?|armv[5-8].*|aarch64|arm64.*|ARM64.*|riscv(32|64))$")
|
||||
MESSAGE(WARNING
|
||||
"Target processor architecture \"${CPUINFO_TARGET_PROCESSOR}\" is not supported in cpuinfo. "
|
||||
"cpuinfo will compile, but cpuinfo_initialize() will always fail.")
|
||||
SET(CPUINFO_SUPPORTED_PLATFORM FALSE)
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(NOT CMAKE_SYSTEM_NAME)
|
||||
MESSAGE(WARNING
|
||||
"Target operating system is not specified. "
|
||||
"cpuinfo will compile, but cpuinfo_initialize() will always fail.")
|
||||
SET(CPUINFO_SUPPORTED_PLATFORM FALSE)
|
||||
ELSEIF(NOT CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS|Darwin|Linux|Android)$")
|
||||
IF(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14" AND NOT CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
ELSEIF(NOT CMAKE_SYSTEM_NAME MATCHES "^(Windows|WindowsStore|CYGWIN|MSYS|Darwin|Linux|Android)$")
|
||||
IF(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14" AND NOT IS_APPLE_OS)
|
||||
MESSAGE(WARNING
|
||||
"Target operating system \"${CMAKE_SYSTEM_NAME}\" is not supported in cpuinfo. "
|
||||
"cpuinfo will compile, but cpuinfo_initialize() will always fail.")
|
||||
@@ -74,11 +114,48 @@ ELSEIF(NOT CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS|Darwin|Linux|Android
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(CPUINFO_SUPPORTED_PLATFORM)
|
||||
IF(CPUINFO_BUILD_MOCK_TESTS OR CPUINFO_BUILD_UNIT_TESTS OR CPUINFO_BUILD_BENCHMARKS)
|
||||
ENABLE_LANGUAGE(CXX)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# ---[ Download deps
|
||||
SET(CONFU_DEPENDENCIES_SOURCE_DIR ${CMAKE_SOURCE_DIR}/deps
|
||||
CACHE PATH "Confu-style dependencies source directory")
|
||||
SET(CONFU_DEPENDENCIES_BINARY_DIR ${CMAKE_BINARY_DIR}/deps
|
||||
CACHE PATH "Confu-style dependencies binary directory")
|
||||
|
||||
IF(CPUINFO_SUPPORTED_PLATFORM AND (CPUINFO_BUILD_MOCK_TESTS OR CPUINFO_BUILD_UNIT_TESTS))
|
||||
IF(USE_SYSTEM_GOOGLETEST)
|
||||
FIND_PACKAGE(GTest REQUIRED)
|
||||
ELSEIF(NOT DEFINED GOOGLETEST_SOURCE_DIR)
|
||||
MESSAGE(STATUS "Downloading Google Test to ${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest (define GOOGLETEST_SOURCE_DIR to avoid it)")
|
||||
CONFIGURE_FILE(cmake/DownloadGoogleTest.cmake "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download/CMakeLists.txt")
|
||||
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download")
|
||||
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download")
|
||||
SET(GOOGLETEST_SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest" CACHE STRING "Google Test source directory")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(CPUINFO_SUPPORTED_PLATFORM AND CPUINFO_BUILD_BENCHMARKS)
|
||||
IF(USE_SYSTEM_GOOGLEBENCHMARK)
|
||||
FIND_PACKAGE(benchmark REQUIRED)
|
||||
ELSEIF(NOT DEFINED GOOGLEBENCHMARK_SOURCE_DIR)
|
||||
MESSAGE(STATUS "Downloading Google Benchmark to ${CONFU_DEPENDENCIES_SOURCE_DIR}/googlebenchmark (define GOOGLEBENCHMARK_SOURCE_DIR to avoid it)")
|
||||
CONFIGURE_FILE(cmake/DownloadGoogleBenchmark.cmake "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark-download/CMakeLists.txt")
|
||||
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark-download")
|
||||
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark-download")
|
||||
SET(GOOGLEBENCHMARK_SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googlebenchmark" CACHE STRING "Google Benchmark source directory")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# ---[ cpuinfo library
|
||||
SET(CPUINFO_SRCS
|
||||
src/init.c
|
||||
src/api.c
|
||||
src/cache.c)
|
||||
SET(CPUINFO_SRCS src/api.c src/cache.c src/init.c src/log.c)
|
||||
|
||||
IF(CPUINFO_SUPPORTED_PLATFORM)
|
||||
IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten" AND (CPUINFO_TARGET_PROCESSOR MATCHES "^(i[3-6]86|AMD64|x86(_64)?)$" OR IOS_ARCH MATCHES "^(i386|x86_64)$"))
|
||||
@@ -97,12 +174,16 @@ IF(CPUINFO_SUPPORTED_PLATFORM)
|
||||
LIST(APPEND CPUINFO_SRCS
|
||||
src/x86/linux/init.c
|
||||
src/x86/linux/cpuinfo.c)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
ELSEIF(IS_APPLE_OS)
|
||||
LIST(APPEND CPUINFO_SRCS src/x86/mach/init.c)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$")
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "^(Windows|WindowsStore|CYGWIN|MSYS)$")
|
||||
LIST(APPEND CPUINFO_SRCS src/x86/windows/init.c)
|
||||
ENDIF()
|
||||
ELSEIF(CPUINFO_TARGET_PROCESSOR MATCHES "^(armv[5-8].*|aarch64|arm64)$" OR IOS_ARCH MATCHES "^(armv7.*|arm64.*)$")
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "^Windows" AND CPUINFO_TARGET_PROCESSOR MATCHES "^(ARM64|arm64)$")
|
||||
LIST(APPEND CPUINFO_SRCS
|
||||
src/arm/windows/init-by-logical-sys-info.c
|
||||
src/arm/windows/init.c)
|
||||
ELSEIF(CPUINFO_TARGET_PROCESSOR MATCHES "^(armv[5-8].*|aarch64|arm64.*)$" OR IOS_ARCH MATCHES "^(armv7.*|arm64.*)$")
|
||||
LIST(APPEND CPUINFO_SRCS
|
||||
src/arm/uarch.c
|
||||
src/arm/cache.c)
|
||||
@@ -122,13 +203,22 @@ IF(CPUINFO_SUPPORTED_PLATFORM)
|
||||
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)$")
|
||||
LIST(APPEND CPUINFO_SRCS src/arm/linux/aarch64-isa.c)
|
||||
ENDIF()
|
||||
ELSEIF(IOS OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CPUINFO_TARGET_PROCESSOR STREQUAL "arm64"))
|
||||
ELSEIF(IS_APPLE_OS AND CPUINFO_TARGET_PROCESSOR MATCHES "arm64.*")
|
||||
LIST(APPEND CPUINFO_SRCS src/arm/mach/init.c)
|
||||
ENDIF()
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
LIST(APPEND CPUINFO_SRCS
|
||||
src/arm/android/properties.c)
|
||||
ENDIF()
|
||||
ELSEIF(CPUINFO_TARGET_PROCESSOR MATCHES "^(riscv(32|64))$")
|
||||
LIST(APPEND CPUINFO_SRCS
|
||||
src/riscv/uarch.c)
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
LIST(APPEND CPUINFO_SRCS
|
||||
src/riscv/linux/init.c
|
||||
src/riscv/linux/riscv-hw.c
|
||||
src/riscv/linux/riscv-isa.c)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
||||
@@ -142,7 +232,7 @@ IF(CPUINFO_SUPPORTED_PLATFORM)
|
||||
src/linux/multiline.c
|
||||
src/linux/cpulist.c
|
||||
src/linux/processors.c)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
ELSEIF(IS_APPLE_OS)
|
||||
LIST(APPEND CPUINFO_SRCS src/mach/topology.c)
|
||||
ENDIF()
|
||||
|
||||
@@ -166,34 +256,43 @@ ADD_LIBRARY(cpuinfo_internals STATIC ${CPUINFO_SRCS})
|
||||
CPUINFO_TARGET_ENABLE_C99(cpuinfo)
|
||||
CPUINFO_TARGET_ENABLE_C99(cpuinfo_internals)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(cpuinfo)
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$")
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "^(Windows|WindowsStore|CYGWIN|MSYS)$")
|
||||
# Target Windows 7+ API
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE _WIN32_WINNT=0x0601)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo_internals PRIVATE _WIN32_WINNT=0x0601)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE _WIN32_WINNT=0x0601 _CRT_SECURE_NO_WARNINGS)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo_internals PRIVATE _WIN32_WINNT=0x0601 _CRT_SECURE_NO_WARNINGS)
|
||||
# Explicitly link Kernel32 for UWP build
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
TARGET_LINK_LIBRARIES(cpuinfo PUBLIC Kernel32)
|
||||
endif()
|
||||
ENDIF()
|
||||
IF(ANDROID AND NOT CPUINFO_LOG_TO_STDIO)
|
||||
TARGET_LINK_LIBRARIES(cpuinfo PRIVATE "log")
|
||||
ENDIF()
|
||||
SET_TARGET_PROPERTIES(cpuinfo PROPERTIES PUBLIC_HEADER include/cpuinfo.h)
|
||||
TARGET_INCLUDE_DIRECTORIES(cpuinfo BEFORE PUBLIC include)
|
||||
TARGET_INCLUDE_DIRECTORIES(cpuinfo BEFORE PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
TARGET_INCLUDE_DIRECTORIES(cpuinfo BEFORE PRIVATE src)
|
||||
TARGET_INCLUDE_DIRECTORIES(cpuinfo_internals BEFORE PUBLIC include src)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE "CPUINFO_LOG_TO_STDIO=$<BOOL:${CPUINFO_LOG_TO_STDIO}>")
|
||||
IF(CPUINFO_LOG_LEVEL STREQUAL "default")
|
||||
# default logging level: error (subject to change)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE CPUINFO_LOG_LEVEL=2)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE "CPUINFO_LOG_LEVEL=2")
|
||||
ELSEIF(CPUINFO_LOG_LEVEL STREQUAL "debug")
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE CPUINFO_LOG_LEVEL=5)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE "CPUINFO_LOG_LEVEL=5")
|
||||
ELSEIF(CPUINFO_LOG_LEVEL STREQUAL "info")
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE CPUINFO_LOG_LEVEL=4)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE "CPUINFO_LOG_LEVEL=4")
|
||||
ELSEIF(CPUINFO_LOG_LEVEL STREQUAL "warning")
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE CPUINFO_LOG_LEVEL=3)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE "CPUINFO_LOG_LEVEL=3")
|
||||
ELSEIF(CPUINFO_LOG_LEVEL STREQUAL "error")
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE CPUINFO_LOG_LEVEL=2)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE "CPUINFO_LOG_LEVEL=2")
|
||||
ELSEIF(CPUINFO_LOG_LEVEL STREQUAL "fatal")
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE CPUINFO_LOG_LEVEL=1)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE "CPUINFO_LOG_LEVEL=1")
|
||||
ELSEIF(CPUINFO_LOG_LEVEL STREQUAL "none")
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE CPUINFO_LOG_LEVEL=0)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE "CPUINFO_LOG_LEVEL=0")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unsupported logging level ${CPUINFO_LOG_LEVEL}")
|
||||
ENDIF()
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo_internals PRIVATE CPUINFO_LOG_LEVEL=0)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo_internals PRIVATE "CPUINFO_LOG_LEVEL=0")
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo_internals PRIVATE "CPUINFO_LOG_TO_STDIO=1")
|
||||
|
||||
IF(CPUINFO_SUPPORTED_PLATFORM)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo INTERFACE CPUINFO_SUPPORTED_PLATFORM=1)
|
||||
@@ -207,17 +306,610 @@ ELSE()
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo INTERFACE CPUINFO_SUPPORTED_PLATFORM=0)
|
||||
ENDIF()
|
||||
|
||||
# ---[ cpuinfo dependencies: clog
|
||||
IF(NOT DEFINED CLOG_SOURCE_DIR)
|
||||
SET(CLOG_SOURCE_DIR "${PROJECT_SOURCE_DIR}/deps/clog")
|
||||
ADD_LIBRARY(${PROJECT_NAME}::cpuinfo ALIAS cpuinfo)
|
||||
|
||||
# support find_package(cpuinfo CONFIG)
|
||||
INCLUDE(CMakePackageConfigHelpers)
|
||||
GET_FILENAME_COMPONENT(CONFIG_FILE_PATH ${CMAKE_CURRENT_BINARY_DIR}/cpuinfo-config.cmake ABSOLUTE)
|
||||
CONFIGURE_PACKAGE_CONFIG_FILE(
|
||||
cmake/cpuinfo-config.cmake.in ${CONFIG_FILE_PATH}
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME})
|
||||
INSTALL(FILES ${CONFIG_FILE_PATH}
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}) # cpuinfo_DIR ${prefix}/share/cpuinfo
|
||||
|
||||
INSTALL(TARGETS cpuinfo
|
||||
EXPORT cpuinfo-targets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
INSTALL(EXPORT cpuinfo-targets
|
||||
NAMESPACE ${PROJECT_NAME}:: # IMPORTED cpuinfo::cpuinfo
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME})
|
||||
|
||||
# ---[ cpuinfo micro-benchmarks
|
||||
IF(CPUINFO_SUPPORTED_PLATFORM AND CPUINFO_BUILD_BENCHMARKS)
|
||||
# ---[ Build google benchmark
|
||||
IF(NOT TARGET benchmark AND NOT USE_SYSTEM_GOOGLEBENCHMARK)
|
||||
SET(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "")
|
||||
ADD_SUBDIRECTORY(
|
||||
"${GOOGLEBENCHMARK_SOURCE_DIR}"
|
||||
"${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark")
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "^(Linux|Android)$")
|
||||
ADD_EXECUTABLE(get-current-bench bench/get-current.cc)
|
||||
TARGET_LINK_LIBRARIES(get-current-bench cpuinfo benchmark)
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(init-bench bench/init.cc)
|
||||
TARGET_LINK_LIBRARIES(init-bench cpuinfo benchmark)
|
||||
ENDIF()
|
||||
IF(NOT TARGET clog)
|
||||
SET(CLOG_BUILD_TESTS OFF CACHE BOOL "")
|
||||
SET(CLOG_RUNTIME_TYPE "${CPUINFO_RUNTIME_TYPE}" CACHE STRING "")
|
||||
ADD_SUBDIRECTORY(
|
||||
"${CLOG_SOURCE_DIR}")
|
||||
# We build static version of clog but a dynamic library may indirectly depend on it
|
||||
SET_PROPERTY(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
IF(CPUINFO_SUPPORTED_PLATFORM)
|
||||
IF(CPUINFO_BUILD_MOCK_TESTS OR CPUINFO_BUILD_UNIT_TESTS)
|
||||
# ---[ Build google test
|
||||
IF(NOT TARGET gtest AND NOT USE_SYSTEM_GOOGLETEST)
|
||||
IF(MSVC AND NOT CPUINFO_RUNTIME_TYPE STREQUAL "static")
|
||||
SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
ENDIF()
|
||||
ADD_SUBDIRECTORY(
|
||||
"${GOOGLETEST_SOURCE_DIR}"
|
||||
"${CONFU_DEPENDENCIES_BINARY_DIR}/googletest")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# ---[ cpuinfo mock library and mock tests
|
||||
IF(CPUINFO_SUPPORTED_PLATFORM AND CPUINFO_BUILD_MOCK_TESTS)
|
||||
SET(CPUINFO_MOCK_SRCS "${CPUINFO_SRCS}")
|
||||
IF(CPUINFO_TARGET_PROCESSOR MATCHES "^(i[3-6]86|AMD64|x86(_64)?)$")
|
||||
LIST(APPEND CPUINFO_MOCK_SRCS src/x86/mockcpuid.c)
|
||||
ENDIF()
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
LIST(APPEND CPUINFO_MOCK_SRCS src/linux/mockfile.c)
|
||||
ENDIF()
|
||||
|
||||
ADD_LIBRARY(cpuinfo_mock STATIC ${CPUINFO_MOCK_SRCS})
|
||||
CPUINFO_TARGET_ENABLE_C99(cpuinfo_mock)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(cpuinfo_mock)
|
||||
SET_TARGET_PROPERTIES(cpuinfo_mock PROPERTIES PUBLIC_HEADER include/cpuinfo.h)
|
||||
TARGET_INCLUDE_DIRECTORIES(cpuinfo_mock BEFORE PUBLIC include)
|
||||
TARGET_INCLUDE_DIRECTORIES(cpuinfo_mock BEFORE PRIVATE src)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PUBLIC "CPUINFO_MOCK=1")
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PRIVATE "CPUINFO_LOG_LEVEL=5")
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PRIVATE "CPUINFO_LOG_TO_STDIO=1")
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
TARGET_LINK_LIBRARIES(cpuinfo_mock PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PRIVATE _GNU_SOURCE=1)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7-a)$")
|
||||
ADD_EXECUTABLE(atm7029b-tablet-test test/mock/atm7029b-tablet.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(atm7029b-tablet-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(atm7029b-tablet-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME atm7029b-tablet-test COMMAND atm7029b-tablet-test)
|
||||
|
||||
ADD_EXECUTABLE(blu-r1-hd-test test/mock/blu-r1-hd.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(blu-r1-hd-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(blu-r1-hd-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME blu-r1-hd-test COMMAND blu-r1-hd-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-a3-2016-eu-test test/mock/galaxy-a3-2016-eu.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-a3-2016-eu-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-a3-2016-eu-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-a3-2016-eu-test COMMAND galaxy-a3-2016-eu-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-a8-2016-duos-test test/mock/galaxy-a8-2016-duos.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-a8-2016-duos-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-a8-2016-duos-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-a8-2016-duos-test COMMAND galaxy-a8-2016-duos-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-grand-prime-value-edition-test test/mock/galaxy-grand-prime-value-edition.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-grand-prime-value-edition-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-grand-prime-value-edition-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-grand-prime-value-edition-test COMMAND galaxy-grand-prime-value-edition-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-j1-2016-test test/mock/galaxy-j1-2016.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-j1-2016-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-j1-2016-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-j1-2016-test COMMAND galaxy-j1-2016-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-j5-test test/mock/galaxy-j5.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-j5-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-j5-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-j5-test COMMAND galaxy-j5-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-j7-prime-test test/mock/galaxy-j7-prime.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-j7-prime-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-j7-prime-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-j7-prime-test COMMAND galaxy-j7-prime-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-j7-tmobile-test test/mock/galaxy-j7-tmobile.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-j7-tmobile-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-j7-tmobile-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-j7-tmobile-test COMMAND galaxy-j7-tmobile-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-j7-uae-test test/mock/galaxy-j7-uae.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-j7-uae-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-j7-uae-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-j7-uae-test COMMAND galaxy-j7-uae-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s3-us-test test/mock/galaxy-s3-us.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s3-us-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s3-us-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s3-us-test COMMAND galaxy-s3-us-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s4-us-test test/mock/galaxy-s4-us.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s4-us-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s4-us-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s4-us-test COMMAND galaxy-s4-us-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s5-global-test test/mock/galaxy-s5-global.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s5-global-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s5-global-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s5-global-test COMMAND galaxy-s5-global-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s5-us-test test/mock/galaxy-s5-us.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s5-us-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s5-us-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s5-us-test COMMAND galaxy-s5-us-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-tab-3-7.0-test test/mock/galaxy-tab-3-7.0.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-tab-3-7.0-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-tab-3-7.0-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-tab-3-7.0-test COMMAND galaxy-tab-3-7.0-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-tab-3-lite-test test/mock/galaxy-tab-3-lite.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-tab-3-lite-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-tab-3-lite-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-tab-3-lite-test COMMAND galaxy-tab-3-lite-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-win-duos-test test/mock/galaxy-win-duos.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-win-duos-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-win-duos-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-win-duos-test COMMAND galaxy-win-duos-test)
|
||||
|
||||
ADD_EXECUTABLE(huawei-ascend-p7-test test/mock/huawei-ascend-p7.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(huawei-ascend-p7-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(huawei-ascend-p7-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME huawei-ascend-p7-test COMMAND huawei-ascend-p7-test)
|
||||
|
||||
ADD_EXECUTABLE(huawei-honor-6-test test/mock/huawei-honor-6.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(huawei-honor-6-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(huawei-honor-6-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME huawei-honor-6-test COMMAND huawei-honor-6-test)
|
||||
|
||||
ADD_EXECUTABLE(lenovo-a6600-plus-test test/mock/lenovo-a6600-plus.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(lenovo-a6600-plus-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(lenovo-a6600-plus-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME lenovo-a6600-plus-test COMMAND lenovo-a6600-plus-test)
|
||||
|
||||
ADD_EXECUTABLE(lenovo-vibe-x2-test test/mock/lenovo-vibe-x2.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(lenovo-vibe-x2-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(lenovo-vibe-x2-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME lenovo-vibe-x2-test COMMAND lenovo-vibe-x2-test)
|
||||
|
||||
ADD_EXECUTABLE(lg-k10-eu-test test/mock/lg-k10-eu.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(lg-k10-eu-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(lg-k10-eu-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME lg-k10-eu-test COMMAND lg-k10-eu-test)
|
||||
|
||||
ADD_EXECUTABLE(lg-optimus-g-pro-test test/mock/lg-optimus-g-pro.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(lg-optimus-g-pro-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(lg-optimus-g-pro-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME lg-optimus-g-pro-test COMMAND lg-optimus-g-pro-test)
|
||||
|
||||
ADD_EXECUTABLE(moto-e-gen1-test test/mock/moto-e-gen1.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(moto-e-gen1-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(moto-e-gen1-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME moto-e-gen1-test COMMAND moto-e-gen1-test)
|
||||
|
||||
ADD_EXECUTABLE(moto-g-gen1-test test/mock/moto-g-gen1.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(moto-g-gen1-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(moto-g-gen1-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME moto-g-gen1-test COMMAND moto-g-gen1-test)
|
||||
|
||||
ADD_EXECUTABLE(moto-g-gen2-test test/mock/moto-g-gen2.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(moto-g-gen2-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(moto-g-gen2-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME moto-g-gen2-test COMMAND moto-g-gen2-test)
|
||||
|
||||
ADD_EXECUTABLE(moto-g-gen3-test test/mock/moto-g-gen3.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(moto-g-gen3-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(moto-g-gen3-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME moto-g-gen3-test COMMAND moto-g-gen3-test)
|
||||
|
||||
ADD_EXECUTABLE(moto-g-gen4-test test/mock/moto-g-gen4.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(moto-g-gen4-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(moto-g-gen4-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME moto-g-gen4-test COMMAND moto-g-gen4-test)
|
||||
|
||||
ADD_EXECUTABLE(moto-g-gen5-test test/mock/moto-g-gen5.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(moto-g-gen5-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(moto-g-gen5-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME moto-g-gen5-test COMMAND moto-g-gen5-test)
|
||||
|
||||
ADD_EXECUTABLE(nexus-s-test test/mock/nexus-s.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(nexus-s-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(nexus-s-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME nexus-s-test COMMAND nexus-s-test)
|
||||
|
||||
ADD_EXECUTABLE(nexus4-test test/mock/nexus4.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(nexus4-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(nexus4-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME nexus4-test COMMAND nexus4-test)
|
||||
|
||||
ADD_EXECUTABLE(nexus6-test test/mock/nexus6.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(nexus6-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(nexus6-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME nexus6-test COMMAND nexus6-test)
|
||||
|
||||
ADD_EXECUTABLE(nexus10-test test/mock/nexus10.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(nexus10-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(nexus10-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME nexus10-test COMMAND nexus10-test)
|
||||
|
||||
ADD_EXECUTABLE(padcod-10.1-test test/mock/padcod-10.1.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(padcod-10.1-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(padcod-10.1-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME padcod-10.1-test COMMAND padcod-10.1-test)
|
||||
|
||||
ADD_EXECUTABLE(xiaomi-redmi-2a-test test/mock/xiaomi-redmi-2a.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(xiaomi-redmi-2a-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(xiaomi-redmi-2a-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME xiaomi-redmi-2a-test COMMAND xiaomi-redmi-2a-test)
|
||||
|
||||
ADD_EXECUTABLE(xperia-sl-test test/mock/xperia-sl.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(xperia-sl-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(xperia-sl-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME xperia-sl-test COMMAND xperia-sl-test)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7-a|aarch64)$")
|
||||
ADD_EXECUTABLE(alcatel-revvl-test test/mock/alcatel-revvl.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(alcatel-revvl-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(alcatel-revvl-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME alcatel-revvl-test COMMAND alcatel-revvl-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-a8-2018-test test/mock/galaxy-a8-2018.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-a8-2018-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-a8-2018-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-a8-2018-test COMMAND galaxy-a8-2018-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-c9-pro-test test/mock/galaxy-c9-pro.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-c9-pro-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-c9-pro-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-c9-pro-test COMMAND galaxy-c9-pro-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s6-test test/mock/galaxy-s6.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s6-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s6-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s6-test COMMAND galaxy-s6-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s7-us-test test/mock/galaxy-s7-us.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s7-us-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s7-us-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s7-us-test COMMAND galaxy-s7-us-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s7-global-test test/mock/galaxy-s7-global.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s7-global-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s7-global-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s7-global-test COMMAND galaxy-s7-global-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s8-us-test test/mock/galaxy-s8-us.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s8-us-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s8-us-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s8-us-test COMMAND galaxy-s8-us-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s8-global-test test/mock/galaxy-s8-global.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s8-global-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s8-global-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s8-global-test COMMAND galaxy-s8-global-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s9-us-test test/mock/galaxy-s9-us.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s9-us-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s9-us-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s9-us-test COMMAND galaxy-s9-us-test)
|
||||
|
||||
ADD_EXECUTABLE(galaxy-s9-global-test test/mock/galaxy-s9-global.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(galaxy-s9-global-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(galaxy-s9-global-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME galaxy-s9-global-test COMMAND galaxy-s9-global-test)
|
||||
|
||||
ADD_EXECUTABLE(huawei-mate-8-test test/mock/huawei-mate-8.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(huawei-mate-8-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(huawei-mate-8-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME huawei-mate-8-test COMMAND huawei-mate-8-test)
|
||||
|
||||
ADD_EXECUTABLE(huawei-mate-9-test test/mock/huawei-mate-9.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(huawei-mate-9-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(huawei-mate-9-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME huawei-mate-9-test COMMAND huawei-mate-9-test)
|
||||
|
||||
ADD_EXECUTABLE(huawei-mate-10-test test/mock/huawei-mate-10.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(huawei-mate-10-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(huawei-mate-10-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME huawei-mate-10-test COMMAND huawei-mate-10-test)
|
||||
|
||||
ADD_EXECUTABLE(huawei-mate-20-test test/mock/huawei-mate-20.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(huawei-mate-20-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(huawei-mate-20-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME huawei-mate-20-test COMMAND huawei-mate-20-test)
|
||||
|
||||
ADD_EXECUTABLE(huawei-p8-lite-test test/mock/huawei-p8-lite.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(huawei-p8-lite-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(huawei-p8-lite-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME huawei-p8-lite-test COMMAND huawei-p8-lite-test)
|
||||
|
||||
ADD_EXECUTABLE(huawei-p9-lite-test test/mock/huawei-p9-lite.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(huawei-p9-lite-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(huawei-p9-lite-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME huawei-p9-lite-test COMMAND huawei-p9-lite-test)
|
||||
|
||||
ADD_EXECUTABLE(huawei-p20-pro-test test/mock/huawei-p20-pro.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(huawei-p20-pro-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(huawei-p20-pro-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME huawei-p20-pro-test COMMAND huawei-p20-pro-test)
|
||||
|
||||
ADD_EXECUTABLE(iconia-one-10-test test/mock/iconia-one-10.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(iconia-one-10-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(iconia-one-10-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME iconia-one-10-test COMMAND iconia-one-10-test)
|
||||
|
||||
ADD_EXECUTABLE(meizu-pro-6-test test/mock/meizu-pro-6.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(meizu-pro-6-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(meizu-pro-6-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME meizu-pro-6-test COMMAND meizu-pro-6-test)
|
||||
|
||||
ADD_EXECUTABLE(meizu-pro-6s-test test/mock/meizu-pro-6s.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(meizu-pro-6s-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(meizu-pro-6s-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME meizu-pro-6s-test COMMAND meizu-pro-6s-test)
|
||||
|
||||
ADD_EXECUTABLE(meizu-pro-7-plus-test test/mock/meizu-pro-7-plus.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(meizu-pro-7-plus-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(meizu-pro-7-plus-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME meizu-pro-7-plus-test COMMAND meizu-pro-7-plus-test)
|
||||
|
||||
ADD_EXECUTABLE(nexus5x-test test/mock/nexus5x.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(nexus5x-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(nexus5x-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME nexus5x-test COMMAND nexus5x-test)
|
||||
|
||||
ADD_EXECUTABLE(nexus6p-test test/mock/nexus6p.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(nexus6p-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(nexus6p-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME nexus6p-test COMMAND nexus6p-test)
|
||||
|
||||
ADD_EXECUTABLE(nexus9-test test/mock/nexus9.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(nexus9-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(nexus9-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME nexus9-test COMMAND nexus9-test)
|
||||
|
||||
ADD_EXECUTABLE(oneplus-3t-test test/mock/oneplus-3t.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(oneplus-3t-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(oneplus-3t-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME oneplus-3t-test COMMAND oneplus-3t-test)
|
||||
|
||||
ADD_EXECUTABLE(oneplus-5-test test/mock/oneplus-5.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(oneplus-5-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(oneplus-5-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME oneplus-5-test COMMAND oneplus-5-test)
|
||||
|
||||
ADD_EXECUTABLE(oneplus-5t-test test/mock/oneplus-5t.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(oneplus-5t-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(oneplus-5t-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME oneplus-5t-test COMMAND oneplus-5t-test)
|
||||
|
||||
ADD_EXECUTABLE(oppo-a37-test test/mock/oppo-a37.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(oppo-a37-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(oppo-a37-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME oppo-a37-test COMMAND oppo-a37-test)
|
||||
|
||||
ADD_EXECUTABLE(oppo-r9-test test/mock/oppo-r9.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(oppo-r9-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(oppo-r9-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME oppo-r9-test COMMAND oppo-r9-test)
|
||||
|
||||
ADD_EXECUTABLE(oppo-r15-test test/mock/oppo-r15.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(oppo-r15-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(oppo-r15-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME oppo-r15-test COMMAND oppo-r15-test)
|
||||
|
||||
ADD_EXECUTABLE(pixel-test test/mock/pixel.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(pixel-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(pixel-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME pixel-test COMMAND pixel-test)
|
||||
|
||||
ADD_EXECUTABLE(pixel-c-test test/mock/pixel-c.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(pixel-c-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(pixel-c-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME pixel-c-test COMMAND pixel-c-test)
|
||||
|
||||
ADD_EXECUTABLE(pixel-xl-test test/mock/pixel-xl.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(pixel-xl-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(pixel-xl-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME pixel-xl-test COMMAND pixel-xl-test)
|
||||
|
||||
ADD_EXECUTABLE(pixel-2-xl-test test/mock/pixel-2-xl.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(pixel-2-xl-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(pixel-2-xl-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME pixel-2-xl-test COMMAND pixel-2-xl-test)
|
||||
|
||||
ADD_EXECUTABLE(xiaomi-mi-5c-test test/mock/xiaomi-mi-5c.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(xiaomi-mi-5c-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(xiaomi-mi-5c-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME xiaomi-mi-5c-test COMMAND xiaomi-mi-5c-test)
|
||||
|
||||
ADD_EXECUTABLE(xiaomi-redmi-note-3-test test/mock/xiaomi-redmi-note-3.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(xiaomi-redmi-note-3-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(xiaomi-redmi-note-3-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME xiaomi-redmi-note-3-test COMMAND xiaomi-redmi-note-3-test)
|
||||
|
||||
ADD_EXECUTABLE(xiaomi-redmi-note-4-test test/mock/xiaomi-redmi-note-4.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(xiaomi-redmi-note-4-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(xiaomi-redmi-note-4-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME xiaomi-redmi-note-4-test COMMAND xiaomi-redmi-note-4-test)
|
||||
|
||||
ADD_EXECUTABLE(xperia-c4-dual-test test/mock/xperia-c4-dual.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(xperia-c4-dual-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(xperia-c4-dual-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME xperia-c4-dual-test COMMAND xperia-c4-dual-test)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64)$")
|
||||
ADD_EXECUTABLE(alldocube-iwork8-test test/mock/alldocube-iwork8.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(alldocube-iwork8-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(alldocube-iwork8-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME alldocube-iwork8-test COMMAND alldocube-iwork8-test)
|
||||
|
||||
ADD_EXECUTABLE(leagoo-t5c-test test/mock/leagoo-t5c.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(leagoo-t5c-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(leagoo-t5c-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME leagoo-t5c-test COMMAND leagoo-t5c-test)
|
||||
|
||||
ADD_EXECUTABLE(memo-pad-7-test test/mock/memo-pad-7.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(memo-pad-7-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(memo-pad-7-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME memo-pad-7-test COMMAND memo-pad-7-test)
|
||||
|
||||
ADD_EXECUTABLE(zenfone-c-test test/mock/zenfone-c.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(zenfone-c-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(zenfone-c-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME zenfone-c-test COMMAND zenfone-c-test)
|
||||
|
||||
ADD_EXECUTABLE(zenfone-2-test test/mock/zenfone-2.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(zenfone-2-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(zenfone-2-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME zenfone-2-test COMMAND zenfone-2-test)
|
||||
|
||||
ADD_EXECUTABLE(zenfone-2e-test test/mock/zenfone-2e.cc)
|
||||
TARGET_INCLUDE_DIRECTORIES(zenfone-2e-test BEFORE PRIVATE test/mock)
|
||||
TARGET_LINK_LIBRARIES(zenfone-2e-test PRIVATE cpuinfo_mock gtest)
|
||||
ADD_TEST(NAME zenfone-2e-test COMMAND zenfone-2e-test)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# ---[ cpuinfo unit tests
|
||||
IF(CPUINFO_SUPPORTED_PLATFORM AND CPUINFO_BUILD_UNIT_TESTS)
|
||||
ADD_EXECUTABLE(init-test test/init.cc)
|
||||
CPUINFO_TARGET_ENABLE_CXX11(init-test)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(init-test)
|
||||
TARGET_LINK_LIBRARIES(init-test PRIVATE cpuinfo gtest gtest_main)
|
||||
ADD_TEST(NAME init-test COMMAND init-test)
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
ADD_EXECUTABLE(get-current-test test/get-current.cc)
|
||||
CPUINFO_TARGET_ENABLE_CXX11(get-current-test)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(get-current-test)
|
||||
TARGET_LINK_LIBRARIES(get-current-test PRIVATE cpuinfo gtest gtest_main)
|
||||
ADD_TEST(NAME get-current-test COMMAND get-current-test)
|
||||
ENDIF()
|
||||
|
||||
IF(CPUINFO_TARGET_PROCESSOR MATCHES "^(i[3-6]86|AMD64|x86(_64)?)$")
|
||||
ADD_EXECUTABLE(brand-string-test test/name/brand-string.cc)
|
||||
CPUINFO_TARGET_ENABLE_CXX11(brand-string-test)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(brand-string-test)
|
||||
TARGET_LINK_LIBRARIES(brand-string-test PRIVATE cpuinfo_internals gtest gtest_main)
|
||||
ADD_TEST(NAME brand-string-test COMMAND brand-string-test)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv[5-8].*|aarch64)$")
|
||||
ADD_LIBRARY(android_properties_interface STATIC test/name/android-properties-interface.c)
|
||||
CPUINFO_TARGET_ENABLE_C99(android_properties_interface)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(android_properties_interface)
|
||||
TARGET_LINK_LIBRARIES(android_properties_interface PRIVATE cpuinfo_internals)
|
||||
|
||||
ADD_EXECUTABLE(chipset-test
|
||||
test/name/proc-cpuinfo-hardware.cc
|
||||
test/name/ro-product-board.cc
|
||||
test/name/ro-board-platform.cc
|
||||
test/name/ro-mediatek-platform.cc
|
||||
test/name/ro-arch.cc
|
||||
test/name/ro-chipname.cc
|
||||
test/name/android-properties.cc)
|
||||
CPUINFO_TARGET_ENABLE_CXX11(chipset-test)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(chipset-test)
|
||||
TARGET_LINK_LIBRARIES(chipset-test PRIVATE android_properties_interface gtest gtest_main)
|
||||
ADD_TEST(NAME chipset-test COMMAND chipset-test)
|
||||
|
||||
ADD_EXECUTABLE(cache-test test/arm-cache.cc)
|
||||
CPUINFO_TARGET_ENABLE_CXX11(cache-test)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(cache-test)
|
||||
TARGET_COMPILE_DEFINITIONS(cache-test PRIVATE __STDC_LIMIT_MACROS=1 __STDC_CONSTANT_MACROS=1)
|
||||
TARGET_LINK_LIBRARIES(cache-test PRIVATE cpuinfo_internals gtest gtest_main)
|
||||
ADD_TEST(NAME cache-test COMMAND cache-test)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# ---[ Helper and debug tools
|
||||
IF(CPUINFO_SUPPORTED_PLATFORM AND CPUINFO_BUILD_TOOLS)
|
||||
ADD_EXECUTABLE(isa-info tools/isa-info.c)
|
||||
CPUINFO_TARGET_ENABLE_C99(isa-info)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(isa-info)
|
||||
TARGET_LINK_LIBRARIES(isa-info PRIVATE cpuinfo)
|
||||
INSTALL(TARGETS isa-info RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
ADD_EXECUTABLE(cpu-info tools/cpu-info.c)
|
||||
CPUINFO_TARGET_ENABLE_C99(cpu-info)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(cpu-info)
|
||||
TARGET_LINK_LIBRARIES(cpu-info PRIVATE cpuinfo)
|
||||
INSTALL(TARGETS cpu-info RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
ADD_EXECUTABLE(cache-info tools/cache-info.c)
|
||||
CPUINFO_TARGET_ENABLE_C99(cache-info)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(cache-info)
|
||||
TARGET_LINK_LIBRARIES(cache-info PRIVATE cpuinfo)
|
||||
INSTALL(TARGETS cache-info RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "^(Android|Linux)$" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv[5-8].*|aarch64)$")
|
||||
ADD_EXECUTABLE(auxv-dump tools/auxv-dump.c)
|
||||
CPUINFO_TARGET_ENABLE_C99(auxv-dump)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(auxv-dump)
|
||||
TARGET_LINK_LIBRARIES(auxv-dump PRIVATE ${CMAKE_DL_LIBS} cpuinfo)
|
||||
|
||||
ADD_EXECUTABLE(cpuinfo-dump tools/cpuinfo-dump.c)
|
||||
CPUINFO_TARGET_ENABLE_C99(cpuinfo-dump)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(cpuinfo-dump)
|
||||
ENDIF()
|
||||
|
||||
IF(CPUINFO_TARGET_PROCESSOR MATCHES "^(i[3-6]86|AMD64|x86(_64)?)$")
|
||||
ADD_EXECUTABLE(cpuid-dump tools/cpuid-dump.c)
|
||||
CPUINFO_TARGET_ENABLE_C99(cpuid-dump)
|
||||
CPUINFO_TARGET_RUNTIME_LIBRARY(cpuid-dump)
|
||||
TARGET_INCLUDE_DIRECTORIES(cpuid-dump BEFORE PRIVATE src)
|
||||
TARGET_INCLUDE_DIRECTORIES(cpuid-dump BEFORE PRIVATE include)
|
||||
INSTALL(TARGETS cpuid-dump RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# ---[ pkg-config manifest. This is mostly from JsonCpp...
|
||||
IF(CPUINFO_BUILD_PKG_CONFIG)
|
||||
|
||||
FUNCTION(JOIN_PATHS joined_path first_path_segment)
|
||||
SET(temp_path "${first_path_segment}")
|
||||
FOREACH(current_segment IN LISTS ARGN)
|
||||
IF(NOT ("${current_segment}" STREQUAL ""))
|
||||
IF(IS_ABSOLUTE "${current_segment}")
|
||||
SET(temp_path "${current_segment}")
|
||||
ELSE()
|
||||
SET(temp_path "${temp_path}/${current_segment}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
SET(${joined_path} "${temp_path}" PARENT_SCOPE)
|
||||
ENDFUNCTION()
|
||||
|
||||
JOIN_PATHS(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||
JOIN_PATHS(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
CONFIGURE_FILE(
|
||||
"libcpuinfo.pc.in"
|
||||
"libcpuinfo.pc"
|
||||
@ONLY)
|
||||
|
||||
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/libcpuinfo.pc"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(cpuinfo PRIVATE clog)
|
||||
TARGET_LINK_LIBRARIES(cpuinfo_internals PRIVATE clog)
|
||||
41
3rdparty/cpuinfo/README.md
vendored
41
3rdparty/cpuinfo/README.md
vendored
@@ -48,7 +48,7 @@ Detect if target is a 32-bit or 64-bit ARM system:
|
||||
#endif
|
||||
```
|
||||
|
||||
Check if the host CPU support ARM NEON
|
||||
Check if the host CPU supports ARM NEON
|
||||
|
||||
```c
|
||||
cpuinfo_initialize();
|
||||
@@ -151,6 +151,36 @@ executable(
|
||||
)
|
||||
```
|
||||
|
||||
### Bazel
|
||||
|
||||
This project can be built using [Bazel](https://bazel.build/install).
|
||||
|
||||
You can also use this library as a dependency to your Bazel project. Add to the `WORKSPACE` file:
|
||||
|
||||
```python
|
||||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||
|
||||
git_repository(
|
||||
name = "org_pytorch_cpuinfo",
|
||||
branch = "master",
|
||||
remote = "https://github.com/Vertexwahn/cpuinfo.git",
|
||||
)
|
||||
```
|
||||
|
||||
And to your `BUILD` file:
|
||||
|
||||
```python
|
||||
cc_binary(
|
||||
name = "cpuinfo_test",
|
||||
srcs = [
|
||||
# ...
|
||||
],
|
||||
deps = [
|
||||
"@org_pytorch_cpuinfo//:cpuinfo",
|
||||
],
|
||||
)
|
||||
```
|
||||
|
||||
### CMake
|
||||
|
||||
To use with CMake use the [FindPkgConfig](https://cmake.org/cmake/help/latest/module/FindPkgConfig.html) module. Here is an example:
|
||||
@@ -220,12 +250,14 @@ LDFLAGS+= $(pkg-config --libs libcpuinfo)
|
||||
- [x] x86-64 (iPhone simulator)
|
||||
- [x] ARMv7
|
||||
- [x] ARM64
|
||||
- [x] OS X
|
||||
- [x] macOS
|
||||
- [x] x86
|
||||
- [x] x86-64
|
||||
- [x] ARM64 (Apple silicon)
|
||||
- [x] Windows
|
||||
- [x] x86
|
||||
- [x] x86-64
|
||||
- [x] arm64
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -234,12 +266,13 @@ LDFLAGS+= $(pkg-config --libs libcpuinfo)
|
||||
- [x] Using `/proc/cpuinfo` on ARM
|
||||
- [x] Using `ro.chipname`, `ro.board.platform`, `ro.product.board`, `ro.mediatek.platform`, `ro.arch` properties (Android)
|
||||
- [ ] Using kernel log (`dmesg`) on ARM Linux
|
||||
- [x] Using Windows registry on ARM64 Windows
|
||||
- Vendor and microarchitecture detection
|
||||
- [x] Intel-designed x86/x86-64 cores (up to Sunny Cove, Goldmont Plus, and Knights Mill)
|
||||
- [x] AMD-designed x86/x86-64 cores (up to Puma/Jaguar and Zen 2)
|
||||
- [ ] VIA-designed x86/x86-64 cores
|
||||
- [ ] Other x86 cores (DM&P, RDC, Transmeta, Cyrix, Rise)
|
||||
- [x] ARM-designed ARM cores (up to Cortex-A55, Cortex-A77, and Neoverse E1/N1)
|
||||
- [x] ARM-designed ARM cores (up to Cortex-A55, Cortex-A77, and Neoverse E1/V1/N2/V2)
|
||||
- [x] Qualcomm-designed ARM cores (Scorpion, Krait, and Kryo)
|
||||
- [x] Nvidia-designed ARM cores (Denver and Carmel)
|
||||
- [x] Samsung-designed ARM cores (Exynos)
|
||||
@@ -256,6 +289,7 @@ LDFLAGS+= $(pkg-config --libs libcpuinfo)
|
||||
- [x] Using `/proc/self/auxv` (Android/ARM)
|
||||
- [ ] Using instruction probing on ARM (Linux)
|
||||
- [ ] Using CPUID registers on ARM64 (Linux)
|
||||
- [x] Using IsProcessorFeaturePresent on ARM64 Windows
|
||||
- Cache detection
|
||||
- [x] Using CPUID leaf 0x00000002 (x86/x86-64)
|
||||
- [x] Using CPUID leaf 0x00000004 (non-AMD x86/x86-64)
|
||||
@@ -267,6 +301,7 @@ LDFLAGS+= $(pkg-config --libs libcpuinfo)
|
||||
- [x] Using `sysctlbyname` (Mach)
|
||||
- [x] Using sysfs `typology` directories (ARM/Linux)
|
||||
- [ ] Using sysfs `cache` directories (Linux)
|
||||
- [x] Using `GetLogicalProcessorInformationEx` on ARM64 Windows
|
||||
- TLB detection
|
||||
- [x] Using CPUID leaf 0x00000002 (x86/x86-64)
|
||||
- [ ] Using CPUID leaves 0x80000005-0x80000006 and 0x80000019 (AMD x86/x86-64)
|
||||
|
||||
15
3rdparty/cpuinfo/cmake/DownloadGoogleBenchmark.cmake
vendored
Normal file
15
3rdparty/cpuinfo/cmake/DownloadGoogleBenchmark.cmake
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
|
||||
|
||||
PROJECT(googlebenchmark-download NONE)
|
||||
|
||||
INCLUDE(ExternalProject)
|
||||
ExternalProject_Add(googlebenchmark
|
||||
URL https://github.com/google/benchmark/archive/v1.6.1.zip
|
||||
URL_HASH SHA256=367e963b8620080aff8c831e24751852cffd1f74ea40f25d9cc1b667a9dd5e45
|
||||
SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googlebenchmark"
|
||||
BINARY_DIR "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
15
3rdparty/cpuinfo/cmake/DownloadGoogleTest.cmake
vendored
Normal file
15
3rdparty/cpuinfo/cmake/DownloadGoogleTest.cmake
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
|
||||
|
||||
PROJECT(googletest-download NONE)
|
||||
|
||||
INCLUDE(ExternalProject)
|
||||
ExternalProject_Add(googletest
|
||||
URL https://github.com/google/googletest/archive/release-1.11.0.zip
|
||||
URL_HASH SHA256=353571c2440176ded91c2de6d6cd88ddd41401d14692ec1f99e35d013feda55a
|
||||
SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest"
|
||||
BINARY_DIR "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
12
3rdparty/cpuinfo/cmake/cpuinfo-config.cmake.in
vendored
Normal file
12
3rdparty/cpuinfo/cmake/cpuinfo-config.cmake.in
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
file(GLOB CONFIG_FILES "${_DIR}/cpuinfo-config-*.cmake")
|
||||
foreach(f ${CONFIG_FILES})
|
||||
include(${f})
|
||||
endforeach()
|
||||
|
||||
# ${_DIR}/cpuinfo-targets-*.cmake will be included here
|
||||
include("${_DIR}/cpuinfo-targets.cmake")
|
||||
|
||||
check_required_components(@PROJECT_NAME@)
|
||||
2
3rdparty/cpuinfo/cpuinfo.vcxproj
vendored
2
3rdparty/cpuinfo/cpuinfo.vcxproj
vendored
@@ -59,7 +59,7 @@
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CPUINFO_LOG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir)deps\clog\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<ObjectFileName>$(IntDir)%(RelativeDir)</ObjectFileName>
|
||||
|
||||
63
3rdparty/cpuinfo/deps/clog/CMakeLists.txt
vendored
63
3rdparty/cpuinfo/deps/clog/CMakeLists.txt
vendored
@@ -1,5 +1,7 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
INCLUDE(GNUInstallDirs)
|
||||
|
||||
# ---[ Project and semantic versioning.
|
||||
PROJECT(clog C CXX)
|
||||
|
||||
@@ -11,6 +13,14 @@ IF(ANDROID)
|
||||
ELSE()
|
||||
OPTION(CLOG_LOG_TO_STDIO "Log errors, warnings, and information to stdout/stderr" ON)
|
||||
ENDIF()
|
||||
OPTION(CLOG_BUILD_TESTS "Build clog tests" ON)
|
||||
OPTION(USE_SYSTEM_LIBS "Use system libraries instead of downloading and building them" OFF)
|
||||
OPTION(USE_SYSTEM_GOOGLETEST "Use system Google Test library instead of downloading and building it" ${USE_SYSTEM_LIBS})
|
||||
|
||||
# ---[ CMake options
|
||||
IF(CLOG_BUILD_TESTS)
|
||||
ENABLE_TESTING()
|
||||
ENDIF()
|
||||
|
||||
MACRO(CLOG_TARGET_RUNTIME_LIBRARY target)
|
||||
IF(MSVC AND NOT CLOG_RUNTIME_TYPE STREQUAL "default")
|
||||
@@ -24,6 +34,26 @@ MACRO(CLOG_TARGET_RUNTIME_LIBRARY target)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# ---[ Download deps
|
||||
SET(CONFU_DEPENDENCIES_SOURCE_DIR ${CMAKE_SOURCE_DIR}/deps
|
||||
CACHE PATH "Confu-style dependencies source directory")
|
||||
SET(CONFU_DEPENDENCIES_BINARY_DIR ${CMAKE_BINARY_DIR}/deps
|
||||
CACHE PATH "Confu-style dependencies binary directory")
|
||||
|
||||
IF(CLOG_BUILD_TESTS)
|
||||
IF(USE_SYSTEM_GOOGLETEST)
|
||||
FIND_PACKAGE(GTest REQUIRED)
|
||||
ELSEIF(NOT DEFINED GOOGLETEST_SOURCE_DIR)
|
||||
MESSAGE(STATUS "Downloading Google Test to ${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest (define GOOGLETEST_SOURCE_DIR to avoid it)")
|
||||
CONFIGURE_FILE(cmake/DownloadGoogleTest.cmake "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download/CMakeLists.txt")
|
||||
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download")
|
||||
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download")
|
||||
SET(GOOGLETEST_SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest" CACHE STRING "Google Test source directory")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# ---[ clog library
|
||||
ADD_LIBRARY(clog STATIC src/clog.c)
|
||||
SET_TARGET_PROPERTIES(clog PROPERTIES
|
||||
@@ -31,7 +61,7 @@ SET_TARGET_PROPERTIES(clog PROPERTIES
|
||||
C_EXTENSIONS NO)
|
||||
CLOG_TARGET_RUNTIME_LIBRARY(clog)
|
||||
SET_TARGET_PROPERTIES(clog PROPERTIES PUBLIC_HEADER include/clog.h)
|
||||
TARGET_INCLUDE_DIRECTORIES(clog BEFORE PUBLIC include)
|
||||
TARGET_INCLUDE_DIRECTORIES(clog PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
IF(CLOG_LOG_TO_STDIO)
|
||||
TARGET_COMPILE_DEFINITIONS(clog PRIVATE CLOG_LOG_TO_STDIO=1)
|
||||
ELSE()
|
||||
@@ -39,4 +69,33 @@ ELSE()
|
||||
ENDIF()
|
||||
IF(ANDROID AND NOT CLOG_LOG_TO_STDIO)
|
||||
TARGET_LINK_LIBRARIES(clog PRIVATE log)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
ADD_LIBRARY(cpuinfo::clog ALIAS clog)
|
||||
|
||||
INSTALL(TARGETS clog
|
||||
EXPORT cpuinfo-targets
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
# ---[ clog tests
|
||||
IF(CLOG_BUILD_TESTS)
|
||||
# ---[ Build google test
|
||||
IF(NOT TARGET gtest AND NOT USE_SYSTEM_GOOGLETEST)
|
||||
IF(MSVC AND NOT CLOG_RUNTIME_TYPE STREQUAL "static")
|
||||
SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
ENDIF()
|
||||
ADD_SUBDIRECTORY(
|
||||
"${GOOGLETEST_SOURCE_DIR}"
|
||||
"${CONFU_DEPENDENCIES_BINARY_DIR}/googletest")
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(clog-test test/clog.cc)
|
||||
SET_TARGET_PROPERTIES(clog-test PROPERTIES
|
||||
CXX_STANDARD 11
|
||||
CXX_EXTENSIONS NO)
|
||||
CLOG_TARGET_RUNTIME_LIBRARY(clog-test)
|
||||
TARGET_LINK_LIBRARIES(clog-test PRIVATE clog gtest gtest_main)
|
||||
ADD_TEST(clog-test clog-test)
|
||||
ENDIF()
|
||||
|
||||
23
3rdparty/cpuinfo/deps/clog/src/clog.c
vendored
23
3rdparty/cpuinfo/deps/clog/src/clog.c
vendored
@@ -10,6 +10,9 @@
|
||||
#ifdef __ANDROID__
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
#ifdef __hexagon__
|
||||
#include <qurt_printf.h>
|
||||
#endif
|
||||
|
||||
#ifndef CLOG_LOG_TO_STDIO
|
||||
#ifdef __ANDROID__
|
||||
@@ -102,12 +105,14 @@ void clog_vlog_fatal(const char* module, const char* format, va_list args) {
|
||||
out_buffer = heap_buffer;
|
||||
}
|
||||
out_buffer[prefix_chars + format_chars] = '\n';
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
DWORD bytes_written;
|
||||
WriteFile(
|
||||
GetStdHandle(STD_ERROR_HANDLE),
|
||||
out_buffer, prefix_chars + format_chars + CLOG_SUFFIX_LENGTH,
|
||||
&bytes_written, NULL);
|
||||
#elif defined(__hexagon__)
|
||||
qurt_printf("%s", out_buffer);
|
||||
#else
|
||||
write(STDERR_FILENO, out_buffer, prefix_chars + format_chars + CLOG_SUFFIX_LENGTH);
|
||||
#endif
|
||||
@@ -178,12 +183,14 @@ void clog_vlog_error(const char* module, const char* format, va_list args) {
|
||||
out_buffer = heap_buffer;
|
||||
}
|
||||
out_buffer[prefix_chars + format_chars] = '\n';
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
DWORD bytes_written;
|
||||
WriteFile(
|
||||
GetStdHandle(STD_ERROR_HANDLE),
|
||||
out_buffer, prefix_chars + format_chars + CLOG_SUFFIX_LENGTH,
|
||||
&bytes_written, NULL);
|
||||
#elif defined(__hexagon__)
|
||||
qurt_printf("%s", out_buffer);
|
||||
#else
|
||||
write(STDERR_FILENO, out_buffer, prefix_chars + format_chars + CLOG_SUFFIX_LENGTH);
|
||||
#endif
|
||||
@@ -254,12 +261,14 @@ void clog_vlog_warning(const char* module, const char* format, va_list args) {
|
||||
out_buffer = heap_buffer;
|
||||
}
|
||||
out_buffer[prefix_chars + format_chars] = '\n';
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
DWORD bytes_written;
|
||||
WriteFile(
|
||||
GetStdHandle(STD_ERROR_HANDLE),
|
||||
out_buffer, prefix_chars + format_chars + CLOG_SUFFIX_LENGTH,
|
||||
&bytes_written, NULL);
|
||||
#elif defined(__hexagon__)
|
||||
qurt_printf("%s", out_buffer);
|
||||
#else
|
||||
write(STDERR_FILENO, out_buffer, prefix_chars + format_chars + CLOG_SUFFIX_LENGTH);
|
||||
#endif
|
||||
@@ -330,12 +339,14 @@ void clog_vlog_info(const char* module, const char* format, va_list args) {
|
||||
out_buffer = heap_buffer;
|
||||
}
|
||||
out_buffer[prefix_chars + format_chars] = '\n';
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
DWORD bytes_written;
|
||||
WriteFile(
|
||||
GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
out_buffer, prefix_chars + format_chars + CLOG_SUFFIX_LENGTH,
|
||||
&bytes_written, NULL);
|
||||
#elif defined(__hexagon__)
|
||||
qurt_printf("%s", out_buffer);
|
||||
#else
|
||||
write(STDOUT_FILENO, out_buffer, prefix_chars + format_chars + CLOG_SUFFIX_LENGTH);
|
||||
#endif
|
||||
@@ -406,12 +417,14 @@ void clog_vlog_debug(const char* module, const char* format, va_list args) {
|
||||
out_buffer = heap_buffer;
|
||||
}
|
||||
out_buffer[prefix_chars + format_chars] = '\n';
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
DWORD bytes_written;
|
||||
WriteFile(
|
||||
GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
out_buffer, prefix_chars + format_chars + CLOG_SUFFIX_LENGTH,
|
||||
&bytes_written, NULL);
|
||||
#elif defined(__hexagon__)
|
||||
qurt_printf("%s", out_buffer);
|
||||
#else
|
||||
write(STDOUT_FILENO, out_buffer, prefix_chars + format_chars + CLOG_SUFFIX_LENGTH);
|
||||
#endif
|
||||
|
||||
215
3rdparty/cpuinfo/include/cpuinfo.h
vendored
215
3rdparty/cpuinfo/include/cpuinfo.h
vendored
@@ -46,6 +46,14 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__riscv)
|
||||
#if (__riscv_xlen == 32)
|
||||
#define CPUINFO_ARCH_RISCV32 1
|
||||
#elif (__riscv_xlen == 64)
|
||||
#define CPUINFO_ARCH_RISCV64 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define other architecture-specific macros as 0 */
|
||||
|
||||
#ifndef CPUINFO_ARCH_X86
|
||||
@@ -80,6 +88,14 @@
|
||||
#define CPUINFO_ARCH_WASMSIMD 0
|
||||
#endif
|
||||
|
||||
#ifndef CPUINFO_ARCH_RISCV32
|
||||
#define CPUINFO_ARCH_RISCV32 0
|
||||
#endif
|
||||
|
||||
#ifndef CPUINFO_ARCH_RISCV64
|
||||
#define CPUINFO_ARCH_RISCV64 0
|
||||
#endif
|
||||
|
||||
#if CPUINFO_ARCH_X86 && defined(_MSC_VER)
|
||||
#define CPUINFO_ABI __cdecl
|
||||
#elif CPUINFO_ARCH_X86 && defined(__GNUC__)
|
||||
@@ -188,6 +204,8 @@ enum cpuinfo_vendor {
|
||||
* Processors are variants of AMD cores.
|
||||
*/
|
||||
cpuinfo_vendor_hygon = 16,
|
||||
/** SiFive, Inc. Vendor of RISC-V processor microarchitectures. */
|
||||
cpuinfo_vendor_sifive = 17,
|
||||
|
||||
/* Active vendors of embedded CPUs */
|
||||
|
||||
@@ -363,6 +381,8 @@ enum cpuinfo_uarch {
|
||||
cpuinfo_uarch_zen2 = 0x0020010A,
|
||||
/** AMD Zen 3 microarchitecture. */
|
||||
cpuinfo_uarch_zen3 = 0x0020010B,
|
||||
/** AMD Zen 4 microarchitecture. */
|
||||
cpuinfo_uarch_zen4 = 0x0020010C,
|
||||
|
||||
/** NSC Geode and AMD Geode GX and LX. */
|
||||
cpuinfo_uarch_geode = 0x00200200,
|
||||
@@ -426,9 +446,26 @@ enum cpuinfo_uarch {
|
||||
cpuinfo_uarch_neoverse_n1 = 0x00300400,
|
||||
/** ARM Neoverse E1. */
|
||||
cpuinfo_uarch_neoverse_e1 = 0x00300401,
|
||||
/** ARM Neoverse V1. */
|
||||
cpuinfo_uarch_neoverse_v1 = 0x00300402,
|
||||
/** ARM Neoverse N2. */
|
||||
cpuinfo_uarch_neoverse_n2 = 0x00300403,
|
||||
/** ARM Neoverse V2. */
|
||||
cpuinfo_uarch_neoverse_v2 = 0x00300404,
|
||||
|
||||
/** ARM Cortex-X1. */
|
||||
cpuinfo_uarch_cortex_x1 = 0x00300500,
|
||||
cpuinfo_uarch_cortex_x1 = 0x00300501,
|
||||
/** ARM Cortex-X2. */
|
||||
cpuinfo_uarch_cortex_x2 = 0x00300502,
|
||||
/** ARM Cortex-X3. */
|
||||
cpuinfo_uarch_cortex_x3 = 0x00300503,
|
||||
|
||||
/** ARM Cortex-A510. */
|
||||
cpuinfo_uarch_cortex_a510 = 0x00300551,
|
||||
/** ARM Cortex-A710. */
|
||||
cpuinfo_uarch_cortex_a710 = 0x00300571,
|
||||
/** ARM Cortex-A715. */
|
||||
cpuinfo_uarch_cortex_a715 = 0x00300572,
|
||||
|
||||
/** Qualcomm Scorpion. */
|
||||
cpuinfo_uarch_scorpion = 0x00400100,
|
||||
@@ -489,10 +526,14 @@ enum cpuinfo_uarch {
|
||||
cpuinfo_uarch_lightning = 0x00700109,
|
||||
/** Apple A13 processor (little cores). */
|
||||
cpuinfo_uarch_thunder = 0x0070010A,
|
||||
/** Apple M1 processor (big cores). */
|
||||
/** Apple A14 / M1 processor (big cores). */
|
||||
cpuinfo_uarch_firestorm = 0x0070010B,
|
||||
/** Apple M1 processor (little cores). */
|
||||
/** Apple A14 / M1 processor (little cores). */
|
||||
cpuinfo_uarch_icestorm = 0x0070010C,
|
||||
/** Apple A15 / M2 processor (big cores). */
|
||||
cpuinfo_uarch_avalanche = 0x0070010D,
|
||||
/** Apple A15 / M2 processor (little cores). */
|
||||
cpuinfo_uarch_blizzard = 0x0070010E,
|
||||
|
||||
/** Cavium ThunderX. */
|
||||
cpuinfo_uarch_thunderx = 0x00800100,
|
||||
@@ -706,6 +747,7 @@ void CPUINFO_ABI cpuinfo_deinitialize(void);
|
||||
bool sse4a;
|
||||
bool misaligned_sse;
|
||||
bool avx;
|
||||
bool avxvnni;
|
||||
bool fma3;
|
||||
bool fma4;
|
||||
bool xop;
|
||||
@@ -725,6 +767,7 @@ void CPUINFO_ABI cpuinfo_deinitialize(void);
|
||||
bool avx512vpopcntdq;
|
||||
bool avx512vnni;
|
||||
bool avx512bf16;
|
||||
bool avx512fp16;
|
||||
bool avx512vp2intersect;
|
||||
bool avx512_4vnniw;
|
||||
bool avx512_4fmaps;
|
||||
@@ -1052,6 +1095,14 @@ static inline bool cpuinfo_has_x86_avx(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_x86_avxvnni(void) {
|
||||
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
|
||||
return cpuinfo_isa.avxvnni;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_x86_fma3(void) {
|
||||
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
|
||||
return cpuinfo_isa.fma3;
|
||||
@@ -1204,6 +1255,14 @@ static inline bool cpuinfo_has_x86_avx512bf16(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_x86_avx512fp16(void) {
|
||||
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
|
||||
return cpuinfo_isa.avx512fp16;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_x86_avx512vp2intersect(void) {
|
||||
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
|
||||
return cpuinfo_isa.avx512vp2intersect;
|
||||
@@ -1460,14 +1519,17 @@ static inline bool cpuinfo_has_x86_sha(void) {
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
bool atomics;
|
||||
bool bf16;
|
||||
bool sve;
|
||||
bool sve2;
|
||||
bool i8mm;
|
||||
#endif
|
||||
bool rdm;
|
||||
bool fp16arith;
|
||||
bool dot;
|
||||
bool jscvt;
|
||||
bool fcma;
|
||||
bool fhm;
|
||||
|
||||
bool aes;
|
||||
bool sha1;
|
||||
@@ -1623,6 +1685,22 @@ static inline bool cpuinfo_has_arm_vfpv4_d32(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_arm_fp16_arith(void) {
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
return cpuinfo_isa.fp16arith;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_arm_bf16(void) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
return cpuinfo_isa.bf16;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_arm_wmmx(void) {
|
||||
#if CPUINFO_ARCH_ARM
|
||||
return cpuinfo_isa.wmmx;
|
||||
@@ -1705,9 +1783,9 @@ static inline bool cpuinfo_has_arm_neon_fp16_arith(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_arm_fp16_arith(void) {
|
||||
static inline bool cpuinfo_has_arm_fhm(void) {
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
return cpuinfo_isa.fp16arith;
|
||||
return cpuinfo_isa.fhm;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@@ -1721,6 +1799,14 @@ static inline bool cpuinfo_has_arm_neon_dot(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_arm_neon_bf16(void) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
return cpuinfo_isa.bf16;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_arm_jscvt(void) {
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
return cpuinfo_isa.jscvt;
|
||||
@@ -1737,6 +1823,14 @@ static inline bool cpuinfo_has_arm_fcma(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_arm_i8mm(void) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
return cpuinfo_isa.i8mm;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_arm_aes(void) {
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
return cpuinfo_isa.aes;
|
||||
@@ -1785,6 +1879,14 @@ static inline bool cpuinfo_has_arm_sve(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_arm_sve_bf16(void) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
return cpuinfo_isa.sve && cpuinfo_isa.bf16;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_arm_sve2(void) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
return cpuinfo_isa.sve2;
|
||||
@@ -1793,6 +1895,109 @@ static inline bool cpuinfo_has_arm_sve2(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
/* This structure is not a part of stable API. Use cpuinfo_has_riscv_* functions instead. */
|
||||
struct cpuinfo_riscv_isa {
|
||||
/**
|
||||
* Keep fields in line with the canonical order as defined by
|
||||
* Section 27.11 Subset Naming Convention.
|
||||
*/
|
||||
/* RV32I/64I/128I Base ISA. */
|
||||
bool i;
|
||||
#if CPUINFO_ARCH_RISCV32
|
||||
/* RV32E Base ISA. */
|
||||
bool e;
|
||||
#endif
|
||||
/* Integer Multiply/Divide Extension. */
|
||||
bool m;
|
||||
/* Atomic Extension. */
|
||||
bool a;
|
||||
/* Single-Precision Floating-Point Extension. */
|
||||
bool f;
|
||||
/* Double-Precision Floating-Point Extension. */
|
||||
bool d;
|
||||
/* Compressed Extension. */
|
||||
bool c;
|
||||
/* Vector Extension. */
|
||||
bool v;
|
||||
};
|
||||
|
||||
extern struct cpuinfo_riscv_isa cpuinfo_isa;
|
||||
#endif
|
||||
|
||||
static inline bool cpuinfo_has_riscv_i(void) {
|
||||
#if CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_isa.i;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_riscv_e(void) {
|
||||
#if CPUINFO_ARCH_RISCV32
|
||||
return cpuinfo_isa.e;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_riscv_m(void) {
|
||||
#if CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_isa.m;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_riscv_a(void) {
|
||||
#if CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_isa.a;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_riscv_f(void) {
|
||||
#if CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_isa.f;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_riscv_d(void) {
|
||||
#if CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_isa.d;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_riscv_g(void) {
|
||||
// The 'G' extension is simply shorthand for 'IMAFD'.
|
||||
return cpuinfo_has_riscv_i()
|
||||
&& cpuinfo_has_riscv_m()
|
||||
&& cpuinfo_has_riscv_a()
|
||||
&& cpuinfo_has_riscv_f()
|
||||
&& cpuinfo_has_riscv_d();
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_riscv_c(void) {
|
||||
#if CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_isa.c;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool cpuinfo_has_riscv_v(void) {
|
||||
#if CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_isa.v;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
const struct cpuinfo_processor* CPUINFO_ABI cpuinfo_get_processors(void);
|
||||
const struct cpuinfo_core* CPUINFO_ABI cpuinfo_get_cores(void);
|
||||
const struct cpuinfo_cluster* CPUINFO_ABI cpuinfo_get_clusters(void);
|
||||
|
||||
25
3rdparty/cpuinfo/src/api.c
vendored
25
3rdparty/cpuinfo/src/api.c
vendored
@@ -30,7 +30,8 @@ uint32_t cpuinfo_packages_count = 0;
|
||||
uint32_t cpuinfo_cache_count[cpuinfo_cache_level_max] = { 0 };
|
||||
uint32_t cpuinfo_max_cache_size = 0;
|
||||
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 \
|
||||
|| CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
struct cpuinfo_uarch_info* cpuinfo_uarchs = NULL;
|
||||
uint32_t cpuinfo_uarchs_count = 0;
|
||||
#else
|
||||
@@ -41,7 +42,8 @@ uint32_t cpuinfo_max_cache_size = 0;
|
||||
uint32_t cpuinfo_linux_cpu_max = 0;
|
||||
const struct cpuinfo_processor** cpuinfo_linux_cpu_to_processor_map = NULL;
|
||||
const struct cpuinfo_core** cpuinfo_linux_cpu_to_core_map = NULL;
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 \
|
||||
|| CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
const uint32_t* cpuinfo_linux_cpu_to_uarch_index_map = NULL;
|
||||
#endif
|
||||
#endif
|
||||
@@ -79,7 +81,8 @@ const struct cpuinfo_uarch_info* cpuinfo_get_uarchs() {
|
||||
if (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "uarchs");
|
||||
}
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 \
|
||||
|| CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_uarchs;
|
||||
#else
|
||||
return &cpuinfo_global_uarch;
|
||||
@@ -130,7 +133,8 @@ const struct cpuinfo_uarch_info* cpuinfo_get_uarch(uint32_t index) {
|
||||
if (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "uarch");
|
||||
}
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 \
|
||||
|| CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
if CPUINFO_UNLIKELY(index >= cpuinfo_uarchs_count) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -175,7 +179,8 @@ uint32_t cpuinfo_get_uarchs_count(void) {
|
||||
if (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "uarchs_count");
|
||||
}
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 \
|
||||
|| CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_uarchs_count;
|
||||
#else
|
||||
return 1;
|
||||
@@ -351,7 +356,8 @@ uint32_t CPUINFO_ABI cpuinfo_get_current_uarch_index(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "current_uarch_index");
|
||||
}
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 \
|
||||
|| CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
#ifdef __linux__
|
||||
if (cpuinfo_linux_cpu_to_uarch_index_map == NULL) {
|
||||
/* Special case: avoid syscall on systems with only a single type of cores */
|
||||
@@ -373,7 +379,7 @@ uint32_t CPUINFO_ABI cpuinfo_get_current_uarch_index(void) {
|
||||
return 0;
|
||||
#endif
|
||||
#else
|
||||
/* Only ARM/ARM64 processors may include cores of different types in the same package. */
|
||||
/* Only ARM/ARM64/RISCV processors may include cores of different types in the same package. */
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@@ -382,7 +388,8 @@ uint32_t CPUINFO_ABI cpuinfo_get_current_uarch_index_with_default(uint32_t defau
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "current_uarch_index_with_default");
|
||||
}
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 \
|
||||
|| CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
#ifdef __linux__
|
||||
if (cpuinfo_linux_cpu_to_uarch_index_map == NULL) {
|
||||
/* Special case: avoid syscall on systems with only a single type of cores */
|
||||
@@ -404,7 +411,7 @@ uint32_t CPUINFO_ABI cpuinfo_get_current_uarch_index_with_default(uint32_t defau
|
||||
return default_uarch_index;
|
||||
#endif
|
||||
#else
|
||||
/* Only ARM/ARM64 processors may include cores of different types in the same package. */
|
||||
/* Only ARM/ARM64/RISCV processors may include cores of different types in the same package. */
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
2
3rdparty/cpuinfo/src/arm/api.h
vendored
2
3rdparty/cpuinfo/src/arm/api.h
vendored
@@ -28,6 +28,7 @@ enum cpuinfo_arm_chipset_vendor {
|
||||
cpuinfo_arm_chipset_vendor_spreadtrum,
|
||||
cpuinfo_arm_chipset_vendor_telechips,
|
||||
cpuinfo_arm_chipset_vendor_texas_instruments,
|
||||
cpuinfo_arm_chipset_vendor_unisoc,
|
||||
cpuinfo_arm_chipset_vendor_wondermedia,
|
||||
cpuinfo_arm_chipset_vendor_max,
|
||||
};
|
||||
@@ -62,6 +63,7 @@ enum cpuinfo_arm_chipset_series {
|
||||
cpuinfo_arm_chipset_series_spreadtrum_sc,
|
||||
cpuinfo_arm_chipset_series_telechips_tcc,
|
||||
cpuinfo_arm_chipset_series_texas_instruments_omap,
|
||||
cpuinfo_arm_chipset_series_unisoc_t,
|
||||
cpuinfo_arm_chipset_series_wondermedia_wm,
|
||||
cpuinfo_arm_chipset_series_max,
|
||||
};
|
||||
|
||||
55
3rdparty/cpuinfo/src/arm/cache.c
vendored
55
3rdparty/cpuinfo/src/arm/cache.c
vendored
@@ -1238,6 +1238,57 @@ void cpuinfo_arm_decode_cache(
|
||||
};
|
||||
break;
|
||||
}
|
||||
case cpuinfo_uarch_neoverse_n1:
|
||||
case cpuinfo_uarch_neoverse_v1:
|
||||
case cpuinfo_uarch_neoverse_n2:
|
||||
case cpuinfo_uarch_neoverse_v2:
|
||||
{
|
||||
/*
|
||||
* The specifications here below are taken from the
|
||||
* Arm Core Technical Reference Manuals for
|
||||
* - Neoverse N1: https://developer.arm.com/documentation/100616/0401/?lang=en
|
||||
* - Neoverse N2: https://developer.arm.com/documentation/102099/0003/?lang=en
|
||||
* - Neoverse V1: https://developer.arm.com/documentation/101427/0102/?lang=en
|
||||
* - Neoverse V2: https://developer.arm.com/documentation/102375/0002/?lang=en
|
||||
*
|
||||
* All four Arm architectures have L1 memory system with instruction and data caches,
|
||||
* both of fixed size of 64KB. The instruction side memory system is 4-way set associative
|
||||
* with a cache line length of 64 bytes. The data cache is also 4-way set associative with
|
||||
* a cache line length of 64 bytes.
|
||||
*
|
||||
* The L2 memory system differs across the four Architectures in the minimum
|
||||
* length of the L2 cache. Namely:
|
||||
* - Arm Neoverse N1/N2/V1 have a L2 cache of configurable size of 256KB, 512KB, or 1024KB
|
||||
* - Arm Neoverse V2 has a L2 cache of configurable size of 1MB or 2MB
|
||||
* For all four architectures, the L2 cache is 8-way set associative
|
||||
* For all other information, please refer to the technical manuals linked above
|
||||
*/
|
||||
const uint32_t min_l2_size_KB = uarch == cpuinfo_uarch_neoverse_v2 ? 1024 : 256;
|
||||
const uint32_t min_l3_size_KB = 0;
|
||||
|
||||
*l1i = (struct cpuinfo_cache) {
|
||||
.size = 64 * 1024,
|
||||
.associativity = 4,
|
||||
.line_size = 64,
|
||||
};
|
||||
*l1d = (struct cpuinfo_cache) {
|
||||
.size = 64 * 1024,
|
||||
.associativity = 4,
|
||||
.line_size = 64,
|
||||
};
|
||||
*l2 = (struct cpuinfo_cache) {
|
||||
.size = min_l2_size_KB * 1024,
|
||||
.associativity = 8,
|
||||
.line_size = 64,
|
||||
.flags = CPUINFO_CACHE_INCLUSIVE,
|
||||
};
|
||||
*l3 = (struct cpuinfo_cache) {
|
||||
.size = min_l3_size_KB * 1024,
|
||||
.associativity = 16,
|
||||
.line_size = 64,
|
||||
};
|
||||
break;
|
||||
}
|
||||
#if CPUINFO_ARCH_ARM && !defined(__ARM_ARCH_8A__)
|
||||
case cpuinfo_uarch_scorpion:
|
||||
/*
|
||||
@@ -1655,6 +1706,10 @@ uint32_t cpuinfo_arm_compute_max_cache_size(const struct cpuinfo_processor* proc
|
||||
*/
|
||||
return 8 * 1024 * 1024;
|
||||
case cpuinfo_uarch_cortex_a55:
|
||||
case cpuinfo_uarch_neoverse_n1:
|
||||
case cpuinfo_uarch_neoverse_v1:
|
||||
case cpuinfo_uarch_neoverse_n2:
|
||||
case cpuinfo_uarch_neoverse_v2:
|
||||
case cpuinfo_uarch_cortex_a75:
|
||||
case cpuinfo_uarch_cortex_a76:
|
||||
case cpuinfo_uarch_exynos_m4:
|
||||
|
||||
125
3rdparty/cpuinfo/src/arm/linux/aarch32-isa.c
vendored
125
3rdparty/cpuinfo/src/arm/linux/aarch32-isa.c
vendored
@@ -33,6 +33,13 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
struct cpuinfo_arm_isa isa[restrict static 1])
|
||||
{
|
||||
if (architecture_version < 8) {
|
||||
const uint32_t armv8_features2_mask = CPUINFO_ARM_LINUX_FEATURE2_AES | CPUINFO_ARM_LINUX_FEATURE2_PMULL |
|
||||
CPUINFO_ARM_LINUX_FEATURE2_SHA1 | CPUINFO_ARM_LINUX_FEATURE2_SHA2 | CPUINFO_ARM_LINUX_FEATURE2_CRC32;
|
||||
if (features2 & armv8_features2_mask) {
|
||||
architecture_version = 8;
|
||||
}
|
||||
}
|
||||
if (architecture_version >= 8) {
|
||||
/*
|
||||
* ARMv7 code running on ARMv8: IDIV, VFP, NEON are always supported,
|
||||
@@ -57,13 +64,22 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
* NEON FP16 compute extension and VQRDMLAH/VQRDMLSH instructions are not indicated in /proc/cpuinfo.
|
||||
* Use a MIDR-based heuristic to whitelist processors known to support it:
|
||||
* - Processors with Cortex-A55 cores
|
||||
* - Processors with Cortex-A65 cores
|
||||
* - Processors with Cortex-A75 cores
|
||||
* - Processors with Cortex-A76 cores
|
||||
* - Processors with Cortex-A77 cores
|
||||
* - Processors with Cortex-A78 cores
|
||||
* - Processors with Cortex-A510 cores
|
||||
* - Processors with Cortex-A710 cores
|
||||
* - Processors with Cortex-A715 cores
|
||||
* - Processors with Cortex-X1 cores
|
||||
* - Processors with Cortex-X2 cores
|
||||
* - Processors with Cortex-X3 cores
|
||||
* - Processors with Exynos M4 cores
|
||||
* - Processors with Exynos M5 cores
|
||||
* - Neoverse N1 cores
|
||||
* - Neoverse N2 cores
|
||||
* - Neoverse V1 cores
|
||||
* - Neoverse V2 cores
|
||||
*/
|
||||
if (chipset->series == cpuinfo_arm_chipset_series_samsung_exynos && chipset->model == 9810) {
|
||||
/* Only little cores of Exynos 9810 support FP16 & RDM */
|
||||
@@ -71,11 +87,21 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
} else {
|
||||
switch (midr & (CPUINFO_ARM_MIDR_IMPLEMENTER_MASK | CPUINFO_ARM_MIDR_PART_MASK)) {
|
||||
case UINT32_C(0x4100D050): /* Cortex-A55 */
|
||||
case UINT32_C(0x4100D060): /* Cortex-A65 */
|
||||
case UINT32_C(0x4100D0A0): /* Cortex-A75 */
|
||||
case UINT32_C(0x4100D0B0): /* Cortex-A76 */
|
||||
case UINT32_C(0x4100D0C0): /* Neoverse N1 */
|
||||
case UINT32_C(0x4100D0D0): /* Cortex-A77 */
|
||||
case UINT32_C(0x4100D0E0): /* Cortex-A76AE */
|
||||
case UINT32_C(0x4100D400): /* Neoverse V1 */
|
||||
case UINT32_C(0x4100D410): /* Cortex-A78 */
|
||||
case UINT32_C(0x4100D440): /* Cortex-X1 */
|
||||
case UINT32_C(0x4100D460): /* Cortex-A510 */
|
||||
case UINT32_C(0x4100D470): /* Cortex-A710 */
|
||||
case UINT32_C(0x4100D480): /* Cortex-X2 */
|
||||
case UINT32_C(0x4100D490): /* Neoverse N2 */
|
||||
case UINT32_C(0x4100D4D0): /* Cortex-A715 */
|
||||
case UINT32_C(0x4100D4E0): /* Cortex-X3 */
|
||||
case UINT32_C(0x4100D4F0): /* Neoverse V2 */
|
||||
case UINT32_C(0x4800D400): /* Cortex-A76 (HiSilicon) */
|
||||
case UINT32_C(0x51008020): /* Kryo 385 Gold (Cortex-A75) */
|
||||
case UINT32_C(0x51008030): /* Kryo 385 Silver (Cortex-A55) */
|
||||
@@ -91,25 +117,57 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
|
||||
/*
|
||||
* NEON VDOT instructions are not indicated in /proc/cpuinfo.
|
||||
* Use a MIDR-based heuristic to whitelist processors known to support it.
|
||||
* Use a MIDR-based heuristic to whitelist processors known to support it:
|
||||
* - Processors with Cortex-A76 cores
|
||||
* - Processors with Cortex-A77 cores
|
||||
* - Processors with Cortex-A78 cores
|
||||
* - Processors with Cortex-A510 cores
|
||||
* - Processors with Cortex-A710 cores
|
||||
* - Processors with Cortex-A715 cores
|
||||
* - Processors with Cortex-X1 cores
|
||||
* - Processors with Cortex-X2 cores
|
||||
* - Processors with Cortex-X3 cores
|
||||
* - Processors with Exynos M4 cores
|
||||
* - Processors with Exynos M5 cores
|
||||
* - Neoverse N1 cores
|
||||
* - Neoverse N2 cores
|
||||
* - Neoverse V1 cores
|
||||
* - Neoverse V2 cores
|
||||
*/
|
||||
switch (midr & (CPUINFO_ARM_MIDR_IMPLEMENTER_MASK | CPUINFO_ARM_MIDR_PART_MASK)) {
|
||||
case UINT32_C(0x4100D0B0): /* Cortex-A76 */
|
||||
case UINT32_C(0x4100D0D0): /* Cortex-A77 */
|
||||
case UINT32_C(0x4100D0E0): /* Cortex-A76AE */
|
||||
case UINT32_C(0x4800D400): /* Cortex-A76 (HiSilicon) */
|
||||
case UINT32_C(0x51008040): /* Kryo 485 Gold (Cortex-A76) */
|
||||
case UINT32_C(0x51008050): /* Kryo 485 Silver (Cortex-A55) */
|
||||
case UINT32_C(0x53000030): /* Exynos-M4 */
|
||||
case UINT32_C(0x53000040): /* Exynos-M5 */
|
||||
isa->dot = true;
|
||||
break;
|
||||
case UINT32_C(0x4100D050): /* Cortex A55: revision 1 or later only */
|
||||
isa->dot = !!(midr_get_variant(midr) >= 1);
|
||||
break;
|
||||
case UINT32_C(0x4100D0A0): /* Cortex A75: revision 2 or later only */
|
||||
isa->dot = !!(midr_get_variant(midr) >= 2);
|
||||
break;
|
||||
if (chipset->series == cpuinfo_arm_chipset_series_spreadtrum_sc && chipset->model == 9863) {
|
||||
cpuinfo_log_warning("VDOT instructions disabled: cause occasional SIGILL on Spreadtrum SC9863A");
|
||||
} else if (chipset->series == cpuinfo_arm_chipset_series_unisoc_t && chipset->model == 310) {
|
||||
cpuinfo_log_warning("VDOT instructions disabled: cause occasional SIGILL on Unisoc T310");
|
||||
} else {
|
||||
switch (midr & (CPUINFO_ARM_MIDR_IMPLEMENTER_MASK | CPUINFO_ARM_MIDR_PART_MASK)) {
|
||||
case UINT32_C(0x4100D0B0): /* Cortex-A76 */
|
||||
case UINT32_C(0x4100D0C0): /* Neoverse N1 */
|
||||
case UINT32_C(0x4100D0D0): /* Cortex-A77 */
|
||||
case UINT32_C(0x4100D0E0): /* Cortex-A76AE */
|
||||
case UINT32_C(0x4100D400): /* Neoverse V1 */
|
||||
case UINT32_C(0x4100D410): /* Cortex-A78 */
|
||||
case UINT32_C(0x4100D440): /* Cortex-X1 */
|
||||
case UINT32_C(0x4100D460): /* Cortex-A510 */
|
||||
case UINT32_C(0x4100D470): /* Cortex-A710 */
|
||||
case UINT32_C(0x4100D480): /* Cortex-X2 */
|
||||
case UINT32_C(0x4100D490): /* Neoverse N2 */
|
||||
case UINT32_C(0x4100D4D0): /* Cortex-A715 */
|
||||
case UINT32_C(0x4100D4E0): /* Cortex-X3 */
|
||||
case UINT32_C(0x4100D4F0): /* Neoverse V2 */
|
||||
case UINT32_C(0x4800D400): /* Cortex-A76 (HiSilicon) */
|
||||
case UINT32_C(0x51008040): /* Kryo 485 Gold (Cortex-A76) */
|
||||
case UINT32_C(0x51008050): /* Kryo 485 Silver (Cortex-A55) */
|
||||
case UINT32_C(0x53000030): /* Exynos M4 */
|
||||
case UINT32_C(0x53000040): /* Exynos M5 */
|
||||
isa->dot = true;
|
||||
break;
|
||||
case UINT32_C(0x4100D050): /* Cortex A55: revision 1 or later only */
|
||||
isa->dot = !!(midr_get_variant(midr) >= 1);
|
||||
break;
|
||||
case UINT32_C(0x4100D0A0): /* Cortex A75: revision 2 or later only */
|
||||
isa->dot = !!(midr_get_variant(midr) >= 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* ARMv7 or lower: use feature flags to detect optional features */
|
||||
@@ -167,19 +225,24 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
}
|
||||
|
||||
if (features & CPUINFO_ARM_LINUX_FEATURE_IWMMXT) {
|
||||
const uint32_t wcid = read_wcid();
|
||||
cpuinfo_log_debug("WCID = 0x%08"PRIx32, wcid);
|
||||
const uint32_t coprocessor_type = (wcid >> 8) & UINT32_C(0xFF);
|
||||
if (coprocessor_type >= 0x10) {
|
||||
isa->wmmx = true;
|
||||
if (coprocessor_type >= 0x20) {
|
||||
isa->wmmx2 = true;
|
||||
#if !defined(__ARM_ARCH_8A__) && !(defined(__ARM_ARCH) && (__ARM_ARCH >= 8))
|
||||
const uint32_t wcid = read_wcid();
|
||||
cpuinfo_log_debug("WCID = 0x%08"PRIx32, wcid);
|
||||
const uint32_t coprocessor_type = (wcid >> 8) & UINT32_C(0xFF);
|
||||
if (coprocessor_type >= 0x10) {
|
||||
isa->wmmx = true;
|
||||
if (coprocessor_type >= 0x20) {
|
||||
isa->wmmx2 = true;
|
||||
}
|
||||
} else {
|
||||
cpuinfo_log_warning("WMMX ISA disabled: OS reported iwmmxt feature, "
|
||||
"but WCID coprocessor type 0x%"PRIx32" indicates no WMMX support",
|
||||
coprocessor_type);
|
||||
}
|
||||
} else {
|
||||
#else
|
||||
cpuinfo_log_warning("WMMX ISA disabled: OS reported iwmmxt feature, "
|
||||
"but WCID coprocessor type 0x%"PRIx32" indicates no WMMX support",
|
||||
coprocessor_type);
|
||||
}
|
||||
"but there is no iWMMXt coprocessor");
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((features & CPUINFO_ARM_LINUX_FEATURE_THUMB) || (architecture_flags & CPUINFO_ARM_LINUX_ARCH_T)) {
|
||||
|
||||
22
3rdparty/cpuinfo/src/arm/linux/aarch64-isa.c
vendored
22
3rdparty/cpuinfo/src/arm/linux/aarch64-isa.c
vendored
@@ -41,6 +41,9 @@ void cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
* - Processors with Exynos M4 cores
|
||||
* - Processors with Exynos M5 cores
|
||||
* - Neoverse N1 cores
|
||||
* - Neoverse V1 cores
|
||||
* - Neoverse N2 cores
|
||||
* - Neoverse V2 cores
|
||||
*/
|
||||
if (chipset->series == cpuinfo_arm_chipset_series_samsung_exynos && chipset->model == 9810) {
|
||||
/* Exynos 9810 reports that it supports FP16 compute, but in fact only little cores do */
|
||||
@@ -50,10 +53,14 @@ void cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
switch (midr & (CPUINFO_ARM_MIDR_IMPLEMENTER_MASK | CPUINFO_ARM_MIDR_PART_MASK)) {
|
||||
case UINT32_C(0x4100D050): /* Cortex-A55 */
|
||||
case UINT32_C(0x4100D060): /* Cortex-A65 */
|
||||
case UINT32_C(0x4100D0A0): /* Cortex-A75 */
|
||||
case UINT32_C(0x4100D0B0): /* Cortex-A76 */
|
||||
case UINT32_C(0x4100D0C0): /* Neoverse N1 */
|
||||
case UINT32_C(0x4100D0D0): /* Cortex-A77 */
|
||||
case UINT32_C(0x4100D0E0): /* Cortex-A76AE */
|
||||
case UINT32_C(0x4100D400): /* Neoverse V1 */
|
||||
case UINT32_C(0x4100D490): /* Neoverse N2 */
|
||||
case UINT32_C(0x4100D4F0): /* Neoverse V2 */
|
||||
case UINT32_C(0x4800D400): /* Cortex-A76 (HiSilicon) */
|
||||
case UINT32_C(0x51008020): /* Kryo 385 Gold (Cortex-A75) */
|
||||
case UINT32_C(0x51008030): /* Kryo 385 Silver (Cortex-A55) */
|
||||
@@ -78,6 +85,9 @@ void cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (features2 & CPUINFO_ARM_LINUX_FEATURE2_I8MM) {
|
||||
isa->i8mm = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Many phones ship with an old kernel configuration that doesn't report UDOT/SDOT instructions.
|
||||
@@ -89,7 +99,10 @@ void cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
case UINT32_C(0x4100D0C0): /* Neoverse N1 */
|
||||
case UINT32_C(0x4100D0D0): /* Cortex-A77 */
|
||||
case UINT32_C(0x4100D0E0): /* Cortex-A76AE */
|
||||
case UINT32_C(0x4100D400): /* Neoverse V1 */
|
||||
case UINT32_C(0x4100D490): /* Neoverse N2 */
|
||||
case UINT32_C(0x4100D4A0): /* Neoverse E1 */
|
||||
case UINT32_C(0x4100D4F0): /* Neoverse V2 */
|
||||
case UINT32_C(0x4800D400): /* Cortex-A76 (HiSilicon) */
|
||||
case UINT32_C(0x51008040): /* Kryo 485 Gold (Cortex-A76) */
|
||||
case UINT32_C(0x51008050): /* Kryo 485 Silver (Cortex-A55) */
|
||||
@@ -124,4 +137,13 @@ void cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
if (features2 & CPUINFO_ARM_LINUX_FEATURE2_SVE2) {
|
||||
isa->sve2 = true;
|
||||
}
|
||||
// SVEBF16 is set iff SVE and BF16 are both supported, but the SVEBF16 feature flag
|
||||
// was added in Linux kernel before the BF16 feature flag, so we check for either.
|
||||
if (features2 & (CPUINFO_ARM_LINUX_FEATURE2_BF16 | CPUINFO_ARM_LINUX_FEATURE2_SVEBF16)) {
|
||||
isa->bf16 = true;
|
||||
}
|
||||
if (features & CPUINFO_ARM_LINUX_FEATURE_ASIMDFHM) {
|
||||
isa->fhm = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
3rdparty/cpuinfo/src/arm/linux/api.h
vendored
2
3rdparty/cpuinfo/src/arm/linux/api.h
vendored
@@ -314,7 +314,7 @@ CPUINFO_INTERNAL bool cpuinfo_arm_linux_parse_proc_cpuinfo(
|
||||
struct cpuinfo_arm_isa isa[restrict static 1]);
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#if defined(__ANDROID__)
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_android_decode_chipset(
|
||||
const struct cpuinfo_android_properties properties[restrict static 1],
|
||||
|
||||
96
3rdparty/cpuinfo/src/arm/linux/chipset.c
vendored
96
3rdparty/cpuinfo/src/arm/linux/chipset.c
vendored
@@ -37,29 +37,17 @@ static inline bool is_ascii_numeric(char c) {
|
||||
}
|
||||
|
||||
static inline uint16_t load_u16le(const void* ptr) {
|
||||
#if defined(__ARM_ARCH_7A__) || defined(__aarch64__)
|
||||
return *((const uint16_t*) ptr);
|
||||
#else
|
||||
const uint8_t* byte_ptr = (const uint8_t*) ptr;
|
||||
return ((uint16_t) byte_ptr[1] << 8) | (uint16_t) byte_ptr[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline uint32_t load_u24le(const void* ptr) {
|
||||
#if defined(__ARM_ARCH_7A__) || defined(__aarch64__)
|
||||
return ((uint32_t) ((const uint8_t*) ptr)[2] << 16) | ((uint32_t) *((const uint16_t*) ptr));
|
||||
#else
|
||||
const uint8_t* byte_ptr = (const uint8_t*) ptr;
|
||||
return ((uint32_t) byte_ptr[2] << 16) | ((uint32_t) byte_ptr[1] << 8) | (uint32_t) byte_ptr[0];
|
||||
#endif
|
||||
return ((uint32_t) ((const uint8_t*) ptr)[2] << 16) | (uint32_t) load_u16le(ptr);
|
||||
}
|
||||
|
||||
static inline uint32_t load_u32le(const void* ptr) {
|
||||
#if defined(__ARM_ARCH_7A__) || defined(__aarch64__)
|
||||
return *((const uint32_t*) ptr);
|
||||
#else
|
||||
return ((uint32_t) ((const uint8_t*) ptr)[3] << 24) | load_u24le(ptr);
|
||||
#endif
|
||||
const uint8_t* byte_ptr = (const uint8_t*) ptr;
|
||||
return ((uint32_t) byte_ptr[3] << 24) | ((uint32_t) byte_ptr[2] << 16) | ((uint32_t) byte_ptr[1] << 8) | (uint32_t) byte_ptr[0];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -96,6 +84,7 @@ static enum cpuinfo_arm_chipset_vendor chipset_series_vendor[cpuinfo_arm_chipset
|
||||
[cpuinfo_arm_chipset_series_spreadtrum_sc] = cpuinfo_arm_chipset_vendor_spreadtrum,
|
||||
[cpuinfo_arm_chipset_series_telechips_tcc] = cpuinfo_arm_chipset_vendor_telechips,
|
||||
[cpuinfo_arm_chipset_series_texas_instruments_omap] = cpuinfo_arm_chipset_vendor_texas_instruments,
|
||||
[cpuinfo_arm_chipset_series_unisoc_t] = cpuinfo_arm_chipset_vendor_unisoc,
|
||||
[cpuinfo_arm_chipset_series_wondermedia_wm] = cpuinfo_arm_chipset_vendor_wondermedia,
|
||||
};
|
||||
|
||||
@@ -877,6 +866,63 @@ static bool match_sc(
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to match, case-sentitively, /Unisoc T\d{3,4}/ signature for Unisoc T chipset.
|
||||
* If match successful, extracts model information into \p chipset argument.
|
||||
*
|
||||
* @param start - start of the platform identifier (/proc/cpuinfo Hardware string, ro.product.board,
|
||||
* ro.board.platform, or ro.chipname) to match.
|
||||
* @param end - end of the platform identifier (/proc/cpuinfo Hardware string, ro.product.board,
|
||||
* ro.board.platform, or ro.chipname) to match.
|
||||
* @param[out] chipset - location where chipset information will be stored upon a successful match.
|
||||
*
|
||||
* @returns true if signature matched, false otherwise.
|
||||
*/
|
||||
static bool match_t(
|
||||
const char* start, const char* end,
|
||||
struct cpuinfo_arm_chipset chipset[restrict static 1])
|
||||
{
|
||||
/* Expect 11-12 symbols: "Unisoc T" (8 symbols) + 3-4-digit model number */
|
||||
const size_t length = end - start;
|
||||
switch (length) {
|
||||
case 11:
|
||||
case 12:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check that string starts with "Unisoc T". The first four characters are loaded as 32-bit little endian word */
|
||||
const uint32_t expected_unis = load_u32le(start);
|
||||
if (expected_unis != UINT32_C(0x73696E55) /* "sinU" = reverse("Unis") */) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* The next four characters are loaded as 32-bit little endian word */
|
||||
const uint32_t expected_oc_t = load_u32le(start + 4);
|
||||
if (expected_oc_t != UINT32_C(0x5420636F) /* "T co" = reverse("oc T") */) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Validate and parse 3-4 digit model number */
|
||||
uint32_t model = 0;
|
||||
for (uint32_t i = 8; i < length; i++) {
|
||||
const uint32_t digit = (uint32_t) (uint8_t) start[i] - '0';
|
||||
if (digit >= 10) {
|
||||
/* Not really a digit */
|
||||
return false;
|
||||
}
|
||||
model = model * 10 + digit;
|
||||
}
|
||||
|
||||
*chipset = (struct cpuinfo_arm_chipset) {
|
||||
.vendor = cpuinfo_arm_chipset_vendor_unisoc,
|
||||
.series = cpuinfo_arm_chipset_series_unisoc_t,
|
||||
.model = model,
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to match /lc\d{4}[a-z]?$/ signature for Leadcore LC chipsets.
|
||||
* If match successful, extracts model information into \p chipset argument.
|
||||
@@ -891,7 +937,7 @@ static bool match_lc(
|
||||
const char* start, const char* end,
|
||||
struct cpuinfo_arm_chipset chipset[restrict static 1])
|
||||
{
|
||||
/* Expect at 6-7 symbols: "lc" (2 symbols) + 4-digit model number + optional 1-letter suffix */
|
||||
/* Expect 6-7 symbols: "lc" (2 symbols) + 4-digit model number + optional 1-letter suffix */
|
||||
const size_t length = end - start;
|
||||
switch (length) {
|
||||
case 6:
|
||||
@@ -1351,7 +1397,7 @@ static bool match_and_parse_sunxi(
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Compare sunXi platform id and number of cores to tabluted values to decode chipset name */
|
||||
/* Compare sunXi platform id and number of cores to tabulated values to decode chipset name */
|
||||
uint32_t model = 0;
|
||||
char suffix = 0;
|
||||
for (size_t i = 0; i < CPUINFO_COUNT_OF(sunxi_map_entries); i++) {
|
||||
@@ -2354,6 +2400,16 @@ struct cpuinfo_arm_chipset cpuinfo_arm_linux_decode_chipset_from_proc_cpuinfo_ha
|
||||
cpuinfo_log_debug(
|
||||
"matched Spreadtrum SC signature in /proc/cpuinfo Hardware string \"%.*s\"",
|
||||
(int) hardware_length, hardware);
|
||||
|
||||
return chipset;
|
||||
}
|
||||
|
||||
/* Check Unisoc T signature */
|
||||
if (match_t(hardware, hardware_end, &chipset)) {
|
||||
cpuinfo_log_debug(
|
||||
"matched Unisoc T signature in /proc/cpuinfo Hardware string \"%.*s\"",
|
||||
(int) hardware_length, hardware);
|
||||
|
||||
return chipset;
|
||||
}
|
||||
|
||||
@@ -3417,6 +3473,7 @@ static const char* chipset_vendor_string[cpuinfo_arm_chipset_vendor_max] = {
|
||||
[cpuinfo_arm_chipset_vendor_spreadtrum] = "Spreadtrum",
|
||||
[cpuinfo_arm_chipset_vendor_telechips] = "Telechips",
|
||||
[cpuinfo_arm_chipset_vendor_texas_instruments] = "Texas Instruments",
|
||||
[cpuinfo_arm_chipset_vendor_unisoc] = "Unisoc",
|
||||
[cpuinfo_arm_chipset_vendor_wondermedia] = "WonderMedia",
|
||||
};
|
||||
|
||||
@@ -3451,6 +3508,7 @@ static const char* chipset_series_string[cpuinfo_arm_chipset_series_max] = {
|
||||
[cpuinfo_arm_chipset_series_spreadtrum_sc] = "SC",
|
||||
[cpuinfo_arm_chipset_series_telechips_tcc] = "TCC",
|
||||
[cpuinfo_arm_chipset_series_texas_instruments_omap] = "OMAP",
|
||||
[cpuinfo_arm_chipset_series_unisoc_t] = "T",
|
||||
[cpuinfo_arm_chipset_series_wondermedia_wm] = "WM",
|
||||
};
|
||||
|
||||
@@ -3484,7 +3542,7 @@ void cpuinfo_arm_chipset_to_string(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#if defined(__ANDROID__)
|
||||
static inline struct cpuinfo_arm_chipset disambiguate_qualcomm_chipset(
|
||||
const struct cpuinfo_arm_chipset proc_cpuinfo_hardware_chipset[restrict static 1],
|
||||
const struct cpuinfo_arm_chipset ro_product_board_chipset[restrict static 1],
|
||||
@@ -3776,7 +3834,7 @@ void cpuinfo_arm_chipset_to_string(
|
||||
*/
|
||||
void cpuinfo_arm_fixup_raspberry_pi_chipset(
|
||||
struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
const char revision[restrict static CPUINFO_HARDWARE_VALUE_MAX])
|
||||
const char revision[restrict static CPUINFO_REVISION_VALUE_MAX])
|
||||
{
|
||||
const size_t revision_length = strnlen(revision, CPUINFO_REVISION_VALUE_MAX);
|
||||
|
||||
|
||||
20
3rdparty/cpuinfo/src/arm/linux/clusters.c
vendored
20
3rdparty/cpuinfo/src/arm/linux/clusters.c
vendored
@@ -48,7 +48,7 @@ static inline bool bitmask_all(uint32_t bitfield, uint32_t mask) {
|
||||
* @param usable_processors - number of processors in the @p processors array with CPUINFO_LINUX_FLAG_VALID flags.
|
||||
* @param max_processors - number of elements in the @p processors array.
|
||||
* @param[in,out] processors - processor descriptors with pre-parsed POSSIBLE and PRESENT flags, minimum/maximum
|
||||
* frequency, MIDR infromation, and core cluster (package siblings list) information.
|
||||
* frequency, MIDR information, and core cluster (package siblings list) information.
|
||||
*
|
||||
* @retval true if the heuristic successfully assigned all processors into clusters of cores.
|
||||
* @retval false if known details about processors contradict the heuristic configuration of core clusters.
|
||||
@@ -292,9 +292,9 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
* - Processors assigned to these clusters stay assigned to the same clusters
|
||||
* - No new processors are added to these clusters
|
||||
* - Processors without pre-assigned cluster are clustered in one sequential scan:
|
||||
* - If known details (min/max frequency, MIDR components) of a processor are compatible with a preceeding
|
||||
* processor, without pre-assigned cluster, the processor is assigned to the cluster of the preceeding processor.
|
||||
* - If known details (min/max frequency, MIDR components) of a processor are not compatible with a preceeding
|
||||
* - If known details (min/max frequency, MIDR components) of a processor are compatible with a preceding
|
||||
* processor, without pre-assigned cluster, the processor is assigned to the cluster of the preceding processor.
|
||||
* - If known details (min/max frequency, MIDR components) of a processor are not compatible with a preceding
|
||||
* processor, the processor is assigned to a newly created cluster.
|
||||
*
|
||||
* The function must be called after parsing OS-provided information on core clusters, and usually is called only
|
||||
@@ -309,7 +309,7 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
*
|
||||
* @param max_processors - number of elements in the @p processors array.
|
||||
* @param[in,out] processors - processor descriptors with pre-parsed POSSIBLE and PRESENT flags, minimum/maximum
|
||||
* frequency, MIDR infromation, and core cluster (package siblings list) information.
|
||||
* frequency, MIDR information, and core cluster (package siblings list) information.
|
||||
*
|
||||
* @retval true if the heuristic successfully assigned all processors into clusters of cores.
|
||||
* @retval false if known details about processors contradict the heuristic configuration of core clusters.
|
||||
@@ -331,7 +331,7 @@ void cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(
|
||||
if (cluster_flags & CPUINFO_LINUX_FLAG_MIN_FREQUENCY) {
|
||||
if (cluster_min_frequency != processors[i].min_frequency) {
|
||||
cpuinfo_log_info(
|
||||
"minimum frequency of processor %"PRIu32" (%"PRIu32" KHz) is different than of preceeding cluster (%"PRIu32" KHz); "
|
||||
"minimum frequency of processor %"PRIu32" (%"PRIu32" KHz) is different than of preceding cluster (%"PRIu32" KHz); "
|
||||
"processor %"PRIu32" starts to a new cluster",
|
||||
i, processors[i].min_frequency, cluster_min_frequency, i);
|
||||
goto new_cluster;
|
||||
@@ -346,7 +346,7 @@ void cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(
|
||||
if (cluster_flags & CPUINFO_LINUX_FLAG_MAX_FREQUENCY) {
|
||||
if (cluster_max_frequency != processors[i].max_frequency) {
|
||||
cpuinfo_log_debug(
|
||||
"maximum frequency of processor %"PRIu32" (%"PRIu32" KHz) is different than of preceeding cluster (%"PRIu32" KHz); "
|
||||
"maximum frequency of processor %"PRIu32" (%"PRIu32" KHz) is different than of preceding cluster (%"PRIu32" KHz); "
|
||||
"processor %"PRIu32" starts a new cluster",
|
||||
i, processors[i].max_frequency, cluster_max_frequency, i);
|
||||
goto new_cluster;
|
||||
@@ -361,7 +361,7 @@ void cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(
|
||||
if (cluster_flags & CPUINFO_ARM_LINUX_VALID_IMPLEMENTER) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_IMPLEMENTER_MASK) != (processors[i].midr & CPUINFO_ARM_MIDR_IMPLEMENTER_MASK)) {
|
||||
cpuinfo_log_debug(
|
||||
"CPU Implementer of processor %"PRIu32" (0x%02"PRIx32") is different than of preceeding cluster (0x%02"PRIx32"); "
|
||||
"CPU Implementer of processor %"PRIu32" (0x%02"PRIx32") is different than of preceding cluster (0x%02"PRIx32"); "
|
||||
"processor %"PRIu32" starts to a new cluster",
|
||||
i, midr_get_implementer(processors[i].midr), midr_get_implementer(cluster_midr), i);
|
||||
goto new_cluster;
|
||||
@@ -417,11 +417,11 @@ void cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(
|
||||
}
|
||||
}
|
||||
|
||||
/* All checks passed, attach processor to the preceeding cluster */
|
||||
/* All checks passed, attach processor to the preceding cluster */
|
||||
cluster_processors++;
|
||||
processors[i].package_leader_id = cluster_start;
|
||||
processors[i].flags |= CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER;
|
||||
cpuinfo_log_debug("assigned processor %"PRIu32" to preceeding cluster of processor %"PRIu32, i, cluster_start);
|
||||
cpuinfo_log_debug("assigned processor %"PRIu32" to preceding cluster of processor %"PRIu32, i, cluster_start);
|
||||
continue;
|
||||
|
||||
new_cluster:
|
||||
|
||||
18
3rdparty/cpuinfo/src/arm/linux/cp.h
vendored
18
3rdparty/cpuinfo/src/arm/linux/cp.h
vendored
@@ -35,10 +35,16 @@
|
||||
return mvfr0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline uint32_t read_wcid(void) {
|
||||
uint32_t wcid;
|
||||
__asm__ __volatile__("MRC p1, 0, %[wcid], c0, c0" : [wcid] "=r" (wcid));
|
||||
return wcid;
|
||||
}
|
||||
#if !defined(__ARM_ARCH_8A__) && !(defined(__ARM_ARCH) && (__ARM_ARCH >= 8))
|
||||
/*
|
||||
* In ARMv8, AArch32 state supports only conceptual coprocessors CP10, CP11, CP14, and CP15.
|
||||
* AArch64 does not support the concept of coprocessors.
|
||||
* and clang refuses to compile inline assembly when targeting ARMv8+
|
||||
*/
|
||||
static inline uint32_t read_wcid(void) {
|
||||
uint32_t wcid;
|
||||
__asm__ __volatile__("MRC p1, 0, %[wcid], c0, c0" : [wcid] "=r" (wcid));
|
||||
return wcid;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
9
3rdparty/cpuinfo/src/arm/linux/cpuinfo.c
vendored
9
3rdparty/cpuinfo/src/arm/linux/cpuinfo.c
vendored
@@ -177,6 +177,10 @@ static void parse_features(
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_FCMA;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "i8mm", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_I8MM;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
} else if (memcmp(feature_start, "half", feature_length) == 0) {
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_HALF;
|
||||
@@ -283,6 +287,10 @@ static void parse_features(
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_ASIMDRDM;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "asimdfhm", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_ASIMDFHM;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
} else if (memcmp(feature_start, "fastmult", feature_length) == 0) {
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_FASTMULT;
|
||||
@@ -896,6 +904,7 @@ bool cpuinfo_arm_linux_parse_proc_cpuinfo(
|
||||
uint32_t max_processors_count,
|
||||
struct cpuinfo_arm_linux_processor processors[restrict static max_processors_count])
|
||||
{
|
||||
hardware[0] = '\0';
|
||||
struct proc_cpuinfo_parser_state state = {
|
||||
.hardware = hardware,
|
||||
.revision = revision,
|
||||
|
||||
10
3rdparty/cpuinfo/src/arm/linux/hwcap.c
vendored
10
3rdparty/cpuinfo/src/arm/linux/hwcap.c
vendored
@@ -1,3 +1,4 @@
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <unistd.h>
|
||||
@@ -15,7 +16,8 @@
|
||||
#include <arm/linux/api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
#if CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_ARM && !defined(__ANDROID__)
|
||||
#if CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_ARM && \
|
||||
defined(__GLIBC__) && defined(__GLIBC_MINOR__) && (__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 16)
|
||||
#include <sys/auxv.h>
|
||||
#else
|
||||
#define AT_HWCAP 16
|
||||
@@ -74,11 +76,13 @@
|
||||
libc = NULL;
|
||||
}
|
||||
return getauxval != NULL;
|
||||
#else
|
||||
/* GNU/Linux: getauxval is always supported */
|
||||
#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) && (__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 16)
|
||||
/* GNU/Linux: getauxval is supported since glibc-2.16 */
|
||||
*hwcap = getauxval(AT_HWCAP);
|
||||
*hwcap2 = getauxval(AT_HWCAP2);
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
12
3rdparty/cpuinfo/src/arm/linux/init.c
vendored
12
3rdparty/cpuinfo/src/arm/linux/init.c
vendored
@@ -199,9 +199,13 @@ void cpuinfo_arm_linux_init(void) {
|
||||
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
|
||||
arm_linux_processors[i].system_processor_id = i;
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
valid_processors += 1;
|
||||
|
||||
if (!(arm_linux_processors[i].flags & CPUINFO_ARM_LINUX_VALID_PROCESSOR)) {
|
||||
if (arm_linux_processors[i].flags & CPUINFO_ARM_LINUX_VALID_PROCESSOR) {
|
||||
/*
|
||||
* Processor is in possible and present lists, and also reported in /proc/cpuinfo.
|
||||
* This processor is availble for compute.
|
||||
*/
|
||||
valid_processors += 1;
|
||||
} else {
|
||||
/*
|
||||
* Processor is in possible and present lists, but not reported in /proc/cpuinfo.
|
||||
* This is fairly common: high-index processors can be not reported if they are offline.
|
||||
@@ -510,7 +514,7 @@ void cpuinfo_arm_linux_init(void) {
|
||||
uint32_t l2_count = 0, l3_count = 0, big_l3_size = 0, cluster_id = UINT32_MAX;
|
||||
/* Indication whether L3 (if it exists) is shared between all cores */
|
||||
bool shared_l3 = true;
|
||||
/* Populate cache infromation structures in l1i, l1d */
|
||||
/* Populate cache information structures in l1i, l1d */
|
||||
for (uint32_t i = 0; i < valid_processors; i++) {
|
||||
if (arm_linux_processors[i].package_leader_id == arm_linux_processors[i].system_processor_id) {
|
||||
cluster_id += 1;
|
||||
|
||||
6
3rdparty/cpuinfo/src/arm/linux/midr.c
vendored
6
3rdparty/cpuinfo/src/arm/linux/midr.c
vendored
@@ -675,10 +675,10 @@ static bool cpuinfo_arm_linux_detect_cluster_midr_by_big_little_heuristic(
|
||||
|
||||
/*
|
||||
* Initializes MIDR for leaders of core clusters in a single sequential scan:
|
||||
* - Clusters preceeding the first reported MIDR value are assumed to have default MIDR value.
|
||||
* - Clusters preceding the first reported MIDR value are assumed to have default MIDR value.
|
||||
* - Clusters following any reported MIDR value to have that MIDR value.
|
||||
*
|
||||
* @param default_midr - MIDR value that will be assigned to cluster leaders preceeding any reported MIDR value.
|
||||
* @param default_midr - MIDR value that will be assigned to cluster leaders preceding any reported MIDR value.
|
||||
* @param processors_count - number of logical processor descriptions in the @p processors array.
|
||||
* @param[in,out] processors - array of logical processor descriptions with pre-parsed MIDR, maximum frequency,
|
||||
* and decoded core cluster (package_leader_id) information.
|
||||
@@ -833,7 +833,7 @@ uint32_t cpuinfo_arm_linux_detect_cluster_midr(
|
||||
* 2. For systems with 2 clusters and MIDR known for one cluster, assume big.LITTLE configuration,
|
||||
* and estimate MIDR for the other cluster under assumption that MIDR for the big cluster is known.
|
||||
* 3. Initialize MIDRs for core clusters in a single sequential scan:
|
||||
* - Clusters preceeding the first reported MIDR value are assumed to have the last reported MIDR value.
|
||||
* - Clusters preceding the first reported MIDR value are assumed to have the last reported MIDR value.
|
||||
* - Clusters following any reported MIDR value to have that MIDR value.
|
||||
*/
|
||||
|
||||
|
||||
223
3rdparty/cpuinfo/src/arm/mach/init.c
vendored
223
3rdparty/cpuinfo/src/arm/mach/init.c
vendored
@@ -15,43 +15,25 @@
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
/* Polyfill recent CPUFAMILY_ARM_* values for older SDKs */
|
||||
#ifndef CPUFAMILY_ARM_MONSOON_MISTRAL
|
||||
#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xE81E7EF6
|
||||
#endif
|
||||
#ifndef CPUFAMILY_ARM_VORTEX_TEMPEST
|
||||
#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07D34B9F
|
||||
#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07D34B9F
|
||||
#endif
|
||||
#ifndef CPUFAMILY_ARM_LIGHTNING_THUNDER
|
||||
#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504D2
|
||||
#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504D2
|
||||
#endif
|
||||
#ifndef CPUFAMILY_ARM_FIRESTORM_ICESTORM
|
||||
#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1B588BB3
|
||||
#endif
|
||||
#ifndef CPUFAMILY_ARM_AVALANCHE_BLIZZARD
|
||||
#define CPUFAMILY_ARM_AVALANCHE_BLIZZARD 0xDA33D83D
|
||||
#endif
|
||||
|
||||
struct cpuinfo_arm_isa cpuinfo_isa = {
|
||||
#if CPUINFO_ARCH_ARM
|
||||
.thumb = true,
|
||||
.thumb2 = true,
|
||||
.thumbee = false,
|
||||
.jazelle = false,
|
||||
.armv5e = true,
|
||||
.armv6 = true,
|
||||
.armv6k = true,
|
||||
.armv7 = true,
|
||||
.vfpv2 = false,
|
||||
.vfpv3 = true,
|
||||
.d32 = true,
|
||||
.wmmx = false,
|
||||
.wmmx2 = false,
|
||||
.neon = true,
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
.aes = true,
|
||||
.sha1 = true,
|
||||
.sha2 = true,
|
||||
.pmull = true,
|
||||
.crc32 = true,
|
||||
#endif
|
||||
};
|
||||
|
||||
static uint32_t get_sys_info(int type_specifier, const char* name) {
|
||||
@@ -83,10 +65,8 @@ static uint32_t get_sys_info_by_name(const char* type_specifier) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static enum cpuinfo_uarch decode_uarch(uint32_t cpu_family, uint32_t cpu_subtype, uint32_t core_index, uint32_t core_count) {
|
||||
static enum cpuinfo_uarch decode_uarch(uint32_t cpu_family, uint32_t core_index, uint32_t core_count) {
|
||||
switch (cpu_family) {
|
||||
case CPUFAMILY_ARM_SWIFT:
|
||||
return cpuinfo_uarch_swift;
|
||||
case CPUFAMILY_ARM_CYCLONE:
|
||||
return cpuinfo_uarch_cyclone;
|
||||
case CPUFAMILY_ARM_TYPHOON:
|
||||
@@ -107,25 +87,15 @@ static enum cpuinfo_uarch decode_uarch(uint32_t cpu_family, uint32_t cpu_subtype
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
/* Hexa-core: 2x Firestorm + 4x Icestorm; Octa-core: 4x Firestorm + 4x Icestorm */
|
||||
return core_index + 4 < core_count ? cpuinfo_uarch_firestorm : cpuinfo_uarch_icestorm;
|
||||
case CPUFAMILY_ARM_AVALANCHE_BLIZZARD:
|
||||
/* Hexa-core: 2x Avalanche + 4x Blizzard */
|
||||
return core_index + 4 < core_count ? cpuinfo_uarch_avalanche : cpuinfo_uarch_blizzard;
|
||||
default:
|
||||
/* Use hw.cpusubtype for detection */
|
||||
break;
|
||||
}
|
||||
|
||||
#if CPUINFO_ARCH_ARM
|
||||
switch (cpu_subtype) {
|
||||
case CPU_SUBTYPE_ARM_V7:
|
||||
return cpuinfo_uarch_cortex_a8;
|
||||
case CPU_SUBTYPE_ARM_V7F:
|
||||
return cpuinfo_uarch_cortex_a9;
|
||||
case CPU_SUBTYPE_ARM_V7K:
|
||||
return cpuinfo_uarch_cortex_a7;
|
||||
default:
|
||||
return cpuinfo_uarch_unknown;
|
||||
}
|
||||
#else
|
||||
return cpuinfo_uarch_unknown;
|
||||
#endif
|
||||
return cpuinfo_uarch_unknown;
|
||||
}
|
||||
|
||||
static void decode_package_name(char* package_name) {
|
||||
@@ -299,71 +269,118 @@ void cpuinfo_arm_mach_init(void) {
|
||||
|
||||
|
||||
const uint32_t cpu_family = get_sys_info_by_name("hw.cpufamily");
|
||||
const uint32_t cpu_type = get_sys_info_by_name("hw.cputype");
|
||||
const uint32_t cpu_subtype = get_sys_info_by_name("hw.cpusubtype");
|
||||
switch (cpu_type) {
|
||||
case CPU_TYPE_ARM64:
|
||||
cpuinfo_isa.aes = true;
|
||||
cpuinfo_isa.sha1 = true;
|
||||
cpuinfo_isa.sha2 = true;
|
||||
cpuinfo_isa.pmull = true;
|
||||
cpuinfo_isa.crc32 = true;
|
||||
break;
|
||||
#if CPUINFO_ARCH_ARM
|
||||
case CPU_TYPE_ARM:
|
||||
switch (cpu_subtype) {
|
||||
case CPU_SUBTYPE_ARM_V8:
|
||||
cpuinfo_isa.armv8 = true;
|
||||
cpuinfo_isa.aes = true;
|
||||
cpuinfo_isa.sha1 = true;
|
||||
cpuinfo_isa.sha2 = true;
|
||||
cpuinfo_isa.pmull = true;
|
||||
cpuinfo_isa.crc32 = true;
|
||||
/* Fall-through to add ARMv7S features */
|
||||
case CPU_SUBTYPE_ARM_V7S:
|
||||
case CPU_SUBTYPE_ARM_V7K:
|
||||
cpuinfo_isa.fma = true;
|
||||
/* Fall-through to add ARMv7F features */
|
||||
case CPU_SUBTYPE_ARM_V7F:
|
||||
cpuinfo_isa.armv7mp = true;
|
||||
cpuinfo_isa.fp16 = true;
|
||||
/* Fall-through to add ARMv7 features */
|
||||
case CPU_SUBTYPE_ARM_V7:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Support for ARMv8.1 Atomics & FP16 arithmetic instructions is supposed to be detected via
|
||||
* sysctlbyname calls with "hw.optional.armv8_1_atomics" and "hw.optional.neon_fp16" arguments
|
||||
* (see https://devstreaming-cdn.apple.com/videos/wwdc/2018/409t8zw7rumablsh/409/409_whats_new_in_llvm.pdf),
|
||||
* but on new iOS versions these calls just fail with EPERM.
|
||||
*
|
||||
* Thus, we whitelist CPUs known to support these instructions.
|
||||
*/
|
||||
switch (cpu_family) {
|
||||
case CPUFAMILY_ARM_MONSOON_MISTRAL:
|
||||
case CPUFAMILY_ARM_VORTEX_TEMPEST:
|
||||
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
cpuinfo_isa.atomics = true;
|
||||
#endif
|
||||
cpuinfo_isa.fp16arith = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* There does not yet seem to exist an OS mechanism to detect support for
|
||||
* ARMv8.2 optional dot-product instructions, so we currently whitelist CPUs
|
||||
* known to support these instruction.
|
||||
* iOS 15 and macOS 12 added sysctls for ARM features, use them where possible.
|
||||
* Otherwise, fallback to hardcoded set of CPUs with known support.
|
||||
*/
|
||||
switch (cpu_family) {
|
||||
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
cpuinfo_isa.dot = true;
|
||||
const uint32_t has_feat_lse = get_sys_info_by_name("hw.optional.arm.FEAT_LSE");
|
||||
if (has_feat_lse != 0) {
|
||||
cpuinfo_isa.atomics = true;
|
||||
} else {
|
||||
// Mandatory in ARMv8.1-A, list only cores released before iOS 15 / macOS 12
|
||||
switch (cpu_family) {
|
||||
case CPUFAMILY_ARM_MONSOON_MISTRAL:
|
||||
case CPUFAMILY_ARM_VORTEX_TEMPEST:
|
||||
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
cpuinfo_isa.atomics = true;
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t has_feat_rdm = get_sys_info_by_name("hw.optional.arm.FEAT_RDM");
|
||||
if (has_feat_rdm != 0) {
|
||||
cpuinfo_isa.rdm = true;
|
||||
} else {
|
||||
// Optional in ARMv8.2-A (implemented in Apple cores),
|
||||
// list only cores released before iOS 15 / macOS 12
|
||||
switch (cpu_family) {
|
||||
case CPUFAMILY_ARM_MONSOON_MISTRAL:
|
||||
case CPUFAMILY_ARM_VORTEX_TEMPEST:
|
||||
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
cpuinfo_isa.rdm = true;
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t has_feat_fp16 = get_sys_info_by_name("hw.optional.arm.FEAT_FP16");
|
||||
if (has_feat_fp16 != 0) {
|
||||
cpuinfo_isa.fp16arith = true;
|
||||
} else {
|
||||
// Optional in ARMv8.2-A (implemented in Apple cores),
|
||||
// list only cores released before iOS 15 / macOS 12
|
||||
switch (cpu_family) {
|
||||
case CPUFAMILY_ARM_MONSOON_MISTRAL:
|
||||
case CPUFAMILY_ARM_VORTEX_TEMPEST:
|
||||
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
cpuinfo_isa.fp16arith = true;
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t has_feat_fhm = get_sys_info_by_name("hw.optional.arm.FEAT_FHM");
|
||||
if (has_feat_fhm != 0) {
|
||||
cpuinfo_isa.fhm = true;
|
||||
} else {
|
||||
// Prior to iOS 15, use 'hw.optional.armv8_2_fhm'
|
||||
const uint32_t has_feat_fhm_legacy = get_sys_info_by_name("hw.optional.armv8_2_fhm");
|
||||
if (has_feat_fhm_legacy != 0) {
|
||||
cpuinfo_isa.fhm = true;
|
||||
} else {
|
||||
// Mandatory in ARMv8.4-A when FP16 arithmetics is implemented,
|
||||
// list only cores released before iOS 15 / macOS 12
|
||||
switch (cpu_family) {
|
||||
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
cpuinfo_isa.fhm = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t has_feat_bf16 = get_sys_info_by_name("hw.optional.arm.FEAT_BF16");
|
||||
if (has_feat_bf16 != 0) {
|
||||
cpuinfo_isa.bf16 = true;
|
||||
}
|
||||
|
||||
const uint32_t has_feat_fcma = get_sys_info_by_name("hw.optional.arm.FEAT_FCMA");
|
||||
if (has_feat_fcma != 0) {
|
||||
cpuinfo_isa.fcma = true;
|
||||
} else {
|
||||
// Mandatory in ARMv8.3-A, list only cores released before iOS 15 / macOS 12
|
||||
switch (cpu_family) {
|
||||
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
cpuinfo_isa.fcma = true;
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t has_feat_jscvt = get_sys_info_by_name("hw.optional.arm.FEAT_JSCVT");
|
||||
if (has_feat_jscvt != 0) {
|
||||
cpuinfo_isa.jscvt = true;
|
||||
} else {
|
||||
// Mandatory in ARMv8.3-A, list only cores released before iOS 15 / macOS 12
|
||||
switch (cpu_family) {
|
||||
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
cpuinfo_isa.jscvt = true;
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t has_feat_dotprod = get_sys_info_by_name("hw.optional.arm.FEAT_DotProd");
|
||||
if (has_feat_dotprod != 0) {
|
||||
cpuinfo_isa.dot = true;
|
||||
} else {
|
||||
// Mandatory in ARMv8.4-A, list only cores released before iOS 15 / macOS 12
|
||||
switch (cpu_family) {
|
||||
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
cpuinfo_isa.dot = true;
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t has_feat_i8mm = get_sys_info_by_name("hw.optional.arm.FEAT_I8MM");
|
||||
if (has_feat_i8mm != 0) {
|
||||
cpuinfo_isa.i8mm = true;
|
||||
}
|
||||
|
||||
uint32_t num_clusters = 1;
|
||||
@@ -374,7 +391,7 @@ void cpuinfo_arm_mach_init(void) {
|
||||
.core_id = i % cores_per_package,
|
||||
.package = packages + i / cores_per_package,
|
||||
.vendor = cpuinfo_vendor_apple,
|
||||
.uarch = decode_uarch(cpu_family, cpu_subtype, i, mach_topology.cores),
|
||||
.uarch = decode_uarch(cpu_family, i, mach_topology.cores),
|
||||
};
|
||||
if (i != 0 && cores[i].uarch != cores[i - 1].uarch) {
|
||||
num_clusters++;
|
||||
|
||||
35
3rdparty/cpuinfo/src/arm/midr.h
vendored
35
3rdparty/cpuinfo/src/arm/midr.h
vendored
@@ -174,23 +174,27 @@ inline static uint32_t midr_score_core(uint32_t midr) {
|
||||
case UINT32_C(0x53000030): /* Exynos M4 */
|
||||
case UINT32_C(0x53000040): /* Exynos M5 */
|
||||
case UINT32_C(0x4100D440): /* Cortex-X1 */
|
||||
/* These cores are in big role w.r.t Cortex-A75/-A76/-A77/-A78 */
|
||||
case UINT32_C(0x4100D480): /* Cortex-X2 */
|
||||
case UINT32_C(0x4100D4E0): /* Cortex-X3 */
|
||||
/* These cores are in big role w.r.t Cortex-A75/-A76/-A77/-A78/-A710/-A715 */
|
||||
return 6;
|
||||
case UINT32_C(0x4E000030): /* Denver 2 */
|
||||
case UINT32_C(0x53000010): /* Exynos M1 and Exynos M2 */
|
||||
case UINT32_C(0x53000020): /* Exynos M3 */
|
||||
case UINT32_C(0x51008040): /* Kryo 485 Gold / Gold Prime */
|
||||
case UINT32_C(0x51008020): /* Kryo 385 Gold */
|
||||
case UINT32_C(0x51008000): /* Kryo 260 / 280 Gold */
|
||||
case UINT32_C(0x51002050): /* Kryo Gold */
|
||||
case UINT32_C(0x4800D400): /* Cortex-A76 (HiSilicon) */
|
||||
case UINT32_C(0x4100D410): /* Cortex-A78 */
|
||||
case UINT32_C(0x4100D080): /* Cortex-A72 */
|
||||
case UINT32_C(0x4100D090): /* Cortex-A73 */
|
||||
case UINT32_C(0x4100D0A0): /* Cortex-A75 */
|
||||
case UINT32_C(0x4100D0B0): /* Cortex-A76 */
|
||||
case UINT32_C(0x4100D0D0): /* Cortex-A77 */
|
||||
case UINT32_C(0x4100D0E0): /* Cortex-A76AE */
|
||||
case UINT32_C(0x4100D0B0): /* Cortex-A76 */
|
||||
case UINT32_C(0x4100D0A0): /* Cortex-A75 */
|
||||
case UINT32_C(0x4100D090): /* Cortex-A73 */
|
||||
case UINT32_C(0x4100D080): /* Cortex-A72 */
|
||||
case UINT32_C(0x4100D410): /* Cortex-A78 */
|
||||
case UINT32_C(0x4100D470): /* Cortex-A710 */
|
||||
case UINT32_C(0x4100D4D0): /* Cortex-A715 */
|
||||
case UINT32_C(0x4800D400): /* Cortex-A76 (HiSilicon) */
|
||||
case UINT32_C(0x4E000030): /* Denver 2 */
|
||||
case UINT32_C(0x51002050): /* Kryo Gold */
|
||||
case UINT32_C(0x51008000): /* Kryo 260 / 280 Gold */
|
||||
case UINT32_C(0x51008020): /* Kryo 385 Gold */
|
||||
case UINT32_C(0x51008040): /* Kryo 485 Gold / Gold Prime */
|
||||
case UINT32_C(0x53000010): /* Exynos M1 and Exynos M2 */
|
||||
case UINT32_C(0x53000020): /* Exynos M3 */
|
||||
#if CPUINFO_ARCH_ARM
|
||||
case UINT32_C(0x4100C0F0): /* Cortex-A15 */
|
||||
case UINT32_C(0x4100C0E0): /* Cortex-A17 */
|
||||
@@ -205,8 +209,9 @@ inline static uint32_t midr_score_core(uint32_t midr) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
case UINT32_C(0x4100D060): /* Cortex-A65 */
|
||||
#endif /* CPUINFO_ARCH_ARM64 */
|
||||
case UINT32_C(0x4100D050): /* Cortex-A55 */
|
||||
case UINT32_C(0x4100D030): /* Cortex-A53 */
|
||||
case UINT32_C(0x4100D050): /* Cortex-A55 */
|
||||
case UINT32_C(0x4100D460): /* Cortex-A510 */
|
||||
/* Cortex-A53 is usually in LITTLE role, but can be in big role w.r.t. Cortex-A35 */
|
||||
return 2;
|
||||
case UINT32_C(0x4100D040): /* Cortex-A35 */
|
||||
|
||||
48
3rdparty/cpuinfo/src/arm/uarch.c
vendored
48
3rdparty/cpuinfo/src/arm/uarch.c
vendored
@@ -80,28 +80,50 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
case 0xD0B:
|
||||
*uarch = cpuinfo_uarch_cortex_a76;
|
||||
break;
|
||||
#if CPUINFO_ARCH_ARM64 && !defined(__ANDROID__)
|
||||
case 0xD0C:
|
||||
*uarch = cpuinfo_uarch_neoverse_n1;
|
||||
break;
|
||||
#endif /* CPUINFO_ARCH_ARM64 && !defined(__ANDROID__) */
|
||||
case 0xD0D:
|
||||
*uarch = cpuinfo_uarch_cortex_a77;
|
||||
break;
|
||||
case 0xD0E: /* Cortex-A76AE */
|
||||
*uarch = cpuinfo_uarch_cortex_a76;
|
||||
break;
|
||||
case 0xD40: /* Neoverse V1 */
|
||||
*uarch = cpuinfo_uarch_neoverse_v1;
|
||||
break;
|
||||
case 0xD41: /* Cortex-A78 */
|
||||
*uarch = cpuinfo_uarch_cortex_a78;
|
||||
break;
|
||||
case 0xD44: /* Cortex-X1 */
|
||||
*uarch = cpuinfo_uarch_cortex_x1;
|
||||
break;
|
||||
#if CPUINFO_ARCH_ARM64 && !defined(__ANDROID__)
|
||||
case 0xD46: /* Cortex-A510 */
|
||||
*uarch = cpuinfo_uarch_cortex_a510;
|
||||
break;
|
||||
case 0xD47: /* Cortex-A710 */
|
||||
*uarch = cpuinfo_uarch_cortex_a710;
|
||||
break;
|
||||
case 0xD48: /* Cortex-X2 */
|
||||
*uarch = cpuinfo_uarch_cortex_x2;
|
||||
break;
|
||||
case 0xD49: /* Neoverse N2 */
|
||||
*uarch = cpuinfo_uarch_neoverse_n2;
|
||||
break;
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
case 0xD4A:
|
||||
*uarch = cpuinfo_uarch_neoverse_e1;
|
||||
break;
|
||||
#endif /* CPUINFO_ARCH_ARM64 && !defined(__ANDROID__) */
|
||||
#endif /* CPUINFO_ARCH_ARM64 */
|
||||
case 0xD4D: /* Cortex-A715 */
|
||||
*uarch = cpuinfo_uarch_cortex_a715;
|
||||
break;
|
||||
case 0xD4E: /* Cortex-X3 */
|
||||
*uarch = cpuinfo_uarch_cortex_x3;
|
||||
break;
|
||||
case 0xD4F: /* Neoverse V2 */
|
||||
*uarch = cpuinfo_uarch_neoverse_v2;
|
||||
break;
|
||||
default:
|
||||
switch (midr_get_part(midr) >> 8) {
|
||||
#if CPUINFO_ARCH_ARM
|
||||
@@ -129,18 +151,18 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
case 0x100:
|
||||
*uarch = cpuinfo_uarch_brahma_b53;
|
||||
break;
|
||||
#if CPUINFO_ARCH_ARM64 && !defined(__ANDROID__)
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
case 0x516:
|
||||
/* Broadcom Vulkan was sold to Cavium before it reached the market, so we identify it as Cavium ThunderX2 */
|
||||
*vendor = cpuinfo_vendor_cavium;
|
||||
*uarch = cpuinfo_uarch_thunderx2;
|
||||
break;
|
||||
#endif
|
||||
#endif /* CPUINFO_ARCH_ARM64 */
|
||||
default:
|
||||
cpuinfo_log_warning("unknown Broadcom CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
}
|
||||
break;
|
||||
#if CPUINFO_ARCH_ARM64 && !defined(__ANDROID__)
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
case 'C':
|
||||
*vendor = cpuinfo_vendor_cavium;
|
||||
switch (midr_get_part(midr)) {
|
||||
@@ -157,15 +179,15 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
cpuinfo_log_warning("unknown Cavium CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#endif /* CPUINFO_ARCH_ARM64 */
|
||||
case 'H':
|
||||
*vendor = cpuinfo_vendor_huawei;
|
||||
switch (midr_get_part(midr)) {
|
||||
#if CPUINFO_ARCH_ARM64 && !defined(__ANDROID__)
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
case 0xD01: /* Kunpeng 920 series */
|
||||
*uarch = cpuinfo_uarch_taishan_v110;
|
||||
break;
|
||||
#endif
|
||||
#endif /* CPUINFO_ARCH_ARM64 */
|
||||
case 0xD40: /* Kirin 980 Big/Medium cores -> Cortex-A76 */
|
||||
*vendor = cpuinfo_vendor_arm;
|
||||
*uarch = cpuinfo_uarch_cortex_a76;
|
||||
@@ -204,7 +226,6 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
cpuinfo_log_warning("unknown Nvidia CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
}
|
||||
break;
|
||||
#if !defined(__ANDROID__)
|
||||
case 'P':
|
||||
*vendor = cpuinfo_vendor_apm;
|
||||
switch (midr_get_part(midr)) {
|
||||
@@ -215,7 +236,6 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
cpuinfo_log_warning("unknown Applied Micro CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case 'Q':
|
||||
*vendor = cpuinfo_vendor_qualcomm;
|
||||
switch (midr_get_part(midr)) {
|
||||
@@ -282,14 +302,14 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
*vendor = cpuinfo_vendor_arm;
|
||||
*uarch = cpuinfo_uarch_cortex_a55;
|
||||
break;
|
||||
#if CPUINFO_ARCH_ARM64 && !defined(__ANDROID__)
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
case 0xC00:
|
||||
*uarch = cpuinfo_uarch_falkor;
|
||||
break;
|
||||
case 0xC01:
|
||||
*uarch = cpuinfo_uarch_saphira;
|
||||
break;
|
||||
#endif /* CPUINFO_ARCH_ARM64 && !defined(__ANDROID__) */
|
||||
#endif /* CPUINFO_ARCH_ARM64 */
|
||||
default:
|
||||
cpuinfo_log_warning("unknown Qualcomm CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
}
|
||||
|
||||
901
3rdparty/cpuinfo/src/arm/windows/init-by-logical-sys-info.c
vendored
Normal file
901
3rdparty/cpuinfo/src/arm/windows/init-by-logical-sys-info.c
vendored
Normal file
@@ -0,0 +1,901 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/internal-api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
#include "windows-arm-init.h"
|
||||
|
||||
#define MAX_NR_OF_CACHES (cpuinfo_cache_level_max - 1)
|
||||
|
||||
/* Call chain:
|
||||
* cpu_info_init_by_logical_sys_info
|
||||
* read_packages_for_processors
|
||||
* read_cores_for_processors
|
||||
* read_caches_for_processors
|
||||
* read_all_logical_processor_info_of_relation
|
||||
* parse_relation_processor_info
|
||||
* store_package_info_per_processor
|
||||
* store_core_info_per_processor
|
||||
* parse_relation_cache_info
|
||||
* store_cache_info_per_processor
|
||||
*/
|
||||
|
||||
static uint32_t count_logical_processors(
|
||||
const uint32_t max_group_count,
|
||||
uint32_t* global_proc_index_per_group);
|
||||
|
||||
static uint32_t read_packages_for_processors(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t number_of_processors,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
const struct woa_chip_info *chip_info);
|
||||
|
||||
static uint32_t read_cores_for_processors(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t number_of_processors,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
struct cpuinfo_core* cores,
|
||||
const struct woa_chip_info *chip_info);
|
||||
|
||||
static uint32_t read_caches_for_processors(
|
||||
struct cpuinfo_processor *processors,
|
||||
const uint32_t number_of_processors,
|
||||
struct cpuinfo_cache *caches,
|
||||
uint32_t* numbers_of_caches,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
const struct woa_chip_info *chip_info);
|
||||
|
||||
static uint32_t read_all_logical_processor_info_of_relation(
|
||||
LOGICAL_PROCESSOR_RELATIONSHIP info_type,
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t number_of_processors,
|
||||
struct cpuinfo_cache* caches,
|
||||
uint32_t* numbers_of_caches,
|
||||
struct cpuinfo_core* cores,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
const struct woa_chip_info *chip_info);
|
||||
|
||||
static bool parse_relation_processor_info(
|
||||
struct cpuinfo_processor* processors,
|
||||
uint32_t nr_of_processors,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info,
|
||||
const uint32_t info_id,
|
||||
struct cpuinfo_core* cores,
|
||||
const struct woa_chip_info *chip_info);
|
||||
|
||||
static bool parse_relation_cache_info(
|
||||
struct cpuinfo_processor* processors,
|
||||
struct cpuinfo_cache* caches,
|
||||
uint32_t* numbers_of_caches,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info);
|
||||
|
||||
static void store_package_info_per_processor(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t processor_global_index,
|
||||
const uint32_t package_id,
|
||||
const uint32_t group_id,
|
||||
const uint32_t processor_id_in_group);
|
||||
|
||||
static void store_core_info_per_processor(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t processor_global_index,
|
||||
const uint32_t core_id,
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX core_info,
|
||||
struct cpuinfo_core* cores,
|
||||
const struct woa_chip_info *chip_info);
|
||||
|
||||
static void store_cache_info_per_processor(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t processor_global_index,
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info,
|
||||
struct cpuinfo_cache* current_cache);
|
||||
|
||||
static bool connect_packages_cores_clusters_by_processors(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t nr_of_processors,
|
||||
struct cpuinfo_package* packages,
|
||||
const uint32_t nr_of_packages,
|
||||
struct cpuinfo_cluster* clusters,
|
||||
struct cpuinfo_core* cores,
|
||||
const uint32_t nr_of_cores,
|
||||
const struct woa_chip_info* chip_info,
|
||||
enum cpuinfo_vendor vendor);
|
||||
|
||||
static inline uint32_t low_index_from_kaffinity(KAFFINITY kaffinity);
|
||||
|
||||
|
||||
bool cpu_info_init_by_logical_sys_info(
|
||||
const struct woa_chip_info *chip_info,
|
||||
const enum cpuinfo_vendor vendor)
|
||||
{
|
||||
struct cpuinfo_processor* processors = NULL;
|
||||
struct cpuinfo_package* packages = NULL;
|
||||
struct cpuinfo_cluster* clusters = NULL;
|
||||
struct cpuinfo_core* cores = NULL;
|
||||
struct cpuinfo_cache* caches = NULL;
|
||||
struct cpuinfo_uarch_info* uarchs = NULL;
|
||||
|
||||
uint32_t nr_of_packages = 0;
|
||||
uint32_t nr_of_cores = 0;
|
||||
uint32_t nr_of_all_caches = 0;
|
||||
uint32_t numbers_of_caches[MAX_NR_OF_CACHES] = {0};
|
||||
|
||||
uint32_t nr_of_uarchs = 0;
|
||||
bool result = false;
|
||||
|
||||
HANDLE heap = GetProcessHeap();
|
||||
|
||||
/* 1. Count available logical processor groups and processors */
|
||||
const uint32_t max_group_count = (uint32_t) GetMaximumProcessorGroupCount();
|
||||
cpuinfo_log_debug("detected %"PRIu32" processor group(s)", max_group_count);
|
||||
/* We need to store the absolute processor ID offsets for every groups, because
|
||||
* 1. We can't assume every processor groups include the same number of
|
||||
* logical processors.
|
||||
* 2. Every processor groups know its group number and processor IDs within
|
||||
* the group, but not the global processor IDs.
|
||||
* 3. We need to list every logical processors by global IDs.
|
||||
*/
|
||||
uint32_t* global_proc_index_per_group =
|
||||
(uint32_t*) HeapAlloc(heap, 0, max_group_count * sizeof(uint32_t));
|
||||
if (global_proc_index_per_group == NULL) {
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %"PRIu32" processor groups",
|
||||
max_group_count * sizeof(struct cpuinfo_processor), max_group_count);
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
uint32_t nr_of_processors =
|
||||
count_logical_processors(max_group_count, global_proc_index_per_group);
|
||||
processors = HeapAlloc(heap, HEAP_ZERO_MEMORY, nr_of_processors * sizeof(struct cpuinfo_processor));
|
||||
if (processors == NULL) {
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %"PRIu32" logical processors",
|
||||
nr_of_processors * sizeof(struct cpuinfo_processor), nr_of_processors);
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
/* 2. Read topology information via MSDN API: packages, cores and caches*/
|
||||
nr_of_packages = read_packages_for_processors(
|
||||
processors, nr_of_processors,
|
||||
global_proc_index_per_group,
|
||||
chip_info);
|
||||
if (!nr_of_packages) {
|
||||
cpuinfo_log_error("error in reading package information");
|
||||
goto clean_up;
|
||||
}
|
||||
cpuinfo_log_debug("detected %"PRIu32" processor package(s)", nr_of_packages);
|
||||
|
||||
/* We need the EfficiencyClass to parse uarch from the core information,
|
||||
* but we need to iterate first to count cores and allocate memory then
|
||||
* we will iterate again to read and store data to cpuinfo_core structures.
|
||||
*/
|
||||
nr_of_cores = read_cores_for_processors(
|
||||
processors, nr_of_processors,
|
||||
global_proc_index_per_group, NULL,
|
||||
chip_info);
|
||||
if (!nr_of_cores) {
|
||||
cpuinfo_log_error("error in reading core information");
|
||||
goto clean_up;
|
||||
}
|
||||
cpuinfo_log_debug("detected %"PRIu32" processor core(s)", nr_of_cores);
|
||||
|
||||
/* There is no API to read number of caches, so we need to iterate twice on caches:
|
||||
1. Count all type of caches -> allocate memory
|
||||
2. Read out cache data and store to allocated memory
|
||||
*/
|
||||
nr_of_all_caches = read_caches_for_processors(
|
||||
processors, nr_of_processors,
|
||||
caches, numbers_of_caches,
|
||||
global_proc_index_per_group, chip_info);
|
||||
if (!nr_of_all_caches) {
|
||||
cpuinfo_log_error("error in reading cache information");
|
||||
goto clean_up;
|
||||
}
|
||||
cpuinfo_log_debug("detected %"PRIu32" processor cache(s)", nr_of_all_caches);
|
||||
|
||||
/* 3. Allocate memory for package, cluster, core and cache structures */
|
||||
packages = HeapAlloc(heap, HEAP_ZERO_MEMORY, nr_of_packages * sizeof(struct cpuinfo_package));
|
||||
if (packages == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" physical packages",
|
||||
nr_of_packages * sizeof(struct cpuinfo_package), nr_of_packages);
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
/* We don't have cluster information so we explicitly set clusters to equal to cores. */
|
||||
clusters = HeapAlloc(heap, HEAP_ZERO_MEMORY, nr_of_cores * sizeof(struct cpuinfo_cluster));
|
||||
if (clusters == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" core clusters",
|
||||
nr_of_cores * sizeof(struct cpuinfo_cluster), nr_of_cores);
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
cores = HeapAlloc(heap, HEAP_ZERO_MEMORY, nr_of_cores * sizeof(struct cpuinfo_core));
|
||||
if (cores == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" cores",
|
||||
nr_of_cores * sizeof(struct cpuinfo_core), nr_of_cores);
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
/* We allocate one contiguous cache array for all caches, then use offsets per cache type. */
|
||||
caches = HeapAlloc(heap, HEAP_ZERO_MEMORY, nr_of_all_caches * sizeof(struct cpuinfo_cache));
|
||||
if (caches == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" caches",
|
||||
nr_of_all_caches * sizeof(struct cpuinfo_cache), nr_of_all_caches);
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
/* 4.Read missing topology information that can't be saved without counted
|
||||
* allocate structures in the first round.
|
||||
*/
|
||||
nr_of_all_caches = read_caches_for_processors(
|
||||
processors, nr_of_processors,
|
||||
caches, numbers_of_caches, global_proc_index_per_group, chip_info);
|
||||
if (!nr_of_all_caches) {
|
||||
cpuinfo_log_error("error in reading cache information");
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
nr_of_cores = read_cores_for_processors(
|
||||
processors, nr_of_processors,
|
||||
global_proc_index_per_group, cores,
|
||||
chip_info);
|
||||
if (!nr_of_cores) {
|
||||
cpuinfo_log_error("error in reading core information");
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
/* 5. Now that we read out everything from the system we can, fill the package, cluster
|
||||
* and core structures respectively.
|
||||
*/
|
||||
result = connect_packages_cores_clusters_by_processors(
|
||||
processors, nr_of_processors,
|
||||
packages, nr_of_packages,
|
||||
clusters,
|
||||
cores, nr_of_cores,
|
||||
chip_info,
|
||||
vendor);
|
||||
if(!result) {
|
||||
cpuinfo_log_error("error in connecting information");
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
/* 6. Count and store uarchs of cores, assuming same uarchs are neighbors */
|
||||
enum cpuinfo_uarch prev_uarch = cpuinfo_uarch_unknown;
|
||||
for (uint32_t i = 0; i < nr_of_cores; i++) {
|
||||
if (prev_uarch != cores[i].uarch) {
|
||||
nr_of_uarchs++;
|
||||
prev_uarch = cores[i].uarch;
|
||||
}
|
||||
}
|
||||
uarchs = HeapAlloc(heap, HEAP_ZERO_MEMORY, nr_of_uarchs * sizeof(struct cpuinfo_uarch_info));
|
||||
if (uarchs == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" uarchs",
|
||||
nr_of_uarchs * sizeof(struct cpuinfo_uarch_info), nr_of_uarchs);
|
||||
goto clean_up;
|
||||
}
|
||||
prev_uarch = cpuinfo_uarch_unknown;
|
||||
for (uint32_t i = 0, uarch_index = 0; i < nr_of_cores; i++) {
|
||||
if (prev_uarch != cores[i].uarch) {
|
||||
if (i != 0) {
|
||||
uarch_index++;
|
||||
}
|
||||
if (uarch_index >= nr_of_uarchs) {
|
||||
cpuinfo_log_error("more uarchs detected than reported");
|
||||
}
|
||||
prev_uarch = cores[i].uarch;
|
||||
uarchs[uarch_index].uarch = cores[i].uarch;
|
||||
uarchs[uarch_index].core_count = 1;
|
||||
uarchs[uarch_index].processor_count = cores[i].processor_count;
|
||||
} else if (prev_uarch != cpuinfo_uarch_unknown) {
|
||||
uarchs[uarch_index].core_count++;
|
||||
uarchs[uarch_index].processor_count += cores[i].processor_count;
|
||||
}
|
||||
}
|
||||
|
||||
/* 7. Commit changes */
|
||||
cpuinfo_processors = processors;
|
||||
cpuinfo_packages = packages;
|
||||
cpuinfo_clusters = clusters;
|
||||
cpuinfo_cores = cores;
|
||||
cpuinfo_uarchs = uarchs;
|
||||
|
||||
cpuinfo_processors_count = nr_of_processors;
|
||||
cpuinfo_packages_count = nr_of_packages;
|
||||
cpuinfo_clusters_count = nr_of_cores;
|
||||
cpuinfo_cores_count = nr_of_cores;
|
||||
cpuinfo_uarchs_count = nr_of_uarchs;
|
||||
|
||||
for (uint32_t i = 0; i < MAX_NR_OF_CACHES; i++) {
|
||||
cpuinfo_cache_count[i] = numbers_of_caches[i];
|
||||
}
|
||||
cpuinfo_cache[cpuinfo_cache_level_1i] = caches;
|
||||
cpuinfo_cache[cpuinfo_cache_level_1d] = cpuinfo_cache[cpuinfo_cache_level_1i] + cpuinfo_cache_count[cpuinfo_cache_level_1i];
|
||||
cpuinfo_cache[cpuinfo_cache_level_2] = cpuinfo_cache[cpuinfo_cache_level_1d] + cpuinfo_cache_count[cpuinfo_cache_level_1d];
|
||||
cpuinfo_cache[cpuinfo_cache_level_3] = cpuinfo_cache[cpuinfo_cache_level_2] + cpuinfo_cache_count[cpuinfo_cache_level_2];
|
||||
cpuinfo_cache[cpuinfo_cache_level_4] = cpuinfo_cache[cpuinfo_cache_level_3] + cpuinfo_cache_count[cpuinfo_cache_level_3];
|
||||
cpuinfo_max_cache_size = cpuinfo_compute_max_cache_size(&processors[0]);
|
||||
|
||||
result = true;
|
||||
MemoryBarrier();
|
||||
|
||||
processors = NULL;
|
||||
packages = NULL;
|
||||
clusters = NULL;
|
||||
cores = NULL;
|
||||
caches = NULL;
|
||||
uarchs = NULL;
|
||||
|
||||
clean_up:
|
||||
/* The propagated pointers, shouldn't be freed, only in case of error
|
||||
* and unfinished init.
|
||||
*/
|
||||
if (processors != NULL) {
|
||||
HeapFree(heap, 0, processors);
|
||||
}
|
||||
if (packages != NULL) {
|
||||
HeapFree(heap, 0, packages);
|
||||
}
|
||||
if (clusters != NULL) {
|
||||
HeapFree(heap, 0, clusters);
|
||||
}
|
||||
if (cores != NULL) {
|
||||
HeapFree(heap, 0, cores);
|
||||
}
|
||||
if (caches != NULL) {
|
||||
HeapFree(heap, 0, caches);
|
||||
}
|
||||
if (uarchs != NULL) {
|
||||
HeapFree(heap, 0, uarchs);
|
||||
}
|
||||
|
||||
/* Free the locally used temporary pointers */
|
||||
HeapFree(heap, 0, global_proc_index_per_group);
|
||||
global_proc_index_per_group = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
static uint32_t count_logical_processors(
|
||||
const uint32_t max_group_count,
|
||||
uint32_t* global_proc_index_per_group)
|
||||
{
|
||||
uint32_t nr_of_processors = 0;
|
||||
|
||||
for (uint32_t i = 0; i < max_group_count; i++) {
|
||||
uint32_t nr_of_processors_per_group = GetMaximumProcessorCount((WORD) i);
|
||||
cpuinfo_log_debug("detected %"PRIu32" processor(s) in group %"PRIu32"",
|
||||
nr_of_processors_per_group, i);
|
||||
global_proc_index_per_group[i] = nr_of_processors;
|
||||
nr_of_processors += nr_of_processors_per_group;
|
||||
}
|
||||
return nr_of_processors;
|
||||
}
|
||||
|
||||
static uint32_t read_packages_for_processors(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t number_of_processors,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
const struct woa_chip_info *chip_info)
|
||||
{
|
||||
return read_all_logical_processor_info_of_relation(
|
||||
RelationProcessorPackage,
|
||||
processors,
|
||||
number_of_processors,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
global_proc_index_per_group,
|
||||
chip_info);
|
||||
}
|
||||
|
||||
uint32_t read_cores_for_processors(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t number_of_processors,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
struct cpuinfo_core* cores,
|
||||
const struct woa_chip_info *chip_info)
|
||||
{
|
||||
return read_all_logical_processor_info_of_relation(
|
||||
RelationProcessorCore,
|
||||
processors,
|
||||
number_of_processors,
|
||||
NULL,
|
||||
NULL,
|
||||
cores,
|
||||
global_proc_index_per_group,
|
||||
chip_info);
|
||||
}
|
||||
|
||||
static uint32_t read_caches_for_processors(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t number_of_processors,
|
||||
struct cpuinfo_cache* caches,
|
||||
uint32_t* numbers_of_caches,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
const struct woa_chip_info *chip_info)
|
||||
{
|
||||
/* Reset processor start indexes */
|
||||
if (caches) {
|
||||
uint32_t cache_offset = 0;
|
||||
for (uint32_t i = 0; i < MAX_NR_OF_CACHES; i++) {
|
||||
for (uint32_t j = 0; j < numbers_of_caches[i]; j++) {
|
||||
caches[cache_offset + j].processor_start = UINT32_MAX;
|
||||
}
|
||||
cache_offset += numbers_of_caches[i];
|
||||
}
|
||||
}
|
||||
|
||||
return read_all_logical_processor_info_of_relation(
|
||||
RelationCache,
|
||||
processors,
|
||||
number_of_processors,
|
||||
caches,
|
||||
numbers_of_caches,
|
||||
NULL,
|
||||
global_proc_index_per_group,
|
||||
chip_info);
|
||||
}
|
||||
|
||||
static uint32_t read_all_logical_processor_info_of_relation(
|
||||
LOGICAL_PROCESSOR_RELATIONSHIP info_type,
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t number_of_processors,
|
||||
struct cpuinfo_cache* caches,
|
||||
uint32_t* numbers_of_caches,
|
||||
struct cpuinfo_core* cores,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
const struct woa_chip_info* chip_info)
|
||||
{
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX infos = NULL;
|
||||
uint32_t nr_of_structs = 0;
|
||||
DWORD info_size = 0;
|
||||
bool result = false;
|
||||
HANDLE heap = GetProcessHeap();
|
||||
|
||||
/* 1. Query the size of the information structure first */
|
||||
if (GetLogicalProcessorInformationEx(info_type, NULL, &info_size) == FALSE) {
|
||||
const DWORD last_error = GetLastError();
|
||||
if (last_error != ERROR_INSUFFICIENT_BUFFER) {
|
||||
cpuinfo_log_error(
|
||||
"failed to query size of processor %"PRIu32" information information: error %"PRIu32"",
|
||||
(uint32_t)info_type, (uint32_t) last_error);
|
||||
goto clean_up;
|
||||
}
|
||||
}
|
||||
/* 2. Allocate memory for the information structure */
|
||||
infos = HeapAlloc(heap, 0, info_size);
|
||||
if (infos == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %"PRIu32" bytes for logical processor information",
|
||||
(uint32_t) info_size);
|
||||
goto clean_up;
|
||||
}
|
||||
/* 3. Read the information structure */
|
||||
if (GetLogicalProcessorInformationEx(info_type, infos, &info_size) == FALSE) {
|
||||
cpuinfo_log_error("failed to query processor %"PRIu32" information: error %"PRIu32"",
|
||||
(uint32_t)info_type, (uint32_t) GetLastError());
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
/* 4. Parse the structure and store relevant data */
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info_end =
|
||||
(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) ((uintptr_t) infos + info_size);
|
||||
for (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info = infos;
|
||||
info < info_end;
|
||||
info = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) ((uintptr_t) info + info->Size))
|
||||
{
|
||||
if (info->Relationship != info_type) {
|
||||
cpuinfo_log_warning(
|
||||
"unexpected processor info type (%"PRIu32") for processor information",
|
||||
(uint32_t) info->Relationship);
|
||||
continue;
|
||||
}
|
||||
|
||||
const uint32_t info_id = nr_of_structs++;
|
||||
|
||||
switch(info_type) {
|
||||
case RelationProcessorPackage:
|
||||
result = parse_relation_processor_info(
|
||||
processors,
|
||||
number_of_processors,
|
||||
global_proc_index_per_group,
|
||||
info,
|
||||
info_id,
|
||||
cores,
|
||||
chip_info);
|
||||
break;
|
||||
case RelationProcessorCore:
|
||||
result = parse_relation_processor_info(
|
||||
processors,
|
||||
number_of_processors,
|
||||
global_proc_index_per_group,
|
||||
info,
|
||||
info_id,
|
||||
cores,
|
||||
chip_info);
|
||||
break;
|
||||
case RelationCache:
|
||||
result = parse_relation_cache_info(
|
||||
processors,
|
||||
caches,
|
||||
numbers_of_caches,
|
||||
global_proc_index_per_group,
|
||||
info);
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_error(
|
||||
"unexpected processor info type (%"PRIu32") for processor information",
|
||||
(uint32_t) info->Relationship);
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
if (!result) {
|
||||
nr_of_structs = 0;
|
||||
goto clean_up;
|
||||
}
|
||||
}
|
||||
clean_up:
|
||||
/* 5. Release dynamically allocated info structure. */
|
||||
HeapFree(heap, 0, infos);
|
||||
infos = NULL;
|
||||
return nr_of_structs;
|
||||
}
|
||||
|
||||
static bool parse_relation_processor_info(
|
||||
struct cpuinfo_processor* processors,
|
||||
uint32_t nr_of_processors,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info,
|
||||
const uint32_t info_id,
|
||||
struct cpuinfo_core* cores,
|
||||
const struct woa_chip_info *chip_info)
|
||||
{
|
||||
for (uint32_t i = 0; i < info->Processor.GroupCount; i++) {
|
||||
const uint32_t group_id = info->Processor.GroupMask[i].Group;
|
||||
/* Bitmask representing processors in this group belonging to this package */
|
||||
KAFFINITY group_processors_mask = info->Processor.GroupMask[i].Mask;
|
||||
while (group_processors_mask != 0) {
|
||||
const uint32_t processor_id_in_group =
|
||||
low_index_from_kaffinity(group_processors_mask);
|
||||
const uint32_t processor_global_index =
|
||||
global_proc_index_per_group[group_id] + processor_id_in_group;
|
||||
|
||||
if(processor_global_index >= nr_of_processors) {
|
||||
cpuinfo_log_error("unexpected processor index %"PRIu32"",
|
||||
processor_global_index);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch(info->Relationship) {
|
||||
case RelationProcessorPackage:
|
||||
store_package_info_per_processor(
|
||||
processors, processor_global_index, info_id,
|
||||
group_id, processor_id_in_group);
|
||||
break;
|
||||
case RelationProcessorCore:
|
||||
store_core_info_per_processor(
|
||||
processors, processor_global_index,
|
||||
info_id, info,
|
||||
cores, chip_info);
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_error(
|
||||
"unexpected processor info type (%"PRIu32") for processor information",
|
||||
(uint32_t) info->Relationship);
|
||||
break;
|
||||
}
|
||||
/* Clear the bits in affinity mask, lower the least set bit. */
|
||||
group_processors_mask &= (group_processors_mask - 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool parse_relation_cache_info(
|
||||
struct cpuinfo_processor* processors,
|
||||
struct cpuinfo_cache* caches,
|
||||
uint32_t* numbers_of_caches,
|
||||
const uint32_t* global_proc_index_per_group,
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info)
|
||||
{
|
||||
static uint32_t l1i_counter = 0;
|
||||
static uint32_t l1d_counter = 0;
|
||||
static uint32_t l2_counter = 0;
|
||||
static uint32_t l3_counter = 0;
|
||||
|
||||
/* Count cache types for allocation at first. */
|
||||
if (caches == NULL) {
|
||||
switch(info->Cache.Level) {
|
||||
case 1:
|
||||
switch (info->Cache.Type) {
|
||||
case CacheInstruction:
|
||||
numbers_of_caches[cpuinfo_cache_level_1i]++;
|
||||
break;
|
||||
case CacheData:
|
||||
numbers_of_caches[cpuinfo_cache_level_1d]++;
|
||||
break;
|
||||
case CacheUnified:
|
||||
break;
|
||||
case CacheTrace:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
numbers_of_caches[cpuinfo_cache_level_2]++;
|
||||
break;
|
||||
case 3:
|
||||
numbers_of_caches[cpuinfo_cache_level_3]++;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
struct cpuinfo_cache* l1i_base = caches;
|
||||
struct cpuinfo_cache* l1d_base = l1i_base + numbers_of_caches[cpuinfo_cache_level_1i];
|
||||
struct cpuinfo_cache* l2_base = l1d_base + numbers_of_caches[cpuinfo_cache_level_1d];
|
||||
struct cpuinfo_cache* l3_base = l2_base + numbers_of_caches[cpuinfo_cache_level_2];
|
||||
|
||||
cpuinfo_log_debug(
|
||||
"info->Cache.GroupCount:%"PRIu32", info->Cache.GroupMask:%"PRIu32","
|
||||
"info->Cache.Level:%"PRIu32", info->Cache.Associativity:%"PRIu32","
|
||||
"info->Cache.LineSize:%"PRIu32","
|
||||
"info->Cache.CacheSize:%"PRIu32", info->Cache.Type:%"PRIu32"",
|
||||
info->Cache.GroupCount, (unsigned int)info->Cache.GroupMask.Mask,
|
||||
info->Cache.Level, info->Cache.Associativity, info->Cache.LineSize,
|
||||
info->Cache.CacheSize, info->Cache.Type);
|
||||
|
||||
struct cpuinfo_cache* current_cache = NULL;
|
||||
switch (info->Cache.Level) {
|
||||
case 1:
|
||||
switch (info->Cache.Type) {
|
||||
case CacheInstruction:
|
||||
current_cache = l1i_base + l1i_counter;
|
||||
l1i_counter++;
|
||||
break;
|
||||
case CacheData:
|
||||
current_cache = l1d_base + l1d_counter;
|
||||
l1d_counter++;
|
||||
break;
|
||||
case CacheUnified:
|
||||
break;
|
||||
case CacheTrace:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
current_cache = l2_base + l2_counter;
|
||||
l2_counter++;
|
||||
break;
|
||||
case 3:
|
||||
current_cache = l3_base + l3_counter;
|
||||
l3_counter++;
|
||||
break;
|
||||
}
|
||||
current_cache->size = info->Cache.CacheSize;
|
||||
current_cache->line_size = info->Cache.LineSize;
|
||||
current_cache->associativity = info->Cache.Associativity;
|
||||
/* We don't have partition and set information of caches on Windows,
|
||||
* so we set partitions to 1 and calculate the expected sets.
|
||||
*/
|
||||
current_cache->partitions = 1;
|
||||
current_cache->sets =
|
||||
current_cache->size / current_cache->line_size / current_cache->associativity;
|
||||
if (info->Cache.Type == CacheUnified) {
|
||||
current_cache->flags = CPUINFO_CACHE_UNIFIED;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < info->Cache.GroupCount; i++) {
|
||||
/* Zero GroupCount is valid, GroupMask still can store bits set. */
|
||||
const uint32_t group_id = info->Cache.GroupMasks[i].Group;
|
||||
/* Bitmask representing processors in this group belonging to this package */
|
||||
KAFFINITY group_processors_mask = info->Cache.GroupMasks[i].Mask;
|
||||
while (group_processors_mask != 0) {
|
||||
const uint32_t processor_id_in_group =
|
||||
low_index_from_kaffinity(group_processors_mask);
|
||||
const uint32_t processor_global_index =
|
||||
global_proc_index_per_group[group_id] + processor_id_in_group;
|
||||
|
||||
store_cache_info_per_processor(
|
||||
processors, processor_global_index,
|
||||
info, current_cache);
|
||||
|
||||
/* Clear the bits in affinity mask, lower the least set bit. */
|
||||
group_processors_mask &= (group_processors_mask - 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void store_package_info_per_processor(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t processor_global_index,
|
||||
const uint32_t package_id,
|
||||
const uint32_t group_id,
|
||||
const uint32_t processor_id_in_group)
|
||||
{
|
||||
processors[processor_global_index].windows_group_id =
|
||||
(uint16_t) group_id;
|
||||
processors[processor_global_index].windows_processor_id =
|
||||
(uint16_t) processor_id_in_group;
|
||||
|
||||
/* As we're counting the number of packages now, we haven't allocated memory for
|
||||
* cpuinfo_packages yet, so we only set the package pointer's offset now.
|
||||
*/
|
||||
processors[processor_global_index].package =
|
||||
(const struct cpuinfo_package*) NULL + package_id;
|
||||
}
|
||||
|
||||
void store_core_info_per_processor(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t processor_global_index,
|
||||
const uint32_t core_id,
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX core_info,
|
||||
struct cpuinfo_core* cores,
|
||||
const struct woa_chip_info *chip_info)
|
||||
{
|
||||
if (cores) {
|
||||
processors[processor_global_index].core = cores + core_id;
|
||||
cores[core_id].core_id = core_id;
|
||||
get_core_uarch_for_efficiency(
|
||||
chip_info->chip_name, core_info->Processor.EfficiencyClass,
|
||||
&(cores[core_id].uarch), &(cores[core_id].frequency));
|
||||
|
||||
/* We don't have cluster information, so we handle it as
|
||||
* fixed 1 to (cluster / cores).
|
||||
* Set the cluster offset ID now, as soon as we have the
|
||||
* cluster base address, we'll set the absolute address.
|
||||
*/
|
||||
processors[processor_global_index].cluster =
|
||||
(const struct cpuinfo_cluster*) NULL + core_id;
|
||||
}
|
||||
}
|
||||
|
||||
static void store_cache_info_per_processor(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t processor_global_index,
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info,
|
||||
struct cpuinfo_cache* current_cache)
|
||||
{
|
||||
if (current_cache->processor_start > processor_global_index) {
|
||||
current_cache->processor_start = processor_global_index;
|
||||
}
|
||||
current_cache->processor_count++;
|
||||
|
||||
switch(info->Cache.Level) {
|
||||
case 1:
|
||||
switch (info->Cache.Type) {
|
||||
case CacheInstruction:
|
||||
processors[processor_global_index].cache.l1i = current_cache;
|
||||
break;
|
||||
case CacheData:
|
||||
processors[processor_global_index].cache.l1d = current_cache;
|
||||
break;
|
||||
case CacheUnified:
|
||||
break;
|
||||
case CacheTrace:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
processors[processor_global_index].cache.l2 = current_cache;
|
||||
break;
|
||||
case 3:
|
||||
processors[processor_global_index].cache.l3 = current_cache;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool connect_packages_cores_clusters_by_processors(
|
||||
struct cpuinfo_processor* processors,
|
||||
const uint32_t nr_of_processors,
|
||||
struct cpuinfo_package* packages,
|
||||
const uint32_t nr_of_packages,
|
||||
struct cpuinfo_cluster* clusters,
|
||||
struct cpuinfo_core* cores,
|
||||
const uint32_t nr_of_cores,
|
||||
const struct woa_chip_info* chip_info,
|
||||
enum cpuinfo_vendor vendor)
|
||||
{
|
||||
/* Adjust core and package pointers for all logical processors. */
|
||||
for (uint32_t i = nr_of_processors; i != 0; i--) {
|
||||
const uint32_t processor_id = i - 1;
|
||||
struct cpuinfo_processor* processor = processors + processor_id;
|
||||
|
||||
struct cpuinfo_core* core = (struct cpuinfo_core*)processor->core;
|
||||
|
||||
/* We stored the offset of pointers when we haven't allocated memory
|
||||
* for packages and clusters, so now add offsets to base addresses.
|
||||
*/
|
||||
struct cpuinfo_package* package =
|
||||
(struct cpuinfo_package*) ((uintptr_t) packages + (uintptr_t) processor->package);
|
||||
if (package < packages ||
|
||||
package >= (packages + nr_of_packages)) {
|
||||
cpuinfo_log_error("invalid package indexing");
|
||||
return false;
|
||||
}
|
||||
processor->package = package;
|
||||
|
||||
struct cpuinfo_cluster* cluster =
|
||||
(struct cpuinfo_cluster*) ((uintptr_t) clusters + (uintptr_t) processor->cluster);
|
||||
if (cluster < clusters ||
|
||||
cluster >= (clusters + nr_of_cores)) {
|
||||
cpuinfo_log_error("invalid cluster indexing");
|
||||
return false;
|
||||
}
|
||||
processor->cluster = cluster;
|
||||
|
||||
if (chip_info) {
|
||||
size_t converted_chars = 0;
|
||||
if (!WideCharToMultiByte(
|
||||
CP_UTF8,
|
||||
WC_ERR_INVALID_CHARS,
|
||||
chip_info->chip_name_string,
|
||||
-1,
|
||||
package->name,
|
||||
CPUINFO_PACKAGE_NAME_MAX,
|
||||
NULL,
|
||||
NULL)) {
|
||||
cpuinfo_log_error("cpu name character conversion error");
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
/* Set start indexes and counts per packages / clusters / cores - going backwards */
|
||||
|
||||
/* This can be overwritten by lower-index processors on the same package. */
|
||||
package->processor_start = processor_id;
|
||||
package->processor_count++;
|
||||
|
||||
/* This can be overwritten by lower-index processors on the same cluster. */
|
||||
cluster->processor_start = processor_id;
|
||||
cluster->processor_count++;
|
||||
|
||||
/* This can be overwritten by lower-index processors on the same core. */
|
||||
core->processor_start = processor_id;
|
||||
core->processor_count++;
|
||||
}
|
||||
/* Fill cores */
|
||||
for (uint32_t i = nr_of_cores; i != 0; i--) {
|
||||
const uint32_t global_core_id = i - 1;
|
||||
struct cpuinfo_core* core = cores + global_core_id;
|
||||
const struct cpuinfo_processor* processor = processors + core->processor_start;
|
||||
struct cpuinfo_package* package = (struct cpuinfo_package*) processor->package;
|
||||
struct cpuinfo_cluster* cluster = (struct cpuinfo_cluster*) processor->cluster;
|
||||
|
||||
core->package = package;
|
||||
core->cluster = cluster;
|
||||
core->vendor = vendor;
|
||||
|
||||
/* This can be overwritten by lower-index cores on the same cluster/package. */
|
||||
cluster->core_start = global_core_id;
|
||||
cluster->core_count++;
|
||||
package->core_start = global_core_id;
|
||||
package->core_count++;
|
||||
package->cluster_start = global_core_id;
|
||||
package->cluster_count = package->core_count;
|
||||
|
||||
cluster->package = package;
|
||||
cluster->vendor = cores[cluster->core_start].vendor;
|
||||
cluster->uarch = cores[cluster->core_start].uarch;
|
||||
cluster->frequency = cores[cluster->core_start].frequency;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline uint32_t low_index_from_kaffinity(KAFFINITY kaffinity) {
|
||||
unsigned long index;
|
||||
_BitScanForward64(&index, (unsigned __int64) kaffinity);
|
||||
return (uint32_t) index;
|
||||
}
|
||||
243
3rdparty/cpuinfo/src/arm/windows/init.c
vendored
Normal file
243
3rdparty/cpuinfo/src/arm/windows/init.c
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/internal-api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
#include "windows-arm-init.h"
|
||||
|
||||
struct cpuinfo_arm_isa cpuinfo_isa;
|
||||
|
||||
static void set_cpuinfo_isa_fields(void);
|
||||
static struct woa_chip_info* get_system_info_from_registry(void);
|
||||
|
||||
static struct woa_chip_info woa_chip_unknown = {
|
||||
L"Unknown",
|
||||
woa_chip_name_unknown,
|
||||
{
|
||||
{
|
||||
cpuinfo_vendor_unknown,
|
||||
cpuinfo_uarch_unknown,
|
||||
0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Please add new SoC/chip info here! */
|
||||
static struct woa_chip_info woa_chips[] = {
|
||||
/* Microsoft SQ1 Kryo 495 4 + 4 cores (3 GHz + 1.80 GHz) */
|
||||
{
|
||||
L"Microsoft SQ1",
|
||||
woa_chip_name_microsoft_sq_1,
|
||||
{
|
||||
{
|
||||
cpuinfo_vendor_arm,
|
||||
cpuinfo_uarch_cortex_a55,
|
||||
1800000000,
|
||||
},
|
||||
{
|
||||
cpuinfo_vendor_arm,
|
||||
cpuinfo_uarch_cortex_a76,
|
||||
3000000000,
|
||||
}
|
||||
}
|
||||
},
|
||||
/* Microsoft SQ2 Kryo 495 4 + 4 cores (3.15 GHz + 2.42 GHz) */
|
||||
{
|
||||
L"Microsoft SQ2",
|
||||
woa_chip_name_microsoft_sq_2,
|
||||
{
|
||||
{
|
||||
cpuinfo_vendor_arm,
|
||||
cpuinfo_uarch_cortex_a55,
|
||||
2420000000,
|
||||
},
|
||||
{
|
||||
cpuinfo_vendor_arm,
|
||||
cpuinfo_uarch_cortex_a76,
|
||||
3150000000
|
||||
}
|
||||
}
|
||||
},
|
||||
/* Microsoft Windows Dev Kit 2023 */
|
||||
{
|
||||
L"Snapdragon Compute Platform",
|
||||
woa_chip_name_microsoft_sq_3,
|
||||
{
|
||||
{
|
||||
cpuinfo_vendor_arm,
|
||||
cpuinfo_uarch_cortex_a78,
|
||||
2420000000,
|
||||
},
|
||||
{
|
||||
cpuinfo_vendor_arm,
|
||||
cpuinfo_uarch_cortex_x1,
|
||||
3000000000
|
||||
}
|
||||
}
|
||||
},
|
||||
/* Ampere Altra */
|
||||
{
|
||||
L"Ampere(R) Altra(R) Processor",
|
||||
woa_chip_name_ampere_altra,
|
||||
{
|
||||
{
|
||||
cpuinfo_vendor_arm,
|
||||
cpuinfo_uarch_neoverse_n1,
|
||||
3000000000
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BOOL CALLBACK cpuinfo_arm_windows_init(
|
||||
PINIT_ONCE init_once, PVOID parameter, PVOID* context)
|
||||
{
|
||||
struct woa_chip_info *chip_info = NULL;
|
||||
enum cpuinfo_vendor vendor = cpuinfo_vendor_unknown;
|
||||
|
||||
set_cpuinfo_isa_fields();
|
||||
|
||||
chip_info = get_system_info_from_registry();
|
||||
if (chip_info == NULL) {
|
||||
chip_info = &woa_chip_unknown;
|
||||
}
|
||||
|
||||
cpuinfo_is_initialized = cpu_info_init_by_logical_sys_info(chip_info, chip_info->uarchs[0].vendor);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool get_core_uarch_for_efficiency(
|
||||
enum woa_chip_name chip, BYTE EfficiencyClass,
|
||||
enum cpuinfo_uarch* uarch, uint64_t* frequency)
|
||||
{
|
||||
/* For currently supported WoA chips, the Efficiency class selects
|
||||
* the pre-defined little and big core.
|
||||
* Any further supported SoC's logic should be implemented here.
|
||||
*/
|
||||
if (uarch && frequency && chip < woa_chip_name_last &&
|
||||
EfficiencyClass < MAX_WOA_VALID_EFFICIENCY_CLASSES) {
|
||||
*uarch = woa_chips[chip].uarchs[EfficiencyClass].uarch;
|
||||
*frequency = woa_chips[chip].uarchs[EfficiencyClass].frequency;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Static helper functions */
|
||||
|
||||
static wchar_t* read_registry(
|
||||
LPCWSTR subkey,
|
||||
LPCWSTR value)
|
||||
{
|
||||
DWORD key_type = 0;
|
||||
DWORD data_size = 0;
|
||||
const DWORD flags = RRF_RT_REG_SZ; /* Only read strings (REG_SZ) */
|
||||
wchar_t *text_buffer = NULL;
|
||||
LSTATUS result = 0;
|
||||
HANDLE heap = GetProcessHeap();
|
||||
|
||||
result = RegGetValueW(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
subkey,
|
||||
value,
|
||||
flags,
|
||||
&key_type,
|
||||
NULL, /* Request buffer size */
|
||||
&data_size);
|
||||
if (result != 0 || data_size == 0) {
|
||||
cpuinfo_log_error("Registry entry size read error");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
text_buffer = HeapAlloc(heap, HEAP_ZERO_MEMORY, data_size);
|
||||
if (text_buffer == NULL) {
|
||||
cpuinfo_log_error("Registry textbuffer allocation error");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result = RegGetValueW(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
subkey,
|
||||
value,
|
||||
flags,
|
||||
NULL,
|
||||
text_buffer, /* Write string in this destination buffer */
|
||||
&data_size);
|
||||
if (result != 0) {
|
||||
cpuinfo_log_error("Registry read error");
|
||||
HeapFree(heap, 0, text_buffer);
|
||||
return NULL;
|
||||
}
|
||||
return text_buffer;
|
||||
}
|
||||
|
||||
static struct woa_chip_info* get_system_info_from_registry(void)
|
||||
{
|
||||
wchar_t* text_buffer = NULL;
|
||||
LPCWSTR cpu0_subkey = L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
|
||||
LPCWSTR chip_name_value = L"ProcessorNameString";
|
||||
struct woa_chip_info* chip_info = NULL;
|
||||
|
||||
HANDLE heap = GetProcessHeap();
|
||||
|
||||
/* Read processor model name from registry and find in the hard-coded list. */
|
||||
text_buffer = read_registry(cpu0_subkey, chip_name_value);
|
||||
if (text_buffer == NULL) {
|
||||
cpuinfo_log_error("Registry read error");
|
||||
return NULL;
|
||||
}
|
||||
for (uint32_t i = 0; i < (uint32_t) woa_chip_name_last; i++) {
|
||||
size_t compare_length = wcsnlen(woa_chips[i].chip_name_string, CPUINFO_PACKAGE_NAME_MAX);
|
||||
int compare_result = wcsncmp(text_buffer, woa_chips[i].chip_name_string, compare_length);
|
||||
if (compare_result == 0) {
|
||||
chip_info = woa_chips+i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (chip_info == NULL) {
|
||||
/* No match was found, so print a warning and assign the unknown case. */
|
||||
cpuinfo_log_error("Unknown chip model name '%ls'.\nPlease add new Windows on Arm SoC/chip support to arm/windows/init.c!", text_buffer);
|
||||
} else {
|
||||
cpuinfo_log_debug("detected chip model name: %s", chip_info->chip_name_string);
|
||||
}
|
||||
|
||||
HeapFree(heap, 0, text_buffer);
|
||||
return chip_info;
|
||||
}
|
||||
|
||||
static void set_cpuinfo_isa_fields(void)
|
||||
{
|
||||
cpuinfo_isa.atomics = IsProcessorFeaturePresent(PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE) != 0;
|
||||
|
||||
const bool dotprod = IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) != 0;
|
||||
cpuinfo_isa.dot = dotprod;
|
||||
|
||||
SYSTEM_INFO system_info;
|
||||
GetSystemInfo(&system_info);
|
||||
switch (system_info.wProcessorLevel) {
|
||||
case 0x803: // Kryo 385 Silver (Snapdragon 850)
|
||||
cpuinfo_isa.fp16arith = dotprod;
|
||||
cpuinfo_isa.rdm = dotprod;
|
||||
break;
|
||||
default:
|
||||
// Assume that Dot Product support implies FP16 arithmetics and RDM support.
|
||||
// ARM manuals don't guarantee that, but it holds in practice.
|
||||
cpuinfo_isa.fp16arith = dotprod;
|
||||
cpuinfo_isa.rdm = dotprod;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Windows API reports all or nothing for cryptographic instructions. */
|
||||
const bool crypto = IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) != 0;
|
||||
cpuinfo_isa.aes = crypto;
|
||||
cpuinfo_isa.sha1 = crypto;
|
||||
cpuinfo_isa.sha2 = crypto;
|
||||
cpuinfo_isa.pmull = crypto;
|
||||
|
||||
cpuinfo_isa.crc32 = IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) != 0;
|
||||
}
|
||||
38
3rdparty/cpuinfo/src/arm/windows/windows-arm-init.h
vendored
Normal file
38
3rdparty/cpuinfo/src/arm/windows/windows-arm-init.h
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
/* Efficiency class = 0 means little core, while 1 means big core for now. */
|
||||
#define MAX_WOA_VALID_EFFICIENCY_CLASSES 2
|
||||
|
||||
/* List of known and supported Windows on Arm SoCs/chips. */
|
||||
enum woa_chip_name {
|
||||
woa_chip_name_microsoft_sq_1 = 0,
|
||||
woa_chip_name_microsoft_sq_2 = 1,
|
||||
woa_chip_name_microsoft_sq_3 = 2,
|
||||
woa_chip_name_ampere_altra = 3,
|
||||
woa_chip_name_unknown = 4,
|
||||
woa_chip_name_last = woa_chip_name_unknown
|
||||
};
|
||||
|
||||
/* Topology information hard-coded by SoC/chip name */
|
||||
struct core_info_by_chip_name {
|
||||
enum cpuinfo_vendor vendor;
|
||||
enum cpuinfo_uarch uarch;
|
||||
uint64_t frequency; /* Hz */
|
||||
};
|
||||
|
||||
/* SoC/chip info that's currently not readable by logical system information,
|
||||
* but can be read from registry.
|
||||
*/
|
||||
struct woa_chip_info {
|
||||
wchar_t* chip_name_string;
|
||||
enum woa_chip_name chip_name;
|
||||
struct core_info_by_chip_name uarchs[MAX_WOA_VALID_EFFICIENCY_CLASSES];
|
||||
};
|
||||
|
||||
bool get_core_uarch_for_efficiency(
|
||||
enum woa_chip_name chip, BYTE EfficiencyClass,
|
||||
enum cpuinfo_uarch* uarch, uint64_t* frequency);
|
||||
|
||||
bool cpu_info_init_by_logical_sys_info(
|
||||
const struct woa_chip_info *chip_info,
|
||||
enum cpuinfo_vendor vendor);
|
||||
9
3rdparty/cpuinfo/src/cpuinfo/internal-api.h
vendored
9
3rdparty/cpuinfo/src/cpuinfo/internal-api.h
vendored
@@ -35,7 +35,7 @@ extern CPUINFO_INTERNAL uint32_t cpuinfo_packages_count;
|
||||
extern CPUINFO_INTERNAL uint32_t cpuinfo_cache_count[cpuinfo_cache_level_max];
|
||||
extern CPUINFO_INTERNAL uint32_t cpuinfo_max_cache_size;
|
||||
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
extern CPUINFO_INTERNAL struct cpuinfo_uarch_info* cpuinfo_uarchs;
|
||||
extern CPUINFO_INTERNAL uint32_t cpuinfo_uarchs_count;
|
||||
#else
|
||||
@@ -51,10 +51,15 @@ extern CPUINFO_INTERNAL uint32_t cpuinfo_max_cache_size;
|
||||
CPUINFO_PRIVATE void cpuinfo_x86_mach_init(void);
|
||||
CPUINFO_PRIVATE void cpuinfo_x86_linux_init(void);
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
CPUINFO_PRIVATE BOOL CALLBACK cpuinfo_x86_windows_init(PINIT_ONCE init_once, PVOID parameter, PVOID* context);
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
CPUINFO_PRIVATE BOOL CALLBACK cpuinfo_arm_windows_init(PINIT_ONCE init_once, PVOID parameter, PVOID* context);
|
||||
#else
|
||||
CPUINFO_PRIVATE BOOL CALLBACK cpuinfo_x86_windows_init(PINIT_ONCE init_once, PVOID parameter, PVOID* context);
|
||||
#endif
|
||||
#endif
|
||||
CPUINFO_PRIVATE void cpuinfo_arm_mach_init(void);
|
||||
CPUINFO_PRIVATE void cpuinfo_arm_linux_init(void);
|
||||
CPUINFO_PRIVATE void cpuinfo_riscv_linux_init(void);
|
||||
CPUINFO_PRIVATE void cpuinfo_emscripten_init(void);
|
||||
|
||||
CPUINFO_PRIVATE uint32_t cpuinfo_compute_max_cache_size(const struct cpuinfo_processor* processor);
|
||||
|
||||
106
3rdparty/cpuinfo/src/cpuinfo/log.h
vendored
106
3rdparty/cpuinfo/src/cpuinfo/log.h
vendored
@@ -1,17 +1,103 @@
|
||||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <clog.h>
|
||||
|
||||
#define CPUINFO_LOG_DEBUG_PARSERS 0
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef CPUINFO_LOG_LEVEL
|
||||
#define CPUINFO_LOG_LEVEL CLOG_ERROR
|
||||
#error "Undefined CPUINFO_LOG_LEVEL"
|
||||
#endif
|
||||
|
||||
CLOG_DEFINE_LOG_DEBUG(cpuinfo_log_debug, "cpuinfo", CPUINFO_LOG_LEVEL);
|
||||
CLOG_DEFINE_LOG_INFO(cpuinfo_log_info, "cpuinfo", CPUINFO_LOG_LEVEL);
|
||||
CLOG_DEFINE_LOG_WARNING(cpuinfo_log_warning, "cpuinfo", CPUINFO_LOG_LEVEL);
|
||||
CLOG_DEFINE_LOG_ERROR(cpuinfo_log_error, "cpuinfo", CPUINFO_LOG_LEVEL);
|
||||
CLOG_DEFINE_LOG_FATAL(cpuinfo_log_fatal, "cpuinfo", CPUINFO_LOG_LEVEL);
|
||||
#define CPUINFO_LOG_NONE 0
|
||||
#define CPUINFO_LOG_FATAL 1
|
||||
#define CPUINFO_LOG_ERROR 2
|
||||
#define CPUINFO_LOG_WARNING 3
|
||||
#define CPUINFO_LOG_INFO 4
|
||||
#define CPUINFO_LOG_DEBUG 5
|
||||
|
||||
#ifndef CPUINFO_LOG_DEBUG_PARSERS
|
||||
#define CPUINFO_LOG_DEBUG_PARSERS 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_DEBUG
|
||||
void cpuinfo_vlog_debug(const char* format, va_list args);
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_INFO
|
||||
void cpuinfo_vlog_info(const char* format, va_list args);
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_WARNING
|
||||
void cpuinfo_vlog_warning(const char* format, va_list args);
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_ERROR
|
||||
void cpuinfo_vlog_error(const char* format, va_list args);
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_FATAL
|
||||
void cpuinfo_vlog_fatal(const char* format, va_list args);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#ifndef CPUINFO_LOG_ARGUMENTS_FORMAT
|
||||
#ifdef __GNUC__
|
||||
#define CPUINFO_LOG_ARGUMENTS_FORMAT __attribute__((__format__(__printf__, 1, 2)))
|
||||
#else
|
||||
#define CPUINFO_LOG_ARGUMENTS_FORMAT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CPUINFO_LOG_ARGUMENTS_FORMAT inline static void cpuinfo_log_debug(const char* format, ...) {
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_DEBUG
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
cpuinfo_vlog_debug(format, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
}
|
||||
|
||||
CPUINFO_LOG_ARGUMENTS_FORMAT inline static void cpuinfo_log_info(const char* format, ...) {
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_INFO
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
cpuinfo_vlog_info(format, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
}
|
||||
|
||||
CPUINFO_LOG_ARGUMENTS_FORMAT inline static void cpuinfo_log_warning(const char* format, ...) {
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_WARNING
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
cpuinfo_vlog_warning(format, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
}
|
||||
|
||||
CPUINFO_LOG_ARGUMENTS_FORMAT inline static void cpuinfo_log_error(const char* format, ...) {
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_ERROR
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
cpuinfo_vlog_error(format, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
}
|
||||
|
||||
CPUINFO_LOG_ARGUMENTS_FORMAT inline static void cpuinfo_log_fatal(const char* format, ...) {
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_FATAL
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
cpuinfo_vlog_fatal(format, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
abort();
|
||||
}
|
||||
3
3rdparty/cpuinfo/src/cpuinfo/utils.h
vendored
3
3rdparty/cpuinfo/src/cpuinfo/utils.h
vendored
@@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
8
3rdparty/cpuinfo/src/init.c
vendored
8
3rdparty/cpuinfo/src/init.c
vendored
@@ -37,6 +37,14 @@ bool CPUINFO_ABI cpuinfo_initialize(void) {
|
||||
pthread_once(&init_guard, &cpuinfo_arm_linux_init);
|
||||
#elif defined(__MACH__) && defined(__APPLE__)
|
||||
pthread_once(&init_guard, &cpuinfo_arm_mach_init);
|
||||
#elif defined(_WIN32)
|
||||
InitOnceExecuteOnce(&init_guard, &cpuinfo_arm_windows_init, NULL, NULL);
|
||||
#else
|
||||
cpuinfo_log_error("operating system is not supported in cpuinfo");
|
||||
#endif
|
||||
#elif CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
#if defined(__linux__)
|
||||
pthread_once(&init_guard, &cpuinfo_riscv_linux_init);
|
||||
#else
|
||||
cpuinfo_log_error("operating system is not supported in cpuinfo");
|
||||
#endif
|
||||
|
||||
19
3rdparty/cpuinfo/src/linux/api.h
vendored
19
3rdparty/cpuinfo/src/linux/api.h
vendored
@@ -21,7 +21,8 @@
|
||||
#define CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER UINT32_C(0x00000400)
|
||||
#define CPUINFO_LINUX_FLAG_PROC_CPUINFO UINT32_C(0x00000800)
|
||||
#define CPUINFO_LINUX_FLAG_VALID UINT32_C(0x00001000)
|
||||
|
||||
#define CPUINFO_LINUX_FLAG_CUR_FREQUENCY UINT32_C(0x00002000)
|
||||
#define CPUINFO_LINUX_FLAG_CLUSTER_CLUSTER UINT32_C(0x00004000)
|
||||
|
||||
typedef bool (*cpuinfo_cpulist_callback)(uint32_t, uint32_t, void*);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_parse_cpulist(const char* filename, cpuinfo_cpulist_callback callback, void* context);
|
||||
@@ -33,6 +34,7 @@ CPUINFO_INTERNAL bool cpuinfo_linux_parse_multiline_file(const char* filename, s
|
||||
CPUINFO_INTERNAL uint32_t cpuinfo_linux_get_max_processors_count(void);
|
||||
CPUINFO_INTERNAL uint32_t cpuinfo_linux_get_max_possible_processor(uint32_t max_processors_count);
|
||||
CPUINFO_INTERNAL uint32_t cpuinfo_linux_get_max_present_processor(uint32_t max_processors_count);
|
||||
CPUINFO_INTERNAL uint32_t cpuinfo_linux_get_processor_cur_frequency(uint32_t processor);
|
||||
CPUINFO_INTERNAL uint32_t cpuinfo_linux_get_processor_min_frequency(uint32_t processor);
|
||||
CPUINFO_INTERNAL uint32_t cpuinfo_linux_get_processor_max_frequency(uint32_t processor);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_get_processor_package_id(uint32_t processor, uint32_t package_id[restrict static 1]);
|
||||
@@ -54,6 +56,21 @@ CPUINFO_INTERNAL bool cpuinfo_linux_detect_thread_siblings(
|
||||
uint32_t processor,
|
||||
cpuinfo_siblings_callback callback,
|
||||
void* context);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_detect_cluster_cpus(
|
||||
uint32_t max_processors_count,
|
||||
uint32_t processor,
|
||||
cpuinfo_siblings_callback callback,
|
||||
void* context);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_detect_core_cpus(
|
||||
uint32_t max_processors_count,
|
||||
uint32_t processor,
|
||||
cpuinfo_siblings_callback callback,
|
||||
void* context);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_detect_package_cpus(
|
||||
uint32_t max_processors_count,
|
||||
uint32_t processor,
|
||||
cpuinfo_siblings_callback callback,
|
||||
void* context);
|
||||
|
||||
extern CPUINFO_INTERNAL const struct cpuinfo_processor** cpuinfo_linux_cpu_to_processor_map;
|
||||
extern CPUINFO_INTERNAL const struct cpuinfo_core** cpuinfo_linux_cpu_to_core_map;
|
||||
|
||||
135
3rdparty/cpuinfo/src/linux/processors.c
vendored
135
3rdparty/cpuinfo/src/linux/processors.c
vendored
@@ -21,6 +21,7 @@
|
||||
#define KERNEL_MAX_FILENAME "/sys/devices/system/cpu/kernel_max"
|
||||
#define KERNEL_MAX_FILESIZE 32
|
||||
#define FREQUENCY_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/cpufreq/cpuinfo_max_freq"))
|
||||
#define CUR_FREQUENCY_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/cpufreq/cpuinfo_cur_freq"
|
||||
#define MAX_FREQUENCY_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/cpufreq/cpuinfo_max_freq"
|
||||
#define MIN_FREQUENCY_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/cpufreq/cpuinfo_min_freq"
|
||||
#define FREQUENCY_FILESIZE 32
|
||||
@@ -31,8 +32,14 @@
|
||||
#define CORE_ID_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/core_id"
|
||||
#define CORE_ID_FILESIZE 32
|
||||
|
||||
#define CORE_CPUS_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/core_cpus_list"))
|
||||
#define CORE_CPUS_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/core_cpus_list"
|
||||
#define CORE_SIBLINGS_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/core_siblings_list"))
|
||||
#define CORE_SIBLINGS_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/core_siblings_list"
|
||||
#define CLUSTER_CPUS_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/cluster_cpus_list"))
|
||||
#define CLUSTER_CPUS_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/cluster_cpus_list"
|
||||
#define PACKAGE_CPUS_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/package_cpus_list"))
|
||||
#define PACKAGE_CPUS_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/package_cpus_list"
|
||||
#define THREAD_SIBLINGS_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/thread_siblings_list"))
|
||||
#define THREAD_SIBLINGS_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/thread_siblings_list"
|
||||
|
||||
@@ -125,6 +132,27 @@ uint32_t cpuinfo_linux_get_max_processors_count(void) {
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t cpuinfo_linux_get_processor_cur_frequency(uint32_t processor) {
|
||||
char cur_frequency_filename[FREQUENCY_FILENAME_SIZE];
|
||||
const int chars_formatted = snprintf(
|
||||
cur_frequency_filename, FREQUENCY_FILENAME_SIZE, CUR_FREQUENCY_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int) chars_formatted >= FREQUENCY_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for current frequency of processor %"PRIu32, processor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t cur_frequency;
|
||||
if (cpuinfo_linux_parse_small_file(cur_frequency_filename, FREQUENCY_FILESIZE, uint32_parser, &cur_frequency)) {
|
||||
cpuinfo_log_debug("parsed currrent frequency value of %"PRIu32" KHz for logical processor %"PRIu32" from %s",
|
||||
cur_frequency, processor, cur_frequency_filename);
|
||||
return cur_frequency;
|
||||
} else {
|
||||
cpuinfo_log_warning("failed to parse current frequency for processor %"PRIu32" from %s",
|
||||
processor, cur_frequency_filename);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t cpuinfo_linux_get_processor_max_frequency(uint32_t processor) {
|
||||
char max_frequency_filename[FREQUENCY_FILENAME_SIZE];
|
||||
const int chars_formatted = snprintf(
|
||||
@@ -285,8 +313,7 @@ static bool detect_processor_parser(uint32_t processor_list_start, uint32_t proc
|
||||
}
|
||||
|
||||
bool cpuinfo_linux_detect_possible_processors(uint32_t max_processors_count,
|
||||
uint32_t* processor0_flags, uint32_t processor_struct_size, uint32_t possible_flag)
|
||||
{
|
||||
uint32_t* processor0_flags, uint32_t processor_struct_size, uint32_t possible_flag) {
|
||||
struct detect_processors_context context = {
|
||||
.max_processors_count = max_processors_count,
|
||||
.processor0_flags = processor0_flags,
|
||||
@@ -302,8 +329,7 @@ bool cpuinfo_linux_detect_possible_processors(uint32_t max_processors_count,
|
||||
}
|
||||
|
||||
bool cpuinfo_linux_detect_present_processors(uint32_t max_processors_count,
|
||||
uint32_t* processor0_flags, uint32_t processor_struct_size, uint32_t present_flag)
|
||||
{
|
||||
uint32_t* processor0_flags, uint32_t processor_struct_size, uint32_t present_flag) {
|
||||
struct detect_processors_context context = {
|
||||
.max_processors_count = max_processors_count,
|
||||
.processor0_flags = processor0_flags,
|
||||
@@ -340,12 +366,41 @@ static bool siblings_parser(uint32_t sibling_list_start, uint32_t sibling_list_e
|
||||
return context->callback(processor, sibling_list_start, sibling_list_end, context->callback_context);
|
||||
}
|
||||
|
||||
bool cpuinfo_linux_detect_core_cpus(
|
||||
uint32_t max_processors_count,
|
||||
uint32_t processor,
|
||||
cpuinfo_siblings_callback callback,
|
||||
void* context) {
|
||||
char core_cpus_filename[CORE_CPUS_FILENAME_SIZE];
|
||||
const int chars_formatted = snprintf(
|
||||
core_cpus_filename, CORE_CPUS_FILENAME_SIZE, CORE_CPUS_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int) chars_formatted >= CORE_CPUS_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for core cpus of processor %"PRIu32, processor);
|
||||
return false;
|
||||
}
|
||||
|
||||
struct siblings_context siblings_context = {
|
||||
.group_name = "cpus",
|
||||
.max_processors_count = max_processors_count,
|
||||
.processor = processor,
|
||||
.callback = callback,
|
||||
.callback_context = context,
|
||||
};
|
||||
if (cpuinfo_linux_parse_cpulist(core_cpus_filename,
|
||||
(cpuinfo_cpulist_callback) siblings_parser, &siblings_context)) {
|
||||
return true;
|
||||
} else {
|
||||
cpuinfo_log_info("failed to parse the list of core cpus for processor %"PRIu32" from %s",
|
||||
processor, core_cpus_filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool cpuinfo_linux_detect_core_siblings(
|
||||
uint32_t max_processors_count,
|
||||
uint32_t processor,
|
||||
cpuinfo_siblings_callback callback,
|
||||
void* context)
|
||||
{
|
||||
void* context) {
|
||||
char core_siblings_filename[CORE_SIBLINGS_FILENAME_SIZE];
|
||||
const int chars_formatted = snprintf(
|
||||
core_siblings_filename, CORE_SIBLINGS_FILENAME_SIZE, CORE_SIBLINGS_FILENAME_FORMAT, processor);
|
||||
@@ -362,8 +417,7 @@ bool cpuinfo_linux_detect_core_siblings(
|
||||
.callback_context = context,
|
||||
};
|
||||
if (cpuinfo_linux_parse_cpulist(core_siblings_filename,
|
||||
(cpuinfo_cpulist_callback) siblings_parser, &siblings_context))
|
||||
{
|
||||
(cpuinfo_cpulist_callback) siblings_parser, &siblings_context)) {
|
||||
return true;
|
||||
} else {
|
||||
cpuinfo_log_info("failed to parse the list of core siblings for processor %"PRIu32" from %s",
|
||||
@@ -376,8 +430,7 @@ bool cpuinfo_linux_detect_thread_siblings(
|
||||
uint32_t max_processors_count,
|
||||
uint32_t processor,
|
||||
cpuinfo_siblings_callback callback,
|
||||
void* context)
|
||||
{
|
||||
void* context) {
|
||||
char thread_siblings_filename[THREAD_SIBLINGS_FILENAME_SIZE];
|
||||
const int chars_formatted = snprintf(
|
||||
thread_siblings_filename, THREAD_SIBLINGS_FILENAME_SIZE, THREAD_SIBLINGS_FILENAME_FORMAT, processor);
|
||||
@@ -394,8 +447,7 @@ bool cpuinfo_linux_detect_thread_siblings(
|
||||
.callback_context = context,
|
||||
};
|
||||
if (cpuinfo_linux_parse_cpulist(thread_siblings_filename,
|
||||
(cpuinfo_cpulist_callback) siblings_parser, &siblings_context))
|
||||
{
|
||||
(cpuinfo_cpulist_callback) siblings_parser, &siblings_context)) {
|
||||
return true;
|
||||
} else {
|
||||
cpuinfo_log_info("failed to parse the list of thread siblings for processor %"PRIu32" from %s",
|
||||
@@ -404,3 +456,62 @@ bool cpuinfo_linux_detect_thread_siblings(
|
||||
}
|
||||
}
|
||||
|
||||
bool cpuinfo_linux_detect_cluster_cpus(
|
||||
uint32_t max_processors_count,
|
||||
uint32_t processor,
|
||||
cpuinfo_siblings_callback callback,
|
||||
void* context) {
|
||||
char cluster_cpus_filename[CLUSTER_CPUS_FILENAME_SIZE];
|
||||
const int chars_formatted = snprintf(
|
||||
cluster_cpus_filename, CLUSTER_CPUS_FILENAME_SIZE, CLUSTER_CPUS_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int) chars_formatted >= CLUSTER_CPUS_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for cluster cpus of processor %"PRIu32, processor);
|
||||
return false;
|
||||
}
|
||||
|
||||
struct siblings_context siblings_context = {
|
||||
.group_name = "cluster",
|
||||
.max_processors_count = max_processors_count,
|
||||
.processor = processor,
|
||||
.callback = callback,
|
||||
.callback_context = context,
|
||||
};
|
||||
if (cpuinfo_linux_parse_cpulist(cluster_cpus_filename,
|
||||
(cpuinfo_cpulist_callback) siblings_parser, &siblings_context)) {
|
||||
return true;
|
||||
} else {
|
||||
cpuinfo_log_info("failed to parse the list of cluster cpus for processor %"PRIu32" from %s",
|
||||
processor, cluster_cpus_filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool cpuinfo_linux_detect_package_cpus(
|
||||
uint32_t max_processors_count,
|
||||
uint32_t processor,
|
||||
cpuinfo_siblings_callback callback,
|
||||
void* context) {
|
||||
char package_cpus_filename[PACKAGE_CPUS_FILENAME_SIZE];
|
||||
const int chars_formatted = snprintf(
|
||||
package_cpus_filename, PACKAGE_CPUS_FILENAME_SIZE, PACKAGE_CPUS_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int) chars_formatted >= PACKAGE_CPUS_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for package cpus of processor %"PRIu32, processor);
|
||||
return false;
|
||||
}
|
||||
|
||||
struct siblings_context siblings_context = {
|
||||
.group_name = "package",
|
||||
.max_processors_count = max_processors_count,
|
||||
.processor = processor,
|
||||
.callback = callback,
|
||||
.callback_context = context,
|
||||
};
|
||||
if (cpuinfo_linux_parse_cpulist(package_cpus_filename,
|
||||
(cpuinfo_cpulist_callback) siblings_parser, &siblings_context)) {
|
||||
return true;
|
||||
} else {
|
||||
cpuinfo_log_info("failed to parse the list of package cpus for processor %"PRIu32" from %s",
|
||||
processor, package_cpus_filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
192
3rdparty/cpuinfo/src/log.c
vendored
Normal file
192
3rdparty/cpuinfo/src/log.c
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if defined(__ANDROID__)
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
#if defined(__hexagon__)
|
||||
#include <qurt_printf.h>
|
||||
#endif
|
||||
|
||||
#ifndef CPUINFO_LOG_TO_STDIO
|
||||
#if defined(__ANDROID__)
|
||||
#define CPUINFO_LOG_TO_STDIO 0
|
||||
#else
|
||||
#define CPUINFO_LOG_TO_STDIO 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
|
||||
/* Messages up to this size are formatted entirely on-stack, and don't allocate heap memory */
|
||||
#define CPUINFO_LOG_STACK_BUFFER_SIZE 1024
|
||||
|
||||
#ifdef _WIN32
|
||||
#define CPUINFO_LOG_NEWLINE_LENGTH 2
|
||||
|
||||
#define CPUINFO_LOG_STDERR STD_ERROR_HANDLE
|
||||
#define CPUINFO_LOG_STDOUT STD_OUTPUT_HANDLE
|
||||
#elif defined(__hexagon__)
|
||||
#define CPUINFO_LOG_NEWLINE_LENGTH 1
|
||||
|
||||
#define CPUINFO_LOG_STDERR 0
|
||||
#define CPUINFO_LOG_STDOUT 0
|
||||
#else
|
||||
#define CPUINFO_LOG_NEWLINE_LENGTH 1
|
||||
|
||||
#define CPUINFO_LOG_STDERR STDERR_FILENO
|
||||
#define CPUINFO_LOG_STDOUT STDOUT_FILENO
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_TO_STDIO
|
||||
static void cpuinfo_vlog(int output_handle, const char* prefix, size_t prefix_length, const char* format, va_list args) {
|
||||
char stack_buffer[CPUINFO_LOG_STACK_BUFFER_SIZE];
|
||||
char* heap_buffer = NULL;
|
||||
char* out_buffer = &stack_buffer[0];
|
||||
|
||||
/* The first call to vsnprintf will clobber args, thus need a copy in case a second vsnprintf call is needed */
|
||||
va_list args_copy;
|
||||
va_copy(args_copy, args);
|
||||
|
||||
memcpy(stack_buffer, prefix, prefix_length * sizeof(char));
|
||||
assert((prefix_length + CPUINFO_LOG_NEWLINE_LENGTH) * sizeof(char) <= CPUINFO_LOG_STACK_BUFFER_SIZE);
|
||||
|
||||
const int format_chars = vsnprintf(
|
||||
&stack_buffer[prefix_length],
|
||||
CPUINFO_LOG_STACK_BUFFER_SIZE - (prefix_length + CPUINFO_LOG_NEWLINE_LENGTH) * sizeof(char),
|
||||
format,
|
||||
args);
|
||||
if (format_chars < 0) {
|
||||
/* Format error in the message: silently ignore this particular message. */
|
||||
goto cleanup;
|
||||
}
|
||||
const size_t format_length = (size_t) format_chars;
|
||||
if ((prefix_length + format_length + CPUINFO_LOG_NEWLINE_LENGTH) * sizeof(char) > CPUINFO_LOG_STACK_BUFFER_SIZE) {
|
||||
/* Allocate a buffer on heap, and vsnprintf to this buffer */
|
||||
const size_t heap_buffer_size = (prefix_length + format_length + CPUINFO_LOG_NEWLINE_LENGTH) * sizeof(char);
|
||||
#if _WIN32
|
||||
heap_buffer = HeapAlloc(GetProcessHeap(), 0, heap_buffer_size);
|
||||
#else
|
||||
heap_buffer = malloc(heap_buffer_size);
|
||||
#endif
|
||||
if (heap_buffer == NULL) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Copy pre-formatted prefix into the on-heap buffer */
|
||||
memcpy(heap_buffer, prefix, prefix_length * sizeof(char));
|
||||
vsnprintf(&heap_buffer[prefix_length], (format_length + CPUINFO_LOG_NEWLINE_LENGTH) * sizeof(char), format, args_copy);
|
||||
out_buffer = heap_buffer;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
out_buffer[prefix_length + format_length] = '\r';
|
||||
out_buffer[prefix_length + format_length + 1] = '\n';
|
||||
|
||||
DWORD bytes_written;
|
||||
WriteFile(
|
||||
GetStdHandle((DWORD) output_handle),
|
||||
out_buffer, (prefix_length + format_length + CPUINFO_LOG_NEWLINE_LENGTH) * sizeof(char),
|
||||
&bytes_written, NULL);
|
||||
#elif defined(__hexagon__)
|
||||
qurt_printf("%s", out_buffer);
|
||||
#else
|
||||
out_buffer[prefix_length + format_length] = '\n';
|
||||
|
||||
ssize_t bytes_written = write(output_handle, out_buffer, (prefix_length + format_length + CPUINFO_LOG_NEWLINE_LENGTH) * sizeof(char));
|
||||
(void) bytes_written;
|
||||
#endif
|
||||
|
||||
cleanup:
|
||||
#ifdef _WIN32
|
||||
HeapFree(GetProcessHeap(), 0, heap_buffer);
|
||||
#else
|
||||
free(heap_buffer);
|
||||
#endif
|
||||
va_end(args_copy);
|
||||
}
|
||||
#elif defined(__ANDROID__) && CPUINFO_LOG_LEVEL > CPUINFO_LOG_NONE
|
||||
static const char cpuinfo_module[] = "XNNPACK";
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_DEBUG
|
||||
void cpuinfo_vlog_debug(const char* format, va_list args) {
|
||||
#if CPUINFO_LOG_TO_STDIO
|
||||
static const char debug_prefix[17] = {
|
||||
'D', 'e', 'b', 'u', 'g', ' ', '(', 'c', 'p', 'u', 'i', 'n', 'f', 'o', ')', ':', ' '
|
||||
};
|
||||
cpuinfo_vlog(CPUINFO_LOG_STDOUT, debug_prefix, 17, format, args);
|
||||
#elif defined(__ANDROID__)
|
||||
__android_log_vprint(ANDROID_LOG_DEBUG, cpuinfo_module, format, args);
|
||||
#else
|
||||
#error "Platform-specific implementation required"
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_INFO
|
||||
void cpuinfo_vlog_info(const char* format, va_list args) {
|
||||
#if CPUINFO_LOG_TO_STDIO
|
||||
static const char info_prefix[16] = {
|
||||
'N', 'o', 't', 'e', ' ', '(', 'c', 'p', 'u', 'i', 'n', 'f', 'o', ')', ':', ' '
|
||||
};
|
||||
cpuinfo_vlog(CPUINFO_LOG_STDOUT, info_prefix, 16, format, args);
|
||||
#elif defined(__ANDROID__)
|
||||
__android_log_vprint(ANDROID_LOG_INFO, cpuinfo_module, format, args);
|
||||
#else
|
||||
#error "Platform-specific implementation required"
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_WARNING
|
||||
void cpuinfo_vlog_warning(const char* format, va_list args) {
|
||||
#if CPUINFO_LOG_TO_STDIO
|
||||
static const char warning_prefix[20] = {
|
||||
'W', 'a', 'r', 'n', 'i', 'n', 'g', ' ', 'i', 'n', ' ', 'c', 'p', 'u', 'i', 'n', 'f', 'o', ':', ' '
|
||||
};
|
||||
cpuinfo_vlog(CPUINFO_LOG_STDERR, warning_prefix, 20, format, args);
|
||||
#elif defined(__ANDROID__)
|
||||
__android_log_vprint(ANDROID_LOG_WARN, cpuinfo_module, format, args);
|
||||
#else
|
||||
#error "Platform-specific implementation required"
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_ERROR
|
||||
void cpuinfo_vlog_error(const char* format, va_list args) {
|
||||
#if CPUINFO_LOG_TO_STDIO
|
||||
static const char error_prefix[18] = {
|
||||
'E', 'r', 'r', 'o', 'r', ' ', 'i', 'n', ' ', 'c', 'p', 'u', 'i', 'n', 'f', 'o', ':', ' '
|
||||
};
|
||||
cpuinfo_vlog(CPUINFO_LOG_STDERR, error_prefix, 18, format, args);
|
||||
#elif defined(__ANDROID__)
|
||||
__android_log_vprint(ANDROID_LOG_ERROR, cpuinfo_module, format, args);
|
||||
#else
|
||||
#error "Platform-specific implementation required"
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_FATAL
|
||||
void cpuinfo_vlog_fatal(const char* format, va_list args) {
|
||||
#if CPUINFO_LOG_TO_STDIO
|
||||
static const char fatal_prefix[24] = {
|
||||
'F', 'a', 't', 'a', 'l', ' ', 'e', 'r', 'r', 'o', 'r', ' ', 'i', 'n', ' ', 'c', 'p', 'u', 'i', 'n', 'f', 'o', ':', ' '
|
||||
};
|
||||
cpuinfo_vlog(CPUINFO_LOG_STDERR, fatal_prefix, 24, format, args);
|
||||
#elif defined(__ANDROID__)
|
||||
__android_log_vprint(ANDROID_LOG_FATAL, cpuinfo_module, format, args);
|
||||
#else
|
||||
#error "Platform-specific implementation required"
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
42
3rdparty/cpuinfo/src/riscv/api.h
vendored
Normal file
42
3rdparty/cpuinfo/src/riscv/api.h
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/common.h>
|
||||
|
||||
/* RISC-V Vendor IDs. */
|
||||
enum cpuinfo_riscv_chipset_vendor {
|
||||
cpuinfo_riscv_chipset_vendor_unknown = 0,
|
||||
cpuinfo_riscv_chipset_sifive = 0x489,
|
||||
cpuinfo_riscv_chipset_vendor_max,
|
||||
};
|
||||
|
||||
/* RISC-V Architecture IDs. */
|
||||
enum cpuinfo_riscv_chipset_arch {
|
||||
cpuinfo_riscv_chipset_arch_unknown = 0,
|
||||
cpuinfo_riscv_chipset_arch_max,
|
||||
};
|
||||
|
||||
/* RISC-V Implementation IDs. */
|
||||
enum cpuinfo_riscv_chipset_impl {
|
||||
cpuinfo_riscv_chipset_impl_unknown = 0,
|
||||
cpuinfo_riscv_chipset_impl_max,
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes the vendor and micro-architecture based on the provided input
|
||||
* parameters, regardless of underlying operating system.
|
||||
*
|
||||
* @param[vendor_id]: The 'mvendorid' as described by the RISC-V Manual.
|
||||
* @param[arch_id]: The 'marchid' as described by the RISC-V Manual.
|
||||
* @param[imp_id]: The 'mimplid' as described by the RISC-V Manual.
|
||||
* @param[vendor] - Reference to the cpuinfo_vendor to populate.
|
||||
* @param[uarch] - Reference to the cpuinfo_uarch to populate.
|
||||
*/
|
||||
CPUINFO_INTERNAL void cpuinfo_riscv_decode_vendor_uarch(
|
||||
uint32_t vendor_id,
|
||||
uint32_t arch_id,
|
||||
uint32_t imp_id,
|
||||
enum cpuinfo_vendor vendor[restrict static 1],
|
||||
enum cpuinfo_uarch uarch[restrict static 1]);
|
||||
69
3rdparty/cpuinfo/src/riscv/linux/api.h
vendored
Normal file
69
3rdparty/cpuinfo/src/riscv/linux/api.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/common.h>
|
||||
|
||||
/**
|
||||
* Definition of a RISC-V Linux processor. It is composed of the base processor
|
||||
* definition in "include/cpuinfo.h" and flags specific to RISC-V Linux
|
||||
* implementations.
|
||||
*/
|
||||
struct cpuinfo_riscv_linux_processor {
|
||||
/* Public ABI cpuinfo structures. */
|
||||
struct cpuinfo_processor processor;
|
||||
struct cpuinfo_core core;
|
||||
struct cpuinfo_cluster cluster;
|
||||
struct cpuinfo_package package;
|
||||
|
||||
/**
|
||||
* Linux-specific flags for the logical processor:
|
||||
* - Bit field that can be masked with CPUINFO_LINUX_FLAG_*.
|
||||
*/
|
||||
uint32_t flags;
|
||||
|
||||
/**
|
||||
* Minimum processor ID on the cluster which includes this logical processor.
|
||||
* This value can serve as an ID for the cluster of logical processors: it is the
|
||||
* same for all logical processors on the same package.
|
||||
*/
|
||||
uint32_t cluster_leader_id;
|
||||
|
||||
/**
|
||||
* Minimum processor ID on the core which includes this logical processor.
|
||||
* This value can serve as an ID for the core of logical processors: it
|
||||
* is the same for all logical processors on the same core.
|
||||
*/
|
||||
uint32_t core_leader_id;
|
||||
|
||||
/**
|
||||
* Minimum processor ID on the package which includes this logical processor.
|
||||
* This value can serve as an ID for the package of logical processors: it
|
||||
* is the same for all logical processors on the same package.
|
||||
*/
|
||||
uint32_t package_leader_id;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reads AT_HWCAP from `getauxval` and populates the cpuinfo_riscv_isa
|
||||
* structure.
|
||||
*
|
||||
* @param[isa] - Reference to cpuinfo_riscv_isa structure to populate.
|
||||
*/
|
||||
CPUINFO_INTERNAL void cpuinfo_riscv_linux_decode_isa_from_hwcap(
|
||||
struct cpuinfo_riscv_isa isa[restrict static 1]);
|
||||
|
||||
/**
|
||||
* Reads `sys_riscv_hwprobe` and determines the processor vendor and
|
||||
* micro-architecture.
|
||||
*
|
||||
* @param[processor] - The Linux ID of the target processor.
|
||||
* @param[vendor] - Reference to the cpuinfo_vendor to populate.
|
||||
* @param[uarch] - Reference to the cpuinfo_uarch to populate.
|
||||
*/
|
||||
CPUINFO_INTERNAL void cpuinfo_riscv_linux_decode_vendor_uarch_from_hwprobe(
|
||||
uint32_t processor,
|
||||
enum cpuinfo_vendor vendor[restrict static 1],
|
||||
enum cpuinfo_uarch uarch[restrict static 1]);
|
||||
|
||||
/* Used to determine which uarch is associated with the current thread. */
|
||||
extern CPUINFO_INTERNAL const uint32_t* cpuinfo_linux_cpu_to_uarch_index_map;
|
||||
620
3rdparty/cpuinfo/src/riscv/linux/init.c
vendored
Normal file
620
3rdparty/cpuinfo/src/riscv/linux/init.c
vendored
Normal file
@@ -0,0 +1,620 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <cpuinfo/internal-api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
#include <linux/api.h>
|
||||
#include <riscv/linux/api.h>
|
||||
|
||||
/* ISA structure to hold supported extensions. */
|
||||
struct cpuinfo_riscv_isa cpuinfo_isa;
|
||||
|
||||
/* Helper function to bitmask flags and ensure operator precedence. */
|
||||
static inline bool bitmask_all(uint32_t flags, uint32_t mask) {
|
||||
return (flags & mask) == mask;
|
||||
}
|
||||
|
||||
static int compare_riscv_linux_processors(const void* a, const void* b) {
|
||||
/**
|
||||
* For our purposes, it is only relevant that the list is sorted by
|
||||
* micro-architecture, so the nature of ordering is irrelevant.
|
||||
*/
|
||||
return ((const struct cpuinfo_riscv_linux_processor*)a)->core.uarch
|
||||
- ((const struct cpuinfo_riscv_linux_processor*)b)->core.uarch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the core cpus list for each processor. This function is called once
|
||||
* per-processor, with the IDs of all other processors in the core list.
|
||||
*
|
||||
* The 'processor_[start|count]' are populated in the processor's 'core'
|
||||
* attribute, with 'start' being the smallest ID in the core list.
|
||||
*
|
||||
* The 'core_leader_id' of each processor is set to the smallest ID in it's
|
||||
* cluster CPU list.
|
||||
*
|
||||
* Precondition: The element in the 'processors' list must be initialized with
|
||||
* their 'core_leader_id' to their index in the list.
|
||||
|
||||
* E.g. processors[0].core_leader_id = 0.
|
||||
*/
|
||||
static bool core_cpus_parser(uint32_t processor,
|
||||
uint32_t core_cpus_start,
|
||||
uint32_t core_cpus_end,
|
||||
struct cpuinfo_riscv_linux_processor* processors) {
|
||||
uint32_t processor_start = UINT32_MAX;
|
||||
uint32_t processor_count = 0;
|
||||
|
||||
/* If the processor already has a leader, use it. */
|
||||
if (bitmask_all(processors[processor].flags, CPUINFO_LINUX_FLAG_CORE_CLUSTER)) {
|
||||
processor_start = processors[processor].core_leader_id;
|
||||
}
|
||||
|
||||
for (size_t core_cpu = core_cpus_start; core_cpu < core_cpus_end; core_cpu++) {
|
||||
if (!bitmask_all(processors[core_cpu].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* The first valid processor observed is the smallest ID in the
|
||||
* list that attaches to this core.
|
||||
*/
|
||||
if (processor_start == UINT32_MAX) {
|
||||
processor_start = core_cpu;
|
||||
}
|
||||
processors[core_cpu].core_leader_id = processor_start;
|
||||
processor_count++;
|
||||
}
|
||||
/**
|
||||
* If the cluster flag has not been set, assign the processor start. If
|
||||
* it has been set, only apply the processor start if it's less than the
|
||||
* held value. This can happen if the callback is invoked twice:
|
||||
*
|
||||
* e.g. core_cpu_list=1,10-12
|
||||
*/
|
||||
if (!bitmask_all(processors[processor].flags, CPUINFO_LINUX_FLAG_CORE_CLUSTER)
|
||||
|| processors[processor].core.processor_start > processor_start) {
|
||||
processors[processor].core.processor_start = processor_start;
|
||||
processors[processor].core_leader_id = processor_start;
|
||||
}
|
||||
processors[processor].core.processor_count += processor_count;
|
||||
processors[processor].flags |= CPUINFO_LINUX_FLAG_CORE_CLUSTER;
|
||||
/* The parser has failed only if no processors were found. */
|
||||
return processor_count != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the cluster cpu list for each processor. This function is called once
|
||||
* per-processor, with the IDs of all other processors in the cluster.
|
||||
*
|
||||
* The 'cluster_leader_id' of each processor is set to the smallest ID in it's
|
||||
* cluster CPU list.
|
||||
*
|
||||
* Precondition: The element in the 'processors' list must be initialized with
|
||||
* their 'cluster_leader_id' to their index in the list.
|
||||
* E.g. processors[0].cluster_leader_id = 0.
|
||||
*/
|
||||
static bool cluster_cpus_parser(uint32_t processor,
|
||||
uint32_t cluster_cpus_start,
|
||||
uint32_t cluster_cpus_end,
|
||||
struct cpuinfo_riscv_linux_processor* processors) {
|
||||
uint32_t processor_start = UINT32_MAX;
|
||||
uint32_t processor_count = 0;
|
||||
uint32_t core_count = 0;
|
||||
|
||||
/* If the processor already has a leader, use it. */
|
||||
if (bitmask_all(processors[processor].flags, CPUINFO_LINUX_FLAG_CLUSTER_CLUSTER)) {
|
||||
processor_start = processors[processor].cluster_leader_id;
|
||||
}
|
||||
|
||||
for (size_t cluster_cpu = cluster_cpus_start; cluster_cpu < cluster_cpus_end; cluster_cpu++) {
|
||||
if (!bitmask_all(processors[cluster_cpu].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* The first valid processor observed is the smallest ID in the
|
||||
* list that attaches to this core.
|
||||
*/
|
||||
if (processor_start == UINT32_MAX) {
|
||||
processor_start = cluster_cpu;
|
||||
}
|
||||
processors[cluster_cpu].cluster_leader_id = processor_start;
|
||||
processor_count++;
|
||||
/**
|
||||
* A processor should only represent it's core if it is the
|
||||
* assigned leader of that core.
|
||||
*/
|
||||
if (processors[cluster_cpu].core_leader_id == cluster_cpu) {
|
||||
core_count++;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* If the cluster flag has not been set, assign the processor start. If
|
||||
* it has been set, only apply the processor start if it's less than the
|
||||
* held value. This can happen if the callback is invoked twice:
|
||||
*
|
||||
* e.g. cluster_cpus_list=1,10-12
|
||||
*/
|
||||
if (!bitmask_all(processors[processor].flags, CPUINFO_LINUX_FLAG_CLUSTER_CLUSTER)
|
||||
|| processors[processor].cluster.processor_start > processor_start) {
|
||||
processors[processor].cluster.processor_start = processor_start;
|
||||
processors[processor].cluster.core_start = processor_start;
|
||||
processors[processor].cluster.cluster_id = processor_start;
|
||||
processors[processor].cluster_leader_id = processor_start;
|
||||
}
|
||||
processors[processor].cluster.processor_count += processor_count;
|
||||
processors[processor].cluster.core_count += core_count;
|
||||
processors[processor].flags |= CPUINFO_LINUX_FLAG_CLUSTER_CLUSTER;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the package cpus list for each processor. This function is called once
|
||||
* per-processor, with the IDs of all other processors in the package list.
|
||||
*
|
||||
* The 'processor_[start|count]' are populated in the processor's 'package'
|
||||
* attribute, with 'start' being the smallest ID in the package list.
|
||||
*
|
||||
* The 'package_leader_id' of each processor is set to the smallest ID in it's
|
||||
* cluster CPU list.
|
||||
*
|
||||
* Precondition: The element in the 'processors' list must be initialized with
|
||||
* their 'package_leader_id' to their index in the list.
|
||||
* E.g. processors[0].package_leader_id = 0.
|
||||
*/
|
||||
static bool package_cpus_parser(uint32_t processor,
|
||||
uint32_t package_cpus_start,
|
||||
uint32_t package_cpus_end,
|
||||
struct cpuinfo_riscv_linux_processor* processors) {
|
||||
uint32_t processor_start = UINT32_MAX;
|
||||
uint32_t processor_count = 0;
|
||||
uint32_t cluster_count = 0;
|
||||
uint32_t core_count = 0;
|
||||
|
||||
/* If the processor already has a leader, use it. */
|
||||
if (bitmask_all(processors[processor].flags, CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER)) {
|
||||
processor_start = processors[processor].package_leader_id;
|
||||
}
|
||||
|
||||
for (size_t package_cpu = package_cpus_start; package_cpu < package_cpus_end; package_cpu++) {
|
||||
if (!bitmask_all(processors[package_cpu].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* The first valid processor observed is the smallest ID in the
|
||||
* list that attaches to this package.
|
||||
*/
|
||||
if (processor_start == UINT32_MAX) {
|
||||
processor_start = package_cpu;
|
||||
}
|
||||
processors[package_cpu].package_leader_id = processor_start;
|
||||
processor_count++;
|
||||
/**
|
||||
* A processor should only represent it's core if it is the
|
||||
* assigned leader of that core, and similarly for it's cluster.
|
||||
*/
|
||||
if (processors[package_cpu].cluster_leader_id == package_cpu) {
|
||||
cluster_count++;
|
||||
}
|
||||
if (processors[package_cpu].core_leader_id == package_cpu) {
|
||||
core_count++;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* If the cluster flag has not been set, assign the processor start. If
|
||||
* it has been set, only apply the processor start if it's less than the
|
||||
* held value. This can happen if the callback is invoked twice:
|
||||
*
|
||||
* e.g. package_cpus_list=1,10-12
|
||||
*/
|
||||
if (!bitmask_all(processors[processor].flags, CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER)
|
||||
|| processors[processor].package.processor_start > processor_start) {
|
||||
processors[processor].package.processor_start = processor_start;
|
||||
processors[processor].package.cluster_start = processor_start;
|
||||
processors[processor].package.core_start = processor_start;
|
||||
processors[processor].package_leader_id = processor_start;
|
||||
}
|
||||
processors[processor].package.processor_count += processor_count;
|
||||
processors[processor].package.cluster_count += cluster_count;
|
||||
processors[processor].package.core_count += core_count;
|
||||
processors[processor].flags |= CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Initialization for the RISC-V Linux system. */
|
||||
void cpuinfo_riscv_linux_init(void) {
|
||||
struct cpuinfo_riscv_linux_processor* riscv_linux_processors = NULL;
|
||||
struct cpuinfo_processor* processors = NULL;
|
||||
struct cpuinfo_package* packages = NULL;
|
||||
struct cpuinfo_cluster* clusters = NULL;
|
||||
struct cpuinfo_core* cores = NULL;
|
||||
struct cpuinfo_uarch_info* uarchs = NULL;
|
||||
const struct cpuinfo_processor** linux_cpu_to_processor_map = NULL;
|
||||
const struct cpuinfo_core** linux_cpu_to_core_map = NULL;
|
||||
uint32_t* linux_cpu_to_uarch_index_map = NULL;
|
||||
|
||||
/**
|
||||
* The interesting set of processors are the number of 'present'
|
||||
* processors on the system. There may be more 'possible' processors, but
|
||||
* processor information cannot be gathered on non-present processors.
|
||||
*
|
||||
* Note: For SoCs, it is largely the case that all processors are known
|
||||
* at boot and no processors are hotplugged at runtime, so the
|
||||
* 'present' and 'possible' list is often the same.
|
||||
*
|
||||
* Note: This computes the maximum processor ID of the 'present'
|
||||
* processors. It is not a count of the number of processors on the
|
||||
* system.
|
||||
*/
|
||||
const uint32_t max_processor_id = 1 +
|
||||
cpuinfo_linux_get_max_present_processor(
|
||||
cpuinfo_linux_get_max_processors_count());
|
||||
if (max_processor_id == 0) {
|
||||
cpuinfo_log_error("failed to discover any processors");
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate space to store all processor information. This array is
|
||||
* sized to the max processor ID as opposed to the number of 'present'
|
||||
* processors, to leverage pointer math in the common utility functions.
|
||||
*/
|
||||
riscv_linux_processors = calloc(max_processor_id,
|
||||
sizeof(struct cpuinfo_riscv_linux_processor));
|
||||
if (riscv_linux_processors == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %"PRIu32" processors.",
|
||||
max_processor_id * sizeof(struct cpuinfo_riscv_linux_processor),
|
||||
max_processor_id);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to detect all processors and apply the corresponding flag to
|
||||
* each processor struct that we find.
|
||||
*/
|
||||
if (!cpuinfo_linux_detect_present_processors(max_processor_id,
|
||||
&riscv_linux_processors->flags,
|
||||
sizeof(struct cpuinfo_riscv_linux_processor),
|
||||
CPUINFO_LINUX_FLAG_PRESENT | CPUINFO_LINUX_FLAG_VALID)) {
|
||||
cpuinfo_log_error("failed to detect present processors");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Populate processor information. */
|
||||
for (size_t processor = 0; processor < max_processor_id; processor++) {
|
||||
if (!bitmask_all(riscv_linux_processors[processor].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
continue;
|
||||
}
|
||||
/* TODO: Determine if an 'smt_id' is available. */
|
||||
riscv_linux_processors[processor].processor.linux_id = processor;
|
||||
}
|
||||
|
||||
/* Populate core information. */
|
||||
for (size_t processor = 0; processor < max_processor_id; processor++) {
|
||||
if (!bitmask_all(riscv_linux_processors[processor].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Populate processor start and count information. */
|
||||
if (!cpuinfo_linux_detect_core_cpus(
|
||||
max_processor_id,
|
||||
processor,
|
||||
(cpuinfo_siblings_callback) core_cpus_parser,
|
||||
riscv_linux_processors)) {
|
||||
cpuinfo_log_error("failed to detect core cpus for processor %zu.", processor);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Populate core ID information. */
|
||||
if (cpuinfo_linux_get_processor_core_id(
|
||||
processor,
|
||||
&riscv_linux_processors[processor].core.core_id)) {
|
||||
riscv_linux_processors[processor].flags |= CPUINFO_LINUX_FLAG_CORE_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the vendor and uarch of this core from this
|
||||
* processor. When the final 'cores' list is constructed, only
|
||||
* the values from the core leader will be honored.
|
||||
*/
|
||||
cpuinfo_riscv_linux_decode_vendor_uarch_from_hwprobe(
|
||||
processor,
|
||||
&riscv_linux_processors[processor].core.vendor,
|
||||
&riscv_linux_processors[processor].core.uarch);
|
||||
|
||||
/* Populate frequency information of this core. */
|
||||
uint32_t frequency = cpuinfo_linux_get_processor_cur_frequency(processor);
|
||||
if (frequency != 0) {
|
||||
riscv_linux_processors[processor].core.frequency = frequency;
|
||||
riscv_linux_processors[processor].flags |= CPUINFO_LINUX_FLAG_CUR_FREQUENCY;
|
||||
}
|
||||
}
|
||||
|
||||
/* Populate cluster information. */
|
||||
for (size_t processor = 0; processor < max_processor_id; processor++) {
|
||||
if (!bitmask_all(riscv_linux_processors[processor].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
continue;
|
||||
}
|
||||
if (!cpuinfo_linux_detect_cluster_cpus(
|
||||
max_processor_id,
|
||||
processor,
|
||||
(cpuinfo_siblings_callback) cluster_cpus_parser,
|
||||
riscv_linux_processors)) {
|
||||
cpuinfo_log_warning("failed to detect cluster cpus for processor %zu.", processor);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the vendor, uarch and frequency of this cluster from
|
||||
* this logical processor. When the 'clusters' list is constructed,
|
||||
* only the values from the cluster leader will be honored.
|
||||
*/
|
||||
riscv_linux_processors[processor].cluster.vendor =
|
||||
riscv_linux_processors[processor].core.vendor;
|
||||
riscv_linux_processors[processor].cluster.uarch =
|
||||
riscv_linux_processors[processor].core.uarch;
|
||||
riscv_linux_processors[processor].cluster.frequency =
|
||||
riscv_linux_processors[processor].core.frequency;
|
||||
}
|
||||
|
||||
/* Populate package information. */
|
||||
for (size_t processor = 0; processor < max_processor_id; processor++) {
|
||||
if (!bitmask_all(riscv_linux_processors[processor].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
continue;
|
||||
}
|
||||
if (!cpuinfo_linux_detect_package_cpus(
|
||||
max_processor_id,
|
||||
processor,
|
||||
(cpuinfo_siblings_callback) package_cpus_parser,
|
||||
riscv_linux_processors)) {
|
||||
cpuinfo_log_warning("failed to detect package cpus for processor %zu.", processor);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
/* Populate ISA structure with hwcap information. */
|
||||
cpuinfo_riscv_linux_decode_isa_from_hwcap(&cpuinfo_isa);
|
||||
|
||||
/**
|
||||
* To efficiently compute the number of unique micro-architectures
|
||||
* present on the system, sort the processor list by micro-architecture
|
||||
* and then scan through the list to count the differences.
|
||||
*
|
||||
* Ensure this is done at the end of composing the processor list - the
|
||||
* parsing functions assume that the position of the processor in the
|
||||
* list matches it's Linux ID, which this sorting operation breaks.
|
||||
*/
|
||||
qsort(riscv_linux_processors,
|
||||
max_processor_id,
|
||||
sizeof(struct cpuinfo_riscv_linux_processor),
|
||||
compare_riscv_linux_processors);
|
||||
|
||||
/**
|
||||
* Determine the number of *valid* detected processors, cores,
|
||||
* clusters, packages and uarchs in the list.
|
||||
*/
|
||||
size_t valid_processors_count = 0;
|
||||
size_t valid_cores_count = 0;
|
||||
size_t valid_clusters_count = 0;
|
||||
size_t valid_packages_count = 0;
|
||||
size_t valid_uarchs_count = 0;
|
||||
enum cpuinfo_uarch last_uarch = cpuinfo_uarch_unknown;
|
||||
for (size_t processor = 0; processor < max_processor_id; processor++) {
|
||||
if (!bitmask_all(riscv_linux_processors[processor].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* All comparisons to the leader id values MUST be done against
|
||||
* the 'linux_id' as opposed to 'processor'. The sort function
|
||||
* above no longer allows us to make the assumption that these
|
||||
* two values are the same.
|
||||
*/
|
||||
uint32_t linux_id = riscv_linux_processors[processor].processor.linux_id;
|
||||
|
||||
valid_processors_count++;
|
||||
if (riscv_linux_processors[processor].core_leader_id == linux_id) {
|
||||
valid_cores_count++;
|
||||
}
|
||||
if (riscv_linux_processors[processor].cluster_leader_id == linux_id) {
|
||||
valid_clusters_count++;
|
||||
}
|
||||
if (riscv_linux_processors[processor].package_leader_id == linux_id) {
|
||||
valid_packages_count++;
|
||||
}
|
||||
/**
|
||||
* As we've sorted by micro-architecture, when the uarch differs
|
||||
* between two entries, a unique uarch has been observed.
|
||||
*/
|
||||
if (last_uarch != riscv_linux_processors[processor].core.uarch
|
||||
|| valid_uarchs_count == 0) {
|
||||
valid_uarchs_count++;
|
||||
last_uarch = riscv_linux_processors[processor].core.uarch;
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate and populate final public ABI structures. */
|
||||
processors = calloc(valid_processors_count,
|
||||
sizeof(struct cpuinfo_processor));
|
||||
if (processors == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %zu processors.",
|
||||
valid_processors_count * sizeof(struct cpuinfo_processor),
|
||||
valid_processors_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cores = calloc(valid_cores_count,
|
||||
sizeof(struct cpuinfo_core));
|
||||
if (cores == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %zu cores.",
|
||||
valid_cores_count * sizeof(struct cpuinfo_core),
|
||||
valid_cores_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
clusters = calloc(valid_clusters_count,
|
||||
sizeof(struct cpuinfo_cluster));
|
||||
if (clusters == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %zu clusters.",
|
||||
valid_clusters_count * sizeof(struct cpuinfo_cluster),
|
||||
valid_clusters_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
packages = calloc(valid_packages_count,
|
||||
sizeof(struct cpuinfo_package));
|
||||
if (packages == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %zu packages.",
|
||||
valid_packages_count * sizeof(struct cpuinfo_package),
|
||||
valid_packages_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
uarchs = calloc(valid_uarchs_count, sizeof(struct cpuinfo_uarch_info));
|
||||
if (uarchs == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %zu packages.",
|
||||
valid_uarchs_count * sizeof(struct cpuinfo_uarch_info),
|
||||
valid_uarchs_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
linux_cpu_to_processor_map = calloc(max_processor_id,
|
||||
sizeof(struct cpuinfo_processor*));
|
||||
if (linux_cpu_to_processor_map == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %"PRIu32" processor map.",
|
||||
max_processor_id * sizeof(struct cpuinfo_processor*),
|
||||
max_processor_id);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
linux_cpu_to_core_map = calloc(max_processor_id,
|
||||
sizeof(struct cpuinfo_core*));
|
||||
if (linux_cpu_to_core_map == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %"PRIu32" core map.",
|
||||
max_processor_id * sizeof(struct cpuinfo_core*),
|
||||
max_processor_id);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
linux_cpu_to_uarch_index_map = calloc(max_processor_id,
|
||||
sizeof(struct cpuinfo_uarch_info*));
|
||||
if (linux_cpu_to_uarch_index_map == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %"PRIu32" uarch map.",
|
||||
max_processor_id * sizeof(struct cpuinfo_uarch_info*),
|
||||
max_processor_id);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Transfer contents of processor list to ABI structures. */
|
||||
size_t valid_processors_index = 0;
|
||||
size_t valid_cores_index = 0;
|
||||
size_t valid_clusters_index = 0;
|
||||
size_t valid_packages_index = 0;
|
||||
size_t valid_uarchs_index = 0;
|
||||
last_uarch = cpuinfo_uarch_unknown;
|
||||
for (size_t processor = 0; processor < max_processor_id; processor++) {
|
||||
if (!bitmask_all(riscv_linux_processors[processor].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* All comparisons to the leader id values MUST be done against
|
||||
* the 'linux_id' as opposed to 'processor'. The sort function
|
||||
* above no longer allows us to make the assumption that these
|
||||
* two values are the same.
|
||||
*/
|
||||
uint32_t linux_id = riscv_linux_processors[processor].processor.linux_id;
|
||||
|
||||
/* Create uarch entry if this uarch has not been seen before. */
|
||||
if (last_uarch != riscv_linux_processors[processor].core.uarch
|
||||
|| valid_uarchs_index == 0) {
|
||||
uarchs[valid_uarchs_index++].uarch =
|
||||
riscv_linux_processors[processor].core.uarch;
|
||||
last_uarch = riscv_linux_processors[processor].core.uarch;
|
||||
}
|
||||
|
||||
/* Copy cpuinfo_processor information. */
|
||||
memcpy(&processors[valid_processors_index++],
|
||||
&riscv_linux_processors[processor].processor,
|
||||
sizeof(struct cpuinfo_processor));
|
||||
|
||||
/* Update uarch processor count. */
|
||||
uarchs[valid_uarchs_index - 1].processor_count++;
|
||||
|
||||
/* Copy cpuinfo_core information, if this is the leader. */
|
||||
if (riscv_linux_processors[processor].core_leader_id == linux_id) {
|
||||
memcpy(&cores[valid_cores_index++],
|
||||
&riscv_linux_processors[processor].core,
|
||||
sizeof(struct cpuinfo_core));
|
||||
/* Update uarch core count. */
|
||||
uarchs[valid_uarchs_index - 1].core_count++;
|
||||
}
|
||||
|
||||
/* Copy cpuinfo_cluster information, if this is the leader. */
|
||||
if (riscv_linux_processors[processor].cluster_leader_id == linux_id) {
|
||||
memcpy(&clusters[valid_clusters_index++],
|
||||
&riscv_linux_processors[processor].cluster,
|
||||
sizeof(struct cpuinfo_cluster));
|
||||
}
|
||||
|
||||
/* Copy cpuinfo_package information, if this is the leader. */
|
||||
if (riscv_linux_processors[processor].package_leader_id == linux_id) {
|
||||
memcpy(&packages[valid_packages_index++],
|
||||
&riscv_linux_processors[processor].package,
|
||||
sizeof(struct cpuinfo_package));
|
||||
}
|
||||
|
||||
/* Commit pointers on the final structures. */
|
||||
processors[valid_processors_index - 1].core = &cores[valid_cores_index - 1];
|
||||
processors[valid_processors_index - 1].cluster = &clusters[valid_clusters_index - 1];
|
||||
processors[valid_processors_index - 1].package = &packages[valid_packages_index - 1];
|
||||
|
||||
cores[valid_cores_index - 1].cluster = &clusters[valid_clusters_index - 1];
|
||||
cores[valid_cores_index - 1].package = &packages[valid_packages_index - 1];
|
||||
|
||||
clusters[valid_clusters_index - 1].package = &packages[valid_packages_index - 1];
|
||||
|
||||
linux_cpu_to_processor_map[linux_id] = &processors[valid_processors_index - 1];
|
||||
linux_cpu_to_core_map[linux_id] = &cores[valid_cores_index - 1];
|
||||
linux_cpu_to_uarch_index_map[linux_id] = valid_uarchs_index - 1;
|
||||
}
|
||||
|
||||
/* Commit */
|
||||
cpuinfo_processors = processors;
|
||||
cpuinfo_processors_count = valid_processors_count;
|
||||
cpuinfo_cores = cores;
|
||||
cpuinfo_cores_count = valid_cores_count;
|
||||
cpuinfo_clusters = clusters;
|
||||
cpuinfo_clusters_count = valid_clusters_count;
|
||||
cpuinfo_packages = packages;
|
||||
cpuinfo_packages_count = valid_packages_count;
|
||||
cpuinfo_uarchs = uarchs;
|
||||
cpuinfo_uarchs_count = valid_uarchs_count;
|
||||
|
||||
cpuinfo_linux_cpu_max = max_processor_id;
|
||||
cpuinfo_linux_cpu_to_processor_map = linux_cpu_to_processor_map;
|
||||
cpuinfo_linux_cpu_to_core_map = linux_cpu_to_core_map;
|
||||
cpuinfo_linux_cpu_to_uarch_index_map = linux_cpu_to_uarch_index_map;
|
||||
|
||||
__sync_synchronize();
|
||||
|
||||
cpuinfo_is_initialized = true;
|
||||
|
||||
/* Mark all public structures NULL to prevent cleanup from erasing them. */
|
||||
processors = NULL;
|
||||
cores = NULL;
|
||||
clusters = NULL;
|
||||
packages = NULL;
|
||||
uarchs = NULL;
|
||||
linux_cpu_to_processor_map = NULL;
|
||||
linux_cpu_to_core_map = NULL;
|
||||
linux_cpu_to_uarch_index_map = NULL;
|
||||
cleanup:
|
||||
free(riscv_linux_processors);
|
||||
free(processors);
|
||||
free(cores);
|
||||
free(clusters);
|
||||
free(packages);
|
||||
free(uarchs);
|
||||
free(linux_cpu_to_processor_map);
|
||||
free(linux_cpu_to_core_map);
|
||||
free(linux_cpu_to_uarch_index_map);
|
||||
}
|
||||
62
3rdparty/cpuinfo/src/riscv/linux/riscv-hw.c
vendored
Normal file
62
3rdparty/cpuinfo/src/riscv/linux/riscv-hw.c
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
#include <sys/hwprobe.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include <cpuinfo/log.h>
|
||||
#include <riscv/api.h>
|
||||
#include <riscv/linux/api.h>
|
||||
|
||||
void cpuinfo_riscv_linux_decode_vendor_uarch_from_hwprobe(
|
||||
uint32_t processor,
|
||||
enum cpuinfo_vendor vendor[restrict static 1],
|
||||
enum cpuinfo_uarch uarch[restrict static 1]) {
|
||||
struct riscv_hwprobe pairs[] = {
|
||||
{ .key = RISCV_HWPROBE_KEY_MVENDORID, },
|
||||
{ .key = RISCV_HWPROBE_KEY_MARCHID, },
|
||||
{ .key = RISCV_HWPROBE_KEY_MIMPID, },
|
||||
};
|
||||
const size_t pairs_count = sizeof(pairs) / sizeof(struct riscv_hwprobe);
|
||||
|
||||
/* In case of failure, report unknown. */
|
||||
*vendor = cpuinfo_vendor_unknown;
|
||||
*uarch = cpuinfo_uarch_unknown;
|
||||
|
||||
/* Create a CPU set with this processor flagged. */
|
||||
const size_t cpu_set_size = processor + 1;
|
||||
cpu_set_t* cpu_set = CPU_ALLOC(cpu_set_size);
|
||||
CPU_SET(processor, cpu_set);
|
||||
|
||||
/* Request all available information from hwprobe. */
|
||||
int ret = __riscv_hwprobe(pairs, pairs_count,
|
||||
cpu_set_size, (unsigned long*)cpu_set,
|
||||
0 /* flags */);
|
||||
if (ret < 0) {
|
||||
cpuinfo_log_warning("failed to get hwprobe information, err: %d", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* The syscall may not have populated all requested keys, loop through
|
||||
* the list and store the values that were discovered.
|
||||
*/
|
||||
uint32_t vendor_id = 0;
|
||||
uint32_t arch_id = 0;
|
||||
uint32_t imp_id = 0;
|
||||
for (size_t pair = 0; pair < pairs_count; pair++) {
|
||||
switch (pairs[pair].key) {
|
||||
case RISCV_HWPROBE_KEY_MVENDORID:
|
||||
vendor_id = pairs[pair].value;
|
||||
break;
|
||||
case RISCV_HWPROBE_KEY_MARCHID:
|
||||
arch_id = pairs[pair].value;
|
||||
break;
|
||||
case RISCV_HWPROBE_KEY_MIMPID:
|
||||
imp_id = pairs[pair].value;
|
||||
break;
|
||||
default:
|
||||
/* The key value may be -1 if unsupported. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
cpuinfo_riscv_decode_vendor_uarch(vendor_id, arch_id, imp_id,
|
||||
vendor, uarch);
|
||||
}
|
||||
44
3rdparty/cpuinfo/src/riscv/linux/riscv-isa.c
vendored
Normal file
44
3rdparty/cpuinfo/src/riscv/linux/riscv-isa.c
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
#include <string.h>
|
||||
#include <sys/auxv.h>
|
||||
|
||||
#include <riscv/linux/api.h>
|
||||
|
||||
/**
|
||||
* arch/riscv/include/uapi/asm/hwcap.h
|
||||
*
|
||||
* This must be kept in sync with the upstream kernel header.
|
||||
*/
|
||||
#define COMPAT_HWCAP_ISA_I (1 << ('I' - 'A'))
|
||||
#define COMPAT_HWCAP_ISA_M (1 << ('M' - 'A'))
|
||||
#define COMPAT_HWCAP_ISA_A (1 << ('A' - 'A'))
|
||||
#define COMPAT_HWCAP_ISA_F (1 << ('F' - 'A'))
|
||||
#define COMPAT_HWCAP_ISA_D (1 << ('D' - 'A'))
|
||||
#define COMPAT_HWCAP_ISA_C (1 << ('C' - 'A'))
|
||||
#define COMPAT_HWCAP_ISA_V (1 << ('V' - 'A'))
|
||||
|
||||
void cpuinfo_riscv_linux_decode_isa_from_hwcap(
|
||||
struct cpuinfo_riscv_isa isa[restrict static 1]) {
|
||||
const unsigned long hwcap = getauxval(AT_HWCAP);
|
||||
|
||||
if (hwcap & COMPAT_HWCAP_ISA_I) {
|
||||
isa->i = true;
|
||||
}
|
||||
if (hwcap & COMPAT_HWCAP_ISA_M) {
|
||||
isa->m = true;
|
||||
}
|
||||
if (hwcap & COMPAT_HWCAP_ISA_A) {
|
||||
isa->a = true;
|
||||
}
|
||||
if (hwcap & COMPAT_HWCAP_ISA_F) {
|
||||
isa->f = true;
|
||||
}
|
||||
if (hwcap & COMPAT_HWCAP_ISA_D) {
|
||||
isa->d = true;
|
||||
}
|
||||
if (hwcap & COMPAT_HWCAP_ISA_C) {
|
||||
isa->c = true;
|
||||
}
|
||||
if (hwcap & COMPAT_HWCAP_ISA_V) {
|
||||
isa->v = true;
|
||||
}
|
||||
}
|
||||
27
3rdparty/cpuinfo/src/riscv/uarch.c
vendored
Normal file
27
3rdparty/cpuinfo/src/riscv/uarch.c
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cpuinfo/log.h>
|
||||
#include <riscv/api.h>
|
||||
|
||||
void cpuinfo_riscv_decode_vendor_uarch(
|
||||
uint32_t vendor_id,
|
||||
uint32_t arch_id,
|
||||
uint32_t imp_id,
|
||||
enum cpuinfo_vendor vendor[restrict static 1],
|
||||
enum cpuinfo_uarch uarch[restrict static 1]) {
|
||||
/* The vendor ID is sufficient to determine the cpuinfo_vendor. */
|
||||
switch(vendor_id) {
|
||||
case cpuinfo_riscv_chipset_sifive:
|
||||
*vendor = cpuinfo_vendor_sifive;
|
||||
break;
|
||||
default:
|
||||
*vendor = cpuinfo_vendor_unknown;
|
||||
cpuinfo_log_warning("unknown vendor ID: %"PRIu32, vendor_id);
|
||||
break;
|
||||
}
|
||||
/**
|
||||
* TODO: Add support for parsing chipset architecture and implementation
|
||||
* IDs here, when a chipset of interest comes along.
|
||||
*/
|
||||
*uarch = cpuinfo_uarch_unknown;
|
||||
}
|
||||
12
3rdparty/cpuinfo/src/x86/isa.c
vendored
12
3rdparty/cpuinfo/src/x86/isa.c
vendored
@@ -490,6 +490,18 @@ struct cpuinfo_x86_isa cpuinfo_x86_detect_isa(
|
||||
*/
|
||||
isa.avx512vp2intersect = avx512_regs && !!(structured_feature_info0.edx & UINT32_C(0x00000100));
|
||||
|
||||
/*
|
||||
* AVX512_FP16 instructions:
|
||||
* - Intel: edx[bit 23] in structured feature info (ecx = 0).
|
||||
*/
|
||||
isa.avx512fp16 = avx512_regs && !!(structured_feature_info0.edx & UINT32_C(0x00800000));
|
||||
|
||||
/*
|
||||
* AVX_VNNI instructions:
|
||||
* - Intel: eax[bit 4] in structured feature info (ecx = 1).
|
||||
*/
|
||||
isa.avxvnni = avx_regs && !!(structured_feature_info1.eax & UINT32_C(0x00000010));
|
||||
|
||||
/*
|
||||
* AVX512_BF16 instructions:
|
||||
* - Intel: eax[bit 5] in structured feature info (ecx = 1).
|
||||
|
||||
6
3rdparty/cpuinfo/src/x86/name.c
vendored
6
3rdparty/cpuinfo/src/x86/name.c
vendored
@@ -234,7 +234,7 @@ static bool transform_token(char* token_start, char* token_end, struct parser_st
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* Erase everywhing after "SOC" on AMD System-on-Chips, e.g.
|
||||
* Erase everything after "SOC" on AMD System-on-Chips, e.g.
|
||||
* "AMD GX-212JC SOC with Radeon(TM) R2E Graphics \0"
|
||||
*/
|
||||
if (erase_matching(token_start, token_length, "SOC")) {
|
||||
@@ -581,7 +581,7 @@ uint32_t cpuinfo_x86_normalize_brand_string(
|
||||
/* Iterate through all tokens and erase redundant parts */
|
||||
{
|
||||
bool is_token = false;
|
||||
char* token_start;
|
||||
char* token_start = NULL;
|
||||
for (char* char_ptr = name; char_ptr != name_end; char_ptr++) {
|
||||
if (*char_ptr == ' ') {
|
||||
if (is_token) {
|
||||
@@ -619,7 +619,7 @@ uint32_t cpuinfo_x86_normalize_brand_string(
|
||||
/* Compact tokens: collapse multiple spacing into one */
|
||||
{
|
||||
char* output_ptr = normalized_name;
|
||||
char* token_start;
|
||||
char* token_start = NULL;
|
||||
bool is_token = false;
|
||||
bool previous_token_ends_with_dash = true;
|
||||
bool current_token_starts_with_dash = false;
|
||||
|
||||
38
3rdparty/cpuinfo/src/x86/uarch.c
vendored
38
3rdparty/cpuinfo/src/x86/uarch.c
vendored
@@ -195,35 +195,37 @@ enum cpuinfo_uarch cpuinfo_x86_decode_uarch(
|
||||
}
|
||||
break;
|
||||
case 0x16:
|
||||
if (model_info->model >= 0x03) {
|
||||
if (model_info->extended_model >= 0x03) {
|
||||
return cpuinfo_uarch_puma;
|
||||
} else {
|
||||
return cpuinfo_uarch_jaguar;
|
||||
}
|
||||
case 0x17:
|
||||
switch (model_info->model) {
|
||||
case 0x01: // 14 nm Naples, Whitehaven, Summit Ridge, Snowy Owl
|
||||
case 0x08: // 12 nm Pinnacle Ridge
|
||||
case 0x11: // 14 nm Raven Ridge, Great Horned Owl
|
||||
case 0x18: // 12 nm Picasso
|
||||
switch (model_info->extended_model) {
|
||||
case 0x0: // model 01h -> 14 nm Naples/Whitehaven/Summit Ridge/Snowy Owl, model 08h -> 12 nm Colfax/Pinnacle Ridge
|
||||
case 0x1: // model 11h -> 14 nm Raven Ridge/Great Horned Owl, model 18h -> 14 nm Banded Kestrel / 12 nm Picasso
|
||||
return cpuinfo_uarch_zen;
|
||||
case 0x31: // Rome, Castle Peak
|
||||
case 0x60: // Renoir
|
||||
case 0x68: // Lucienne
|
||||
case 0x71: // Matisse
|
||||
case 0x90: // Van Gogh
|
||||
case 0x98: // Mero
|
||||
case 0x3: // model 31h -> Rome/Castle Peak
|
||||
case 0x4: // model 47h -> Xbox Series X
|
||||
case 0x6: // model 60h -> Renoir/Grey Hawk, model 68h -> Lucienne
|
||||
case 0x7: // model 71h -> Matisse
|
||||
case 0x9: // model 90h -> Van Gogh, model 98h -> Mero
|
||||
return cpuinfo_uarch_zen2;
|
||||
}
|
||||
break;
|
||||
case 0x19:
|
||||
switch (model_info->model) {
|
||||
case 0x01: // Genesis
|
||||
case 0x21: // Vermeer
|
||||
case 0x30: // Badami, Trento
|
||||
case 0x40: // Rembrandt
|
||||
case 0x50: // Cezanne
|
||||
switch (model_info->extended_model) {
|
||||
case 0x0: // model 00h -> Genesis, model 01h -> Milan, model 08h -> Chagall
|
||||
case 0x2: // model 21h -> Vermeer
|
||||
case 0x3: // model 30h -> Badami, Trento
|
||||
case 0x4: // model 40h -> Rembrandt
|
||||
case 0x5: // model 50h -> Cezanne
|
||||
return cpuinfo_uarch_zen3;
|
||||
case 0x1: // model 10h..1Fh -> Stones
|
||||
case 0x6: // model 60h..6Fh -> Raphael
|
||||
case 0x7: // model 70h..77h -> Phoenix/Hawkpoint1, model 78h..7Fh -> Phoenix 2/Hawkpoint2
|
||||
case 0xA: // model A0h..AFh -> Stones-Dense
|
||||
return cpuinfo_uarch_zen4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
257
3rdparty/cubeb/CMakeLists.txt
vendored
257
3rdparty/cubeb/CMakeLists.txt
vendored
@@ -2,10 +2,8 @@
|
||||
# - backend selection via command line, rather than simply detecting headers.
|
||||
|
||||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
||||
project(cubeb
|
||||
VERSION 0.0.0)
|
||||
project(cubeb C CXX)
|
||||
|
||||
option(BUILD_RUST_LIBS "Build rust backends" OFF)
|
||||
option(LAZY_LOAD_LIBS "Lazily load shared libraries" ON)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
@@ -14,25 +12,17 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (BUILD_RUST_LIBS)
|
||||
if(EXISTS "${PROJECT_SOURCE_DIR}/src/cubeb-pulse-rs")
|
||||
set(USE_PULSE_RUST 1)
|
||||
endif()
|
||||
if(EXISTS "${PROJECT_SOURCE_DIR}/src/cubeb-coreaudio-rs")
|
||||
set(USE_AUDIOUNIT_RUST 1)
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
set(CMAKE_CXX_WARNING_LEVEL 4)
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -fno-exceptions -fno-rtti")
|
||||
else()
|
||||
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
|
||||
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable Exceptions
|
||||
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # Disable RTTI
|
||||
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # Disable Exceptions
|
||||
endif()
|
||||
|
||||
add_library(cubeb
|
||||
@@ -46,43 +36,15 @@ add_library(cubeb
|
||||
target_include_directories(cubeb
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>
|
||||
)
|
||||
set_target_properties(cubeb PROPERTIES
|
||||
VERSION ${cubeb_VERSION}
|
||||
SOVERSION ${cubeb_VERSION_MAJOR}
|
||||
)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
configure_package_config_file(
|
||||
"Config.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
)
|
||||
|
||||
install(
|
||||
FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
)
|
||||
|
||||
install(TARGETS cubeb EXPORT "${PROJECT_NAME}Targets")
|
||||
install(
|
||||
EXPORT "${PROJECT_NAME}Targets"
|
||||
NAMESPACE "${PROJECT_NAME}::"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
)
|
||||
|
||||
add_library(speex OBJECT subprojects/speex/resample.c)
|
||||
set_target_properties(speex PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||
target_include_directories(speex INTERFACE subprojects)
|
||||
target_compile_definitions(speex PUBLIC
|
||||
OUTSIDE_SPEEX
|
||||
FLOATING_POINT
|
||||
EXPORT=
|
||||
RANDOM_PREFIX=speex
|
||||
OUTSIDE_SPEEX
|
||||
FLOATING_POINT
|
||||
EXPORT=
|
||||
RANDOM_PREFIX=speex
|
||||
)
|
||||
|
||||
# $<BUILD_INTERFACE:> required because of https://gitlab.kitware.com/cmake/cmake/-/issues/15415
|
||||
@@ -96,17 +58,19 @@ find_package(Threads)
|
||||
target_link_libraries(cubeb PRIVATE Threads::Threads)
|
||||
|
||||
if(LAZY_LOAD_LIBS)
|
||||
check_include_files(pulse/pulseaudio.h USE_PULSE)
|
||||
check_include_files(alsa/asoundlib.h USE_ALSA)
|
||||
check_include_files(jack/jack.h USE_JACK)
|
||||
check_include_files(sndio.h USE_SNDIO)
|
||||
check_include_files(aaudio/AAudio.h USE_AAUDIO)
|
||||
if(NOT APPLE AND NOT WIN32)
|
||||
# Skip checks on MacOS because it takes ages in XCode.
|
||||
check_include_files(pulse/pulseaudio.h USE_PULSE)
|
||||
check_include_files(alsa/asoundlib.h USE_ALSA)
|
||||
check_include_files(jack/jack.h USE_JACK)
|
||||
check_include_files(sndio.h USE_SNDIO)
|
||||
|
||||
if(USE_PULSE OR USE_ALSA OR USE_JACK OR USE_SNDIO OR USE_AAUDIO)
|
||||
target_link_libraries(cubeb PRIVATE ${CMAKE_DL_LIBS})
|
||||
if(USE_PULSE OR USE_ALSA OR USE_JACK OR USE_SNDIO)
|
||||
target_link_libraries(cubeb PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else()
|
||||
elseif(NOT APPLE AND NOT WIN32)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
@@ -136,12 +100,6 @@ else()
|
||||
target_compile_definitions(cubeb PRIVATE DISABLE_LIBSNDIO_DLOPEN)
|
||||
target_link_libraries(cubeb PRIVATE sndio)
|
||||
endif()
|
||||
|
||||
check_include_files(aaudio/AAudio.h USE_AAUDIO)
|
||||
if(USE_AAUDIO)
|
||||
target_compile_definitions(cubeb PRIVATE DISABLE_LIBAAUDIO_DLOPEN)
|
||||
target_link_libraries(cubeb PRIVATE aaudio)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_PULSE)
|
||||
@@ -164,138 +122,57 @@ if(USE_SNDIO)
|
||||
target_compile_definitions(cubeb PRIVATE USE_SNDIO)
|
||||
endif()
|
||||
|
||||
if(USE_AAUDIO)
|
||||
target_sources(cubeb PRIVATE src/cubeb_aaudio.cpp)
|
||||
target_compile_definitions(cubeb PRIVATE USE_AAUDIO)
|
||||
|
||||
# set this definition to enable low latency mode. Possibly bad for battery
|
||||
target_compile_definitions(cubeb PRIVATE CUBEB_AAUDIO_LOW_LATENCY)
|
||||
|
||||
# set this definition to enable power saving mode. Possibly resulting
|
||||
# in high latency
|
||||
# target_compile_definitions(cubeb PRIVATE CUBEB_AAUDIO_LOW_POWER_SAVING)
|
||||
|
||||
# set this mode to make the backend use an exclusive stream.
|
||||
# will decrease latency.
|
||||
# target_compile_definitions(cubeb PRIVATE CUBEB_AAUDIO_EXCLUSIVE_STREAM)
|
||||
endif()
|
||||
|
||||
check_include_files(AudioUnit/AudioUnit.h USE_AUDIOUNIT)
|
||||
if(USE_AUDIOUNIT)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_audiounit.cpp
|
||||
src/cubeb_osx_run_loop.cpp)
|
||||
target_compile_definitions(cubeb PRIVATE USE_AUDIOUNIT)
|
||||
target_link_libraries(cubeb PRIVATE "-framework AudioUnit" "-framework CoreAudio" "-framework CoreServices")
|
||||
endif()
|
||||
|
||||
check_include_files(audioclient.h USE_WASAPI)
|
||||
if(USE_WASAPI)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_wasapi.cpp)
|
||||
target_compile_definitions(cubeb PRIVATE USE_WASAPI)
|
||||
target_link_libraries(cubeb PRIVATE avrt ole32 ksuser)
|
||||
endif()
|
||||
|
||||
check_include_files("windows.h;mmsystem.h" USE_WINMM)
|
||||
if(USE_WINMM)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_winmm.c)
|
||||
target_compile_definitions(cubeb PRIVATE USE_WINMM)
|
||||
target_link_libraries(cubeb PRIVATE winmm)
|
||||
endif()
|
||||
|
||||
check_include_files(SLES/OpenSLES.h USE_OPENSL)
|
||||
if(USE_OPENSL)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_opensl.c
|
||||
src/cubeb-jni.cpp)
|
||||
target_compile_definitions(cubeb PRIVATE USE_OPENSL)
|
||||
target_link_libraries(cubeb PRIVATE OpenSLES)
|
||||
endif()
|
||||
|
||||
check_include_files(sys/soundcard.h HAVE_SYS_SOUNDCARD_H)
|
||||
if(HAVE_SYS_SOUNDCARD_H)
|
||||
try_compile(USE_OSS "${PROJECT_BINARY_DIR}/compile_tests"
|
||||
${PROJECT_SOURCE_DIR}/cmake/compile_tests/oss_is_v4.c)
|
||||
if(USE_OSS)
|
||||
# strlcpy is not available on BSD systems that use glibc,
|
||||
# like Debian kfreebsd, so try using libbsd if available
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(strlcpy string.h HAVE_STRLCPY)
|
||||
if(NOT HAVE_STRLCPY)
|
||||
pkg_check_modules(libbsd-overlay IMPORTED_TARGET libbsd-overlay)
|
||||
if(libbsd-overlay_FOUND)
|
||||
target_link_libraries(cubeb PRIVATE PkgConfig::libbsd-overlay)
|
||||
set(HAVE_STRLCPY true)
|
||||
endif()
|
||||
endif()
|
||||
if (HAVE_STRLCPY)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_oss.c)
|
||||
target_compile_definitions(cubeb PRIVATE USE_OSS)
|
||||
endif()
|
||||
if(APPLE)
|
||||
check_include_files(AudioUnit/AudioUnit.h USE_AUDIOUNIT)
|
||||
if(USE_AUDIOUNIT)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_audiounit.cpp
|
||||
src/cubeb_osx_run_loop.cpp)
|
||||
target_compile_definitions(cubeb PRIVATE USE_AUDIOUNIT)
|
||||
target_link_libraries(cubeb PRIVATE "-framework AudioUnit" "-framework CoreAudio" "-framework CoreServices")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_include_files(android/log.h USE_AUDIOTRACK)
|
||||
if(USE_AUDIOTRACK)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_audiotrack.c)
|
||||
target_compile_definitions(cubeb PRIVATE USE_AUDIOTRACK)
|
||||
target_link_libraries(cubeb PRIVATE log)
|
||||
if(WIN32)
|
||||
check_include_files(audioclient.h USE_WASAPI)
|
||||
if(USE_WASAPI)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_wasapi.cpp)
|
||||
target_compile_definitions(cubeb PRIVATE USE_WASAPI)
|
||||
target_link_libraries(cubeb PRIVATE avrt ole32 ksuser)
|
||||
endif()
|
||||
|
||||
check_include_files("windows.h;mmsystem.h" USE_WINMM)
|
||||
if(USE_WINMM)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_winmm.c)
|
||||
target_compile_definitions(cubeb PRIVATE USE_WINMM)
|
||||
target_link_libraries(cubeb PRIVATE winmm)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_include_files(sys/audioio.h USE_SUN)
|
||||
if(USE_SUN)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_sun.c)
|
||||
target_compile_definitions(cubeb PRIVATE USE_SUN)
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
check_include_files(sys/soundcard.h HAVE_SYS_SOUNDCARD_H)
|
||||
if(HAVE_SYS_SOUNDCARD_H)
|
||||
try_compile(USE_OSS "${PROJECT_BINARY_DIR}/compile_tests"
|
||||
${PROJECT_SOURCE_DIR}/cmake/compile_tests/oss_is_v4.c)
|
||||
if(USE_OSS)
|
||||
# strlcpy is not available on BSD systems that use glibc,
|
||||
# like Debian kfreebsd, so try using libbsd if available
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(strlcpy string.h HAVE_STRLCPY)
|
||||
if(NOT HAVE_STRLCPY)
|
||||
pkg_check_modules(libbsd-overlay IMPORTED_TARGET libbsd-overlay)
|
||||
if(libbsd-overlay_FOUND)
|
||||
target_link_libraries(cubeb PRIVATE PkgConfig::libbsd-overlay)
|
||||
set(HAVE_STRLCPY true)
|
||||
endif()
|
||||
endif()
|
||||
if (HAVE_STRLCPY)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_oss.c)
|
||||
target_compile_definitions(cubeb PRIVATE USE_OSS)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_include_files(kai.h USE_KAI)
|
||||
if(USE_KAI)
|
||||
target_sources(cubeb PRIVATE
|
||||
src/cubeb_kai.c)
|
||||
target_compile_definitions(cubeb PRIVATE USE_KAI)
|
||||
target_link_libraries(cubeb PRIVATE kai)
|
||||
endif()
|
||||
|
||||
if(USE_PULSE AND USE_PULSE_RUST)
|
||||
include(ExternalProject)
|
||||
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/rust)
|
||||
ExternalProject_Add(
|
||||
cubeb_pulse_rs
|
||||
DOWNLOAD_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND cargo build COMMAND cargo build --release
|
||||
BUILD_ALWAYS ON
|
||||
BINARY_DIR "${PROJECT_SOURCE_DIR}/src/cubeb-pulse-rs"
|
||||
INSTALL_COMMAND ""
|
||||
LOG_BUILD ON)
|
||||
add_dependencies(cubeb cubeb_pulse_rs)
|
||||
target_compile_definitions(cubeb PRIVATE USE_PULSE_RUST)
|
||||
target_link_libraries(cubeb PRIVATE
|
||||
debug "${PROJECT_SOURCE_DIR}/src/cubeb-pulse-rs/target/debug/libcubeb_pulse.a"
|
||||
optimized "${PROJECT_SOURCE_DIR}/src/cubeb-pulse-rs/target/release/libcubeb_pulse.a" pulse)
|
||||
endif()
|
||||
|
||||
if(USE_AUDIOUNIT AND USE_AUDIOUNIT_RUST)
|
||||
include(ExternalProject)
|
||||
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/rust)
|
||||
ExternalProject_Add(
|
||||
cubeb_coreaudio_rs
|
||||
DOWNLOAD_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND cargo build COMMAND cargo build --release
|
||||
BUILD_ALWAYS ON
|
||||
BINARY_DIR "${PROJECT_SOURCE_DIR}/src/cubeb-coreaudio-rs"
|
||||
INSTALL_COMMAND ""
|
||||
LOG_BUILD ON)
|
||||
add_dependencies(cubeb cubeb_coreaudio_rs)
|
||||
target_compile_definitions(cubeb PRIVATE USE_AUDIOUNIT_RUST)
|
||||
target_link_libraries(cubeb PRIVATE
|
||||
debug "${PROJECT_SOURCE_DIR}/src/cubeb-coreaudio-rs/target/debug/libcubeb_coreaudio.a"
|
||||
optimized "${PROJECT_SOURCE_DIR}/src/cubeb-coreaudio-rs/target/release/libcubeb_coreaudio.a")
|
||||
endif()
|
||||
|
||||
|
||||
4
3rdparty/cubeb/Config.cmake.in
vendored
4
3rdparty/cubeb/Config.cmake.in
vendored
@@ -1,4 +0,0 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/cubebTargets.cmake")
|
||||
check_required_components(cubeb)
|
||||
14
3rdparty/cubeb/cmake/toolchain-cross-mingw.cmake
vendored
14
3rdparty/cubeb/cmake/toolchain-cross-mingw.cmake
vendored
@@ -1,14 +0,0 @@
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
set(COMPILER_PREFIX "i686-w64-mingw32")
|
||||
|
||||
find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
|
||||
find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc-posix)
|
||||
find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++-posix)
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
36
3rdparty/cubeb/cubeb.supp
vendored
36
3rdparty/cubeb/cubeb.supp
vendored
@@ -1,36 +0,0 @@
|
||||
{
|
||||
snd_config_update-malloc
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
...
|
||||
fun:snd_config_update_r
|
||||
}
|
||||
{
|
||||
snd1_dlobj_cache_get-malloc
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
...
|
||||
fun:snd1_dlobj_cache_get
|
||||
}
|
||||
{
|
||||
parse_defs-malloc
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
...
|
||||
fun:parse_defs
|
||||
}
|
||||
{
|
||||
parse_defs-calloc
|
||||
Memcheck:Leak
|
||||
fun:calloc
|
||||
...
|
||||
fun:parse_defs
|
||||
}
|
||||
{
|
||||
pa_client_conf_from_x11-malloc
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
...
|
||||
fun:pa_client_conf_from_x11
|
||||
}
|
||||
|
||||
6
3rdparty/cubeb/cubeb.vcxproj
vendored
6
3rdparty/cubeb/cubeb.vcxproj
vendored
@@ -49,7 +49,6 @@
|
||||
<ClInclude Include="subprojects\speex\stack_alloc.h" />
|
||||
<ClInclude Include="src\cubeb-internal.h" />
|
||||
<ClInclude Include="src\cubeb-speex-resampler.h" />
|
||||
<ClInclude Include="src\cubeb_array_queue.h" />
|
||||
<ClInclude Include="src\cubeb_assert.h" />
|
||||
<ClInclude Include="src\cubeb_log.h" />
|
||||
<ClInclude Include="src\cubeb_mixer.h" />
|
||||
@@ -73,6 +72,11 @@
|
||||
<ClCompile Include="src\cubeb_winmm.c" />
|
||||
<ClCompile Include="subprojects\speex\resample.c" />
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Lib>
|
||||
<AdditionalDependencies Condition="'$(Platform)'!='ARM64'">ksuser.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
1
3rdparty/cubeb/cubeb.vcxproj.filters
vendored
1
3rdparty/cubeb/cubeb.vcxproj.filters
vendored
@@ -3,7 +3,6 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\cubeb-internal.h" />
|
||||
<ClInclude Include="src\cubeb-speex-resampler.h" />
|
||||
<ClInclude Include="src\cubeb_array_queue.h" />
|
||||
<ClInclude Include="src\cubeb_assert.h" />
|
||||
<ClInclude Include="src\cubeb_log.h" />
|
||||
<ClInclude Include="src\cubeb_mixer.h" />
|
||||
|
||||
70
3rdparty/cubeb/include/cubeb/cubeb.h
vendored
70
3rdparty/cubeb/include/cubeb/cubeb.h
vendored
@@ -163,6 +163,7 @@ typedef enum {
|
||||
implications. */
|
||||
} cubeb_log_level;
|
||||
|
||||
/// A single channel position, to be used in a bitmask.
|
||||
typedef enum {
|
||||
CHANNEL_UNKNOWN = 0,
|
||||
CHANNEL_FRONT_LEFT = 1 << 0,
|
||||
@@ -185,43 +186,46 @@ typedef enum {
|
||||
CHANNEL_TOP_BACK_RIGHT = 1 << 17
|
||||
} cubeb_channel;
|
||||
|
||||
/// A bitmask representing the channel layout of a cubeb stream. This is
|
||||
/// bit-compatible with WAVEFORMATEXENSIBLE and in the same order as the SMPTE
|
||||
/// ordering.
|
||||
typedef uint32_t cubeb_channel_layout;
|
||||
// Some common layout definitions.
|
||||
enum {
|
||||
CUBEB_LAYOUT_UNDEFINED = 0, // Indicate the speaker's layout is undefined.
|
||||
CUBEB_LAYOUT_MONO = CHANNEL_FRONT_CENTER,
|
||||
CUBEB_LAYOUT_MONO_LFE = CUBEB_LAYOUT_MONO | CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_STEREO = CHANNEL_FRONT_LEFT | CHANNEL_FRONT_RIGHT,
|
||||
CUBEB_LAYOUT_STEREO_LFE = CUBEB_LAYOUT_STEREO | CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_MONO = (uint32_t)CHANNEL_FRONT_CENTER,
|
||||
CUBEB_LAYOUT_MONO_LFE = (uint32_t)CUBEB_LAYOUT_MONO | (uint32_t)CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_STEREO = (uint32_t)CHANNEL_FRONT_LEFT | (uint32_t)CHANNEL_FRONT_RIGHT,
|
||||
CUBEB_LAYOUT_STEREO_LFE = (uint32_t)CUBEB_LAYOUT_STEREO | (uint32_t)CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_3F =
|
||||
CHANNEL_FRONT_LEFT | CHANNEL_FRONT_RIGHT | CHANNEL_FRONT_CENTER,
|
||||
CUBEB_LAYOUT_3F_LFE = CUBEB_LAYOUT_3F | CHANNEL_LOW_FREQUENCY,
|
||||
(uint32_t)CHANNEL_FRONT_LEFT | (uint32_t)CHANNEL_FRONT_RIGHT | (uint32_t)CHANNEL_FRONT_CENTER,
|
||||
CUBEB_LAYOUT_3F_LFE = (uint32_t)CUBEB_LAYOUT_3F | (uint32_t)CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_2F1 =
|
||||
CHANNEL_FRONT_LEFT | CHANNEL_FRONT_RIGHT | CHANNEL_BACK_CENTER,
|
||||
CUBEB_LAYOUT_2F1_LFE = CUBEB_LAYOUT_2F1 | CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_3F1 = CHANNEL_FRONT_LEFT | CHANNEL_FRONT_RIGHT |
|
||||
CHANNEL_FRONT_CENTER | CHANNEL_BACK_CENTER,
|
||||
CUBEB_LAYOUT_3F1_LFE = CUBEB_LAYOUT_3F1 | CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_2F2 = CHANNEL_FRONT_LEFT | CHANNEL_FRONT_RIGHT |
|
||||
CHANNEL_SIDE_LEFT | CHANNEL_SIDE_RIGHT,
|
||||
CUBEB_LAYOUT_2F2_LFE = CUBEB_LAYOUT_2F2 | CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_QUAD = CHANNEL_FRONT_LEFT | CHANNEL_FRONT_RIGHT |
|
||||
CHANNEL_BACK_LEFT | CHANNEL_BACK_RIGHT,
|
||||
CUBEB_LAYOUT_QUAD_LFE = CUBEB_LAYOUT_QUAD | CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_3F2 = CHANNEL_FRONT_LEFT | CHANNEL_FRONT_RIGHT |
|
||||
CHANNEL_FRONT_CENTER | CHANNEL_SIDE_LEFT |
|
||||
CHANNEL_SIDE_RIGHT,
|
||||
CUBEB_LAYOUT_3F2_LFE = CUBEB_LAYOUT_3F2 | CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_3F2_BACK = CUBEB_LAYOUT_QUAD | CHANNEL_FRONT_CENTER,
|
||||
CUBEB_LAYOUT_3F2_LFE_BACK = CUBEB_LAYOUT_3F2_BACK | CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_3F3R_LFE = CHANNEL_FRONT_LEFT | CHANNEL_FRONT_RIGHT |
|
||||
CHANNEL_FRONT_CENTER | CHANNEL_LOW_FREQUENCY |
|
||||
CHANNEL_BACK_CENTER | CHANNEL_SIDE_LEFT |
|
||||
CHANNEL_SIDE_RIGHT,
|
||||
CUBEB_LAYOUT_3F4_LFE = CHANNEL_FRONT_LEFT | CHANNEL_FRONT_RIGHT |
|
||||
CHANNEL_FRONT_CENTER | CHANNEL_LOW_FREQUENCY |
|
||||
CHANNEL_BACK_LEFT | CHANNEL_BACK_RIGHT |
|
||||
CHANNEL_SIDE_LEFT | CHANNEL_SIDE_RIGHT,
|
||||
(uint32_t)CHANNEL_FRONT_LEFT | (uint32_t)CHANNEL_FRONT_RIGHT | (uint32_t)CHANNEL_BACK_CENTER,
|
||||
CUBEB_LAYOUT_2F1_LFE = (uint32_t)CUBEB_LAYOUT_2F1 | (uint32_t)CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_3F1 = (uint32_t)CHANNEL_FRONT_LEFT | (uint32_t)CHANNEL_FRONT_RIGHT |
|
||||
(uint32_t)CHANNEL_FRONT_CENTER | (uint32_t)CHANNEL_BACK_CENTER,
|
||||
CUBEB_LAYOUT_3F1_LFE = (uint32_t)CUBEB_LAYOUT_3F1 | (uint32_t)CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_2F2 = (uint32_t)CHANNEL_FRONT_LEFT | (uint32_t)CHANNEL_FRONT_RIGHT |
|
||||
(uint32_t)CHANNEL_SIDE_LEFT | (uint32_t)CHANNEL_SIDE_RIGHT,
|
||||
CUBEB_LAYOUT_2F2_LFE = (uint32_t)CUBEB_LAYOUT_2F2 | (uint32_t)CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_QUAD = (uint32_t)CHANNEL_FRONT_LEFT | (uint32_t)CHANNEL_FRONT_RIGHT |
|
||||
(uint32_t)CHANNEL_BACK_LEFT | (uint32_t)CHANNEL_BACK_RIGHT,
|
||||
CUBEB_LAYOUT_QUAD_LFE = (uint32_t)CUBEB_LAYOUT_QUAD | (uint32_t)CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_3F2 = (uint32_t)CHANNEL_FRONT_LEFT | (uint32_t)CHANNEL_FRONT_RIGHT |
|
||||
(uint32_t)CHANNEL_FRONT_CENTER | (uint32_t)CHANNEL_SIDE_LEFT |
|
||||
(uint32_t)CHANNEL_SIDE_RIGHT,
|
||||
CUBEB_LAYOUT_3F2_LFE = (uint32_t)CUBEB_LAYOUT_3F2 | (uint32_t)CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_3F2_BACK = (uint32_t)CUBEB_LAYOUT_QUAD | (uint32_t)CHANNEL_FRONT_CENTER,
|
||||
CUBEB_LAYOUT_3F2_LFE_BACK = (uint32_t)CUBEB_LAYOUT_3F2_BACK | (uint32_t)CHANNEL_LOW_FREQUENCY,
|
||||
CUBEB_LAYOUT_3F3R_LFE = (uint32_t)CHANNEL_FRONT_LEFT | (uint32_t)CHANNEL_FRONT_RIGHT |
|
||||
(uint32_t)CHANNEL_FRONT_CENTER | (uint32_t)CHANNEL_LOW_FREQUENCY |
|
||||
(uint32_t)CHANNEL_BACK_CENTER | (uint32_t)CHANNEL_SIDE_LEFT |
|
||||
(uint32_t)CHANNEL_SIDE_RIGHT,
|
||||
CUBEB_LAYOUT_3F4_LFE = (uint32_t)CHANNEL_FRONT_LEFT | (uint32_t)CHANNEL_FRONT_RIGHT |
|
||||
(uint32_t)CHANNEL_FRONT_CENTER | (uint32_t)CHANNEL_LOW_FREQUENCY |
|
||||
(uint32_t)CHANNEL_BACK_LEFT | (uint32_t)CHANNEL_BACK_RIGHT |
|
||||
(uint32_t)CHANNEL_SIDE_LEFT | (uint32_t)CHANNEL_SIDE_RIGHT,
|
||||
};
|
||||
|
||||
/** Miscellaneous stream preferences. */
|
||||
@@ -433,7 +437,7 @@ typedef void (*cubeb_state_callback)(cubeb_stream * stream, void * user_ptr,
|
||||
|
||||
/**
|
||||
* User supplied callback called when the underlying device changed.
|
||||
* @param user The pointer passed to cubeb_stream_init. */
|
||||
* @param user_ptr The pointer passed to cubeb_stream_init. */
|
||||
typedef void (*cubeb_device_changed_callback)(void * user_ptr);
|
||||
|
||||
/**
|
||||
@@ -471,7 +475,7 @@ cubeb_init(cubeb ** context, char const * context_name,
|
||||
|
||||
/** Returns a list of backend names which can be supplid to cubeb_init().
|
||||
Array is null-terminated. */
|
||||
CUBEB_EXPORT const char* const*
|
||||
CUBEB_EXPORT const char**
|
||||
cubeb_get_backend_names();
|
||||
|
||||
/** Get a read-only string identifying this context's current backend.
|
||||
|
||||
12
3rdparty/cubeb/include/cubeb/cubeb_export.h
vendored
Normal file
12
3rdparty/cubeb/include/cubeb/cubeb_export.h
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef CUBEB_EXPORT_H
|
||||
#define CUBEB_EXPORT_H
|
||||
|
||||
#define CUBEB_EXPORT
|
||||
#define CUBEB_NO_EXPORT
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma comment(lib, "winmm.lib")
|
||||
#pragma comment(lib, "avrt.lib")
|
||||
#endif
|
||||
|
||||
#endif
|
||||
25
3rdparty/cubeb/include/cubeb_export.h
vendored
25
3rdparty/cubeb/include/cubeb_export.h
vendored
@@ -1,25 +0,0 @@
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CUBEB_EXPORT
|
||||
#define CUBEB_NO_EXPORT
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma comment(lib, "winmm.lib")
|
||||
#pragma comment(lib, "avrt.lib")
|
||||
#pragma comment(lib, "ksuser.lib")
|
||||
#endif
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* The following definitions are copied from the android sources. Only the
|
||||
* relevant enum member and values needed are copied.
|
||||
*/
|
||||
|
||||
/*
|
||||
* From
|
||||
* https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/utils/Errors.h
|
||||
*/
|
||||
typedef int32_t status_t;
|
||||
|
||||
/*
|
||||
* From
|
||||
* https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/media/AudioTrack.h
|
||||
*/
|
||||
struct Buffer {
|
||||
uint32_t flags;
|
||||
int channelCount;
|
||||
int format;
|
||||
size_t frameCount;
|
||||
size_t size;
|
||||
union {
|
||||
void * raw;
|
||||
short * i16;
|
||||
int8_t * i8;
|
||||
};
|
||||
};
|
||||
|
||||
enum event_type {
|
||||
EVENT_MORE_DATA = 0,
|
||||
EVENT_UNDERRUN = 1,
|
||||
EVENT_LOOP_END = 2,
|
||||
EVENT_MARKER = 3,
|
||||
EVENT_NEW_POS = 4,
|
||||
EVENT_BUFFER_END = 5
|
||||
};
|
||||
|
||||
/**
|
||||
* From
|
||||
* https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/media/AudioSystem.h
|
||||
* and
|
||||
* https://android.googlesource.com/platform/system/core/+/android-4.2.2_r1/include/system/audio.h
|
||||
*/
|
||||
|
||||
#define AUDIO_STREAM_TYPE_MUSIC 3
|
||||
|
||||
enum {
|
||||
AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS = 0x1,
|
||||
AUDIO_CHANNEL_OUT_FRONT_RIGHT_ICS = 0x2,
|
||||
AUDIO_CHANNEL_OUT_MONO_ICS = AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS,
|
||||
AUDIO_CHANNEL_OUT_STEREO_ICS =
|
||||
(AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS | AUDIO_CHANNEL_OUT_FRONT_RIGHT_ICS)
|
||||
} AudioTrack_ChannelMapping_ICS;
|
||||
|
||||
enum {
|
||||
AUDIO_CHANNEL_OUT_FRONT_LEFT_Legacy = 0x4,
|
||||
AUDIO_CHANNEL_OUT_FRONT_RIGHT_Legacy = 0x8,
|
||||
AUDIO_CHANNEL_OUT_MONO_Legacy = AUDIO_CHANNEL_OUT_FRONT_LEFT_Legacy,
|
||||
AUDIO_CHANNEL_OUT_STEREO_Legacy = (AUDIO_CHANNEL_OUT_FRONT_LEFT_Legacy |
|
||||
AUDIO_CHANNEL_OUT_FRONT_RIGHT_Legacy)
|
||||
} AudioTrack_ChannelMapping_Legacy;
|
||||
|
||||
typedef enum {
|
||||
AUDIO_FORMAT_PCM = 0x00000000,
|
||||
AUDIO_FORMAT_PCM_SUB_16_BIT = 0x1,
|
||||
AUDIO_FORMAT_PCM_16_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_16_BIT),
|
||||
} AudioTrack_SampleType;
|
||||
@@ -1,76 +0,0 @@
|
||||
#ifndef _CUBEB_OUTPUT_LATENCY_H_
|
||||
#define _CUBEB_OUTPUT_LATENCY_H_
|
||||
|
||||
#include "../cubeb-jni.h"
|
||||
#include "cubeb_media_library.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
struct output_latency_function {
|
||||
media_lib * from_lib;
|
||||
cubeb_jni * from_jni;
|
||||
int version;
|
||||
};
|
||||
|
||||
typedef struct output_latency_function output_latency_function;
|
||||
|
||||
const int ANDROID_JELLY_BEAN_MR1_4_2 = 17;
|
||||
|
||||
output_latency_function *
|
||||
cubeb_output_latency_load_method(int version)
|
||||
{
|
||||
output_latency_function * ol = NULL;
|
||||
ol = calloc(1, sizeof(output_latency_function));
|
||||
|
||||
ol->version = version;
|
||||
|
||||
if (ol->version > ANDROID_JELLY_BEAN_MR1_4_2) {
|
||||
ol->from_jni = cubeb_jni_init();
|
||||
return ol;
|
||||
}
|
||||
|
||||
ol->from_lib = cubeb_load_media_library();
|
||||
return ol;
|
||||
}
|
||||
|
||||
bool
|
||||
cubeb_output_latency_method_is_loaded(output_latency_function * ol)
|
||||
{
|
||||
assert(ol);
|
||||
if (ol->version > ANDROID_JELLY_BEAN_MR1_4_2) {
|
||||
return !!ol->from_jni;
|
||||
}
|
||||
|
||||
return !!ol->from_lib;
|
||||
}
|
||||
|
||||
void
|
||||
cubeb_output_latency_unload_method(output_latency_function * ol)
|
||||
{
|
||||
if (!ol) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ol->version > ANDROID_JELLY_BEAN_MR1_4_2 && ol->from_jni) {
|
||||
cubeb_jni_destroy(ol->from_jni);
|
||||
}
|
||||
|
||||
if (ol->version <= ANDROID_JELLY_BEAN_MR1_4_2 && ol->from_lib) {
|
||||
cubeb_close_media_library(ol->from_lib);
|
||||
}
|
||||
|
||||
free(ol);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
cubeb_get_output_latency(output_latency_function * ol)
|
||||
{
|
||||
assert(cubeb_output_latency_method_is_loaded(ol));
|
||||
|
||||
if (ol->version > ANDROID_JELLY_BEAN_MR1_4_2) {
|
||||
return cubeb_get_output_latency_from_jni(ol->from_jni);
|
||||
}
|
||||
|
||||
return cubeb_get_output_latency_from_media_library(ol->from_lib);
|
||||
}
|
||||
|
||||
#endif // _CUBEB_OUTPUT_LATENCY_H_
|
||||
64
3rdparty/cubeb/src/android/cubeb_media_library.h
vendored
64
3rdparty/cubeb/src/android/cubeb_media_library.h
vendored
@@ -1,64 +0,0 @@
|
||||
#ifndef _CUBEB_MEDIA_LIBRARY_H_
|
||||
#define _CUBEB_MEDIA_LIBRARY_H_
|
||||
|
||||
struct media_lib {
|
||||
void * libmedia;
|
||||
int32_t (*get_output_latency)(uint32_t * latency, int stream_type);
|
||||
};
|
||||
|
||||
typedef struct media_lib media_lib;
|
||||
|
||||
media_lib *
|
||||
cubeb_load_media_library()
|
||||
{
|
||||
media_lib ml = {0};
|
||||
ml.libmedia = dlopen("libmedia.so", RTLD_LAZY);
|
||||
if (!ml.libmedia) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get the latency, in ms, from AudioFlinger. First, try the most recent
|
||||
// signature. status_t AudioSystem::getOutputLatency(uint32_t* latency,
|
||||
// audio_stream_type_t streamType)
|
||||
ml.get_output_latency = dlsym(
|
||||
ml.libmedia,
|
||||
"_ZN7android11AudioSystem16getOutputLatencyEPj19audio_stream_type_t");
|
||||
if (!ml.get_output_latency) {
|
||||
// In case of failure, try the signature from legacy version.
|
||||
// status_t AudioSystem::getOutputLatency(uint32_t* latency, int streamType)
|
||||
ml.get_output_latency =
|
||||
dlsym(ml.libmedia, "_ZN7android11AudioSystem16getOutputLatencyEPji");
|
||||
if (!ml.get_output_latency) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
media_lib * rv = NULL;
|
||||
rv = calloc(1, sizeof(media_lib));
|
||||
assert(rv);
|
||||
*rv = ml;
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
cubeb_close_media_library(media_lib * ml)
|
||||
{
|
||||
dlclose(ml->libmedia);
|
||||
ml->libmedia = NULL;
|
||||
ml->get_output_latency = NULL;
|
||||
free(ml);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
cubeb_get_output_latency_from_media_library(media_lib * ml)
|
||||
{
|
||||
uint32_t latency = 0;
|
||||
const int audio_stream_type_music = 3;
|
||||
int32_t r = ml->get_output_latency(&latency, audio_stream_type_music);
|
||||
if (r) {
|
||||
return 0;
|
||||
}
|
||||
return latency;
|
||||
}
|
||||
|
||||
#endif // _CUBEB_MEDIA_LIBRARY_H_
|
||||
104
3rdparty/cubeb/src/android/sles_definitions.h
vendored
104
3rdparty/cubeb/src/android/sles_definitions.h
vendored
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This file is similar to the file "OpenSLES_AndroidConfiguration.h" found in
|
||||
* the Android NDK, but removes the #ifdef __cplusplus defines, so we can keep
|
||||
* using a C compiler in cubeb.
|
||||
*/
|
||||
|
||||
#ifndef OPENSL_ES_ANDROIDCONFIGURATION_H_
|
||||
#define OPENSL_ES_ANDROIDCONFIGURATION_H_
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android AudioRecorder configuration */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Audio recording preset */
|
||||
/** Audio recording preset key */
|
||||
#define SL_ANDROID_KEY_RECORDING_PRESET \
|
||||
((const SLchar *)"androidRecordingPreset")
|
||||
/** Audio recording preset values */
|
||||
/** preset "none" cannot be set, it is used to indicate the current settings
|
||||
* do not match any of the presets. */
|
||||
#define SL_ANDROID_RECORDING_PRESET_NONE ((SLuint32)0x00000000)
|
||||
/** generic recording configuration on the platform */
|
||||
#define SL_ANDROID_RECORDING_PRESET_GENERIC ((SLuint32)0x00000001)
|
||||
/** uses the microphone audio source with the same orientation as the camera
|
||||
* if available, the main device microphone otherwise */
|
||||
#define SL_ANDROID_RECORDING_PRESET_CAMCORDER ((SLuint32)0x00000002)
|
||||
/** uses the main microphone tuned for voice recognition */
|
||||
#define SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION ((SLuint32)0x00000003)
|
||||
/** uses the main microphone tuned for audio communications */
|
||||
#define SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION ((SLuint32)0x00000004)
|
||||
/** uses the main microphone unprocessed */
|
||||
#define SL_ANDROID_RECORDING_PRESET_UNPROCESSED ((SLuint32)0x00000005)
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android AudioPlayer configuration */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Audio playback stream type */
|
||||
/** Audio playback stream type key */
|
||||
#define SL_ANDROID_KEY_STREAM_TYPE ((const SLchar *)"androidPlaybackStreamType")
|
||||
|
||||
/** Audio playback stream type values */
|
||||
/* same as android.media.AudioManager.STREAM_VOICE_CALL */
|
||||
#define SL_ANDROID_STREAM_VOICE ((SLint32)0x00000000)
|
||||
/* same as android.media.AudioManager.STREAM_SYSTEM */
|
||||
#define SL_ANDROID_STREAM_SYSTEM ((SLint32)0x00000001)
|
||||
/* same as android.media.AudioManager.STREAM_RING */
|
||||
#define SL_ANDROID_STREAM_RING ((SLint32)0x00000002)
|
||||
/* same as android.media.AudioManager.STREAM_MUSIC */
|
||||
#define SL_ANDROID_STREAM_MEDIA ((SLint32)0x00000003)
|
||||
/* same as android.media.AudioManager.STREAM_ALARM */
|
||||
#define SL_ANDROID_STREAM_ALARM ((SLint32)0x00000004)
|
||||
/* same as android.media.AudioManager.STREAM_NOTIFICATION */
|
||||
#define SL_ANDROID_STREAM_NOTIFICATION ((SLint32)0x00000005)
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android AudioPlayer and AudioRecorder configuration */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Audio Performance mode.
|
||||
* Performance mode tells the framework how to configure the audio path
|
||||
* for a player or recorder according to application performance and
|
||||
* functional requirements.
|
||||
* It affects the output or input latency based on acceptable tradeoffs on
|
||||
* battery drain and use of pre or post processing effects.
|
||||
* Performance mode should be set before realizing the object and should be
|
||||
* read after realizing the object to check if the requested mode could be
|
||||
* granted or not.
|
||||
*/
|
||||
/** Audio Performance mode key */
|
||||
#define SL_ANDROID_KEY_PERFORMANCE_MODE \
|
||||
((const SLchar *)"androidPerformanceMode")
|
||||
|
||||
/** Audio performance values */
|
||||
/* No specific performance requirement. Allows HW and SW pre/post
|
||||
* processing. */
|
||||
#define SL_ANDROID_PERFORMANCE_NONE ((SLuint32)0x00000000)
|
||||
/* Priority given to latency. No HW or software pre/post processing.
|
||||
* This is the default if no performance mode is specified. */
|
||||
#define SL_ANDROID_PERFORMANCE_LATENCY ((SLuint32)0x00000001)
|
||||
/* Priority given to latency while still allowing HW pre and post
|
||||
* processing. */
|
||||
#define SL_ANDROID_PERFORMANCE_LATENCY_EFFECTS ((SLuint32)0x00000002)
|
||||
/* Priority given to power saving if latency is not a concern.
|
||||
* Allows HW and SW pre/post processing. */
|
||||
#define SL_ANDROID_PERFORMANCE_POWER_SAVING ((SLuint32)0x00000003)
|
||||
|
||||
#endif /* OPENSL_ES_ANDROIDCONFIGURATION_H_ */
|
||||
8
3rdparty/cubeb/src/cubeb-jni.h
vendored
8
3rdparty/cubeb/src/cubeb-jni.h
vendored
@@ -3,6 +3,10 @@
|
||||
|
||||
typedef struct cubeb_jni cubeb_jni;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
cubeb_jni *
|
||||
cubeb_jni_init();
|
||||
int
|
||||
@@ -10,4 +14,8 @@ cubeb_get_output_latency_from_jni(cubeb_jni * cubeb_jni_ptr);
|
||||
void
|
||||
cubeb_jni_destroy(cubeb_jni * cubeb_jni_ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // _CUBEB_JNI_H_
|
||||
|
||||
38
3rdparty/cubeb/src/cubeb-sles.h
vendored
38
3rdparty/cubeb/src/cubeb-sles.h
vendored
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2016 Mozilla Foundation
|
||||
*
|
||||
* This program is made available under an ISC-style license. See the
|
||||
* accompanying file LICENSE for details.
|
||||
*/
|
||||
|
||||
#ifndef _CUBEB_SLES_H_
|
||||
#define _CUBEB_SLES_H_
|
||||
#include <SLES/OpenSLES.h>
|
||||
|
||||
static SLresult
|
||||
cubeb_get_sles_engine(SLObjectItf * pEngine, SLuint32 numOptions,
|
||||
const SLEngineOption * pEngineOptions,
|
||||
SLuint32 numInterfaces,
|
||||
const SLInterfaceID * pInterfaceIds,
|
||||
const SLboolean * pInterfaceRequired)
|
||||
{
|
||||
return slCreateEngine(pEngine, numOptions, pEngineOptions, numInterfaces,
|
||||
pInterfaceIds, pInterfaceRequired);
|
||||
}
|
||||
|
||||
static void
|
||||
cubeb_destroy_sles_engine(SLObjectItf * self)
|
||||
{
|
||||
if (*self != NULL) {
|
||||
(**self)->Destroy(*self);
|
||||
*self = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static SLresult
|
||||
cubeb_realize_sles_engine(SLObjectItf self)
|
||||
{
|
||||
return (*self)->Realize(self, SL_BOOLEAN_FALSE);
|
||||
}
|
||||
|
||||
#endif
|
||||
98
3rdparty/cubeb/src/cubeb.c
vendored
98
3rdparty/cubeb/src/cubeb.c
vendored
@@ -31,10 +31,6 @@ struct cubeb_stream {
|
||||
int
|
||||
pulse_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_PULSE_RUST)
|
||||
int
|
||||
pulse_rust_init(cubeb ** contet, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_JACK)
|
||||
int
|
||||
jack_init(cubeb ** context, char const * context_name);
|
||||
@@ -47,10 +43,6 @@ alsa_init(cubeb ** context, char const * context_name);
|
||||
int
|
||||
audiounit_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_AUDIOUNIT_RUST)
|
||||
int
|
||||
audiounit_rust_init(cubeb ** contet, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_WINMM)
|
||||
int
|
||||
winmm_init(cubeb ** context, char const * context_name);
|
||||
@@ -63,30 +55,10 @@ wasapi_init(cubeb ** context, char const * context_name);
|
||||
int
|
||||
sndio_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_SUN)
|
||||
int
|
||||
sun_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_OPENSL)
|
||||
int
|
||||
opensl_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_OSS)
|
||||
int
|
||||
oss_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_AAUDIO)
|
||||
int
|
||||
aaudio_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_AUDIOTRACK)
|
||||
int
|
||||
audiotrack_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_KAI)
|
||||
int
|
||||
kai_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
|
||||
static int
|
||||
validate_stream_params(cubeb_stream_params * input_stream_params,
|
||||
@@ -151,10 +123,6 @@ cubeb_init(cubeb ** context, char const * context_name,
|
||||
if (!strcmp(backend_name, "pulse")) {
|
||||
#if defined(USE_PULSE)
|
||||
init_oneshot = pulse_init;
|
||||
#endif
|
||||
} else if (!strcmp(backend_name, "pulse-rust")) {
|
||||
#if defined(USE_PULSE_RUST)
|
||||
init_oneshot = pulse_rust_init;
|
||||
#endif
|
||||
} else if (!strcmp(backend_name, "jack")) {
|
||||
#if defined(USE_JACK)
|
||||
@@ -167,10 +135,6 @@ cubeb_init(cubeb ** context, char const * context_name,
|
||||
} else if (!strcmp(backend_name, "audiounit")) {
|
||||
#if defined(USE_AUDIOUNIT)
|
||||
init_oneshot = audiounit_init;
|
||||
#endif
|
||||
} else if (!strcmp(backend_name, "audiounit-rust")) {
|
||||
#if defined(USE_AUDIOUNIT_RUST)
|
||||
init_oneshot = audiounit_rust_init;
|
||||
#endif
|
||||
} else if (!strcmp(backend_name, "wasapi")) {
|
||||
#if defined(USE_WASAPI)
|
||||
@@ -183,30 +147,10 @@ cubeb_init(cubeb ** context, char const * context_name,
|
||||
} else if (!strcmp(backend_name, "sndio")) {
|
||||
#if defined(USE_SNDIO)
|
||||
init_oneshot = sndio_init;
|
||||
#endif
|
||||
} else if (!strcmp(backend_name, "sun")) {
|
||||
#if defined(USE_SUN)
|
||||
init_oneshot = sun_init;
|
||||
#endif
|
||||
} else if (!strcmp(backend_name, "opensl")) {
|
||||
#if defined(USE_OPENSL)
|
||||
init_oneshot = opensl_init;
|
||||
#endif
|
||||
} else if (!strcmp(backend_name, "oss")) {
|
||||
#if defined(USE_OSS)
|
||||
init_oneshot = oss_init;
|
||||
#endif
|
||||
} else if (!strcmp(backend_name, "aaudio")) {
|
||||
#if defined(USE_AAUDIO)
|
||||
init_oneshot = aaudio_init;
|
||||
#endif
|
||||
} else if (!strcmp(backend_name, "audiotrack")) {
|
||||
#if defined(USE_AUDIOTRACK)
|
||||
init_oneshot = audiotrack_init;
|
||||
#endif
|
||||
} else if (!strcmp(backend_name, "kai")) {
|
||||
#if defined(USE_KAI)
|
||||
init_oneshot = kai_init;
|
||||
#endif
|
||||
} else {
|
||||
/* Already set */
|
||||
@@ -219,9 +163,6 @@ cubeb_init(cubeb ** context, char const * context_name,
|
||||
* to override all other choices
|
||||
*/
|
||||
init_oneshot,
|
||||
#if defined(USE_PULSE_RUST)
|
||||
pulse_rust_init,
|
||||
#endif
|
||||
#if defined(USE_PULSE)
|
||||
pulse_init,
|
||||
#endif
|
||||
@@ -237,9 +178,6 @@ cubeb_init(cubeb ** context, char const * context_name,
|
||||
#if defined(USE_OSS)
|
||||
oss_init,
|
||||
#endif
|
||||
#if defined(USE_AUDIOUNIT_RUST)
|
||||
audiounit_rust_init,
|
||||
#endif
|
||||
#if defined(USE_AUDIOUNIT)
|
||||
audiounit_init,
|
||||
#endif
|
||||
@@ -251,20 +189,6 @@ cubeb_init(cubeb ** context, char const * context_name,
|
||||
#endif
|
||||
#if defined(USE_SUN)
|
||||
sun_init,
|
||||
#endif
|
||||
#if defined(USE_OPENSL)
|
||||
opensl_init,
|
||||
#endif
|
||||
// TODO: should probably be preferred over OpenSLES when available.
|
||||
// Initialization will fail on old android devices.
|
||||
#if defined(USE_AAUDIO)
|
||||
aaudio_init,
|
||||
#endif
|
||||
#if defined(USE_AUDIOTRACK)
|
||||
audiotrack_init,
|
||||
#endif
|
||||
#if defined(USE_KAI)
|
||||
kai_init,
|
||||
#endif
|
||||
};
|
||||
int i;
|
||||
@@ -290,16 +214,13 @@ cubeb_init(cubeb ** context, char const * context_name,
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
const char* const*
|
||||
const char**
|
||||
cubeb_get_backend_names()
|
||||
{
|
||||
static const char* backend_names[] = {
|
||||
#if defined(USE_PULSE)
|
||||
"pulse",
|
||||
#endif
|
||||
#if defined(USE_PULSE_RUST)
|
||||
"pulse-rust",
|
||||
#endif
|
||||
#if defined(USE_JACK)
|
||||
"jack",
|
||||
#endif
|
||||
@@ -309,9 +230,6 @@ cubeb_get_backend_names()
|
||||
#if defined(USE_AUDIOUNIT)
|
||||
"audiounit",
|
||||
#endif
|
||||
#if defined(USE_AUDIOUNIT_RUST)
|
||||
"audiounit-rust",
|
||||
#endif
|
||||
#if defined(USE_WASAPI)
|
||||
"wasapi",
|
||||
#endif
|
||||
@@ -324,20 +242,8 @@ cubeb_get_backend_names()
|
||||
#if defined(USE_SUN)
|
||||
"sun",
|
||||
#endif
|
||||
#if defined(USE_OPENSL)
|
||||
"opensl",
|
||||
#endif
|
||||
#if defined(USE_OSS)
|
||||
"oss",
|
||||
#endif
|
||||
#if defined(USE_AAUDIO)
|
||||
"aaudio",
|
||||
#endif
|
||||
#if defined(USE_AUDIOTRACK)
|
||||
"audiotrack",
|
||||
#endif
|
||||
#if defined(USE_KAI)
|
||||
"kai",
|
||||
#endif
|
||||
NULL,
|
||||
};
|
||||
@@ -406,6 +312,8 @@ cubeb_destroy(cubeb * context)
|
||||
}
|
||||
|
||||
context->ops->destroy(context);
|
||||
|
||||
cubeb_set_log_callback(CUBEB_LOG_DISABLED, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
1507
3rdparty/cubeb/src/cubeb_aaudio.cpp
vendored
1507
3rdparty/cubeb/src/cubeb_aaudio.cpp
vendored
File diff suppressed because it is too large
Load Diff
3
3rdparty/cubeb/src/cubeb_alsa.c
vendored
3
3rdparty/cubeb/src/cubeb_alsa.c
vendored
@@ -7,6 +7,9 @@
|
||||
#undef NDEBUG
|
||||
#define _DEFAULT_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#if defined(__NetBSD__)
|
||||
#define _NETBSD_SOURCE /* timersub() */
|
||||
#endif
|
||||
#define _XOPEN_SOURCE 500
|
||||
#include "cubeb-internal.h"
|
||||
#include "cubeb/cubeb.h"
|
||||
|
||||
17
3rdparty/cubeb/src/cubeb_android.h
vendored
17
3rdparty/cubeb/src/cubeb_android.h
vendored
@@ -1,17 +0,0 @@
|
||||
#ifndef CUBEB_ANDROID_H
|
||||
#define CUBEB_ANDROID_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
// If the latency requested is above this threshold, this stream is considered
|
||||
// intended for playback (vs. real-time). Tell Android it should favor saving
|
||||
// power over performance or latency.
|
||||
// This is around 100ms at 44100 or 48000
|
||||
const uint16_t POWERSAVE_LATENCY_FRAMES_THRESHOLD = 4000;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // CUBEB_ANDROID_H
|
||||
99
3rdparty/cubeb/src/cubeb_array_queue.h
vendored
99
3rdparty/cubeb/src/cubeb_array_queue.h
vendored
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2016 Mozilla Foundation
|
||||
*
|
||||
* This program is made available under an ISC-style license. See the
|
||||
* accompanying file LICENSE for details.
|
||||
*/
|
||||
|
||||
#ifndef CUBEB_ARRAY_QUEUE_H
|
||||
#define CUBEB_ARRAY_QUEUE_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
void ** buf;
|
||||
size_t num;
|
||||
size_t writePos;
|
||||
size_t readPos;
|
||||
pthread_mutex_t mutex;
|
||||
} array_queue;
|
||||
|
||||
array_queue *
|
||||
array_queue_create(size_t num)
|
||||
{
|
||||
assert(num != 0);
|
||||
array_queue * new_queue = (array_queue *)calloc(1, sizeof(array_queue));
|
||||
new_queue->buf = (void **)calloc(1, sizeof(void *) * num);
|
||||
new_queue->readPos = 0;
|
||||
new_queue->writePos = 0;
|
||||
new_queue->num = num;
|
||||
|
||||
pthread_mutex_init(&new_queue->mutex, NULL);
|
||||
|
||||
return new_queue;
|
||||
}
|
||||
|
||||
void
|
||||
array_queue_destroy(array_queue * aq)
|
||||
{
|
||||
assert(aq);
|
||||
|
||||
free(aq->buf);
|
||||
pthread_mutex_destroy(&aq->mutex);
|
||||
free(aq);
|
||||
}
|
||||
|
||||
int
|
||||
array_queue_push(array_queue * aq, void * item)
|
||||
{
|
||||
assert(item);
|
||||
|
||||
pthread_mutex_lock(&aq->mutex);
|
||||
int ret = -1;
|
||||
if (aq->buf[aq->writePos % aq->num] == NULL) {
|
||||
aq->buf[aq->writePos % aq->num] = item;
|
||||
aq->writePos = (aq->writePos + 1) % aq->num;
|
||||
ret = 0;
|
||||
}
|
||||
// else queue is full
|
||||
pthread_mutex_unlock(&aq->mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *
|
||||
array_queue_pop(array_queue * aq)
|
||||
{
|
||||
pthread_mutex_lock(&aq->mutex);
|
||||
void * value = aq->buf[aq->readPos % aq->num];
|
||||
if (value) {
|
||||
aq->buf[aq->readPos % aq->num] = NULL;
|
||||
aq->readPos = (aq->readPos + 1) % aq->num;
|
||||
}
|
||||
pthread_mutex_unlock(&aq->mutex);
|
||||
return value;
|
||||
}
|
||||
|
||||
size_t
|
||||
array_queue_get_size(array_queue * aq)
|
||||
{
|
||||
pthread_mutex_lock(&aq->mutex);
|
||||
ssize_t r = aq->writePos - aq->readPos;
|
||||
if (r < 0) {
|
||||
r = aq->num + r;
|
||||
assert(r >= 0);
|
||||
}
|
||||
pthread_mutex_unlock(&aq->mutex);
|
||||
return (size_t)r;
|
||||
}
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CUBE_ARRAY_QUEUE_H
|
||||
472
3rdparty/cubeb/src/cubeb_audiotrack.c
vendored
472
3rdparty/cubeb/src/cubeb_audiotrack.c
vendored
@@ -1,472 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Mozilla Foundation
|
||||
*
|
||||
* This program is made available under an ISC-style license. See the
|
||||
* accompanying file LICENSE for details.
|
||||
*/
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
#define NDEBUG
|
||||
#endif
|
||||
#include <android/log.h>
|
||||
#include <assert.h>
|
||||
#include <dlfcn.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "android/audiotrack_definitions.h"
|
||||
#include "cubeb-internal.h"
|
||||
#include "cubeb/cubeb.h"
|
||||
|
||||
#ifndef ALOG
|
||||
#if defined(DEBUG) || defined(FORCE_ALOG)
|
||||
#define ALOG(args...) \
|
||||
__android_log_print(ANDROID_LOG_INFO, "Gecko - Cubeb", ##args)
|
||||
#else
|
||||
#define ALOG(args...)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A lot of bytes for safety. It should be possible to bring this down a bit. */
|
||||
#define SIZE_AUDIOTRACK_INSTANCE 256
|
||||
|
||||
/**
|
||||
* call dlsym to get the symbol |mangled_name|, handle the error and store the
|
||||
* pointer in |pointer|. Because depending on Android version, we want different
|
||||
* symbols, not finding a symbol is not an error. */
|
||||
#define DLSYM_DLERROR(mangled_name, pointer, lib) \
|
||||
do { \
|
||||
pointer = dlsym(lib, mangled_name); \
|
||||
if (!pointer) { \
|
||||
ALOG("error while loading %stm: %stm\n", mangled_name, dlerror()); \
|
||||
} else { \
|
||||
ALOG("%stm: OK", mangled_name); \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
static struct cubeb_ops const audiotrack_ops;
|
||||
void
|
||||
audiotrack_destroy(cubeb * context);
|
||||
void
|
||||
audiotrack_stream_destroy(cubeb_stream * stream);
|
||||
|
||||
struct AudioTrack {
|
||||
/* only available on ICS and later. The second int paramter is in fact of type
|
||||
* audio_stream_type_t. */
|
||||
/* static */ status_t (*get_min_frame_count)(int * frame_count,
|
||||
int stream_type, uint32_t rate);
|
||||
/* if we have a recent ctor, but can't find the above symbol, we
|
||||
* can get the minimum frame count with this signature, and we are
|
||||
* running gingerbread. */
|
||||
/* static */ status_t (*get_min_frame_count_gingerbread)(int * frame_count,
|
||||
int stream_type,
|
||||
uint32_t rate);
|
||||
void * (*ctor)(void * instance, int, unsigned int, int, int, int,
|
||||
unsigned int, void (*)(int, void *, void *), void *, int, int);
|
||||
void * (*dtor)(void * instance);
|
||||
void (*start)(void * instance);
|
||||
void (*pause)(void * instance);
|
||||
uint32_t (*latency)(void * instance);
|
||||
status_t (*check)(void * instance);
|
||||
status_t (*get_position)(void * instance, uint32_t * position);
|
||||
/* static */ int (*get_output_samplingrate)(int * samplerate, int stream);
|
||||
status_t (*set_marker_position)(void * instance, unsigned int);
|
||||
status_t (*set_volume)(void * instance, float left, float right);
|
||||
};
|
||||
|
||||
struct cubeb {
|
||||
struct cubeb_ops const * ops;
|
||||
void * library;
|
||||
struct AudioTrack klass;
|
||||
};
|
||||
|
||||
struct cubeb_stream {
|
||||
/* Note: Must match cubeb_stream layout in cubeb.c. */
|
||||
cubeb * context;
|
||||
void * user_ptr;
|
||||
/**/
|
||||
cubeb_stream_params params;
|
||||
cubeb_data_callback data_callback;
|
||||
cubeb_state_callback state_callback;
|
||||
void * instance;
|
||||
/* Number of frames that have been passed to the AudioTrack callback */
|
||||
long unsigned written;
|
||||
int draining;
|
||||
};
|
||||
|
||||
static void
|
||||
audiotrack_refill(int event, void * user, void * info)
|
||||
{
|
||||
cubeb_stream * stream = user;
|
||||
switch (event) {
|
||||
case EVENT_MORE_DATA: {
|
||||
long got = 0;
|
||||
struct Buffer * b = (struct Buffer *)info;
|
||||
|
||||
if (stream->draining) {
|
||||
return;
|
||||
}
|
||||
|
||||
got = stream->data_callback(stream, stream->user_ptr, NULL, b->raw,
|
||||
b->frameCount);
|
||||
|
||||
stream->written += got;
|
||||
|
||||
if (got != (long)b->frameCount) {
|
||||
stream->draining = 1;
|
||||
/* set a marker so we are notified when the are done draining, that is,
|
||||
* when every frame has been played by android. */
|
||||
stream->context->klass.set_marker_position(stream->instance,
|
||||
stream->written);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case EVENT_UNDERRUN:
|
||||
ALOG("underrun in cubeb backend.");
|
||||
break;
|
||||
case EVENT_LOOP_END:
|
||||
assert(0 && "We don't support the loop feature of audiotrack.");
|
||||
break;
|
||||
case EVENT_MARKER:
|
||||
assert(stream->draining);
|
||||
stream->state_callback(stream, stream->user_ptr, CUBEB_STATE_DRAINED);
|
||||
break;
|
||||
case EVENT_NEW_POS:
|
||||
assert(
|
||||
0 &&
|
||||
"We don't support the setPositionUpdatePeriod feature of audiotrack.");
|
||||
break;
|
||||
case EVENT_BUFFER_END:
|
||||
assert(0 && "Should not happen.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* We are running on gingerbread if we found the gingerbread signature for
|
||||
* getMinFrameCount */
|
||||
static int
|
||||
audiotrack_version_is_gingerbread(cubeb * ctx)
|
||||
{
|
||||
return ctx->klass.get_min_frame_count_gingerbread != NULL;
|
||||
}
|
||||
|
||||
int
|
||||
audiotrack_get_min_frame_count(cubeb * ctx, cubeb_stream_params * params,
|
||||
int * min_frame_count)
|
||||
{
|
||||
status_t status;
|
||||
/* Recent Android have a getMinFrameCount method. */
|
||||
if (!audiotrack_version_is_gingerbread(ctx)) {
|
||||
status = ctx->klass.get_min_frame_count(
|
||||
min_frame_count, AUDIO_STREAM_TYPE_MUSIC, params->rate);
|
||||
} else {
|
||||
status = ctx->klass.get_min_frame_count_gingerbread(
|
||||
min_frame_count, AUDIO_STREAM_TYPE_MUSIC, params->rate);
|
||||
}
|
||||
if (status != 0) {
|
||||
ALOG("error getting the min frame count");
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
int
|
||||
audiotrack_init(cubeb ** context, char const * context_name)
|
||||
{
|
||||
cubeb * ctx;
|
||||
struct AudioTrack * c;
|
||||
|
||||
assert(context);
|
||||
*context = NULL;
|
||||
|
||||
ctx = calloc(1, sizeof(*ctx));
|
||||
assert(ctx);
|
||||
|
||||
/* If we use an absolute path here ("/system/lib/libmedia.so"), and on Android
|
||||
* 2.2, the dlopen succeeds, all the dlsym succeed, but a segfault happens on
|
||||
* the first call to a dlsym'ed function. Somehow this does not happen when
|
||||
* using only the name of the library. */
|
||||
ctx->library = dlopen("libmedia.so", RTLD_LAZY);
|
||||
if (!ctx->library) {
|
||||
ALOG("dlopen error: %s.", dlerror());
|
||||
free(ctx);
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
/* Recent Android first, then Gingerbread. */
|
||||
DLSYM_DLERROR("_ZN7android10AudioTrackC1EijiiijPFviPvS1_ES1_ii",
|
||||
ctx->klass.ctor, ctx->library);
|
||||
DLSYM_DLERROR("_ZN7android10AudioTrackD1Ev", ctx->klass.dtor, ctx->library);
|
||||
|
||||
DLSYM_DLERROR("_ZNK7android10AudioTrack7latencyEv", ctx->klass.latency,
|
||||
ctx->library);
|
||||
DLSYM_DLERROR("_ZNK7android10AudioTrack9initCheckEv", ctx->klass.check,
|
||||
ctx->library);
|
||||
|
||||
DLSYM_DLERROR("_ZN7android11AudioSystem21getOutputSamplingRateEPii",
|
||||
ctx->klass.get_output_samplingrate, ctx->library);
|
||||
|
||||
/* |getMinFrameCount| is available on gingerbread and ICS with different
|
||||
* signatures. */
|
||||
DLSYM_DLERROR(
|
||||
"_ZN7android10AudioTrack16getMinFrameCountEPi19audio_stream_type_tj",
|
||||
ctx->klass.get_min_frame_count, ctx->library);
|
||||
if (!ctx->klass.get_min_frame_count) {
|
||||
DLSYM_DLERROR("_ZN7android10AudioTrack16getMinFrameCountEPiij",
|
||||
ctx->klass.get_min_frame_count_gingerbread, ctx->library);
|
||||
}
|
||||
|
||||
DLSYM_DLERROR("_ZN7android10AudioTrack5startEv", ctx->klass.start,
|
||||
ctx->library);
|
||||
DLSYM_DLERROR("_ZN7android10AudioTrack5pauseEv", ctx->klass.pause,
|
||||
ctx->library);
|
||||
DLSYM_DLERROR("_ZN7android10AudioTrack11getPositionEPj",
|
||||
ctx->klass.get_position, ctx->library);
|
||||
DLSYM_DLERROR("_ZN7android10AudioTrack17setMarkerPositionEj",
|
||||
ctx->klass.set_marker_position, ctx->library);
|
||||
DLSYM_DLERROR("_ZN7android10AudioTrack9setVolumeEff", ctx->klass.set_volume,
|
||||
ctx->library);
|
||||
|
||||
/* check that we have a combination of symbol that makes sense */
|
||||
c = &ctx->klass;
|
||||
if (!(c->ctor && c->dtor && c->latency && c->check &&
|
||||
/* at least one way to get the minimum frame count to request. */
|
||||
(c->get_min_frame_count || c->get_min_frame_count_gingerbread) &&
|
||||
c->start && c->pause && c->get_position && c->set_marker_position)) {
|
||||
ALOG("Could not find all the symbols we need.");
|
||||
audiotrack_destroy(ctx);
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
ctx->ops = &audiotrack_ops;
|
||||
|
||||
*context = ctx;
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
char const *
|
||||
audiotrack_get_backend_id(cubeb * context)
|
||||
{
|
||||
return "audiotrack";
|
||||
}
|
||||
|
||||
static int
|
||||
audiotrack_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
|
||||
{
|
||||
assert(ctx && max_channels);
|
||||
|
||||
/* The android mixer handles up to two channels, see
|
||||
http://androidxref.com/4.2.2_r1/xref/frameworks/av/services/audioflinger/AudioFlinger.h#67
|
||||
*/
|
||||
*max_channels = 2;
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
audiotrack_get_min_latency(cubeb * ctx, cubeb_stream_params params,
|
||||
uint32_t * latency_ms)
|
||||
{
|
||||
/* We always use the lowest latency possible when using this backend (see
|
||||
* audiotrack_stream_init), so this value is not going to be used. */
|
||||
int r;
|
||||
|
||||
r = audiotrack_get_min_frame_count(ctx, ¶ms, (int *)latency_ms);
|
||||
if (r != CUBEB_OK) {
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
audiotrack_get_preferred_sample_rate(cubeb * ctx, uint32_t * rate)
|
||||
{
|
||||
status_t r;
|
||||
|
||||
r = ctx->klass.get_output_samplingrate((int32_t *)rate, 3 /* MUSIC */);
|
||||
|
||||
return r == 0 ? CUBEB_OK : CUBEB_ERROR;
|
||||
}
|
||||
|
||||
void
|
||||
audiotrack_destroy(cubeb * context)
|
||||
{
|
||||
assert(context);
|
||||
|
||||
dlclose(context->library);
|
||||
|
||||
free(context);
|
||||
}
|
||||
|
||||
int
|
||||
audiotrack_stream_init(cubeb * ctx, cubeb_stream ** stream,
|
||||
char const * stream_name, cubeb_devid input_device,
|
||||
cubeb_stream_params * input_stream_params,
|
||||
cubeb_devid output_device,
|
||||
cubeb_stream_params * output_stream_params,
|
||||
unsigned int latency, cubeb_data_callback data_callback,
|
||||
cubeb_state_callback state_callback, void * user_ptr)
|
||||
{
|
||||
cubeb_stream * stm;
|
||||
int32_t channels;
|
||||
uint32_t min_frame_count;
|
||||
|
||||
assert(ctx && stream);
|
||||
|
||||
assert(!input_stream_params && "not supported");
|
||||
if (input_device || output_device) {
|
||||
/* Device selection not yet implemented. */
|
||||
return CUBEB_ERROR_DEVICE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
if (output_stream_params->format == CUBEB_SAMPLE_FLOAT32LE ||
|
||||
output_stream_params->format == CUBEB_SAMPLE_FLOAT32BE) {
|
||||
return CUBEB_ERROR_INVALID_FORMAT;
|
||||
}
|
||||
|
||||
if (audiotrack_get_min_frame_count(ctx, output_stream_params,
|
||||
(int *)&min_frame_count)) {
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
stm = calloc(1, sizeof(*stm));
|
||||
assert(stm);
|
||||
|
||||
stm->context = ctx;
|
||||
stm->data_callback = data_callback;
|
||||
stm->state_callback = state_callback;
|
||||
stm->user_ptr = user_ptr;
|
||||
stm->params = *output_stream_params;
|
||||
|
||||
stm->instance = calloc(SIZE_AUDIOTRACK_INSTANCE, 1);
|
||||
(*(uint32_t *)((intptr_t)stm->instance + SIZE_AUDIOTRACK_INSTANCE - 4)) =
|
||||
0xbaadbaad;
|
||||
assert(stm->instance && "cubeb: EOM");
|
||||
|
||||
/* gingerbread uses old channel layout enum */
|
||||
if (audiotrack_version_is_gingerbread(ctx)) {
|
||||
channels = stm->params.channels == 2 ? AUDIO_CHANNEL_OUT_STEREO_Legacy
|
||||
: AUDIO_CHANNEL_OUT_MONO_Legacy;
|
||||
} else {
|
||||
channels = stm->params.channels == 2 ? AUDIO_CHANNEL_OUT_STEREO_ICS
|
||||
: AUDIO_CHANNEL_OUT_MONO_ICS;
|
||||
}
|
||||
|
||||
ctx->klass.ctor(stm->instance, AUDIO_STREAM_TYPE_MUSIC, stm->params.rate,
|
||||
AUDIO_FORMAT_PCM_16_BIT, channels, min_frame_count, 0,
|
||||
audiotrack_refill, stm, 0, 0);
|
||||
|
||||
assert((*(uint32_t *)((intptr_t)stm->instance + SIZE_AUDIOTRACK_INSTANCE -
|
||||
4)) == 0xbaadbaad);
|
||||
|
||||
if (ctx->klass.check(stm->instance)) {
|
||||
ALOG("stream not initialized properly.");
|
||||
audiotrack_stream_destroy(stm);
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
*stream = stm;
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
void
|
||||
audiotrack_stream_destroy(cubeb_stream * stream)
|
||||
{
|
||||
assert(stream->context);
|
||||
|
||||
stream->context->klass.dtor(stream->instance);
|
||||
|
||||
free(stream->instance);
|
||||
stream->instance = NULL;
|
||||
free(stream);
|
||||
}
|
||||
|
||||
int
|
||||
audiotrack_stream_start(cubeb_stream * stream)
|
||||
{
|
||||
assert(stream->instance);
|
||||
|
||||
stream->context->klass.start(stream->instance);
|
||||
stream->state_callback(stream, stream->user_ptr, CUBEB_STATE_STARTED);
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
int
|
||||
audiotrack_stream_stop(cubeb_stream * stream)
|
||||
{
|
||||
assert(stream->instance);
|
||||
|
||||
stream->context->klass.pause(stream->instance);
|
||||
stream->state_callback(stream, stream->user_ptr, CUBEB_STATE_STOPPED);
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
int
|
||||
audiotrack_stream_get_position(cubeb_stream * stream, uint64_t * position)
|
||||
{
|
||||
uint32_t p;
|
||||
|
||||
assert(stream->instance && position);
|
||||
stream->context->klass.get_position(stream->instance, &p);
|
||||
*position = p;
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
int
|
||||
audiotrack_stream_get_latency(cubeb_stream * stream, uint32_t * latency)
|
||||
{
|
||||
assert(stream->instance && latency);
|
||||
|
||||
/* Android returns the latency in ms, we want it in frames. */
|
||||
*latency = stream->context->klass.latency(stream->instance);
|
||||
/* with rate <= 96000, we won't overflow until 44.739 seconds of latency */
|
||||
*latency = (*latency * stream->params.rate) / 1000;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
audiotrack_stream_set_volume(cubeb_stream * stream, float volume)
|
||||
{
|
||||
status_t status;
|
||||
|
||||
status = stream->context->klass.set_volume(stream->instance, volume, volume);
|
||||
|
||||
if (status) {
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static struct cubeb_ops const audiotrack_ops = {
|
||||
.init = audiotrack_init,
|
||||
.get_backend_id = audiotrack_get_backend_id,
|
||||
.get_max_channel_count = audiotrack_get_max_channel_count,
|
||||
.get_min_latency = audiotrack_get_min_latency,
|
||||
.get_preferred_sample_rate = audiotrack_get_preferred_sample_rate,
|
||||
.enumerate_devices = NULL,
|
||||
.device_collection_destroy = NULL,
|
||||
.destroy = audiotrack_destroy,
|
||||
.stream_init = audiotrack_stream_init,
|
||||
.stream_destroy = audiotrack_stream_destroy,
|
||||
.stream_start = audiotrack_stream_start,
|
||||
.stream_stop = audiotrack_stream_stop,
|
||||
.stream_get_position = audiotrack_stream_get_position,
|
||||
.stream_get_latency = audiotrack_stream_get_latency,
|
||||
.stream_get_input_latency = NULL,
|
||||
.stream_set_volume = audiotrack_stream_set_volume,
|
||||
.stream_set_name = NULL,
|
||||
.stream_get_current_device = NULL,
|
||||
.stream_device_destroy = NULL,
|
||||
.stream_register_device_changed_callback = NULL,
|
||||
.register_device_collection_changed = NULL};
|
||||
2
3rdparty/cubeb/src/cubeb_jack.cpp
vendored
2
3rdparty/cubeb/src/cubeb_jack.cpp
vendored
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
#define _DEFAULT_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#ifndef __FreeBSD__
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||
#define _POSIX_SOURCE
|
||||
#endif
|
||||
#include "cubeb-internal.h"
|
||||
|
||||
369
3rdparty/cubeb/src/cubeb_kai.c
vendored
369
3rdparty/cubeb/src/cubeb_kai.c
vendored
@@ -1,369 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2015 Mozilla Foundation
|
||||
*
|
||||
* This program is made available under an ISC-style license. See the
|
||||
* accompanying file LICENSE for details.
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/fmutex.h>
|
||||
|
||||
#include <kai.h>
|
||||
|
||||
#include "cubeb-internal.h"
|
||||
#include "cubeb/cubeb.h"
|
||||
|
||||
/* We don't support more than 2 channels in KAI */
|
||||
#define MAX_CHANNELS 2
|
||||
|
||||
#define NBUFS 2
|
||||
#define FRAME_SIZE 2048
|
||||
|
||||
struct cubeb_stream_item {
|
||||
cubeb_stream * stream;
|
||||
};
|
||||
|
||||
static struct cubeb_ops const kai_ops;
|
||||
|
||||
struct cubeb {
|
||||
struct cubeb_ops const * ops;
|
||||
};
|
||||
|
||||
struct cubeb_stream {
|
||||
/* Note: Must match cubeb_stream layout in cubeb.c. */
|
||||
cubeb * context;
|
||||
void * user_ptr;
|
||||
/**/
|
||||
cubeb_stream_params params;
|
||||
cubeb_data_callback data_callback;
|
||||
cubeb_state_callback state_callback;
|
||||
|
||||
HKAI hkai;
|
||||
KAISPEC spec;
|
||||
uint64_t total_frames;
|
||||
float soft_volume;
|
||||
_fmutex mutex;
|
||||
float float_buffer[FRAME_SIZE * MAX_CHANNELS];
|
||||
};
|
||||
|
||||
static inline long
|
||||
frames_to_bytes(long frames, cubeb_stream_params params)
|
||||
{
|
||||
return frames * 2 * params.channels; /* 2 bytes per frame */
|
||||
}
|
||||
|
||||
static inline long
|
||||
bytes_to_frames(long bytes, cubeb_stream_params params)
|
||||
{
|
||||
return bytes / 2 / params.channels; /* 2 bytes per frame */
|
||||
}
|
||||
|
||||
static void
|
||||
kai_destroy(cubeb * ctx);
|
||||
|
||||
/*static*/ int
|
||||
kai_init(cubeb ** context, char const * context_name)
|
||||
{
|
||||
cubeb * ctx;
|
||||
|
||||
XASSERT(context);
|
||||
*context = NULL;
|
||||
|
||||
if (kaiInit(KAIM_AUTO))
|
||||
return CUBEB_ERROR;
|
||||
|
||||
ctx = calloc(1, sizeof(*ctx));
|
||||
XASSERT(ctx);
|
||||
|
||||
ctx->ops = &kai_ops;
|
||||
|
||||
*context = ctx;
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static char const *
|
||||
kai_get_backend_id(cubeb * ctx)
|
||||
{
|
||||
return "kai";
|
||||
}
|
||||
|
||||
static void
|
||||
kai_destroy(cubeb * ctx)
|
||||
{
|
||||
kaiDone();
|
||||
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
float_to_s16ne(int16_t * dst, float * src, size_t n)
|
||||
{
|
||||
long l;
|
||||
|
||||
while (n--) {
|
||||
l = lrintf(*src++ * 0x8000);
|
||||
if (l > 32767)
|
||||
l = 32767;
|
||||
if (l < -32768)
|
||||
l = -32768;
|
||||
*dst++ = (int16_t)l;
|
||||
}
|
||||
}
|
||||
|
||||
static ULONG APIENTRY
|
||||
kai_callback(PVOID cbdata, PVOID buffer, ULONG len)
|
||||
{
|
||||
cubeb_stream * stm = cbdata;
|
||||
void * p;
|
||||
long wanted_frames;
|
||||
long frames;
|
||||
float soft_volume;
|
||||
int elements = len / sizeof(int16_t);
|
||||
|
||||
p = stm->params.format == CUBEB_SAMPLE_FLOAT32NE ? stm->float_buffer : buffer;
|
||||
|
||||
wanted_frames = bytes_to_frames(len, stm->params);
|
||||
frames = stm->data_callback(stm, stm->user_ptr, NULL, p, wanted_frames);
|
||||
|
||||
_fmutex_request(&stm->mutex, 0);
|
||||
stm->total_frames += frames;
|
||||
soft_volume = stm->soft_volume;
|
||||
_fmutex_release(&stm->mutex);
|
||||
|
||||
if (frames < wanted_frames)
|
||||
stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_DRAINED);
|
||||
|
||||
if (stm->params.format == CUBEB_SAMPLE_FLOAT32NE)
|
||||
float_to_s16ne(buffer, p, elements);
|
||||
|
||||
if (soft_volume != -1.0f) {
|
||||
int16_t * b = buffer;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < elements; i++)
|
||||
*b++ *= soft_volume;
|
||||
}
|
||||
|
||||
return frames_to_bytes(frames, stm->params);
|
||||
}
|
||||
|
||||
static void
|
||||
kai_stream_destroy(cubeb_stream * stm);
|
||||
|
||||
static int
|
||||
kai_stream_init(cubeb * context, cubeb_stream ** stream,
|
||||
char const * stream_name, cubeb_devid input_device,
|
||||
cubeb_stream_params * input_stream_params,
|
||||
cubeb_devid output_device,
|
||||
cubeb_stream_params * output_stream_params,
|
||||
unsigned int latency, cubeb_data_callback data_callback,
|
||||
cubeb_state_callback state_callback, void * user_ptr)
|
||||
{
|
||||
cubeb_stream * stm;
|
||||
KAISPEC wanted_spec;
|
||||
|
||||
XASSERT(!input_stream_params && "not supported.");
|
||||
if (input_device || output_device) {
|
||||
/* Device selection not yet implemented. */
|
||||
return CUBEB_ERROR_DEVICE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
if (!output_stream_params)
|
||||
return CUBEB_ERROR_INVALID_PARAMETER;
|
||||
|
||||
// Loopback is unsupported
|
||||
if (output_stream_params->prefs & CUBEB_STREAM_PREF_LOOPBACK) {
|
||||
return CUBEB_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (output_stream_params->channels < 1 ||
|
||||
output_stream_params->channels > MAX_CHANNELS)
|
||||
return CUBEB_ERROR_INVALID_FORMAT;
|
||||
|
||||
XASSERT(context);
|
||||
XASSERT(stream);
|
||||
|
||||
*stream = NULL;
|
||||
|
||||
stm = calloc(1, sizeof(*stm));
|
||||
XASSERT(stm);
|
||||
|
||||
stm->context = context;
|
||||
stm->params = *output_stream_params;
|
||||
stm->data_callback = data_callback;
|
||||
stm->state_callback = state_callback;
|
||||
stm->user_ptr = user_ptr;
|
||||
stm->soft_volume = -1.0f;
|
||||
|
||||
if (_fmutex_create(&stm->mutex, 0)) {
|
||||
free(stm);
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
wanted_spec.usDeviceIndex = 0;
|
||||
wanted_spec.ulType = KAIT_PLAY;
|
||||
wanted_spec.ulBitsPerSample = BPS_16;
|
||||
wanted_spec.ulSamplingRate = stm->params.rate;
|
||||
wanted_spec.ulDataFormat = MCI_WAVE_FORMAT_PCM;
|
||||
wanted_spec.ulChannels = stm->params.channels;
|
||||
wanted_spec.ulNumBuffers = NBUFS;
|
||||
wanted_spec.ulBufferSize = frames_to_bytes(FRAME_SIZE, stm->params);
|
||||
wanted_spec.fShareable = TRUE;
|
||||
wanted_spec.pfnCallBack = kai_callback;
|
||||
wanted_spec.pCallBackData = stm;
|
||||
|
||||
if (kaiOpen(&wanted_spec, &stm->spec, &stm->hkai)) {
|
||||
_fmutex_close(&stm->mutex);
|
||||
free(stm);
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
*stream = stm;
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
kai_stream_destroy(cubeb_stream * stm)
|
||||
{
|
||||
kaiClose(stm->hkai);
|
||||
_fmutex_close(&stm->mutex);
|
||||
free(stm);
|
||||
}
|
||||
|
||||
static int
|
||||
kai_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
|
||||
{
|
||||
XASSERT(ctx && max_channels);
|
||||
|
||||
*max_channels = MAX_CHANNELS;
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
kai_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * latency)
|
||||
{
|
||||
/* We have at least two buffers. One is being played, the other one is being
|
||||
filled. So there is as much latency as one buffer. */
|
||||
*latency = FRAME_SIZE;
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
kai_get_preferred_sample_rate(cubeb * ctx, uint32_t * rate)
|
||||
{
|
||||
cubeb_stream_params params;
|
||||
KAISPEC wanted_spec;
|
||||
KAISPEC spec;
|
||||
HKAI hkai;
|
||||
|
||||
params.format = CUBEB_SAMPLE_S16NE;
|
||||
params.rate = 48000;
|
||||
params.channels = 2;
|
||||
|
||||
wanted_spec.usDeviceIndex = 0;
|
||||
wanted_spec.ulType = KAIT_PLAY;
|
||||
wanted_spec.ulBitsPerSample = BPS_16;
|
||||
wanted_spec.ulSamplingRate = params.rate;
|
||||
wanted_spec.ulDataFormat = MCI_WAVE_FORMAT_PCM;
|
||||
wanted_spec.ulChannels = params.channels;
|
||||
wanted_spec.ulNumBuffers = NBUFS;
|
||||
wanted_spec.ulBufferSize = frames_to_bytes(FRAME_SIZE, params);
|
||||
wanted_spec.fShareable = TRUE;
|
||||
wanted_spec.pfnCallBack = kai_callback;
|
||||
wanted_spec.pCallBackData = NULL;
|
||||
|
||||
/* Test 48KHz */
|
||||
if (kaiOpen(&wanted_spec, &spec, &hkai)) {
|
||||
/* Not supported. Fall back to 44.1KHz */
|
||||
params.rate = 44100;
|
||||
} else {
|
||||
/* Supported. Use 48KHz */
|
||||
kaiClose(hkai);
|
||||
}
|
||||
|
||||
*rate = params.rate;
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
kai_stream_start(cubeb_stream * stm)
|
||||
{
|
||||
if (kaiPlay(stm->hkai))
|
||||
return CUBEB_ERROR;
|
||||
|
||||
stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_STARTED);
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
kai_stream_stop(cubeb_stream * stm)
|
||||
{
|
||||
if (kaiStop(stm->hkai))
|
||||
return CUBEB_ERROR;
|
||||
|
||||
stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_STOPPED);
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
kai_stream_get_position(cubeb_stream * stm, uint64_t * position)
|
||||
{
|
||||
_fmutex_request(&stm->mutex, 0);
|
||||
*position = stm->total_frames;
|
||||
_fmutex_release(&stm->mutex);
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
kai_stream_get_latency(cubeb_stream * stm, uint32_t * latency)
|
||||
{
|
||||
/* Out of buffers, one is being played, the others are being filled.
|
||||
So there is as much latency as total buffers - 1. */
|
||||
*latency = bytes_to_frames(stm->spec.ulBufferSize, stm->params) *
|
||||
(stm->spec.ulNumBuffers - 1);
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
kai_stream_set_volume(cubeb_stream * stm, float volume)
|
||||
{
|
||||
_fmutex_request(&stm->mutex, 0);
|
||||
stm->soft_volume = volume;
|
||||
_fmutex_release(&stm->mutex);
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
static struct cubeb_ops const kai_ops = {
|
||||
/*.init =*/kai_init,
|
||||
/*.get_backend_id =*/kai_get_backend_id,
|
||||
/*.get_max_channel_count=*/kai_get_max_channel_count,
|
||||
/*.get_min_latency=*/kai_get_min_latency,
|
||||
/*.get_preferred_sample_rate =*/kai_get_preferred_sample_rate,
|
||||
/*.get_preferred_channel_layout =*/NULL,
|
||||
/*.enumerate_devices =*/NULL,
|
||||
/*.device_collection_destroy =*/NULL,
|
||||
/*.destroy =*/kai_destroy,
|
||||
/*.stream_init =*/kai_stream_init,
|
||||
/*.stream_destroy =*/kai_stream_destroy,
|
||||
/*.stream_start =*/kai_stream_start,
|
||||
/*.stream_stop =*/kai_stream_stop,
|
||||
/*.stream_get_position =*/kai_stream_get_position,
|
||||
/*.stream_get_latency = */ kai_stream_get_latency,
|
||||
/*.stream_get_input_latency = */ NULL,
|
||||
/*.stream_set_volume =*/kai_stream_set_volume,
|
||||
/*.stream_set_name =*/NULL,
|
||||
/*.stream_get_current_device =*/NULL,
|
||||
/*.stream_device_destroy =*/NULL,
|
||||
/*.stream_register_device_changed_callback=*/NULL,
|
||||
/*.register_device_collection_changed=*/NULL};
|
||||
128
3rdparty/cubeb/src/cubeb_log.cpp
vendored
128
3rdparty/cubeb/src/cubeb_log.cpp
vendored
@@ -16,8 +16,8 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
std::atomic<cubeb_log_level> g_cubeb_log_level;
|
||||
std::atomic<cubeb_log_callback> g_cubeb_log_callback;
|
||||
static std::atomic<cubeb_log_level> g_cubeb_log_level;
|
||||
static std::atomic<cubeb_log_callback> g_cubeb_log_callback;
|
||||
|
||||
/** The maximum size of a log message, after having been formatted. */
|
||||
const size_t CUBEB_LOG_MESSAGE_MAX_SIZE = 256;
|
||||
@@ -25,88 +25,12 @@ const size_t CUBEB_LOG_MESSAGE_MAX_SIZE = 256;
|
||||
* messages. */
|
||||
const size_t CUBEB_LOG_MESSAGE_QUEUE_DEPTH = 40;
|
||||
/** Number of milliseconds to wait before dequeuing log messages. */
|
||||
#define CUBEB_LOG_BATCH_PRINT_INTERVAL_MS 10
|
||||
const size_t CUBEB_LOG_BATCH_PRINT_INTERVAL_MS = 10;
|
||||
|
||||
/**
|
||||
* This wraps an inline buffer, that represents a log message, that must be
|
||||
* null-terminated.
|
||||
* This class should not use system calls or other potentially blocking code.
|
||||
*/
|
||||
class cubeb_log_message {
|
||||
public:
|
||||
cubeb_log_message() { *storage = '\0'; }
|
||||
cubeb_log_message(char const str[CUBEB_LOG_MESSAGE_MAX_SIZE])
|
||||
{
|
||||
size_t length = strlen(str);
|
||||
/* paranoia against malformed message */
|
||||
assert(length < CUBEB_LOG_MESSAGE_MAX_SIZE);
|
||||
if (length > CUBEB_LOG_MESSAGE_MAX_SIZE - 1) {
|
||||
return;
|
||||
}
|
||||
PodCopy(storage, str, length);
|
||||
storage[length] = '\0';
|
||||
}
|
||||
char const * get() { return storage; }
|
||||
|
||||
private:
|
||||
char storage[CUBEB_LOG_MESSAGE_MAX_SIZE];
|
||||
};
|
||||
|
||||
/** Lock-free asynchronous logger, made so that logging from a
|
||||
* real-time audio callback does not block the audio thread. */
|
||||
class cubeb_async_logger {
|
||||
public:
|
||||
/* This is thread-safe since C++11 */
|
||||
static cubeb_async_logger & get()
|
||||
{
|
||||
static cubeb_async_logger instance;
|
||||
return instance;
|
||||
}
|
||||
void push(char const str[CUBEB_LOG_MESSAGE_MAX_SIZE])
|
||||
{
|
||||
cubeb_log_message msg(str);
|
||||
msg_queue.enqueue(msg);
|
||||
}
|
||||
void run()
|
||||
{
|
||||
std::thread([this]() {
|
||||
CUBEB_REGISTER_THREAD("cubeb_log");
|
||||
while (true) {
|
||||
cubeb_log_message msg;
|
||||
while (msg_queue.dequeue(&msg, 1)) {
|
||||
cubeb_log_internal_no_format(msg.get());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
Sleep(CUBEB_LOG_BATCH_PRINT_INTERVAL_MS);
|
||||
#else
|
||||
timespec sleep_duration = sleep_for;
|
||||
timespec remainder;
|
||||
do {
|
||||
if (nanosleep(&sleep_duration, &remainder) == 0 || errno != EINTR) {
|
||||
break;
|
||||
}
|
||||
sleep_duration = remainder;
|
||||
} while (remainder.tv_sec || remainder.tv_nsec);
|
||||
#endif
|
||||
}
|
||||
CUBEB_UNREGISTER_THREAD();
|
||||
}).detach();
|
||||
}
|
||||
// Tell the underlying queue the producer thread has changed, so it does not
|
||||
// assert in debug. This should be called with the thread stopped.
|
||||
void reset_producer_thread() { msg_queue.reset_thread_ids(); }
|
||||
|
||||
private:
|
||||
#ifndef _WIN32
|
||||
const struct timespec sleep_for = {
|
||||
CUBEB_LOG_BATCH_PRINT_INTERVAL_MS / 1000,
|
||||
(CUBEB_LOG_BATCH_PRINT_INTERVAL_MS % 1000) * 1000 * 1000};
|
||||
#endif
|
||||
cubeb_async_logger() : msg_queue(CUBEB_LOG_MESSAGE_QUEUE_DEPTH) { run(); }
|
||||
/** This is quite a big data structure, but is only instantiated if the
|
||||
* asynchronous logger is used.*/
|
||||
lock_free_queue<cubeb_log_message> msg_queue;
|
||||
};
|
||||
void
|
||||
cubeb_noop_log_callback(char const * /* fmt */, ...)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cubeb_log_internal(char const * file, uint32_t line, char const * fmt, ...)
|
||||
@@ -115,8 +39,8 @@ cubeb_log_internal(char const * file, uint32_t line, char const * fmt, ...)
|
||||
va_start(args, fmt);
|
||||
char msg[CUBEB_LOG_MESSAGE_MAX_SIZE];
|
||||
vsnprintf(msg, CUBEB_LOG_MESSAGE_MAX_SIZE, fmt, args);
|
||||
g_cubeb_log_callback.load()("%s:%d:%s", file, line, msg);
|
||||
va_end(args);
|
||||
g_cubeb_log_callback.load()("%s:%d:%s", file, line, msg);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -125,34 +49,19 @@ cubeb_log_internal_no_format(const char * msg)
|
||||
g_cubeb_log_callback.load()(msg);
|
||||
}
|
||||
|
||||
void
|
||||
cubeb_async_log(char const * fmt, ...)
|
||||
{
|
||||
// This is going to copy a 256 bytes array around, which is fine.
|
||||
// We don't want to allocate memory here, because this is made to
|
||||
// be called from a real-time callback.
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
char msg[CUBEB_LOG_MESSAGE_MAX_SIZE];
|
||||
vsnprintf(msg, CUBEB_LOG_MESSAGE_MAX_SIZE, fmt, args);
|
||||
cubeb_async_logger::get().push(msg);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
cubeb_async_log_reset_threads(void)
|
||||
{
|
||||
if (!g_cubeb_log_callback) {
|
||||
return;
|
||||
}
|
||||
cubeb_async_logger::get().reset_producer_thread();
|
||||
}
|
||||
|
||||
void
|
||||
cubeb_log_set(cubeb_log_level log_level, cubeb_log_callback log_callback)
|
||||
{
|
||||
g_cubeb_log_level = log_level;
|
||||
g_cubeb_log_callback = log_callback;
|
||||
// Once a callback has a been set, `g_cubeb_log_callback` is never set back to
|
||||
// nullptr, to prevent a TOCTOU race between checking the pointer
|
||||
if (log_callback && log_level != CUBEB_LOG_DISABLED) {
|
||||
g_cubeb_log_callback = log_callback;
|
||||
} else if (!log_callback || CUBEB_LOG_DISABLED) {
|
||||
g_cubeb_log_callback = cubeb_noop_log_callback;
|
||||
} else {
|
||||
assert(false && "Incorrect parameters passed to cubeb_log_set");
|
||||
}
|
||||
}
|
||||
|
||||
cubeb_log_level
|
||||
@@ -164,5 +73,8 @@ cubeb_log_get_level()
|
||||
cubeb_log_callback
|
||||
cubeb_log_get_callback()
|
||||
{
|
||||
if (g_cubeb_log_callback == cubeb_noop_log_callback) {
|
||||
return nullptr;
|
||||
}
|
||||
return g_cubeb_log_callback;
|
||||
}
|
||||
|
||||
19
3rdparty/cubeb/src/cubeb_log.h
vendored
19
3rdparty/cubeb/src/cubeb_log.h
vendored
@@ -33,17 +33,13 @@ extern "C" {
|
||||
void
|
||||
cubeb_log_set(cubeb_log_level log_level, cubeb_log_callback log_callback);
|
||||
cubeb_log_level
|
||||
cubeb_log_get_level();
|
||||
cubeb_log_get_level(void);
|
||||
cubeb_log_callback
|
||||
cubeb_log_get_callback();
|
||||
cubeb_log_get_callback(void);
|
||||
void
|
||||
cubeb_log_internal_no_format(const char * msg);
|
||||
void
|
||||
cubeb_log_internal(const char * filename, uint32_t line, const char * fmt, ...);
|
||||
void
|
||||
cubeb_async_log(const char * fmt, ...);
|
||||
void
|
||||
cubeb_async_log_reset_threads(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@@ -59,16 +55,9 @@ cubeb_async_log_reset_threads(void);
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ALOG_INTERNAL(level, fmt, ...) \
|
||||
do { \
|
||||
if (cubeb_log_get_level() >= level && cubeb_log_get_callback()) { \
|
||||
cubeb_async_log(fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Asynchronous logging macros to log in real-time callbacks. */
|
||||
/* Should not be used on android due to the use of global/static variables. */
|
||||
#define ALOGV(msg, ...) ALOG_INTERNAL(CUBEB_LOG_VERBOSE, msg, ##__VA_ARGS__)
|
||||
#define ALOG(msg, ...) ALOG_INTERNAL(CUBEB_LOG_NORMAL, msg, ##__VA_ARGS__)
|
||||
#define ALOGV(msg, ...) LOG_INTERNAL(CUBEB_LOG_VERBOSE, msg, ##__VA_ARGS__)
|
||||
#define ALOG(msg, ...) LOG_INTERNAL(CUBEB_LOG_NORMAL, msg, ##__VA_ARGS__)
|
||||
|
||||
#endif // CUBEB_LOG
|
||||
|
||||
2
3rdparty/cubeb/src/cubeb_mixer.cpp
vendored
2
3rdparty/cubeb/src/cubeb_mixer.cpp
vendored
@@ -183,7 +183,7 @@ MixerContext::auto_matrix()
|
||||
{
|
||||
double matrix[NUM_NAMED_CHANNELS][NUM_NAMED_CHANNELS] = {{0}};
|
||||
double maxcoef = 0;
|
||||
float maxval;
|
||||
double maxval;
|
||||
|
||||
cubeb_channel_layout in_ch_layout = clean_layout(_in_ch_layout);
|
||||
cubeb_channel_layout out_ch_layout = clean_layout(_out_ch_layout);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user