mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
Compare commits
1912 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b0655b9d9 | ||
|
|
de020978e4 | ||
|
|
75defbeded | ||
|
|
294bb4d4f2 | ||
|
|
81c35d1c49 | ||
|
|
d057b0fa79 | ||
|
|
c68222d9ac | ||
|
|
d68f1aa73a | ||
|
|
e2a126722f | ||
|
|
fdcb0efe0a | ||
|
|
51fcd7b886 | ||
|
|
7420956136 | ||
|
|
a2aae7fb45 | ||
|
|
93abd2f2e5 | ||
|
|
c127d23d75 | ||
|
|
404824e69e | ||
|
|
06c9c60717 | ||
|
|
28f7860af0 | ||
|
|
05a7a5bdad | ||
|
|
9781d29768 | ||
|
|
8543e87b19 | ||
|
|
b2062c93d9 | ||
|
|
30b6641025 | ||
|
|
a52f823500 | ||
|
|
10a7fe07a2 | ||
|
|
defb50aac2 | ||
|
|
84e36463b4 | ||
|
|
48d88c5fea | ||
|
|
dbfd506c8a | ||
|
|
d47cdfba2d | ||
|
|
a0b42f069f | ||
|
|
c7e516b743 | ||
|
|
315d30fe4c | ||
|
|
46e30467de | ||
|
|
e7139ab801 | ||
|
|
3f952c88a4 | ||
|
|
bed31d3903 | ||
|
|
5ff35927a7 | ||
|
|
f6ce7b9ede | ||
|
|
7ab494ca31 | ||
|
|
b5258a83c8 | ||
|
|
2ce9dd4689 | ||
|
|
bb67ed3ded | ||
|
|
a483aca361 | ||
|
|
44038adaf8 | ||
|
|
d3bcfe0f5c | ||
|
|
6600d09966 | ||
|
|
3cfd4a7958 | ||
|
|
51917c4461 | ||
|
|
56f32ff332 | ||
|
|
a7047b605e | ||
|
|
faa54f6c14 | ||
|
|
b38d008a96 | ||
|
|
cd300c21d9 | ||
|
|
5b45913a6a | ||
|
|
1627bd6cc7 | ||
|
|
7f0ab1442e | ||
|
|
71cb2daea8 | ||
|
|
63619ef40f | ||
|
|
baec86e39b | ||
|
|
fbac331528 | ||
|
|
a00cb49035 | ||
|
|
ba73a4cf3f | ||
|
|
f8ab3843f7 | ||
|
|
107c117a4e | ||
|
|
c44500ba0f | ||
|
|
d53b2ae104 | ||
|
|
f909282973 | ||
|
|
46931072c7 | ||
|
|
9225fa9efd | ||
|
|
46f37f3b45 | ||
|
|
8e891b0c5a | ||
|
|
fc4bdfd025 | ||
|
|
7e53cb8e99 | ||
|
|
3040474f99 | ||
|
|
02ef8098c9 | ||
|
|
4924d8c984 | ||
|
|
57d225437e | ||
|
|
f6a7dc52e2 | ||
|
|
ec8d5d1b71 | ||
|
|
f47b2d02cb | ||
|
|
32721f9f8f | ||
|
|
27e2138d6c | ||
|
|
512ab67efc | ||
|
|
9d66c8b1a1 | ||
|
|
a132a6f979 | ||
|
|
6fc631eaba | ||
|
|
915ed85f5d | ||
|
|
2c9ddf3b38 | ||
|
|
1d4d75fda0 | ||
|
|
dda6e37bd0 | ||
|
|
a4ffc6c457 | ||
|
|
5e9b31d243 | ||
|
|
97bb270a2b | ||
|
|
2bbb167541 | ||
|
|
74ea27817d | ||
|
|
779b175567 | ||
|
|
e252bcf425 | ||
|
|
bdc3585b60 | ||
|
|
ce7ee345c7 | ||
|
|
2fc6357ac4 | ||
|
|
1d46ec2059 | ||
|
|
839a6daa63 | ||
|
|
ae57878b27 | ||
|
|
eb5f90027d | ||
|
|
c077d9e2e1 | ||
|
|
55e0464cd3 | ||
|
|
e843e17403 | ||
|
|
6195c1a3ac | ||
|
|
a507d55467 | ||
|
|
807050db0d | ||
|
|
d626028203 | ||
|
|
f565da6c58 | ||
|
|
8f72c4f4a6 | ||
|
|
9c45567d8d | ||
|
|
ab2874749e | ||
|
|
8766d0b676 | ||
|
|
b1f051df40 | ||
|
|
707d61f54d | ||
|
|
4e3431585f | ||
|
|
6fcd5d0aff | ||
|
|
9c57ac34e3 | ||
|
|
e6714db7b3 | ||
|
|
21df138833 | ||
|
|
36f9715637 | ||
|
|
a0d32d493c | ||
|
|
f3776fa886 | ||
|
|
de7d934a05 | ||
|
|
8917c5dbc9 | ||
|
|
6aa57b7e87 | ||
|
|
6a37353565 | ||
|
|
bf50bad287 | ||
|
|
7aea867a66 | ||
|
|
abec2738b9 | ||
|
|
480bd2da4b | ||
|
|
774f68936d | ||
|
|
99a30733c1 | ||
|
|
62c5309b23 | ||
|
|
8a18403fea | ||
|
|
fe9399612d | ||
|
|
0a4c037898 | ||
|
|
71036c95a4 | ||
|
|
7d098674f2 | ||
|
|
4e0e8cef54 | ||
|
|
6ee99d8b81 | ||
|
|
22d929d171 | ||
|
|
122f1ec767 | ||
|
|
04d7d1a1db | ||
|
|
3c69d5cf70 | ||
|
|
e03e8b602c | ||
|
|
cc7b58eef0 | ||
|
|
a703076720 | ||
|
|
21897414ac | ||
|
|
1a286b0bec | ||
|
|
94fc34dd62 | ||
|
|
4731c6d290 | ||
|
|
153b492a79 | ||
|
|
ccb23868e5 | ||
|
|
affbcfe135 | ||
|
|
bdeb0fcb76 | ||
|
|
08e824831b | ||
|
|
d2f101c7d7 | ||
|
|
0717b1f7c0 | ||
|
|
7ad27e6e9d | ||
|
|
e1596c7911 | ||
|
|
8a3513f2ba | ||
|
|
d43171454b | ||
|
|
e5917fa47a | ||
|
|
5ee751326a | ||
|
|
226a02a770 | ||
|
|
8cc7e60138 | ||
|
|
5c59288b39 | ||
|
|
d6c4a9a4d5 | ||
|
|
08975bd9f1 | ||
|
|
cf475d961a | ||
|
|
cb0f0b65cc | ||
|
|
28734a65dc | ||
|
|
cc7313bf32 | ||
|
|
b011e91abd | ||
|
|
e2a4d8f1e6 | ||
|
|
b55ec3ae58 | ||
|
|
6220148be7 | ||
|
|
919da4d97a | ||
|
|
ac38a350a0 | ||
|
|
4f5562ad3f | ||
|
|
37df1adff6 | ||
|
|
7878dee32d | ||
|
|
a95288946c | ||
|
|
58ae9fd355 | ||
|
|
d34f359621 | ||
|
|
986a9773e6 | ||
|
|
7d530228e3 | ||
|
|
1ec4c248fb | ||
|
|
91fbf1b22e | ||
|
|
5e858fa1bc | ||
|
|
f771b0f29c | ||
|
|
3c15f6e42f | ||
|
|
0522da2299 | ||
|
|
877c3ee90d | ||
|
|
9e1acc5744 | ||
|
|
bc9edb5387 | ||
|
|
8625e30dc6 | ||
|
|
af8fdae75e | ||
|
|
7de06e340b | ||
|
|
4c8e42d801 | ||
|
|
834f12dd55 | ||
|
|
6d67156707 | ||
|
|
4faa5f2095 | ||
|
|
69c2c53ca7 | ||
|
|
d48f527d6d | ||
|
|
f2e4a5e780 | ||
|
|
c44659d3ab | ||
|
|
ee9866b568 | ||
|
|
f58ee161c7 | ||
|
|
0856f3b223 | ||
|
|
3acf898680 | ||
|
|
38f02de318 | ||
|
|
a6ddbdb879 | ||
|
|
3aff833b5c | ||
|
|
344cf6fffb | ||
|
|
8f1b804f98 | ||
|
|
226cf2d21d | ||
|
|
ecbe239c0b | ||
|
|
18665b81c4 | ||
|
|
525a7c48e9 | ||
|
|
521038984a | ||
|
|
94bd7c96b9 | ||
|
|
e863da9490 | ||
|
|
c94282ce5f | ||
|
|
d94f1dd9a3 | ||
|
|
5dc1167fa8 | ||
|
|
9187e7eb34 | ||
|
|
2d127039e1 | ||
|
|
3928014e5c | ||
|
|
c7a21a60cf | ||
|
|
82fbf34f5b | ||
|
|
256babd337 | ||
|
|
99e38bc458 | ||
|
|
68bbc2cc92 | ||
|
|
63a5a15c37 | ||
|
|
19d5d5c485 | ||
|
|
4fe5064b8c | ||
|
|
0ea98d6edb | ||
|
|
92b707db99 | ||
|
|
d765f2e15c | ||
|
|
b512162956 | ||
|
|
e24d97bbe4 | ||
|
|
fb4aaf5236 | ||
|
|
8d0af30e0e | ||
|
|
06efa93070 | ||
|
|
8d3617bb71 | ||
|
|
ef2549edb1 | ||
|
|
c5511d0afa | ||
|
|
68eed55490 | ||
|
|
2d79b89acc | ||
|
|
9242da96f2 | ||
|
|
932474a7d6 | ||
|
|
115d83a02e | ||
|
|
2e882dfabc | ||
|
|
ff7995f0d6 | ||
|
|
f11ef37745 | ||
|
|
9044f54353 | ||
|
|
475bd6ee7d | ||
|
|
086bbf95dc | ||
|
|
4536daa5f8 | ||
|
|
570039f49a | ||
|
|
c6b55e5aa3 | ||
|
|
7683674585 | ||
|
|
81f1102809 | ||
|
|
ebb315ab6f | ||
|
|
f0b8895350 | ||
|
|
4134e7a7e0 | ||
|
|
39a493f7d3 | ||
|
|
70b709a675 | ||
|
|
31e935d831 | ||
|
|
34ae500614 | ||
|
|
2cead675bb | ||
|
|
a6f7159537 | ||
|
|
d099f7afd6 | ||
|
|
7587bb8a07 | ||
|
|
29e9125b15 | ||
|
|
f0ae33d61e | ||
|
|
89c4e2c1a4 | ||
|
|
431b8b0df6 | ||
|
|
e8e84d160b | ||
|
|
3fd1eabdb8 | ||
|
|
21c46b778e | ||
|
|
55ee8242cc | ||
|
|
967a41c035 | ||
|
|
75894501ee | ||
|
|
39b29b3542 | ||
|
|
25bc75a468 | ||
|
|
12a0644315 | ||
|
|
9fac941570 | ||
|
|
81203d9a15 | ||
|
|
5d50cd562f | ||
|
|
49a17b3a2e | ||
|
|
cfecbf53aa | ||
|
|
3a0b26225d | ||
|
|
0628e8cc87 | ||
|
|
6545c62d26 | ||
|
|
c573c00eb0 | ||
|
|
f084e76f36 | ||
|
|
b9d7b63b32 | ||
|
|
4d67f71217 | ||
|
|
4b1a4fdbb9 | ||
|
|
a0bc8e0ff8 | ||
|
|
7166c04ff2 | ||
|
|
1483e4f88e | ||
|
|
454d4c9fa0 | ||
|
|
8887930fd5 | ||
|
|
c8047c1a61 | ||
|
|
566ea8ea9b | ||
|
|
67f1d6e24b | ||
|
|
e520dc2605 | ||
|
|
b9f4a01138 | ||
|
|
aeff832ffc | ||
|
|
3cb12cce84 | ||
|
|
fc2a750f85 | ||
|
|
e3ccb500d8 | ||
|
|
0aea297b73 | ||
|
|
20dbcfd2eb | ||
|
|
ba7096c9fa | ||
|
|
4cc4a6561c | ||
|
|
95843dc84a | ||
|
|
fdb751ed1a | ||
|
|
612c24e0c0 | ||
|
|
da9e3fdc32 | ||
|
|
58defda298 | ||
|
|
8b9b7f7baf | ||
|
|
8ad08706aa | ||
|
|
4035f1c554 | ||
|
|
f0c331e32b | ||
|
|
43fb79d669 | ||
|
|
a4cc42c6ad | ||
|
|
2e89f6ad4d | ||
|
|
9b03b236fe | ||
|
|
052951fbb0 | ||
|
|
e53abb1989 | ||
|
|
dc20521b01 | ||
|
|
4081d07dd8 | ||
|
|
85888a9a81 | ||
|
|
d7101c3be5 | ||
|
|
b3bb40980e | ||
|
|
cf3ad3f855 | ||
|
|
c6e7e15599 | ||
|
|
a0f6036337 | ||
|
|
2fc4d02dd6 | ||
|
|
c6cd6b5eb3 | ||
|
|
5f7e97c27c | ||
|
|
49d5e69e70 | ||
|
|
7bc5427908 | ||
|
|
1881139b0a | ||
|
|
339dc2313b | ||
|
|
9752a037be | ||
|
|
d8cd336674 | ||
|
|
7264e397e2 | ||
|
|
3114332c89 | ||
|
|
f67611cbe6 | ||
|
|
11264e6c08 | ||
|
|
89749f2206 | ||
|
|
6630783686 | ||
|
|
90338ed065 | ||
|
|
89f4ac9b9a | ||
|
|
2ab6a3b873 | ||
|
|
12af031193 | ||
|
|
ddd2018e81 | ||
|
|
8d9c89a871 | ||
|
|
e48c68d80f | ||
|
|
0ccf8a7775 | ||
|
|
63e6248fd3 | ||
|
|
8d678c6c6f | ||
|
|
0f5e7355ff | ||
|
|
ca091eeea9 | ||
|
|
ca8a837614 | ||
|
|
dceac5372a | ||
|
|
7fae0f499f | ||
|
|
964dcfcb0a | ||
|
|
8bfcbdebf3 | ||
|
|
ce734f8a0d | ||
|
|
b67b555617 | ||
|
|
29b886eafb | ||
|
|
fd81349dab | ||
|
|
09ea13df55 | ||
|
|
ff3fc9b362 | ||
|
|
3b63445f07 | ||
|
|
999f0cc84f | ||
|
|
04957b6bda | ||
|
|
df6a33ef7c | ||
|
|
8f57d8afe0 | ||
|
|
4c24d96966 | ||
|
|
8a7d5bc417 | ||
|
|
e46d435d28 | ||
|
|
c03cffb5c2 | ||
|
|
40c7982dcf | ||
|
|
fd0c82c04a | ||
|
|
8e5b84b097 | ||
|
|
e862e68192 | ||
|
|
46f6e691e0 | ||
|
|
5f7c2b7cd8 | ||
|
|
4363255234 | ||
|
|
d1e9a5265d | ||
|
|
a485398029 | ||
|
|
33556c70f2 | ||
|
|
ba16a90290 | ||
|
|
894f2f145c | ||
|
|
56b06a0495 | ||
|
|
fe4693f158 | ||
|
|
f5de7da42f | ||
|
|
107a3fda44 | ||
|
|
e734eb415c | ||
|
|
aa48256010 | ||
|
|
77a03498c1 | ||
|
|
1cf8c7c375 | ||
|
|
f5276f13ae | ||
|
|
d63966b071 | ||
|
|
b01871aea8 | ||
|
|
f5c3cd0f87 | ||
|
|
85a33971e7 | ||
|
|
4e79e85f3f | ||
|
|
a0e323dae5 | ||
|
|
25737a1a46 | ||
|
|
6816f640e2 | ||
|
|
c831f5759f | ||
|
|
9f1483f01b | ||
|
|
ece89051bd | ||
|
|
e768f1c93b | ||
|
|
56cd7f2259 | ||
|
|
a14d699f28 | ||
|
|
d48c3cfce5 | ||
|
|
550da21015 | ||
|
|
98eda97bd2 | ||
|
|
a2439d120e | ||
|
|
0ca816d030 | ||
|
|
b44d479921 | ||
|
|
0acc91403d | ||
|
|
d6a29d483c | ||
|
|
6d25c6b1ef | ||
|
|
c5604472f6 | ||
|
|
59d7a36068 | ||
|
|
500b31eab0 | ||
|
|
cd907584ee | ||
|
|
5af5fe8387 | ||
|
|
346823f7c2 | ||
|
|
fc712a0724 | ||
|
|
e97fc40dec | ||
|
|
e99fc5c3a8 | ||
|
|
a00056599c | ||
|
|
ccd6f91c66 | ||
|
|
3d11057177 | ||
|
|
fe0e71f586 | ||
|
|
d824ae6e0c | ||
|
|
4e06d51a00 | ||
|
|
5a91ecd16a | ||
|
|
7dd7345e08 | ||
|
|
7e1900a8a1 | ||
|
|
cbecda8850 | ||
|
|
b9cc65704e | ||
|
|
49c6f5e866 | ||
|
|
bdd0f7e2f4 | ||
|
|
1e094096c2 | ||
|
|
6d8a906605 | ||
|
|
f75a0df449 | ||
|
|
f16ce3bdbe | ||
|
|
a38dd74d0e | ||
|
|
2a2dad9280 | ||
|
|
0b5a3fa6af | ||
|
|
3fea71731f | ||
|
|
c0b36a482a | ||
|
|
a9311142dc | ||
|
|
3c901543bd | ||
|
|
410e950da6 | ||
|
|
815e5d952d | ||
|
|
8723513528 | ||
|
|
6eab82ecc0 | ||
|
|
f09e99fb05 | ||
|
|
ed8e1aa6db | ||
|
|
8e8581cb15 | ||
|
|
b5472c1b51 | ||
|
|
14b2335c54 | ||
|
|
b94a232b31 | ||
|
|
79a882d18b | ||
|
|
d98b7d9505 | ||
|
|
5351a6a64a | ||
|
|
850845ea44 | ||
|
|
55907bf310 | ||
|
|
83bf215ead | ||
|
|
070068366f | ||
|
|
ee07b71a62 | ||
|
|
5219f52130 | ||
|
|
2157a7ed0b | ||
|
|
888f3d8499 | ||
|
|
e027874468 | ||
|
|
a1ec590bf8 | ||
|
|
35525d5304 | ||
|
|
9fdd609add | ||
|
|
9fa409a1a9 | ||
|
|
ece20b1307 | ||
|
|
ff0b748d58 | ||
|
|
c746a3c4e6 | ||
|
|
b1aa82db18 | ||
|
|
f6e08f3cc2 | ||
|
|
fbfdf1200d | ||
|
|
1cd4ba2698 | ||
|
|
17e0d9fcbe | ||
|
|
91b0b16b35 | ||
|
|
b86c72732f | ||
|
|
91f16ae45a | ||
|
|
272c0369f1 | ||
|
|
c0a6e21599 | ||
|
|
6d478021f9 | ||
|
|
5e1009b4fb | ||
|
|
c3c602b5a4 | ||
|
|
18e484f766 | ||
|
|
82bd9bbd6c | ||
|
|
5271e83824 | ||
|
|
52ddb0efd9 | ||
|
|
7903c7c17e | ||
|
|
8a14552e56 | ||
|
|
569b93da51 | ||
|
|
889af7cf17 | ||
|
|
d685a7f2fe | ||
|
|
9849992cfd | ||
|
|
30f4e77b31 | ||
|
|
b1f4f67130 | ||
|
|
dcdb39026c | ||
|
|
14a1d7a608 | ||
|
|
eafdd8bc76 | ||
|
|
72e8ba2203 | ||
|
|
fdb29a3a09 | ||
|
|
c8698dac79 | ||
|
|
25726d2aef | ||
|
|
ec3f1b2aa4 | ||
|
|
291ce2cbb0 | ||
|
|
49c199e7e8 | ||
|
|
e6ff49eb60 | ||
|
|
8890e5948b | ||
|
|
651e9a7f9c | ||
|
|
caf0ade6f3 | ||
|
|
431b2c5b83 | ||
|
|
ebf0cf91b6 | ||
|
|
590b81a782 | ||
|
|
6808db1cde | ||
|
|
dfa5fccec9 | ||
|
|
d5290e93a8 | ||
|
|
056a8d0274 | ||
|
|
da7284f185 | ||
|
|
434001d4a3 | ||
|
|
14ad8014e2 | ||
|
|
dd82ee532c | ||
|
|
29a961a407 | ||
|
|
7066369887 | ||
|
|
efa8f058d4 | ||
|
|
f8b18d406f | ||
|
|
332be6c771 | ||
|
|
81502e6c7d | ||
|
|
b06da6607b | ||
|
|
f3d6249cc1 | ||
|
|
c16ac2034c | ||
|
|
c5dfc5d5da | ||
|
|
2693bbff95 | ||
|
|
8e008288b6 | ||
|
|
effdfd5a22 | ||
|
|
8a73f98b1f | ||
|
|
553ad0a372 | ||
|
|
088ba4e2ea | ||
|
|
1cd69977e4 | ||
|
|
69349e9d38 | ||
|
|
aeb3cb0945 | ||
|
|
c729a6f91c | ||
|
|
f3a75f55e7 | ||
|
|
8dce187746 | ||
|
|
fce8317da7 | ||
|
|
64a471b5a2 | ||
|
|
c9fdd0197f | ||
|
|
c650b4b00f | ||
|
|
64b6dec56f | ||
|
|
4d531384e9 | ||
|
|
085699f9de | ||
|
|
9de38e50e2 | ||
|
|
545fbdeed1 | ||
|
|
a959d33f85 | ||
|
|
00b2ad49d5 | ||
|
|
872f5c677d | ||
|
|
ad81318854 | ||
|
|
907ae642d0 | ||
|
|
299fd3d5ad | ||
|
|
4dca6c3bb2 | ||
|
|
615e30fa52 | ||
|
|
8679755d18 | ||
|
|
11ee0a8613 | ||
|
|
7ddf6386f1 | ||
|
|
253e02b4c1 | ||
|
|
b2b7fa36bb | ||
|
|
cf1f2d6919 | ||
|
|
9c320a90db | ||
|
|
5be4326626 | ||
|
|
0384d9c29f | ||
|
|
aa82789132 | ||
|
|
2eab0f9757 | ||
|
|
a317e9c038 | ||
|
|
b644f85f51 | ||
|
|
ee3b6e59eb | ||
|
|
0917d49a01 | ||
|
|
0d61f154d7 | ||
|
|
d6e3eccf45 | ||
|
|
e9ac262cd3 | ||
|
|
68a71d2e12 | ||
|
|
478033037f | ||
|
|
059ec49389 | ||
|
|
d0f070bf97 | ||
|
|
452f9e4b50 | ||
|
|
2a6d71cd5a | ||
|
|
4ba43b8496 | ||
|
|
9e42bf7385 | ||
|
|
4ace75151f | ||
|
|
f416fd7a9e | ||
|
|
e20984a5f7 | ||
|
|
18e3a9987e | ||
|
|
fb1a5eab7e | ||
|
|
8ae01f642f | ||
|
|
20fa3b6af9 | ||
|
|
a462c914fc | ||
|
|
60cb78577f | ||
|
|
e8ad355a90 | ||
|
|
0a161f9591 | ||
|
|
234acf5ca2 | ||
|
|
7689729d9b | ||
|
|
6177825939 | ||
|
|
a74a236654 | ||
|
|
93a1ae9f2f | ||
|
|
3f4d9fd23c | ||
|
|
23d98e9352 | ||
|
|
8f381a4e16 | ||
|
|
7e43448110 | ||
|
|
3ca9680c88 | ||
|
|
6f1048d6fd | ||
|
|
6d92cee5bb | ||
|
|
d1bff18e0c | ||
|
|
4d2b2e5803 | ||
|
|
bfef8397d6 | ||
|
|
886a368297 | ||
|
|
73d617fb72 | ||
|
|
3a2888a5d5 | ||
|
|
97237c963f | ||
|
|
f2b3db9cbc | ||
|
|
7a547e64c4 | ||
|
|
6a5ac4fe54 | ||
|
|
500e86c43c | ||
|
|
0900c2fd8b | ||
|
|
58628b8dd3 | ||
|
|
71376ff4e6 | ||
|
|
fff4aea076 | ||
|
|
6c9f132093 | ||
|
|
3b7ad788bf | ||
|
|
867afd7da0 | ||
|
|
c4bfdc4506 | ||
|
|
a7c5eebf99 | ||
|
|
a2a6a98635 | ||
|
|
d309e24e60 | ||
|
|
7abbdf89af | ||
|
|
4720f69b76 | ||
|
|
515cbc7b29 | ||
|
|
b4992856f7 | ||
|
|
74df63ff94 | ||
|
|
52ac8f0d7b | ||
|
|
760ea91cc1 | ||
|
|
2324922111 | ||
|
|
1cfc2780d0 | ||
|
|
c0e47767b7 | ||
|
|
65649b3cbb | ||
|
|
d28ba0e53c | ||
|
|
4fef86a635 | ||
|
|
b16bb14c58 | ||
|
|
36278b6aae | ||
|
|
88165ab072 | ||
|
|
5337e46f43 | ||
|
|
7ed6801101 | ||
|
|
162354decf | ||
|
|
483c7f41de | ||
|
|
46e039dab2 | ||
|
|
4d23410b99 | ||
|
|
88192adfd0 | ||
|
|
e3c745cf9b | ||
|
|
e5de4c8f10 | ||
|
|
511cb0c322 | ||
|
|
688306dd9c | ||
|
|
d39e655fa2 | ||
|
|
812a3c1123 | ||
|
|
244a8775dd | ||
|
|
5e28c2608a | ||
|
|
bd032bbcb8 | ||
|
|
875fdc40a5 | ||
|
|
0ae3cbf4d6 | ||
|
|
b9a7143dee | ||
|
|
ef9cbf6be8 | ||
|
|
a903387182 | ||
|
|
4919f9b18c | ||
|
|
b07b56fce6 | ||
|
|
3a8845dc6f | ||
|
|
de64f784e8 | ||
|
|
f2a614913d | ||
|
|
6b54094e26 | ||
|
|
4442ff7221 | ||
|
|
19c3dd8419 | ||
|
|
9c9d2b7c9c | ||
|
|
f00f0cc846 | ||
|
|
78b6323272 | ||
|
|
a272d99335 | ||
|
|
ce5e66a2d5 | ||
|
|
1f584736f1 | ||
|
|
645dc3fa9d | ||
|
|
96a72286b7 | ||
|
|
d3c97bedb9 | ||
|
|
e6303cef9e | ||
|
|
5b5e11828f | ||
|
|
84972d2548 | ||
|
|
76be30f5c8 | ||
|
|
689a512f5d | ||
|
|
f81d555f7e | ||
|
|
83376d3f3b | ||
|
|
ea00a89cff | ||
|
|
418a97a02a | ||
|
|
d2830b77ec | ||
|
|
dcb60c785f | ||
|
|
987dd805c2 | ||
|
|
45421a9f96 | ||
|
|
71c8ad605f | ||
|
|
e1fc414691 | ||
|
|
dc68da4236 | ||
|
|
8dc16827ea | ||
|
|
6e7c6c205c | ||
|
|
734cfb8966 | ||
|
|
43c85f22c3 | ||
|
|
85e899b92c | ||
|
|
941a8832bf | ||
|
|
8ae111add3 | ||
|
|
88672dc38f | ||
|
|
dccba86dde | ||
|
|
a7bced02da | ||
|
|
a654e2ac43 | ||
|
|
56b54e0e17 | ||
|
|
8ffd920700 | ||
|
|
b6f67a7a6e | ||
|
|
9308410e12 | ||
|
|
65882ae14d | ||
|
|
0f533ec16c | ||
|
|
0c708e8c1e | ||
|
|
2693544faa | ||
|
|
2e95e59f40 | ||
|
|
72bc826907 | ||
|
|
21440c31f4 | ||
|
|
3e225d78fa | ||
|
|
5464463ab0 | ||
|
|
9c9bae7443 | ||
|
|
9d69a0ad54 | ||
|
|
4b88256df2 | ||
|
|
bc7b0e53f0 | ||
|
|
3695862368 | ||
|
|
18ae23b99d | ||
|
|
bb60058fa0 | ||
|
|
1ad25605d1 | ||
|
|
9809265be4 | ||
|
|
63872e6b28 | ||
|
|
fb3a9eae9b | ||
|
|
f53c3050df | ||
|
|
67bd0dfcdb | ||
|
|
12196359f7 | ||
|
|
609165e412 | ||
|
|
41f14a8cf8 | ||
|
|
a8bdd3fbfc | ||
|
|
993ec82a9e | ||
|
|
c5a2844367 | ||
|
|
e5bb405b47 | ||
|
|
8c9a65d094 | ||
|
|
047b8593ac | ||
|
|
4fc4eb8a66 | ||
|
|
1f95a86f0a | ||
|
|
2b90451c4a | ||
|
|
77a6525556 | ||
|
|
5eacab387d | ||
|
|
ddaf57d5b0 | ||
|
|
1144c46109 | ||
|
|
850b839fc3 | ||
|
|
22037e75ba | ||
|
|
303ab163ab | ||
|
|
2833537167 | ||
|
|
1aa7b591b6 | ||
|
|
2f0463d936 | ||
|
|
82a1ec0c3a | ||
|
|
d65133451d | ||
|
|
36e81949e0 | ||
|
|
6b62945632 | ||
|
|
fa2f578900 | ||
|
|
e1c9987059 | ||
|
|
325e219bb1 | ||
|
|
be208df11b | ||
|
|
49df804d1b | ||
|
|
122fde79bd | ||
|
|
2099e68c41 | ||
|
|
52ccc609cd | ||
|
|
b402f6a404 | ||
|
|
3576a1824d | ||
|
|
c3afaae169 | ||
|
|
c5a9ce6b56 | ||
|
|
4f0d944bb9 | ||
|
|
5684bcb6f4 | ||
|
|
5087fcea88 | ||
|
|
28f984e87f | ||
|
|
e0233daeb0 | ||
|
|
49922ebe32 | ||
|
|
8fe0c3441c | ||
|
|
ba55caa404 | ||
|
|
e50e651078 | ||
|
|
39b4fd47c7 | ||
|
|
56b83e5cfa | ||
|
|
ed57355948 | ||
|
|
b4b2f3a0b6 | ||
|
|
1946882952 | ||
|
|
dbe4930c17 | ||
|
|
3b25fa3065 | ||
|
|
01849565aa | ||
|
|
e3ca5833d0 | ||
|
|
dfac1f034b | ||
|
|
a8d07df81d | ||
|
|
609cb44b01 | ||
|
|
feb4d605d0 | ||
|
|
276d887917 | ||
|
|
61aef9c96f | ||
|
|
b4005682f2 | ||
|
|
7d98461fc6 | ||
|
|
862d03b78e | ||
|
|
0ecf46240f | ||
|
|
a2755e212b | ||
|
|
2ec5559dd6 | ||
|
|
6f904759ee | ||
|
|
507fafd601 | ||
|
|
9c463f1338 | ||
|
|
8818cd0285 | ||
|
|
23b72d08d2 | ||
|
|
227049b6f2 | ||
|
|
97abd3e1f9 | ||
|
|
6f34b7ba99 | ||
|
|
c0d86c3852 | ||
|
|
bf743ff467 | ||
|
|
306f994464 | ||
|
|
f56676942b | ||
|
|
bfd0a05289 | ||
|
|
3999c08f00 | ||
|
|
febb8ec1a6 | ||
|
|
cdd38ef7aa | ||
|
|
54c620a5df | ||
|
|
089b7fa73e | ||
|
|
d9d0e84ca1 | ||
|
|
badede2e2d | ||
|
|
e2ae28741d | ||
|
|
ff34150b15 | ||
|
|
4a93ceac58 | ||
|
|
5a724bf49e | ||
|
|
c23bcf6322 | ||
|
|
c863149ad9 | ||
|
|
5fb6e22bed | ||
|
|
d634088282 | ||
|
|
c99a935831 | ||
|
|
165da677ed | ||
|
|
0bbde2ca52 | ||
|
|
3d13c5d13c | ||
|
|
9d978c67ec | ||
|
|
8766e1fa57 | ||
|
|
c0e4883987 | ||
|
|
57f2cd5f9e | ||
|
|
50d8d06a94 | ||
|
|
2e07328878 | ||
|
|
ad8294e521 | ||
|
|
14426a7b45 | ||
|
|
6697e76be1 | ||
|
|
73cd876f6d | ||
|
|
e626754000 | ||
|
|
1fedd31229 | ||
|
|
bfe1746ddb | ||
|
|
4800c32db4 | ||
|
|
140fc28b3e | ||
|
|
f9833bb8af | ||
|
|
4b6ddaf09e | ||
|
|
d427db4a15 | ||
|
|
deb39cc20f | ||
|
|
3a4c25e916 | ||
|
|
f416eb3d4f | ||
|
|
87cbb1f90c | ||
|
|
68f43121fb | ||
|
|
51ceab1f3c | ||
|
|
2257992a3f | ||
|
|
40ead584d7 | ||
|
|
6f2be7bd17 | ||
|
|
af9ca4cf7d | ||
|
|
ea98203ac5 | ||
|
|
e908bbfae6 | ||
|
|
fa00069068 | ||
|
|
efae58de52 | ||
|
|
39c7f703cb | ||
|
|
96220e509c | ||
|
|
4de495ad59 | ||
|
|
56a950a074 | ||
|
|
2b47254bdd | ||
|
|
da28e2cc37 | ||
|
|
3d64f4a548 | ||
|
|
abf03b0c79 | ||
|
|
8381742422 | ||
|
|
724bb09aec | ||
|
|
ad5de248b4 | ||
|
|
1a1fdf6a5a | ||
|
|
c469b17350 | ||
|
|
01842a3c6b | ||
|
|
4cd385dbff | ||
|
|
72787d103f | ||
|
|
59072272a9 | ||
|
|
ef76666e5a | ||
|
|
0a0994b19c | ||
|
|
ab68c570a9 | ||
|
|
dcdf3b39a3 | ||
|
|
476cb2db34 | ||
|
|
34a7e00413 | ||
|
|
413ba09ee0 | ||
|
|
33eefefffb | ||
|
|
b3c822e31b | ||
|
|
14a458a275 | ||
|
|
6c49f9cf52 | ||
|
|
803ea4dda5 | ||
|
|
c9b23e6e4e | ||
|
|
509c9318af | ||
|
|
46e1e3d904 | ||
|
|
7a045d837b | ||
|
|
574ea820f7 | ||
|
|
7061d48dde | ||
|
|
53633b7279 | ||
|
|
05bb126af9 | ||
|
|
436fba77ac | ||
|
|
91c0e64159 | ||
|
|
7207681485 | ||
|
|
eef53f1b54 | ||
|
|
150d8d3214 | ||
|
|
a14376abb6 | ||
|
|
dfb45a8ebc | ||
|
|
00137c3031 | ||
|
|
b9c7dacbd1 | ||
|
|
3a03b579d2 | ||
|
|
e2bbe5cd8b | ||
|
|
c7347a3a16 | ||
|
|
8749b3c782 | ||
|
|
10389dc3f1 | ||
|
|
5e191a6cd8 | ||
|
|
a247625095 | ||
|
|
0fb234f3e4 | ||
|
|
e3e35d3bc6 | ||
|
|
6b12ca5b39 | ||
|
|
44e2837efb | ||
|
|
27dcd1bba2 | ||
|
|
ebf8cba6a4 | ||
|
|
e06cf23a03 | ||
|
|
dd55887f4b | ||
|
|
39b7b29af8 | ||
|
|
6f0aef3344 | ||
|
|
85c3a413fa | ||
|
|
b6c365b89d | ||
|
|
9eedf3901a | ||
|
|
2a6ecaeb09 | ||
|
|
027db2480a | ||
|
|
f4cabca62d | ||
|
|
0b3edc5fd4 | ||
|
|
b05152da0f | ||
|
|
2e0988ff03 | ||
|
|
ec12d9b657 | ||
|
|
f388de26ab | ||
|
|
68df8bf8ea | ||
|
|
4a960bba5e | ||
|
|
3a72b3fe3f | ||
|
|
47f372f215 | ||
|
|
7dc93bee7e | ||
|
|
69ff64149a | ||
|
|
4795f0a7dd | ||
|
|
e9411a3db5 | ||
|
|
6a064a4fa5 | ||
|
|
f036cdaaad | ||
|
|
46a68e2118 | ||
|
|
d020ea8f63 | ||
|
|
a4b40ab9e1 | ||
|
|
7c62b86ed9 | ||
|
|
96fb49e35c | ||
|
|
8e5fc236ca | ||
|
|
0784b5930b | ||
|
|
6de792c465 | ||
|
|
e9a2c89930 | ||
|
|
9d9f3acbe6 | ||
|
|
b67126e917 | ||
|
|
bcbf390334 | ||
|
|
714e355c87 | ||
|
|
f258ea2906 | ||
|
|
9445018586 | ||
|
|
97310b8912 | ||
|
|
47073040d4 | ||
|
|
a93663af0b | ||
|
|
ecd3b87cc0 | ||
|
|
5c34f208bd | ||
|
|
47f8d8c71c | ||
|
|
b2a0dba3bb | ||
|
|
fc1304dff5 | ||
|
|
0e15de7103 | ||
|
|
182375314e | ||
|
|
69ac4ddedc | ||
|
|
68b31347f4 | ||
|
|
6be2d1cbc0 | ||
|
|
5fac15c449 | ||
|
|
ecb86b01c8 | ||
|
|
1744a6ffeb | ||
|
|
fb393c22b6 | ||
|
|
fe2ed74020 | ||
|
|
5f51050b2f | ||
|
|
913253d861 | ||
|
|
8172b2e5ed | ||
|
|
0a7fc06510 | ||
|
|
a81b20d9d5 | ||
|
|
90a09eb520 | ||
|
|
4ffbe0bbf9 | ||
|
|
8f991c311f | ||
|
|
367f839934 | ||
|
|
6c15359137 | ||
|
|
fa05d656ad | ||
|
|
76e32f55de | ||
|
|
30ca79a23a | ||
|
|
0ce6961972 | ||
|
|
b0ae2caef8 | ||
|
|
3eb4a64517 | ||
|
|
61a80b59d1 | ||
|
|
71eaef35e3 | ||
|
|
b7ae453d84 | ||
|
|
33958fed96 | ||
|
|
59d29b3648 | ||
|
|
911d7f6533 | ||
|
|
9d49015c0c | ||
|
|
d585712b40 | ||
|
|
fb15893521 | ||
|
|
308f8c5112 | ||
|
|
86edc0dbe2 | ||
|
|
f461bc9176 | ||
|
|
b121e5af25 | ||
|
|
d292835941 | ||
|
|
88aee00a02 | ||
|
|
2fa806bbee | ||
|
|
ae3faa1540 | ||
|
|
e1e9c428f1 | ||
|
|
443ca9da56 | ||
|
|
ef05da1860 | ||
|
|
e5a87c7463 | ||
|
|
da2f419b86 | ||
|
|
4586a12859 | ||
|
|
9c416bdbc1 | ||
|
|
f43255a1fb | ||
|
|
59949c50d3 | ||
|
|
4608579c31 | ||
|
|
8b7c69c4b0 | ||
|
|
0d519a5f28 | ||
|
|
47ae3ff8d3 | ||
|
|
97b7d7c7b9 | ||
|
|
c552d717ff | ||
|
|
3230287a5f | ||
|
|
0bc9c7ffa1 | ||
|
|
d9abe10308 | ||
|
|
3f62e7d36f | ||
|
|
47a65ce01e | ||
|
|
cd6590e15c | ||
|
|
87d392adb5 | ||
|
|
1dac754ca3 | ||
|
|
b844bb1268 | ||
|
|
dc859ca0a6 | ||
|
|
20e75b4057 | ||
|
|
a69977c62b | ||
|
|
3b0513a57c | ||
|
|
a5c2ea679d | ||
|
|
0dd5e7c081 | ||
|
|
31e9206fc0 | ||
|
|
4bf7d2b2fe | ||
|
|
c8b051628f | ||
|
|
76f36b780c | ||
|
|
d73d698fd5 | ||
|
|
9967d5ca9e | ||
|
|
fdc0370cdf | ||
|
|
a51a46f61a | ||
|
|
3edd508fc8 | ||
|
|
18fea6440e | ||
|
|
3a242b513c | ||
|
|
ade6a6c3ab | ||
|
|
9740ebe2a4 | ||
|
|
0a2e137613 | ||
|
|
56056c4846 | ||
|
|
b32d96636d | ||
|
|
9a4094e997 | ||
|
|
6a0bbea9c5 | ||
|
|
fea213ee2c | ||
|
|
669cadf1ee | ||
|
|
c3bafa2a40 | ||
|
|
2611a93af2 | ||
|
|
651e7e5963 | ||
|
|
7bf18a4464 | ||
|
|
14fd42ad91 | ||
|
|
33a61558e1 | ||
|
|
05ed785af1 | ||
|
|
158193a6c4 | ||
|
|
2671da5c2f | ||
|
|
a99a819e75 | ||
|
|
94664c24d8 | ||
|
|
466e96e79a | ||
|
|
fd2cd0b904 | ||
|
|
4afe14dff7 | ||
|
|
9436a823ba | ||
|
|
1346c98a58 | ||
|
|
93992ee1c1 | ||
|
|
e29bc933fe | ||
|
|
6df5cd8222 | ||
|
|
2dfc75c341 | ||
|
|
e75a1edea8 | ||
|
|
8c94efd61a | ||
|
|
20c3178dfe | ||
|
|
a7271697a2 | ||
|
|
c2bd21922f | ||
|
|
96831b0970 | ||
|
|
0fd5db9f78 | ||
|
|
918328e5b0 | ||
|
|
6bb6322bde | ||
|
|
00e255ee3c | ||
|
|
c662dd8b04 | ||
|
|
a85a246ab8 | ||
|
|
9132a7c8d4 | ||
|
|
44367f24f9 | ||
|
|
5d6a9a68fe | ||
|
|
476d15f0fc | ||
|
|
cce7f465f2 | ||
|
|
0e289d2d3b | ||
|
|
efc9321cec | ||
|
|
4154784f09 | ||
|
|
feb9d7b2a9 | ||
|
|
da22df5f5d | ||
|
|
78f751959d | ||
|
|
b0c3a1e23f | ||
|
|
cb703a6ce5 | ||
|
|
c1b26b87a8 | ||
|
|
15f752f002 | ||
|
|
af1a4ab07a | ||
|
|
5413765a23 | ||
|
|
da63afa758 | ||
|
|
1d86d674e5 | ||
|
|
5718c3d14d | ||
|
|
2bfefaf296 | ||
|
|
2c00ccca83 | ||
|
|
ade2cc8182 | ||
|
|
f546ea1f8a | ||
|
|
ff499d42a0 | ||
|
|
10e5af2ddf | ||
|
|
724f92562c | ||
|
|
2b68c5e383 | ||
|
|
47545e511d | ||
|
|
b7aea5b726 | ||
|
|
5338a4f17c | ||
|
|
e2dcabcbea | ||
|
|
971929777d | ||
|
|
0f4a95e31b | ||
|
|
b453787670 | ||
|
|
c555dbc3e8 | ||
|
|
1561e07ddf | ||
|
|
ec9bc59962 | ||
|
|
7fd82fffab | ||
|
|
0652b218db | ||
|
|
59217b9af3 | ||
|
|
46c9bcbc4f | ||
|
|
f6154032c7 | ||
|
|
6c2d2e8455 | ||
|
|
4d61f26dfa | ||
|
|
86c42a00a3 | ||
|
|
2443e06745 | ||
|
|
eb1d93d4e5 | ||
|
|
f0bf525cf4 | ||
|
|
45758add5d | ||
|
|
57465b2892 | ||
|
|
8a95eecf60 | ||
|
|
766b0ba9c8 | ||
|
|
a6796fe80a | ||
|
|
5e450388f9 | ||
|
|
cc62825081 | ||
|
|
7b5d640f35 | ||
|
|
96a9e8a090 | ||
|
|
d572765f09 | ||
|
|
ce539f30a5 | ||
|
|
103cf9c3bf | ||
|
|
e9fca78c13 | ||
|
|
19431ef675 | ||
|
|
8d6c5ea406 | ||
|
|
0dfc35ee5f | ||
|
|
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)
|
||||
|
||||
8
.github/ISSUE_TEMPLATE/app_bug_report.yaml
vendored
8
.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).
|
||||
@@ -27,6 +29,9 @@ body:
|
||||
- If your bug is the result of upscaling please use the forums or discord for assistance with various upscaling workarounds. Additionally, the unofficial PCSX2 [Wiki](https://wiki.pcsx2.net/Main_Page) often lists various fixes for upscaling issues.
|
||||
- We do **not** accept issues relating to Widescreen/no-interlace patches at this time.
|
||||
- Any issues pertaining to Widescreen/no-interlace patches please forward them to the [patches repository](https://github.com/PCSX2/pcsx2_patches).
|
||||
- We do **not** accept issues pertaining to Linux builds other than the official AppImage and Flatpak.
|
||||
- Please contact your packager for support. We have no control over other builds, nor can we investigate any issues, and historically they have been known to be broken.
|
||||
- This includes pre-configured "distributions" such as EmuDeck, the "AUR", etc.
|
||||
|
||||
- type: textarea
|
||||
id: desc
|
||||
@@ -65,11 +70,10 @@ body:
|
||||
- Windows 11
|
||||
- Windows 10 (64bit)
|
||||
- Linux (64bit) - Specify distro below
|
||||
- macOS 14 (Sonoma)
|
||||
- macOS 13 (Ventura)
|
||||
- macOS 12 (Monterey)
|
||||
- macOS 11 (Big Sur)
|
||||
- macOS 10.15 (Catalina)
|
||||
- macOS 10.14 (Mojave)
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
|
||||
12
.github/ISSUE_TEMPLATE/emu_bug_report.yaml
vendored
12
.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).
|
||||
@@ -27,6 +29,9 @@ body:
|
||||
- If your bug is the result of upscaling please use the forums or discord for assistance with various upscaling workarounds. Additionally, the unofficial PCSX2 [Wiki](https://wiki.pcsx2.net/Main_Page) often lists various fixes for upscaling issues.
|
||||
- We do **not** accept issues relating to Widescreen/no-interlace patches at this time.
|
||||
- Any issues pertaining to Widescreen/no-interlace patches please forward them to the [patches repository](https://github.com/PCSX2/pcsx2_patches).
|
||||
- We do **not** accept issues pertaining to Linux builds other than the official AppImage and Flatpak.
|
||||
- Please contact your packager for support. We have no control over other builds, nor can we investigate any issues, and historically they have been known to be broken.
|
||||
- This includes pre-configured "distributions" such as EmuDeck, the "AUR", etc.
|
||||
|
||||
- type: textarea
|
||||
id: desc
|
||||
@@ -80,11 +85,10 @@ body:
|
||||
- Windows 11
|
||||
- Windows 10 (64bit)
|
||||
- Linux (64bit) - Specify distro below
|
||||
- macOS 14 (Sonoma)
|
||||
- macOS 13 (Ventura)
|
||||
- macOS 12 (Monterey)
|
||||
- macOS 11 (Big Sur)
|
||||
- macOS 10.15 (Catalina)
|
||||
- macOS 10.14 (Mojave)
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
@@ -122,9 +126,9 @@ body:
|
||||
description: |
|
||||
Any non-default core settings. If you don't want to list them out, please provide screenshots of your configuration window.
|
||||
|
||||
Please note that the safe preset works for most games. MTVU can have some compatibility issues so please disable it before making a report.
|
||||
Please note that defaults tend to work best.
|
||||
|
||||
If you need to modify the settings manually because a game requires you to do so to work, please state that explicitly.
|
||||
If you need to modify the settings manually to fix an issue , please state that explicitly.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
|
||||
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:
|
||||
|
||||
4
.github/dependabot.yml
vendored
4
.github/dependabot.yml
vendored
@@ -6,3 +6,7 @@ updates:
|
||||
schedule:
|
||||
# Check for updates to GitHub Actions every week
|
||||
interval: "weekly"
|
||||
groups:
|
||||
ci-deps:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
234
.github/labeler.yml
vendored
234
.github/labeler.yml
vendored
@@ -2,127 +2,187 @@
|
||||
|
||||
# General Labels
|
||||
'Build | Project System':
|
||||
- '.github/*'
|
||||
- '.github/**/*'
|
||||
- '*.sln'
|
||||
- '**/*.sln'
|
||||
- '*.vcxproj*'
|
||||
- '**/*.vcxproj*'
|
||||
- 'cmake/*'
|
||||
- 'cmake/**/*'
|
||||
- 'CMakeLists.txt'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'build.sh'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- '.github/*'
|
||||
- '.github/**/*'
|
||||
- '*.sln'
|
||||
- '**/*.sln'
|
||||
- '*.vcxproj*'
|
||||
- '**/*.vcxproj*'
|
||||
- 'cmake/*'
|
||||
- 'cmake/**/*'
|
||||
- 'CMakeLists.txt'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'build.sh'
|
||||
'Dependencies':
|
||||
- '3rdparty/*'
|
||||
- '3rdparty/**/*'
|
||||
- '**/3rdpartyDeps.props'
|
||||
- '.gitmodules'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- '3rdparty/*'
|
||||
- '3rdparty/**/*'
|
||||
- '**/3rdpartyDeps.props'
|
||||
- '.gitmodules'
|
||||
'Documentation':
|
||||
- '*.md'
|
||||
- '**/*.md'
|
||||
- '*.pdf'
|
||||
- '**/*.pdf'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- '*.md'
|
||||
- '**/*.md'
|
||||
- '*.pdf'
|
||||
- '**/*.pdf'
|
||||
'GUI/Qt':
|
||||
- 'pcsx2-qt/*'
|
||||
- 'pcsx2-qt/**/*'
|
||||
- '3rdparty/Qt/*'
|
||||
- '3rdparty/Qt/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2-qt/*'
|
||||
- 'pcsx2-qt/**/*'
|
||||
- '3rdparty/Qt/*'
|
||||
- '3rdparty/Qt/**/*'
|
||||
'GameDB':
|
||||
- '**/GameIndex.*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- '**/GameIndex.*'
|
||||
'Installer | Package':
|
||||
- 'build.sh'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'build.sh'
|
||||
'Translations':
|
||||
- 'pcsx2-qt/Translations/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2-qt/Translations/*'
|
||||
|
||||
# Tools / Features
|
||||
'Debugger':
|
||||
- 'pcsx2/DebugTools/*'
|
||||
- 'pcsx2/DebugTools/**/*'
|
||||
- 'pcsx2-qt/Debugger/*'
|
||||
- 'pcsx2-qt/Debugger/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/DebugTools/*'
|
||||
- 'pcsx2/DebugTools/**/*'
|
||||
- 'pcsx2-qt/Debugger/*'
|
||||
- 'pcsx2-qt/Debugger/**/*'
|
||||
'IPC':
|
||||
- 'pcsx2/IPC*'
|
||||
- 'pcsx2/**/IPC*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/IPC*'
|
||||
- 'pcsx2/**/IPC*'
|
||||
'TAS Functionality':
|
||||
- 'pcsx2/Recording/*'
|
||||
- 'pcsx2/Recording/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/Recording/*'
|
||||
- 'pcsx2/Recording/**/*'
|
||||
'RetroAchievements':
|
||||
- 'pcsx2/Frontend/Achievements.*'
|
||||
- 'pcsx2/Achievements.*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/Frontend/Achievements.*'
|
||||
- 'pcsx2/Achievements.*'
|
||||
|
||||
# Emulation Components
|
||||
'Counters':
|
||||
- 'pcsx2/Counters.*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/Counters.*'
|
||||
'Vector Units':
|
||||
- 'pcsx2/VU*'
|
||||
- 'pcsx2/**/VU*'
|
||||
- 'pcsx2/*VU*'
|
||||
- 'pcsx2/**/*VU*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/VU*'
|
||||
- 'pcsx2/**/VU*'
|
||||
- 'pcsx2/*VU*'
|
||||
- 'pcsx2/**/*VU*'
|
||||
'VIF':
|
||||
- 'pcsx2/Vif*'
|
||||
- 'pcsx2/**/Vif*'
|
||||
- 'pcsx2/VIF*'
|
||||
- 'pcsx2/**/VIF*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/Vif*'
|
||||
- 'pcsx2/**/Vif*'
|
||||
- 'pcsx2/VIF*'
|
||||
- 'pcsx2/**/VIF*'
|
||||
|
||||
# GS Related Labels
|
||||
'GS':
|
||||
- 'pcsx2/GS/*'
|
||||
- 'pcsx2/GS/**/*'
|
||||
- 'bin/resources/shaders/*'
|
||||
- 'bin/resources/shaders/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/GS/*'
|
||||
- 'pcsx2/GS/**/*'
|
||||
- 'bin/resources/shaders/*'
|
||||
- 'bin/resources/shaders/**/*'
|
||||
'GS: Direct3D 11':
|
||||
- 'pcsx2/GS/Renderers/DX11/*'
|
||||
- 'pcsx2/GS/Renderers/DX11/**/*'
|
||||
- 'bin/resources/shaders/dx11/*'
|
||||
- 'bin/resources/shaders/dx11/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/GS/Renderers/DX11/*'
|
||||
- 'pcsx2/GS/Renderers/DX11/**/*'
|
||||
- 'bin/resources/shaders/dx11/*'
|
||||
- 'bin/resources/shaders/dx11/**/*'
|
||||
'GS: Direct3D 12':
|
||||
- 'pcsx2/GS/Renderers/DX12/*'
|
||||
- 'pcsx2/GS/Renderers/DX12/**/*'
|
||||
- 'bin/resources/shaders/dx11/*'
|
||||
- 'bin/resources/shaders/dx11/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/GS/Renderers/DX12/*'
|
||||
- 'pcsx2/GS/Renderers/DX12/**/*'
|
||||
- 'bin/resources/shaders/dx11/*'
|
||||
- 'bin/resources/shaders/dx11/**/*'
|
||||
'GS: Hardware':
|
||||
- 'pcsx2/GS/Renderers/HW/*'
|
||||
- 'pcsx2/GS/Renderers/HW/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/GS/Renderers/HW/*'
|
||||
- 'pcsx2/GS/Renderers/HW/**/*'
|
||||
'GS: OpenGL':
|
||||
- 'pcsx2/GS/Renderers/OpenGL/*'
|
||||
- 'pcsx2/GS/Renderers/OpenGL/**/*'
|
||||
- 'bin/resources/shaders/opengl/*'
|
||||
- 'bin/resources/shaders/opengl/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/GS/Renderers/OpenGL/*'
|
||||
- 'pcsx2/GS/Renderers/OpenGL/**/*'
|
||||
- 'bin/resources/shaders/opengl/*'
|
||||
- 'bin/resources/shaders/opengl/**/*'
|
||||
'GS: Vulkan':
|
||||
- 'pcsx2/GS/Renderers/Vulkan/*'
|
||||
- 'pcsx2/GS/Renderers/Vulkan/**/*'
|
||||
- 'bin/resources/shaders/vulkan/*'
|
||||
- 'bin/resources/shaders/vulkan/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/GS/Renderers/Vulkan/*'
|
||||
- 'pcsx2/GS/Renderers/Vulkan/**/*'
|
||||
- 'bin/resources/shaders/vulkan/*'
|
||||
- 'bin/resources/shaders/vulkan/**/*'
|
||||
'GS: Metal':
|
||||
- 'pcsx2/GS/Renderers/Metal/*'
|
||||
- 'pcsx2/GS/Renderers/Metal/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/GS/Renderers/Metal/*'
|
||||
- 'pcsx2/GS/Renderers/Metal/**/*'
|
||||
'GS: Texture Cache':
|
||||
- 'pcsx2/GS/Renderers/*TextureCache*.*'
|
||||
- 'pcsx2/GS/Renderers/**/*TextureCache*.*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/GS/Renderers/*TextureCache*.*'
|
||||
- 'pcsx2/GS/Renderers/**/*TextureCache*.*'
|
||||
'GS: Software':
|
||||
- 'pcsx2/GS/Renderers/SW/*'
|
||||
- 'pcsx2/GS/Renderers/SW/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/GS/Renderers/SW/*'
|
||||
- 'pcsx2/GS/Renderers/SW/**/*'
|
||||
|
||||
# Other Core Components
|
||||
'CDVD':
|
||||
- 'pcsx2/CDVD/*'
|
||||
- 'pcsx2/CDVD/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/CDVD/*'
|
||||
- 'pcsx2/CDVD/**/*'
|
||||
'DEV9':
|
||||
- 'pcsx2/DEV9/*'
|
||||
- 'pcsx2/DEV9/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/DEV9/*'
|
||||
- 'pcsx2/DEV9/**/*'
|
||||
'IPU':
|
||||
- 'pcsx2/IPU/*'
|
||||
- 'pcsx2/IPU/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/IPU/*'
|
||||
- 'pcsx2/IPU/**/*'
|
||||
'Memory Card':
|
||||
- 'pcsx2/SIO/Memcard/*'
|
||||
- 'pcsx2/SIO/Memcard/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/SIO/Memcard/*'
|
||||
- 'pcsx2/SIO/Memcard/**/*'
|
||||
'PAD':
|
||||
- 'pcsx2/SIO/Pad/*'
|
||||
- 'pcsx2/SIO/Pad/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/SIO/Pad/*'
|
||||
- 'pcsx2/SIO/Pad/**/*'
|
||||
'SPU2':
|
||||
- 'pcsx2/SPU2/*'
|
||||
- 'pcsx2/SPU2/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/SPU2/*'
|
||||
- 'pcsx2/SPU2/**/*'
|
||||
'USB':
|
||||
- 'pcsx2/USB/*'
|
||||
- 'pcsx2/USB/**/*'
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- 'pcsx2/USB/*'
|
||||
- 'pcsx2/USB/**/*'
|
||||
|
||||
2
.github/workflows/cron_publish_flatpak.yml
vendored
2
.github/workflows/cron_publish_flatpak.yml
vendored
@@ -33,9 +33,11 @@ jobs:
|
||||
uses: ./.github/workflows/linux_build_flatpak.yml
|
||||
with:
|
||||
jobName: "Qt"
|
||||
artifactPrefixName: "PCSX2-linux-Qt-x64-flatpak"
|
||||
compiler: clang
|
||||
cmakeflags: ""
|
||||
publish: true
|
||||
branch: stable
|
||||
fetchTags: true
|
||||
secrets: inherit
|
||||
|
||||
|
||||
@@ -11,13 +11,13 @@ 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
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
title: "Qt: Update Base Translation"
|
||||
commit-message: "Qt: Update Base Translation"
|
||||
|
||||
@@ -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: |
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
mv ./game_controller_db.txt ${{github.workspace}}/bin/resources/game_controller_db.txt
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
title: "PAD: Update to latest controller database"
|
||||
commit-message: "PAD: Update to latest controller database."
|
||||
|
||||
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
|
||||
|
||||
73
.github/workflows/linux_build_flatpak.yml
vendored
73
.github/workflows/linux_build_flatpak.yml
vendored
@@ -6,6 +6,9 @@ on:
|
||||
jobName:
|
||||
required: true
|
||||
type: string
|
||||
artifactPrefixName:
|
||||
required: true
|
||||
type: string
|
||||
os:
|
||||
required: false
|
||||
type: string
|
||||
@@ -36,18 +39,30 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
stableBuild:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build_linux:
|
||||
name: ${{ inputs.jobName }}
|
||||
runs-on: ${{ inputs.os }}
|
||||
container:
|
||||
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.7
|
||||
options: --privileged
|
||||
timeout-minutes: 60
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
set-safe-directory: ${{ env.GITHUB_WORKSPACE }}
|
||||
|
||||
# Work around container ownership issue
|
||||
- name: Set Safe Directory
|
||||
shell: bash
|
||||
run: git config --global --add safe.directory "*"
|
||||
|
||||
# Hackity hack. When running the workflow on a schedule, we don't have the tag,
|
||||
# it doesn't fetch tags, therefore we don't get a version. So grab them manually.
|
||||
@@ -56,66 +71,86 @@ jobs:
|
||||
if: ${{ inputs.fetchTags }}
|
||||
run: git fetch --tags --no-recurse-submodules
|
||||
|
||||
- name: Add stable release identifier file
|
||||
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
cat ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
|
||||
- name: Prepare Artifact Metadata
|
||||
id: artifact-metadata
|
||||
shell: bash
|
||||
env:
|
||||
OS: linux
|
||||
BUILD_SYSTEM: flatpak
|
||||
ARCH: ${{ inputs.platform }}
|
||||
PREFIX: ${{ inputs.artifactPrefixName }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
PR_NUM: ${{ github.event.pull_request.number }}
|
||||
PR_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: ./.github/workflows/scripts/common/name-artifacts.sh
|
||||
|
||||
- name: Install Packages
|
||||
env:
|
||||
COMPILER: ${{ inputs.compiler }}
|
||||
run: .github/workflows/scripts/linux/install-packages-flatpak.sh
|
||||
|
||||
- name: Download patches
|
||||
run: |
|
||||
cd bin/resources
|
||||
aria2c -Z "${{ inputs.patchesUrl }}/patches.zip"
|
||||
wget "${{ inputs.patchesUrl }}/patches.zip"
|
||||
|
||||
- name: Generate AppStream XML
|
||||
run: |
|
||||
./.github/workflows/scripts/linux/generate-metainfo.sh .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml
|
||||
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
|
||||
# flatpak-builder-lint appstream .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml
|
||||
|
||||
- name: Validate manifest
|
||||
run: |
|
||||
flatpak-builder-lint manifest .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json
|
||||
|
||||
- name: Build Flatpak
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.1
|
||||
uses: flathub-infra/flatpak-github-actions/flatpak-builder@23796715b3dfa4c86ddf50cf29c3cc8b3c82dca8
|
||||
with:
|
||||
bundle: ${{ steps.artifact-metadata.outputs.artifact-name }}.flatpak
|
||||
upload-artifact: false
|
||||
manifest-path: .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json
|
||||
arch: x86_64
|
||||
build-bundle: true
|
||||
verbose: true
|
||||
mirror-screenshots-url: https://dl.flathub.org/repo/screenshots
|
||||
mirror-screenshots-url: https://dl.flathub.org/media
|
||||
branch: ${{ inputs.branch }}
|
||||
cache: true
|
||||
restore-cache: true
|
||||
cache-key: ${{ inputs.os }} ${{ inputs.platform }} ${{ inputs.compiler }} flatpak ${{ hashFiles('.github/workflows/scripts/linux/flatpak/**/*.json') }}
|
||||
|
||||
- name: Commit screenshots to OSTree
|
||||
run: |
|
||||
ostree commit --repo=repo --canonical-permissions --branch=screenshots/x86_64 flatpak_app/screenshots
|
||||
#- name: Validate build
|
||||
# run: |
|
||||
# flatpak-builder-lint repo repo
|
||||
|
||||
- name: Push to Flathub beta
|
||||
if: inputs.publish == true && inputs.branch == 'beta'
|
||||
uses: flatpak/flatpak-github-actions/flat-manager@v6.1
|
||||
uses: flathub-infra/flatpak-github-actions/flat-manager@23796715b3dfa4c86ddf50cf29c3cc8b3c82dca8
|
||||
with:
|
||||
flat-manager-url: https://hub.flathub.org/
|
||||
repository: beta
|
||||
token: ${{ secrets.FLATHUB_BETA_TOKEN }}
|
||||
build-log-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
|
||||
- name: Push to Flathub stable
|
||||
if: inputs.publish == true && inputs.branch == 'stable'
|
||||
uses: flatpak/flatpak-github-actions/flat-manager@v6.1
|
||||
uses: flathub-infra/flatpak-github-actions/flat-manager@23796715b3dfa4c86ddf50cf29c3cc8b3c82dca8
|
||||
with:
|
||||
flat-manager-url: https://hub.flathub.org/
|
||||
repository: stable
|
||||
token: ${{ secrets.FLATHUB_TOKEN }}
|
||||
build-log-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
|
||||
# NOTE - this is done after on purpose so the flatpak file is wherever it needs to be for the previous pushes
|
||||
- name: Prepare artifacts folder
|
||||
# NOTE - 'flatpak-builder' dumps the artifact out into the current directory
|
||||
run: |
|
||||
mkdir -p "$GITHUB_WORKSPACE"/ci-artifacts/
|
||||
mv "./${{ steps.artifact-metadata.outputs.artifact-name }}.flatpak" "$GITHUB_WORKSPACE"/ci-artifacts/
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
||||
path: ci-artifacts
|
||||
|
||||
|
||||
2
.github/workflows/linux_build_matrix.yml
vendored
2
.github/workflows/linux_build_matrix.yml
vendored
@@ -15,6 +15,7 @@ jobs:
|
||||
uses: ./.github/workflows/linux_build_qt.yml
|
||||
with:
|
||||
jobName: "AppImage Build"
|
||||
artifactPrefixName: "PCSX2-linux-Qt-x64-appimage-sse4"
|
||||
compiler: clang
|
||||
cmakeflags: ""
|
||||
buildAppImage: true
|
||||
@@ -25,6 +26,7 @@ jobs:
|
||||
uses: ./.github/workflows/linux_build_flatpak.yml
|
||||
with:
|
||||
jobName: "Flatpak Build"
|
||||
artifactPrefixName: "PCSX2-linux-Qt-x64-flatpak-sse4"
|
||||
compiler: clang
|
||||
cmakeflags: ""
|
||||
publish: false
|
||||
|
||||
79
.github/workflows/linux_build_qt.yml
vendored
79
.github/workflows/linux_build_qt.yml
vendored
@@ -6,6 +6,9 @@ on:
|
||||
jobName:
|
||||
required: true
|
||||
type: string
|
||||
artifactPrefixName:
|
||||
required: true
|
||||
type: string
|
||||
os:
|
||||
required: false
|
||||
type: string
|
||||
@@ -36,13 +39,17 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
stableBuild:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build_linux:
|
||||
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,22 +58,34 @@ 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-0ubuntu*' 'libc6-dev=2.35-0ubuntu*' libstdc++6=12.3.0-1ubuntu1~22.04 libgcc-s1=12.3.0-1ubuntu1~22.04
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# actions/checkout elides tags, fetch them primarily for releases
|
||||
- name: Fetch Tags
|
||||
if: ${{ inputs.fetchTags }}
|
||||
run: git fetch --tags --no-recurse-submodules
|
||||
|
||||
- name: Add stable release identifier file
|
||||
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
cat ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
|
||||
- name: Prepare Artifact Metadata
|
||||
id: artifact-metadata
|
||||
shell: bash
|
||||
env:
|
||||
OS: linux
|
||||
ARCH: ${{ inputs.platform }}
|
||||
PREFIX: ${{ inputs.artifactPrefixName }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
PR_NUM: ${{ github.event.pull_request.number }}
|
||||
@@ -79,27 +98,36 @@ jobs:
|
||||
run: echo "timestamp=$(date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .ccache
|
||||
key: ${{ inputs.os }} ${{ inputs.platform }} ${{ inputs.compiler }} ${{ inputs.detail }} ccache ${{ steps.ccache_cache_timestamp.outputs.timestamp }}
|
||||
restore-keys: ${{ inputs.os }} ${{ inputs.platform }} ${{ inputs.compiler }} ${{ inputs.detail }} ccache
|
||||
|
||||
- name: Install Packages
|
||||
env:
|
||||
COMPILER: ${{ inputs.compiler }}
|
||||
run: .github/workflows/scripts/linux/install-packages-qt.sh
|
||||
run: |
|
||||
tools/retry.sh wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
|
||||
sudo tools/retry.sh apt-add-repository -n 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main'
|
||||
sudo tools/retry.sh apt-get update
|
||||
sudo tools/retry.sh apt-get -y install \
|
||||
build-essential ccache clang-17 cmake curl extra-cmake-modules git libasound2-dev libaio-dev libavcodec-dev libavformat-dev libavutil-dev \
|
||||
libcurl4-openssl-dev libdbus-1-dev libdecor-0-dev libegl-dev libevdev-dev libfontconfig-dev libfreetype-dev libfuse2 libgtk-3-dev libgudev-1.0-dev \
|
||||
libharfbuzz-dev libinput-dev libopengl-dev libpcap-dev libpipewire-0.3-dev libpulse-dev libssl-dev libswresample-dev libswscale-dev libudev-dev \
|
||||
libwayland-dev libx11-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-cursor-dev libxcb-damage0-dev libxcb-glx0-dev libxcb-icccm4-dev \
|
||||
libxcb-image0-dev libxcb-keysyms1-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev \
|
||||
libxcb-shm0-dev libxcb-sync-dev libxcb-util-dev libxcb-xfixes0-dev libxcb-xinput-dev libxcb-xkb-dev libxext-dev libxkbcommon-x11-dev libxrandr-dev \
|
||||
lld-17 llvm-17 ninja-build patchelf pkg-config zlib1g-dev
|
||||
|
||||
- name: Cache Dependencies
|
||||
id: cache-deps
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/deps
|
||||
key: ${{ inputs.os }} ${{ inputs.platform }} deps ${{ hashFiles('.github/workflows/scripts/linux/build-dependencies-qt.sh') }}
|
||||
|
||||
- name: Build Dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: .github/workflows/scripts/linux/build-dependencies-qt.sh
|
||||
run: .github/workflows/scripts/linux/build-dependencies-qt.sh "$HOME/deps"
|
||||
|
||||
- name: Download patches
|
||||
run: |
|
||||
@@ -108,16 +136,31 @@ jobs:
|
||||
|
||||
- name: Generate CMake
|
||||
env:
|
||||
COMPILER: ${{ inputs.compiler }}
|
||||
ADDITIONAL_CMAKE_ARGS: ${{ inputs.cmakeflags }}
|
||||
CLANG_PATH: /usr/bin/clang-16
|
||||
CLANGXX_PATH: /usr/bin/clang++-16
|
||||
run: |
|
||||
DEPS_PREFIX="$HOME/deps" .github/workflows/scripts/linux/generate-cmake-qt.sh
|
||||
cmake -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
|
||||
-DCMAKE_PREFIX_PATH="$HOME/deps" \
|
||||
-DCMAKE_C_COMPILER=clang-17 \
|
||||
-DCMAKE_CXX_COMPILER=clang++-17 \
|
||||
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
||||
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DENABLE_SETCAP=OFF \
|
||||
-DDISABLE_ADVANCE_SIMD=TRUE \
|
||||
$ADDITIONAL_CMAKE_ARGS
|
||||
|
||||
- name: Build PCSX2
|
||||
working-directory: build
|
||||
run: ../.github/workflows/scripts/linux/compile.sh
|
||||
run: |
|
||||
# Prepare the Cache
|
||||
ccache -p
|
||||
ccache -z
|
||||
# Build
|
||||
ninja
|
||||
# Save the Cache
|
||||
ccache -s
|
||||
|
||||
- name: Run Tests
|
||||
working-directory: ./build
|
||||
@@ -134,7 +177,7 @@ jobs:
|
||||
|
||||
- name: Upload artifact
|
||||
if: inputs.buildAppImage == true
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
||||
path: ci-artifacts
|
||||
|
||||
48
.github/workflows/macos_build.yml
vendored
48
.github/workflows/macos_build.yml
vendored
@@ -6,10 +6,13 @@ on:
|
||||
jobName:
|
||||
required: true
|
||||
type: string
|
||||
artifactPrefixName:
|
||||
required: true
|
||||
type: string
|
||||
os:
|
||||
required: false
|
||||
type: string
|
||||
default: macos-13
|
||||
default: macos-14
|
||||
patchesUrl:
|
||||
required: false
|
||||
type: string
|
||||
@@ -18,6 +21,10 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
stableBuild:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build_macos:
|
||||
@@ -35,23 +42,28 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# actions/checkout elides tags, fetch them primarily for releases
|
||||
- name: Fetch Tags
|
||||
if: ${{ inputs.fetchTags }}
|
||||
run: git fetch --tags --no-recurse-submodules
|
||||
|
||||
- name: Use Xcode 14.3.1
|
||||
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app
|
||||
- name: Add stable release identifier file
|
||||
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
cat ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
|
||||
- name: Use Xcode 15.2
|
||||
run: sudo xcode-select -s /Applications/Xcode_15.2.app
|
||||
|
||||
- name: Prepare Artifact Metadata
|
||||
id: artifact-metadata
|
||||
shell: bash
|
||||
env:
|
||||
OS: macos
|
||||
PREFIX: ${{ inputs.artifactPrefixName }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
PR_NUM: ${{ github.event.pull_request.number }}
|
||||
@@ -60,28 +72,25 @@ jobs:
|
||||
|
||||
- name: Install Packages
|
||||
env:
|
||||
PLATFORM: "x64"
|
||||
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
|
||||
if ! brew install ccache nasm; then
|
||||
brew update
|
||||
brew install molten-vk ccache nasm
|
||||
brew install ccache nasm
|
||||
fi
|
||||
|
||||
- name: Cache Dependencies
|
||||
id: cache-deps
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/deps
|
||||
key: ${{ inputs.os }} deps ${{ hashFiles('.github/workflows/scripts/macos/build-dependencies.sh') }}
|
||||
|
||||
- name: Build Dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: .github/workflows/scripts/macos/build-dependencies.sh
|
||||
run: |
|
||||
.github/workflows/scripts/macos/build-dependencies.sh "$HOME/deps"
|
||||
|
||||
- name: Download patches
|
||||
run: |
|
||||
@@ -94,7 +103,7 @@ jobs:
|
||||
run: echo "timestamp=$(date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache ccache cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .ccache
|
||||
key: ${{ inputs.os }} ccache ${{ steps.ccache_cache_timestamp.outputs.timestamp }}
|
||||
@@ -104,11 +113,9 @@ jobs:
|
||||
run: |
|
||||
cmake -DCMAKE_PREFIX_PATH="$HOME/deps" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DUSE_OPENGL=OFF \
|
||||
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
|
||||
-DDISABLE_ADVANCE_SIMD=ON \
|
||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
|
||||
-DUSE_SYSTEM_LIBS=OFF \
|
||||
-DUSE_SYSTEM_SDL2=ON \
|
||||
-DUSE_LINKED_FFMPEG=ON \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
@@ -137,7 +144,6 @@ jobs:
|
||||
|
||||
- name: Prepare Build Artifacts
|
||||
run: |
|
||||
cp /usr/local/lib/libMoltenVK.dylib build/pcsx2*/PCSX2.app/Contents/Frameworks/
|
||||
TAG="$(git tag --points-at HEAD)"
|
||||
if [ -z "$TAG" ]; then
|
||||
APPNAME="${{ steps.artifact-metadata.outputs.artifact-name }}"
|
||||
@@ -150,7 +156,7 @@ jobs:
|
||||
cp "${{ steps.artifact-metadata.outputs.artifact-name }}.tar.xz" ci-artifacts/macOS.tar.xz
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
||||
path: "*.tar.xz"
|
||||
|
||||
1
.github/workflows/macos_build_matrix.yml
vendored
1
.github/workflows/macos_build_matrix.yml
vendored
@@ -15,4 +15,5 @@ jobs:
|
||||
uses: ./.github/workflows/macos_build.yml
|
||||
with:
|
||||
jobName: "MacOS Build"
|
||||
artifactPrefixName: "PCSX2-macos-Qt"
|
||||
secrets: inherit
|
||||
|
||||
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
|
||||
88
.github/workflows/release_cut_new.yml
vendored
88
.github/workflows/release_cut_new.yml
vendored
@@ -10,16 +10,19 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
# TODO - future work
|
||||
# workflow_dispatch:
|
||||
# inputs:
|
||||
# isStable:
|
||||
# description: 'Should it be a stable release?'
|
||||
# required: true
|
||||
# default: 'false'
|
||||
# versionTag:
|
||||
# description: 'The version to tag with'
|
||||
# required: true
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
is_prelease:
|
||||
description: 'Should be a pre-release?'
|
||||
required: true
|
||||
default: 'true'
|
||||
type: choice
|
||||
options:
|
||||
- 'true'
|
||||
- 'false'
|
||||
tag_value:
|
||||
description: 'Create a new release from latest master with the given tag, if this is left blank it will bump the patch version. You dont need to include the "v" prefix'
|
||||
required: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -27,19 +30,23 @@ 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
|
||||
id: tag_version
|
||||
uses: mathieudutour/github-tag-action@v6.1
|
||||
uses: mathieudutour/github-tag-action@v6.2
|
||||
with:
|
||||
github_token: ${{ github.token }}
|
||||
tag_prefix: v
|
||||
default_bump: patch
|
||||
# if set, it will overwrite the bump settings
|
||||
custom_tag: ${{ github.event.inputs.tag_value == '' && null || github.event.inputs.tag_value }}
|
||||
|
||||
# TODO - we could do this and remove the node.js script, but auto-generated notes only work
|
||||
# with PRs -- not commits (determine how much we care).
|
||||
@@ -60,9 +67,18 @@ jobs:
|
||||
node index.js
|
||||
mv ./release-notes.md ${GITHUB_WORKSPACE}/release-notes.md
|
||||
|
||||
- name: Create a GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: steps.tag_version.outputs.new_tag
|
||||
- name: Create a GitHub Release (Manual)
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: steps.tag_version.outputs.new_tag && github.event_name == 'workflow_dispatch'
|
||||
with:
|
||||
body_path: ./release-notes.md
|
||||
draft: true
|
||||
prerelease: ${{ github.event_name != 'workflow_dispatch' || inputs.is_prelease == 'true' }}
|
||||
tag_name: ${{ steps.tag_version.outputs.new_tag }}
|
||||
|
||||
- name: Create a GitHub Release (Push)
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: steps.tag_version.outputs.new_tag && github.event_name != 'workflow_dispatch'
|
||||
with:
|
||||
body_path: ./release-notes.md
|
||||
draft: true
|
||||
@@ -79,10 +95,12 @@ jobs:
|
||||
uses: ./.github/workflows/linux_build_qt.yml
|
||||
with:
|
||||
jobName: "AppImage Build"
|
||||
artifactPrefixName: "PCSX2-linux-Qt-x64-appimage"
|
||||
compiler: clang
|
||||
cmakeflags: ""
|
||||
buildAppImage: true
|
||||
fetchTags: true
|
||||
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
|
||||
secrets: inherit
|
||||
|
||||
build_linux_flatpak:
|
||||
@@ -93,11 +111,13 @@ jobs:
|
||||
uses: ./.github/workflows/linux_build_flatpak.yml
|
||||
with:
|
||||
jobName: "Flatpak Build"
|
||||
artifactPrefixName: "PCSX2-linux-Qt-x64-flatpak"
|
||||
compiler: clang
|
||||
cmakeflags: ""
|
||||
branch: "stable"
|
||||
publish: false
|
||||
fetchTags: true
|
||||
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
|
||||
secrets: inherit
|
||||
|
||||
# Windows
|
||||
@@ -109,10 +129,12 @@ jobs:
|
||||
uses: ./.github/workflows/windows_build_qt.yml
|
||||
with:
|
||||
jobName: "Windows Build"
|
||||
artifactPrefixName: "PCSX2-windows-Qt-x64"
|
||||
configuration: CMake
|
||||
buildSystem: cmake
|
||||
cmakeFlags: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl
|
||||
fetchTags: true
|
||||
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
|
||||
secrets: inherit
|
||||
|
||||
# MacOS
|
||||
@@ -124,13 +146,16 @@ jobs:
|
||||
uses: ./.github/workflows/macos_build.yml
|
||||
with:
|
||||
jobName: "MacOS Build"
|
||||
artifactPrefixName: "PCSX2-macos-Qt"
|
||||
fetchTags: true
|
||||
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
|
||||
secrets: inherit
|
||||
|
||||
# Upload the Artifacts
|
||||
upload_artifacts:
|
||||
if: github.repository == 'PCSX2/pcsx2'
|
||||
needs:
|
||||
- cut-release
|
||||
- build_linux_flatpak
|
||||
- build_linux_qt
|
||||
- build_windows_qt
|
||||
@@ -138,16 +163,12 @@ 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/
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
name: Download all Artifacts
|
||||
with:
|
||||
path: ./ci-artifacts/
|
||||
@@ -160,16 +181,13 @@ jobs:
|
||||
working-directory: ./ci-artifacts/
|
||||
run: for d in *windows*/; do 7z a "${d}asset.7z" ./$d/*; done
|
||||
|
||||
# Artifact Naming:
|
||||
# MacOS: PCSX2-<tag>-macOS-[additional hyphen seperated tags]
|
||||
# Windows|Linux: PCSX2-<tag>-<windows|linux>-<32bit|64bit>--[additional hyphen seperated tags]
|
||||
- name: Name and Upload the Release Assets
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
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 +199,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
|
||||
|
||||
@@ -1,39 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Artifact Naming Scheme:
|
||||
# PCSX2-<OS>-Qt-[ARCH]-[SIMD]-[pr\[PR_NUM\]]-[title|sha\[SHA|PR_TITLE\]
|
||||
# PCSX2-<OS>-Qt-[BUILD_SYSTEM]-[ARCH]-[SIMD]-[pr\[PR_NUM\]]-[title|sha\[SHA|PR_TITLE\]
|
||||
# -- limited to 200 chars
|
||||
# Outputs:
|
||||
# - artifact-name
|
||||
|
||||
# Example - PCSX2-linux-Qt-x64-flatpak-sse4-sha[e880a2749]
|
||||
|
||||
# Inputs as env-vars
|
||||
# OS
|
||||
# BUILD_SYSTEM
|
||||
# ARCH
|
||||
# SIMD
|
||||
# PREFIX
|
||||
# EVENT_NAME
|
||||
# PR_TITLE
|
||||
# PR_NUM
|
||||
# PR_SHA
|
||||
|
||||
NAME=""
|
||||
|
||||
if [ "${OS}" == "macos" ]; then
|
||||
# MacOS has combined binaries for x64 and ARM64.
|
||||
NAME="PCSX2-${OS}-Qt"
|
||||
elif [[ ("${OS}" == "windows" && "$BUILD_SYSTEM" != "cmake") ]]; then
|
||||
NAME="PCSX2-${OS}-Qt-${ARCH}-${SIMD}"
|
||||
else
|
||||
NAME="PCSX2-${OS}-Qt-${ARCH}"
|
||||
if [[ -z "${PREFIX}" ]]; then
|
||||
echo "PREFIX is not set, can't name artifact without it!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add cmake if used to differentate it from msbuild builds
|
||||
# Else the two artifacts will have the same name and the files will be merged
|
||||
if [[ ! -z "${BUILD_SYSTEM}" ]]; then
|
||||
if [[ "${BUILD_SYSTEM}" == "cmake" ]] || [[ "${BUILD_SYSTEM}" == "flatpak" ]]; then
|
||||
NAME="${NAME}-${BUILD_SYSTEM}"
|
||||
fi
|
||||
fi
|
||||
NAME="${PREFIX}"
|
||||
|
||||
# Add PR / Commit Metadata
|
||||
if [ "$EVENT_NAME" == "pull_request" ]; then
|
||||
|
||||
577
.github/workflows/scripts/common/shaderc-changes.patch
vendored
Normal file
577
.github/workflows/scripts/common/shaderc-changes.patch
vendored
Normal file
@@ -0,0 +1,577 @@
|
||||
diff --git a/CHANGES b/CHANGES
|
||||
index 5d3dd16..587b612 100644
|
||||
--- a/CHANGES
|
||||
+++ b/CHANGES
|
||||
@@ -4,7 +4,7 @@ v2024.1
|
||||
- Update dependencies
|
||||
- Propagate test/install options to Glslang
|
||||
|
||||
-v2024.0
|
||||
+v2024.0 2024-03-09
|
||||
- Update dependencies
|
||||
- Utilities:
|
||||
- Use Python3 explicitly in utility scripts
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index ffcb54b..7c1a6d8 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -117,6 +117,9 @@ if(MSVC)
|
||||
endif()
|
||||
endif(MSVC)
|
||||
|
||||
+if(NOT WIN32)
|
||||
+ add_definitions("-fvisibility=hidden")
|
||||
+endif()
|
||||
|
||||
# Configure subdirectories.
|
||||
# We depend on these for later projects, so they should come first.
|
||||
@@ -124,7 +127,6 @@ add_subdirectory(third_party)
|
||||
|
||||
add_subdirectory(libshaderc_util)
|
||||
add_subdirectory(libshaderc)
|
||||
-add_subdirectory(glslc)
|
||||
if(${SHADERC_ENABLE_EXAMPLES})
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
@@ -158,5 +160,3 @@ function(define_pkg_config_file NAME LIBS)
|
||||
endfunction()
|
||||
|
||||
define_pkg_config_file(shaderc -lshaderc_shared)
|
||||
-define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
|
||||
-define_pkg_config_file(shaderc_combined -lshaderc_combined)
|
||||
diff --git a/libshaderc/CMakeLists.txt b/libshaderc/CMakeLists.txt
|
||||
index df9a88d..b15e5d7 100644
|
||||
--- a/libshaderc/CMakeLists.txt
|
||||
+++ b/libshaderc/CMakeLists.txt
|
||||
@@ -24,13 +24,6 @@ set(SHADERC_SOURCES
|
||||
src/shaderc_private.h
|
||||
)
|
||||
|
||||
-add_library(shaderc STATIC ${SHADERC_SOURCES})
|
||||
-shaderc_default_compile_options(shaderc)
|
||||
-target_include_directories(shaderc
|
||||
- PUBLIC include
|
||||
- PRIVATE ${glslang_SOURCE_DIR}
|
||||
- ${SPIRV-Headers_SOURCE_DIR}/include)
|
||||
-
|
||||
add_library(shaderc_shared SHARED ${SHADERC_SOURCES})
|
||||
shaderc_default_compile_options(shaderc_shared)
|
||||
target_include_directories(shaderc_shared
|
||||
@@ -54,7 +47,7 @@ if(SHADERC_ENABLE_INSTALL)
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
|
||||
|
||||
- install(TARGETS shaderc shaderc_shared
|
||||
+ install(TARGETS shaderc_shared
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
@@ -69,20 +62,8 @@ set(SHADERC_LIBS
|
||||
SPIRV-Tools
|
||||
)
|
||||
|
||||
-target_link_libraries(shaderc PRIVATE ${SHADERC_LIBS})
|
||||
target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS})
|
||||
|
||||
-shaderc_add_tests(
|
||||
- TEST_PREFIX shaderc
|
||||
- LINK_LIBS shaderc
|
||||
- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR}
|
||||
- ${spirv-tools_SOURCE_DIR}/include
|
||||
- ${SPIRV-Headers_SOURCE_DIR}/include
|
||||
- TEST_NAMES
|
||||
- shaderc
|
||||
- shaderc_cpp
|
||||
- shaderc_private)
|
||||
-
|
||||
shaderc_add_tests(
|
||||
TEST_PREFIX shaderc_shared
|
||||
LINK_LIBS shaderc_shared SPIRV-Tools
|
||||
@@ -94,22 +75,6 @@ shaderc_add_tests(
|
||||
shaderc_cpp
|
||||
shaderc_private)
|
||||
|
||||
-shaderc_combine_static_lib(shaderc_combined shaderc)
|
||||
-
|
||||
-if(SHADERC_ENABLE_INSTALL)
|
||||
- install(TARGETS shaderc_combined DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
-endif(SHADERC_ENABLE_INSTALL)
|
||||
-
|
||||
-shaderc_add_tests(
|
||||
- TEST_PREFIX shaderc_combined
|
||||
- LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT}
|
||||
- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR}
|
||||
- ${spirv-tools_SOURCE_DIR}/include
|
||||
- ${SPIRV-Headers_SOURCE_DIR}/include
|
||||
- TEST_NAMES
|
||||
- shaderc
|
||||
- shaderc_cpp)
|
||||
-
|
||||
if(${SHADERC_ENABLE_TESTS})
|
||||
add_executable(shaderc_c_smoke_test ./src/shaderc_c_smoke_test.c)
|
||||
shaderc_default_c_compile_options(shaderc_c_smoke_test)
|
||||
diff --git a/libshaderc/include/shaderc/shaderc.h b/libshaderc/include/shaderc/shaderc.h
|
||||
index 3a3e97d..65d5b77 100644
|
||||
--- a/libshaderc/include/shaderc/shaderc.h
|
||||
+++ b/libshaderc/include/shaderc/shaderc.h
|
||||
@@ -317,7 +317,7 @@ SHADERC_EXPORT void shaderc_compile_options_set_source_language(
|
||||
|
||||
// Sets the compiler mode to generate debug information in the output.
|
||||
SHADERC_EXPORT void shaderc_compile_options_set_generate_debug_info(
|
||||
- shaderc_compile_options_t options);
|
||||
+ shaderc_compile_options_t options, bool enabled, bool enable_non_semantic);
|
||||
|
||||
// Sets the compiler optimization level to the given level. Only the last one
|
||||
// takes effect if multiple calls of this function exist.
|
||||
@@ -506,6 +506,10 @@ SHADERC_EXPORT void shaderc_compile_options_set_invert_y(
|
||||
SHADERC_EXPORT void shaderc_compile_options_set_nan_clamp(
|
||||
shaderc_compile_options_t options, bool enable);
|
||||
|
||||
+// Returns a string representation of the specified compilation status.
|
||||
+SHADERC_EXPORT const char* shaderc_compilation_status_to_string(
|
||||
+ shaderc_compilation_status status);
|
||||
+
|
||||
// An opaque handle to the results of a call to any shaderc_compile_into_*()
|
||||
// function.
|
||||
typedef struct shaderc_compilation_result* shaderc_compilation_result_t;
|
||||
@@ -529,28 +533,31 @@ typedef struct shaderc_compilation_result* shaderc_compilation_result_t;
|
||||
// present. May be safely called from multiple threads without explicit
|
||||
// synchronization. If there was failure in allocating the compiler object,
|
||||
// null will be returned.
|
||||
-SHADERC_EXPORT shaderc_compilation_result_t shaderc_compile_into_spv(
|
||||
+SHADERC_EXPORT shaderc_compilation_status shaderc_compile_into_spv(
|
||||
const shaderc_compiler_t compiler, const char* source_text,
|
||||
size_t source_text_size, shaderc_shader_kind shader_kind,
|
||||
const char* input_file_name, const char* entry_point_name,
|
||||
- const shaderc_compile_options_t additional_options);
|
||||
+ const shaderc_compile_options_t additional_options,
|
||||
+ shaderc_compilation_result_t* result);
|
||||
|
||||
// Like shaderc_compile_into_spv, but the result contains SPIR-V assembly text
|
||||
// instead of a SPIR-V binary module. The SPIR-V assembly syntax is as defined
|
||||
// by the SPIRV-Tools open source project.
|
||||
-SHADERC_EXPORT shaderc_compilation_result_t shaderc_compile_into_spv_assembly(
|
||||
+SHADERC_EXPORT shaderc_compilation_status shaderc_compile_into_spv_assembly(
|
||||
const shaderc_compiler_t compiler, const char* source_text,
|
||||
size_t source_text_size, shaderc_shader_kind shader_kind,
|
||||
const char* input_file_name, const char* entry_point_name,
|
||||
- const shaderc_compile_options_t additional_options);
|
||||
+ const shaderc_compile_options_t additional_options,
|
||||
+ shaderc_compilation_result_t* result);
|
||||
|
||||
// Like shaderc_compile_into_spv, but the result contains preprocessed source
|
||||
// code instead of a SPIR-V binary module
|
||||
-SHADERC_EXPORT shaderc_compilation_result_t shaderc_compile_into_preprocessed_text(
|
||||
+SHADERC_EXPORT shaderc_compilation_status shaderc_compile_into_preprocessed_text(
|
||||
const shaderc_compiler_t compiler, const char* source_text,
|
||||
size_t source_text_size, shaderc_shader_kind shader_kind,
|
||||
const char* input_file_name, const char* entry_point_name,
|
||||
- const shaderc_compile_options_t additional_options);
|
||||
+ const shaderc_compile_options_t additional_options,
|
||||
+ shaderc_compilation_result_t* result);
|
||||
|
||||
// Takes an assembly string of the format defined in the SPIRV-Tools project
|
||||
// (https://github.com/KhronosGroup/SPIRV-Tools/blob/master/syntax.md),
|
||||
@@ -561,10 +568,11 @@ SHADERC_EXPORT shaderc_compilation_result_t shaderc_compile_into_preprocessed_te
|
||||
// May be safely called from multiple threads without explicit synchronization.
|
||||
// If there was failure in allocating the compiler object, null will be
|
||||
// returned.
|
||||
-SHADERC_EXPORT shaderc_compilation_result_t shaderc_assemble_into_spv(
|
||||
+SHADERC_EXPORT shaderc_compilation_status shaderc_assemble_into_spv(
|
||||
const shaderc_compiler_t compiler, const char* source_assembly,
|
||||
size_t source_assembly_size,
|
||||
- const shaderc_compile_options_t additional_options);
|
||||
+ const shaderc_compile_options_t additional_options,
|
||||
+ shaderc_compilation_result_t* result);
|
||||
|
||||
// The following functions, operating on shaderc_compilation_result_t objects,
|
||||
// offer only the basic thread-safety guarantee.
|
||||
diff --git a/libshaderc/include/shaderc/shaderc.hpp b/libshaderc/include/shaderc/shaderc.hpp
|
||||
index 3817af8..5592b49 100644
|
||||
--- a/libshaderc/include/shaderc/shaderc.hpp
|
||||
+++ b/libshaderc/include/shaderc/shaderc.hpp
|
||||
@@ -168,8 +168,9 @@ class CompileOptions {
|
||||
}
|
||||
|
||||
// Sets the compiler mode to generate debug information in the output.
|
||||
- void SetGenerateDebugInfo() {
|
||||
- shaderc_compile_options_set_generate_debug_info(options_);
|
||||
+ void SetGenerateDebugInfo(bool enabled, bool non_semantic_debug_info) {
|
||||
+ shaderc_compile_options_set_generate_debug_info(options_, enabled,
|
||||
+ non_sematic_debug_info);
|
||||
}
|
||||
|
||||
// Sets the compiler optimization level to the given level. Only the last one
|
||||
@@ -425,9 +426,10 @@ class Compiler {
|
||||
const char* input_file_name,
|
||||
const char* entry_point_name,
|
||||
const CompileOptions& options) const {
|
||||
- shaderc_compilation_result_t compilation_result = shaderc_compile_into_spv(
|
||||
+ shaderc_compilation_result_t compilation_result = nullptr;
|
||||
+ shaderc_compile_into_spv(
|
||||
compiler_, source_text, source_text_size, shader_kind, input_file_name,
|
||||
- entry_point_name, options.options_);
|
||||
+ entry_point_name, options.options_, &compilation_result);
|
||||
return SpvCompilationResult(compilation_result);
|
||||
}
|
||||
|
||||
@@ -451,9 +453,10 @@ class Compiler {
|
||||
size_t source_text_size,
|
||||
shaderc_shader_kind shader_kind,
|
||||
const char* input_file_name) const {
|
||||
- shaderc_compilation_result_t compilation_result =
|
||||
- shaderc_compile_into_spv(compiler_, source_text, source_text_size,
|
||||
- shader_kind, input_file_name, "main", nullptr);
|
||||
+ shaderc_compilation_result_t compilation_result = nullptr;
|
||||
+ shaderc_compile_into_spv(compiler_, source_text, source_text_size,
|
||||
+ shader_kind, input_file_name, "main", nullptr,
|
||||
+ &compilation_result);
|
||||
return SpvCompilationResult(compilation_result);
|
||||
}
|
||||
|
||||
@@ -504,8 +507,11 @@ class Compiler {
|
||||
SpvCompilationResult AssembleToSpv(const char* source_assembly,
|
||||
size_t source_assembly_size,
|
||||
const CompileOptions& options) const {
|
||||
- return SpvCompilationResult(shaderc_assemble_into_spv(
|
||||
- compiler_, source_assembly, source_assembly_size, options.options_));
|
||||
+ shaderc_compilation_result_t compilation_result = nullptr;
|
||||
+ shaderc_assemble_into_spv(
|
||||
+ compiler_, source_assembly, source_assembly_size, options.options_,
|
||||
+ &compilation_result);
|
||||
+ return SpvCompilationResult(compilation_result);
|
||||
}
|
||||
|
||||
// Assembles the given SPIR-V assembly and returns a SPIR-V binary module
|
||||
@@ -513,8 +519,11 @@ class Compiler {
|
||||
// Like the first AssembleToSpv method but uses the default compiler options.
|
||||
SpvCompilationResult AssembleToSpv(const char* source_assembly,
|
||||
size_t source_assembly_size) const {
|
||||
- return SpvCompilationResult(shaderc_assemble_into_spv(
|
||||
- compiler_, source_assembly, source_assembly_size, nullptr));
|
||||
+ shaderc_compilation_result_t compilation_result = nullptr;
|
||||
+ shaderc_assemble_into_spv(
|
||||
+ compiler_, source_assembly, source_assembly_size, nullptr,
|
||||
+ &compilation_result);
|
||||
+ return SpvCompilationResult(compilation_result);
|
||||
}
|
||||
|
||||
// Assembles the given SPIR-V assembly and returns a SPIR-V binary module
|
||||
@@ -523,9 +532,11 @@ class Compiler {
|
||||
// std::string.
|
||||
SpvCompilationResult AssembleToSpv(const std::string& source_assembly,
|
||||
const CompileOptions& options) const {
|
||||
- return SpvCompilationResult(
|
||||
- shaderc_assemble_into_spv(compiler_, source_assembly.data(),
|
||||
- source_assembly.size(), options.options_));
|
||||
+ shaderc_compilation_result_t compilation_result = nullptr;
|
||||
+ shaderc_assemble_into_spv(
|
||||
+ compiler_, source_assembly.data(), source_assembly.size(),
|
||||
+ options.options_, &compilation_result);
|
||||
+ return SpvCompilationResult(compilation_result);
|
||||
}
|
||||
|
||||
// Assembles the given SPIR-V assembly and returns a SPIR-V binary module
|
||||
@@ -533,8 +544,10 @@ class Compiler {
|
||||
// Like the first AssembleToSpv method but the source is provided as a
|
||||
// std::string and also uses default compiler options.
|
||||
SpvCompilationResult AssembleToSpv(const std::string& source_assembly) const {
|
||||
- return SpvCompilationResult(shaderc_assemble_into_spv(
|
||||
- compiler_, source_assembly.data(), source_assembly.size(), nullptr));
|
||||
+ shaderc_compilation_result_t compilation_result = nullptr;
|
||||
+ shaderc_assemble_into_spv(compiler_, source_assembly.data(),
|
||||
+ source_assembly.size(), nullptr, &compilation_result);
|
||||
+ return SpvCompilationResult(compilation_result);
|
||||
}
|
||||
|
||||
// Compiles the given source GLSL and returns the SPIR-V assembly text
|
||||
@@ -544,10 +557,11 @@ class Compiler {
|
||||
const char* source_text, size_t source_text_size,
|
||||
shaderc_shader_kind shader_kind, const char* input_file_name,
|
||||
const char* entry_point_name, const CompileOptions& options) const {
|
||||
- shaderc_compilation_result_t compilation_result =
|
||||
- shaderc_compile_into_spv_assembly(
|
||||
- compiler_, source_text, source_text_size, shader_kind,
|
||||
- input_file_name, entry_point_name, options.options_);
|
||||
+ shaderc_compilation_result_t compilation_result = nullptr;
|
||||
+ shaderc_compile_into_spv_assembly(
|
||||
+ compiler_, source_text, source_text_size, shader_kind,
|
||||
+ input_file_name, entry_point_name, options.options_,
|
||||
+ &compilation_result);
|
||||
return AssemblyCompilationResult(compilation_result);
|
||||
}
|
||||
|
||||
@@ -592,10 +606,10 @@ class Compiler {
|
||||
const char* source_text, size_t source_text_size,
|
||||
shaderc_shader_kind shader_kind, const char* input_file_name,
|
||||
const CompileOptions& options) const {
|
||||
- shaderc_compilation_result_t compilation_result =
|
||||
- shaderc_compile_into_preprocessed_text(
|
||||
+ shaderc_compilation_result_t compilation_result;
|
||||
+ shaderc_compile_into_preprocessed_text(
|
||||
compiler_, source_text, source_text_size, shader_kind,
|
||||
- input_file_name, "main", options.options_);
|
||||
+ input_file_name, "main", options.options_, &compilation_result);
|
||||
return PreprocessedSourceCompilationResult(compilation_result);
|
||||
}
|
||||
|
||||
diff --git a/libshaderc/src/shaderc.cc b/libshaderc/src/shaderc.cc
|
||||
index 63f1bbc..c1a9b12 100644
|
||||
--- a/libshaderc/src/shaderc.cc
|
||||
+++ b/libshaderc/src/shaderc.cc
|
||||
@@ -418,8 +418,12 @@ void shaderc_compile_options_set_source_language(
|
||||
}
|
||||
|
||||
void shaderc_compile_options_set_generate_debug_info(
|
||||
- shaderc_compile_options_t options) {
|
||||
- options->compiler.SetGenerateDebugInfo();
|
||||
+ shaderc_compile_options_t options, bool enabled, bool enable_non_semantic) {
|
||||
+ if (enabled) {
|
||||
+ options->compiler.SetGenerateDebugInfo();
|
||||
+ if (enable_non_semantic)
|
||||
+ options->compiler.SetEmitNonSemanticDebugInfo();
|
||||
+ }
|
||||
}
|
||||
|
||||
void shaderc_compile_options_set_optimization_level(
|
||||
@@ -591,8 +595,31 @@ void shaderc_compiler_release(shaderc_compiler_t compiler) {
|
||||
delete compiler;
|
||||
}
|
||||
|
||||
+const char* shaderc_compilation_status_to_string(shaderc_compilation_status status)
|
||||
+{
|
||||
+ static constexpr const std::pair<shaderc_compilation_status, const char*> status_names[] = {
|
||||
+ {shaderc_compilation_status_success, "shaderc_compilation_status_success"},
|
||||
+ {shaderc_compilation_status_invalid_stage, "shaderc_compilation_status_invalid_stage"},
|
||||
+ {shaderc_compilation_status_compilation_error, "shaderc_compilation_status_compilation_error"},
|
||||
+ {shaderc_compilation_status_internal_error, "shaderc_compilation_status_internal_error"},
|
||||
+ {shaderc_compilation_status_null_result_object, "shaderc_compilation_status_null_result_object"},
|
||||
+ {shaderc_compilation_status_invalid_assembly, "shaderc_compilation_status_invalid_assembly"},
|
||||
+ {shaderc_compilation_status_validation_error, "shaderc_compilation_status_validation_error"},
|
||||
+ {shaderc_compilation_status_transformation_error, "shaderc_compilation_status_transformation_error"},
|
||||
+ {shaderc_compilation_status_configuration_error, "shaderc_compilation_status_configuration_error"},
|
||||
+ };
|
||||
+
|
||||
+ for (const auto& it : status_names)
|
||||
+ {
|
||||
+ if (status == it.first)
|
||||
+ return it.second;
|
||||
+ }
|
||||
+
|
||||
+ return "shaderc_compilation_status_unknown";
|
||||
+}
|
||||
+
|
||||
namespace {
|
||||
-shaderc_compilation_result_t CompileToSpecifiedOutputType(
|
||||
+shaderc_compilation_result_vector* CompileToSpecifiedOutputType(
|
||||
const shaderc_compiler_t compiler, const char* source_text,
|
||||
size_t source_text_size, shaderc_shader_kind shader_kind,
|
||||
const char* input_file_name, const char* entry_point_name,
|
||||
@@ -669,48 +696,59 @@ shaderc_compilation_result_t CompileToSpecifiedOutputType(
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
-shaderc_compilation_result_t shaderc_compile_into_spv(
|
||||
+shaderc_compilation_status shaderc_compile_into_spv(
|
||||
const shaderc_compiler_t compiler, const char* source_text,
|
||||
size_t source_text_size, shaderc_shader_kind shader_kind,
|
||||
const char* input_file_name, const char* entry_point_name,
|
||||
- const shaderc_compile_options_t additional_options) {
|
||||
- return CompileToSpecifiedOutputType(
|
||||
+ const shaderc_compile_options_t additional_options,
|
||||
+ shaderc_compilation_result_t* result) {
|
||||
+ shaderc_compilation_result_vector* resultv = CompileToSpecifiedOutputType(
|
||||
compiler, source_text, source_text_size, shader_kind, input_file_name,
|
||||
entry_point_name, additional_options,
|
||||
shaderc_util::Compiler::OutputType::SpirvBinary);
|
||||
+ *result = resultv;
|
||||
+ return resultv ? resultv->compilation_status : shaderc_compilation_status_internal_error;
|
||||
}
|
||||
|
||||
-shaderc_compilation_result_t shaderc_compile_into_spv_assembly(
|
||||
+shaderc_compilation_status shaderc_compile_into_spv_assembly(
|
||||
const shaderc_compiler_t compiler, const char* source_text,
|
||||
size_t source_text_size, shaderc_shader_kind shader_kind,
|
||||
const char* input_file_name, const char* entry_point_name,
|
||||
- const shaderc_compile_options_t additional_options) {
|
||||
- return CompileToSpecifiedOutputType(
|
||||
+ const shaderc_compile_options_t additional_options,
|
||||
+ shaderc_compilation_result_t* result) {
|
||||
+ shaderc_compilation_result_vector* resultv = CompileToSpecifiedOutputType(
|
||||
compiler, source_text, source_text_size, shader_kind, input_file_name,
|
||||
entry_point_name, additional_options,
|
||||
shaderc_util::Compiler::OutputType::SpirvAssemblyText);
|
||||
+ *result = resultv;
|
||||
+ return resultv ? resultv->compilation_status : shaderc_compilation_status_internal_error;
|
||||
}
|
||||
|
||||
-shaderc_compilation_result_t shaderc_compile_into_preprocessed_text(
|
||||
+shaderc_compilation_status shaderc_compile_into_preprocessed_text(
|
||||
const shaderc_compiler_t compiler, const char* source_text,
|
||||
size_t source_text_size, shaderc_shader_kind shader_kind,
|
||||
const char* input_file_name, const char* entry_point_name,
|
||||
- const shaderc_compile_options_t additional_options) {
|
||||
- return CompileToSpecifiedOutputType(
|
||||
+ const shaderc_compile_options_t additional_options,
|
||||
+ shaderc_compilation_result_t* result) {
|
||||
+ shaderc_compilation_result_vector* resultv = CompileToSpecifiedOutputType(
|
||||
compiler, source_text, source_text_size, shader_kind, input_file_name,
|
||||
entry_point_name, additional_options,
|
||||
shaderc_util::Compiler::OutputType::PreprocessedText);
|
||||
+ *result = resultv;
|
||||
+ return resultv ? resultv->compilation_status : shaderc_compilation_status_internal_error;
|
||||
}
|
||||
|
||||
-shaderc_compilation_result_t shaderc_assemble_into_spv(
|
||||
+shaderc_compilation_status shaderc_assemble_into_spv(
|
||||
const shaderc_compiler_t compiler, const char* source_assembly,
|
||||
size_t source_assembly_size,
|
||||
- const shaderc_compile_options_t additional_options) {
|
||||
- auto* result = new (std::nothrow) shaderc_compilation_result_spv_binary;
|
||||
- if (!result) return nullptr;
|
||||
- result->compilation_status = shaderc_compilation_status_invalid_assembly;
|
||||
- if (!compiler->initializer) return result;
|
||||
- if (source_assembly == nullptr) return result;
|
||||
+ const shaderc_compile_options_t additional_options,
|
||||
+ shaderc_compilation_result_t* result) {
|
||||
+ auto* bresult = new (std::nothrow) shaderc_compilation_result_spv_binary;
|
||||
+ if (!bresult) return shaderc_compilation_status_internal_error;
|
||||
+ bresult->compilation_status = shaderc_compilation_status_invalid_assembly;
|
||||
+ *result = bresult;
|
||||
+ if (!compiler->initializer) return bresult->compilation_status;
|
||||
+ if (source_assembly == nullptr) return bresult->compilation_status;
|
||||
|
||||
TRY_IF_EXCEPTIONS_ENABLED {
|
||||
spv_binary assembling_output_data = nullptr;
|
||||
@@ -724,22 +762,22 @@ shaderc_compilation_result_t shaderc_assemble_into_spv(
|
||||
GetCompilerTargetEnvVersion(target_env_version),
|
||||
{source_assembly, source_assembly + source_assembly_size},
|
||||
&assembling_output_data, &errors);
|
||||
- result->num_errors = !assembling_succeeded;
|
||||
+ bresult->num_errors = !assembling_succeeded;
|
||||
if (assembling_succeeded) {
|
||||
- result->SetOutputData(assembling_output_data);
|
||||
- result->output_data_size =
|
||||
+ bresult->SetOutputData(assembling_output_data);
|
||||
+ bresult->output_data_size =
|
||||
assembling_output_data->wordCount * sizeof(uint32_t);
|
||||
- result->compilation_status = shaderc_compilation_status_success;
|
||||
+ bresult->compilation_status = shaderc_compilation_status_success;
|
||||
} else {
|
||||
- result->messages = std::move(errors);
|
||||
- result->compilation_status = shaderc_compilation_status_invalid_assembly;
|
||||
+ bresult->messages = std::move(errors);
|
||||
+ bresult->compilation_status = shaderc_compilation_status_invalid_assembly;
|
||||
}
|
||||
}
|
||||
CATCH_IF_EXCEPTIONS_ENABLED(...) {
|
||||
- result->compilation_status = shaderc_compilation_status_internal_error;
|
||||
+ bresult->compilation_status = shaderc_compilation_status_internal_error;
|
||||
}
|
||||
|
||||
- return result;
|
||||
+ return bresult->compilation_status;
|
||||
}
|
||||
|
||||
size_t shaderc_result_get_length(const shaderc_compilation_result_t result) {
|
||||
diff --git a/libshaderc_util/include/libshaderc_util/compiler.h b/libshaderc_util/include/libshaderc_util/compiler.h
|
||||
index d9d02b9..b076ec8 100644
|
||||
--- a/libshaderc_util/include/libshaderc_util/compiler.h
|
||||
+++ b/libshaderc_util/include/libshaderc_util/compiler.h
|
||||
@@ -195,6 +195,7 @@ class Compiler {
|
||||
warnings_as_errors_(false),
|
||||
suppress_warnings_(false),
|
||||
generate_debug_info_(false),
|
||||
+ emit_non_semantic_debug_info_(false),
|
||||
enabled_opt_passes_(),
|
||||
target_env_(TargetEnv::Vulkan),
|
||||
target_env_version_(TargetEnvVersion::Default),
|
||||
@@ -220,6 +221,10 @@ class Compiler {
|
||||
// such as identifier names and line numbers.
|
||||
void SetGenerateDebugInfo();
|
||||
|
||||
+ // Requests that the compiler emit non-semantic debug information.
|
||||
+ // Requires VK_KHR_shader_non_semantic_info.
|
||||
+ void SetEmitNonSemanticDebugInfo();
|
||||
+
|
||||
// Sets the optimization level to the given level. Only the last one takes
|
||||
// effect if multiple calls of this method exist.
|
||||
void SetOptimizationLevel(OptimizationLevel level);
|
||||
@@ -486,6 +491,10 @@ class Compiler {
|
||||
// output.
|
||||
bool generate_debug_info_;
|
||||
|
||||
+ // When true and generate_debug_info_ is also set, generate non-semantic debug
|
||||
+ // information.
|
||||
+ bool emit_non_semantic_debug_info_;
|
||||
+
|
||||
// Optimization passes to be applied.
|
||||
std::vector<PassId> enabled_opt_passes_;
|
||||
|
||||
diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc
|
||||
index e5f5d10..1f9e6a5 100644
|
||||
--- a/libshaderc_util/src/compiler.cc
|
||||
+++ b/libshaderc_util/src/compiler.cc
|
||||
@@ -341,6 +341,11 @@ std::tuple<bool, std::vector<uint32_t>, size_t> Compiler::Compile(
|
||||
options.generateDebugInfo = generate_debug_info_;
|
||||
options.disableOptimizer = true;
|
||||
options.optimizeSize = false;
|
||||
+ options.emitNonSemanticShaderDebugInfo =
|
||||
+ generate_debug_info_ && emit_non_semantic_debug_info_;
|
||||
+ options.emitNonSemanticShaderDebugSource =
|
||||
+ generate_debug_info_ && emit_non_semantic_debug_info_;
|
||||
+
|
||||
// Note the call to GlslangToSpv also populates compilation_output_data.
|
||||
glslang::GlslangToSpv(*program.getIntermediate(used_shader_stage), spirv,
|
||||
&options);
|
||||
@@ -438,6 +443,10 @@ void Compiler::SetGenerateDebugInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
+void Compiler::SetEmitNonSemanticDebugInfo() {
|
||||
+ emit_non_semantic_debug_info_ = true;
|
||||
+}
|
||||
+
|
||||
void Compiler::SetOptimizationLevel(Compiler::OptimizationLevel level) {
|
||||
// Clear previous settings first.
|
||||
enabled_opt_passes_.clear();
|
||||
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
|
||||
index d44f62a..83966b6 100644
|
||||
--- a/third_party/CMakeLists.txt
|
||||
+++ b/third_party/CMakeLists.txt
|
||||
@@ -20,9 +20,9 @@ set(SHADERC_TINT_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/tint" CACHE STRING
|
||||
set(SHADERC_ABSL_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/abseil_cpp" CACHE STRING
|
||||
"Location of re2 source")
|
||||
|
||||
-set( SKIP_GLSLANG_INSTALL ${SHADERC_SKIP_INSTALL} )
|
||||
-set( SKIP_SPIRV_TOOLS_INSTALL ${SHADERC_SKIP_INSTALL} )
|
||||
-set( SKIP_GOOGLETEST_INSTALL ${SHADERC_SKIP_INSTALL} )
|
||||
+set( SKIP_GLSLANG_INSTALL ON )
|
||||
+set( SKIP_SPIRV_TOOLS_INSTALL ON )
|
||||
+set( SKIP_GOOGLETEST_INSTALL ON )
|
||||
|
||||
# Configure third party projects.
|
||||
if(${SHADERC_ENABLE_TESTS})
|
||||
@@ -64,7 +64,10 @@ if (NOT TARGET SPIRV-Tools)
|
||||
add_subdirectory(${SHADERC_RE2_DIR} re2)
|
||||
add_subdirectory(${SHADERC_EFFCEE_DIR} effcee)
|
||||
endif()
|
||||
- add_subdirectory(${SHADERC_SPIRV_TOOLS_DIR} spirv-tools)
|
||||
+ set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "Skip building SPIRV-Tools executables")
|
||||
+ set(SPIRV_TOOLS_BUILD_STATIC OFF CACHE BOOL "Skip building two SPIRV-Tools libs")
|
||||
+ set(SPIRV_TOOLS_LIBRARY_TYPE STATIC CACHE STRING "Build static SPIRV-Tools libs")
|
||||
+ add_subdirectory(${SHADERC_SPIRV_TOOLS_DIR} spirv-tools EXCLUDE_FROM_ALL)
|
||||
if (NOT "${SPIRV_SKIP_TESTS}")
|
||||
if (MSVC)
|
||||
if (${MSVC_VERSION} LESS 1920)
|
||||
@@ -87,8 +90,8 @@ if (NOT TARGET glslang)
|
||||
# Glslang tests are off by default. Turn them on if testing Shaderc.
|
||||
set(GLSLANG_TESTS ON)
|
||||
endif()
|
||||
- set(GLSLANG_ENABLE_INSTALL $<NOT:${SKIP_GLSLANG_INSTALL}>)
|
||||
- add_subdirectory(${SHADERC_GLSLANG_DIR} glslang)
|
||||
+ set(GLSLANG_ENABLE_INSTALL OFF)
|
||||
+ add_subdirectory(${SHADERC_GLSLANG_DIR} glslang EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
if (NOT TARGET glslang)
|
||||
message(FATAL_ERROR "glslang was not found - required for compilation")
|
||||
@@ -1,12 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
source "$SCRIPTDIR/../linux/functions.sh"
|
||||
|
||||
set -e
|
||||
|
||||
# While we use custom Qt builds for our releases, the Qt6 package will be good enough
|
||||
# for just updating translations. Saves building it for this action alone.
|
||||
retry_command sudo apt-get -y install qt6-l10n-tools
|
||||
"$SCRIPTDIR/../../../../tools/retry.sh" sudo apt-get -y install qt6-l10n-tools
|
||||
|
||||
PATH=/usr/lib/qt6/bin:$PATH "$SCRIPTDIR/../../../../pcsx2-qt/Translations/update_en_translation.sh"
|
||||
PATH=/usr/lib/qt6/bin:$PATH "$SCRIPTDIR/../../../../pcsx2-qt/Translations/update_base_translation.sh"
|
||||
|
||||
65
.github/workflows/scripts/linux/appimage-qt.sh
vendored
65
.github/workflows/scripts/linux/appimage-qt.sh
vendored
@@ -26,7 +26,6 @@
|
||||
# For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
source "$SCRIPTDIR/functions.sh"
|
||||
|
||||
if [ "$#" -ne 4 ]; then
|
||||
echo "Syntax: $0 <path to pcsx2 directory> <path to build directory> <deps prefix> <output name>"
|
||||
@@ -42,6 +41,10 @@ BINARY=pcsx2-qt
|
||||
APPDIRNAME=PCSX2.AppDir
|
||||
STRIP=strip
|
||||
|
||||
declare -a MANUAL_LIBS=(
|
||||
"libshaderc_shared.so.1"
|
||||
)
|
||||
|
||||
declare -a MANUAL_QT_LIBS=(
|
||||
"libQt6WaylandEglClientHwIntegration.so.6"
|
||||
)
|
||||
@@ -52,6 +55,12 @@ declare -a MANUAL_QT_PLUGINS=(
|
||||
"wayland-shell-integration"
|
||||
)
|
||||
|
||||
declare -a REMOVE_LIBS=(
|
||||
'libwayland-client.so*'
|
||||
'libwayland-cursor.so*'
|
||||
'libwayland-egl.so*'
|
||||
)
|
||||
|
||||
set -e
|
||||
|
||||
LINUXDEPLOY=./linuxdeploy-x86_64.AppImage
|
||||
@@ -60,24 +69,41 @@ APPIMAGETOOL=./appimagetool-x86_64.AppImage
|
||||
PATCHELF=patchelf
|
||||
|
||||
if [ ! -f "$LINUXDEPLOY" ]; then
|
||||
retry_command wget -O "$LINUXDEPLOY" https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
||||
"$PCSX2DIR/tools/retry.sh" wget -O "$LINUXDEPLOY" https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
||||
chmod +x "$LINUXDEPLOY"
|
||||
fi
|
||||
|
||||
if [ ! -f "$LINUXDEPLOY_PLUGIN_QT" ]; then
|
||||
retry_command wget -O "$LINUXDEPLOY_PLUGIN_QT" https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
|
||||
"$PCSX2DIR/tools/retry.sh" wget -O "$LINUXDEPLOY_PLUGIN_QT" https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
|
||||
chmod +x "$LINUXDEPLOY_PLUGIN_QT"
|
||||
fi
|
||||
|
||||
if [ ! -f "$APPIMAGETOOL" ]; then
|
||||
retry_command wget -O "$APPIMAGETOOL" https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
"$PCSX2DIR/tools/retry.sh" wget -O "$APPIMAGETOOL" https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
chmod +x "$APPIMAGETOOL"
|
||||
fi
|
||||
|
||||
OUTDIR=$(realpath "./$APPDIRNAME")
|
||||
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
rm -fr "$OUTDIR"
|
||||
|
||||
echo "Locating extra libraries..."
|
||||
EXTRA_LIBS_ARGS=""
|
||||
for lib in "${MANUAL_LIBS[@]}"; do
|
||||
srcpath=$(find "$DEPSDIR" -name "$lib")
|
||||
if [ ! -f "$srcpath" ]; then
|
||||
echo "Missinge extra library $lib. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Found $lib at $srcpath."
|
||||
|
||||
if [ "$EXTRA_LIBS_ARGS" == "" ]; then
|
||||
EXTRA_LIBS_ARGS="--library=$srcpath"
|
||||
else
|
||||
EXTRA_LIBS_ARGS="$EXTRA_LIBS_ARGS,$srcpath"
|
||||
fi
|
||||
done
|
||||
|
||||
# Why the nastyness? linuxdeploy strips our main binary, and there's no option to turn it off.
|
||||
# It also doesn't strip the Qt libs. We can't strip them after running linuxdeploy, because
|
||||
# patchelf corrupts the libraries (but they still work), but patchelf+strip makes them crash
|
||||
@@ -99,11 +125,12 @@ cp "$PCSX2DIR/.github/workflows/scripts/linux/pcsx2-qt.desktop" "net.pcsx2.PCSX2
|
||||
cp "$PCSX2DIR/bin/resources/icons/AppIconLarge.png" "PCSX2.png"
|
||||
|
||||
echo "Running linuxdeploy to create AppDir..."
|
||||
EXTRA_QT_PLUGINS="core;gui;network;svg;waylandclient;widgets;xcbqpa" \
|
||||
EXTRA_QT_PLUGINS="core;gui;svg;waylandclient;widgets;xcbqpa" \
|
||||
EXTRA_PLATFORM_PLUGINS="libqwayland-egl.so;libqwayland-generic.so" \
|
||||
DEPLOY_PLATFORM_THEMES="1" \
|
||||
QMAKE="$DEPSDIR/bin/qmake" \
|
||||
NO_STRIP="1" \
|
||||
$LINUXDEPLOY --plugin qt --appdir="$OUTDIR" --executable="$BUILDDIR/bin/pcsx2-qt" \
|
||||
$LINUXDEPLOY --plugin qt --appdir="$OUTDIR" --executable="$BUILDDIR/bin/pcsx2-qt" $EXTRA_LIBS_ARGS \
|
||||
--desktop-file="net.pcsx2.PCSX2.desktop" --icon-file="PCSX2.png"
|
||||
|
||||
echo "Copying resources into AppDir..."
|
||||
@@ -137,13 +164,22 @@ for GROUP in "${MANUAL_QT_PLUGINS[@]}"; do
|
||||
done
|
||||
done
|
||||
|
||||
# Why do we have to manually remove these libs? Because the linuxdeploy Qt plugin
|
||||
# copies them, not the "main" linuxdeploy binary, and plugins don't inherit the
|
||||
# include list...
|
||||
for lib in "${REMOVE_LIBS[@]}"; do
|
||||
for libpath in $(find "$OUTDIR/usr/lib" -name "$lib"); do
|
||||
echo " Removing problematic library ${libpath}."
|
||||
rm -f "$libpath"
|
||||
done
|
||||
done
|
||||
|
||||
# Restore unstripped deps (for cache).
|
||||
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 +187,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
|
||||
|
||||
@@ -2,52 +2,141 @@
|
||||
|
||||
set -e
|
||||
|
||||
INSTALLDIR="$HOME/deps"
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Syntax: $0 <output directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCRIPTDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
|
||||
NPROCS="$(getconf _NPROCESSORS_ONLN)"
|
||||
SDL=SDL2-2.28.1
|
||||
QT=6.5.2
|
||||
INSTALLDIR="$1"
|
||||
if [ "${INSTALLDIR:0:1}" != "/" ]; then
|
||||
INSTALLDIR="$PWD/$INSTALLDIR"
|
||||
fi
|
||||
|
||||
LIBBACKTRACE=ad106d5fdd5d960bd33fae1c48a351af567fd075
|
||||
LIBJPEG=9f
|
||||
LIBPNG=1.6.43
|
||||
LIBWEBP=1.4.0
|
||||
LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
SDL=SDL2-2.30.5
|
||||
QT=6.7.2
|
||||
ZSTD=1.5.6
|
||||
|
||||
SHADERC=2024.1
|
||||
SHADERC_GLSLANG=142052fa30f9eca191aa9dcf65359fcaed09eeec
|
||||
SHADERC_SPIRVHEADERS=5e3ad389ee56fca27c9705d093ae5387ce404df4
|
||||
SHADERC_SPIRVTOOLS=dd4b663e13c07fea4fbb3f70c1c91c86731099f7
|
||||
|
||||
mkdir -p deps-build
|
||||
cd deps-build
|
||||
|
||||
cat > SHASUMS <<EOF
|
||||
4977ceba5c0054dbe6c2f114641aced43ce3bf2b41ea64b6a372d6ba129cb15d $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
|
||||
04705c110cb2469caa79fb71fba3d7bf834914706e9641a4589485c1f832565b jpegsrc.v$LIBJPEG.tar.gz
|
||||
6a5ca0652392a2d7c9db2ae5b40210843c0bbc081cbd410825ab00cc59f14a6c libpng-$LIBPNG.tar.xz
|
||||
61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5 libwebp-$LIBWEBP.tar.gz
|
||||
0728800155f3ed0a0c87e03addbd30ecbe374f7b080678bbca1506051d50dec3 $LZ4.tar.gz
|
||||
f374f3fa29c37dfcc20822d4a7d7dc57e58924d1a5f2ad511bfab4c8193de63b $SDL.tar.gz
|
||||
8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 zstd-$ZSTD.tar.gz
|
||||
c5f22a5e10fb162895ded7de0963328e7307611c688487b5d152c9ee64767599 qtbase-everywhere-src-$QT.tar.xz
|
||||
e1a1d8785fae67d16ad0a443b01d5f32663a6b68d275f1806ebab257485ce5d6 qtimageformats-everywhere-src-$QT.tar.xz
|
||||
fb0d1286a35be3583fee34aeb5843c94719e07193bdf1d4d8b0dc14009caef01 qtsvg-everywhere-src-$QT.tar.xz
|
||||
58e855ad1b2533094726c8a425766b63a04a0eede2ed85086860e54593aa4b2a qttools-everywhere-src-$QT.tar.xz
|
||||
9845780b5dc1b7279d57836db51aeaf2e4a1160c42be09750616f39157582ca9 qttranslations-everywhere-src-$QT.tar.xz
|
||||
a2a057e1dd644bd44abb9990fecc194b2e25c2e0f39e81aa9fee4c1e5e2a8a5b qtwayland-everywhere-src-$QT.tar.xz
|
||||
eb3b5f0c16313d34f208d90c2fa1e588a23283eed63b101edd5422be6165d528 shaderc-$SHADERC.tar.gz
|
||||
aa27e4454ce631c5a17924ce0624eac736da19fc6f5a2ab15a6c58da7b36950f shaderc-glslang-$SHADERC_GLSLANG.tar.gz
|
||||
5d866ce34a4b6908e262e5ebfffc0a5e11dd411640b5f24c85a80ad44c0d4697 shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz
|
||||
03ee1a2c06f3b61008478f4abe9423454e53e580b9488b47c8071547c6a9db47 shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz
|
||||
EOF
|
||||
|
||||
curl -L \
|
||||
-O "https://libsdl.org/release/$SDL.tar.gz" \
|
||||
curl -C - -L \
|
||||
-O "https://github.com/ianlancetaylor/libbacktrace/archive/$LIBBACKTRACE.zip" \
|
||||
-O "https://ijg.org/files/jpegsrc.v$LIBJPEG.tar.gz" \
|
||||
-O "https://downloads.sourceforge.net/project/libpng/libpng16/$LIBPNG/libpng-$LIBPNG.tar.xz" \
|
||||
-O "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$LIBWEBP.tar.gz" \
|
||||
-O "https://github.com/lz4/lz4/archive/$LZ4.tar.gz" \
|
||||
-O "https://libsdl.org/release/$SDL.tar.gz" \
|
||||
-O "https://github.com/facebook/zstd/releases/download/v$ZSTD/zstd-$ZSTD.tar.gz" \
|
||||
-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" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtwayland-everywhere-src-$QT.tar.xz"
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtwayland-everywhere-src-$QT.tar.xz" \
|
||||
-o "shaderc-$SHADERC.tar.gz" "https://github.com/google/shaderc/archive/refs/tags/v$SHADERC.tar.gz" \
|
||||
-o "shaderc-glslang-$SHADERC_GLSLANG.tar.gz" "https://github.com/KhronosGroup/glslang/archive/$SHADERC_GLSLANG.tar.gz" \
|
||||
-o "shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Headers/archive/$SHADERC_SPIRVHEADERS.tar.gz" \
|
||||
-o "shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Tools/archive/$SHADERC_SPIRVTOOLS.tar.gz"
|
||||
|
||||
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
|
||||
make "-j$NPROCS"
|
||||
echo "Building libbacktrace..."
|
||||
rm -fr "libbacktrace-$LIBBACKTRACE"
|
||||
unzip "$LIBBACKTRACE.zip"
|
||||
cd "libbacktrace-$LIBBACKTRACE"
|
||||
./configure --prefix="$INSTALLDIR"
|
||||
make
|
||||
make install
|
||||
cd ..
|
||||
|
||||
echo "Building libbacktrace..."
|
||||
unzip "$LIBBACKTRACE.zip"
|
||||
cd "libbacktrace-$LIBBACKTRACE"
|
||||
./configure --prefix="$HOME/deps"
|
||||
make
|
||||
echo "Building libpng..."
|
||||
rm -fr "libpng-$LIBPNG"
|
||||
tar xf "libpng-$LIBPNG.tar.xz"
|
||||
cd "libpng-$LIBPNG"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DBUILD_SHARED_LIBS=ON -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_STATIC=OFF -DPNG_SHARED=ON -DPNG_TOOLS=OFF -B build -G Ninja
|
||||
cmake --build build --parallel
|
||||
ninja -C build install
|
||||
cd ..
|
||||
|
||||
echo "Building libjpeg..."
|
||||
rm -fr "jpeg-$LIBJPEG"
|
||||
tar xf "jpegsrc.v$LIBJPEG.tar.gz"
|
||||
cd "jpeg-$LIBJPEG"
|
||||
mkdir build
|
||||
cd build
|
||||
../configure --prefix="$INSTALLDIR" --disable-static --enable-shared
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ../..
|
||||
|
||||
echo "Building LZ4..."
|
||||
rm -fr "lz4-$LZ4"
|
||||
tar xf "$LZ4.tar.gz"
|
||||
cd "lz4-$LZ4"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DBUILD_SHARED_LIBS=ON -DLZ4_BUILD_CLI=OFF -DLZ4_BUILD_LEGACY_LZ4C=OFF -B build-dir -G Ninja build/cmake
|
||||
cmake --build build-dir --parallel
|
||||
ninja -C build-dir install
|
||||
cd ..
|
||||
|
||||
echo "Building Zstandard..."
|
||||
rm -fr "zstd-$ZSTD"
|
||||
tar xf "zstd-$ZSTD.tar.gz"
|
||||
cd "zstd-$ZSTD"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_SHARED=ON -DZSTD_BUILD_STATIC=OFF -DZSTD_BUILD_PROGRAMS=OFF -B build -G Ninja build/cmake
|
||||
cmake --build build --parallel
|
||||
ninja -C build install
|
||||
cd ..
|
||||
|
||||
echo "Building WebP..."
|
||||
rm -fr "libwebp-$LIBWEBP"
|
||||
tar xf "libwebp-$LIBWEBP.tar.gz"
|
||||
cd "libwebp-$LIBWEBP"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -B build -G Ninja \
|
||||
-DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF \
|
||||
-DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON
|
||||
cmake --build build --parallel
|
||||
ninja -C build install
|
||||
cd ..
|
||||
|
||||
echo "Building SDL..."
|
||||
rm -fr "$SDL"
|
||||
tar xf "$SDL.tar.gz"
|
||||
cd "$SDL"
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DBUILD_SHARED_LIBS=ON -DSDL_SHARED=ON -DSDL_STATIC=OFF -G Ninja
|
||||
cmake --build build --parallel
|
||||
ninja -C build install
|
||||
cd ..
|
||||
|
||||
# Couple notes:
|
||||
@@ -56,65 +145,54 @@ cd ..
|
||||
# ICU avoids pulling in a bunch of large libraries, and hopefully we can get away without it.
|
||||
# OpenGL is needed to render window decorations in Wayland, apparently.
|
||||
echo "Building Qt Base..."
|
||||
rm -fr "qtbase-everywhere-src-$QT"
|
||||
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 -xcb -gtk -- -DFEATURE_dbus=ON -DFEATURE_icu=OFF -DFEATURE_sql=OFF -DFEATURE_system_png=ON -DFEATURE_system_jpeg=ON -DFEATURE_system_zlib=ON -DFEATURE_system_freetype=ON -DFEATURE_system_harfbuzz=ON
|
||||
cmake --build . --parallel
|
||||
cmake --install .
|
||||
ninja install
|
||||
cd ../../
|
||||
|
||||
echo "Building Qt SVG..."
|
||||
rm -fr "qtsvg-everywhere-src-$QT"
|
||||
tar xf "qtsvg-everywhere-src-$QT.tar.xz"
|
||||
cd "qtsvg-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release ..
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- -DCMAKE_PREFIX_PATH="$INSTALLDIR"
|
||||
cmake --build . --parallel
|
||||
cmake --install .
|
||||
ninja install
|
||||
cd ../../
|
||||
|
||||
echo "Building Qt Image Formats..."
|
||||
rm -fr "qtimageformats-everywhere-src-$QT"
|
||||
tar xf "qtimageformats-everywhere-src-$QT.tar.xz"
|
||||
cd "qtimageformats-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release ..
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DFEATURE_system_webp=ON
|
||||
cmake --build . --parallel
|
||||
cmake --install .
|
||||
ninja install
|
||||
cd ../../
|
||||
|
||||
echo "Building Qt Wayland..."
|
||||
rm -fr "qtwayland-everywhere-src-$QT"
|
||||
tar xf "qtwayland-everywhere-src-$QT.tar.xz"
|
||||
cd "qtwayland-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release ..
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- -DCMAKE_PREFIX_PATH="$INSTALLDIR"
|
||||
cmake --build . --parallel
|
||||
cmake --install .
|
||||
ninja install
|
||||
cd ../../
|
||||
|
||||
echo "Installing Qt Tools..."
|
||||
rm -fr "qttools-everywhere-src-$QT"
|
||||
tar xf "qttools-everywhere-src-$QT.tar.xz"
|
||||
cd "qttools-everywhere-src-$QT"
|
||||
# From Mac build-dependencies.sh:
|
||||
# Linguist relies on a library in the Designer target, which takes 5-7 minutes to build on the CI
|
||||
# Avoid it by not building Linguist, since we only need the tools that come with it
|
||||
patch -u src/linguist/CMakeLists.txt <<EOF
|
||||
--- src/linguist/CMakeLists.txt
|
||||
+++ src/linguist/CMakeLists.txt
|
||||
@@ -14,7 +14,7 @@
|
||||
add_subdirectory(lrelease-pro)
|
||||
add_subdirectory(lupdate)
|
||||
add_subdirectory(lupdate-pro)
|
||||
-if(QT_FEATURE_process AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets AND NOT no-png)
|
||||
+if(QT_FEATURE_process AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets AND TARGET Qt::PrintSupport AND NOT no-png)
|
||||
add_subdirectory(linguist)
|
||||
endif()
|
||||
EOF
|
||||
|
||||
# Also force disable clang scanning, it gets very confused.
|
||||
# Force disable clang scanning, it gets very confused.
|
||||
patch -u configure.cmake <<EOF
|
||||
--- configure.cmake
|
||||
+++ configure.cmake
|
||||
@@ -139,21 +217,40 @@ EOF
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release -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 ..
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DFEATURE_assistant=OFF -DFEATURE_clang=OFF -DFEATURE_designer=ON -DFEATURE_kmap2qmap=OFF -DFEATURE_pixeltool=OFF -DFEATURE_pkg_config=OFF -DFEATURE_qev=OFF -DFEATURE_qtattributionsscanner=OFF -DFEATURE_qtdiag=OFF -DFEATURE_qtplugininfo=OFF
|
||||
cmake --build . --parallel
|
||||
cmake --install .
|
||||
ninja install
|
||||
cd ../../
|
||||
|
||||
echo "Installing Qt Translations..."
|
||||
rm -fr "qttranslations-everywhere-src-$QT"
|
||||
tar xf "qttranslations-everywhere-src-$QT.tar.xz"
|
||||
cd "qttranslations-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release ..
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- -DCMAKE_PREFIX_PATH="$INSTALLDIR"
|
||||
cmake --build . --parallel
|
||||
cmake --install .
|
||||
ninja install
|
||||
cd ../../
|
||||
|
||||
echo "Building shaderc..."
|
||||
rm -fr "shaderc-$SHADERC"
|
||||
tar xf "shaderc-$SHADERC.tar.gz"
|
||||
cd "shaderc-$SHADERC"
|
||||
cd third_party
|
||||
tar xf "../../shaderc-glslang-$SHADERC_GLSLANG.tar.gz"
|
||||
mv "glslang-$SHADERC_GLSLANG" "glslang"
|
||||
tar xf "../../shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz"
|
||||
mv "SPIRV-Headers-$SHADERC_SPIRVHEADERS" "spirv-headers"
|
||||
tar xf "../../shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz"
|
||||
mv "SPIRV-Tools-$SHADERC_SPIRVTOOLS" "spirv-tools"
|
||||
cd ..
|
||||
patch -p1 < "$SCRIPTDIR/../common/shaderc-changes.patch"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -B build -G Ninja
|
||||
cmake --build build --parallel
|
||||
ninja -C build install
|
||||
cd ..
|
||||
|
||||
echo "Cleaning up..."
|
||||
cd ..
|
||||
rm -r deps-build
|
||||
|
||||
15
.github/workflows/scripts/linux/compile.sh
vendored
15
.github/workflows/scripts/linux/compile.sh
vendored
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -n "${GITHUB_ACTIONS}" ]; then
|
||||
echo "Warning: Running this script outside of GitHub Actions isn't recommended."
|
||||
fi
|
||||
|
||||
# Prepare the Cache
|
||||
ccache -p
|
||||
ccache -z
|
||||
# Build
|
||||
ninja
|
||||
# Save the Cache
|
||||
ccache -s
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "libaio",
|
||||
"no-autogen": true,
|
||||
"make-install-args": [
|
||||
"prefix=/app"
|
||||
],
|
||||
"build-options": {
|
||||
"strip": true
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://pagure.io/libaio.git",
|
||||
"tag": "libaio-0.3.113",
|
||||
"commit": "1b18bfafc6a2f7b9fa2c6be77a95afed8b7be448"
|
||||
}
|
||||
],
|
||||
"cleanup": [
|
||||
"/include",
|
||||
"/lib/*.a",
|
||||
"/lib/*.la"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,26 +1,12 @@
|
||||
{
|
||||
"name": "sdl2",
|
||||
"buildsystem": "autotools",
|
||||
"no-autogen": true,
|
||||
"buildsystem": "cmake-ninja",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"--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"
|
||||
"-DBUILD_SHARED_LIBS=ON",
|
||||
"-DSDL_SHARED=ON",
|
||||
"-DSDL_STATIC=OFF",
|
||||
"-DSDL_TESTS=OFF"
|
||||
],
|
||||
"build-options": {
|
||||
"strip": true
|
||||
@@ -28,8 +14,8 @@
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://libsdl.org/release/SDL2-2.28.1.tar.gz",
|
||||
"sha256": "4977ceba5c0054dbe6c2f114641aced43ce3bf2b41ea64b6a372d6ba129cb15d"
|
||||
"url": "https://libsdl.org/release/SDL2-2.30.5.tar.gz",
|
||||
"sha256": "f374f3fa29c37dfcc20822d4a7d7dc57e58924d1a5f2ad511bfab4c8193de63b"
|
||||
}
|
||||
],
|
||||
"cleanup": [
|
||||
@@ -42,4 +28,3 @@
|
||||
"/share/aclocal"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
51
.github/workflows/scripts/linux/flatpak/modules/22-shaderc.json
vendored
Normal file
51
.github/workflows/scripts/linux/flatpak/modules/22-shaderc.json
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "shaderc",
|
||||
"buildsystem": "cmake-ninja",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"-DCMAKE_BUILD_TYPE=Release",
|
||||
"-DSHADERC_SKIP_TESTS=ON",
|
||||
"-DSHADERC_SKIP_EXAMPLES=ON",
|
||||
"-DSHADERC_SKIP_COPYRIGHT_CHECK=ON"
|
||||
],
|
||||
"build-options": {
|
||||
"strip": true
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/google/shaderc.git",
|
||||
"commit": "47a9387ef5b3600d30d84c71ec77a59dc7db46fa"
|
||||
},
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://github.com/KhronosGroup/glslang/archive/142052fa30f9eca191aa9dcf65359fcaed09eeec.tar.gz",
|
||||
"sha256": "aa27e4454ce631c5a17924ce0624eac736da19fc6f5a2ab15a6c58da7b36950f",
|
||||
"dest": "third_party/glslang"
|
||||
},
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://github.com/KhronosGroup/SPIRV-Headers/archive/5e3ad389ee56fca27c9705d093ae5387ce404df4.tar.gz",
|
||||
"sha256": "5d866ce34a4b6908e262e5ebfffc0a5e11dd411640b5f24c85a80ad44c0d4697",
|
||||
"dest": "third_party/spirv-headers"
|
||||
},
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://github.com/KhronosGroup/SPIRV-Tools/archive/dd4b663e13c07fea4fbb3f70c1c91c86731099f7.tar.gz",
|
||||
"sha256": "03ee1a2c06f3b61008478f4abe9423454e53e580b9488b47c8071547c6a9db47",
|
||||
"dest": "third_party/spirv-tools"
|
||||
},
|
||||
{
|
||||
"type": "patch",
|
||||
"path": "../../../common/shaderc-changes.patch"
|
||||
}
|
||||
],
|
||||
"cleanup": [
|
||||
"/bin",
|
||||
"/include",
|
||||
"/lib/*.a",
|
||||
"/lib/*.la",
|
||||
"/lib/cmake",
|
||||
"/lib/pkgconfig"
|
||||
]
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"app-id": "net.pcsx2.PCSX2",
|
||||
"runtime": "org.kde.Platform",
|
||||
"runtime-version": "6.5",
|
||||
"runtime-version": "6.7",
|
||||
"sdk": "org.kde.Sdk",
|
||||
"sdk-extensions": [
|
||||
"org.freedesktop.Sdk.Extension.llvm16"
|
||||
"org.freedesktop.Sdk.Extension.llvm17"
|
||||
],
|
||||
"add-extensions": {
|
||||
"org.freedesktop.Platform.ffmpeg-full": {
|
||||
@@ -19,30 +19,39 @@
|
||||
"--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",
|
||||
"modules/11-libaio.json",
|
||||
"modules/20-sdl2.json",
|
||||
"modules/21-libbacktrace.json",
|
||||
"modules/22-shaderc.json",
|
||||
{
|
||||
"name": "pcsx2",
|
||||
"buildsystem": "simple",
|
||||
"buildsystem": "cmake-ninja",
|
||||
"builddir": true,
|
||||
"no-make-install": true,
|
||||
"build-options": {
|
||||
"strip": false,
|
||||
"no-debuginfo": true,
|
||||
"env": {
|
||||
"DEPS_PREFIX": "/app",
|
||||
"COMPILER": "clang",
|
||||
"CLANG_PATH": "/usr/lib/sdk/llvm16/bin/clang",
|
||||
"CLANGXX_PATH": "/usr/lib/sdk/llvm16/bin/clang++",
|
||||
"ADDITIONAL_CMAKE_ARGS": "-DUSE_LINKED_FFMPEG=ON"
|
||||
}
|
||||
"cflags": "",
|
||||
"cflags-override": true,
|
||||
"cxxflags": "",
|
||||
"cxxflags-override": true,
|
||||
"config-opts": [
|
||||
"-DCMAKE_BUILD_TYPE=Release",
|
||||
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON",
|
||||
"-DCMAKE_C_COMPILER=/usr/lib/sdk/llvm17/bin/clang",
|
||||
"-DCMAKE_CXX_COMPILER=/usr/lib/sdk/llvm17/bin/clang++",
|
||||
"-DCMAKE_EXE_LINKER_FLAGS_INIT=-fuse-ld=lld",
|
||||
"-DCMAKE_MODULE_LINKER_FLAGS_INIT=-fuse-ld=lld",
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS_INIT=-fuse-ld=lld",
|
||||
"-DUSE_LINKED_FFMPEG=ON",
|
||||
"-DDISABLE_ADVANCE_SIMD=TRUE"
|
||||
]
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
@@ -50,17 +59,13 @@
|
||||
"path": "../../../../.."
|
||||
}
|
||||
],
|
||||
"build-commands": [
|
||||
".github/workflows/scripts/linux/generate-cmake-qt.sh",
|
||||
"cd build && ../.github/workflows/scripts/linux/compile.sh && cd ..",
|
||||
"cp -a build/bin ${FLATPAK_DEST}",
|
||||
"cd build && ninja unittests && cd .."
|
||||
],
|
||||
"post-install": [
|
||||
"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"
|
||||
"cp -a bin \"${FLATPAK_DEST}\"",
|
||||
"install -Dm644 \"${FLATPAK_BUILDER_BUILDDIR}/bin/resources/icons/AppIconLarge.png\" \"${FLATPAK_DEST}/share/icons/hicolor/512x512/apps/net.pcsx2.PCSX2.png\"",
|
||||
"install -Dm644 \"${FLATPAK_BUILDER_BUILDDIR}/.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 \"${FLATPAK_BUILDER_BUILDDIR}/.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\""
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
16
.github/workflows/scripts/linux/functions.sh
vendored
16
.github/workflows/scripts/linux/functions.sh
vendored
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function retry_command {
|
||||
# Package servers tend to be unreliable at times..
|
||||
# Retry a bunch of times.
|
||||
local RETRIES=10
|
||||
|
||||
for i in $(seq 1 "$RETRIES"); do
|
||||
"$@" && break
|
||||
if [ "$i" == "$RETRIES" ]; then
|
||||
echo "Command \"$@\" failed after ${RETRIES} retries."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -z "${DEPS_PREFIX}" ]]; then
|
||||
echo "DEPS_PREFIX is not set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using build dependencies from: ${DEPS_PREFIX}"
|
||||
|
||||
if [ "${COMPILER}" = "clang" ]; then
|
||||
if [[ -z "${CLANG_PATH}" ]] || [[ -z "${CLANGXX_PATH}" ]]; then
|
||||
echo "CLANG_PATH or CLANGXX_PATH is not set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using clang toolchain"
|
||||
cat > "clang-toolchain.cmake" << EOF
|
||||
set(CMAKE_C_COMPILER "${CLANG_PATH}")
|
||||
set(CMAKE_CXX_COMPILER "${CLANGXX_PATH}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld")
|
||||
EOF
|
||||
ADDITIONAL_CMAKE_ARGS="$ADDITIONAL_CMAKE_ARGS -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_TOOLCHAIN_FILE=clang-toolchain.cmake"
|
||||
fi
|
||||
|
||||
echo "Additional CMake Args - ${ADDITIONAL_CMAKE_ARGS}"
|
||||
|
||||
# Generate CMake into ./build
|
||||
# DISABLE_ADVANCE_SIMD is needed otherwise we end up doing -march=native.
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
cmake \
|
||||
-B build \
|
||||
-G Ninja \
|
||||
$ADDITIONAL_CMAKE_ARGS \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DQT_BUILD=ON \
|
||||
-DCUBEB_API=ON \
|
||||
-DX11_API=ON \
|
||||
-DWAYLAND_API=ON \
|
||||
-DENABLE_SETCAP=OFF \
|
||||
-DCMAKE_PREFIX_PATH="${DEPS_PREFIX}" \
|
||||
-DUSE_SYSTEM_SDL2=ON \
|
||||
-DUSE_SYSTEM_ZSTD=OFF \
|
||||
-DDISABLE_ADVANCE_SIMD=TRUE
|
||||
|
||||
@@ -8,7 +8,7 @@ if [[ $# -lt 1 ]]; then
|
||||
fi
|
||||
|
||||
OUTFILE=$1
|
||||
GIT_DATE=$(git log -1 --pretty=%cd --date=short)
|
||||
GIT_DATE=$(git log -1 --pretty=%cd --date=iso8601)
|
||||
GIT_VERSION=$(git tag --points-at HEAD)
|
||||
GIT_HASH=$(git rev-parse HEAD)
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
source "$SCRIPTDIR/functions.sh"
|
||||
|
||||
set -e
|
||||
|
||||
ARCH=x86_64
|
||||
KDE_BRANCH=6.5
|
||||
BRANCH=22.08
|
||||
FLAT_MANAGER_CLIENT_DIR="$HOME/.local/bin"
|
||||
|
||||
# Build packages. Mostly needed for flat-manager-client.
|
||||
declare -a BUILD_PACKAGES=(
|
||||
"flatpak"
|
||||
"flatpak-builder"
|
||||
"appstream-util"
|
||||
"python3-aiohttp"
|
||||
"python3-tenacity"
|
||||
"python3-gi"
|
||||
"gobject-introspection"
|
||||
"libappstream-glib8"
|
||||
"libappstream-glib-dev"
|
||||
"libappstream-dev"
|
||||
"gir1.2-ostree-1.0"
|
||||
)
|
||||
|
||||
# Flatpak runtimes and SDKs.
|
||||
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.appstream-glib/${ARCH}/stable"
|
||||
)
|
||||
|
||||
retry_command sudo apt-get -qq update
|
||||
|
||||
# Install packages needed for building
|
||||
echo "Will install the following packages for building - ${BUILD_PACKAGES[*]}"
|
||||
retry_command sudo apt-get -y install "${BUILD_PACKAGES[@]}"
|
||||
|
||||
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
# Install packages needed for building
|
||||
echo "Will install the following packages for building - ${FLATPAK_PACKAGES[*]}"
|
||||
retry_command sudo flatpak -y install "${FLATPAK_PACKAGES[@]}"
|
||||
|
||||
echo "Downloading flat-manager-client"
|
||||
mkdir -p "$FLAT_MANAGER_CLIENT_DIR"
|
||||
pushd "$FLAT_MANAGER_CLIENT_DIR"
|
||||
aria2c -Z "https://raw.githubusercontent.com/flatpak/flat-manager/9401efbdc0d6bd489507d8401c567ba219d735d5/flat-manager-client"
|
||||
chmod +x flat-manager-client
|
||||
echo "$FLAT_MANAGER_CLIENT_DIR" >> $GITHUB_PATH
|
||||
popd
|
||||
@@ -1,83 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
source "$SCRIPTDIR/functions.sh"
|
||||
|
||||
set -e
|
||||
|
||||
# Packages - Build and Qt
|
||||
declare -a BUILD_PACKAGES=(
|
||||
"build-essential"
|
||||
"g++"
|
||||
"git"
|
||||
"cmake"
|
||||
"ccache"
|
||||
"ninja-build"
|
||||
"patchelf"
|
||||
"libfuse2"
|
||||
"libglib2.0-dev"
|
||||
"libfontconfig1-dev"
|
||||
"libharfbuzz-dev"
|
||||
"libjpeg-dev"
|
||||
"libpng-dev"
|
||||
"libfreetype-dev"
|
||||
"libinput-dev"
|
||||
"libxcb-*-dev"
|
||||
"libxkbcommon-dev"
|
||||
"libxkbcommon-x11-dev"
|
||||
"libxrender-dev"
|
||||
"libwayland-dev"
|
||||
"libgl1-mesa-dev"
|
||||
"libegl-dev"
|
||||
"libegl1-mesa-dev"
|
||||
"libgl1-mesa-dev"
|
||||
"libssl-dev"
|
||||
)
|
||||
|
||||
# Packages - PCSX2
|
||||
declare -a PCSX2_PACKAGES=(
|
||||
"extra-cmake-modules"
|
||||
"libaio-dev"
|
||||
"libasound2-dev"
|
||||
"libbz2-dev"
|
||||
"libcurl4-openssl-dev"
|
||||
"libegl1-mesa-dev"
|
||||
"libgl1-mesa-dev"
|
||||
"libgtk-3-dev"
|
||||
"libharfbuzz-dev"
|
||||
"libjpeg-dev"
|
||||
"liblzma-dev"
|
||||
"libpcap0.8-dev"
|
||||
"libpng-dev"
|
||||
"libpulse-dev"
|
||||
"librsvg2-dev"
|
||||
"libsamplerate0-dev"
|
||||
"libudev-dev"
|
||||
"libx11-xcb-dev"
|
||||
"libavcodec-dev"
|
||||
"libavformat-dev"
|
||||
"libavutil-dev"
|
||||
"libswresample-dev"
|
||||
"libswscale-dev"
|
||||
"pkg-config"
|
||||
"zlib1g-dev"
|
||||
)
|
||||
|
||||
if [ "${COMPILER}" = "clang" ]; then
|
||||
BUILD_PACKAGES+=("llvm-16" "lld-16" "clang-16")
|
||||
|
||||
# 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'
|
||||
fi
|
||||
|
||||
retry_command sudo apt-get -qq update && break
|
||||
|
||||
# Install packages needed for building
|
||||
echo "Will install the following packages for building - ${BUILD_PACKAGES[*]}"
|
||||
retry_command sudo apt-get -y install "${BUILD_PACKAGES[@]}"
|
||||
|
||||
# Install packages needed by pcsx2
|
||||
PCSX2_PACKAGES=("${PCSX2_PACKAGES[@]}")
|
||||
echo "Will install the following packages for pcsx2 - ${PCSX2_PACKAGES[*]}"
|
||||
retry_command sudo apt-get -y install "${PCSX2_PACKAGES[@]}"
|
||||
385
.github/workflows/scripts/macos/build-dependencies-universal.sh
vendored
Executable file
385
.github/workflows/scripts/macos/build-dependencies-universal.sh
vendored
Executable file
@@ -0,0 +1,385 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
merge_binaries() {
|
||||
X86DIR=$1
|
||||
ARMDIR=$2
|
||||
echo "Merging ARM64 binaries from $ARMDIR into fat binaries at $X86DIR..."
|
||||
|
||||
IFS="
|
||||
"
|
||||
pushd "$X86DIR"
|
||||
for X86BIN in $(find . -type f \( -name '*.dylib' -o -name '*.a' -o -perm +111 \)); do
|
||||
if file "$X86DIR/$X86BIN" | grep "Mach-O " >/dev/null; then
|
||||
ARMBIN="${ARMDIR}/${X86BIN}"
|
||||
echo "Merge $ARMBIN to $X86BIN..."
|
||||
lipo -create "$X86BIN" "$ARMBIN" -o "$X86BIN"
|
||||
fi
|
||||
done
|
||||
popd
|
||||
}
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Syntax: $0 <output directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The bundled ffmpeg has a lot of things disabled to reduce code size.
|
||||
# Users may want to use system ffmpeg for additional features
|
||||
: ${BUILD_FFMPEG:=1}
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=11.0
|
||||
|
||||
NPROCS="$(getconf _NPROCESSORS_ONLN)"
|
||||
SCRIPTDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
|
||||
INSTALLDIR="$1"
|
||||
if [ "${INSTALLDIR:0:1}" != "/" ]; then
|
||||
INSTALLDIR="$PWD/$INSTALLDIR"
|
||||
fi
|
||||
|
||||
FREETYPE=2.13.2
|
||||
HARFBUZZ=8.3.1
|
||||
SDL=SDL2-2.30.3
|
||||
ZSTD=1.5.5
|
||||
LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
LIBPNG=1.6.43
|
||||
LIBJPEG=9f
|
||||
LIBWEBP=1.3.2
|
||||
FFMPEG=6.0
|
||||
MOLTENVK=1.2.8
|
||||
QT=6.7.1
|
||||
|
||||
SHADERC=2024.1
|
||||
SHADERC_GLSLANG=142052fa30f9eca191aa9dcf65359fcaed09eeec
|
||||
SHADERC_SPIRVHEADERS=5e3ad389ee56fca27c9705d093ae5387ce404df4
|
||||
SHADERC_SPIRVTOOLS=dd4b663e13c07fea4fbb3f70c1c91c86731099f7
|
||||
|
||||
mkdir -p deps-build
|
||||
cd deps-build
|
||||
|
||||
export PKG_CONFIG_PATH="$INSTALLDIR/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
export LDFLAGS="-L$INSTALLDIR/lib $LDFLAGS"
|
||||
export CFLAGS="-I$INSTALLDIR/include $CFLAGS"
|
||||
export CXXFLAGS="-I$INSTALLDIR/include $CXXFLAGS"
|
||||
CMAKE_COMMON=(
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="-dead_strip -dead_strip_dylibs"
|
||||
-DCMAKE_PREFIX_PATH="$INSTALLDIR"
|
||||
-DCMAKE_INSTALL_PREFIX="$INSTALLDIR"
|
||||
-DCMAKE_INSTALL_NAME_DIR='$<INSTALL_PREFIX>/lib'
|
||||
)
|
||||
CMAKE_ARCH_X64=-DCMAKE_OSX_ARCHITECTURES="x86_64"
|
||||
CMAKE_ARCH_ARM64=-DCMAKE_OSX_ARCHITECTURES="arm64"
|
||||
CMAKE_ARCH_UNIVERSAL=-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
|
||||
|
||||
cat > SHASUMS <<EOF
|
||||
12991c4e55c506dd7f9b765933e62fd2be2e06d421505d7950a132e4f1bb484d freetype-$FREETYPE.tar.xz
|
||||
19a54fe9596f7a47c502549fce8e8a10978c697203774008cc173f8360b19a9a harfbuzz-$HARFBUZZ.tar.gz
|
||||
820440072f8f5b50188c1dae104f2ad25984de268785be40c41a099a510f0aec $SDL.tar.gz
|
||||
9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4 zstd-$ZSTD.tar.gz
|
||||
0728800155f3ed0a0c87e03addbd30ecbe374f7b080678bbca1506051d50dec3 $LZ4.tar.gz
|
||||
6a5ca0652392a2d7c9db2ae5b40210843c0bbc081cbd410825ab00cc59f14a6c libpng-$LIBPNG.tar.xz
|
||||
2a499607df669e40258e53d0ade8035ba4ec0175244869d1025d460562aa09b4 libwebp-$LIBWEBP.tar.gz
|
||||
04705c110cb2469caa79fb71fba3d7bf834914706e9641a4589485c1f832565b jpegsrc.v$LIBJPEG.tar.gz
|
||||
57be87c22d9b49c112b6d24bc67d42508660e6b718b3db89c44e47e289137082 ffmpeg-$FFMPEG.tar.xz
|
||||
85beaf8abfcc54d9da0ff0257ae311abd9e7aa96e53da37e1c37d6bc04ac83cd v$MOLTENVK.tar.gz
|
||||
b7338da1bdccb4d861e714efffaa83f174dfe37e194916bfd7ec82279a6ace19 qtbase-everywhere-src-$QT.tar.xz
|
||||
a733b98f771064d000476b8861f822143982749448ba8abf9f1813edb8dfe79f qtimageformats-everywhere-src-$QT.tar.xz
|
||||
3ed5b80f7228c41dd463b7a57284ed273d224d1c323c0dd78c5209635807cbce qtsvg-everywhere-src-$QT.tar.xz
|
||||
0953cddf6248f3959279a10904892e8a98eb3e463d729a174b6fc47febd99824 qttools-everywhere-src-$QT.tar.xz
|
||||
03d71565872b0e0e7303349071df031ab0f922f6dbdd3a5ec1ade9e188e4fbf4 qttranslations-everywhere-src-$QT.tar.xz
|
||||
eb3b5f0c16313d34f208d90c2fa1e588a23283eed63b101edd5422be6165d528 shaderc-$SHADERC.tar.gz
|
||||
aa27e4454ce631c5a17924ce0624eac736da19fc6f5a2ab15a6c58da7b36950f shaderc-glslang-$SHADERC_GLSLANG.tar.gz
|
||||
5d866ce34a4b6908e262e5ebfffc0a5e11dd411640b5f24c85a80ad44c0d4697 shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz
|
||||
03ee1a2c06f3b61008478f4abe9423454e53e580b9488b47c8071547c6a9db47 shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz
|
||||
EOF
|
||||
|
||||
curl -C - -L \
|
||||
-o "freetype-$FREETYPE.tar.xz" "https://sourceforge.net/projects/freetype/files/freetype2/$FREETYPE/freetype-$FREETYPE.tar.xz/download" \
|
||||
-o "harfbuzz-$HARFBUZZ.tar.gz" "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/$HARFBUZZ.tar.gz" \
|
||||
-O "https://libsdl.org/release/$SDL.tar.gz" \
|
||||
-O "https://github.com/facebook/zstd/releases/download/v$ZSTD/zstd-$ZSTD.tar.gz" \
|
||||
-O "https://github.com/lz4/lz4/archive/$LZ4.tar.gz" \
|
||||
-O "https://downloads.sourceforge.net/project/libpng/libpng16/$LIBPNG/libpng-$LIBPNG.tar.xz" \
|
||||
-O "https://ijg.org/files/jpegsrc.v$LIBJPEG.tar.gz" \
|
||||
-O "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$LIBWEBP.tar.gz" \
|
||||
-O "https://ffmpeg.org/releases/ffmpeg-$FFMPEG.tar.xz" \
|
||||
-O "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v$MOLTENVK.tar.gz" \
|
||||
-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" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz" \
|
||||
-o "shaderc-$SHADERC.tar.gz" "https://github.com/google/shaderc/archive/refs/tags/v$SHADERC.tar.gz" \
|
||||
-o "shaderc-glslang-$SHADERC_GLSLANG.tar.gz" "https://github.com/KhronosGroup/glslang/archive/$SHADERC_GLSLANG.tar.gz" \
|
||||
-o "shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Headers/archive/$SHADERC_SPIRVHEADERS.tar.gz" \
|
||||
-o "shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Tools/archive/$SHADERC_SPIRVTOOLS.tar.gz"
|
||||
|
||||
shasum -a 256 --check SHASUMS
|
||||
|
||||
echo "Installing SDL..."
|
||||
rm -fr "$SDL"
|
||||
tar xf "$SDL.tar.gz"
|
||||
cd "$SDL"
|
||||
cmake -B build "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DSDL_X11=OFF -DBUILD_SHARED_LIBS=ON
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
if [ "$BUILD_FFMPEG" -ne 0 ]; then
|
||||
echo "Installing FFmpeg..."
|
||||
rm -fr "ffmpeg-$FFMPEG"
|
||||
tar xf "ffmpeg-$FFMPEG.tar.xz"
|
||||
cd "ffmpeg-$FFMPEG"
|
||||
mkdir build
|
||||
cd build
|
||||
LDFLAGS="-dead_strip $LDFLAGS" CFLAGS="-Os $CFLAGS" CXXFLAGS="-Os $CXXFLAGS" \
|
||||
../configure --prefix="$INSTALLDIR" \
|
||||
--enable-cross-compile --arch=x86_64 --cc='clang -arch x86_64' --cxx='clang++ -arch x86_64' --disable-x86asm \
|
||||
--disable-all --disable-autodetect --disable-static --enable-shared \
|
||||
--enable-avcodec --enable-avformat --enable-avutil --enable-swresample --enable-swscale \
|
||||
--enable-audiotoolbox --enable-videotoolbox \
|
||||
--enable-encoder=ffv1,qtrle,pcm_s16be,pcm_s16le,*_at,*_videotoolbox \
|
||||
--enable-muxer=avi,matroska,mov,mp3,mp4,wav \
|
||||
--enable-protocol=file
|
||||
make "-j$NPROCS"
|
||||
cd ..
|
||||
mkdir build-arm64
|
||||
cd build-arm64
|
||||
LDFLAGS="-dead_strip $LDFLAGS" CFLAGS="-Os $CFLAGS" CXXFLAGS="-Os $CXXFLAGS" \
|
||||
../configure --prefix="$INSTALLDIR" \
|
||||
--enable-cross-compile --arch=arm64 --cc='clang -arch arm64' --cxx='clang++ -arch arm64' --disable-x86asm \
|
||||
--disable-all --disable-autodetect --disable-static --enable-shared \
|
||||
--enable-avcodec --enable-avformat --enable-avutil --enable-swresample --enable-swscale \
|
||||
--enable-audiotoolbox --enable-videotoolbox \
|
||||
--enable-encoder=ffv1,qtrle,pcm_s16be,pcm_s16le,*_at,*_videotoolbox \
|
||||
--enable-muxer=avi,matroska,mov,mp3,mp4,wav \
|
||||
--enable-protocol=file
|
||||
make "-j$NPROCS"
|
||||
cd ..
|
||||
merge_binaries $(realpath build) $(realpath build-arm64)
|
||||
cd build
|
||||
make install
|
||||
cd ../..
|
||||
fi
|
||||
|
||||
echo "Installing Zstd..."
|
||||
rm -fr "zstd-$ZSTD"
|
||||
tar xf "zstd-$ZSTD.tar.gz"
|
||||
cd "zstd-$ZSTD"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_X64" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_PROGRAMS=OFF -B build-dir build/cmake
|
||||
make -C build-dir "-j$NPROCS"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_ARM64" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_PROGRAMS=OFF -B build-dir-arm64 build/cmake
|
||||
make -C build-dir-arm64 "-j$NPROCS"
|
||||
merge_binaries $(realpath build-dir) $(realpath build-dir-arm64)
|
||||
make -C build-dir install
|
||||
cd ..
|
||||
|
||||
echo "Installing LZ4..."
|
||||
rm -fr "lz4-$LZ4"
|
||||
tar xf "$LZ4.tar.gz"
|
||||
cd "lz4-$LZ4"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_X64" -DBUILD_SHARED_LIBS=ON -DLZ4_BUILD_CLI=OFF -DLZ4_BUILD_LEGACY_LZ4C=OFF -B build-dir build/cmake
|
||||
make -C build-dir "-j$NPROCS"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_ARM64" -DBUILD_SHARED_LIBS=ON -DLZ4_BUILD_CLI=OFF -DLZ4_BUILD_LEGACY_LZ4C=OFF -B build-dir-arm64 build/cmake
|
||||
make -C build-dir-arm64 "-j$NPROCS"
|
||||
merge_binaries $(realpath build-dir) $(realpath build-dir-arm64)
|
||||
make -C build-dir install
|
||||
cd ..
|
||||
|
||||
echo "Installing libpng..."
|
||||
rm -fr "libpng-$LIBPNG"
|
||||
tar xf "libpng-$LIBPNG.tar.xz"
|
||||
cd "libpng-$LIBPNG"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_X64" -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_FRAMEWORK=OFF -B build
|
||||
make -C build "-j$NPROCS"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_ARM64" -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_FRAMEWORK=OFF -DPNG_ARM_NEON=on -B build-arm64
|
||||
make -C build-arm64 "-j$NPROCS"
|
||||
merge_binaries $(realpath build) $(realpath build-arm64)
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Installing libjpeg..."
|
||||
rm -fr "jpeg-$LIBJPEG"
|
||||
tar xf "jpegsrc.v$LIBJPEG.tar.gz"
|
||||
cd "jpeg-$LIBJPEG"
|
||||
mkdir build
|
||||
cd build
|
||||
../configure --prefix="$INSTALLDIR" --disable-static --enable-shared --host="x86_64-apple-darwin" CFLAGS="-arch x86_64"
|
||||
make "-j$NPROCS"
|
||||
cd ..
|
||||
mkdir build-arm64
|
||||
cd build-arm64
|
||||
../configure --prefix="$INSTALLDIR" --disable-static --enable-shared --host="aarch64-apple-darwin" CFLAGS="-arch arm64"
|
||||
make "-j$NPROCS"
|
||||
cd ..
|
||||
merge_binaries $(realpath build) $(realpath build-arm64)
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Installing WebP..."
|
||||
rm -fr "libwebp-$LIBWEBP"
|
||||
tar xf "libwebp-$LIBWEBP.tar.gz"
|
||||
cd "libwebp-$LIBWEBP"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_X64" -B build \
|
||||
-DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF \
|
||||
-DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON
|
||||
make -C build "-j$NPROCS"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_ARM64" -B build-arm64 \
|
||||
-DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF \
|
||||
-DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON
|
||||
make -C build-arm64 "-j$NPROCS"
|
||||
merge_binaries $(realpath build) $(realpath build-arm64)
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Building FreeType without HarfBuzz..."
|
||||
rm -fr "freetype-$FREETYPE"
|
||||
tar xf "freetype-$FREETYPE.tar.xz"
|
||||
cd "freetype-$FREETYPE"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DBUILD_SHARED_LIBS=ON -DFT_REQUIRE_ZLIB=ON -DFT_REQUIRE_PNG=ON -DFT_DISABLE_BZIP2=TRUE -DFT_DISABLE_BROTLI=TRUE -DFT_DISABLE_HARFBUZZ=TRUE -B build
|
||||
cmake --build build --parallel
|
||||
cmake --install build
|
||||
cd ..
|
||||
|
||||
echo "Building HarfBuzz..."
|
||||
rm -fr "harfbuzz-$HARFBUZZ"
|
||||
tar xf "harfbuzz-$HARFBUZZ.tar.gz"
|
||||
cd "harfbuzz-$HARFBUZZ"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DBUILD_SHARED_LIBS=ON -DHB_BUILD_UTILS=OFF -B build
|
||||
cmake --build build --parallel
|
||||
cmake --install build
|
||||
cd ..
|
||||
|
||||
echo "Building FreeType with HarfBuzz..."
|
||||
rm -fr "freetype-$FREETYPE"
|
||||
tar xf "freetype-$FREETYPE.tar.xz"
|
||||
cd "freetype-$FREETYPE"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DBUILD_SHARED_LIBS=ON -DFT_REQUIRE_ZLIB=ON -DFT_REQUIRE_PNG=ON -DFT_DISABLE_BZIP2=TRUE -DFT_DISABLE_BROTLI=TRUE -DFT_REQUIRE_HARFBUZZ=TRUE -B build
|
||||
cmake --build build --parallel
|
||||
cmake --install build
|
||||
cd ..
|
||||
|
||||
# MoltenVK already builds universal binaries, nothing special to do here.
|
||||
echo "Installing MoltenVK..."
|
||||
rm -fr "MoltenVK-${MOLTENVK}"
|
||||
tar xf "v$MOLTENVK.tar.gz"
|
||||
cd "MoltenVK-${MOLTENVK}"
|
||||
./fetchDependencies --macos
|
||||
make macos
|
||||
cp Package/Latest/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib "$INSTALLDIR/lib/"
|
||||
cd ..
|
||||
|
||||
echo "Installing Qt Base..."
|
||||
rm -fr "qtbase-everywhere-src-$QT"
|
||||
tar xf "qtbase-everywhere-src-$QT.tar.xz"
|
||||
cd "qtbase-everywhere-src-$QT"
|
||||
# since we don't have a direct reference to QtSvg, it doesn't deployed directly from the main binary
|
||||
# (only indirectly from iconengines), and the libqsvg.dylib imageformat plugin does not get deployed.
|
||||
# We could run macdeployqt twice, but that's even more janky than patching it.
|
||||
patch -u src/tools/macdeployqt/shared/shared.cpp <<EOF
|
||||
--- shared.cpp
|
||||
+++ shared.cpp
|
||||
@@ -1119,14 +1119,8 @@
|
||||
addPlugins(QStringLiteral("networkinformation"));
|
||||
}
|
||||
|
||||
- // All image formats (svg if QtSvg is used)
|
||||
- const bool usesSvg = deploymentInfo.containsModule("Svg", libInfix);
|
||||
- addPlugins(QStringLiteral("imageformats"), [usesSvg](const QString &lib) {
|
||||
- if (lib.contains(QStringLiteral("qsvg")) && !usesSvg)
|
||||
- return false;
|
||||
- return true;
|
||||
- });
|
||||
-
|
||||
+ // All image formats
|
||||
+ addPlugins(QStringLiteral("imageformats"));
|
||||
addPlugins(QStringLiteral("iconengines"));
|
||||
|
||||
// Platforminputcontext plugins if QtGui is in use
|
||||
EOF
|
||||
cmake -B build "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DFEATURE_dbus=OFF -DFEATURE_framework=OFF -DFEATURE_icu=OFF -DFEATURE_opengl=OFF -DFEATURE_printsupport=OFF -DFEATURE_sql=OFF -DFEATURE_gssapi=OFF -DFEATURE_system_png=ON -DFEATURE_system_jpeg=ON -DFEATURE_system_zlib=ON -DFEATURE_system_freetype=ON -DFEATURE_system_harfbuzz=ON
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Installing Qt SVG..."
|
||||
rm -fr "qtsvg-everywhere-src-$QT"
|
||||
tar xf "qtsvg-everywhere-src-$QT.tar.xz"
|
||||
cd "qtsvg-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL"
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ../..
|
||||
|
||||
echo "Installing Qt Image Formats..."
|
||||
rm -fr "qtimageformats-everywhere-src-$QT"
|
||||
tar xf "qtimageformats-everywhere-src-$QT.tar.xz"
|
||||
cd "qtimageformats-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DFEATURE_system_webp=ON
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ../..
|
||||
|
||||
echo "Installing Qt Tools..."
|
||||
rm -fr "qttools-everywhere-src-$QT"
|
||||
tar xf "qttools-everywhere-src-$QT.tar.xz"
|
||||
cd "qttools-everywhere-src-$QT"
|
||||
# Linguist relies on a library in the Designer target, which takes 5-7 minutes to build on the CI
|
||||
# Avoid it by not building Linguist, since we only need the tools that come with it
|
||||
patch -u src/linguist/CMakeLists.txt <<EOF
|
||||
--- src/linguist/CMakeLists.txt
|
||||
+++ src/linguist/CMakeLists.txt
|
||||
@@ -14,7 +14,7 @@
|
||||
add_subdirectory(lrelease-pro)
|
||||
add_subdirectory(lupdate)
|
||||
add_subdirectory(lupdate-pro)
|
||||
-if(QT_FEATURE_process AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets AND NOT no-png)
|
||||
+if(QT_FEATURE_process AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets AND TARGET Qt::PrintSupport AND NOT no-png)
|
||||
add_subdirectory(linguist)
|
||||
endif()
|
||||
EOF
|
||||
mkdir build
|
||||
cd build
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -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
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ../..
|
||||
|
||||
echo "Building shaderc..."
|
||||
rm -fr "shaderc-$SHADERC"
|
||||
tar xf "shaderc-$SHADERC.tar.gz"
|
||||
cd "shaderc-$SHADERC"
|
||||
cd third_party
|
||||
tar xf "../../shaderc-glslang-$SHADERC_GLSLANG.tar.gz"
|
||||
mv "glslang-$SHADERC_GLSLANG" "glslang"
|
||||
tar xf "../../shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz"
|
||||
mv "SPIRV-Headers-$SHADERC_SPIRVHEADERS" "spirv-headers"
|
||||
tar xf "../../shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz"
|
||||
mv "SPIRV-Tools-$SHADERC_SPIRVTOOLS" "spirv-tools"
|
||||
cd ..
|
||||
patch -p1 < "$SCRIPTDIR/../common/shaderc-changes.patch"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -B build
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Installing Qt Translations..."
|
||||
rm -fr "qttranslations-everywhere-src-$QT"
|
||||
tar xf "qttranslations-everywhere-src-$QT.tar.xz"
|
||||
cd "qttranslations-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL"
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ../..
|
||||
|
||||
echo "Cleaning up..."
|
||||
cd ..
|
||||
rm -rf deps-build
|
||||
@@ -2,231 +2,328 @@
|
||||
|
||||
set -e
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.14
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Syntax: $0 <output directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The bundled ffmpeg has a lot of things disabled to reduce code size.
|
||||
# Users may want to use system ffmpeg for additional features
|
||||
: ${BUILD_FFMPEG:=1}
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=11.0
|
||||
|
||||
INSTALLDIR="$HOME/deps"
|
||||
NPROCS="$(getconf _NPROCESSORS_ONLN)"
|
||||
SDL=SDL2-2.28.1
|
||||
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.
|
||||
SCRIPTDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
|
||||
INSTALLDIR="$1"
|
||||
if [ "${INSTALLDIR:0:1}" != "/" ]; then
|
||||
INSTALLDIR="$PWD/$INSTALLDIR"
|
||||
fi
|
||||
|
||||
mkdir deps-build
|
||||
FREETYPE=2.13.2
|
||||
HARFBUZZ=8.3.1
|
||||
SDL=SDL2-2.30.5
|
||||
ZSTD=1.5.6
|
||||
LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
LIBPNG=1.6.43
|
||||
LIBJPEG=9f
|
||||
LIBWEBP=1.4.0
|
||||
FFMPEG=6.0
|
||||
MOLTENVK=1.2.9
|
||||
QT=6.7.2
|
||||
|
||||
SHADERC=2024.1
|
||||
SHADERC_GLSLANG=142052fa30f9eca191aa9dcf65359fcaed09eeec
|
||||
SHADERC_SPIRVHEADERS=5e3ad389ee56fca27c9705d093ae5387ce404df4
|
||||
SHADERC_SPIRVTOOLS=dd4b663e13c07fea4fbb3f70c1c91c86731099f7
|
||||
|
||||
mkdir -p deps-build
|
||||
cd deps-build
|
||||
|
||||
export PKG_CONFIG_PATH="$INSTALLDIR/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
export LDFLAGS="-L$INSTALLDIR/lib -dead_strip $LDFLAGS"
|
||||
export CFLAGS="-I$INSTALLDIR/include -Os $CFLAGS"
|
||||
export CXXFLAGS="-I$INSTALLDIR/include -Os $CXXFLAGS"
|
||||
export LDFLAGS="-L$INSTALLDIR/lib $LDFLAGS"
|
||||
export CFLAGS="-I$INSTALLDIR/include $CFLAGS"
|
||||
export CXXFLAGS="-I$INSTALLDIR/include $CXXFLAGS"
|
||||
CMAKE_COMMON=(
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="-dead_strip -dead_strip_dylibs"
|
||||
-DCMAKE_PREFIX_PATH="$INSTALLDIR"
|
||||
-DCMAKE_INSTALL_PREFIX="$INSTALLDIR"
|
||||
-DCMAKE_OSX_ARCHITECTURES="x86_64"
|
||||
-DCMAKE_INSTALL_NAME_DIR='$<INSTALL_PREFIX>/lib'
|
||||
)
|
||||
|
||||
cat > SHASUMS <<EOF
|
||||
4977ceba5c0054dbe6c2f114641aced43ce3bf2b41ea64b6a372d6ba129cb15d $SDL.tar.gz
|
||||
505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca libpng-$PNG.tar.xz
|
||||
4077d6a6a75aeb01884f708919d25934c93305e49f7e3f36db9129320e6f4f3d jpegsrc.v$JPG.tar.gz
|
||||
6900996607258496ce126924a19fe9d598af9d892cf3f33d1e4daaa9b42ae0b1 $SOUNDTOUCH.tar.gz
|
||||
12991c4e55c506dd7f9b765933e62fd2be2e06d421505d7950a132e4f1bb484d freetype-$FREETYPE.tar.xz
|
||||
19a54fe9596f7a47c502549fce8e8a10978c697203774008cc173f8360b19a9a harfbuzz-$HARFBUZZ.tar.gz
|
||||
f374f3fa29c37dfcc20822d4a7d7dc57e58924d1a5f2ad511bfab4c8193de63b $SDL.tar.gz
|
||||
8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 zstd-$ZSTD.tar.gz
|
||||
0728800155f3ed0a0c87e03addbd30ecbe374f7b080678bbca1506051d50dec3 $LZ4.tar.gz
|
||||
6a5ca0652392a2d7c9db2ae5b40210843c0bbc081cbd410825ab00cc59f14a6c libpng-$LIBPNG.tar.xz
|
||||
61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5 libwebp-$LIBWEBP.tar.gz
|
||||
04705c110cb2469caa79fb71fba3d7bf834914706e9641a4589485c1f832565b jpegsrc.v$LIBJPEG.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
|
||||
f415a09385030c6510a936155ce211f617c31506db5fbc563e804345f1ecf56e v$MOLTENVK.tar.gz
|
||||
c5f22a5e10fb162895ded7de0963328e7307611c688487b5d152c9ee64767599 qtbase-everywhere-src-$QT.tar.xz
|
||||
e1a1d8785fae67d16ad0a443b01d5f32663a6b68d275f1806ebab257485ce5d6 qtimageformats-everywhere-src-$QT.tar.xz
|
||||
fb0d1286a35be3583fee34aeb5843c94719e07193bdf1d4d8b0dc14009caef01 qtsvg-everywhere-src-$QT.tar.xz
|
||||
58e855ad1b2533094726c8a425766b63a04a0eede2ed85086860e54593aa4b2a qttools-everywhere-src-$QT.tar.xz
|
||||
9845780b5dc1b7279d57836db51aeaf2e4a1160c42be09750616f39157582ca9 qttranslations-everywhere-src-$QT.tar.xz
|
||||
eb3b5f0c16313d34f208d90c2fa1e588a23283eed63b101edd5422be6165d528 shaderc-$SHADERC.tar.gz
|
||||
aa27e4454ce631c5a17924ce0624eac736da19fc6f5a2ab15a6c58da7b36950f shaderc-glslang-$SHADERC_GLSLANG.tar.gz
|
||||
5d866ce34a4b6908e262e5ebfffc0a5e11dd411640b5f24c85a80ad44c0d4697 shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz
|
||||
03ee1a2c06f3b61008478f4abe9423454e53e580b9488b47c8071547c6a9db47 shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz
|
||||
EOF
|
||||
|
||||
curl -L \
|
||||
-o "freetype-$FREETYPE.tar.xz" "https://sourceforge.net/projects/freetype/files/freetype2/$FREETYPE/freetype-$FREETYPE.tar.xz/download" \
|
||||
-o "harfbuzz-$HARFBUZZ.tar.gz" "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/$HARFBUZZ.tar.gz" \
|
||||
-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://github.com/facebook/zstd/releases/download/v$ZSTD/zstd-$ZSTD.tar.gz" \
|
||||
-O "https://github.com/lz4/lz4/archive/$LZ4.tar.gz" \
|
||||
-O "https://downloads.sourceforge.net/project/libpng/libpng16/$LIBPNG/libpng-$LIBPNG.tar.xz" \
|
||||
-O "https://ijg.org/files/jpegsrc.v$LIBJPEG.tar.gz" \
|
||||
-O "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$LIBWEBP.tar.gz" \
|
||||
-O "https://ffmpeg.org/releases/ffmpeg-$FFMPEG.tar.xz" \
|
||||
-O "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v$MOLTENVK.tar.gz" \
|
||||
-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" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz" \
|
||||
-o "shaderc-$SHADERC.tar.gz" "https://github.com/google/shaderc/archive/refs/tags/v$SHADERC.tar.gz" \
|
||||
-o "shaderc-glslang-$SHADERC_GLSLANG.tar.gz" "https://github.com/KhronosGroup/glslang/archive/$SHADERC_GLSLANG.tar.gz" \
|
||||
-o "shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Headers/archive/$SHADERC_SPIRVHEADERS.tar.gz" \
|
||||
-o "shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Tools/archive/$SHADERC_SPIRVTOOLS.tar.gz"
|
||||
|
||||
shasum -a 256 --check SHASUMS
|
||||
|
||||
echo "Installing SDL..."
|
||||
rm -fr "$SDL"
|
||||
tar xf "$SDL.tar.gz"
|
||||
cd "$SDL"
|
||||
./configure --prefix "$INSTALLDIR" --without-x
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cmake -B build "${CMAKE_COMMON[@]}" -DSDL_X11=OFF -DBUILD_SHARED_LIBS=ON
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
if [ "$BUILD_FFMPEG" -ne 0 ]; then
|
||||
echo "Installing FFmpeg..."
|
||||
rm -fr "ffmpeg-$FFMPEG"
|
||||
tar xf "ffmpeg-$FFMPEG.tar.xz"
|
||||
cd "ffmpeg-$FFMPEG"
|
||||
LDFLAGS="-dead_strip $LDFLAGS" CFLAGS="-Os $CFLAGS" CXXFLAGS="-Os $CXXFLAGS" \
|
||||
./configure --prefix="$INSTALLDIR" \
|
||||
--enable-cross-compile --arch=x86_64 --cc='clang -arch x86_64' --cxx='clang++ -arch x86_64' \
|
||||
--disable-all --disable-autodetect --disable-static --enable-shared \
|
||||
--enable-avcodec --enable-avformat --enable-avutil --enable-swresample --enable-swscale \
|
||||
--enable-audiotoolbox --enable-videotoolbox \
|
||||
--enable-encoder=ffv1,qtrle,pcm_s16be,pcm_s16le,*_at,*_videotoolbox \
|
||||
--enable-muxer=avi,matroska,mov,mp3,mp4,wav \
|
||||
--enable-protocol=file
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ..
|
||||
fi
|
||||
|
||||
echo "Installing Zstd..."
|
||||
rm -fr "zstd-$ZSTD"
|
||||
tar xf "zstd-$ZSTD.tar.gz"
|
||||
cd "zstd-$ZSTD"
|
||||
cmake "${CMAKE_COMMON[@]}" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_PROGRAMS=OFF -B build-dir build/cmake
|
||||
make -C build-dir "-j$NPROCS"
|
||||
make -C build-dir install
|
||||
cd ..
|
||||
|
||||
echo "Installing LZ4..."
|
||||
rm -fr "lz4-$LZ4"
|
||||
tar xf "$LZ4.tar.gz"
|
||||
cd "lz4-$LZ4"
|
||||
cmake "${CMAKE_COMMON[@]}" -DBUILD_SHARED_LIBS=ON -DLZ4_BUILD_CLI=OFF -DLZ4_BUILD_LEGACY_LZ4C=OFF -B build-dir build/cmake
|
||||
make -C build-dir "-j$NPROCS"
|
||||
make -C build-dir install
|
||||
cd ..
|
||||
|
||||
echo "Installing libpng..."
|
||||
tar xf "libpng-$PNG.tar.xz"
|
||||
cd "libpng-$PNG"
|
||||
./configure --prefix "$INSTALLDIR" --disable-dependency-tracking
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
rm -fr "libpng-$LIBPNG"
|
||||
tar xf "libpng-$LIBPNG.tar.xz"
|
||||
cd "libpng-$LIBPNG"
|
||||
cmake "${CMAKE_COMMON[@]}" -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_FRAMEWORK=OFF -B build
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Installing libjpeg..."
|
||||
tar xf "jpegsrc.v$JPG.tar.gz"
|
||||
cd "jpeg-$JPG"
|
||||
./configure --prefix "$INSTALLDIR" --disable-dependency-tracking
|
||||
rm -fr "jpeg-$LIBJPEG"
|
||||
tar xf "jpegsrc.v$LIBJPEG.tar.gz"
|
||||
cd "jpeg-$LIBJPEG"
|
||||
mkdir build
|
||||
cd build
|
||||
../configure --prefix="$INSTALLDIR" --disable-static --enable-shared --host="x86_64-apple-darwin" CFLAGS="-arch x86_64"
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ..
|
||||
cd ../..
|
||||
|
||||
echo "Installing soundtouch..."
|
||||
tar xf "$SOUNDTOUCH.tar.gz"
|
||||
cd "$SOUNDTOUCH"
|
||||
cmake -B build -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=MinSizeRel
|
||||
echo "Installing WebP..."
|
||||
rm -fr "libwebp-$LIBWEBP"
|
||||
tar xf "libwebp-$LIBWEBP.tar.gz"
|
||||
cd "libwebp-$LIBWEBP"
|
||||
cmake "${CMAKE_COMMON[@]}" -B build \
|
||||
-DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF \
|
||||
-DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Installing FFmpeg..."
|
||||
tar xf "ffmpeg-$FFMPEG.tar.xz"
|
||||
cd "ffmpeg-$FFMPEG"
|
||||
./configure --prefix="$INSTALLDIR" --disable-all --disable-autodetect --disable-static --enable-shared \
|
||||
--enable-avcodec --enable-avformat --enable-avutil --enable-swresample --enable-swscale \
|
||||
--enable-audiotoolbox --enable-videotoolbox \
|
||||
--enable-encoder=ffv1,qtrle,pcm_s16be,pcm_s16le,*_at,*_videotoolbox \
|
||||
--enable-muxer=avi,matroska,mov,mp3,mp4,wav \
|
||||
--enable-protocol=file
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
echo "Building FreeType without HarfBuzz..."
|
||||
rm -fr "freetype-$FREETYPE"
|
||||
tar xf "freetype-$FREETYPE.tar.xz"
|
||||
cd "freetype-$FREETYPE"
|
||||
cmake "${CMAKE_COMMON[@]}" -DBUILD_SHARED_LIBS=ON -DFT_REQUIRE_ZLIB=ON -DFT_REQUIRE_PNG=ON -DFT_DISABLE_BZIP2=TRUE -DFT_DISABLE_BROTLI=TRUE -DFT_DISABLE_HARFBUZZ=TRUE -B build
|
||||
cmake --build build --parallel
|
||||
cmake --install build
|
||||
cd ..
|
||||
|
||||
echo "Building HarfBuzz..."
|
||||
rm -fr "harfbuzz-$HARFBUZZ"
|
||||
tar xf "harfbuzz-$HARFBUZZ.tar.gz"
|
||||
cd "harfbuzz-$HARFBUZZ"
|
||||
cmake "${CMAKE_COMMON[@]}" -DBUILD_SHARED_LIBS=ON -DHB_BUILD_UTILS=OFF -B build
|
||||
cmake --build build --parallel
|
||||
cmake --install build
|
||||
cd ..
|
||||
|
||||
echo "Building FreeType with HarfBuzz..."
|
||||
rm -fr "freetype-$FREETYPE"
|
||||
tar xf "freetype-$FREETYPE.tar.xz"
|
||||
cd "freetype-$FREETYPE"
|
||||
cmake "${CMAKE_COMMON[@]}" -DBUILD_SHARED_LIBS=ON -DFT_REQUIRE_ZLIB=ON -DFT_REQUIRE_PNG=ON -DFT_DISABLE_BZIP2=TRUE -DFT_DISABLE_BROTLI=TRUE -DFT_REQUIRE_HARFBUZZ=TRUE -B build
|
||||
cmake --build build --parallel
|
||||
cmake --install build
|
||||
cd ..
|
||||
|
||||
# MoltenVK already builds universal binaries, nothing special to do here.
|
||||
echo "Installing MoltenVK..."
|
||||
rm -fr "MoltenVK-${MOLTENVK}"
|
||||
tar xf "v$MOLTENVK.tar.gz"
|
||||
cd "MoltenVK-${MOLTENVK}"
|
||||
sed -i '' 's/xcodebuild "$@"/xcodebuild $XCODEBUILD_EXTRA_ARGS "$@"/g' fetchDependencies
|
||||
sed -i '' 's/XCODEBUILD :=/XCODEBUILD ?=/g' Makefile
|
||||
XCODEBUILD_EXTRA_ARGS="VALID_ARCHS=x86_64" ./fetchDependencies --macos
|
||||
XCODEBUILD="set -o pipefail && xcodebuild VALID_ARCHS=x86_64" make macos
|
||||
cp Package/Latest/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib "$INSTALLDIR/lib/"
|
||||
cd ..
|
||||
|
||||
echo "Installing Qt Base..."
|
||||
rm -fr "qtbase-everywhere-src-$QT"
|
||||
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];
|
||||
|
||||
# since we don't have a direct reference to QtSvg, it doesn't deployed directly from the main binary
|
||||
# (only indirectly from iconengines), and the libqsvg.dylib imageformat plugin does not get deployed.
|
||||
# We could run macdeployqt twice, but that's even more janky than patching it.
|
||||
|
||||
# https://github.com/qt/qtbase/commit/7b018629c3c3ab23665bf1da00c43c1546042035
|
||||
# The QProcess default wait time of 30s may be too short in e.g. CI environments where processes may be blocked
|
||||
# for a longer time waiting for CPU or IO.
|
||||
|
||||
patch -u src/tools/macdeployqt/shared/shared.cpp <<EOF
|
||||
--- shared.cpp
|
||||
+++ shared.cpp
|
||||
@@ -152,7 +152,7 @@
|
||||
LogDebug() << " inspecting" << binaryPath;
|
||||
QProcess otool;
|
||||
otool.start("otool", QStringList() << "-L" << binaryPath);
|
||||
- otool.waitForFinished();
|
||||
+ otool.waitForFinished(-1);
|
||||
|
||||
m_panel.directoryURL = [NSURL fileURLWithPath:m_currentDirectory];
|
||||
- m_panel.nameFieldStringValue = selectable ? info.fileName().toNSString() : @"";
|
||||
+ m_panel.nameFieldStringValue = info.fileName().toNSString();
|
||||
if (otool.exitStatus() != QProcess::NormalExit || otool.exitCode() != 0) {
|
||||
LogError() << otool.readAllStandardError();
|
||||
@@ -1122,14 +1122,8 @@
|
||||
addPlugins(QStringLiteral("networkinformation"));
|
||||
}
|
||||
|
||||
@@ -203,61 +201,2 @@
|
||||
return hidden;
|
||||
-}
|
||||
- // All image formats (svg if QtSvg is used)
|
||||
- const bool usesSvg = deploymentInfo.containsModule("Svg", libInfix);
|
||||
- addPlugins(QStringLiteral("imageformats"), [usesSvg](const QString &lib) {
|
||||
- if (lib.contains(QStringLiteral("qsvg")) && !usesSvg)
|
||||
- return false;
|
||||
- return true;
|
||||
- });
|
||||
-
|
||||
-- (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;
|
||||
+ // All image formats
|
||||
+ addPlugins(QStringLiteral("imageformats"));
|
||||
addPlugins(QStringLiteral("iconengines"));
|
||||
|
||||
// Platforminputcontext plugins if QtGui is in use
|
||||
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
|
||||
cd ..
|
||||
echo "Installing Qt SVG..."
|
||||
tar xf "qtsvg-everywhere-src-$QT.tar.xz"
|
||||
cd "qtsvg-everywhere-src-$QT"
|
||||
cmake -B build -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=MinSizeRel
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
echo "Installing Qt Image Formats..."
|
||||
tar xf "qtimageformats-everywhere-src-$QT.tar.xz"
|
||||
cd "qtimageformats-everywhere-src-$QT"
|
||||
cmake -B build -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=MinSizeRel
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
echo "Installing Qt Tools..."
|
||||
tar xf "qttools-everywhere-src-$QT.tar.xz"
|
||||
cd "qttools-everywhere-src-$QT"
|
||||
# Linguist relies on a library in the Designer target, which takes 5-7 minutes to build on the CI
|
||||
# Avoid it by not building Linguist, since we only need the tools that come with it
|
||||
patch -u src/linguist/CMakeLists.txt <<EOF
|
||||
--- src/linguist/CMakeLists.txt
|
||||
+++ src/linguist/CMakeLists.txt
|
||||
@@ -14,7 +14,7 @@
|
||||
add_subdirectory(lrelease-pro)
|
||||
add_subdirectory(lupdate)
|
||||
add_subdirectory(lupdate-pro)
|
||||
-if(QT_FEATURE_process AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets AND NOT no-png)
|
||||
+if(QT_FEATURE_process AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets AND TARGET Qt::PrintSupport AND NOT no-png)
|
||||
add_subdirectory(linguist)
|
||||
endif()
|
||||
EOF
|
||||
cmake -B build -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release -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
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
echo "Installing Qt Translations..."
|
||||
tar xf "qttranslations-everywhere-src-$QT.tar.xz"
|
||||
cd "qttranslations-everywhere-src-$QT"
|
||||
cmake -B build -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release
|
||||
cmake -B build "${CMAKE_COMMON[@]}" -DFEATURE_dbus=OFF -DFEATURE_framework=OFF -DFEATURE_icu=OFF -DFEATURE_opengl=OFF -DFEATURE_sql=OFF -DFEATURE_gssapi=OFF -DFEATURE_system_png=ON -DFEATURE_system_jpeg=ON -DFEATURE_system_zlib=ON -DFEATURE_system_freetype=ON -DFEATURE_system_harfbuzz=ON
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Installing Qt SVG..."
|
||||
rm -fr "qtsvg-everywhere-src-$QT"
|
||||
tar xf "qtsvg-everywhere-src-$QT.tar.xz"
|
||||
cd "qtsvg-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}"
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ../..
|
||||
|
||||
echo "Installing Qt Image Formats..."
|
||||
rm -fr "qtimageformats-everywhere-src-$QT"
|
||||
tar xf "qtimageformats-everywhere-src-$QT.tar.xz"
|
||||
cd "qtimageformats-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}" -DFEATURE_system_webp=ON
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ../..
|
||||
|
||||
echo "Installing Qt Tools..."
|
||||
rm -fr "qttools-everywhere-src-$QT"
|
||||
tar xf "qttools-everywhere-src-$QT.tar.xz"
|
||||
cd "qttools-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}" -DFEATURE_assistant=OFF -DFEATURE_clang=OFF -DFEATURE_designer=ON -DFEATURE_kmap2qmap=OFF -DFEATURE_pixeltool=OFF -DFEATURE_pkg_config=OFF -DFEATURE_qev=OFF -DFEATURE_qtattributionsscanner=OFF -DFEATURE_qtdiag=OFF -DFEATURE_qtplugininfo=OFF
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ../..
|
||||
|
||||
echo "Building shaderc..."
|
||||
rm -fr "shaderc-$SHADERC"
|
||||
tar xf "shaderc-$SHADERC.tar.gz"
|
||||
cd "shaderc-$SHADERC"
|
||||
cd third_party
|
||||
tar xf "../../shaderc-glslang-$SHADERC_GLSLANG.tar.gz"
|
||||
mv "glslang-$SHADERC_GLSLANG" "glslang"
|
||||
tar xf "../../shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz"
|
||||
mv "SPIRV-Headers-$SHADERC_SPIRVHEADERS" "spirv-headers"
|
||||
tar xf "../../shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz"
|
||||
mv "SPIRV-Tools-$SHADERC_SPIRVTOOLS" "spirv-tools"
|
||||
cd ..
|
||||
patch -p1 < "$SCRIPTDIR/../common/shaderc-changes.patch"
|
||||
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -B build
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Installing Qt Translations..."
|
||||
rm -fr "qttranslations-everywhere-src-$QT"
|
||||
tar xf "qttranslations-everywhere-src-$QT.tar.xz"
|
||||
cd "qttranslations-everywhere-src-$QT"
|
||||
mkdir build
|
||||
cd build
|
||||
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}"
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
cd ../..
|
||||
|
||||
echo "Cleaning up..."
|
||||
cd ..
|
||||
rm -r deps-build
|
||||
rm -rf deps-build
|
||||
|
||||
@@ -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(",");
|
||||
|
||||
155
.github/workflows/scripts/releases/announce-release/package-lock.json
generated
vendored
155
.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",
|
||||
@@ -440,15 +461,15 @@
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.2.3",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
|
||||
"integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
|
||||
"version": "8.17.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
||||
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
@@ -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",
|
||||
@@ -805,9 +842,9 @@
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"ws": {
|
||||
"version": "8.2.3",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
|
||||
"integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
|
||||
"version": "8.17.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
||||
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
||||
"requires": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
293
.github/workflows/scripts/windows/build-dependencies-arm64.bat
vendored
Normal file
293
.github/workflows/scripts/windows/build-dependencies-arm64.bat
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
echo Setting environment...
|
||||
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" (
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
|
||||
) else if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" (
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
|
||||
) else (
|
||||
echo Visual Studio 2022 not found.
|
||||
goto error
|
||||
)
|
||||
|
||||
set SEVENZIP="C:\Program Files\7-Zip\7z.exe"
|
||||
set PATCH="C:\Program Files\Git\usr\bin\patch.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-arm64
|
||||
cd deps-arm64 || goto error
|
||||
set "INSTALLDIR=%CD%"
|
||||
cd ..
|
||||
cd deps || goto error
|
||||
set "X64INSTALLDIR=%CD%"
|
||||
cd ..
|
||||
popd
|
||||
|
||||
echo SCRIPTDIR=%SCRIPTDIR%
|
||||
echo BUILDDIR=%BUILDDIR%
|
||||
echo INSTALLDIR=%INSTALLDIR%
|
||||
|
||||
cd "%BUILDDIR%"
|
||||
|
||||
set FREETYPE=2.13.2
|
||||
set HARFBUZZ=8.3.1
|
||||
set LIBJPEG=9f
|
||||
set LIBPNG=1643
|
||||
set LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
set QT=6.7.0
|
||||
set QTMINOR=6.7
|
||||
set SDL=SDL2-2.30.2
|
||||
set WEBP=1.3.2
|
||||
set ZLIB=1.3.1
|
||||
set ZLIBSHORT=131
|
||||
set ZSTD=1.5.5
|
||||
|
||||
set SHADERC=2024.1
|
||||
set SHADERC_GLSLANG=142052fa30f9eca191aa9dcf65359fcaed09eeec
|
||||
set SHADERC_SPIRVHEADERS=5e3ad389ee56fca27c9705d093ae5387ce404df4
|
||||
set SHADERC_SPIRVTOOLS=dd4b663e13c07fea4fbb3f70c1c91c86731099f7
|
||||
|
||||
call :downloadfile "freetype-%FREETYPE%.tar.gz" https://sourceforge.net/projects/freetype/files/freetype2/%FREETYPE%/freetype-%FREETYPE%.tar.gz/download 1ac27e16c134a7f2ccea177faba19801131116fd682efc1f5737037c5db224b5 || goto error
|
||||
call :downloadfile "harfbuzz-%HARFBUZZ%.zip" https://github.com/harfbuzz/harfbuzz/archive/refs/tags/%HARFBUZZ%.zip b2bc56184ae37324bc4829fde7d3f9e6916866ad711ee85792e457547c9fd127 || goto error
|
||||
call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lpng1643.zip fc466a1e638e635d6c66363bdf3f38555b81b0141d0b06ba45b49ccca327436d || goto error
|
||||
call :downloadfile "jpegsr%LIBJPEG%.zip" https://ijg.org/files/jpegsr%LIBJPEG%.zip 6255da8c89e09d694e6800688c76145eb6870a76ac0d36c74fccd61b3940aafa || goto error
|
||||
call :downloadfile "libwebp-%WEBP%.tar.gz" "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-%WEBP%.tar.gz" 2a499607df669e40258e53d0ade8035ba4ec0175244869d1025d460562aa09b4 || goto error
|
||||
call :downloadfile "lz4-%LZ4%.zip" "https://github.com/lz4/lz4/archive/%LZ4%.zip" 0c33119688d6b180c7e760b0acd70059222389cfd581632623784bee27e51a31 || goto error
|
||||
call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" c5d78a9e0346c6695f03df8ba25e5e111a1e23c8aefa8372a1c5a0dd79acaf10 || goto error
|
||||
call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" 3027fb990cb66436b5476b9dd17cd58f23b55a42eb1c1bcf9c7d78bca3ad7d63 || goto error
|
||||
call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" f30065289517847d721467827ee446a5f606f6d1c750e166cbfb0ed5bf066c5e || goto error
|
||||
call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtsvg-everywhere-src-%QT%.zip" 882d1db58d35155bd92e4ed92b485d7d713b6aff0d7cf78655de0b414a980689 || goto error
|
||||
call :downloadfile "qttools-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttools-everywhere-src-%QT%.zip" 93a31892ca8a4f38464e923328788ce3da881d82016fe18fa1ed12dd43ce486c || goto error
|
||||
call :downloadfile "qttranslations-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttranslations-everywhere-src-%QT%.zip" 102ca62fa682c0d3e700ba89069fd3b6663b9f0c2890b058e97998b6e8971fb3 || goto error
|
||||
call :downloadfile "zlib%ZLIBSHORT%.zip" "https://zlib.net/zlib%ZLIBSHORT%.zip" 72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17 || goto error
|
||||
call :downloadfile "zstd-%ZSTD%.zip" "https://github.com/facebook/zstd/archive/refs/tags/v%ZSTD%.zip" c5c8daa1d40dabc51790c62a5b86af2b36dfc4e1a738ff10dc4a46ea4e68ee51 || goto error
|
||||
|
||||
call :downloadfile "shaderc-%SHADERC%.zip" "https://github.com/google/shaderc/archive/refs/tags/v%SHADERC%.zip" 6c9f42ed6bf42750f5369b089909abfdcf0101488b4a1f41116d5159d00af8e7 || goto error
|
||||
call :downloadfile "shaderc-glslang-%SHADERC_GLSLANG%.zip" "https://github.com/KhronosGroup/glslang/archive/%SHADERC_GLSLANG%.zip" 03ad8a6fa987af4653d0cfe6bdaed41bcf617f1366a151fb1574da75950cd3e8 || goto error
|
||||
call :downloadfile "shaderc-spirv-headers-%SHADERC_SPIRVHEADERS%.zip" "https://github.com/KhronosGroup/SPIRV-Headers/archive/%SHADERC_SPIRVHEADERS%.zip" fa59a54334feaba5702b9c25724c3f4746123865769b36dd5a28d9ef5e9d39ab || goto error
|
||||
call :downloadfile "shaderc-spirv-tools-%SHADERC_SPIRVTOOLS%.zip" "https://github.com/KhronosGroup/SPIRV-Tools/archive/%SHADERC_SPIRVTOOLS%.zip" bf385994c20293485b378c27dfdbd77a31b949deabccd9218a977f173eda9f6f || goto error
|
||||
|
||||
if %DEBUG%==1 (
|
||||
echo Building debug and release libraries...
|
||||
) else (
|
||||
echo Building release libraries...
|
||||
)
|
||||
|
||||
set FORCEPDB=-DCMAKE_SHARED_LINKER_FLAGS_RELEASE="/DEBUG"
|
||||
set ARM64TOOLCHAIN=-DCMAKE_TOOLCHAIN_FILE="%SCRIPTDIR%\cmake-toolchain-windows-arm64.cmake"
|
||||
|
||||
echo Building Zlib...
|
||||
rmdir /S /Q "zlib-%ZLIB%"
|
||||
%SEVENZIP% x "zlib%ZLIBSHORT%.zip" || goto error
|
||||
cd "zlib-%ZLIB%" || goto error
|
||||
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DZLIB_BUILD_EXAMPLES=OFF -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building libpng...
|
||||
rmdir /S /Q "lpng%LIBPNG%"
|
||||
%SEVENZIP% x "lpng%LIBPNG%.zip" || goto error
|
||||
cd "lpng%LIBPNG%" || goto error
|
||||
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_STATIC=OFF -DPNG_SHARED=ON -DPNG_TOOLS=OFF -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building libjpeg...
|
||||
%SEVENZIP% x "jpegsr%LIBJPEG%.zip" || goto error
|
||||
cd "jpeg-%LIBJPEG%" || goto error
|
||||
%PATCH% -p1 < "%SCRIPTDIR%\libjpeg-cmake.patch" || goto error
|
||||
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building LZ4...
|
||||
rmdir /S /Q "lz4"
|
||||
%SEVENZIP% x "lz4-%LZ4%.zip" || goto error
|
||||
rename "lz4-%LZ4%" "lz4" || goto error
|
||||
cd "lz4" || goto error
|
||||
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DLZ4_BUILD_CLI=OFF -DLZ4_BUILD_LEGACY_LZ4C=OFF -DCMAKE_C_FLAGS="/wd4711 /wd5045" -B build-dir -G Ninja build/cmake || goto error
|
||||
cmake --build build-dir --parallel || goto error
|
||||
ninja -C build-dir install || goto error
|
||||
cd ..
|
||||
|
||||
echo Building FreeType without HarfBuzz...
|
||||
rmdir /S /Q "freetype-%FREETYPE%"
|
||||
tar -xf "freetype-%FREETYPE%.tar.gz" || goto error
|
||||
cd "freetype-%FREETYPE%" || goto error
|
||||
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DFT_REQUIRE_ZLIB=TRUE -DFT_REQUIRE_PNG=TRUE -DFT_DISABLE_BZIP2=TRUE -DFT_DISABLE_BROTLI=TRUE -DFT_DISABLE_HARFBUZZ=TRUE -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building HarfBuzz...
|
||||
rmdir /S /Q "harfbuzz-%HARFBUZZ%"
|
||||
%SEVENZIP% x "-x^!harfbuzz-%HARFBUZZ%\README" "harfbuzz-%HARFBUZZ%.zip" || goto error
|
||||
cd "harfbuzz-%HARFBUZZ%" || goto error
|
||||
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DHB_BUILD_UTILS=OFF -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building FreeType with HarfBuzz...
|
||||
rmdir /S /Q "freetype-%FREETYPE%"
|
||||
tar -xf "freetype-%FREETYPE%.tar.gz" || goto error
|
||||
cd "freetype-%FREETYPE%" || goto error
|
||||
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DFT_REQUIRE_ZLIB=TRUE -DFT_REQUIRE_PNG=TRUE -DFT_DISABLE_BZIP2=TRUE -DFT_DISABLE_BROTLI=TRUE -DFT_REQUIRE_HARFBUZZ=TRUE -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building Zstandard...
|
||||
rmdir /S /Q "zstd-%ZSTD%"
|
||||
%SEVENZIP% x "-x^!zstd-1.5.5\tests\cli-tests\bin" "zstd-%ZSTD%.zip" || goto error
|
||||
cd "zstd-%ZSTD%"
|
||||
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_SHARED=ON -DZSTD_BUILD_STATIC=OFF -DZSTD_BUILD_PROGRAMS=OFF -B build -G Ninja build/cmake
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building WebP...
|
||||
rmdir /S /Q "libwebp-%WEBP%"
|
||||
tar -xf "libwebp-%WEBP%.tar.gz" || goto error
|
||||
cd "libwebp-%WEBP%" || goto error
|
||||
cmake -B build %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building SDL...
|
||||
rmdir /S /Q "%SDL%"
|
||||
%SEVENZIP% x "%SDL%.zip" || goto error
|
||||
cd "%SDL%" || goto error
|
||||
cmake -B build %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release %FORCEPDB% -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
|
||||
copy build\SDL2.pdb "%INSTALLDIR%\bin" || 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 %ARM64TOOLCHAIN% -DFEATURE_sql=OFF -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DQT_HOST_PATH="%X64INSTALLDIR%" %FORCEPDB% -DINPUT_gui=yes -DINPUT_widgets=yes -DINPUT_ssl=yes -DINPUT_openssl=no -DINPUT_schannel=yes -DFEATURE_system_png=ON -DFEATURE_system_jpeg=ON -DFEATURE_system_zlib=ON -DFEATURE_system_freetype=ON -DFEATURE_system_harfbuzz=ON %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" .. -- %FORCEPDB% -DCMAKE_PREFIX_PATH="%INSTALLDIR%" || 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" .. -- %FORCEPDB% -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DFEATURE_system_webp=ON || 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" .. -- %FORCEPDB% -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" .. -- %FORCEPDB% || goto error
|
||||
cmake --build . --parallel || goto error
|
||||
ninja install || goto error
|
||||
cd ..\.. || goto error
|
||||
|
||||
echo Building shaderc...
|
||||
rmdir /S /Q "shaderc-%SHADERC%"
|
||||
%SEVENZIP% x "shaderc-%SHADERC%.zip" || goto error
|
||||
cd "shaderc-%SHADERC%" || goto error
|
||||
cd third_party || goto error
|
||||
%SEVENZIP% x "..\..\shaderc-glslang-%SHADERC_GLSLANG%.zip" || goto error
|
||||
rename "glslang-%SHADERC_GLSLANG%" "glslang" || goto error
|
||||
%SEVENZIP% x "..\..\shaderc-spirv-headers-%SHADERC_SPIRVHEADERS%.zip" || goto error
|
||||
rename "SPIRV-Headers-%SHADERC_SPIRVHEADERS%" "spirv-headers" || goto error
|
||||
%SEVENZIP% x "..\..\shaderc-spirv-tools-%SHADERC_SPIRVTOOLS%.zip" || goto error
|
||||
rename "SPIRV-Tools-%SHADERC_SPIRVTOOLS%" "spirv-tools" || goto error
|
||||
cd .. || goto error
|
||||
%PATCH% -p1 < "%SCRIPTDIR%\..\common\shaderc-changes.patch" || goto error
|
||||
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build 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
|
||||
)
|
||||
297
.github/workflows/scripts/windows/build-dependencies.bat
vendored
Normal file
297
.github/workflows/scripts/windows/build-dependencies.bat
vendored
Normal file
@@ -0,0 +1,297 @@
|
||||
@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"
|
||||
set PATCH="C:\Program Files\Git\usr\bin\patch.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%
|
||||
|
||||
set "PATH=%PATH%;%INSTALLDIR%\bin"
|
||||
|
||||
cd "%BUILDDIR%"
|
||||
|
||||
set FREETYPE=2.13.2
|
||||
set HARFBUZZ=8.3.1
|
||||
set LIBJPEG=9f
|
||||
set LIBPNG=1643
|
||||
set LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
set QT=6.7.2
|
||||
set QTMINOR=6.7
|
||||
set SDL=SDL2-2.30.5
|
||||
set WEBP=1.4.0
|
||||
set ZLIB=1.3.1
|
||||
set ZLIBSHORT=131
|
||||
set ZSTD=1.5.6
|
||||
|
||||
set SHADERC=2024.1
|
||||
set SHADERC_GLSLANG=142052fa30f9eca191aa9dcf65359fcaed09eeec
|
||||
set SHADERC_SPIRVHEADERS=5e3ad389ee56fca27c9705d093ae5387ce404df4
|
||||
set SHADERC_SPIRVTOOLS=dd4b663e13c07fea4fbb3f70c1c91c86731099f7
|
||||
|
||||
call :downloadfile "freetype-%FREETYPE%.tar.gz" https://sourceforge.net/projects/freetype/files/freetype2/%FREETYPE%/freetype-%FREETYPE%.tar.gz/download 1ac27e16c134a7f2ccea177faba19801131116fd682efc1f5737037c5db224b5 || goto error
|
||||
call :downloadfile "harfbuzz-%HARFBUZZ%.zip" https://github.com/harfbuzz/harfbuzz/archive/refs/tags/%HARFBUZZ%.zip b2bc56184ae37324bc4829fde7d3f9e6916866ad711ee85792e457547c9fd127 || goto error
|
||||
call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lpng1643.zip fc466a1e638e635d6c66363bdf3f38555b81b0141d0b06ba45b49ccca327436d || goto error
|
||||
call :downloadfile "jpegsr%LIBJPEG%.zip" https://ijg.org/files/jpegsr%LIBJPEG%.zip 6255da8c89e09d694e6800688c76145eb6870a76ac0d36c74fccd61b3940aafa || goto error
|
||||
call :downloadfile "libwebp-%WEBP%.tar.gz" "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-%WEBP%.tar.gz" 61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5 || goto error
|
||||
call :downloadfile "lz4-%LZ4%.zip" "https://github.com/lz4/lz4/archive/%LZ4%.zip" 0c33119688d6b180c7e760b0acd70059222389cfd581632623784bee27e51a31 || goto error
|
||||
call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" 688d3da2bf7e887d0ba8e0f81c926119f85029544f4f6da8dea96db70f9d28e3 || goto error
|
||||
call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" 488119aad60719a085a1e45c31641ac2406ef86fc088a3c99885c18e9d6b4bb9 || goto error
|
||||
call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" 8e736b02db7dd67dbe834d56503b242344ce85d3532da692f1812b30ccf80997 || goto error
|
||||
call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtsvg-everywhere-src-%QT%.zip" 85a22142270a92be0dd0ab5d27cc53617b2a2f1a45fc0a3890024164032f8475 || goto error
|
||||
call :downloadfile "qttools-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttools-everywhere-src-%QT%.zip" 9e15f1fdbd83e4123e733bff20aff1b45921c09056c3790fa42eb71d0a5cd01f || goto error
|
||||
call :downloadfile "qttranslations-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttranslations-everywhere-src-%QT%.zip" d1f25e0f68a1282feffdd5fe795a027ee5f16ad19e3b1fa2e04a51cea19110ec || goto error
|
||||
call :downloadfile "zlib%ZLIBSHORT%.zip" "https://zlib.net/zlib%ZLIBSHORT%.zip" 72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17 || goto error
|
||||
call :downloadfile "zstd-%ZSTD%.zip" "https://github.com/facebook/zstd/archive/refs/tags/v%ZSTD%.zip" 3b1c3b46e416d36931efd34663122d7f51b550c87f74de2d38249516fe7d8be5 || goto error
|
||||
call :downloadfile "zstd-fd5f8106a58601a963ee816e6a57aa7c61fafc53.patch" https://github.com/facebook/zstd/commit/fd5f8106a58601a963ee816e6a57aa7c61fafc53.patch 675f144b11f8ab2424b64bed8ccdca5d3f35b9326046fa7a883925dd180f0651 || goto error
|
||||
|
||||
call :downloadfile "shaderc-%SHADERC%.zip" "https://github.com/google/shaderc/archive/refs/tags/v%SHADERC%.zip" 6c9f42ed6bf42750f5369b089909abfdcf0101488b4a1f41116d5159d00af8e7 || goto error
|
||||
call :downloadfile "shaderc-glslang-%SHADERC_GLSLANG%.zip" "https://github.com/KhronosGroup/glslang/archive/%SHADERC_GLSLANG%.zip" 03ad8a6fa987af4653d0cfe6bdaed41bcf617f1366a151fb1574da75950cd3e8 || goto error
|
||||
call :downloadfile "shaderc-spirv-headers-%SHADERC_SPIRVHEADERS%.zip" "https://github.com/KhronosGroup/SPIRV-Headers/archive/%SHADERC_SPIRVHEADERS%.zip" fa59a54334feaba5702b9c25724c3f4746123865769b36dd5a28d9ef5e9d39ab || goto error
|
||||
call :downloadfile "shaderc-spirv-tools-%SHADERC_SPIRVTOOLS%.zip" "https://github.com/KhronosGroup/SPIRV-Tools/archive/%SHADERC_SPIRVTOOLS%.zip" bf385994c20293485b378c27dfdbd77a31b949deabccd9218a977f173eda9f6f || goto error
|
||||
|
||||
if %DEBUG%==1 (
|
||||
echo Building debug and release libraries...
|
||||
) else (
|
||||
echo Building release libraries...
|
||||
)
|
||||
|
||||
set FORCEPDB=-DCMAKE_SHARED_LINKER_FLAGS_RELEASE="/DEBUG"
|
||||
|
||||
echo Building Zlib...
|
||||
rmdir /S /Q "zlib-%ZLIB%"
|
||||
%SEVENZIP% x "zlib%ZLIBSHORT%.zip" || goto error
|
||||
cd "zlib-%ZLIB%" || goto error
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DZLIB_BUILD_EXAMPLES=OFF -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building libpng...
|
||||
rmdir /S /Q "lpng%LIBPNG%"
|
||||
%SEVENZIP% x "lpng%LIBPNG%.zip" || goto error
|
||||
cd "lpng%LIBPNG%" || goto error
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_STATIC=OFF -DPNG_SHARED=ON -DPNG_TOOLS=OFF -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building libjpeg...
|
||||
rmdir /S /Q "jpeg-%LIBJPEG%"
|
||||
%SEVENZIP% x "jpegsr%LIBJPEG%.zip" || goto error
|
||||
cd "jpeg-%LIBJPEG%" || goto error
|
||||
%PATCH% -p1 < "%SCRIPTDIR%\libjpeg-cmake.patch" || goto error
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building LZ4...
|
||||
rmdir /S /Q "lz4"
|
||||
%SEVENZIP% x "lz4-%LZ4%.zip" || goto error
|
||||
rename "lz4-%LZ4%" "lz4" || goto error
|
||||
cd "lz4" || goto error
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DLZ4_BUILD_CLI=OFF -DLZ4_BUILD_LEGACY_LZ4C=OFF -DCMAKE_C_FLAGS="/wd4711 /wd5045" -B build-dir -G Ninja build/cmake || goto error
|
||||
cmake --build build-dir --parallel || goto error
|
||||
ninja -C build-dir install || goto error
|
||||
cd ..
|
||||
|
||||
echo Building FreeType without HarfBuzz...
|
||||
rmdir /S /Q "freetype-%FREETYPE%"
|
||||
tar -xf "freetype-%FREETYPE%.tar.gz" || goto error
|
||||
cd "freetype-%FREETYPE%" || goto error
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DFT_REQUIRE_ZLIB=TRUE -DFT_REQUIRE_PNG=TRUE -DFT_DISABLE_BZIP2=TRUE -DFT_DISABLE_BROTLI=TRUE -DFT_DISABLE_HARFBUZZ=TRUE -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building HarfBuzz...
|
||||
rmdir /S /Q "harfbuzz-%HARFBUZZ%"
|
||||
%SEVENZIP% x "-x^!harfbuzz-%HARFBUZZ%\README" "harfbuzz-%HARFBUZZ%.zip" || goto error
|
||||
cd "harfbuzz-%HARFBUZZ%" || goto error
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DHB_BUILD_UTILS=OFF -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building FreeType with HarfBuzz...
|
||||
rmdir /S /Q "freetype-%FREETYPE%"
|
||||
tar -xf "freetype-%FREETYPE%.tar.gz" || goto error
|
||||
cd "freetype-%FREETYPE%" || goto error
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DFT_REQUIRE_ZLIB=TRUE -DFT_REQUIRE_PNG=TRUE -DFT_DISABLE_BZIP2=TRUE -DFT_DISABLE_BROTLI=TRUE -DFT_REQUIRE_HARFBUZZ=TRUE -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building Zstandard...
|
||||
rmdir /S /Q "zstd-%ZSTD%"
|
||||
%SEVENZIP% x "-x^!zstd-1.5.6\tests\cli-tests\bin" "zstd-%ZSTD%.zip" || goto error
|
||||
cd "zstd-%ZSTD%"
|
||||
%PATCH% -p1 < "..\zstd-fd5f8106a58601a963ee816e6a57aa7c61fafc53.patch" || goto error
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_SHARED=ON -DZSTD_BUILD_STATIC=OFF -DZSTD_BUILD_PROGRAMS=OFF -B build -G Ninja build/cmake
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building WebP...
|
||||
rmdir /S /Q "libwebp-%WEBP%"
|
||||
tar -xf "libwebp-%WEBP%.tar.gz" || goto error
|
||||
cd "libwebp-%WEBP%" || goto error
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build install || goto error
|
||||
cd .. || goto error
|
||||
|
||||
echo Building SDL...
|
||||
rmdir /S /Q "%SDL%"
|
||||
%SEVENZIP% x "%SDL%.zip" || goto error
|
||||
cd "%SDL%" || goto error
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release %FORCEPDB% -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
|
||||
copy build\SDL2.pdb "%INSTALLDIR%\bin" || 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
|
||||
|
||||
rem Disable the PCRE2 JIT, it doesn't properly verify AVX2 support.
|
||||
%PATCH% -p1 < "%SCRIPTDIR%\qtbase-disable-pcre2-jit.patch" || goto error
|
||||
|
||||
cmake -B build -DFEATURE_sql=OFF -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" %FORCEPDB% -DINPUT_gui=yes -DINPUT_widgets=yes -DINPUT_ssl=yes -DINPUT_openssl=no -DINPUT_schannel=yes -DFEATURE_system_png=ON -DFEATURE_system_jpeg=ON -DFEATURE_system_zlib=ON -DFEATURE_system_freetype=ON -DFEATURE_system_harfbuzz=ON %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" .. -- %FORCEPDB% -DCMAKE_PREFIX_PATH="%INSTALLDIR%" || 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" .. -- %FORCEPDB% -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DFEATURE_system_webp=ON || 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" .. -- %FORCEPDB% -DFEATURE_assistant=OFF -DFEATURE_clang=OFF -DFEATURE_designer=ON -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" .. -- %FORCEPDB% || goto error
|
||||
cmake --build . --parallel || goto error
|
||||
ninja install || goto error
|
||||
cd ..\.. || goto error
|
||||
|
||||
echo Building shaderc...
|
||||
rmdir /S /Q "shaderc-%SHADERC%"
|
||||
%SEVENZIP% x "shaderc-%SHADERC%.zip" || goto error
|
||||
cd "shaderc-%SHADERC%" || goto error
|
||||
cd third_party || goto error
|
||||
%SEVENZIP% x "..\..\shaderc-glslang-%SHADERC_GLSLANG%.zip" || goto error
|
||||
rename "glslang-%SHADERC_GLSLANG%" "glslang" || goto error
|
||||
%SEVENZIP% x "..\..\shaderc-spirv-headers-%SHADERC_SPIRVHEADERS%.zip" || goto error
|
||||
rename "SPIRV-Headers-%SHADERC_SPIRVHEADERS%" "spirv-headers" || goto error
|
||||
%SEVENZIP% x "..\..\shaderc-spirv-tools-%SHADERC_SPIRVTOOLS%.zip" || goto error
|
||||
rename "SPIRV-Tools-%SHADERC_SPIRVTOOLS%" "spirv-tools" || goto error
|
||||
cd .. || goto error
|
||||
%PATCH% -p1 < "%SCRIPTDIR%\..\common\shaderc-changes.patch" || goto error
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build -G Ninja || goto error
|
||||
cmake --build build --parallel || goto error
|
||||
ninja -C build 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
|
||||
)
|
||||
4
.github/workflows/scripts/windows/cmake-toolchain-windows-arm64.cmake
vendored
Normal file
4
.github/workflows/scripts/windows/cmake-toolchain-windows-arm64.cmake
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_VERSION 10)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm64)
|
||||
422
.github/workflows/scripts/windows/libjpeg-cmake.patch
vendored
Normal file
422
.github/workflows/scripts/windows/libjpeg-cmake.patch
vendored
Normal file
@@ -0,0 +1,422 @@
|
||||
diff -ruN jpeg-9f/CMakeLists.txt jpeg-9f-new/CMakeLists.txt
|
||||
--- jpeg-9f/CMakeLists.txt 1970-01-01 10:00:00.000000000 +1000
|
||||
+++ jpeg-9f-new/CMakeLists.txt 2024-03-23 21:29:37.969221600 +1000
|
||||
@@ -0,0 +1,110 @@
|
||||
+# CMake configuration for IJG libjpeg
|
||||
+# Modified from https://github.com/csparker247/jpeg-cmake/blob/develop/resources/CMakeLists.txt
|
||||
+# To install, copy this file and jconfig.h.in into a libjpeg source directory
|
||||
+# Adapted from LuaDist's CMakeLists
|
||||
+# https://github.com/LuaDist/libjpeg/blob/master/CMakeLists.txt
|
||||
+
|
||||
+cmake_minimum_required(VERSION 3.5)
|
||||
+
|
||||
+### Setup the project ###
|
||||
+file(READ "configure.ac" ac)
|
||||
+string(REGEX MATCH "AC_INIT\\(\\[libjpeg\\],\ \\[([0-9]*\\.[0-9]*\\.[0-9]*)\\]\\)" _ ${ac})
|
||||
+set(version ${CMAKE_MATCH_1})
|
||||
+project(libjpeg VERSION ${version} LANGUAGES C)
|
||||
+set(C_STANDARD 99)
|
||||
+
|
||||
+### Include extra packages ###
|
||||
+include(CMakeDependentOption)
|
||||
+include(GNUInstallDirs)
|
||||
+
|
||||
+### Options ###
|
||||
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
+option(BUILD_STATIC_LIBS "Build static libraries" ON)
|
||||
+
|
||||
+# Make sure we build at least one library
|
||||
+if(NOT(BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS))
|
||||
+ message(FATAL_ERROR "Both static and shared libraries are disabled. Nothing will be built.")
|
||||
+endif()
|
||||
+
|
||||
+### Configure jconfig.h ###
|
||||
+include(ConfigureJConfig.cmake)
|
||||
+
|
||||
+### Build the object library ###
|
||||
+set(PUBLIC_HDRS
|
||||
+ jconfig.h
|
||||
+ jerror.h
|
||||
+ jmorecfg.h
|
||||
+ jpeglib.h
|
||||
+)
|
||||
+
|
||||
+set(SRCS
|
||||
+ jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c
|
||||
+ jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c
|
||||
+ jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdarith.c
|
||||
+ jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c
|
||||
+ jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdpostct.c jdsample.c jdtrans.c
|
||||
+ jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c
|
||||
+ jmemmgr.c jmemnobs.c jquant1.c jquant2.c jutils.c
|
||||
+)
|
||||
+
|
||||
+### Create static and shared libs ###
|
||||
+if(BUILD_SHARED_LIBS)
|
||||
+ add_library(libjpeg SHARED ${SRCS})
|
||||
+ target_compile_definitions(libjpeg PRIVATE COMPILING_LIBJPEG)
|
||||
+ target_include_directories(libjpeg
|
||||
+ PUBLIC
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
+ $<INSTALL_INTERFACE:include>
|
||||
+ )
|
||||
+ set_target_properties(libjpeg
|
||||
+ PROPERTIES
|
||||
+ VERSION ${PROJECT_VERSION_MAJOR}
|
||||
+ POSITION_INDEPENDENT_CODE ON
|
||||
+ CLEAN_DIRECT_OUTPUT ON
|
||||
+ PUBLIC_HEADER "${PUBLIC_HDRS}"
|
||||
+ )
|
||||
+ install(TARGETS libjpeg
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
+ )
|
||||
+endif()
|
||||
+
|
||||
+if(BUILD_STATIC_LIBS)
|
||||
+ add_library(libjpeg_static STATIC $<TARGET_OBJECTS:jpeg_objs>)
|
||||
+ target_include_directories(libjpeg_static
|
||||
+ PUBLIC
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
+ $<INSTALL_INTERFACE:include>
|
||||
+ )
|
||||
+ set_target_properties(libjpeg_static
|
||||
+ PROPERTIES
|
||||
+ OUTPUT_NAME jpeg
|
||||
+ VERSION ${PROJECT_VERSION_MAJOR}
|
||||
+ POSITION_INDEPENDENT_CODE ON
|
||||
+ CLEAN_DIRECT_OUTPUT ON
|
||||
+ PUBLIC_HEADER "${PUBLIC_HDRS}"
|
||||
+ )
|
||||
+ install(TARGETS libjpeg_static
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
+ )
|
||||
+endif()
|
||||
+
|
||||
+# Configure and install pkg-config and libtool files
|
||||
+if(BUILD_STATIC_LIBS OR BUILD_SHARED_LIBS)
|
||||
+ # Compute the la file's weird version number
|
||||
+ math(EXPR JPEG_CONF_VER_MAJOR "${PROJECT_VERSION_MAJOR} + ${PROJECT_VERSION_MINOR}")
|
||||
+ set(JPEG_LIB_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
||||
+ set(JPEG_LIB_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
||||
+
|
||||
+ # Configure and install
|
||||
+ configure_file(libjpeg.pc.cmakein libjpeg.pc @ONLY)
|
||||
+ install(FILES
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/libjpeg.pc
|
||||
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig
|
||||
+ )
|
||||
+endif()
|
||||
+
|
||||
diff -ruN jpeg-9f/ConfigureJConfig.cmake jpeg-9f-new/ConfigureJConfig.cmake
|
||||
--- jpeg-9f/ConfigureJConfig.cmake 1970-01-01 10:00:00.000000000 +1000
|
||||
+++ jpeg-9f-new/ConfigureJConfig.cmake 2024-03-23 21:09:37.223882900 +1000
|
||||
@@ -0,0 +1,95 @@
|
||||
+include(CheckIncludeFile)
|
||||
+include(CheckSymbolExists)
|
||||
+include(CheckTypeSize)
|
||||
+
|
||||
+# Define this if your system has an ANSI-conforming <stddef.h> file.
|
||||
+check_include_file(stddef.h HAVE_STDDEF_H)
|
||||
+
|
||||
+# Define this if your system has an ANSI-conforming <stdlib.h> file.
|
||||
+check_include_file(stdlib.h HAVE_STDLIB_H)
|
||||
+
|
||||
+# Does your compiler support function prototypes?
|
||||
+# (If not, you also need to use ansi2knr, see install.txt)
|
||||
+set(HAVE_PROTOTYPES true CACHE BOOL "Does your compiler support function prototypes?")
|
||||
+
|
||||
+# Does your compiler support the declaration "unsigned char" ?
|
||||
+# How about "unsigned short" ?
|
||||
+check_type_size("unsigned char" UNSIGNED_CHAR LANGUAGE C)
|
||||
+check_type_size("unsigned short" UNSIGNED_SHORT LANGUAGE C)
|
||||
+
|
||||
+# Define "void" as "char" if your compiler doesn't know about type void.
|
||||
+# NOTE: be sure to define void such that "void *" represents the most general
|
||||
+# pointer type, e.g., that returned by malloc().
|
||||
+# NOT IMPLEMENTED: Modify in jconfig.h.in #
|
||||
+
|
||||
+# Define "const" as empty if your compiler doesn't know the "const" keyword.
|
||||
+# NOT IMPLEMENTED: Modify in jconfig.h.in #
|
||||
+
|
||||
+# Define this if an ordinary "char" type is unsigned.
|
||||
+# If you're not sure, leaving it undefined will work at some cost in speed.
|
||||
+# If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal.
|
||||
+set(CHAR_IS_UNSIGNED false CACHE BOOL "char type is unsigned")
|
||||
+
|
||||
+# Define this if your system does not have an ANSI/SysV <string.h>,
|
||||
+# but does have a BSD-style <strings.h>.
|
||||
+set(NEED_BSD_STRINGS false CACHE BOOL "Use BSD <strings.h>. Use only if system lacks ANSI/SysV <strings.h>")
|
||||
+
|
||||
+# Define this if your system does not provide typedef size_t in any of the
|
||||
+# ANSI-standard places (stddef.h, stdlib.h, or stdio.h), but places it in
|
||||
+# <sys/types.h> instead.
|
||||
+set(NEED_SYS_TYPES_H false CACHE BOOL "size_t defined in <sys/types.h>")
|
||||
+
|
||||
+# For 80x86 machines, you need to define NEED_FAR_POINTERS,
|
||||
+# unless you are using a large-data memory model or 80386 flat-memory mode.
|
||||
+# On less brain-damaged CPUs this symbol must not be defined.
|
||||
+# (Defining this symbol causes large data structures to be referenced through
|
||||
+# "far" pointers and to be allocated with a special version of malloc.)
|
||||
+set(NEED_FAR_POINTERS false CACHE BOOL "Reference large data structures through 'far' pointers allocated with a special version of malloc")
|
||||
+
|
||||
+# Define this if your linker needs global names to be unique in less
|
||||
+# than the first 15 characters.
|
||||
+set(NEED_SHORT_EXTERNAL_NAMES false CACHE BOOL "Global names must be unique in less than the first 15 characters")
|
||||
+
|
||||
+# Although a real ANSI C compiler can deal perfectly well with pointers to
|
||||
+# unspecified structures (see "incomplete types" in the spec), a few pre-ANSI
|
||||
+# and pseudo-ANSI compilers get confused. To keep one of these bozos happy,
|
||||
+# define INCOMPLETE_TYPES_BROKEN. This is not recommended unless you
|
||||
+# actually get "missing structure definition" warnings or errors while
|
||||
+# compiling the JPEG code.
|
||||
+set(INCOMPLETE_TYPES_BROKEN false CACHE BOOL "Disable pointers to unspecified structures")
|
||||
+
|
||||
+# Define "boolean" as unsigned char, not enum, on Windows systems.
|
||||
+# NOT IMPLEMENTED: Modify in jconfig.h.in #
|
||||
+
|
||||
+# The following options affect code selection within the JPEG library,
|
||||
+# but they don't need to be visible to applications using the library.
|
||||
+# To minimize application namespace pollution, the symbols won't be
|
||||
+# defined unless JPEG_INTERNALS has been defined.
|
||||
+#
|
||||
+
|
||||
+# Define this if your compiler implements ">>" on signed values as a logical
|
||||
+# (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift,
|
||||
+# which is the normal and rational definition.
|
||||
+set(RIGHT_SHIFT_IS_UNSIGNED false CACHE BOOL "Compiler implements >> on signed values as a logical (unsigned) shift")
|
||||
+
|
||||
+# The remaining options do not affect the JPEG library proper,
|
||||
+# but only the sample applications cjpeg/djpeg (see cjpeg.c, djpeg.c).
|
||||
+# Other applications can ignore these.
|
||||
+#
|
||||
+
|
||||
+mark_as_advanced(FORCE
|
||||
+ HAVE_PROTOTYPES
|
||||
+ HAVE_UNSIGNED_CHAR
|
||||
+ HAVE_UNSIGNED_SHORT
|
||||
+ CHAR_IS_UNSIGNED
|
||||
+ HAVE_STDDEF_H
|
||||
+ HAVE_STDLIB_H
|
||||
+ NEED_BSD_STRINGS
|
||||
+ NEED_SYS_TYPES_H
|
||||
+ NEED_FAR_POINTERS
|
||||
+ NEED_SHORT_EXTERNAL_NAMES
|
||||
+ INCOMPLETE_TYPES_BROKEN
|
||||
+ RIGHT_SHIFT_IS_UNSIGNED
|
||||
+)
|
||||
+
|
||||
+configure_file(jconfig.h.in ${CMAKE_CURRENT_SOURCE_DIR}/jconfig.h)
|
||||
diff -ruN jpeg-9f/jconfig.h.in jpeg-9f-new/jconfig.h.in
|
||||
--- jpeg-9f/jconfig.h.in 1970-01-01 10:00:00.000000000 +1000
|
||||
+++ jpeg-9f-new/jconfig.h.in 2024-03-23 21:06:05.204994600 +1000
|
||||
@@ -0,0 +1,173 @@
|
||||
+/*
|
||||
+ * jconfig.h.in
|
||||
+ *
|
||||
+ * Copyright (C) 1991-1994, Thomas G. Lane.
|
||||
+ * Modified 2009-2013 by Guido Vollbeding.
|
||||
+ * This file is part of the Independent JPEG Group's software.
|
||||
+ * For conditions of distribution and use, see the accompanying README file.
|
||||
+ *
|
||||
+ * This file is a modification of jconfig.txt from libjpeg. In addition to
|
||||
+ * documenting the configuration options that are required to customize the
|
||||
+ * JPEG software for a particular system, it is used by jpeg-cmake to configure
|
||||
+ * jconfig.h
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * These symbols indicate the properties of your machine or compiler.
|
||||
+ * #define the symbol if yes, #undef it if no.
|
||||
+ */
|
||||
+
|
||||
+/* Does your compiler support function prototypes?
|
||||
+ * (If not, you also need to use ansi2knr, see install.txt)
|
||||
+ */
|
||||
+#cmakedefine HAVE_PROTOTYPES
|
||||
+
|
||||
+/* Does your compiler support the declaration "unsigned char" ?
|
||||
+ * How about "unsigned short" ?
|
||||
+ */
|
||||
+#cmakedefine HAVE_UNSIGNED_CHAR
|
||||
+#cmakedefine HAVE_UNSIGNED_SHORT
|
||||
+
|
||||
+/* Define "void" as "char" if your compiler doesn't know about type void.
|
||||
+ * NOTE: be sure to define void such that "void *" represents the most general
|
||||
+ * pointer type, e.g., that returned by malloc().
|
||||
+ */
|
||||
+/* #define void char */
|
||||
+
|
||||
+/* Define "const" as empty if your compiler doesn't know the "const" keyword.
|
||||
+ */
|
||||
+/* #define const */
|
||||
+
|
||||
+/* Define this if an ordinary "char" type is unsigned.
|
||||
+ * If you're not sure, leaving it undefined will work at some cost in speed.
|
||||
+ * If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal.
|
||||
+ */
|
||||
+#cmakedefine CHAR_IS_UNSIGNED
|
||||
+
|
||||
+/* Define this if your system has an ANSI-conforming <stddef.h> file.
|
||||
+ */
|
||||
+#cmakedefine HAVE_STDDEF_H
|
||||
+
|
||||
+/* Define this if your system has an ANSI-conforming <stdlib.h> file.
|
||||
+ */
|
||||
+#cmakedefine HAVE_STDLIB_H
|
||||
+
|
||||
+/* Define this if your system does not have an ANSI/SysV <string.h>,
|
||||
+ * but does have a BSD-style <strings.h>.
|
||||
+ */
|
||||
+#cmakedefine NEED_BSD_STRINGS
|
||||
+
|
||||
+/* Define this if your system does not provide typedef size_t in any of the
|
||||
+ * ANSI-standard places (stddef.h, stdlib.h, or stdio.h), but places it in
|
||||
+ * <sys/types.h> instead.
|
||||
+ */
|
||||
+#cmakedefine NEED_SYS_TYPES_H
|
||||
+
|
||||
+/* For 80x86 machines, you need to define NEED_FAR_POINTERS,
|
||||
+ * unless you are using a large-data memory model or 80386 flat-memory mode.
|
||||
+ * On less brain-damaged CPUs this symbol must not be defined.
|
||||
+ * (Defining this symbol causes large data structures to be referenced through
|
||||
+ * "far" pointers and to be allocated with a special version of malloc.)
|
||||
+ */
|
||||
+#cmakedefine NEED_FAR_POINTERS
|
||||
+
|
||||
+/* Define this if your linker needs global names to be unique in less
|
||||
+ * than the first 15 characters.
|
||||
+ */
|
||||
+#cmakedefine NEED_SHORT_EXTERNAL_NAMES
|
||||
+
|
||||
+/* Although a real ANSI C compiler can deal perfectly well with pointers to
|
||||
+ * unspecified structures (see "incomplete types" in the spec), a few pre-ANSI
|
||||
+ * and pseudo-ANSI compilers get confused. To keep one of these bozos happy,
|
||||
+ * define INCOMPLETE_TYPES_BROKEN. This is not recommended unless you
|
||||
+ * actually get "missing structure definition" warnings or errors while
|
||||
+ * compiling the JPEG code.
|
||||
+ */
|
||||
+#cmakedefine INCOMPLETE_TYPES_BROKEN
|
||||
+
|
||||
+/* Define "boolean" as unsigned char, not enum, on Windows systems.
|
||||
+ */
|
||||
+#ifdef _WIN32
|
||||
+#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
||||
+typedef unsigned char boolean;
|
||||
+#endif
|
||||
+#ifndef FALSE /* in case these macros already exist */
|
||||
+#define FALSE 0 /* values of boolean */
|
||||
+#endif
|
||||
+#ifndef TRUE
|
||||
+#define TRUE 1
|
||||
+#endif
|
||||
+#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * The following options affect code selection within the JPEG library,
|
||||
+ * but they don't need to be visible to applications using the library.
|
||||
+ * To minimize application namespace pollution, the symbols won't be
|
||||
+ * defined unless JPEG_INTERNALS has been defined.
|
||||
+ */
|
||||
+
|
||||
+#ifdef JPEG_INTERNALS
|
||||
+
|
||||
+/* Define this if your compiler implements ">>" on signed values as a logical
|
||||
+ * (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift,
|
||||
+ * which is the normal and rational definition.
|
||||
+ */
|
||||
+#cmakedefine RIGHT_SHIFT_IS_UNSIGNED
|
||||
+
|
||||
+
|
||||
+#endif /* JPEG_INTERNALS */
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * The remaining options do not affect the JPEG library proper,
|
||||
+ * but only the sample applications cjpeg/djpeg (see cjpeg.c, djpeg.c).
|
||||
+ * Other applications can ignore these.
|
||||
+ */
|
||||
+
|
||||
+#ifdef JPEG_CJPEG_DJPEG
|
||||
+
|
||||
+/* These defines indicate which image (non-JPEG) file formats are allowed. */
|
||||
+
|
||||
+#cmakedefine BMP_SUPPORTED /* BMP image file format */
|
||||
+#cmakedefine GIF_SUPPORTED /* GIF image file format */
|
||||
+#cmakedefine PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
|
||||
+#cmakedefine RLE_SUPPORTED /* Utah RLE image file format */
|
||||
+#cmakedefine TARGA_SUPPORTED /* Targa image file format */
|
||||
+
|
||||
+/*
|
||||
+ * This defines the default output format for djpeg. Must be one of the FMT_*
|
||||
+ * enums found in djpeg.c or djpegalt.c
|
||||
+ */
|
||||
+#cmakedefine DEFAULT_FMT @DEFAULT_FMT@
|
||||
+
|
||||
+/* Define this if you want to name both input and output files on the command
|
||||
+ * line, rather than using stdout and optionally stdin. You MUST do this if
|
||||
+ * your system can't cope with binary I/O to stdin/stdout. See comments at
|
||||
+ * head of cjpeg.c or djpeg.c.
|
||||
+ */
|
||||
+#cmakedefine TWO_FILE_COMMANDLINE
|
||||
+
|
||||
+/* Define this if your system needs explicit cleanup of temporary files.
|
||||
+ * This is crucial under MS-DOS, where the temporary "files" may be areas
|
||||
+ * of extended memory; on most other systems it's not as important.
|
||||
+ */
|
||||
+#cmakedefine NEED_SIGNAL_CATCHER
|
||||
+
|
||||
+/* By default, we open image files with fopen(...,"rb") or fopen(...,"wb").
|
||||
+ * This is necessary on systems that distinguish text files from binary files,
|
||||
+ * and is harmless on most systems that don't. If you have one of the rare
|
||||
+ * systems that complains about the "b" spec, define this symbol.
|
||||
+ */
|
||||
+#cmakedefine DONT_USE_B_MODE
|
||||
+
|
||||
+/* Define this if you want percent-done progress reports from cjpeg/djpeg.
|
||||
+ */
|
||||
+#cmakedefine PROGRESS_REPORT
|
||||
+
|
||||
+/* Define this if you *don't* want overwrite confirmation */
|
||||
+#cmakedefine NO_OVERWRITE_CHECK
|
||||
+
|
||||
+#endif /* JPEG_CJPEG_DJPEG */
|
||||
diff -ruN jpeg-9f/jmorecfg.h jpeg-9f-new/jmorecfg.h
|
||||
--- jpeg-9f/jmorecfg.h 2022-03-31 19:41:26.000000000 +1000
|
||||
+++ jpeg-9f-new/jmorecfg.h 2024-03-23 21:20:25.514814400 +1000
|
||||
@@ -244,8 +244,13 @@
|
||||
#define LOCAL(type) static type
|
||||
/* a function referenced thru EXTERNs: */
|
||||
#define GLOBAL(type) type
|
||||
+
|
||||
/* a reference to a GLOBAL function: */
|
||||
-#define EXTERN(type) extern type
|
||||
+#ifdef COMPILING_LIBJPEG
|
||||
+#define EXTERN(type) __declspec(dllexport) extern type
|
||||
+#else
|
||||
+#define EXTERN(type) __declspec(dllimport) extern type
|
||||
+#endif
|
||||
|
||||
|
||||
/* This macro is used to declare a "method", that is, a function pointer.
|
||||
diff -ruN jpeg-9f/libjpeg.pc.cmakein jpeg-9f-new/libjpeg.pc.cmakein
|
||||
--- jpeg-9f/libjpeg.pc.cmakein 1970-01-01 10:00:00.000000000 +1000
|
||||
+++ jpeg-9f-new/libjpeg.pc.cmakein 2024-03-23 21:06:13.922695100 +1000
|
||||
@@ -0,0 +1,10 @@
|
||||
+prefix=@CMAKE_INSTALL_PREFIX@
|
||||
+exec_prefix=${prefix}
|
||||
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
+
|
||||
+Name: libjpeg
|
||||
+Description: Reads and writes JPEG files
|
||||
+Version: @JPEG_LIB_VERSION_MAJOR@.@JPEG_LIB_VERSION_MINOR@.0
|
||||
+Libs: -L${libdir} -ljpeg
|
||||
+Cflags: -I${includedir}
|
||||
35
.github/workflows/scripts/windows/qtbase-disable-pcre2-jit.patch
vendored
Normal file
35
.github/workflows/scripts/windows/qtbase-disable-pcre2-jit.patch
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
--- qtbase/src/3rdparty/pcre2/CMakeLists.txt 2024-03-19 08:46:43.000000000 -0700
|
||||
+++ qtbase/src/3rdparty/pcre2/CMakeLists.txt 2024-06-06 21:52:20.539619500 -0700
|
||||
@@ -41,6 +41,7 @@
|
||||
src/pcre2_xclass.c
|
||||
DEFINES
|
||||
HAVE_CONFIG_H
|
||||
+ PCRE2_DISABLE_JIT
|
||||
PUBLIC_DEFINES
|
||||
PCRE2_CODE_UNIT_WIDTH=16
|
||||
PUBLIC_INCLUDE_DIRECTORIES
|
||||
@@ -52,23 +53,8 @@
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
-qt_internal_extend_target(BundledPcre2 CONDITION QNX OR UIKIT
|
||||
- DEFINES
|
||||
- PCRE2_DISABLE_JIT
|
||||
-)
|
||||
-
|
||||
-qt_internal_extend_target(BundledPcre2 CONDITION (TEST_architecture_arch STREQUAL "arm") AND WIN32
|
||||
- DEFINES
|
||||
- PCRE2_DISABLE_JIT
|
||||
-)
|
||||
-
|
||||
-qt_internal_extend_target(BundledPcre2 CONDITION (TEST_architecture_arch STREQUAL "arm64") AND WIN32
|
||||
- DEFINES
|
||||
- PCRE2_DISABLE_JIT
|
||||
-)
|
||||
-
|
||||
if (APPLE)
|
||||
- target_compile_options(BundledPcre2 PRIVATE "SHELL:-Xarch_arm64 -DPCRE2_DISABLE_JIT")
|
||||
+ target_compile_options(BundledPcre2 PRIVATE "SHELL:-Xarch_arm64")
|
||||
endif()
|
||||
|
||||
qt_internal_extend_target(BundledPcre2 CONDITION WIN32
|
||||
2
.github/workflows/triage_pr.yml
vendored
2
.github/workflows/triage_pr.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
||||
if: github.repository == 'PCSX2/pcsx2'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@main
|
||||
- uses: actions/labeler@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
8
.github/workflows/windows_build_matrix.yml
vendored
8
.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
|
||||
|
||||
@@ -27,6 +27,7 @@ jobs:
|
||||
uses: ./.github/workflows/windows_build_qt.yml
|
||||
with:
|
||||
jobName: "MSVC SSE4"
|
||||
artifactPrefixName: "PCSX2-windows-Qt-x64-sse4-msvc"
|
||||
configuration: Release
|
||||
simd: "SSE4"
|
||||
secrets: inherit
|
||||
@@ -38,6 +39,7 @@ jobs:
|
||||
uses: ./.github/workflows/windows_build_qt.yml
|
||||
with:
|
||||
jobName: "MSVC AVX2"
|
||||
artifactPrefixName: "PCSX2-windows-Qt-x64-avx2-msvc"
|
||||
configuration: Release AVX2
|
||||
secrets: inherit
|
||||
|
||||
@@ -47,6 +49,7 @@ jobs:
|
||||
uses: ./.github/workflows/windows_build_qt.yml
|
||||
with:
|
||||
jobName: "CMake MSVC"
|
||||
artifactPrefixName: "PCSX2-windows-Qt-x64-cmake-msvc"
|
||||
configuration: CMake
|
||||
buildSystem: cmake
|
||||
secrets: inherit
|
||||
@@ -58,6 +61,7 @@ jobs:
|
||||
uses: ./.github/workflows/windows_build_qt.yml
|
||||
with:
|
||||
jobName: "Clang SSE4"
|
||||
artifactPrefixName: "PCSX2-windows-Qt-x64-sse4-clang"
|
||||
configuration: Release Clang
|
||||
simd: "SSE4"
|
||||
secrets: inherit
|
||||
@@ -69,6 +73,7 @@ jobs:
|
||||
uses: ./.github/workflows/windows_build_qt.yml
|
||||
with:
|
||||
jobName: "Clang AVX2"
|
||||
artifactPrefixName: "PCSX2-windows-Qt-x64-avx2-clang"
|
||||
configuration: Release Clang AVX2
|
||||
secrets: inherit
|
||||
|
||||
@@ -78,6 +83,7 @@ jobs:
|
||||
uses: ./.github/workflows/windows_build_qt.yml
|
||||
with:
|
||||
jobName: "CMake Clang"
|
||||
artifactPrefixName: "PCSX2-windows-Qt-x64-cmake-clang"
|
||||
configuration: CMake
|
||||
buildSystem: cmake
|
||||
cmakeFlags: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DPCSX2_EXE_NAME=pcsx2-qt-clang
|
||||
|
||||
67
.github/workflows/windows_build_qt.yml
vendored
67
.github/workflows/windows_build_qt.yml
vendored
@@ -6,6 +6,9 @@ on:
|
||||
jobName:
|
||||
required: true
|
||||
type: string
|
||||
artifactPrefixName:
|
||||
required: true
|
||||
type: string
|
||||
os:
|
||||
required: false
|
||||
type: string
|
||||
@@ -29,14 +32,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
|
||||
@@ -45,35 +40,45 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
stableBuild:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build_windows_qt:
|
||||
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: Tempfix Clang
|
||||
if: inputs.configuration == 'CMake'
|
||||
run: choco uninstall llvm
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# actions/checkout elides tags, fetch them primarily for releases
|
||||
- name: Fetch Tags
|
||||
if: ${{ inputs.fetchTags }}
|
||||
run: git fetch --tags --no-recurse-submodules
|
||||
|
||||
- name: Add stable release identifier file
|
||||
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
cat ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
|
||||
- name: Prepare Artifact Metadata
|
||||
id: artifact-metadata
|
||||
shell: bash
|
||||
env:
|
||||
OS: windows
|
||||
BUILD_SYSTEM: ${{ inputs.buildSystem }}
|
||||
ARCH: ${{ inputs.platform }}
|
||||
SIMD: ${{ inputs.simd }}
|
||||
PREFIX: ${{ inputs.artifactPrefixName }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
PR_NUM: ${{ github.event.pull_request.number }}
|
||||
@@ -82,15 +87,7 @@ jobs:
|
||||
|
||||
- name: Setup msbuild
|
||||
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
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Download patches
|
||||
shell: cmd
|
||||
@@ -98,13 +95,26 @@ jobs:
|
||||
cd bin/resources
|
||||
aria2c -Z "${{ inputs.patchesUrl }}/patches.zip"
|
||||
|
||||
- name: Cache Dependencies
|
||||
id: cache-deps
|
||||
uses: actions/cache@v4
|
||||
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
|
||||
@@ -122,10 +132,11 @@ jobs:
|
||||
shell: cmd
|
||||
run: |
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
||||
set PATH=%PATH%;%GITHUB_WORKSPACE%\bin
|
||||
cmake --build build --config Release --target unittests
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
||||
path: |
|
||||
@@ -139,7 +150,7 @@ jobs:
|
||||
!./bin/**/*.lib
|
||||
|
||||
- name: Upload artifact - with symbols
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.artifact-metadata.outputs.artifact-name }}-symbols
|
||||
path: ./bin/**/*.pdb
|
||||
|
||||
32
.gitignore
vendored
32
.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
|
||||
@@ -62,6 +56,13 @@ oprofile_data/
|
||||
/UpgradeLog*.htm
|
||||
/.vscode*
|
||||
|
||||
# Jetbrains Rider
|
||||
/.idea*
|
||||
|
||||
# KDevelop 4 Workspace Configuration Files
|
||||
*.kdev4
|
||||
/.kdev4*
|
||||
|
||||
/bin/**/*.dll
|
||||
/bin/**/*.dmp
|
||||
/bin/**/*.exp
|
||||
@@ -73,11 +74,13 @@ oprofile_data/
|
||||
/bin/bios
|
||||
/bin/cache
|
||||
/bin/cheats
|
||||
/bin/patches
|
||||
/bin/covers
|
||||
/bin/dumps
|
||||
/bin/gamesettings
|
||||
/bin/help
|
||||
/bin/inis
|
||||
/bin/inis/debuggersettings
|
||||
/bin/logs
|
||||
/bin/memcards
|
||||
/bin/plugins
|
||||
@@ -86,7 +89,22 @@ oprofile_data/
|
||||
/bin/textures
|
||||
/bin/translations
|
||||
/bin/inputprofiles
|
||||
/bin/videos
|
||||
/bin/portable.ini
|
||||
/bin/portable.txt
|
||||
|
||||
# Manually added by user.
|
||||
/bin/resources/patches.zip
|
||||
|
||||
# Resources that are runtime downloaded.
|
||||
/bin/resources/fonts/NotoSansJP-Regular.ttf
|
||||
/bin/resources/fonts/NotoSansKR-Regular.ttf
|
||||
/bin/resources/fonts/NotoSansSC-Regular.ttf
|
||||
/bin/resources/fonts/NotoSansTC-Regular.ttf
|
||||
|
||||
/deps-build
|
||||
/deps
|
||||
/deps-arm64
|
||||
/ipch
|
||||
|
||||
!/3rdparty/libjpeg/change.log
|
||||
|
||||
38
.gitmodules
vendored
38
.gitmodules
vendored
@@ -1,38 +0,0 @@
|
||||
[submodule "3rdparty/xz/xz"]
|
||||
path = 3rdparty/xz/xz
|
||||
url = https://github.com/PCSX2/xz.git
|
||||
[submodule "3rdparty/gtest"]
|
||||
path = 3rdparty/gtest
|
||||
url = https://github.com/google/googletest.git
|
||||
[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
|
||||
branch = master
|
||||
[submodule "3rdparty/rapidyaml/rapidyaml"]
|
||||
path = 3rdparty/rapidyaml/rapidyaml
|
||||
url = https://github.com/biojppm/rapidyaml.git
|
||||
branch = master
|
||||
[submodule "3rdparty/glslang/glslang"]
|
||||
path = 3rdparty/glslang/glslang
|
||||
url = https://github.com/KhronosGroup/glslang.git
|
||||
[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
|
||||
|
||||
21
3rdparty/3rdparty.props
vendored
21
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>
|
||||
@@ -16,6 +16,23 @@
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
|
||||
<!-- MSVC automatically adds __AVX__ and __AVX2__ appropriately -->
|
||||
<PreprocessorDefinitions>_M_X86;__SSE4_1__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnableEnhancedInstructionSet Condition="!$(Configuration.Contains(AVX2)) Or $(Configuration.Contains(Clang))">NotSet</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet Condition="$(Configuration.Contains(AVX2)) And !$(Configuration.Contains(Clang))">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
<AdditionalOptions Condition="'$(Platform)'=='x64' And $(Configuration.Contains(Clang)) And !$(Configuration.Contains(AVX2))"> -march=nehalem %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Platform)'=='x64' And $(Configuration.Contains(Clang)) And $(Configuration.Contains(AVX2))"> -march=haswell %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Platform)'=='ARM64' And $(Configuration.Contains(Clang))"> -march=armv8.4-a %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="!$(Configuration.Contains(Clang))">%(AdditionalOptions) /Zc:externConstexpr /Zc:__cplusplus /Zo /utf-8</AdditionalOptions>
|
||||
|
||||
<!-- Force ThinLTO for Release builds, MSVC doesn't seem to do it otherwise. -->
|
||||
<!-- Also due to include order, needs to be set here, rather than in CodeGen_Release.props -->
|
||||
<AdditionalOptions Condition="$(Configuration.Contains(Clang)) And $(Configuration.Contains(Release))"> -flto=thin %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
|
||||
782
3rdparty/cpuinfo/CMakeLists.txt
vendored
782
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,32 @@ 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(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" AND CPUINFO_TARGET_PROCESSOR STREQUAL "amd64")
|
||||
SET(CPUINFO_TARGET_PROCESSOR "AMD64")
|
||||
ENDIF()
|
||||
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 +95,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|FreeBSD)$")
|
||||
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 +117,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 +177,18 @@ 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)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
LIST(APPEND CPUINFO_SRCS src/x86/freebsd/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 +208,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,11 +237,13 @@ 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)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
LIST(APPEND CPUINFO_SRCS src/freebsd/topology.c)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
SET(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
SET(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
FIND_PACKAGE(Threads REQUIRED)
|
||||
@@ -166,34 +263,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)
|
||||
@@ -202,22 +308,618 @@ IF(CPUINFO_SUPPORTED_PLATFORM)
|
||||
TARGET_LINK_LIBRARIES(cpuinfo_internals PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE _GNU_SOURCE=1)
|
||||
TARGET_COMPILE_DEFINITIONS(cpuinfo_internals PRIVATE _GNU_SOURCE=1)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
TARGET_LINK_LIBRARIES(cpuinfo PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
||||
TARGET_LINK_LIBRARIES(cpuinfo_internals PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF()
|
||||
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@)
|
||||
76
3rdparty/cpuinfo/cpuinfo.vcxproj
vendored
76
3rdparty/cpuinfo/cpuinfo.vcxproj
vendored
@@ -30,36 +30,82 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\duckstation\dep\cpuinfo\src\arm\cache.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='ARM64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\duckstation\dep\cpuinfo\src\arm\uarch.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='ARM64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\duckstation\dep\cpuinfo\src\arm\windows\init.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='ARM64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="deps\clog\src\clog.c" />
|
||||
<ClCompile Include="src\api.c" />
|
||||
<ClCompile Include="src\cache.c" />
|
||||
<ClCompile Include="src\init.c" />
|
||||
<ClCompile Include="src\x86\cache\descriptor.c" />
|
||||
<ClCompile Include="src\x86\cache\deterministic.c" />
|
||||
<ClCompile Include="src\x86\cache\init.c" />
|
||||
<ClCompile Include="src\x86\info.c" />
|
||||
<ClCompile Include="src\x86\init.c" />
|
||||
<ClCompile Include="src\x86\isa.c" />
|
||||
<ClCompile Include="src\x86\name.c" />
|
||||
<ClCompile Include="src\x86\topology.c" />
|
||||
<ClCompile Include="src\x86\uarch.c" />
|
||||
<ClCompile Include="src\x86\vendor.c" />
|
||||
<ClCompile Include="src\x86\windows\init.c" />
|
||||
<ClCompile Include="src\x86\cache\descriptor.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\x86\cache\deterministic.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\x86\cache\init.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\x86\info.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\x86\init.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\x86\isa.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\x86\name.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\x86\topology.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\x86\uarch.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\x86\vendor.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\x86\windows\init.c">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\duckstation\dep\cpuinfo\src\arm\api.h">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='ARM64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\duckstation\dep\cpuinfo\src\arm\midr.h">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='ARM64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\duckstation\dep\cpuinfo\src\arm\windows\api.h">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='ARM64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="deps\clog\include\clog.h" />
|
||||
<ClInclude Include="include\cpuinfo.h" />
|
||||
<ClInclude Include="src\cpuinfo\common.h" />
|
||||
<ClInclude Include="src\cpuinfo\internal-api.h" />
|
||||
<ClInclude Include="src\cpuinfo\log.h" />
|
||||
<ClInclude Include="src\cpuinfo\utils.h" />
|
||||
<ClInclude Include="src\x86\api.h" />
|
||||
<ClInclude Include="src\x86\cpuid.h" />
|
||||
<ClInclude Include="src\x86\windows\api.h" />
|
||||
<ClInclude Include="src\x86\api.h">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\x86\cpuid.h">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\x86\windows\api.h">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
</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>
|
||||
|
||||
24
3rdparty/cpuinfo/cpuinfo.vcxproj.filters
vendored
24
3rdparty/cpuinfo/cpuinfo.vcxproj.filters
vendored
@@ -16,6 +16,12 @@
|
||||
<Filter Include="clog">
|
||||
<UniqueIdentifier>{7f0aba4c-ca06-4a7b-aed1-4f1e6976e839}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="arm">
|
||||
<UniqueIdentifier>{ac4549d3-f60f-4e60-bf43-86d1c253cf3f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="arm\windows">
|
||||
<UniqueIdentifier>{41fcb23a-e77b-4b5c-8238-e9b92bf1f3c6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\x86\isa.c">
|
||||
@@ -57,6 +63,15 @@
|
||||
<ClCompile Include="deps\clog\src\clog.c">
|
||||
<Filter>clog</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\duckstation\dep\cpuinfo\src\arm\cache.c">
|
||||
<Filter>arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\duckstation\dep\cpuinfo\src\arm\uarch.c">
|
||||
<Filter>arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\duckstation\dep\cpuinfo\src\arm\windows\init.c">
|
||||
<Filter>arm\windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\x86\api.h">
|
||||
@@ -84,5 +99,14 @@
|
||||
<ClInclude Include="deps\clog\include\clog.h">
|
||||
<Filter>clog</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\duckstation\dep\cpuinfo\src\arm\api.h">
|
||||
<Filter>arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\duckstation\dep\cpuinfo\src\arm\midr.h">
|
||||
<Filter>arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\duckstation\dep\cpuinfo\src\arm\windows\api.h">
|
||||
<Filter>arm\windows</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
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
|
||||
|
||||
56
3rdparty/cpuinfo/include/cpuinfo-mock.h
vendored
56
3rdparty/cpuinfo/include/cpuinfo-mock.h
vendored
@@ -7,37 +7,35 @@
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#if defined(__linux__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if !defined(CPUINFO_MOCK) || !(CPUINFO_MOCK)
|
||||
#error This header is intended only for test use
|
||||
#error This header is intended only for test use
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if CPUINFO_ARCH_ARM
|
||||
void CPUINFO_ABI cpuinfo_set_fpsid(uint32_t fpsid);
|
||||
void CPUINFO_ABI cpuinfo_set_wcid(uint32_t wcid);
|
||||
void CPUINFO_ABI cpuinfo_set_fpsid(uint32_t fpsid);
|
||||
void CPUINFO_ABI cpuinfo_set_wcid(uint32_t wcid);
|
||||
#endif /* CPUINFO_ARCH_ARM */
|
||||
|
||||
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
|
||||
struct cpuinfo_mock_cpuid {
|
||||
uint32_t input_eax;
|
||||
uint32_t input_ecx;
|
||||
uint32_t eax;
|
||||
uint32_t ebx;
|
||||
uint32_t ecx;
|
||||
uint32_t edx;
|
||||
};
|
||||
struct cpuinfo_mock_cpuid {
|
||||
uint32_t input_eax;
|
||||
uint32_t input_ecx;
|
||||
uint32_t eax;
|
||||
uint32_t ebx;
|
||||
uint32_t ecx;
|
||||
uint32_t edx;
|
||||
};
|
||||
|
||||
void CPUINFO_ABI cpuinfo_mock_set_cpuid(struct cpuinfo_mock_cpuid* dump, size_t entries);
|
||||
void CPUINFO_ABI cpuinfo_mock_get_cpuid(uint32_t eax, uint32_t regs[4]);
|
||||
void CPUINFO_ABI cpuinfo_mock_get_cpuidex(uint32_t eax, uint32_t ecx, uint32_t regs[4]);
|
||||
void CPUINFO_ABI cpuinfo_mock_set_cpuid(struct cpuinfo_mock_cpuid* dump, size_t entries);
|
||||
void CPUINFO_ABI cpuinfo_mock_get_cpuid(uint32_t eax, uint32_t regs[4]);
|
||||
void CPUINFO_ABI cpuinfo_mock_get_cpuidex(uint32_t eax, uint32_t ecx, uint32_t regs[4]);
|
||||
#endif /* CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64 */
|
||||
|
||||
struct cpuinfo_mock_file {
|
||||
@@ -53,22 +51,22 @@ struct cpuinfo_mock_property {
|
||||
};
|
||||
|
||||
#if defined(__linux__)
|
||||
void CPUINFO_ABI cpuinfo_mock_filesystem(struct cpuinfo_mock_file* files);
|
||||
int CPUINFO_ABI cpuinfo_mock_open(const char* path, int oflag);
|
||||
int CPUINFO_ABI cpuinfo_mock_close(int fd);
|
||||
ssize_t CPUINFO_ABI cpuinfo_mock_read(int fd, void* buffer, size_t capacity);
|
||||
void CPUINFO_ABI cpuinfo_mock_filesystem(struct cpuinfo_mock_file* files);
|
||||
int CPUINFO_ABI cpuinfo_mock_open(const char* path, int oflag);
|
||||
int CPUINFO_ABI cpuinfo_mock_close(int fd);
|
||||
ssize_t CPUINFO_ABI cpuinfo_mock_read(int fd, void* buffer, size_t capacity);
|
||||
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
void CPUINFO_ABI cpuinfo_set_hwcap(uint32_t hwcap);
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
void CPUINFO_ABI cpuinfo_set_hwcap2(uint32_t hwcap2);
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
void CPUINFO_ABI cpuinfo_set_hwcap(uint32_t hwcap);
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
void CPUINFO_ABI cpuinfo_set_hwcap2(uint32_t hwcap2);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
void CPUINFO_ABI cpuinfo_mock_android_properties(struct cpuinfo_mock_property* properties);
|
||||
void CPUINFO_ABI cpuinfo_mock_gl_renderer(const char* renderer);
|
||||
void CPUINFO_ABI cpuinfo_mock_android_properties(struct cpuinfo_mock_property* properties);
|
||||
void CPUINFO_ABI cpuinfo_mock_gl_renderer(const char* renderer);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
2382
3rdparty/cpuinfo/include/cpuinfo.h
vendored
2382
3rdparty/cpuinfo/include/cpuinfo.h
vendored
File diff suppressed because it is too large
Load Diff
318
3rdparty/cpuinfo/src/api.c
vendored
318
3rdparty/cpuinfo/src/api.c
vendored
@@ -6,13 +6,13 @@
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <linux/api.h>
|
||||
#include <linux/api.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#if !defined(__NR_getcpu)
|
||||
#include <asm-generic/unistd.h>
|
||||
#endif
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
#if !defined(__NR_getcpu)
|
||||
#include <asm-generic/unistd.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool cpuinfo_is_initialized = false;
|
||||
@@ -21,55 +21,54 @@ struct cpuinfo_processor* cpuinfo_processors = NULL;
|
||||
struct cpuinfo_core* cpuinfo_cores = NULL;
|
||||
struct cpuinfo_cluster* cpuinfo_clusters = NULL;
|
||||
struct cpuinfo_package* cpuinfo_packages = NULL;
|
||||
struct cpuinfo_cache* cpuinfo_cache[cpuinfo_cache_level_max] = { NULL };
|
||||
struct cpuinfo_cache* cpuinfo_cache[cpuinfo_cache_level_max] = {NULL};
|
||||
|
||||
uint32_t cpuinfo_processors_count = 0;
|
||||
uint32_t cpuinfo_cores_count = 0;
|
||||
uint32_t cpuinfo_clusters_count = 0;
|
||||
uint32_t cpuinfo_packages_count = 0;
|
||||
uint32_t cpuinfo_cache_count[cpuinfo_cache_level_max] = { 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
|
||||
struct cpuinfo_uarch_info* cpuinfo_uarchs = NULL;
|
||||
uint32_t cpuinfo_uarchs_count = 0;
|
||||
#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
|
||||
struct cpuinfo_uarch_info cpuinfo_global_uarch = { cpuinfo_uarch_unknown };
|
||||
struct cpuinfo_uarch_info cpuinfo_global_uarch = {cpuinfo_uarch_unknown};
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
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
|
||||
const uint32_t* cpuinfo_linux_cpu_to_uarch_index_map = NULL;
|
||||
#endif
|
||||
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 || CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
const uint32_t* cpuinfo_linux_cpu_to_uarch_index_map = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
const struct cpuinfo_processor* cpuinfo_get_processors(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "processors");
|
||||
}
|
||||
return cpuinfo_processors;
|
||||
}
|
||||
|
||||
const struct cpuinfo_core* cpuinfo_get_cores(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "core");
|
||||
}
|
||||
return cpuinfo_cores;
|
||||
}
|
||||
|
||||
const struct cpuinfo_cluster* cpuinfo_get_clusters(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "clusters");
|
||||
}
|
||||
return cpuinfo_clusters;
|
||||
}
|
||||
|
||||
const struct cpuinfo_package* cpuinfo_get_packages(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "packages");
|
||||
}
|
||||
return cpuinfo_packages;
|
||||
@@ -79,48 +78,48 @@ 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
|
||||
return cpuinfo_uarchs;
|
||||
#else
|
||||
return &cpuinfo_global_uarch;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_uarchs;
|
||||
#else
|
||||
return &cpuinfo_global_uarch;
|
||||
#endif
|
||||
}
|
||||
|
||||
const struct cpuinfo_processor* cpuinfo_get_processor(uint32_t index) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "processor");
|
||||
}
|
||||
if CPUINFO_UNLIKELY(index >= cpuinfo_processors_count) {
|
||||
if CPUINFO_UNLIKELY (index >= cpuinfo_processors_count) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_processors[index];
|
||||
}
|
||||
|
||||
const struct cpuinfo_core* cpuinfo_get_core(uint32_t index) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "core");
|
||||
}
|
||||
if CPUINFO_UNLIKELY(index >= cpuinfo_cores_count) {
|
||||
if CPUINFO_UNLIKELY (index >= cpuinfo_cores_count) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_cores[index];
|
||||
}
|
||||
|
||||
const struct cpuinfo_cluster* cpuinfo_get_cluster(uint32_t index) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "cluster");
|
||||
}
|
||||
if CPUINFO_UNLIKELY(index >= cpuinfo_clusters_count) {
|
||||
if CPUINFO_UNLIKELY (index >= cpuinfo_clusters_count) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_clusters[index];
|
||||
}
|
||||
|
||||
const struct cpuinfo_package* cpuinfo_get_package(uint32_t index) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "package");
|
||||
}
|
||||
if CPUINFO_UNLIKELY(index >= cpuinfo_packages_count) {
|
||||
if CPUINFO_UNLIKELY (index >= cpuinfo_packages_count) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_packages[index];
|
||||
@@ -130,42 +129,42 @@ 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_UNLIKELY(index >= cpuinfo_uarchs_count) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_uarchs[index];
|
||||
#else
|
||||
if CPUINFO_UNLIKELY(index != 0) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_global_uarch;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
if CPUINFO_UNLIKELY (index >= cpuinfo_uarchs_count) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_uarchs[index];
|
||||
#else
|
||||
if CPUINFO_UNLIKELY (index != 0) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_global_uarch;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t cpuinfo_get_processors_count(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "processors_count");
|
||||
}
|
||||
return cpuinfo_processors_count;
|
||||
}
|
||||
|
||||
uint32_t cpuinfo_get_cores_count(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "cores_count");
|
||||
}
|
||||
return cpuinfo_cores_count;
|
||||
}
|
||||
|
||||
uint32_t cpuinfo_get_clusters_count(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "clusters_count");
|
||||
}
|
||||
return cpuinfo_clusters_count;
|
||||
}
|
||||
|
||||
uint32_t cpuinfo_get_packages_count(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "packages_count");
|
||||
}
|
||||
return cpuinfo_packages_count;
|
||||
@@ -175,236 +174,243 @@ 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
|
||||
return cpuinfo_uarchs_count;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_RISCV32 || CPUINFO_ARCH_RISCV64
|
||||
return cpuinfo_uarchs_count;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1i_caches(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l1i_caches");
|
||||
}
|
||||
return cpuinfo_cache[cpuinfo_cache_level_1i];
|
||||
}
|
||||
|
||||
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1d_caches(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l1d_caches");
|
||||
}
|
||||
return cpuinfo_cache[cpuinfo_cache_level_1d];
|
||||
}
|
||||
|
||||
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l2_caches(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l2_caches");
|
||||
}
|
||||
return cpuinfo_cache[cpuinfo_cache_level_2];
|
||||
}
|
||||
|
||||
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l3_caches(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l3_caches");
|
||||
}
|
||||
return cpuinfo_cache[cpuinfo_cache_level_3];
|
||||
}
|
||||
|
||||
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l4_caches(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l4_caches");
|
||||
}
|
||||
return cpuinfo_cache[cpuinfo_cache_level_4];
|
||||
}
|
||||
|
||||
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1i_cache(uint32_t index) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l1i_cache");
|
||||
}
|
||||
if CPUINFO_UNLIKELY(index >= cpuinfo_cache_count[cpuinfo_cache_level_1i]) {
|
||||
if CPUINFO_UNLIKELY (index >= cpuinfo_cache_count[cpuinfo_cache_level_1i]) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_cache[cpuinfo_cache_level_1i][index];
|
||||
}
|
||||
|
||||
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1d_cache(uint32_t index) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l1d_cache");
|
||||
}
|
||||
if CPUINFO_UNLIKELY(index >= cpuinfo_cache_count[cpuinfo_cache_level_1d]) {
|
||||
if CPUINFO_UNLIKELY (index >= cpuinfo_cache_count[cpuinfo_cache_level_1d]) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_cache[cpuinfo_cache_level_1d][index];
|
||||
}
|
||||
|
||||
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l2_cache(uint32_t index) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l2_cache");
|
||||
}
|
||||
if CPUINFO_UNLIKELY(index >= cpuinfo_cache_count[cpuinfo_cache_level_2]) {
|
||||
if CPUINFO_UNLIKELY (index >= cpuinfo_cache_count[cpuinfo_cache_level_2]) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_cache[cpuinfo_cache_level_2][index];
|
||||
}
|
||||
|
||||
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l3_cache(uint32_t index) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l3_cache");
|
||||
}
|
||||
if CPUINFO_UNLIKELY(index >= cpuinfo_cache_count[cpuinfo_cache_level_3]) {
|
||||
if CPUINFO_UNLIKELY (index >= cpuinfo_cache_count[cpuinfo_cache_level_3]) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_cache[cpuinfo_cache_level_3][index];
|
||||
}
|
||||
|
||||
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l4_cache(uint32_t index) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l4_cache");
|
||||
}
|
||||
if CPUINFO_UNLIKELY(index >= cpuinfo_cache_count[cpuinfo_cache_level_4]) {
|
||||
if CPUINFO_UNLIKELY (index >= cpuinfo_cache_count[cpuinfo_cache_level_4]) {
|
||||
return NULL;
|
||||
}
|
||||
return &cpuinfo_cache[cpuinfo_cache_level_4][index];
|
||||
}
|
||||
|
||||
uint32_t CPUINFO_ABI cpuinfo_get_l1i_caches_count(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l1i_caches_count");
|
||||
}
|
||||
return cpuinfo_cache_count[cpuinfo_cache_level_1i];
|
||||
}
|
||||
|
||||
uint32_t CPUINFO_ABI cpuinfo_get_l1d_caches_count(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l1d_caches_count");
|
||||
}
|
||||
return cpuinfo_cache_count[cpuinfo_cache_level_1d];
|
||||
}
|
||||
|
||||
uint32_t CPUINFO_ABI cpuinfo_get_l2_caches_count(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l2_caches_count");
|
||||
}
|
||||
return cpuinfo_cache_count[cpuinfo_cache_level_2];
|
||||
}
|
||||
|
||||
uint32_t CPUINFO_ABI cpuinfo_get_l3_caches_count(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l3_caches_count");
|
||||
}
|
||||
return cpuinfo_cache_count[cpuinfo_cache_level_3];
|
||||
}
|
||||
|
||||
uint32_t CPUINFO_ABI cpuinfo_get_l4_caches_count(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "l4_caches_count");
|
||||
}
|
||||
return cpuinfo_cache_count[cpuinfo_cache_level_4];
|
||||
}
|
||||
|
||||
uint32_t CPUINFO_ABI cpuinfo_get_max_cache_size(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "max_cache_size");
|
||||
}
|
||||
return cpuinfo_max_cache_size;
|
||||
}
|
||||
|
||||
const struct cpuinfo_processor* CPUINFO_ABI cpuinfo_get_current_processor(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "current_processor");
|
||||
}
|
||||
#ifdef __linux__
|
||||
/* Initializing this variable silences a MemorySanitizer error. */
|
||||
unsigned cpu = 0;
|
||||
if CPUINFO_UNLIKELY(syscall(__NR_getcpu, &cpu, NULL, NULL) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if CPUINFO_UNLIKELY((uint32_t) cpu >= cpuinfo_linux_cpu_max) {
|
||||
return 0;
|
||||
}
|
||||
return cpuinfo_linux_cpu_to_processor_map[cpu];
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
/* Initializing this variable silences a MemorySanitizer error. */
|
||||
unsigned cpu = 0;
|
||||
if CPUINFO_UNLIKELY (syscall(__NR_getcpu, &cpu, NULL, NULL) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if CPUINFO_UNLIKELY ((uint32_t)cpu >= cpuinfo_linux_cpu_max) {
|
||||
return 0;
|
||||
}
|
||||
return cpuinfo_linux_cpu_to_processor_map[cpu];
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
const struct cpuinfo_core* CPUINFO_ABI cpuinfo_get_current_core(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
if CPUINFO_UNLIKELY (!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "current_core");
|
||||
}
|
||||
#ifdef __linux__
|
||||
/* Initializing this variable silences a MemorySanitizer error. */
|
||||
unsigned cpu = 0;
|
||||
if CPUINFO_UNLIKELY(syscall(__NR_getcpu, &cpu, NULL, NULL) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if CPUINFO_UNLIKELY((uint32_t) cpu >= cpuinfo_linux_cpu_max) {
|
||||
return 0;
|
||||
}
|
||||
return cpuinfo_linux_cpu_to_core_map[cpu];
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
/* Initializing this variable silences a MemorySanitizer error. */
|
||||
unsigned cpu = 0;
|
||||
if CPUINFO_UNLIKELY (syscall(__NR_getcpu, &cpu, NULL, NULL) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if CPUINFO_UNLIKELY ((uint32_t)cpu >= cpuinfo_linux_cpu_max) {
|
||||
return 0;
|
||||
}
|
||||
return cpuinfo_linux_cpu_to_core_map[cpu];
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t CPUINFO_ABI cpuinfo_get_current_uarch_index(void) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
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
|
||||
#ifdef __linux__
|
||||
if (cpuinfo_linux_cpu_to_uarch_index_map == NULL) {
|
||||
/* Special case: avoid syscall on systems with only a single type of cores */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* General case */
|
||||
/* Initializing this variable silences a MemorySanitizer error. */
|
||||
unsigned cpu = 0;
|
||||
if CPUINFO_UNLIKELY(syscall(__NR_getcpu, &cpu, NULL, NULL) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if CPUINFO_UNLIKELY((uint32_t) cpu >= cpuinfo_linux_cpu_max) {
|
||||
return 0;
|
||||
}
|
||||
return cpuinfo_linux_cpu_to_uarch_index_map[cpu];
|
||||
#else
|
||||
/* Fallback: pretend to be on the big core. */
|
||||
return 0;
|
||||
#endif
|
||||
#else
|
||||
/* Only ARM/ARM64 processors may include cores of different types in the same package. */
|
||||
#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
|
||||
*/
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* General case */
|
||||
/* Initializing this variable silences a MemorySanitizer error. */
|
||||
unsigned cpu = 0;
|
||||
if CPUINFO_UNLIKELY (syscall(__NR_getcpu, &cpu, NULL, NULL) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if CPUINFO_UNLIKELY ((uint32_t)cpu >= cpuinfo_linux_cpu_max) {
|
||||
return 0;
|
||||
}
|
||||
return cpuinfo_linux_cpu_to_uarch_index_map[cpu];
|
||||
#else
|
||||
/* Fallback: pretend to be on the big core. */
|
||||
return 0;
|
||||
#endif
|
||||
#else
|
||||
/* Only ARM/ARM64/RISCV processors may include cores of different types
|
||||
* in the same package. */
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t CPUINFO_ABI cpuinfo_get_current_uarch_index_with_default(uint32_t default_uarch_index) {
|
||||
if CPUINFO_UNLIKELY(!cpuinfo_is_initialized) {
|
||||
cpuinfo_log_fatal("cpuinfo_get_%s called before cpuinfo is initialized", "current_uarch_index_with_default");
|
||||
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
|
||||
#ifdef __linux__
|
||||
if (cpuinfo_linux_cpu_to_uarch_index_map == NULL) {
|
||||
/* Special case: avoid syscall on systems with only a single type of cores */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* General case */
|
||||
/* Initializing this variable silences a MemorySanitizer error. */
|
||||
unsigned cpu = 0;
|
||||
if CPUINFO_UNLIKELY(syscall(__NR_getcpu, &cpu, NULL, NULL) != 0) {
|
||||
return default_uarch_index;
|
||||
}
|
||||
if CPUINFO_UNLIKELY((uint32_t) cpu >= cpuinfo_linux_cpu_max) {
|
||||
return default_uarch_index;
|
||||
}
|
||||
return cpuinfo_linux_cpu_to_uarch_index_map[cpu];
|
||||
#else
|
||||
/* Fallback: no API to query current core, use default uarch index. */
|
||||
return default_uarch_index;
|
||||
#endif
|
||||
#else
|
||||
/* Only ARM/ARM64 processors may include cores of different types in the same package. */
|
||||
#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
|
||||
*/
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* General case */
|
||||
/* Initializing this variable silences a MemorySanitizer error. */
|
||||
unsigned cpu = 0;
|
||||
if CPUINFO_UNLIKELY (syscall(__NR_getcpu, &cpu, NULL, NULL) != 0) {
|
||||
return default_uarch_index;
|
||||
}
|
||||
if CPUINFO_UNLIKELY ((uint32_t)cpu >= cpuinfo_linux_cpu_max) {
|
||||
return default_uarch_index;
|
||||
}
|
||||
return cpuinfo_linux_cpu_to_uarch_index_map[cpu];
|
||||
#else
|
||||
/* Fallback: no API to query current core, use default uarch index. */
|
||||
return default_uarch_index;
|
||||
#endif
|
||||
#else
|
||||
/* Only ARM/ARM64/RISCV processors may include cores of different types
|
||||
* in the same package. */
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
4
3rdparty/cpuinfo/src/arm/android/api.h
vendored
4
3rdparty/cpuinfo/src/arm/android/api.h
vendored
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/common.h>
|
||||
#include <arm/api.h>
|
||||
#include <arm/linux/api.h>
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/common.h>
|
||||
|
||||
enum cpuinfo_android_chipset_property {
|
||||
cpuinfo_android_chipset_property_proc_cpuinfo_hardware = 0,
|
||||
|
||||
53
3rdparty/cpuinfo/src/arm/android/properties.c
vendored
53
3rdparty/cpuinfo/src/arm/android/properties.c
vendored
@@ -1,42 +1,42 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
#include <linux/api.h>
|
||||
#include <arm/android/api.h>
|
||||
#include <arm/linux/api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
#include <linux/api.h>
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
#include <cpuinfo-mock.h>
|
||||
#include <cpuinfo-mock.h>
|
||||
|
||||
static struct cpuinfo_mock_property* cpuinfo_mock_properties = NULL;
|
||||
static struct cpuinfo_mock_property* cpuinfo_mock_properties = NULL;
|
||||
|
||||
void CPUINFO_ABI cpuinfo_mock_android_properties(struct cpuinfo_mock_property* properties) {
|
||||
cpuinfo_log_info("Android properties mocking enabled");
|
||||
cpuinfo_mock_properties = properties;
|
||||
}
|
||||
void CPUINFO_ABI cpuinfo_mock_android_properties(struct cpuinfo_mock_property* properties) {
|
||||
cpuinfo_log_info("Android properties mocking enabled");
|
||||
cpuinfo_mock_properties = properties;
|
||||
}
|
||||
|
||||
static int cpuinfo_android_property_get(const char* key, char* value) {
|
||||
if (cpuinfo_mock_properties != NULL) {
|
||||
for (const struct cpuinfo_mock_property* prop = cpuinfo_mock_properties; prop->key != NULL; prop++) {
|
||||
if (strncmp(key, prop->key, CPUINFO_BUILD_PROP_NAME_MAX) == 0) {
|
||||
strncpy(value, prop->value, CPUINFO_BUILD_PROP_VALUE_MAX);
|
||||
return (int) strnlen(prop->value, CPUINFO_BUILD_PROP_VALUE_MAX);
|
||||
}
|
||||
static int cpuinfo_android_property_get(const char* key, char* value) {
|
||||
if (cpuinfo_mock_properties != NULL) {
|
||||
for (const struct cpuinfo_mock_property* prop = cpuinfo_mock_properties; prop->key != NULL; prop++) {
|
||||
if (strncmp(key, prop->key, CPUINFO_BUILD_PROP_NAME_MAX) == 0) {
|
||||
strncpy(value, prop->value, CPUINFO_BUILD_PROP_VALUE_MAX);
|
||||
return (int)strnlen(prop->value, CPUINFO_BUILD_PROP_VALUE_MAX);
|
||||
}
|
||||
}
|
||||
*value = '\0';
|
||||
return 0;
|
||||
}
|
||||
*value = '\0';
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static inline int cpuinfo_android_property_get(const char* key, char* value) {
|
||||
return __system_property_get(key, value);
|
||||
}
|
||||
static inline int cpuinfo_android_property_get(const char* key, char* value) {
|
||||
return __system_property_get(key, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
void cpuinfo_arm_android_parse_properties(struct cpuinfo_android_properties properties[restrict static 1]) {
|
||||
@@ -50,18 +50,17 @@ void cpuinfo_arm_android_parse_properties(struct cpuinfo_android_properties prop
|
||||
|
||||
const int ro_mediatek_platform_length =
|
||||
cpuinfo_android_property_get("ro.mediatek.platform", properties->ro_mediatek_platform);
|
||||
cpuinfo_log_debug("read ro.mediatek.platform = \"%.*s\"",
|
||||
ro_mediatek_platform_length, properties->ro_mediatek_platform);
|
||||
cpuinfo_log_debug(
|
||||
"read ro.mediatek.platform = \"%.*s\"", ro_mediatek_platform_length, properties->ro_mediatek_platform);
|
||||
|
||||
const int ro_arch_length =
|
||||
cpuinfo_android_property_get("ro.arch", properties->ro_arch);
|
||||
const int ro_arch_length = cpuinfo_android_property_get("ro.arch", properties->ro_arch);
|
||||
cpuinfo_log_debug("read ro.arch = \"%.*s\"", ro_arch_length, properties->ro_arch);
|
||||
|
||||
const int ro_chipname_length =
|
||||
cpuinfo_android_property_get("ro.chipname", properties->ro_chipname);
|
||||
const int ro_chipname_length = cpuinfo_android_property_get("ro.chipname", properties->ro_chipname);
|
||||
cpuinfo_log_debug("read ro.chipname = \"%.*s\"", ro_chipname_length, properties->ro_chipname);
|
||||
|
||||
const int ro_hardware_chipname_length =
|
||||
cpuinfo_android_property_get("ro.hardware.chipname", properties->ro_hardware_chipname);
|
||||
cpuinfo_log_debug("read ro.hardware.chipname = \"%.*s\"", ro_hardware_chipname_length, properties->ro_hardware_chipname);
|
||||
cpuinfo_log_debug(
|
||||
"read ro.hardware.chipname = \"%.*s\"", ro_hardware_chipname_length, properties->ro_hardware_chipname);
|
||||
}
|
||||
|
||||
82
3rdparty/cpuinfo/src/arm/api.h
vendored
82
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,
|
||||
};
|
||||
@@ -78,45 +80,47 @@ struct cpuinfo_arm_chipset {
|
||||
#define CPUINFO_ARM_CHIPSET_NAME_MAX CPUINFO_PACKAGE_NAME_MAX
|
||||
|
||||
#ifndef __cplusplus
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_chipset_to_string(
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
char name[restrict static CPUINFO_ARM_CHIPSET_NAME_MAX]);
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_chipset_to_string(
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
char name[restrict static CPUINFO_ARM_CHIPSET_NAME_MAX]);
|
||||
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_fixup_chipset(
|
||||
struct cpuinfo_arm_chipset chipset[restrict static 1], uint32_t cores, uint32_t max_cpu_freq_max);
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_fixup_chipset(
|
||||
struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
uint32_t cores,
|
||||
uint32_t max_cpu_freq_max);
|
||||
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_decode_vendor_uarch(
|
||||
uint32_t midr,
|
||||
#if CPUINFO_ARCH_ARM
|
||||
bool has_vfpv4,
|
||||
#endif
|
||||
enum cpuinfo_vendor vendor[restrict static 1],
|
||||
enum cpuinfo_uarch uarch[restrict static 1]);
|
||||
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_decode_cache(
|
||||
enum cpuinfo_uarch uarch,
|
||||
uint32_t cluster_cores,
|
||||
uint32_t midr,
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
uint32_t cluster_id,
|
||||
uint32_t arch_version,
|
||||
struct cpuinfo_cache l1i[restrict static 1],
|
||||
struct cpuinfo_cache l1d[restrict static 1],
|
||||
struct cpuinfo_cache l2[restrict static 1],
|
||||
struct cpuinfo_cache l3[restrict static 1]);
|
||||
|
||||
CPUINFO_INTERNAL uint32_t cpuinfo_arm_compute_max_cache_size(
|
||||
const struct cpuinfo_processor processor[restrict static 1]);
|
||||
#else /* defined(__cplusplus) */
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_decode_cache(
|
||||
enum cpuinfo_uarch uarch,
|
||||
uint32_t cluster_cores,
|
||||
uint32_t midr,
|
||||
const struct cpuinfo_arm_chipset chipset[1],
|
||||
uint32_t cluster_id,
|
||||
uint32_t arch_version,
|
||||
struct cpuinfo_cache l1i[1],
|
||||
struct cpuinfo_cache l1d[1],
|
||||
struct cpuinfo_cache l2[1],
|
||||
struct cpuinfo_cache l3[1]);
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_decode_vendor_uarch(
|
||||
uint32_t midr,
|
||||
#if CPUINFO_ARCH_ARM
|
||||
bool has_vfpv4,
|
||||
#endif
|
||||
enum cpuinfo_vendor vendor[restrict static 1],
|
||||
enum cpuinfo_uarch uarch[restrict static 1]);
|
||||
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_decode_cache(
|
||||
enum cpuinfo_uarch uarch,
|
||||
uint32_t cluster_cores,
|
||||
uint32_t midr,
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
uint32_t cluster_id,
|
||||
uint32_t arch_version,
|
||||
struct cpuinfo_cache l1i[restrict static 1],
|
||||
struct cpuinfo_cache l1d[restrict static 1],
|
||||
struct cpuinfo_cache l2[restrict static 1],
|
||||
struct cpuinfo_cache l3[restrict static 1]);
|
||||
|
||||
CPUINFO_INTERNAL uint32_t
|
||||
cpuinfo_arm_compute_max_cache_size(const struct cpuinfo_processor processor[restrict static 1]);
|
||||
#else /* defined(__cplusplus) */
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_decode_cache(
|
||||
enum cpuinfo_uarch uarch,
|
||||
uint32_t cluster_cores,
|
||||
uint32_t midr,
|
||||
const struct cpuinfo_arm_chipset chipset[1],
|
||||
uint32_t cluster_id,
|
||||
uint32_t arch_version,
|
||||
struct cpuinfo_cache l1i[1],
|
||||
struct cpuinfo_cache l1d[1],
|
||||
struct cpuinfo_cache l2[1],
|
||||
struct cpuinfo_cache l3[1]);
|
||||
#endif
|
||||
|
||||
1625
3rdparty/cpuinfo/src/arm/cache.c
vendored
1625
3rdparty/cpuinfo/src/arm/cache.c
vendored
File diff suppressed because it is too large
Load Diff
269
3rdparty/cpuinfo/src/arm/linux/aarch32-isa.c
vendored
269
3rdparty/cpuinfo/src/arm/linux/aarch32-isa.c
vendored
@@ -1,29 +1,27 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
#include <cpuinfo-mock.h>
|
||||
#include <cpuinfo-mock.h>
|
||||
#endif
|
||||
#include <arm/linux/api.h>
|
||||
#include <arm/linux/cp.h>
|
||||
#include <arm/midr.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
uint32_t cpuinfo_arm_fpsid = 0;
|
||||
uint32_t cpuinfo_arm_mvfr0 = 0;
|
||||
uint32_t cpuinfo_arm_wcid = 0;
|
||||
uint32_t cpuinfo_arm_fpsid = 0;
|
||||
uint32_t cpuinfo_arm_mvfr0 = 0;
|
||||
uint32_t cpuinfo_arm_wcid = 0;
|
||||
|
||||
void cpuinfo_set_fpsid(uint32_t fpsid) {
|
||||
cpuinfo_arm_fpsid = fpsid;
|
||||
}
|
||||
void cpuinfo_set_fpsid(uint32_t fpsid) {
|
||||
cpuinfo_arm_fpsid = fpsid;
|
||||
}
|
||||
|
||||
void cpuinfo_set_wcid(uint32_t wcid) {
|
||||
cpuinfo_arm_wcid = wcid;
|
||||
}
|
||||
void cpuinfo_set_wcid(uint32_t wcid) {
|
||||
cpuinfo_arm_wcid = wcid;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
uint32_t features,
|
||||
uint32_t features2,
|
||||
@@ -31,20 +29,27 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
uint32_t architecture_version,
|
||||
uint32_t architecture_flags,
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
struct cpuinfo_arm_isa isa[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,
|
||||
* but may be not reported in /proc/cpuinfo features.
|
||||
* ARMv7 code running on ARMv8: IDIV, VFP, NEON are always
|
||||
* supported, but may be not reported in /proc/cpuinfo features.
|
||||
*/
|
||||
isa->armv5e = true;
|
||||
isa->armv6 = true;
|
||||
isa->armv6k = true;
|
||||
isa->armv7 = true;
|
||||
isa->armv5e = true;
|
||||
isa->armv6 = true;
|
||||
isa->armv6k = true;
|
||||
isa->armv7 = true;
|
||||
isa->armv7mp = true;
|
||||
isa->armv8 = true;
|
||||
isa->thumb = true;
|
||||
isa->armv8 = true;
|
||||
isa->thumb = true;
|
||||
isa->thumb2 = true;
|
||||
isa->idiv = true;
|
||||
isa->vfpv3 = true;
|
||||
@@ -54,33 +59,61 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
isa->neon = true;
|
||||
|
||||
/*
|
||||
* 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:
|
||||
* 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 */
|
||||
cpuinfo_log_warning("FP16 arithmetics and RDM disabled: only little cores in Exynos 9810 support these extensions");
|
||||
/* Only little cores of Exynos 9810 support FP16 & RDM
|
||||
*/
|
||||
cpuinfo_log_warning(
|
||||
"FP16 arithmetics and RDM disabled: only little cores in Exynos 9810 support these extensions");
|
||||
} 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(0x4800D400): /* Cortex-A76 (HiSilicon) */
|
||||
case UINT32_C(0x51008020): /* Kryo 385 Gold (Cortex-A75) */
|
||||
case UINT32_C(0x51008030): /* Kryo 385 Silver (Cortex-A55) */
|
||||
case UINT32_C(0x51008040): /* Kryo 485 Gold (Cortex-A76) */
|
||||
case UINT32_C(0x51008050): /* Kryo 485 Silver (Cortex-A55) */
|
||||
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) */
|
||||
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->fp16arith = true;
|
||||
@@ -91,46 +124,91 @@ 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 */
|
||||
/* ARMv7 or lower: use feature flags to detect optional features
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARM11 (ARM 1136/1156/1176/11 MPCore) processors can report v7 architecture
|
||||
* even though they support only ARMv6 instruction set.
|
||||
* ARM11 (ARM 1136/1156/1176/11 MPCore) processors can report v7
|
||||
* architecture even though they support only ARMv6 instruction
|
||||
* set.
|
||||
*/
|
||||
if (architecture_version == 7 && midr_is_arm11(midr)) {
|
||||
cpuinfo_log_warning("kernel-reported architecture ARMv7 ignored due to mismatch with processor microarchitecture (ARM11)");
|
||||
cpuinfo_log_warning(
|
||||
"kernel-reported architecture ARMv7 ignored due to mismatch with processor microarchitecture (ARM11)");
|
||||
architecture_version = 6;
|
||||
}
|
||||
|
||||
if (architecture_version < 7) {
|
||||
const uint32_t armv7_features_mask = CPUINFO_ARM_LINUX_FEATURE_VFPV3 | CPUINFO_ARM_LINUX_FEATURE_VFPV3D16 | CPUINFO_ARM_LINUX_FEATURE_VFPD32 |
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPV4 | CPUINFO_ARM_LINUX_FEATURE_NEON | CPUINFO_ARM_LINUX_FEATURE_IDIVT | CPUINFO_ARM_LINUX_FEATURE_IDIVA;
|
||||
const uint32_t armv7_features_mask = CPUINFO_ARM_LINUX_FEATURE_VFPV3 |
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPV3D16 | CPUINFO_ARM_LINUX_FEATURE_VFPD32 |
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPV4 | CPUINFO_ARM_LINUX_FEATURE_NEON |
|
||||
CPUINFO_ARM_LINUX_FEATURE_IDIVT | CPUINFO_ARM_LINUX_FEATURE_IDIVA;
|
||||
if (features & armv7_features_mask) {
|
||||
architecture_version = 7;
|
||||
}
|
||||
}
|
||||
if ((architecture_version >= 6) || (features & CPUINFO_ARM_LINUX_FEATURE_EDSP) || (architecture_flags & CPUINFO_ARM_LINUX_ARCH_E)) {
|
||||
if ((architecture_version >= 6) || (features & CPUINFO_ARM_LINUX_FEATURE_EDSP) ||
|
||||
(architecture_flags & CPUINFO_ARM_LINUX_ARCH_E)) {
|
||||
isa->armv5e = true;
|
||||
}
|
||||
if (architecture_version >= 6) {
|
||||
@@ -141,13 +219,16 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
isa->armv7 = true;
|
||||
|
||||
/*
|
||||
* ARMv7 MP extension (PLDW instruction) is not indicated in /proc/cpuinfo.
|
||||
* Use heuristic list of supporting processors:
|
||||
* - Processors supporting UDIV/SDIV instructions ("idiva" + "idivt" features in /proc/cpuinfo)
|
||||
* ARMv7 MP extension (PLDW instruction) is not
|
||||
* indicated in /proc/cpuinfo. Use heuristic list of
|
||||
* supporting processors:
|
||||
* - Processors supporting UDIV/SDIV instructions
|
||||
* ("idiva" + "idivt" features in /proc/cpuinfo)
|
||||
* - Cortex-A5
|
||||
* - Cortex-A9
|
||||
* - Dual-Core Scorpion
|
||||
* - Krait (supports UDIV/SDIV, but kernels may not report it in /proc/cpuinfo)
|
||||
* - Krait (supports UDIV/SDIV, but kernels may not
|
||||
* report it in /proc/cpuinfo)
|
||||
*
|
||||
* TODO: check single-core Qualcomm Scorpion.
|
||||
*/
|
||||
@@ -160,15 +241,18 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
isa->armv7mp = true;
|
||||
break;
|
||||
default:
|
||||
/* In practice IDIV instruction implies ARMv7+MP ISA */
|
||||
isa->armv7mp = (features & CPUINFO_ARM_LINUX_FEATURE_IDIV) == CPUINFO_ARM_LINUX_FEATURE_IDIV;
|
||||
/* In practice IDIV instruction implies
|
||||
* ARMv7+MP ISA */
|
||||
isa->armv7mp = (features & CPUINFO_ARM_LINUX_FEATURE_IDIV) ==
|
||||
CPUINFO_ARM_LINUX_FEATURE_IDIV;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (features & CPUINFO_ARM_LINUX_FEATURE_IWMMXT) {
|
||||
#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);
|
||||
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;
|
||||
@@ -176,10 +260,16 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
isa->wmmx2 = true;
|
||||
}
|
||||
} else {
|
||||
cpuinfo_log_warning("WMMX ISA disabled: OS reported iwmmxt feature, "
|
||||
"but WCID coprocessor type 0x%"PRIx32" indicates no WMMX support",
|
||||
cpuinfo_log_warning(
|
||||
"WMMX ISA disabled: OS reported iwmmxt feature, "
|
||||
"but WCID coprocessor type 0x%" PRIx32 " indicates no WMMX support",
|
||||
coprocessor_type);
|
||||
}
|
||||
#else
|
||||
cpuinfo_log_warning(
|
||||
"WMMX ISA disabled: OS reported iwmmxt feature, "
|
||||
"but there is no iWMMXt coprocessor");
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((features & CPUINFO_ARM_LINUX_FEATURE_THUMB) || (architecture_flags & CPUINFO_ARM_LINUX_ARCH_T)) {
|
||||
@@ -200,35 +290,39 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
isa->jazelle = true;
|
||||
}
|
||||
|
||||
/* Qualcomm Krait may have buggy kernel configuration that doesn't report IDIV */
|
||||
if ((features & CPUINFO_ARM_LINUX_FEATURE_IDIV) == CPUINFO_ARM_LINUX_FEATURE_IDIV || midr_is_krait(midr)) {
|
||||
/* Qualcomm Krait may have buggy kernel configuration that
|
||||
* doesn't report IDIV */
|
||||
if ((features & CPUINFO_ARM_LINUX_FEATURE_IDIV) == CPUINFO_ARM_LINUX_FEATURE_IDIV ||
|
||||
midr_is_krait(midr)) {
|
||||
isa->idiv = true;
|
||||
}
|
||||
|
||||
const uint32_t vfp_mask = \
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFP | CPUINFO_ARM_LINUX_FEATURE_VFPV3 | CPUINFO_ARM_LINUX_FEATURE_VFPV3D16 | \
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPD32 | CPUINFO_ARM_LINUX_FEATURE_VFPV4 | CPUINFO_ARM_LINUX_FEATURE_NEON;
|
||||
const uint32_t vfp_mask = CPUINFO_ARM_LINUX_FEATURE_VFP | CPUINFO_ARM_LINUX_FEATURE_VFPV3 |
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPV3D16 | CPUINFO_ARM_LINUX_FEATURE_VFPD32 |
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPV4 | CPUINFO_ARM_LINUX_FEATURE_NEON;
|
||||
if (features & vfp_mask) {
|
||||
const uint32_t vfpv3_mask = CPUINFO_ARM_LINUX_FEATURE_VFPV3 | CPUINFO_ARM_LINUX_FEATURE_VFPV3D16 | \
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPD32 | CPUINFO_ARM_LINUX_FEATURE_VFPV4 | CPUINFO_ARM_LINUX_FEATURE_NEON;
|
||||
const uint32_t vfpv3_mask = CPUINFO_ARM_LINUX_FEATURE_VFPV3 |
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPV3D16 | CPUINFO_ARM_LINUX_FEATURE_VFPD32 |
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPV4 | CPUINFO_ARM_LINUX_FEATURE_NEON;
|
||||
if ((architecture_version >= 7) || (features & vfpv3_mask)) {
|
||||
isa->vfpv3 = true;
|
||||
|
||||
const uint32_t d32_mask = CPUINFO_ARM_LINUX_FEATURE_VFPD32 | CPUINFO_ARM_LINUX_FEATURE_NEON;
|
||||
const uint32_t d32_mask =
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPD32 | CPUINFO_ARM_LINUX_FEATURE_NEON;
|
||||
if (features & d32_mask) {
|
||||
isa->d32 = true;
|
||||
}
|
||||
} else {
|
||||
#if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_8A__) || defined(__ARM_ARCH) && (__ARM_ARCH >= 7)
|
||||
isa->vfpv3 = true;
|
||||
#else
|
||||
const uint32_t fpsid = read_fpsid();
|
||||
cpuinfo_log_debug("FPSID = 0x%08"PRIx32, fpsid);
|
||||
const uint32_t subarchitecture = (fpsid >> 16) & UINT32_C(0x7F);
|
||||
if (subarchitecture >= 0x01) {
|
||||
isa->vfpv2 = true;
|
||||
}
|
||||
#endif
|
||||
#if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_8A__) || defined(__ARM_ARCH) && (__ARM_ARCH >= 7)
|
||||
isa->vfpv3 = true;
|
||||
#else
|
||||
const uint32_t fpsid = read_fpsid();
|
||||
cpuinfo_log_debug("FPSID = 0x%08" PRIx32, fpsid);
|
||||
const uint32_t subarchitecture = (fpsid >> 16) & UINT32_C(0x7F);
|
||||
if (subarchitecture >= 0x01) {
|
||||
isa->vfpv2 = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (features & CPUINFO_ARM_LINUX_FEATURE_NEON) {
|
||||
@@ -237,8 +331,9 @@ void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
|
||||
/*
|
||||
* There is no separate feature flag for FP16 support.
|
||||
* VFPv4 implies VFPv3-FP16 support (and in practice, NEON-HP as well).
|
||||
* Additionally, ARM Cortex-A9 and Qualcomm Scorpion support FP16.
|
||||
* VFPv4 implies VFPv3-FP16 support (and in practice, NEON-HP as
|
||||
* well). Additionally, ARM Cortex-A9 and Qualcomm Scorpion
|
||||
* support FP16.
|
||||
*/
|
||||
if ((features & CPUINFO_ARM_LINUX_FEATURE_VFPV4) || midr_is_cortex_a9(midr) || midr_is_scorpion(midr)) {
|
||||
isa->fp16 = true;
|
||||
|
||||
49
3rdparty/cpuinfo/src/arm/linux/aarch64-isa.c
vendored
49
3rdparty/cpuinfo/src/arm/linux/aarch64-isa.c
vendored
@@ -3,14 +3,12 @@
|
||||
#include <arm/linux/api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
|
||||
void cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
uint32_t features,
|
||||
uint32_t features2,
|
||||
uint32_t midr,
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
struct cpuinfo_arm_isa isa[restrict static 1])
|
||||
{
|
||||
struct cpuinfo_arm_isa isa[restrict static 1]) {
|
||||
if (features & CPUINFO_ARM_LINUX_FEATURE_AES) {
|
||||
isa->aes = true;
|
||||
}
|
||||
@@ -31,8 +29,10 @@ void cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
}
|
||||
|
||||
/*
|
||||
* Some phones ship with an old kernel configuration that doesn't report NEON FP16 compute extension and SQRDMLAH/SQRDMLSH/UQRDMLAH/UQRDMLSH instructions.
|
||||
* Use a MIDR-based heuristic to whitelist processors known to support it:
|
||||
* Some phones ship with an old kernel configuration that doesn't report
|
||||
* NEON FP16 compute extension and SQRDMLAH/SQRDMLSH/UQRDMLAH/UQRDMLSH
|
||||
* instructions. 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
|
||||
@@ -41,19 +41,28 @@ 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 */
|
||||
cpuinfo_log_warning("FP16 arithmetics and RDM disabled: only little cores in Exynos 9810 support these extensions");
|
||||
/* Exynos 9810 reports that it supports FP16 compute, but in
|
||||
* fact only little cores do */
|
||||
cpuinfo_log_warning(
|
||||
"FP16 arithmetics and RDM disabled: only little cores in Exynos 9810 support these extensions");
|
||||
} else {
|
||||
const uint32_t fp16arith_mask = CPUINFO_ARM_LINUX_FEATURE_FPHP | CPUINFO_ARM_LINUX_FEATURE_ASIMDHP;
|
||||
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) */
|
||||
@@ -68,9 +77,11 @@ void cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
if ((features & fp16arith_mask) == fp16arith_mask) {
|
||||
isa->fp16arith = true;
|
||||
} else if (features & CPUINFO_ARM_LINUX_FEATURE_FPHP) {
|
||||
cpuinfo_log_warning("FP16 arithmetics disabled: detected support only for scalar operations");
|
||||
cpuinfo_log_warning(
|
||||
"FP16 arithmetics disabled: detected support only for scalar operations");
|
||||
} else if (features & CPUINFO_ARM_LINUX_FEATURE_ASIMDHP) {
|
||||
cpuinfo_log_warning("FP16 arithmetics disabled: detected support only for SIMD operations");
|
||||
cpuinfo_log_warning(
|
||||
"FP16 arithmetics disabled: detected support only for SIMD operations");
|
||||
}
|
||||
if (features & CPUINFO_ARM_LINUX_FEATURE_ASIMDRDM) {
|
||||
isa->rdm = true;
|
||||
@@ -78,10 +89,14 @@ 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.
|
||||
* Use a MIDR-based heuristic to whitelist processors known to support it.
|
||||
* Many phones ship with an old kernel configuration that doesn't report
|
||||
* UDOT/SDOT instructions. Use a MIDR-based heuristic to whitelist
|
||||
* processors known to support it.
|
||||
*/
|
||||
switch (midr & (CPUINFO_ARM_MIDR_IMPLEMENTER_MASK | CPUINFO_ARM_MIDR_PART_MASK)) {
|
||||
case UINT32_C(0x4100D060): /* Cortex-A65 */
|
||||
@@ -89,7 +104,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 +142,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;
|
||||
}
|
||||
}
|
||||
|
||||
389
3rdparty/cpuinfo/src/arm/linux/api.h
vendored
389
3rdparty/cpuinfo/src/arm/linux/api.h
vendored
@@ -3,38 +3,40 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <arm/api.h>
|
||||
#include <arm/midr.h>
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/common.h>
|
||||
#include <arm/midr.h>
|
||||
#include <arm/api.h>
|
||||
#include <linux/api.h>
|
||||
|
||||
/* No hard limit in the kernel, maximum length observed on non-rogue kernels is 64 */
|
||||
/* No hard limit in the kernel, maximum length observed on non-rogue kernels is
|
||||
* 64 */
|
||||
#define CPUINFO_HARDWARE_VALUE_MAX 64
|
||||
/* No hard limit in the kernel, maximum length on Raspberry Pi is 8. Add 1 symbol to detect overly large revision strings */
|
||||
/* No hard limit in the kernel, maximum length on Raspberry Pi is 8. Add 1
|
||||
* symbol to detect overly large revision strings */
|
||||
#define CPUINFO_REVISION_VALUE_MAX 9
|
||||
|
||||
#ifdef __ANDROID__
|
||||
/* As per include/sys/system_properties.h in Android NDK */
|
||||
#define CPUINFO_BUILD_PROP_NAME_MAX 32
|
||||
#define CPUINFO_BUILD_PROP_VALUE_MAX 92
|
||||
/* As per include/sys/system_properties.h in Android NDK */
|
||||
#define CPUINFO_BUILD_PROP_NAME_MAX 32
|
||||
#define CPUINFO_BUILD_PROP_VALUE_MAX 92
|
||||
|
||||
struct cpuinfo_android_properties {
|
||||
char proc_cpuinfo_hardware[CPUINFO_HARDWARE_VALUE_MAX];
|
||||
char ro_product_board[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
char ro_board_platform[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
char ro_mediatek_platform[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
char ro_arch[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
char ro_chipname[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
char ro_hardware_chipname[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
};
|
||||
struct cpuinfo_android_properties {
|
||||
char proc_cpuinfo_hardware[CPUINFO_HARDWARE_VALUE_MAX];
|
||||
char ro_product_board[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
char ro_board_platform[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
char ro_mediatek_platform[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
char ro_arch[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
char ro_chipname[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
char ro_hardware_chipname[CPUINFO_BUILD_PROP_VALUE_MAX];
|
||||
};
|
||||
#endif
|
||||
|
||||
#define CPUINFO_ARM_LINUX_ARCH_T UINT32_C(0x00000001)
|
||||
#define CPUINFO_ARM_LINUX_ARCH_E UINT32_C(0x00000002)
|
||||
#define CPUINFO_ARM_LINUX_ARCH_J UINT32_C(0x00000004)
|
||||
#define CPUINFO_ARM_LINUX_ARCH_T UINT32_C(0x00000001)
|
||||
#define CPUINFO_ARM_LINUX_ARCH_E UINT32_C(0x00000002)
|
||||
#define CPUINFO_ARM_LINUX_ARCH_J UINT32_C(0x00000004)
|
||||
|
||||
#define CPUINFO_ARM_LINUX_ARCH_TE UINT32_C(0x00000003)
|
||||
#define CPUINFO_ARM_LINUX_ARCH_TE UINT32_C(0x00000003)
|
||||
#define CPUINFO_ARM_LINUX_ARCH_TEJ UINT32_C(0x00000007)
|
||||
|
||||
struct cpuinfo_arm_linux_proc_cpuinfo_cache {
|
||||
@@ -49,116 +51,118 @@ struct cpuinfo_arm_linux_proc_cpuinfo_cache {
|
||||
};
|
||||
|
||||
#if CPUINFO_ARCH_ARM
|
||||
/* arch/arm/include/uapi/asm/hwcap.h */
|
||||
/* arch/arm/include/uapi/asm/hwcap.h */
|
||||
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SWP UINT32_C(0x00000001)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_HALF UINT32_C(0x00000002)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_THUMB UINT32_C(0x00000004)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_26BIT UINT32_C(0x00000008)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FASTMULT UINT32_C(0x00000010)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FPA UINT32_C(0x00000020)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_VFP UINT32_C(0x00000040)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_EDSP UINT32_C(0x00000080)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_JAVA UINT32_C(0x00000100)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_IWMMXT UINT32_C(0x00000200)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_CRUNCH UINT32_C(0x00000400)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_THUMBEE UINT32_C(0x00000800)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_NEON UINT32_C(0x00001000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_VFPV3 UINT32_C(0x00002000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_VFPV3D16 UINT32_C(0x00004000) /* Also set for VFPv4 with 16 double-precision registers */
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_TLS UINT32_C(0x00008000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_VFPV4 UINT32_C(0x00010000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_IDIVA UINT32_C(0x00020000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_IDIVT UINT32_C(0x00040000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_IDIV UINT32_C(0x00060000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_VFPD32 UINT32_C(0x00080000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_LPAE UINT32_C(0x00100000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_EVTSTRM UINT32_C(0x00200000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SWP UINT32_C(0x00000001)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_HALF UINT32_C(0x00000002)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_THUMB UINT32_C(0x00000004)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_26BIT UINT32_C(0x00000008)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FASTMULT UINT32_C(0x00000010)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FPA UINT32_C(0x00000020)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_VFP UINT32_C(0x00000040)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_EDSP UINT32_C(0x00000080)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_JAVA UINT32_C(0x00000100)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_IWMMXT UINT32_C(0x00000200)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_CRUNCH UINT32_C(0x00000400)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_THUMBEE UINT32_C(0x00000800)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_NEON UINT32_C(0x00001000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_VFPV3 UINT32_C(0x00002000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_VFPV3D16 \
|
||||
UINT32_C(0x00004000) /* Also set for VFPv4 with 16 double-precision \
|
||||
registers */
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_TLS UINT32_C(0x00008000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_VFPV4 UINT32_C(0x00010000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_IDIVA UINT32_C(0x00020000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_IDIVT UINT32_C(0x00040000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_IDIV UINT32_C(0x00060000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_VFPD32 UINT32_C(0x00080000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_LPAE UINT32_C(0x00100000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_EVTSTRM UINT32_C(0x00200000)
|
||||
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_AES UINT32_C(0x00000001)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_PMULL UINT32_C(0x00000002)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SHA1 UINT32_C(0x00000004)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SHA2 UINT32_C(0x00000008)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_CRC32 UINT32_C(0x00000010)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_AES UINT32_C(0x00000001)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_PMULL UINT32_C(0x00000002)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SHA1 UINT32_C(0x00000004)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SHA2 UINT32_C(0x00000008)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_CRC32 UINT32_C(0x00000010)
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
/* arch/arm64/include/uapi/asm/hwcap.h */
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FP UINT32_C(0x00000001)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ASIMD UINT32_C(0x00000002)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_EVTSTRM UINT32_C(0x00000004)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_AES UINT32_C(0x00000008)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_PMULL UINT32_C(0x00000010)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SHA1 UINT32_C(0x00000020)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SHA2 UINT32_C(0x00000040)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_CRC32 UINT32_C(0x00000080)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ATOMICS UINT32_C(0x00000100)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FPHP UINT32_C(0x00000200)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ASIMDHP UINT32_C(0x00000400)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_CPUID UINT32_C(0x00000800)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ASIMDRDM UINT32_C(0x00001000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_JSCVT UINT32_C(0x00002000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FCMA UINT32_C(0x00004000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_LRCPC UINT32_C(0x00008000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_DCPOP UINT32_C(0x00010000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SHA3 UINT32_C(0x00020000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SM3 UINT32_C(0x00040000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SM4 UINT32_C(0x00080000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ASIMDDP UINT32_C(0x00100000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SHA512 UINT32_C(0x00200000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SVE UINT32_C(0x00400000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ASIMDFHM UINT32_C(0x00800000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_DIT UINT32_C(0x01000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_USCAT UINT32_C(0x02000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ILRCPC UINT32_C(0x04000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FLAGM UINT32_C(0x08000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SSBS UINT32_C(0x10000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SB UINT32_C(0x20000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_PACA UINT32_C(0x40000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_PACG UINT32_C(0x80000000)
|
||||
/* arch/arm64/include/uapi/asm/hwcap.h */
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FP UINT32_C(0x00000001)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ASIMD UINT32_C(0x00000002)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_EVTSTRM UINT32_C(0x00000004)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_AES UINT32_C(0x00000008)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_PMULL UINT32_C(0x00000010)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SHA1 UINT32_C(0x00000020)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SHA2 UINT32_C(0x00000040)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_CRC32 UINT32_C(0x00000080)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ATOMICS UINT32_C(0x00000100)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FPHP UINT32_C(0x00000200)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ASIMDHP UINT32_C(0x00000400)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_CPUID UINT32_C(0x00000800)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ASIMDRDM UINT32_C(0x00001000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_JSCVT UINT32_C(0x00002000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FCMA UINT32_C(0x00004000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_LRCPC UINT32_C(0x00008000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_DCPOP UINT32_C(0x00010000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SHA3 UINT32_C(0x00020000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SM3 UINT32_C(0x00040000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SM4 UINT32_C(0x00080000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ASIMDDP UINT32_C(0x00100000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SHA512 UINT32_C(0x00200000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SVE UINT32_C(0x00400000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ASIMDFHM UINT32_C(0x00800000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_DIT UINT32_C(0x01000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_USCAT UINT32_C(0x02000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_ILRCPC UINT32_C(0x04000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_FLAGM UINT32_C(0x08000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SSBS UINT32_C(0x10000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_SB UINT32_C(0x20000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_PACA UINT32_C(0x40000000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE_PACG UINT32_C(0x80000000)
|
||||
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_DCPODP UINT32_C(0x00000001)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVE2 UINT32_C(0x00000002)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEAES UINT32_C(0x00000004)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEPMULL UINT32_C(0x00000008)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEBITPERM UINT32_C(0x00000010)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVESHA3 UINT32_C(0x00000020)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVESM4 UINT32_C(0x00000040)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_FLAGM2 UINT32_C(0x00000080)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_FRINT UINT32_C(0x00000100)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEI8MM UINT32_C(0x00000200)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEF32MM UINT32_C(0x00000400)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEF64MM UINT32_C(0x00000800)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEBF16 UINT32_C(0x00001000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_I8MM UINT32_C(0x00002000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_BF16 UINT32_C(0x00004000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_DGH UINT32_C(0x00008000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_RNG UINT32_C(0x00010000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_BTI UINT32_C(0x00020000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_DCPODP UINT32_C(0x00000001)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVE2 UINT32_C(0x00000002)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEAES UINT32_C(0x00000004)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEPMULL UINT32_C(0x00000008)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEBITPERM UINT32_C(0x00000010)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVESHA3 UINT32_C(0x00000020)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVESM4 UINT32_C(0x00000040)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_FLAGM2 UINT32_C(0x00000080)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_FRINT UINT32_C(0x00000100)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEI8MM UINT32_C(0x00000200)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEF32MM UINT32_C(0x00000400)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEF64MM UINT32_C(0x00000800)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_SVEBF16 UINT32_C(0x00001000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_I8MM UINT32_C(0x00002000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_BF16 UINT32_C(0x00004000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_DGH UINT32_C(0x00008000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_RNG UINT32_C(0x00010000)
|
||||
#define CPUINFO_ARM_LINUX_FEATURE2_BTI UINT32_C(0x00020000)
|
||||
#endif
|
||||
|
||||
#define CPUINFO_ARM_LINUX_VALID_ARCHITECTURE UINT32_C(0x00010000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_IMPLEMENTER UINT32_C(0x00020000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_VARIANT UINT32_C(0x00040000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_PART UINT32_C(0x00080000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_REVISION UINT32_C(0x00100000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_PROCESSOR UINT32_C(0x00200000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_FEATURES UINT32_C(0x00400000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_IMPLEMENTER UINT32_C(0x00020000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_VARIANT UINT32_C(0x00040000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_PART UINT32_C(0x00080000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_REVISION UINT32_C(0x00100000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_PROCESSOR UINT32_C(0x00200000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_FEATURES UINT32_C(0x00400000)
|
||||
#if CPUINFO_ARCH_ARM
|
||||
#define CPUINFO_ARM_LINUX_VALID_ICACHE_SIZE UINT32_C(0x01000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_ICACHE_SETS UINT32_C(0x02000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_ICACHE_WAYS UINT32_C(0x04000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_ICACHE_LINE UINT32_C(0x08000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_DCACHE_SIZE UINT32_C(0x10000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_DCACHE_SETS UINT32_C(0x20000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_DCACHE_WAYS UINT32_C(0x40000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_DCACHE_LINE UINT32_C(0x80000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_ICACHE_SIZE UINT32_C(0x01000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_ICACHE_SETS UINT32_C(0x02000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_ICACHE_WAYS UINT32_C(0x04000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_ICACHE_LINE UINT32_C(0x08000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_DCACHE_SIZE UINT32_C(0x10000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_DCACHE_SETS UINT32_C(0x20000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_DCACHE_WAYS UINT32_C(0x40000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_DCACHE_LINE UINT32_C(0x80000000)
|
||||
#endif
|
||||
|
||||
#define CPUINFO_ARM_LINUX_VALID_INFO UINT32_C(0x007F0000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_MIDR UINT32_C(0x003F0000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_INFO UINT32_C(0x007F0000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_MIDR UINT32_C(0x003F0000)
|
||||
#if CPUINFO_ARCH_ARM
|
||||
#define CPUINFO_ARM_LINUX_VALID_ICACHE UINT32_C(0x0F000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_DCACHE UINT32_C(0xF0000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_CACHE_LINE UINT32_C(0x88000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_ICACHE UINT32_C(0x0F000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_DCACHE UINT32_C(0xF0000000)
|
||||
#define CPUINFO_ARM_LINUX_VALID_CACHE_LINE UINT32_C(0x88000000)
|
||||
#endif
|
||||
|
||||
struct cpuinfo_arm_linux_processor {
|
||||
@@ -178,13 +182,15 @@ struct cpuinfo_arm_linux_processor {
|
||||
uint32_t uarch_index;
|
||||
/**
|
||||
* ID of the physical package which includes this logical processor.
|
||||
* The value is parsed from /sys/devices/system/cpu/cpu<N>/topology/physical_package_id
|
||||
* The value is parsed from
|
||||
* /sys/devices/system/cpu/cpu<N>/topology/physical_package_id
|
||||
*/
|
||||
uint32_t package_id;
|
||||
/**
|
||||
* Minimum processor ID on the package 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.
|
||||
* Minimum processor ID on the package 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 package_leader_id;
|
||||
/**
|
||||
@@ -193,14 +199,16 @@ struct cpuinfo_arm_linux_processor {
|
||||
uint32_t package_processor_count;
|
||||
/**
|
||||
* Maximum frequency, in kHZ.
|
||||
* The value is parsed from /sys/devices/system/cpu/cpu<N>/cpufreq/cpuinfo_max_freq
|
||||
* If failed to read or parse the file, the value is 0.
|
||||
* The value is parsed from
|
||||
* /sys/devices/system/cpu/cpu<N>/cpufreq/cpuinfo_max_freq If failed to
|
||||
* read or parse the file, the value is 0.
|
||||
*/
|
||||
uint32_t max_frequency;
|
||||
/**
|
||||
* Minimum frequency, in kHZ.
|
||||
* The value is parsed from /sys/devices/system/cpu/cpu<N>/cpufreq/cpuinfo_min_freq
|
||||
* If failed to read or parse the file, the value is 0.
|
||||
* The value is parsed from
|
||||
* /sys/devices/system/cpu/cpu<N>/cpufreq/cpuinfo_min_freq If failed to
|
||||
* read or parse the file, the value is 0.
|
||||
*/
|
||||
uint32_t min_frequency;
|
||||
/** Linux processor ID */
|
||||
@@ -216,8 +224,7 @@ struct cpuinfo_arm_linux_cluster {
|
||||
/* Returns true if the two processors do belong to the same cluster */
|
||||
static inline bool cpuinfo_arm_linux_processor_equals(
|
||||
struct cpuinfo_arm_linux_processor processor_i[restrict static 1],
|
||||
struct cpuinfo_arm_linux_processor processor_j[restrict static 1])
|
||||
{
|
||||
struct cpuinfo_arm_linux_processor processor_j[restrict static 1]) {
|
||||
const uint32_t joint_flags = processor_i->flags & processor_j->flags;
|
||||
|
||||
bool same_max_frequency = false;
|
||||
@@ -251,11 +258,11 @@ static inline bool cpuinfo_arm_linux_processor_equals(
|
||||
return same_max_frequency && same_min_frequency;
|
||||
}
|
||||
|
||||
/* Returns true if the two processors certainly don't belong to the same cluster */
|
||||
/* Returns true if the two processors certainly don't belong to the same cluster
|
||||
*/
|
||||
static inline bool cpuinfo_arm_linux_processor_not_equals(
|
||||
struct cpuinfo_arm_linux_processor processor_i[restrict static 1],
|
||||
struct cpuinfo_arm_linux_processor processor_j[restrict static 1])
|
||||
{
|
||||
struct cpuinfo_arm_linux_processor processor_j[restrict static 1]) {
|
||||
const uint32_t joint_flags = processor_i->flags & processor_j->flags;
|
||||
|
||||
if (joint_flags & CPUINFO_LINUX_FLAG_MAX_FREQUENCY) {
|
||||
@@ -286,79 +293,73 @@ CPUINFO_INTERNAL bool cpuinfo_arm_linux_parse_proc_cpuinfo(
|
||||
struct cpuinfo_arm_linux_processor processors[restrict static max_processors_count]);
|
||||
|
||||
#if CPUINFO_ARCH_ARM
|
||||
CPUINFO_INTERNAL bool cpuinfo_arm_linux_hwcap_from_getauxval(
|
||||
uint32_t hwcap[restrict static 1],
|
||||
uint32_t hwcap2[restrict static 1]);
|
||||
CPUINFO_INTERNAL bool cpuinfo_arm_linux_hwcap_from_procfs(
|
||||
uint32_t hwcap[restrict static 1],
|
||||
uint32_t hwcap2[restrict static 1]);
|
||||
CPUINFO_INTERNAL bool cpuinfo_arm_linux_hwcap_from_getauxval(
|
||||
uint32_t hwcap[restrict static 1],
|
||||
uint32_t hwcap2[restrict static 1]);
|
||||
CPUINFO_INTERNAL bool cpuinfo_arm_linux_hwcap_from_procfs(
|
||||
uint32_t hwcap[restrict static 1],
|
||||
uint32_t hwcap2[restrict static 1]);
|
||||
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
uint32_t features,
|
||||
uint32_t features2,
|
||||
uint32_t midr,
|
||||
uint32_t architecture_version,
|
||||
uint32_t architecture_flags,
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
struct cpuinfo_arm_isa isa[restrict static 1]);
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
uint32_t features,
|
||||
uint32_t features2,
|
||||
uint32_t midr,
|
||||
uint32_t architecture_version,
|
||||
uint32_t architecture_flags,
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
struct cpuinfo_arm_isa isa[restrict static 1]);
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_linux_hwcap_from_getauxval(
|
||||
uint32_t hwcap[restrict static 1],
|
||||
uint32_t hwcap2[restrict static 1]);
|
||||
CPUINFO_INTERNAL void cpuinfo_arm_linux_hwcap_from_getauxval(
|
||||
uint32_t hwcap[restrict static 1],
|
||||
uint32_t hwcap2[restrict static 1]);
|
||||
|
||||
CPUINFO_INTERNAL void cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
uint32_t features,
|
||||
uint32_t features2,
|
||||
uint32_t midr,
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
struct cpuinfo_arm_isa isa[restrict static 1]);
|
||||
CPUINFO_INTERNAL void cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
uint32_t features,
|
||||
uint32_t features2,
|
||||
uint32_t midr,
|
||||
const struct cpuinfo_arm_chipset chipset[restrict static 1],
|
||||
struct cpuinfo_arm_isa isa[restrict static 1]);
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_android_decode_chipset(
|
||||
const struct cpuinfo_android_properties properties[restrict static 1],
|
||||
uint32_t cores,
|
||||
uint32_t max_cpu_freq_max);
|
||||
#if defined(__ANDROID__)
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset cpuinfo_arm_android_decode_chipset(
|
||||
const struct cpuinfo_android_properties properties[restrict static 1],
|
||||
uint32_t cores,
|
||||
uint32_t max_cpu_freq_max);
|
||||
#else
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_linux_decode_chipset(
|
||||
const char hardware[restrict static CPUINFO_HARDWARE_VALUE_MAX],
|
||||
const char revision[restrict static CPUINFO_REVISION_VALUE_MAX],
|
||||
uint32_t cores,
|
||||
uint32_t max_cpu_freq_max);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset cpuinfo_arm_linux_decode_chipset(
|
||||
const char hardware[restrict static CPUINFO_HARDWARE_VALUE_MAX],
|
||||
const char revision[restrict static CPUINFO_REVISION_VALUE_MAX],
|
||||
uint32_t cores,
|
||||
uint32_t max_cpu_freq_max);
|
||||
#endif
|
||||
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_linux_decode_chipset_from_proc_cpuinfo_hardware(
|
||||
const char proc_cpuinfo_hardware[restrict static CPUINFO_HARDWARE_VALUE_MAX],
|
||||
uint32_t cores, uint32_t max_cpu_freq_max, bool is_tegra);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset cpuinfo_arm_linux_decode_chipset_from_proc_cpuinfo_hardware(
|
||||
const char proc_cpuinfo_hardware[restrict static CPUINFO_HARDWARE_VALUE_MAX],
|
||||
uint32_t cores,
|
||||
uint32_t max_cpu_freq_max,
|
||||
bool is_tegra);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_android_decode_chipset_from_ro_product_board(
|
||||
const char ro_product_board[restrict static CPUINFO_BUILD_PROP_VALUE_MAX],
|
||||
uint32_t cores, uint32_t max_cpu_freq_max);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_android_decode_chipset_from_ro_board_platform(
|
||||
const char ro_board_platform[restrict static CPUINFO_BUILD_PROP_VALUE_MAX],
|
||||
uint32_t cores, uint32_t max_cpu_freq_max);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_android_decode_chipset_from_ro_mediatek_platform(
|
||||
const char ro_mediatek_platform[restrict static CPUINFO_BUILD_PROP_VALUE_MAX]);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_android_decode_chipset_from_ro_arch(
|
||||
const char ro_arch[restrict static CPUINFO_BUILD_PROP_VALUE_MAX]);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_android_decode_chipset_from_ro_chipname(
|
||||
const char ro_chipname[restrict static CPUINFO_BUILD_PROP_VALUE_MAX]);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_android_decode_chipset_from_ro_hardware_chipname(
|
||||
const char ro_hardware_chipname[restrict static CPUINFO_BUILD_PROP_VALUE_MAX]);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset cpuinfo_arm_android_decode_chipset_from_ro_product_board(
|
||||
const char ro_product_board[restrict static CPUINFO_BUILD_PROP_VALUE_MAX],
|
||||
uint32_t cores,
|
||||
uint32_t max_cpu_freq_max);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset cpuinfo_arm_android_decode_chipset_from_ro_board_platform(
|
||||
const char ro_board_platform[restrict static CPUINFO_BUILD_PROP_VALUE_MAX],
|
||||
uint32_t cores,
|
||||
uint32_t max_cpu_freq_max);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset cpuinfo_arm_android_decode_chipset_from_ro_mediatek_platform(
|
||||
const char ro_mediatek_platform[restrict static CPUINFO_BUILD_PROP_VALUE_MAX]);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset cpuinfo_arm_android_decode_chipset_from_ro_arch(
|
||||
const char ro_arch[restrict static CPUINFO_BUILD_PROP_VALUE_MAX]);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset cpuinfo_arm_android_decode_chipset_from_ro_chipname(
|
||||
const char ro_chipname[restrict static CPUINFO_BUILD_PROP_VALUE_MAX]);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset cpuinfo_arm_android_decode_chipset_from_ro_hardware_chipname(
|
||||
const char ro_hardware_chipname[restrict static CPUINFO_BUILD_PROP_VALUE_MAX]);
|
||||
#else
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset
|
||||
cpuinfo_arm_linux_decode_chipset_from_proc_cpuinfo_revision(
|
||||
const char proc_cpuinfo_revision[restrict static CPUINFO_REVISION_VALUE_MAX]);
|
||||
CPUINFO_INTERNAL struct cpuinfo_arm_chipset cpuinfo_arm_linux_decode_chipset_from_proc_cpuinfo_revision(
|
||||
const char proc_cpuinfo_revision[restrict static CPUINFO_REVISION_VALUE_MAX]);
|
||||
#endif
|
||||
|
||||
CPUINFO_INTERNAL bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
|
||||
3329
3rdparty/cpuinfo/src/arm/linux/chipset.c
vendored
3329
3rdparty/cpuinfo/src/arm/linux/chipset.c
vendored
File diff suppressed because it is too large
Load Diff
403
3rdparty/cpuinfo/src/arm/linux/clusters.c
vendored
403
3rdparty/cpuinfo/src/arm/linux/clusters.c
vendored
@@ -1,63 +1,74 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#include <arm/linux/api.h>
|
||||
#include <cpuinfo.h>
|
||||
#if defined(__ANDROID__)
|
||||
#include <arm/android/api.h>
|
||||
#include <arm/android/api.h>
|
||||
#endif
|
||||
#include <arm/api.h>
|
||||
#include <arm/midr.h>
|
||||
#include <linux/api.h>
|
||||
#include <cpuinfo/internal-api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
#include <linux/api.h>
|
||||
|
||||
static inline bool bitmask_all(uint32_t bitfield, uint32_t mask) {
|
||||
return (bitfield & mask) == mask;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assigns logical processors to clusters of cores using heuristic based on the typical configuration of clusters for
|
||||
* 5, 6, 8, and 10 cores:
|
||||
* Assigns logical processors to clusters of cores using heuristic based on the
|
||||
* typical configuration of clusters for 5, 6, 8, and 10 cores:
|
||||
* - 5 cores (ARM32 Android only): 2 clusters of 4+1 cores
|
||||
* - 6 cores: 2 clusters of 4+2 cores
|
||||
* - 8 cores: 2 clusters of 4+4 cores
|
||||
* - 10 cores: 3 clusters of 4+4+2 cores
|
||||
*
|
||||
* The function must be called after parsing OS-provided information on core clusters.
|
||||
* Its purpose is to detect clusters of cores when OS-provided information is lacking or incomplete, i.e.
|
||||
* - Linux kernel is not configured to report information in sysfs topology leaf.
|
||||
* - Linux kernel reports topology information only for online cores, and only cores on one cluster are online, e.g.:
|
||||
* - Exynos 8890 has 8 cores in 4+4 clusters, but only the first cluster of 4 cores is reported, and cluster
|
||||
* configuration of logical processors 4-7 is not reported (all remaining processors 4-7 form cluster 1)
|
||||
* - MT6797 has 10 cores in 4+4+2, but only the first cluster of 4 cores is reported, and cluster configuration
|
||||
* of logical processors 4-9 is not reported (processors 4-7 form cluster 1, and processors 8-9 form cluster 2).
|
||||
* The function must be called after parsing OS-provided information on core
|
||||
* clusters. Its purpose is to detect clusters of cores when OS-provided
|
||||
* information is lacking or incomplete, i.e.
|
||||
* - Linux kernel is not configured to report information in sysfs topology
|
||||
* leaf.
|
||||
* - Linux kernel reports topology information only for online cores, and only
|
||||
* cores on one cluster are online, e.g.:
|
||||
* - Exynos 8890 has 8 cores in 4+4 clusters, but only the first cluster of 4
|
||||
* cores is reported, and cluster configuration of logical processors 4-7 is not
|
||||
* reported (all remaining processors 4-7 form cluster 1)
|
||||
* - MT6797 has 10 cores in 4+4+2, but only the first cluster of 4 cores is
|
||||
* reported, and cluster configuration of logical processors 4-9 is not reported
|
||||
* (processors 4-7 form cluster 1, and processors 8-9 form cluster 2).
|
||||
*
|
||||
* Heuristic assignment of processors to the above pre-defined clusters fails if such assignment would contradict
|
||||
* information provided by the operating system:
|
||||
* - Any of the OS-reported processor clusters is different than the corresponding heuristic cluster.
|
||||
* - Processors in a heuristic cluster have no OS-provided cluster siblings information, but have known and different
|
||||
* minimum/maximum frequency.
|
||||
* - Processors in a heuristic cluster have no OS-provided cluster siblings information, but have known and different
|
||||
* MIDR components.
|
||||
* Heuristic assignment of processors to the above pre-defined clusters fails if
|
||||
* such assignment would contradict information provided by the operating
|
||||
* system:
|
||||
* - Any of the OS-reported processor clusters is different than the
|
||||
* corresponding heuristic cluster.
|
||||
* - Processors in a heuristic cluster have no OS-provided cluster siblings
|
||||
* information, but have known and different minimum/maximum frequency.
|
||||
* - Processors in a heuristic cluster have no OS-provided cluster siblings
|
||||
* information, but have known and different MIDR components.
|
||||
*
|
||||
* If the heuristic assignment of processors to clusters of cores fails, all processors' clusters are unchanged.
|
||||
* If the heuristic assignment of processors to clusters of cores fails, all
|
||||
* processors' clusters are unchanged.
|
||||
*
|
||||
* @param usable_processors - number of processors in the @p processors array with CPUINFO_LINUX_FLAG_VALID flags.
|
||||
* @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.
|
||||
* @param[in,out] processors - processor descriptors with pre-parsed POSSIBLE
|
||||
* and PRESENT flags, minimum/maximum 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.
|
||||
* @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.
|
||||
*/
|
||||
bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
uint32_t usable_processors,
|
||||
uint32_t max_processors,
|
||||
struct cpuinfo_arm_linux_processor processors[restrict static max_processors])
|
||||
{
|
||||
struct cpuinfo_arm_linux_processor processors[restrict static max_processors]) {
|
||||
uint32_t cluster_processors[3];
|
||||
switch (usable_processors) {
|
||||
case 10:
|
||||
@@ -76,8 +87,9 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
#if defined(__ANDROID__) && CPUINFO_ARCH_ARM
|
||||
case 5:
|
||||
/*
|
||||
* The only processor with 5 cores is Leadcore L1860C (ARMv7, mobile),
|
||||
* but this configuration is not too unreasonable for a virtualized ARM server.
|
||||
* The only processor with 5 cores is Leadcore L1860C
|
||||
* (ARMv7, mobile), but this configuration is not too
|
||||
* unreasonable for a virtualized ARM server.
|
||||
*/
|
||||
cluster_processors[0] = 4;
|
||||
cluster_processors[1] = 1;
|
||||
@@ -89,7 +101,8 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
|
||||
/*
|
||||
* Assignment of processors to core clusters is done in two passes:
|
||||
* 1. Verify that the clusters proposed by heuristic are compatible with known details about processors.
|
||||
* 1. Verify that the clusters proposed by heuristic are compatible with
|
||||
* known details about processors.
|
||||
* 2. If verification passed, update core clusters for the processors.
|
||||
*/
|
||||
|
||||
@@ -100,16 +113,22 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
for (uint32_t i = 0; i < max_processors; i++) {
|
||||
if (bitmask_all(processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
if (expected_cluster_processors == 0) {
|
||||
/* Expect this processor to start a new cluster */
|
||||
/* Expect this processor to start a new cluster
|
||||
*/
|
||||
|
||||
expected_cluster_exists = !!(processors[i].flags & CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER);
|
||||
if (expected_cluster_exists) {
|
||||
if (processors[i].package_leader_id != i) {
|
||||
cpuinfo_log_debug(
|
||||
"heuristic detection of core clusters failed: "
|
||||
"processor %"PRIu32" is expected to start a new cluster #%"PRIu32" with %"PRIu32" cores, "
|
||||
"but system siblings lists reported it as a sibling of processor %"PRIu32,
|
||||
i, cluster, cluster_processors[cluster], processors[i].package_leader_id);
|
||||
"processor %" PRIu32
|
||||
" is expected to start a new cluster #%" PRIu32 " with %" PRIu32
|
||||
" cores, "
|
||||
"but system siblings lists reported it as a sibling of processor %" PRIu32,
|
||||
i,
|
||||
cluster,
|
||||
cluster_processors[cluster],
|
||||
processors[i].package_leader_id);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -119,48 +138,73 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
cluster_start = i;
|
||||
expected_cluster_processors = cluster_processors[cluster++];
|
||||
} else {
|
||||
/* Expect this processor to belong to the same cluster as processor */
|
||||
/* Expect this processor to belong to the same
|
||||
* cluster as processor */
|
||||
|
||||
if (expected_cluster_exists) {
|
||||
/*
|
||||
* The cluster suggested by the heuristic was already parsed from system siblings lists.
|
||||
* For all processors we expect in the cluster, check that:
|
||||
* - They have pre-assigned cluster from siblings lists (CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER flag).
|
||||
* - They were assigned to the same cluster based on siblings lists
|
||||
* (package_leader_id points to the first processor in the cluster).
|
||||
* The cluster suggested by the
|
||||
* heuristic was already parsed from
|
||||
* system siblings lists. For all
|
||||
* processors we expect in the cluster,
|
||||
* check that:
|
||||
* - They have pre-assigned cluster from
|
||||
* siblings lists
|
||||
* (CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER
|
||||
* flag).
|
||||
* - They were assigned to the same
|
||||
* cluster based on siblings lists
|
||||
* (package_leader_id points to the
|
||||
* first processor in the cluster).
|
||||
*/
|
||||
|
||||
if ((processors[i].flags & CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER) == 0) {
|
||||
cpuinfo_log_debug(
|
||||
"heuristic detection of core clusters failed: "
|
||||
"processor %"PRIu32" is expected to belong to the cluster of processor %"PRIu32", "
|
||||
"but system siblings lists did not report it as a sibling of processor %"PRIu32,
|
||||
i, cluster_start, cluster_start);
|
||||
"processor %" PRIu32
|
||||
" is expected to belong to the cluster of processor %" PRIu32
|
||||
", "
|
||||
"but system siblings lists did not report it as a sibling of processor %" PRIu32,
|
||||
i,
|
||||
cluster_start,
|
||||
cluster_start);
|
||||
return false;
|
||||
}
|
||||
if (processors[i].package_leader_id != cluster_start) {
|
||||
cpuinfo_log_debug(
|
||||
"heuristic detection of core clusters failed: "
|
||||
"processor %"PRIu32" is expected to belong to the cluster of processor %"PRIu32", "
|
||||
"but system siblings lists reported it to belong to the cluster of processor %"PRIu32,
|
||||
i, cluster_start, cluster_start);
|
||||
"processor %" PRIu32
|
||||
" is expected to belong to the cluster of processor %" PRIu32
|
||||
", "
|
||||
"but system siblings lists reported it to belong to the cluster of processor %" PRIu32,
|
||||
i,
|
||||
cluster_start,
|
||||
cluster_start);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* The cluster suggest by the heuristic was not parsed from system siblings lists.
|
||||
* For all processors we expect in the cluster, check that:
|
||||
* - They have no pre-assigned cluster from siblings lists.
|
||||
* - If their min/max CPU frequency is known, it is the same.
|
||||
* - If any part of their MIDR (Implementer, Variant, Part, Revision) is known, it is the same.
|
||||
* The cluster suggest by the heuristic
|
||||
* was not parsed from system siblings
|
||||
* lists. For all processors we expect
|
||||
* in the cluster, check that:
|
||||
* - They have no pre-assigned cluster
|
||||
* from siblings lists.
|
||||
* - If their min/max CPU frequency is
|
||||
* known, it is the same.
|
||||
* - If any part of their MIDR
|
||||
* (Implementer, Variant, Part,
|
||||
* Revision) is known, it is the same.
|
||||
*/
|
||||
|
||||
if (processors[i].flags & CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER) {
|
||||
cpuinfo_log_debug(
|
||||
"heuristic detection of core clusters failed: "
|
||||
"processor %"PRIu32" is expected to be unassigned to any cluster, "
|
||||
"but system siblings lists reported it to belong to the cluster of processor %"PRIu32,
|
||||
i, processors[i].package_leader_id);
|
||||
"processor %" PRIu32
|
||||
" is expected to be unassigned to any cluster, "
|
||||
"but system siblings lists reported it to belong to the cluster of processor %" PRIu32,
|
||||
i,
|
||||
processors[i].package_leader_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -169,8 +213,13 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
if (cluster_min_frequency != processors[i].min_frequency) {
|
||||
cpuinfo_log_debug(
|
||||
"heuristic detection of core clusters failed: "
|
||||
"minimum frequency of processor %"PRIu32" (%"PRIu32" KHz) is different than of its expected cluster (%"PRIu32" KHz)",
|
||||
i, processors[i].min_frequency, cluster_min_frequency);
|
||||
"minimum frequency of processor %" PRIu32
|
||||
" (%" PRIu32
|
||||
" KHz) is different than of its expected cluster (%" PRIu32
|
||||
" KHz)",
|
||||
i,
|
||||
processors[i].min_frequency,
|
||||
cluster_min_frequency);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -184,8 +233,13 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
if (cluster_max_frequency != processors[i].max_frequency) {
|
||||
cpuinfo_log_debug(
|
||||
"heuristic detection of core clusters failed: "
|
||||
"maximum frequency of processor %"PRIu32" (%"PRIu32" KHz) is different than of its expected cluster (%"PRIu32" KHz)",
|
||||
i, processors[i].max_frequency, cluster_max_frequency);
|
||||
"maximum frequency of processor %" PRIu32
|
||||
" (%" PRIu32
|
||||
" KHz) is different than of its expected cluster (%" PRIu32
|
||||
" KHz)",
|
||||
i,
|
||||
processors[i].max_frequency,
|
||||
cluster_max_frequency);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -196,41 +250,61 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
|
||||
if (processors[i].flags & CPUINFO_ARM_LINUX_VALID_IMPLEMENTER) {
|
||||
if (cluster_flags & CPUINFO_ARM_LINUX_VALID_IMPLEMENTER) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_IMPLEMENTER_MASK) != (processors[i].midr & CPUINFO_ARM_MIDR_IMPLEMENTER_MASK)) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_IMPLEMENTER_MASK) !=
|
||||
(processors[i].midr & CPUINFO_ARM_MIDR_IMPLEMENTER_MASK)) {
|
||||
cpuinfo_log_debug(
|
||||
"heuristic detection of core clusters failed: "
|
||||
"CPU Implementer of processor %"PRIu32" (0x%02"PRIx32") is different than of its expected cluster (0x%02"PRIx32")",
|
||||
i, midr_get_implementer(processors[i].midr), midr_get_implementer(cluster_midr));
|
||||
"CPU Implementer of processor %" PRIu32
|
||||
" (0x%02" PRIx32
|
||||
") is different than of its expected cluster (0x%02" PRIx32
|
||||
")",
|
||||
i,
|
||||
midr_get_implementer(processors[i].midr),
|
||||
midr_get_implementer(cluster_midr));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cluster_midr = midr_copy_implementer(cluster_midr, processors[i].midr);
|
||||
cluster_midr =
|
||||
midr_copy_implementer(cluster_midr, processors[i].midr);
|
||||
cluster_flags |= CPUINFO_ARM_LINUX_VALID_IMPLEMENTER;
|
||||
}
|
||||
}
|
||||
|
||||
if (processors[i].flags & CPUINFO_ARM_LINUX_VALID_VARIANT) {
|
||||
if (cluster_flags & CPUINFO_ARM_LINUX_VALID_VARIANT) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_VARIANT_MASK) != (processors[i].midr & CPUINFO_ARM_MIDR_VARIANT_MASK)) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_VARIANT_MASK) !=
|
||||
(processors[i].midr & CPUINFO_ARM_MIDR_VARIANT_MASK)) {
|
||||
cpuinfo_log_debug(
|
||||
"heuristic detection of core clusters failed: "
|
||||
"CPU Variant of processor %"PRIu32" (0x%"PRIx32") is different than of its expected cluster (0x%"PRIx32")",
|
||||
i, midr_get_variant(processors[i].midr), midr_get_variant(cluster_midr));
|
||||
"CPU Variant of processor %" PRIu32
|
||||
" (0x%" PRIx32
|
||||
") is different than of its expected cluster (0x%" PRIx32
|
||||
")",
|
||||
i,
|
||||
midr_get_variant(processors[i].midr),
|
||||
midr_get_variant(cluster_midr));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cluster_midr = midr_copy_variant(cluster_midr, processors[i].midr);
|
||||
cluster_midr =
|
||||
midr_copy_variant(cluster_midr, processors[i].midr);
|
||||
cluster_flags |= CPUINFO_ARM_LINUX_VALID_VARIANT;
|
||||
}
|
||||
}
|
||||
|
||||
if (processors[i].flags & CPUINFO_ARM_LINUX_VALID_PART) {
|
||||
if (cluster_flags & CPUINFO_ARM_LINUX_VALID_PART) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_PART_MASK) != (processors[i].midr & CPUINFO_ARM_MIDR_PART_MASK)) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_PART_MASK) !=
|
||||
(processors[i].midr & CPUINFO_ARM_MIDR_PART_MASK)) {
|
||||
cpuinfo_log_debug(
|
||||
"heuristic detection of core clusters failed: "
|
||||
"CPU Part of processor %"PRIu32" (0x%03"PRIx32") is different than of its expected cluster (0x%03"PRIx32")",
|
||||
i, midr_get_part(processors[i].midr), midr_get_part(cluster_midr));
|
||||
"CPU Part of processor %" PRIu32
|
||||
" (0x%03" PRIx32
|
||||
") is different than of its expected cluster (0x%03" PRIx32
|
||||
")",
|
||||
i,
|
||||
midr_get_part(processors[i].midr),
|
||||
midr_get_part(cluster_midr));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -241,15 +315,22 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
|
||||
if (processors[i].flags & CPUINFO_ARM_LINUX_VALID_REVISION) {
|
||||
if (cluster_flags & CPUINFO_ARM_LINUX_VALID_REVISION) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_REVISION_MASK) != (processors[i].midr & CPUINFO_ARM_MIDR_REVISION_MASK)) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_REVISION_MASK) !=
|
||||
(processors[i].midr & CPUINFO_ARM_MIDR_REVISION_MASK)) {
|
||||
cpuinfo_log_debug(
|
||||
"heuristic detection of core clusters failed: "
|
||||
"CPU Revision of processor %"PRIu32" (0x%"PRIx32") is different than of its expected cluster (0x%"PRIx32")",
|
||||
i, midr_get_revision(cluster_midr), midr_get_revision(processors[i].midr));
|
||||
"CPU Revision of processor %" PRIu32
|
||||
" (0x%" PRIx32
|
||||
") is different than of its expected cluster (0x%" PRIx32
|
||||
")",
|
||||
i,
|
||||
midr_get_revision(cluster_midr),
|
||||
midr_get_revision(processors[i].midr));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cluster_midr = midr_copy_revision(cluster_midr, processors[i].midr);
|
||||
cluster_midr =
|
||||
midr_copy_revision(cluster_midr, processors[i].midr);
|
||||
cluster_flags |= CPUINFO_ARM_LINUX_VALID_REVISION;
|
||||
}
|
||||
}
|
||||
@@ -265,16 +346,21 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
for (uint32_t i = 0; i < max_processors; i++) {
|
||||
if (bitmask_all(processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
if (expected_cluster_processors == 0) {
|
||||
/* Expect this processor to start a new cluster */
|
||||
/* Expect this processor to start a new cluster
|
||||
*/
|
||||
|
||||
cluster_start = i;
|
||||
expected_cluster_processors = cluster_processors[cluster++];
|
||||
} else {
|
||||
/* Expect this processor to belong to the same cluster as processor */
|
||||
/* Expect this processor to belong to the same
|
||||
* cluster as processor */
|
||||
|
||||
if (!(processors[i].flags & CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER)) {
|
||||
cpuinfo_log_debug("assigned processor %"PRIu32" to cluster of processor %"PRIu32" based on heuristic",
|
||||
i, cluster_start);
|
||||
cpuinfo_log_debug(
|
||||
"assigned processor %" PRIu32 " to cluster of processor %" PRIu32
|
||||
" based on heuristic",
|
||||
i,
|
||||
cluster_start);
|
||||
}
|
||||
|
||||
processors[i].package_leader_id = cluster_start;
|
||||
@@ -291,38 +377,49 @@ bool cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
* - Clusters detected from OS-provided information are unchanged:
|
||||
* - 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
|
||||
* processor, the processor is assigned to a newly created cluster.
|
||||
* - 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 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
|
||||
* if heuristic assignment of processors to clusters (cpuinfo_arm_linux_cluster_processors_by_heuristic) failed.
|
||||
* The function must be called after parsing OS-provided information on core
|
||||
* clusters, and usually is called only if heuristic assignment of processors to
|
||||
* clusters (cpuinfo_arm_linux_cluster_processors_by_heuristic) failed.
|
||||
*
|
||||
* Its purpose is to detect clusters of cores when OS-provided information is lacking or incomplete, i.e.
|
||||
* - Linux kernel is not configured to report information in sysfs topology leaf.
|
||||
* - Linux kernel reports topology information only for online cores, and all cores on some of the clusters are offline.
|
||||
* Its purpose is to detect clusters of cores when OS-provided information is
|
||||
* lacking or incomplete, i.e.
|
||||
* - Linux kernel is not configured to report information in sysfs topology
|
||||
* leaf.
|
||||
* - Linux kernel reports topology information only for online cores, and all
|
||||
* cores on some of the clusters are offline.
|
||||
*
|
||||
* Sequential assignment of processors to clusters always succeeds, and upon exit, all usable processors in the
|
||||
* Sequential assignment of processors to clusters always succeeds, and upon
|
||||
* exit, all usable processors in the
|
||||
* @p processors array have cluster information.
|
||||
*
|
||||
* @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.
|
||||
* @param[in,out] processors - processor descriptors with pre-parsed POSSIBLE
|
||||
* and PRESENT flags, minimum/maximum 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.
|
||||
* @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.
|
||||
*/
|
||||
void cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(
|
||||
uint32_t max_processors,
|
||||
struct cpuinfo_arm_linux_processor processors[restrict static max_processors])
|
||||
{
|
||||
struct cpuinfo_arm_linux_processor processors[restrict static max_processors]) {
|
||||
uint32_t cluster_flags = 0;
|
||||
uint32_t cluster_processors = 0;
|
||||
uint32_t cluster_start, cluster_midr, cluster_max_frequency, cluster_min_frequency;
|
||||
for (uint32_t i = 0; i < max_processors; i++) {
|
||||
if ((processors[i].flags & (CPUINFO_LINUX_FLAG_VALID | CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER)) == CPUINFO_LINUX_FLAG_VALID) {
|
||||
if ((processors[i].flags & (CPUINFO_LINUX_FLAG_VALID | CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER)) ==
|
||||
CPUINFO_LINUX_FLAG_VALID) {
|
||||
if (cluster_processors == 0) {
|
||||
goto new_cluster;
|
||||
}
|
||||
@@ -331,9 +428,14 @@ 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); "
|
||||
"processor %"PRIu32" starts to a new cluster",
|
||||
i, processors[i].min_frequency, cluster_min_frequency, i);
|
||||
"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;
|
||||
}
|
||||
} else {
|
||||
@@ -346,9 +448,14 @@ 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); "
|
||||
"processor %"PRIu32" starts a new cluster",
|
||||
i, processors[i].max_frequency, cluster_max_frequency, i);
|
||||
"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;
|
||||
}
|
||||
} else {
|
||||
@@ -359,11 +466,17 @@ void cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(
|
||||
|
||||
if (processors[i].flags & CPUINFO_ARM_LINUX_VALID_IMPLEMENTER) {
|
||||
if (cluster_flags & CPUINFO_ARM_LINUX_VALID_IMPLEMENTER) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_IMPLEMENTER_MASK) != (processors[i].midr & CPUINFO_ARM_MIDR_IMPLEMENTER_MASK)) {
|
||||
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"); "
|
||||
"processor %"PRIu32" starts to a new cluster",
|
||||
i, midr_get_implementer(processors[i].midr), midr_get_implementer(cluster_midr), i);
|
||||
"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;
|
||||
}
|
||||
} else {
|
||||
@@ -374,11 +487,17 @@ void cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(
|
||||
|
||||
if (processors[i].flags & CPUINFO_ARM_LINUX_VALID_VARIANT) {
|
||||
if (cluster_flags & CPUINFO_ARM_LINUX_VALID_VARIANT) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_VARIANT_MASK) != (processors[i].midr & CPUINFO_ARM_MIDR_VARIANT_MASK)) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_VARIANT_MASK) !=
|
||||
(processors[i].midr & CPUINFO_ARM_MIDR_VARIANT_MASK)) {
|
||||
cpuinfo_log_debug(
|
||||
"CPU Variant of processor %"PRIu32" (0x%"PRIx32") is different than of its expected cluster (0x%"PRIx32")"
|
||||
"processor %"PRIu32" starts to a new cluster",
|
||||
i, midr_get_variant(processors[i].midr), midr_get_variant(cluster_midr), i);
|
||||
"CPU Variant of processor %" PRIu32 " (0x%" PRIx32
|
||||
") is different than of its expected cluster (0x%" PRIx32
|
||||
")"
|
||||
"processor %" PRIu32 " starts to a new cluster",
|
||||
i,
|
||||
midr_get_variant(processors[i].midr),
|
||||
midr_get_variant(cluster_midr),
|
||||
i);
|
||||
goto new_cluster;
|
||||
}
|
||||
} else {
|
||||
@@ -389,11 +508,17 @@ void cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(
|
||||
|
||||
if (processors[i].flags & CPUINFO_ARM_LINUX_VALID_PART) {
|
||||
if (cluster_flags & CPUINFO_ARM_LINUX_VALID_PART) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_PART_MASK) != (processors[i].midr & CPUINFO_ARM_MIDR_PART_MASK)) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_PART_MASK) !=
|
||||
(processors[i].midr & CPUINFO_ARM_MIDR_PART_MASK)) {
|
||||
cpuinfo_log_debug(
|
||||
"CPU Part of processor %"PRIu32" (0x%03"PRIx32") is different than of its expected cluster (0x%03"PRIx32")"
|
||||
"processor %"PRIu32" starts to a new cluster",
|
||||
i, midr_get_part(processors[i].midr), midr_get_part(cluster_midr), i);
|
||||
"CPU Part of processor %" PRIu32 " (0x%03" PRIx32
|
||||
") is different than of its expected cluster (0x%03" PRIx32
|
||||
")"
|
||||
"processor %" PRIu32 " starts to a new cluster",
|
||||
i,
|
||||
midr_get_part(processors[i].midr),
|
||||
midr_get_part(cluster_midr),
|
||||
i);
|
||||
goto new_cluster;
|
||||
}
|
||||
} else {
|
||||
@@ -404,11 +529,17 @@ void cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(
|
||||
|
||||
if (processors[i].flags & CPUINFO_ARM_LINUX_VALID_REVISION) {
|
||||
if (cluster_flags & CPUINFO_ARM_LINUX_VALID_REVISION) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_REVISION_MASK) != (processors[i].midr & CPUINFO_ARM_MIDR_REVISION_MASK)) {
|
||||
if ((cluster_midr & CPUINFO_ARM_MIDR_REVISION_MASK) !=
|
||||
(processors[i].midr & CPUINFO_ARM_MIDR_REVISION_MASK)) {
|
||||
cpuinfo_log_debug(
|
||||
"CPU Revision of processor %"PRIu32" (0x%"PRIx32") is different than of its expected cluster (0x%"PRIx32")"
|
||||
"processor %"PRIu32" starts to a new cluster",
|
||||
i, midr_get_revision(cluster_midr), midr_get_revision(processors[i].midr), i);
|
||||
"CPU Revision of processor %" PRIu32 " (0x%" PRIx32
|
||||
") is different than of its expected cluster (0x%" PRIx32
|
||||
")"
|
||||
"processor %" PRIu32 " starts to a new cluster",
|
||||
i,
|
||||
midr_get_revision(cluster_midr),
|
||||
midr_get_revision(processors[i].midr),
|
||||
i);
|
||||
goto new_cluster;
|
||||
}
|
||||
} else {
|
||||
@@ -417,21 +548,26 @@ 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:
|
||||
new_cluster:
|
||||
/* Create a new cluster starting with processor i */
|
||||
cluster_start = i;
|
||||
processors[i].package_leader_id = i;
|
||||
processors[i].flags |= CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER;
|
||||
cluster_processors = 1;
|
||||
|
||||
/* Copy known information from processor to cluster, and set the flags accordingly */
|
||||
/* Copy known information from processor to cluster, and
|
||||
* set the flags accordingly */
|
||||
cluster_flags = 0;
|
||||
if (processors[i].flags & CPUINFO_LINUX_FLAG_MIN_FREQUENCY) {
|
||||
cluster_min_frequency = processors[i].min_frequency;
|
||||
@@ -463,27 +599,30 @@ new_cluster:
|
||||
|
||||
/*
|
||||
* Counts the number of logical processors in each core cluster.
|
||||
* This function should be called after all processors are assigned to core clusters.
|
||||
* This function should be called after all processors are assigned to core
|
||||
* clusters.
|
||||
*
|
||||
* @param max_processors - number of elements in the @p processors array.
|
||||
* @param[in,out] processors - processor descriptors with pre-parsed POSSIBLE and PRESENT flags,
|
||||
* and decoded core cluster (package_leader_id) information.
|
||||
* The function expects the value of processors[i].package_processor_count to be zero.
|
||||
* Upon return, processors[i].package_processor_count will contain the number of logical
|
||||
* @param[in,out] processors - processor descriptors with pre-parsed POSSIBLE
|
||||
* and PRESENT flags, and decoded core cluster (package_leader_id) information.
|
||||
* The function expects the value of
|
||||
* processors[i].package_processor_count to be zero. Upon return,
|
||||
* processors[i].package_processor_count will contain the number of logical
|
||||
* processors in the respective core cluster.
|
||||
*/
|
||||
void cpuinfo_arm_linux_count_cluster_processors(
|
||||
uint32_t max_processors,
|
||||
struct cpuinfo_arm_linux_processor processors[restrict static max_processors])
|
||||
{
|
||||
/* First pass: accumulate the number of processors at the group leader's package_processor_count */
|
||||
struct cpuinfo_arm_linux_processor processors[restrict static max_processors]) {
|
||||
/* First pass: accumulate the number of processors at the group leader's
|
||||
* package_processor_count */
|
||||
for (uint32_t i = 0; i < max_processors; i++) {
|
||||
if (bitmask_all(processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
const uint32_t package_leader_id = processors[i].package_leader_id;
|
||||
processors[package_leader_id].package_processor_count += 1;
|
||||
}
|
||||
}
|
||||
/* Second pass: copy the package_processor_count from the group leader processor */
|
||||
/* Second pass: copy the package_processor_count from the group leader
|
||||
* processor */
|
||||
for (uint32_t i = 0; i < max_processors; i++) {
|
||||
if (bitmask_all(processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
const uint32_t package_leader_id = processors[i].package_leader_id;
|
||||
|
||||
75
3rdparty/cpuinfo/src/arm/linux/cp.h
vendored
75
3rdparty/cpuinfo/src/arm/linux/cp.h
vendored
@@ -1,44 +1,49 @@
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
extern uint32_t cpuinfo_arm_fpsid;
|
||||
extern uint32_t cpuinfo_arm_mvfr0;
|
||||
extern uint32_t cpuinfo_arm_wcid;
|
||||
extern uint32_t cpuinfo_arm_fpsid;
|
||||
extern uint32_t cpuinfo_arm_mvfr0;
|
||||
extern uint32_t cpuinfo_arm_wcid;
|
||||
|
||||
static inline uint32_t read_fpsid(void) {
|
||||
return cpuinfo_arm_fpsid;
|
||||
}
|
||||
static inline uint32_t read_fpsid(void) {
|
||||
return cpuinfo_arm_fpsid;
|
||||
}
|
||||
|
||||
static inline uint32_t read_mvfr0(void) {
|
||||
return cpuinfo_arm_mvfr0;
|
||||
}
|
||||
static inline uint32_t read_mvfr0(void) {
|
||||
return cpuinfo_arm_mvfr0;
|
||||
}
|
||||
|
||||
static inline uint32_t read_wcid(void) {
|
||||
return cpuinfo_arm_wcid;
|
||||
}
|
||||
static inline uint32_t read_wcid(void) {
|
||||
return cpuinfo_arm_wcid;
|
||||
}
|
||||
#else
|
||||
#if !defined(__ARM_ARCH_7A__) && !defined(__ARM_ARCH_8A__) && !(defined(__ARM_ARCH) && (__ARM_ARCH >= 7))
|
||||
/*
|
||||
* CoProcessor 10 is inaccessible from user mode since ARMv7,
|
||||
* and clang refuses to compile inline assembly when targeting ARMv7+
|
||||
*/
|
||||
static inline uint32_t read_fpsid(void) {
|
||||
uint32_t fpsid;
|
||||
__asm__ __volatile__("MRC p10, 0x7, %[fpsid], cr0, cr0, 0" : [fpsid] "=r" (fpsid));
|
||||
return fpsid;
|
||||
}
|
||||
#if !defined(__ARM_ARCH_7A__) && !defined(__ARM_ARCH_8A__) && !(defined(__ARM_ARCH) && (__ARM_ARCH >= 7))
|
||||
/*
|
||||
* CoProcessor 10 is inaccessible from user mode since ARMv7,
|
||||
* and clang refuses to compile inline assembly when targeting ARMv7+
|
||||
*/
|
||||
static inline uint32_t read_fpsid(void) {
|
||||
uint32_t fpsid;
|
||||
__asm__ __volatile__("MRC p10, 0x7, %[fpsid], cr0, cr0, 0" : [fpsid] "=r"(fpsid));
|
||||
return fpsid;
|
||||
}
|
||||
|
||||
static inline uint32_t read_mvfr0(void) {
|
||||
uint32_t mvfr0;
|
||||
__asm__ __volatile__("MRC p10, 0x7, %[mvfr0], cr7, cr0, 0" : [mvfr0] "=r" (mvfr0));
|
||||
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;
|
||||
}
|
||||
static inline uint32_t read_mvfr0(void) {
|
||||
uint32_t mvfr0;
|
||||
__asm__ __volatile__("MRC p10, 0x7, %[mvfr0], cr7, cr0, 0" : [mvfr0] "=r"(mvfr0));
|
||||
return mvfr0;
|
||||
}
|
||||
#endif
|
||||
#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
|
||||
|
||||
599
3rdparty/cpuinfo/src/arm/linux/cpuinfo.c
vendored
599
3rdparty/cpuinfo/src/arm/linux/cpuinfo.c
vendored
@@ -1,26 +1,22 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <linux/api.h>
|
||||
#include <arm/linux/api.h>
|
||||
#include <arm/midr.h>
|
||||
#include <cpuinfo/log.h>
|
||||
#include <linux/api.h>
|
||||
|
||||
/*
|
||||
* Size, in chars, of the on-stack buffer used for parsing lines of /proc/cpuinfo.
|
||||
* This is also the limit on the length of a single line.
|
||||
* Size, in chars, of the on-stack buffer used for parsing lines of
|
||||
* /proc/cpuinfo. This is also the limit on the length of a single line.
|
||||
*/
|
||||
#define BUFFER_SIZE 1024
|
||||
|
||||
|
||||
static uint32_t parse_processor_number(
|
||||
const char* processor_start,
|
||||
const char* processor_end)
|
||||
{
|
||||
const size_t processor_length = (size_t) (processor_end - processor_start);
|
||||
static uint32_t parse_processor_number(const char* processor_start, const char* processor_end) {
|
||||
const size_t processor_length = (size_t)(processor_end - processor_start);
|
||||
|
||||
if (processor_length == 0) {
|
||||
cpuinfo_log_warning("Processor number in /proc/cpuinfo is ignored: string is empty");
|
||||
@@ -29,10 +25,12 @@ static uint32_t parse_processor_number(
|
||||
|
||||
uint32_t processor_number = 0;
|
||||
for (const char* digit_ptr = processor_start; digit_ptr != processor_end; digit_ptr++) {
|
||||
const uint32_t digit = (uint32_t) (*digit_ptr - '0');
|
||||
const uint32_t digit = (uint32_t)(*digit_ptr - '0');
|
||||
if (digit > 10) {
|
||||
cpuinfo_log_warning("non-decimal suffix %.*s in /proc/cpuinfo processor number is ignored",
|
||||
(int) (processor_end - digit_ptr), digit_ptr);
|
||||
cpuinfo_log_warning(
|
||||
"non-decimal suffix %.*s in /proc/cpuinfo processor number is ignored",
|
||||
(int)(processor_end - digit_ptr),
|
||||
digit_ptr);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -45,42 +43,48 @@ static uint32_t parse_processor_number(
|
||||
/*
|
||||
* Full list of ARM features reported in /proc/cpuinfo:
|
||||
*
|
||||
* * swp - support for SWP instruction (deprecated in ARMv7, can be removed in future)
|
||||
* * half - support for half-word loads and stores. These instruction are part of ARMv4,
|
||||
* so no need to check it on supported CPUs.
|
||||
* * thumb - support for 16-bit Thumb instruction set. Note that BX instruction is detected
|
||||
* by ARMv4T architecture, not by this flag.
|
||||
* * 26bit - old CPUs merged 26-bit PC and program status register (flags) into 32-bit PC
|
||||
* and had special instructions for working with packed PC. Now it is all deprecated.
|
||||
* * fastmult - most old ARM CPUs could only compute 2 bits of multiplication result per clock
|
||||
* cycle, but CPUs with M suffix (e.g. ARM7TDMI) could compute 4 bits per cycle.
|
||||
* Of course, now it makes no sense.
|
||||
* * fpa - floating point accelerator available. On original ARM ABI all floating-point operations
|
||||
* generated FPA instructions. If FPA was not available, these instructions generated
|
||||
* "illegal operation" interrupts, and the OS processed them by emulating the FPA instructions.
|
||||
* Debian used this ABI before it switched to EABI. Now FPA is deprecated.
|
||||
* * vfp - vector floating point instructions. Available on most modern CPUs (as part of VFPv3).
|
||||
* Required by Android ARMv7A ABI and by Ubuntu on ARM.
|
||||
* * swp - support for SWP instruction (deprecated in ARMv7, can be removed
|
||||
*in future)
|
||||
* * half - support for half-word loads and stores. These instruction are
|
||||
*part of ARMv4, so no need to check it on supported CPUs.
|
||||
* * thumb - support for 16-bit Thumb instruction set. Note that BX
|
||||
*instruction is detected by ARMv4T architecture, not by this flag.
|
||||
* * 26bit - old CPUs merged 26-bit PC and program status register (flags)
|
||||
*into 32-bit PC and had special instructions for working with packed PC. Now it
|
||||
*is all deprecated.
|
||||
* * fastmult - most old ARM CPUs could only compute 2 bits of
|
||||
*multiplication result per clock cycle, but CPUs with M suffix (e.g. ARM7TDMI)
|
||||
*could compute 4 bits per cycle. Of course, now it makes no sense.
|
||||
* * fpa - floating point accelerator available. On original ARM ABI all
|
||||
*floating-point operations generated FPA instructions. If FPA was not
|
||||
*available, these instructions generated "illegal operation" interrupts, and
|
||||
*the OS processed them by emulating the FPA instructions. Debian used this ABI
|
||||
*before it switched to EABI. Now FPA is deprecated.
|
||||
* * vfp - vector floating point instructions. Available on most modern
|
||||
*CPUs (as part of VFPv3). Required by Android ARMv7A ABI and by Ubuntu on ARM.
|
||||
* Note: there is no flag for VFPv2.
|
||||
* * edsp - V5E instructions: saturating add/sub and 16-bit x 16-bit -> 32/64-bit multiplications.
|
||||
* Required on Android, supported by all CPUs in production.
|
||||
* * edsp - V5E instructions: saturating add/sub and 16-bit x 16-bit ->
|
||||
*32/64-bit multiplications. Required on Android, supported by all CPUs in
|
||||
*production.
|
||||
* * java - Jazelle extension. Supported on most CPUs.
|
||||
* * iwmmxt - Intel/Marvell Wireless MMX instructions. 64-bit integer SIMD.
|
||||
* Supported on XScale (Since PXA270) and Sheeva (PJ1, PJ4) architectures.
|
||||
* Note that there is no flag for WMMX2 instructions.
|
||||
* Supported on XScale (Since PXA270) and Sheeva (PJ1, PJ4)
|
||||
*architectures. Note that there is no flag for WMMX2 instructions.
|
||||
* * crunch - Maverick Crunch instructions. Junk.
|
||||
* * thumbee - ThumbEE instructions. Almost no documentation is available.
|
||||
* * neon - NEON instructions (aka Advanced SIMD). MVFR1 register gives more
|
||||
* fine-grained information on particular supported features, but
|
||||
* the Linux kernel exports only a single flag for all of them.
|
||||
* According to ARMv7A docs it also implies the availability of VFPv3
|
||||
* (with 32 double-precision registers d0-d31).
|
||||
* * vfpv3 - VFPv3 instructions. Available on most modern CPUs. Augment VFPv2 by
|
||||
* conversion to/from integers and load constant instructions.
|
||||
* Required by Android ARMv7A ABI and by Ubuntu on ARM.
|
||||
* * vfpv3d16 - VFPv3 instructions with only 16 double-precision registers (d0-d15).
|
||||
* * neon - NEON instructions (aka Advanced SIMD). MVFR1 register gives
|
||||
*more fine-grained information on particular supported features, but the Linux
|
||||
*kernel exports only a single flag for all of them. According to ARMv7A docs it
|
||||
*also implies the availability of VFPv3 (with 32 double-precision registers
|
||||
*d0-d31).
|
||||
* * vfpv3 - VFPv3 instructions. Available on most modern CPUs. Augment
|
||||
*VFPv2 by conversion to/from integers and load constant instructions. Required
|
||||
*by Android ARMv7A ABI and by Ubuntu on ARM.
|
||||
* * vfpv3d16 - VFPv3 instructions with only 16 double-precision registers
|
||||
*(d0-d15).
|
||||
* * tls - software thread ID registers.
|
||||
* Used by kernel (and likely libc) for efficient implementation of TLS.
|
||||
* Used by kernel (and likely libc) for efficient implementation of
|
||||
*TLS.
|
||||
* * vfpv4 - fused multiply-add instructions.
|
||||
* * idiva - DIV instructions available in ARM mode.
|
||||
* * idivt - DIV instructions available in Thumb mode.
|
||||
@@ -93,15 +97,15 @@ static uint32_t parse_processor_number(
|
||||
* * sha2 - SHA2 instructions.
|
||||
* * crc32 - CRC32 instructions.
|
||||
*
|
||||
* /proc/cpuinfo on ARM is populated in file arch/arm/kernel/setup.c in Linux kernel
|
||||
* Note that some devices may use patched Linux kernels with different feature names.
|
||||
* However, the names above were checked on a large number of /proc/cpuinfo listings.
|
||||
* /proc/cpuinfo on ARM is populated in file arch/arm/kernel/setup.c in
|
||||
*Linux kernel Note that some devices may use patched Linux kernels with
|
||||
*different feature names. However, the names above were checked on a large
|
||||
*number of /proc/cpuinfo listings.
|
||||
*/
|
||||
static void parse_features(
|
||||
const char* features_start,
|
||||
const char* features_end,
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1])
|
||||
{
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1]) {
|
||||
const char* feature_start = features_start;
|
||||
const char* feature_end;
|
||||
|
||||
@@ -115,7 +119,7 @@ static void parse_features(
|
||||
break;
|
||||
}
|
||||
}
|
||||
const size_t feature_length = (size_t) (feature_end - feature_start);
|
||||
const size_t feature_length = (size_t)(feature_end - feature_start);
|
||||
|
||||
switch (feature_length) {
|
||||
case 2:
|
||||
@@ -126,8 +130,9 @@ static void parse_features(
|
||||
#if CPUINFO_ARCH_ARM
|
||||
} else if (memcmp(feature_start, "wp", feature_length) == 0) {
|
||||
/*
|
||||
* Some AArch64 kernels, including the one on Nexus 5X,
|
||||
* erroneously report "swp" as "wp" to AArch32 programs
|
||||
* Some AArch64 kernels, including the
|
||||
* one on Nexus 5X, erroneously report
|
||||
* "swp" as "wp" to AArch32 programs
|
||||
*/
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_SWP;
|
||||
#endif
|
||||
@@ -137,11 +142,11 @@ static void parse_features(
|
||||
break;
|
||||
case 3:
|
||||
if (memcmp(feature_start, "aes", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_AES;
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_AES;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_AES;
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_AES;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
} else if (memcmp(feature_start, "swp", feature_length) == 0) {
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_SWP;
|
||||
@@ -158,25 +163,29 @@ static void parse_features(
|
||||
break;
|
||||
case 4:
|
||||
if (memcmp(feature_start, "sha1", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_SHA1;
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_SHA1;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_SHA1;
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_SHA1;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "sha2", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_SHA2;
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_SHA2;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_SHA2;
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_SHA2;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "fphp", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_FPHP;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_FPHP;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "fcma", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_FCMA;
|
||||
#endif
|
||||
#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;
|
||||
@@ -190,8 +199,9 @@ static void parse_features(
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_LPAE;
|
||||
} else if (memcmp(feature_start, "tlsi", feature_length) == 0) {
|
||||
/*
|
||||
* Some AArch64 kernels, including the one on Nexus 5X,
|
||||
* erroneously report "tls" as "tlsi" to AArch32 programs
|
||||
* Some AArch64 kernels, including the
|
||||
* one on Nexus 5X, erroneously report
|
||||
* "tls" as "tlsi" to AArch32 programs
|
||||
*/
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_TLS;
|
||||
#endif /* CPUINFO_ARCH_ARM */
|
||||
@@ -201,33 +211,33 @@ static void parse_features(
|
||||
break;
|
||||
case 5:
|
||||
if (memcmp(feature_start, "pmull", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_PMULL;
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_PMULL;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_PMULL;
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_PMULL;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "crc32", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_CRC32;
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_CRC32;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
processor->features2 |= CPUINFO_ARM_LINUX_FEATURE2_CRC32;
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_CRC32;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "asimd", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_ASIMD;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_ASIMD;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "cpuid", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_CPUID;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_CPUID;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "jscvt", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_JSCVT;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_JSCVT;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "lrcpc", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_LRCPC;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_LRCPC;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
} else if (memcmp(feature_start, "thumb", feature_length) == 0) {
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_THUMB;
|
||||
@@ -245,7 +255,7 @@ static void parse_features(
|
||||
} else {
|
||||
goto unexpected;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
#if CPUINFO_ARCH_ARM
|
||||
case 6:
|
||||
if (memcmp(feature_start, "iwmmxt", feature_length) == 0) {
|
||||
@@ -263,13 +273,13 @@ static void parse_features(
|
||||
if (memcmp(feature_start, "evtstrm", feature_length) == 0) {
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_EVTSTRM;
|
||||
} else if (memcmp(feature_start, "atomics", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_ATOMICS;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_ATOMICS;
|
||||
#endif
|
||||
} else if (memcmp(feature_start, "asimdhp", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_ASIMDHP;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_ASIMDHP;
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
} else if (memcmp(feature_start, "thumbee", feature_length) == 0) {
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_THUMBEE;
|
||||
@@ -280,9 +290,13 @@ static void parse_features(
|
||||
break;
|
||||
case 8:
|
||||
if (memcmp(feature_start, "asimdrdm", feature_length) == 0) {
|
||||
#if CPUINFO_ARCH_ARM64
|
||||
processor->features |= CPUINFO_ARM_LINUX_FEATURE_ASIMDRDM;
|
||||
#endif
|
||||
#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;
|
||||
@@ -295,8 +309,10 @@ static void parse_features(
|
||||
break;
|
||||
default:
|
||||
unexpected:
|
||||
cpuinfo_log_warning("unexpected /proc/cpuinfo feature \"%.*s\" is ignored",
|
||||
(int) feature_length, feature_start);
|
||||
cpuinfo_log_warning(
|
||||
"unexpected /proc/cpuinfo feature \"%.*s\" is ignored",
|
||||
(int)feature_length,
|
||||
feature_start);
|
||||
break;
|
||||
}
|
||||
feature_start = feature_end;
|
||||
@@ -311,10 +327,10 @@ static void parse_features(
|
||||
static void parse_cpu_architecture(
|
||||
const char* cpu_architecture_start,
|
||||
const char* cpu_architecture_end,
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1])
|
||||
{
|
||||
const size_t cpu_architecture_length = (size_t) (cpu_architecture_end - cpu_architecture_start);
|
||||
/* Early AArch64 kernels report "CPU architecture: AArch64" instead of a numeric value 8 */
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1]) {
|
||||
const size_t cpu_architecture_length = (size_t)(cpu_architecture_end - cpu_architecture_start);
|
||||
/* Early AArch64 kernels report "CPU architecture: AArch64" instead of a
|
||||
* numeric value 8 */
|
||||
if (cpu_architecture_length == 7) {
|
||||
if (memcmp(cpu_architecture_start, "AArch64", cpu_architecture_length) == 0) {
|
||||
processor->midr = midr_set_architecture(processor->midr, UINT32_C(0xF));
|
||||
@@ -324,7 +340,6 @@ static void parse_cpu_architecture(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t architecture = 0;
|
||||
const char* cpu_architecture_ptr = cpu_architecture_start;
|
||||
for (; cpu_architecture_ptr != cpu_architecture_end; cpu_architecture_ptr++) {
|
||||
@@ -339,8 +354,10 @@ static void parse_cpu_architecture(
|
||||
}
|
||||
|
||||
if (cpu_architecture_ptr == cpu_architecture_start) {
|
||||
cpuinfo_log_warning("CPU architecture %.*s in /proc/cpuinfo is ignored due to non-digit at the beginning of the string",
|
||||
(int) cpu_architecture_length, cpu_architecture_start);
|
||||
cpuinfo_log_warning(
|
||||
"CPU architecture %.*s in /proc/cpuinfo is ignored due to non-digit at the beginning of the string",
|
||||
(int)cpu_architecture_length,
|
||||
cpu_architecture_start);
|
||||
} else {
|
||||
if (architecture != 0) {
|
||||
processor->architecture_version = architecture;
|
||||
@@ -362,17 +379,22 @@ static void parse_cpu_architecture(
|
||||
#endif /* CPUINFO_ARCH_ARM */
|
||||
case ' ':
|
||||
case '\t':
|
||||
/* Ignore whitespace at the end */
|
||||
/* Ignore whitespace at the end
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_warning("skipped unknown architectural feature '%c' for ARMv%"PRIu32,
|
||||
feature, architecture);
|
||||
cpuinfo_log_warning(
|
||||
"skipped unknown architectural feature '%c' for ARMv%" PRIu32,
|
||||
feature,
|
||||
architecture);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cpuinfo_log_warning("CPU architecture %.*s in /proc/cpuinfo is ignored due to invalid value (0)",
|
||||
(int) cpu_architecture_length, cpu_architecture_start);
|
||||
cpuinfo_log_warning(
|
||||
"CPU architecture %.*s in /proc/cpuinfo is ignored due to invalid value (0)",
|
||||
(int)cpu_architecture_length,
|
||||
cpu_architecture_start);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,9 +405,12 @@ static void parse_cpu_architecture(
|
||||
midr_architecture = UINT32_C(0x7); /* ARMv6 */
|
||||
break;
|
||||
case 5:
|
||||
if ((processor->architecture_flags & CPUINFO_ARM_LINUX_ARCH_TEJ) == CPUINFO_ARM_LINUX_ARCH_TEJ) {
|
||||
if ((processor->architecture_flags & CPUINFO_ARM_LINUX_ARCH_TEJ) ==
|
||||
CPUINFO_ARM_LINUX_ARCH_TEJ) {
|
||||
midr_architecture = UINT32_C(0x6); /* ARMv5TEJ */
|
||||
} else if ((processor->architecture_flags & CPUINFO_ARM_LINUX_ARCH_TE) == CPUINFO_ARM_LINUX_ARCH_TE) {
|
||||
} else if (
|
||||
(processor->architecture_flags & CPUINFO_ARM_LINUX_ARCH_TE) ==
|
||||
CPUINFO_ARM_LINUX_ARCH_TE) {
|
||||
midr_architecture = UINT32_C(0x5); /* ARMv5TE */
|
||||
} else {
|
||||
midr_architecture = UINT32_C(0x4); /* ARMv5T */
|
||||
@@ -399,9 +424,8 @@ static void parse_cpu_architecture(
|
||||
static void parse_cpu_part(
|
||||
const char* cpu_part_start,
|
||||
const char* cpu_part_end,
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1])
|
||||
{
|
||||
const size_t cpu_part_length = (size_t) (cpu_part_end - cpu_part_start);
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1]) {
|
||||
const size_t cpu_part_length = (size_t)(cpu_part_end - cpu_part_start);
|
||||
|
||||
/*
|
||||
* CPU part should contain hex prefix (0x) and one to three hex digits.
|
||||
@@ -411,32 +435,42 @@ static void parse_cpu_part(
|
||||
* Main ID Register (MIDR) assigns only a 12-bit value for CPU part.
|
||||
*/
|
||||
if (cpu_part_length < 3 || cpu_part_length > 5) {
|
||||
cpuinfo_log_warning("CPU part %.*s in /proc/cpuinfo is ignored due to unexpected length (%zu)",
|
||||
(int) cpu_part_length, cpu_part_start, cpu_part_length);
|
||||
cpuinfo_log_warning(
|
||||
"CPU part %.*s in /proc/cpuinfo is ignored due to unexpected length (%zu)",
|
||||
(int)cpu_part_length,
|
||||
cpu_part_start,
|
||||
cpu_part_length);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Verify the presence of hex prefix */
|
||||
if (cpu_part_start[0] != '0' || cpu_part_start[1] != 'x') {
|
||||
cpuinfo_log_warning("CPU part %.*s in /proc/cpuinfo is ignored due to lack of 0x prefix",
|
||||
(int) cpu_part_length, cpu_part_start);
|
||||
cpuinfo_log_warning(
|
||||
"CPU part %.*s in /proc/cpuinfo is ignored due to lack of 0x prefix",
|
||||
(int)cpu_part_length,
|
||||
cpu_part_start);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Verify that characters after hex prefix are hexadecimal digits and decode them */
|
||||
/* Verify that characters after hex prefix are hexadecimal digits and
|
||||
* decode them */
|
||||
uint32_t cpu_part = 0;
|
||||
for (const char* digit_ptr = cpu_part_start + 2; digit_ptr != cpu_part_end; digit_ptr++) {
|
||||
const char digit_char = *digit_ptr;
|
||||
uint32_t digit;
|
||||
if (digit_char >= '0' && digit_char <= '9') {
|
||||
digit = digit_char - '0';
|
||||
} else if ((uint32_t) (digit_char - 'A') < 6) {
|
||||
} else if ((uint32_t)(digit_char - 'A') < 6) {
|
||||
digit = 10 + (digit_char - 'A');
|
||||
} else if ((uint32_t) (digit_char - 'a') < 6) {
|
||||
} else if ((uint32_t)(digit_char - 'a') < 6) {
|
||||
digit = 10 + (digit_char - 'a');
|
||||
} else {
|
||||
cpuinfo_log_warning("CPU part %.*s in /proc/cpuinfo is ignored due to unexpected non-hex character %c at offset %zu",
|
||||
(int) cpu_part_length, cpu_part_start, digit_char, (size_t) (digit_ptr - cpu_part_start));
|
||||
cpuinfo_log_warning(
|
||||
"CPU part %.*s in /proc/cpuinfo is ignored due to unexpected non-hex character %c at offset %zu",
|
||||
(int)cpu_part_length,
|
||||
cpu_part_start,
|
||||
digit_char,
|
||||
(size_t)(digit_ptr - cpu_part_start));
|
||||
return;
|
||||
}
|
||||
cpu_part = cpu_part * 16 + digit;
|
||||
@@ -449,8 +483,7 @@ static void parse_cpu_part(
|
||||
static void parse_cpu_implementer(
|
||||
const char* cpu_implementer_start,
|
||||
const char* cpu_implementer_end,
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1])
|
||||
{
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1]) {
|
||||
const size_t cpu_implementer_length = cpu_implementer_end - cpu_implementer_start;
|
||||
|
||||
/*
|
||||
@@ -458,39 +491,50 @@ static void parse_cpu_implementer(
|
||||
* I have never seen single hex digit as a value of this field,
|
||||
* but I don't think it is impossible in future.
|
||||
* Value can not contain more than two hex digits since
|
||||
* Main ID Register (MIDR) assigns only an 8-bit value for CPU implementer.
|
||||
* Main ID Register (MIDR) assigns only an 8-bit value for CPU
|
||||
* implementer.
|
||||
*/
|
||||
switch (cpu_implementer_length) {
|
||||
case 3:
|
||||
case 4:
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_warning("CPU implementer %.*s in /proc/cpuinfo is ignored due to unexpected length (%zu)",
|
||||
(int) cpu_implementer_length, cpu_implementer_start, cpu_implementer_length);
|
||||
return;
|
||||
cpuinfo_log_warning(
|
||||
"CPU implementer %.*s in /proc/cpuinfo is ignored due to unexpected length (%zu)",
|
||||
(int)cpu_implementer_length,
|
||||
cpu_implementer_start,
|
||||
cpu_implementer_length);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Verify the presence of hex prefix */
|
||||
if (cpu_implementer_start[0] != '0' || cpu_implementer_start[1] != 'x') {
|
||||
cpuinfo_log_warning("CPU implementer %.*s in /proc/cpuinfo is ignored due to lack of 0x prefix",
|
||||
(int) cpu_implementer_length, cpu_implementer_start);
|
||||
cpuinfo_log_warning(
|
||||
"CPU implementer %.*s in /proc/cpuinfo is ignored due to lack of 0x prefix",
|
||||
(int)cpu_implementer_length,
|
||||
cpu_implementer_start);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Verify that characters after hex prefix are hexadecimal digits and decode them */
|
||||
/* Verify that characters after hex prefix are hexadecimal digits and
|
||||
* decode them */
|
||||
uint32_t cpu_implementer = 0;
|
||||
for (const char* digit_ptr = cpu_implementer_start + 2; digit_ptr != cpu_implementer_end; digit_ptr++) {
|
||||
const char digit_char = *digit_ptr;
|
||||
uint32_t digit;
|
||||
if (digit_char >= '0' && digit_char <= '9') {
|
||||
digit = digit_char - '0';
|
||||
} else if ((uint32_t) (digit_char - 'A') < 6) {
|
||||
} else if ((uint32_t)(digit_char - 'A') < 6) {
|
||||
digit = 10 + (digit_char - 'A');
|
||||
} else if ((uint32_t) (digit_char - 'a') < 6) {
|
||||
} else if ((uint32_t)(digit_char - 'a') < 6) {
|
||||
digit = 10 + (digit_char - 'a');
|
||||
} else {
|
||||
cpuinfo_log_warning("CPU implementer %.*s in /proc/cpuinfo is ignored due to unexpected non-hex character '%c' at offset %zu",
|
||||
(int) cpu_implementer_length, cpu_implementer_start, digit_char, (size_t) (digit_ptr - cpu_implementer_start));
|
||||
cpuinfo_log_warning(
|
||||
"CPU implementer %.*s in /proc/cpuinfo is ignored due to unexpected non-hex character '%c' at offset %zu",
|
||||
(int)cpu_implementer_length,
|
||||
cpu_implementer_start,
|
||||
digit_char,
|
||||
(size_t)(digit_ptr - cpu_implementer_start));
|
||||
return;
|
||||
}
|
||||
cpu_implementer = cpu_implementer * 16 + digit;
|
||||
@@ -503,8 +547,7 @@ static void parse_cpu_implementer(
|
||||
static void parse_cpu_variant(
|
||||
const char* cpu_variant_start,
|
||||
const char* cpu_variant_end,
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1])
|
||||
{
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1]) {
|
||||
const size_t cpu_variant_length = cpu_variant_end - cpu_variant_start;
|
||||
|
||||
/*
|
||||
@@ -513,30 +556,39 @@ static void parse_cpu_variant(
|
||||
* Main ID Register (MIDR) assigns only a 4-bit value for CPU variant.
|
||||
*/
|
||||
if (cpu_variant_length != 3) {
|
||||
cpuinfo_log_warning("CPU variant %.*s in /proc/cpuinfo is ignored due to unexpected length (%zu)",
|
||||
(int) cpu_variant_length, cpu_variant_start, cpu_variant_length);
|
||||
cpuinfo_log_warning(
|
||||
"CPU variant %.*s in /proc/cpuinfo is ignored due to unexpected length (%zu)",
|
||||
(int)cpu_variant_length,
|
||||
cpu_variant_start,
|
||||
cpu_variant_length);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Skip if there is no hex prefix (0x) */
|
||||
if (cpu_variant_start[0] != '0' || cpu_variant_start[1] != 'x') {
|
||||
cpuinfo_log_warning("CPU variant %.*s in /proc/cpuinfo is ignored due to lack of 0x prefix",
|
||||
(int) cpu_variant_length, cpu_variant_start);
|
||||
cpuinfo_log_warning(
|
||||
"CPU variant %.*s in /proc/cpuinfo is ignored due to lack of 0x prefix",
|
||||
(int)cpu_variant_length,
|
||||
cpu_variant_start);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if the value after hex prefix is indeed a hex digit and decode it. */
|
||||
/* Check if the value after hex prefix is indeed a hex digit and decode
|
||||
* it. */
|
||||
const char digit_char = cpu_variant_start[2];
|
||||
uint32_t cpu_variant;
|
||||
if ((uint32_t) (digit_char - '0') < 10) {
|
||||
cpu_variant = (uint32_t) (digit_char - '0');
|
||||
} else if ((uint32_t) (digit_char - 'A') < 6) {
|
||||
cpu_variant = 10 + (uint32_t) (digit_char - 'A');
|
||||
} else if ((uint32_t) (digit_char - 'a') < 6) {
|
||||
cpu_variant = 10 + (uint32_t) (digit_char - 'a');
|
||||
if ((uint32_t)(digit_char - '0') < 10) {
|
||||
cpu_variant = (uint32_t)(digit_char - '0');
|
||||
} else if ((uint32_t)(digit_char - 'A') < 6) {
|
||||
cpu_variant = 10 + (uint32_t)(digit_char - 'A');
|
||||
} else if ((uint32_t)(digit_char - 'a') < 6) {
|
||||
cpu_variant = 10 + (uint32_t)(digit_char - 'a');
|
||||
} else {
|
||||
cpuinfo_log_warning("CPU variant %.*s in /proc/cpuinfo is ignored due to unexpected non-hex character '%c'",
|
||||
(int) cpu_variant_length, cpu_variant_start, digit_char);
|
||||
cpuinfo_log_warning(
|
||||
"CPU variant %.*s in /proc/cpuinfo is ignored due to unexpected non-hex character '%c'",
|
||||
(int)cpu_variant_length,
|
||||
cpu_variant_start,
|
||||
digit_char);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -547,17 +599,20 @@ static void parse_cpu_variant(
|
||||
static void parse_cpu_revision(
|
||||
const char* cpu_revision_start,
|
||||
const char* cpu_revision_end,
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1])
|
||||
{
|
||||
struct cpuinfo_arm_linux_processor processor[restrict static 1]) {
|
||||
uint32_t cpu_revision = 0;
|
||||
for (const char* digit_ptr = cpu_revision_start; digit_ptr != cpu_revision_end; digit_ptr++) {
|
||||
const uint32_t digit = (uint32_t) (*digit_ptr - '0');
|
||||
const uint32_t digit = (uint32_t)(*digit_ptr - '0');
|
||||
|
||||
/* Verify that the character in CPU revision is a decimal digit */
|
||||
/* Verify that the character in CPU revision is a decimal digit
|
||||
*/
|
||||
if (digit >= 10) {
|
||||
cpuinfo_log_warning("CPU revision %.*s in /proc/cpuinfo is ignored due to unexpected non-digit character '%c' at offset %zu",
|
||||
(int) (cpu_revision_end - cpu_revision_start), cpu_revision_start,
|
||||
*digit_ptr, (size_t) (digit_ptr - cpu_revision_start));
|
||||
cpuinfo_log_warning(
|
||||
"CPU revision %.*s in /proc/cpuinfo is ignored due to unexpected non-digit character '%c' at offset %zu",
|
||||
(int)(cpu_revision_end - cpu_revision_start),
|
||||
cpu_revision_start,
|
||||
*digit_ptr,
|
||||
(size_t)(digit_ptr - cpu_revision_start));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -590,15 +645,18 @@ static void parse_cache_number(
|
||||
const char* number_name,
|
||||
uint32_t number_ptr[restrict static 1],
|
||||
uint32_t flags[restrict static 1],
|
||||
uint32_t number_mask)
|
||||
{
|
||||
uint32_t number_mask) {
|
||||
uint32_t number = 0;
|
||||
for (const char* digit_ptr = number_start; digit_ptr != number_end; digit_ptr++) {
|
||||
const uint32_t digit = *digit_ptr - '0';
|
||||
if (digit >= 10) {
|
||||
cpuinfo_log_warning("%s %.*s in /proc/cpuinfo is ignored due to unexpected non-digit character '%c' at offset %zu",
|
||||
number_name, (int) (number_end - number_start), number_start,
|
||||
*digit_ptr, (size_t) (digit_ptr - number_start));
|
||||
cpuinfo_log_warning(
|
||||
"%s %.*s in /proc/cpuinfo is ignored due to unexpected non-digit character '%c' at offset %zu",
|
||||
number_name,
|
||||
(int)(number_end - number_start),
|
||||
number_start,
|
||||
*digit_ptr,
|
||||
(size_t)(digit_ptr - number_start));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -606,11 +664,15 @@ static void parse_cache_number(
|
||||
}
|
||||
|
||||
if (number == 0) {
|
||||
cpuinfo_log_warning("%s %.*s in /proc/cpuinfo is ignored due to invalid value of zero reported by the kernel",
|
||||
number_name, (int) (number_end - number_start), number_start);
|
||||
cpuinfo_log_warning(
|
||||
"%s %.*s in /proc/cpuinfo is ignored due to invalid value of zero reported by the kernel",
|
||||
number_name,
|
||||
(int)(number_end - number_start),
|
||||
number_start);
|
||||
}
|
||||
|
||||
/* If the number specifies a cache line size, verify that is a reasonable power of 2 */
|
||||
/* If the number specifies a cache line size, verify that is a
|
||||
* reasonable power of 2 */
|
||||
if (number_mask & CPUINFO_ARM_LINUX_VALID_CACHE_LINE) {
|
||||
switch (number) {
|
||||
case 16:
|
||||
@@ -619,8 +681,11 @@ static void parse_cache_number(
|
||||
case 128:
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_warning("invalid %s %.*s is ignored: a value of 16, 32, 64, or 128 expected",
|
||||
number_name, (int) (number_end - number_start), number_start);
|
||||
cpuinfo_log_warning(
|
||||
"invalid %s %.*s is ignored: a value of 16, 32, 64, or 128 expected",
|
||||
number_name,
|
||||
(int)(number_end - number_start),
|
||||
number_start);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,12 +715,9 @@ struct proc_cpuinfo_parser_state {
|
||||
* processor : 1
|
||||
* BogoMIPS : 1363.33
|
||||
*
|
||||
* Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3
|
||||
* CPU implementer : 0x41
|
||||
* CPU architecture: 7
|
||||
* CPU variant : 0x2
|
||||
* CPU part : 0xc09
|
||||
* CPU revision : 10
|
||||
* Features : swp half thumb fastmult vfp edsp thumbee neon
|
||||
*vfpv3 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU
|
||||
*part : 0xc09 CPU revision : 10
|
||||
*
|
||||
* Hardware : OMAP4 Panda board
|
||||
* Revision : 0020
|
||||
@@ -665,8 +727,7 @@ static bool parse_line(
|
||||
const char* line_start,
|
||||
const char* line_end,
|
||||
struct proc_cpuinfo_parser_state state[restrict static 1],
|
||||
uint64_t line_number)
|
||||
{
|
||||
uint64_t line_number) {
|
||||
/* Empty line. Skip. */
|
||||
if (line_start == line_end) {
|
||||
return true;
|
||||
@@ -681,8 +742,10 @@ static bool parse_line(
|
||||
}
|
||||
/* Skip line if no ':' separator was found. */
|
||||
if (separator == line_end) {
|
||||
cpuinfo_log_info("Line %.*s in /proc/cpuinfo is ignored: key/value separator ':' not found",
|
||||
(int) (line_end - line_start), line_start);
|
||||
cpuinfo_log_debug(
|
||||
"Line %.*s in /proc/cpuinfo is ignored: key/value separator ':' not found",
|
||||
(int)(line_end - line_start),
|
||||
line_start);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -695,8 +758,10 @@ static bool parse_line(
|
||||
}
|
||||
/* Skip line if key contains nothing but spaces. */
|
||||
if (key_end == line_start) {
|
||||
cpuinfo_log_info("Line %.*s in /proc/cpuinfo is ignored: key contains only spaces",
|
||||
(int) (line_end - line_start), line_start);
|
||||
cpuinfo_log_debug(
|
||||
"Line %.*s in /proc/cpuinfo is ignored: key contains only spaces",
|
||||
(int)(line_end - line_start),
|
||||
line_start);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -709,8 +774,10 @@ static bool parse_line(
|
||||
}
|
||||
/* Value part contains nothing but spaces. Skip line. */
|
||||
if (value_start == line_end) {
|
||||
cpuinfo_log_info("Line %.*s in /proc/cpuinfo is ignored: value contains only spaces",
|
||||
(int) (line_end - line_start), line_start);
|
||||
cpuinfo_log_debug(
|
||||
"Line %.*s in /proc/cpuinfo is ignored: value contains only spaces",
|
||||
(int)(line_end - line_start),
|
||||
line_start);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -722,10 +789,10 @@ static bool parse_line(
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t processor_index = state->processor_index;
|
||||
const uint32_t processor_index = state->processor_index;
|
||||
const uint32_t max_processors_count = state->max_processors_count;
|
||||
struct cpuinfo_arm_linux_processor* processors = state->processors;
|
||||
struct cpuinfo_arm_linux_processor* processor = &state->dummy_processor;
|
||||
struct cpuinfo_arm_linux_processor* processor = &state->dummy_processor;
|
||||
if (processor_index < max_processors_count) {
|
||||
processor = &processors[processor_index];
|
||||
}
|
||||
@@ -737,21 +804,37 @@ static bool parse_line(
|
||||
/* Usually contains just zeros, useless */
|
||||
#if CPUINFO_ARCH_ARM
|
||||
} else if (memcmp(line_start, "I size", key_length) == 0) {
|
||||
parse_cache_number(value_start, value_end,
|
||||
"instruction cache size", &processor->proc_cpuinfo_cache.i_size,
|
||||
&processor->flags, CPUINFO_ARM_LINUX_VALID_ICACHE_SIZE);
|
||||
parse_cache_number(
|
||||
value_start,
|
||||
value_end,
|
||||
"instruction cache size",
|
||||
&processor->proc_cpuinfo_cache.i_size,
|
||||
&processor->flags,
|
||||
CPUINFO_ARM_LINUX_VALID_ICACHE_SIZE);
|
||||
} else if (memcmp(line_start, "I sets", key_length) == 0) {
|
||||
parse_cache_number(value_start, value_end,
|
||||
"instruction cache sets", &processor->proc_cpuinfo_cache.i_sets,
|
||||
&processor->flags, CPUINFO_ARM_LINUX_VALID_ICACHE_SETS);
|
||||
parse_cache_number(
|
||||
value_start,
|
||||
value_end,
|
||||
"instruction cache sets",
|
||||
&processor->proc_cpuinfo_cache.i_sets,
|
||||
&processor->flags,
|
||||
CPUINFO_ARM_LINUX_VALID_ICACHE_SETS);
|
||||
} else if (memcmp(line_start, "D size", key_length) == 0) {
|
||||
parse_cache_number(value_start, value_end,
|
||||
"data cache size", &processor->proc_cpuinfo_cache.d_size,
|
||||
&processor->flags, CPUINFO_ARM_LINUX_VALID_DCACHE_SIZE);
|
||||
parse_cache_number(
|
||||
value_start,
|
||||
value_end,
|
||||
"data cache size",
|
||||
&processor->proc_cpuinfo_cache.d_size,
|
||||
&processor->flags,
|
||||
CPUINFO_ARM_LINUX_VALID_DCACHE_SIZE);
|
||||
} else if (memcmp(line_start, "D sets", key_length) == 0) {
|
||||
parse_cache_number(value_start, value_end,
|
||||
"data cache sets", &processor->proc_cpuinfo_cache.d_sets,
|
||||
&processor->flags, CPUINFO_ARM_LINUX_VALID_DCACHE_SETS);
|
||||
parse_cache_number(
|
||||
value_start,
|
||||
value_end,
|
||||
"data cache sets",
|
||||
&processor->proc_cpuinfo_cache.d_sets,
|
||||
&processor->flags,
|
||||
CPUINFO_ARM_LINUX_VALID_DCACHE_SETS);
|
||||
#endif /* CPUINFO_ARCH_ARM */
|
||||
} else {
|
||||
goto unknown;
|
||||
@@ -760,13 +843,21 @@ static bool parse_line(
|
||||
#if CPUINFO_ARCH_ARM
|
||||
case 7:
|
||||
if (memcmp(line_start, "I assoc", key_length) == 0) {
|
||||
parse_cache_number(value_start, value_end,
|
||||
"instruction cache associativity", &processor->proc_cpuinfo_cache.i_assoc,
|
||||
&processor->flags, CPUINFO_ARM_LINUX_VALID_ICACHE_WAYS);
|
||||
parse_cache_number(
|
||||
value_start,
|
||||
value_end,
|
||||
"instruction cache associativity",
|
||||
&processor->proc_cpuinfo_cache.i_assoc,
|
||||
&processor->flags,
|
||||
CPUINFO_ARM_LINUX_VALID_ICACHE_WAYS);
|
||||
} else if (memcmp(line_start, "D assoc", key_length) == 0) {
|
||||
parse_cache_number(value_start, value_end,
|
||||
"data cache associativity", &processor->proc_cpuinfo_cache.d_assoc,
|
||||
&processor->flags, CPUINFO_ARM_LINUX_VALID_DCACHE_WAYS);
|
||||
parse_cache_number(
|
||||
value_start,
|
||||
value_end,
|
||||
"data cache associativity",
|
||||
&processor->proc_cpuinfo_cache.d_assoc,
|
||||
&processor->flags,
|
||||
CPUINFO_ARM_LINUX_VALID_DCACHE_WAYS);
|
||||
} else {
|
||||
goto unknown;
|
||||
}
|
||||
@@ -782,27 +873,33 @@ static bool parse_line(
|
||||
} else if (memcmp(line_start, "Hardware", key_length) == 0) {
|
||||
size_t value_length = value_end - value_start;
|
||||
if (value_length > CPUINFO_HARDWARE_VALUE_MAX) {
|
||||
cpuinfo_log_info(
|
||||
cpuinfo_log_warning(
|
||||
"length of Hardware value \"%.*s\" in /proc/cpuinfo exceeds limit (%d): truncating to the limit",
|
||||
(int) value_length, value_start, CPUINFO_HARDWARE_VALUE_MAX);
|
||||
(int)value_length,
|
||||
value_start,
|
||||
CPUINFO_HARDWARE_VALUE_MAX);
|
||||
value_length = CPUINFO_HARDWARE_VALUE_MAX;
|
||||
} else {
|
||||
state->hardware[value_length] = '\0';
|
||||
}
|
||||
memcpy(state->hardware, value_start, value_length);
|
||||
cpuinfo_log_debug("parsed /proc/cpuinfo Hardware = \"%.*s\"", (int) value_length, value_start);
|
||||
cpuinfo_log_debug(
|
||||
"parsed /proc/cpuinfo Hardware = \"%.*s\"", (int)value_length, value_start);
|
||||
} else if (memcmp(line_start, "Revision", key_length) == 0) {
|
||||
size_t value_length = value_end - value_start;
|
||||
if (value_length > CPUINFO_REVISION_VALUE_MAX) {
|
||||
cpuinfo_log_info(
|
||||
cpuinfo_log_warning(
|
||||
"length of Revision value \"%.*s\" in /proc/cpuinfo exceeds limit (%d): truncating to the limit",
|
||||
(int) value_length, value_start, CPUINFO_REVISION_VALUE_MAX);
|
||||
(int)value_length,
|
||||
value_start,
|
||||
CPUINFO_REVISION_VALUE_MAX);
|
||||
value_length = CPUINFO_REVISION_VALUE_MAX;
|
||||
} else {
|
||||
state->revision[value_length] = '\0';
|
||||
}
|
||||
memcpy(state->revision, value_start, value_length);
|
||||
cpuinfo_log_debug("parsed /proc/cpuinfo Revision = \"%.*s\"", (int) value_length, value_start);
|
||||
cpuinfo_log_debug(
|
||||
"parsed /proc/cpuinfo Revision = \"%.*s\"", (int)value_length, value_start);
|
||||
} else {
|
||||
goto unknown;
|
||||
}
|
||||
@@ -811,28 +908,39 @@ static bool parse_line(
|
||||
if (memcmp(line_start, "processor", key_length) == 0) {
|
||||
const uint32_t new_processor_index = parse_processor_number(value_start, value_end);
|
||||
if (new_processor_index < processor_index) {
|
||||
/* Strange: decreasing processor number */
|
||||
/* Strange: decreasing processor number
|
||||
*/
|
||||
cpuinfo_log_warning(
|
||||
"unexpectedly low processor number %"PRIu32" following processor %"PRIu32" in /proc/cpuinfo",
|
||||
new_processor_index, processor_index);
|
||||
"unexpectedly low processor number %" PRIu32
|
||||
" following processor %" PRIu32 " in /proc/cpuinfo",
|
||||
new_processor_index,
|
||||
processor_index);
|
||||
} else if (new_processor_index > processor_index + 1) {
|
||||
/* Strange, but common: skipped processor $(processor_index + 1) */
|
||||
cpuinfo_log_info(
|
||||
"unexpectedly high processor number %"PRIu32" following processor %"PRIu32" in /proc/cpuinfo",
|
||||
new_processor_index, processor_index);
|
||||
/* Strange, but common: skipped
|
||||
* processor $(processor_index + 1) */
|
||||
cpuinfo_log_warning(
|
||||
"unexpectedly high processor number %" PRIu32
|
||||
" following processor %" PRIu32 " in /proc/cpuinfo",
|
||||
new_processor_index,
|
||||
processor_index);
|
||||
}
|
||||
if (new_processor_index < max_processors_count) {
|
||||
/* Record that the processor was mentioned in /proc/cpuinfo */
|
||||
/* Record that the processor was
|
||||
* mentioned in /proc/cpuinfo */
|
||||
processors[new_processor_index].flags |= CPUINFO_ARM_LINUX_VALID_PROCESSOR;
|
||||
} else {
|
||||
/* Log and ignore processor */
|
||||
cpuinfo_log_warning("processor %"PRIu32" in /proc/cpuinfo is ignored: index exceeds system limit %"PRIu32,
|
||||
new_processor_index, max_processors_count - 1);
|
||||
cpuinfo_log_warning(
|
||||
"processor %" PRIu32
|
||||
" in /proc/cpuinfo is ignored: index exceeds system limit %" PRIu32,
|
||||
new_processor_index,
|
||||
max_processors_count - 1);
|
||||
}
|
||||
state->processor_index = new_processor_index;
|
||||
return true;
|
||||
} else if (memcmp(line_start, "Processor", key_length) == 0) {
|
||||
/* TODO: parse to fix misreported architecture, similar to Android's cpufeatures */
|
||||
/* TODO: parse to fix misreported architecture,
|
||||
* similar to Android's cpufeatures */
|
||||
} else {
|
||||
goto unknown;
|
||||
}
|
||||
@@ -854,13 +962,21 @@ static bool parse_line(
|
||||
#if CPUINFO_ARCH_ARM
|
||||
case 13:
|
||||
if (memcmp(line_start, "I line length", key_length) == 0) {
|
||||
parse_cache_number(value_start, value_end,
|
||||
"instruction cache line size", &processor->proc_cpuinfo_cache.i_line_length,
|
||||
&processor->flags, CPUINFO_ARM_LINUX_VALID_ICACHE_LINE);
|
||||
parse_cache_number(
|
||||
value_start,
|
||||
value_end,
|
||||
"instruction cache line size",
|
||||
&processor->proc_cpuinfo_cache.i_line_length,
|
||||
&processor->flags,
|
||||
CPUINFO_ARM_LINUX_VALID_ICACHE_LINE);
|
||||
} else if (memcmp(line_start, "D line length", key_length) == 0) {
|
||||
parse_cache_number(value_start, value_end,
|
||||
"data cache line size", &processor->proc_cpuinfo_cache.d_line_length,
|
||||
&processor->flags, CPUINFO_ARM_LINUX_VALID_DCACHE_LINE);
|
||||
parse_cache_number(
|
||||
value_start,
|
||||
value_end,
|
||||
"data cache line size",
|
||||
&processor->proc_cpuinfo_cache.d_line_length,
|
||||
&processor->flags,
|
||||
CPUINFO_ARM_LINUX_VALID_DCACHE_LINE);
|
||||
} else {
|
||||
goto unknown;
|
||||
}
|
||||
@@ -884,8 +1000,7 @@ static bool parse_line(
|
||||
break;
|
||||
default:
|
||||
unknown:
|
||||
cpuinfo_log_debug("unknown /proc/cpuinfo key: %.*s", (int) key_length, line_start);
|
||||
|
||||
cpuinfo_log_debug("unknown /proc/cpuinfo key: %.*s", (int)key_length, line_start);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -894,8 +1009,8 @@ bool cpuinfo_arm_linux_parse_proc_cpuinfo(
|
||||
char hardware[restrict static CPUINFO_HARDWARE_VALUE_MAX],
|
||||
char revision[restrict static CPUINFO_REVISION_VALUE_MAX],
|
||||
uint32_t max_processors_count,
|
||||
struct cpuinfo_arm_linux_processor processors[restrict static 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,
|
||||
@@ -903,6 +1018,6 @@ bool cpuinfo_arm_linux_parse_proc_cpuinfo(
|
||||
.max_processors_count = max_processors_count,
|
||||
.processors = processors,
|
||||
};
|
||||
return cpuinfo_linux_parse_multiline_file("/proc/cpuinfo", BUFFER_SIZE,
|
||||
(cpuinfo_line_callback) parse_line, &state);
|
||||
return cpuinfo_linux_parse_multiline_file(
|
||||
"/proc/cpuinfo", BUFFER_SIZE, (cpuinfo_line_callback)parse_line, &state);
|
||||
}
|
||||
|
||||
265
3rdparty/cpuinfo/src/arm/linux/hwcap.c
vendored
265
3rdparty/cpuinfo/src/arm/linux/hwcap.c
vendored
@@ -1,159 +1,154 @@
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <dlfcn.h>
|
||||
#include <elf.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
#include <cpuinfo-mock.h>
|
||||
#include <cpuinfo-mock.h>
|
||||
#endif
|
||||
#include <cpuinfo.h>
|
||||
#include <arm/linux/api.h>
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
#if CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_ARM && !defined(__ANDROID__)
|
||||
#include <sys/auxv.h>
|
||||
#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
|
||||
#define AT_HWCAP2 26
|
||||
#define AT_HWCAP 16
|
||||
#define AT_HWCAP2 26
|
||||
#endif
|
||||
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
static uint32_t mock_hwcap = 0;
|
||||
void cpuinfo_set_hwcap(uint32_t hwcap) {
|
||||
mock_hwcap = hwcap;
|
||||
}
|
||||
static uint32_t mock_hwcap = 0;
|
||||
void cpuinfo_set_hwcap(uint32_t hwcap) {
|
||||
mock_hwcap = hwcap;
|
||||
}
|
||||
|
||||
static uint32_t mock_hwcap2 = 0;
|
||||
void cpuinfo_set_hwcap2(uint32_t hwcap2) {
|
||||
mock_hwcap2 = hwcap2;
|
||||
}
|
||||
static uint32_t mock_hwcap2 = 0;
|
||||
void cpuinfo_set_hwcap2(uint32_t hwcap2) {
|
||||
mock_hwcap2 = hwcap2;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if CPUINFO_ARCH_ARM
|
||||
typedef unsigned long (*getauxval_function_t)(unsigned long);
|
||||
typedef unsigned long (*getauxval_function_t)(unsigned long);
|
||||
|
||||
bool cpuinfo_arm_linux_hwcap_from_getauxval(
|
||||
uint32_t hwcap[restrict static 1],
|
||||
uint32_t hwcap2[restrict static 1])
|
||||
{
|
||||
#if CPUINFO_MOCK
|
||||
*hwcap = mock_hwcap;
|
||||
*hwcap2 = mock_hwcap2;
|
||||
return true;
|
||||
#elif defined(__ANDROID__)
|
||||
/* Android: dynamically check if getauxval is supported */
|
||||
void* libc = NULL;
|
||||
getauxval_function_t getauxval = NULL;
|
||||
bool cpuinfo_arm_linux_hwcap_from_getauxval(uint32_t hwcap[restrict static 1], uint32_t hwcap2[restrict static 1]) {
|
||||
#if CPUINFO_MOCK
|
||||
*hwcap = mock_hwcap;
|
||||
*hwcap2 = mock_hwcap2;
|
||||
return true;
|
||||
#elif defined(__ANDROID__)
|
||||
/* Android: dynamically check if getauxval is supported */
|
||||
void* libc = NULL;
|
||||
getauxval_function_t getauxval = NULL;
|
||||
|
||||
dlerror();
|
||||
libc = dlopen("libc.so", RTLD_LAZY);
|
||||
if (libc == NULL) {
|
||||
cpuinfo_log_warning("failed to load libc.so: %s", dlerror());
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
getauxval = (getauxval_function_t) dlsym(libc, "getauxval");
|
||||
if (getauxval == NULL) {
|
||||
cpuinfo_log_info("failed to locate getauxval in libc.so: %s", dlerror());
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
*hwcap = getauxval(AT_HWCAP);
|
||||
*hwcap2 = getauxval(AT_HWCAP2);
|
||||
|
||||
cleanup:
|
||||
if (libc != NULL) {
|
||||
dlclose(libc);
|
||||
libc = NULL;
|
||||
}
|
||||
return getauxval != NULL;
|
||||
#else
|
||||
/* GNU/Linux: getauxval is always supported */
|
||||
*hwcap = getauxval(AT_HWCAP);
|
||||
*hwcap2 = getauxval(AT_HWCAP2);
|
||||
return true;
|
||||
#endif
|
||||
dlerror();
|
||||
libc = dlopen("libc.so", RTLD_LAZY);
|
||||
if (libc == NULL) {
|
||||
cpuinfo_log_warning("failed to load libc.so: %s", dlerror());
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
bool cpuinfo_arm_linux_hwcap_from_procfs(
|
||||
uint32_t hwcap[restrict static 1],
|
||||
uint32_t hwcap2[restrict static 1])
|
||||
{
|
||||
#if CPUINFO_MOCK
|
||||
*hwcap = mock_hwcap;
|
||||
*hwcap2 = mock_hwcap2;
|
||||
return true;
|
||||
#else
|
||||
uint32_t hwcaps[2] = { 0, 0 };
|
||||
bool result = false;
|
||||
int file = -1;
|
||||
|
||||
file = open("/proc/self/auxv", O_RDONLY);
|
||||
if (file == -1) {
|
||||
cpuinfo_log_warning("failed to open /proc/self/auxv: %s", strerror(errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ssize_t bytes_read;
|
||||
do {
|
||||
Elf32_auxv_t elf_auxv;
|
||||
bytes_read = read(file, &elf_auxv, sizeof(Elf32_auxv_t));
|
||||
if (bytes_read < 0) {
|
||||
cpuinfo_log_warning("failed to read /proc/self/auxv: %s", strerror(errno));
|
||||
goto cleanup;
|
||||
} else if (bytes_read > 0) {
|
||||
if (bytes_read == sizeof(elf_auxv)) {
|
||||
switch (elf_auxv.a_type) {
|
||||
case AT_HWCAP:
|
||||
hwcaps[0] = (uint32_t) elf_auxv.a_un.a_val;
|
||||
break;
|
||||
case AT_HWCAP2:
|
||||
hwcaps[1] = (uint32_t) elf_auxv.a_un.a_val;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
cpuinfo_log_warning(
|
||||
"failed to read %zu bytes from /proc/self/auxv: %zu bytes available",
|
||||
sizeof(elf_auxv), (size_t) bytes_read);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
} while (bytes_read == sizeof(Elf32_auxv_t));
|
||||
|
||||
/* Success, commit results */
|
||||
*hwcap = hwcaps[0];
|
||||
*hwcap2 = hwcaps[1];
|
||||
result = true;
|
||||
|
||||
cleanup:
|
||||
if (file != -1) {
|
||||
close(file);
|
||||
file = -1;
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
#endif /* __ANDROID__ */
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
void cpuinfo_arm_linux_hwcap_from_getauxval(
|
||||
uint32_t hwcap[restrict static 1],
|
||||
uint32_t hwcap2[restrict static 1])
|
||||
{
|
||||
#if CPUINFO_MOCK
|
||||
*hwcap = mock_hwcap;
|
||||
*hwcap2 = mock_hwcap2;
|
||||
#else
|
||||
*hwcap = (uint32_t) getauxval(AT_HWCAP);
|
||||
*hwcap2 = (uint32_t) getauxval(AT_HWCAP2);
|
||||
return ;
|
||||
#endif
|
||||
getauxval = (getauxval_function_t)dlsym(libc, "getauxval");
|
||||
if (getauxval == NULL) {
|
||||
cpuinfo_log_info("failed to locate getauxval in libc.so: %s", dlerror());
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
*hwcap = getauxval(AT_HWCAP);
|
||||
*hwcap2 = getauxval(AT_HWCAP2);
|
||||
|
||||
cleanup:
|
||||
if (libc != NULL) {
|
||||
dlclose(libc);
|
||||
libc = NULL;
|
||||
}
|
||||
return getauxval != NULL;
|
||||
#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
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
bool cpuinfo_arm_linux_hwcap_from_procfs(uint32_t hwcap[restrict static 1], uint32_t hwcap2[restrict static 1]) {
|
||||
#if CPUINFO_MOCK
|
||||
*hwcap = mock_hwcap;
|
||||
*hwcap2 = mock_hwcap2;
|
||||
return true;
|
||||
#else
|
||||
uint32_t hwcaps[2] = {0, 0};
|
||||
bool result = false;
|
||||
int file = -1;
|
||||
|
||||
file = open("/proc/self/auxv", O_RDONLY);
|
||||
if (file == -1) {
|
||||
cpuinfo_log_warning("failed to open /proc/self/auxv: %s", strerror(errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ssize_t bytes_read;
|
||||
do {
|
||||
Elf32_auxv_t elf_auxv;
|
||||
bytes_read = read(file, &elf_auxv, sizeof(Elf32_auxv_t));
|
||||
if (bytes_read < 0) {
|
||||
cpuinfo_log_warning("failed to read /proc/self/auxv: %s", strerror(errno));
|
||||
goto cleanup;
|
||||
} else if (bytes_read > 0) {
|
||||
if (bytes_read == sizeof(elf_auxv)) {
|
||||
switch (elf_auxv.a_type) {
|
||||
case AT_HWCAP:
|
||||
hwcaps[0] = (uint32_t)elf_auxv.a_un.a_val;
|
||||
break;
|
||||
case AT_HWCAP2:
|
||||
hwcaps[1] = (uint32_t)elf_auxv.a_un.a_val;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
cpuinfo_log_warning(
|
||||
"failed to read %zu bytes from /proc/self/auxv: %zu bytes available",
|
||||
sizeof(elf_auxv),
|
||||
(size_t)bytes_read);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
} while (bytes_read == sizeof(Elf32_auxv_t));
|
||||
|
||||
/* Success, commit results */
|
||||
*hwcap = hwcaps[0];
|
||||
*hwcap2 = hwcaps[1];
|
||||
result = true;
|
||||
|
||||
cleanup:
|
||||
if (file != -1) {
|
||||
close(file);
|
||||
file = -1;
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
#endif /* __ANDROID__ */
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
void cpuinfo_arm_linux_hwcap_from_getauxval(uint32_t hwcap[restrict static 1], uint32_t hwcap2[restrict static 1]) {
|
||||
#if CPUINFO_MOCK
|
||||
*hwcap = mock_hwcap;
|
||||
*hwcap2 = mock_hwcap2;
|
||||
#else
|
||||
*hwcap = (uint32_t)getauxval(AT_HWCAP);
|
||||
*hwcap2 = (uint32_t)getauxval(AT_HWCAP2);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
507
3rdparty/cpuinfo/src/arm/linux/init.c
vendored
507
3rdparty/cpuinfo/src/arm/linux/init.c
vendored
@@ -1,23 +1,22 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#include <arm/linux/api.h>
|
||||
#include <cpuinfo.h>
|
||||
#if defined(__ANDROID__)
|
||||
#include <arm/android/api.h>
|
||||
#include <arm/android/api.h>
|
||||
#endif
|
||||
#include <arm/api.h>
|
||||
#include <arm/midr.h>
|
||||
#include <linux/api.h>
|
||||
#include <cpuinfo/internal-api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
#include <linux/api.h>
|
||||
|
||||
struct cpuinfo_arm_isa cpuinfo_isa = {0};
|
||||
|
||||
struct cpuinfo_arm_isa cpuinfo_isa = { 0 };
|
||||
|
||||
static struct cpuinfo_package package = { { 0 } };
|
||||
static struct cpuinfo_package package = {{0}};
|
||||
|
||||
static inline bool bitmask_all(uint32_t bitfield, uint32_t mask) {
|
||||
return (bitfield & mask) == mask;
|
||||
@@ -32,16 +31,19 @@ static inline int cmp(uint32_t a, uint32_t b) {
|
||||
}
|
||||
|
||||
static bool cluster_siblings_parser(
|
||||
uint32_t processor, uint32_t siblings_start, uint32_t siblings_end,
|
||||
struct cpuinfo_arm_linux_processor* processors)
|
||||
{
|
||||
uint32_t processor,
|
||||
uint32_t siblings_start,
|
||||
uint32_t siblings_end,
|
||||
struct cpuinfo_arm_linux_processor* processors) {
|
||||
processors[processor].flags |= CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER;
|
||||
uint32_t package_leader_id = processors[processor].package_leader_id;
|
||||
|
||||
for (uint32_t sibling = siblings_start; sibling < siblings_end; sibling++) {
|
||||
if (!bitmask_all(processors[sibling].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
cpuinfo_log_info("invalid processor %"PRIu32" reported as a sibling for processor %"PRIu32,
|
||||
sibling, processor);
|
||||
cpuinfo_log_info(
|
||||
"invalid processor %" PRIu32 " reported as a sibling for processor %" PRIu32,
|
||||
sibling,
|
||||
processor);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -60,14 +62,14 @@ static bool cluster_siblings_parser(
|
||||
}
|
||||
|
||||
static int cmp_arm_linux_processor(const void* ptr_a, const void* ptr_b) {
|
||||
const struct cpuinfo_arm_linux_processor* processor_a = (const struct cpuinfo_arm_linux_processor*) ptr_a;
|
||||
const struct cpuinfo_arm_linux_processor* processor_b = (const struct cpuinfo_arm_linux_processor*) ptr_b;
|
||||
const struct cpuinfo_arm_linux_processor* processor_a = (const struct cpuinfo_arm_linux_processor*)ptr_a;
|
||||
const struct cpuinfo_arm_linux_processor* processor_b = (const struct cpuinfo_arm_linux_processor*)ptr_b;
|
||||
|
||||
/* Move usable processors towards the start of the array */
|
||||
const bool usable_a = bitmask_all(processor_a->flags, CPUINFO_LINUX_FLAG_VALID);
|
||||
const bool usable_b = bitmask_all(processor_b->flags, CPUINFO_LINUX_FLAG_VALID);
|
||||
if (usable_a != usable_b) {
|
||||
return (int) usable_b - (int) usable_a;
|
||||
return (int)usable_b - (int)usable_a;
|
||||
}
|
||||
|
||||
/* Compare based on core type (e.g. Cortex-A57 < Cortex-A53) */
|
||||
@@ -95,7 +97,8 @@ static int cmp_arm_linux_processor(const void* ptr_a, const void* ptr_b) {
|
||||
return cluster_a > cluster_b ? -1 : 1;
|
||||
}
|
||||
|
||||
/* Compare based on system processor id (i.e. processor 0 < processor 1) */
|
||||
/* Compare based on system processor id (i.e. processor 0 < processor 1)
|
||||
*/
|
||||
const uint32_t id_a = processor_a->system_processor_id;
|
||||
const uint32_t id_b = processor_b->system_processor_id;
|
||||
return cmp(id_a, id_b);
|
||||
@@ -116,14 +119,13 @@ void cpuinfo_arm_linux_init(void) {
|
||||
uint32_t* linux_cpu_to_uarch_index_map = NULL;
|
||||
|
||||
const uint32_t max_processors_count = cpuinfo_linux_get_max_processors_count();
|
||||
cpuinfo_log_debug("system maximum processors count: %"PRIu32, max_processors_count);
|
||||
cpuinfo_log_debug("system maximum processors count: %" PRIu32, max_processors_count);
|
||||
|
||||
const uint32_t max_possible_processors_count = 1 +
|
||||
cpuinfo_linux_get_max_possible_processor(max_processors_count);
|
||||
cpuinfo_log_debug("maximum possible processors count: %"PRIu32, max_possible_processors_count);
|
||||
const uint32_t max_present_processors_count = 1 +
|
||||
cpuinfo_linux_get_max_present_processor(max_processors_count);
|
||||
cpuinfo_log_debug("maximum present processors count: %"PRIu32, max_present_processors_count);
|
||||
const uint32_t max_possible_processors_count =
|
||||
1 + cpuinfo_linux_get_max_possible_processor(max_processors_count);
|
||||
cpuinfo_log_debug("maximum possible processors count: %" PRIu32, max_possible_processors_count);
|
||||
const uint32_t max_present_processors_count = 1 + cpuinfo_linux_get_max_present_processor(max_processors_count);
|
||||
cpuinfo_log_debug("maximum present processors count: %" PRIu32, max_present_processors_count);
|
||||
|
||||
uint32_t valid_processor_mask = 0;
|
||||
uint32_t arm_linux_processors_count = max_processors_count;
|
||||
@@ -143,7 +145,7 @@ void cpuinfo_arm_linux_init(void) {
|
||||
arm_linux_processors = calloc(arm_linux_processors_count, sizeof(struct cpuinfo_arm_linux_processor));
|
||||
if (arm_linux_processors == NULL) {
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %"PRIu32" ARM logical processors",
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " ARM logical processors",
|
||||
arm_linux_processors_count * sizeof(struct cpuinfo_arm_linux_processor),
|
||||
arm_linux_processors_count);
|
||||
return;
|
||||
@@ -151,14 +153,16 @@ void cpuinfo_arm_linux_init(void) {
|
||||
|
||||
if (max_possible_processors_count) {
|
||||
cpuinfo_linux_detect_possible_processors(
|
||||
arm_linux_processors_count, &arm_linux_processors->flags,
|
||||
arm_linux_processors_count,
|
||||
&arm_linux_processors->flags,
|
||||
sizeof(struct cpuinfo_arm_linux_processor),
|
||||
CPUINFO_LINUX_FLAG_POSSIBLE);
|
||||
}
|
||||
|
||||
if (max_present_processors_count) {
|
||||
cpuinfo_linux_detect_present_processors(
|
||||
arm_linux_processors_count, &arm_linux_processors->flags,
|
||||
arm_linux_processors_count,
|
||||
&arm_linux_processors->flags,
|
||||
sizeof(struct cpuinfo_arm_linux_processor),
|
||||
CPUINFO_LINUX_FLAG_PRESENT);
|
||||
}
|
||||
@@ -173,13 +177,13 @@ void cpuinfo_arm_linux_init(void) {
|
||||
|
||||
if (!cpuinfo_arm_linux_parse_proc_cpuinfo(
|
||||
#if defined(__ANDROID__)
|
||||
android_properties.proc_cpuinfo_hardware,
|
||||
android_properties.proc_cpuinfo_hardware,
|
||||
#else
|
||||
proc_cpuinfo_hardware,
|
||||
proc_cpuinfo_hardware,
|
||||
#endif
|
||||
proc_cpuinfo_revision,
|
||||
arm_linux_processors_count,
|
||||
arm_linux_processors)) {
|
||||
proc_cpuinfo_revision,
|
||||
arm_linux_processors_count,
|
||||
arm_linux_processors)) {
|
||||
cpuinfo_log_error("failed to parse processor information from /proc/cpuinfo");
|
||||
return;
|
||||
}
|
||||
@@ -187,41 +191,49 @@ void cpuinfo_arm_linux_init(void) {
|
||||
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
|
||||
if (bitmask_all(arm_linux_processors[i].flags, valid_processor_mask)) {
|
||||
arm_linux_processors[i].flags |= CPUINFO_LINUX_FLAG_VALID;
|
||||
cpuinfo_log_debug("parsed processor %"PRIu32" MIDR 0x%08"PRIx32,
|
||||
i, arm_linux_processors[i].midr);
|
||||
cpuinfo_log_debug(
|
||||
"parsed processor %" PRIu32 " MIDR 0x%08" PRIx32, i, arm_linux_processors[i].midr);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t valid_processors = 0, last_midr = 0;
|
||||
#if CPUINFO_ARCH_ARM
|
||||
#if CPUINFO_ARCH_ARM
|
||||
uint32_t last_architecture_version = 0, last_architecture_flags = 0;
|
||||
#endif
|
||||
#endif
|
||||
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, but not reported in /proc/cpuinfo.
|
||||
* This is fairly common: high-index processors can be not reported if they are offline.
|
||||
* Processor is in possible and present lists,
|
||||
* and also reported in /proc/cpuinfo. This
|
||||
* processor is availble for compute.
|
||||
*/
|
||||
cpuinfo_log_info("processor %"PRIu32" is not listed in /proc/cpuinfo", i);
|
||||
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.
|
||||
*/
|
||||
cpuinfo_log_info("processor %" PRIu32 " is not listed in /proc/cpuinfo", i);
|
||||
}
|
||||
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_ARM_LINUX_VALID_MIDR)) {
|
||||
last_midr = arm_linux_processors[i].midr;
|
||||
}
|
||||
#if CPUINFO_ARCH_ARM
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_ARM_LINUX_VALID_ARCHITECTURE)) {
|
||||
last_architecture_version = arm_linux_processors[i].architecture_version;
|
||||
last_architecture_flags = arm_linux_processors[i].architecture_flags;
|
||||
}
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_ARM_LINUX_VALID_ARCHITECTURE)) {
|
||||
last_architecture_version = arm_linux_processors[i].architecture_version;
|
||||
last_architecture_flags = arm_linux_processors[i].architecture_flags;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
/* Processor reported in /proc/cpuinfo, but not in possible and/or present lists: log and ignore */
|
||||
/* Processor reported in /proc/cpuinfo, but not in
|
||||
* possible and/or present lists: log and ignore */
|
||||
if (!(arm_linux_processors[i].flags & CPUINFO_ARM_LINUX_VALID_PROCESSOR)) {
|
||||
cpuinfo_log_warning("invalid processor %"PRIu32" reported in /proc/cpuinfo", i);
|
||||
cpuinfo_log_warning("invalid processor %" PRIu32 " reported in /proc/cpuinfo", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,55 +246,65 @@ void cpuinfo_arm_linux_init(void) {
|
||||
cpuinfo_arm_linux_decode_chipset(proc_cpuinfo_hardware, proc_cpuinfo_revision, valid_processors, 0);
|
||||
#endif
|
||||
|
||||
#if CPUINFO_ARCH_ARM
|
||||
uint32_t isa_features = 0, isa_features2 = 0;
|
||||
#ifdef __ANDROID__
|
||||
#if CPUINFO_ARCH_ARM
|
||||
uint32_t isa_features = 0, isa_features2 = 0;
|
||||
#ifdef __ANDROID__
|
||||
/*
|
||||
* On Android before API 20, libc.so does not provide getauxval
|
||||
* function. Thus, we try to dynamically find it, or use two fallback
|
||||
* mechanisms:
|
||||
* 1. dlopen libc.so, and try to find getauxval
|
||||
* 2. Parse /proc/self/auxv procfs file
|
||||
* 3. Use features reported in /proc/cpuinfo
|
||||
*/
|
||||
if (!cpuinfo_arm_linux_hwcap_from_getauxval(&isa_features, &isa_features2)) {
|
||||
/* getauxval can't be used, fall back to parsing /proc/self/auxv
|
||||
*/
|
||||
if (!cpuinfo_arm_linux_hwcap_from_procfs(&isa_features, &isa_features2)) {
|
||||
/*
|
||||
* On Android before API 20, libc.so does not provide getauxval function.
|
||||
* Thus, we try to dynamically find it, or use two fallback mechanisms:
|
||||
* 1. dlopen libc.so, and try to find getauxval
|
||||
* 2. Parse /proc/self/auxv procfs file
|
||||
* 3. Use features reported in /proc/cpuinfo
|
||||
* Reading /proc/self/auxv failed, probably due to file
|
||||
* permissions. Use information from /proc/cpuinfo to
|
||||
* detect ISA.
|
||||
*
|
||||
* If different processors report different ISA
|
||||
* features, take the intersection.
|
||||
*/
|
||||
if (!cpuinfo_arm_linux_hwcap_from_getauxval(&isa_features, &isa_features2)) {
|
||||
/* getauxval can't be used, fall back to parsing /proc/self/auxv */
|
||||
if (!cpuinfo_arm_linux_hwcap_from_procfs(&isa_features, &isa_features2)) {
|
||||
/*
|
||||
* Reading /proc/self/auxv failed, probably due to file permissions.
|
||||
* Use information from /proc/cpuinfo to detect ISA.
|
||||
*
|
||||
* If different processors report different ISA features, take the intersection.
|
||||
*/
|
||||
uint32_t processors_with_features = 0;
|
||||
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID | CPUINFO_ARM_LINUX_VALID_FEATURES)) {
|
||||
if (processors_with_features == 0) {
|
||||
isa_features = arm_linux_processors[i].features;
|
||||
isa_features2 = arm_linux_processors[i].features2;
|
||||
} else {
|
||||
isa_features &= arm_linux_processors[i].features;
|
||||
isa_features2 &= arm_linux_processors[i].features2;
|
||||
}
|
||||
processors_with_features += 1;
|
||||
}
|
||||
uint32_t processors_with_features = 0;
|
||||
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
|
||||
if (bitmask_all(
|
||||
arm_linux_processors[i].flags,
|
||||
CPUINFO_LINUX_FLAG_VALID | CPUINFO_ARM_LINUX_VALID_FEATURES)) {
|
||||
if (processors_with_features == 0) {
|
||||
isa_features = arm_linux_processors[i].features;
|
||||
isa_features2 = arm_linux_processors[i].features2;
|
||||
} else {
|
||||
isa_features &= arm_linux_processors[i].features;
|
||||
isa_features2 &= arm_linux_processors[i].features2;
|
||||
}
|
||||
processors_with_features += 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* On GNU/Linux getauxval is always available */
|
||||
cpuinfo_arm_linux_hwcap_from_getauxval(&isa_features, &isa_features2);
|
||||
#endif
|
||||
cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
isa_features, isa_features2,
|
||||
last_midr, last_architecture_version, last_architecture_flags,
|
||||
&chipset, &cpuinfo_isa);
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
uint32_t isa_features = 0, isa_features2 = 0;
|
||||
/* getauxval is always available on ARM64 Android */
|
||||
cpuinfo_arm_linux_hwcap_from_getauxval(&isa_features, &isa_features2);
|
||||
cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
isa_features, isa_features2, last_midr, &chipset, &cpuinfo_isa);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* On GNU/Linux getauxval is always available */
|
||||
cpuinfo_arm_linux_hwcap_from_getauxval(&isa_features, &isa_features2);
|
||||
#endif
|
||||
cpuinfo_arm_linux_decode_isa_from_proc_cpuinfo(
|
||||
isa_features,
|
||||
isa_features2,
|
||||
last_midr,
|
||||
last_architecture_version,
|
||||
last_architecture_flags,
|
||||
&chipset,
|
||||
&cpuinfo_isa);
|
||||
#elif CPUINFO_ARCH_ARM64
|
||||
uint32_t isa_features = 0, isa_features2 = 0;
|
||||
/* getauxval is always available on ARM64 Android */
|
||||
cpuinfo_arm_linux_hwcap_from_getauxval(&isa_features, &isa_features2);
|
||||
cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
|
||||
isa_features, isa_features2, last_midr, &chipset, &cpuinfo_isa);
|
||||
#endif
|
||||
|
||||
/* Detect min/max frequency and package ID */
|
||||
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
|
||||
@@ -318,8 +340,9 @@ void cpuinfo_arm_linux_init(void) {
|
||||
|
||||
if (arm_linux_processors[i].flags & CPUINFO_LINUX_FLAG_PACKAGE_ID) {
|
||||
cpuinfo_linux_detect_core_siblings(
|
||||
arm_linux_processors_count, i,
|
||||
(cpuinfo_siblings_callback) cluster_siblings_parser,
|
||||
arm_linux_processors_count,
|
||||
i,
|
||||
(cpuinfo_siblings_callback)cluster_siblings_parser,
|
||||
arm_linux_processors);
|
||||
}
|
||||
}
|
||||
@@ -327,79 +350,107 @@ void cpuinfo_arm_linux_init(void) {
|
||||
/* Propagate all cluster IDs */
|
||||
uint32_t clustered_processors = 0;
|
||||
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID | CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER)) {
|
||||
if (bitmask_all(
|
||||
arm_linux_processors[i].flags,
|
||||
CPUINFO_LINUX_FLAG_VALID | CPUINFO_LINUX_FLAG_PACKAGE_CLUSTER)) {
|
||||
clustered_processors += 1;
|
||||
|
||||
const uint32_t package_leader_id = arm_linux_processors[i].package_leader_id;
|
||||
if (package_leader_id < i) {
|
||||
arm_linux_processors[i].package_leader_id = arm_linux_processors[package_leader_id].package_leader_id;
|
||||
arm_linux_processors[i].package_leader_id =
|
||||
arm_linux_processors[package_leader_id].package_leader_id;
|
||||
}
|
||||
|
||||
cpuinfo_log_debug("processor %"PRIu32" clustered with processor %"PRIu32" as inferred from system siblings lists",
|
||||
i, arm_linux_processors[i].package_leader_id);
|
||||
cpuinfo_log_debug(
|
||||
"processor %" PRIu32 " clustered with processor %" PRIu32
|
||||
" as inferred from system siblings lists",
|
||||
i,
|
||||
arm_linux_processors[i].package_leader_id);
|
||||
}
|
||||
}
|
||||
|
||||
if (clustered_processors != valid_processors) {
|
||||
/*
|
||||
* Topology information about some or all logical processors may be unavailable, for the following reasons:
|
||||
* - Linux kernel is too old, or configured without support for topology information in sysfs.
|
||||
* - Core is offline, and Linux kernel is configured to not report topology for offline cores.
|
||||
* Topology information about some or all logical processors may
|
||||
* be unavailable, for the following reasons:
|
||||
* - Linux kernel is too old, or configured without support for
|
||||
* topology information in sysfs.
|
||||
* - Core is offline, and Linux kernel is configured to not
|
||||
* report topology for offline cores.
|
||||
*
|
||||
* In this case, we assign processors to clusters using two methods:
|
||||
* - Try heuristic cluster configurations (e.g. 6-core SoC usually has 4+2 big.LITTLE configuration).
|
||||
* - If heuristic failed, assign processors to core clusters in a sequential scan.
|
||||
* In this case, we assign processors to clusters using two
|
||||
* methods:
|
||||
* - Try heuristic cluster configurations (e.g. 6-core SoC
|
||||
* usually has 4+2 big.LITTLE configuration).
|
||||
* - If heuristic failed, assign processors to core clusters in
|
||||
* a sequential scan.
|
||||
*/
|
||||
if (!cpuinfo_arm_linux_detect_core_clusters_by_heuristic(valid_processors, arm_linux_processors_count, arm_linux_processors)) {
|
||||
cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(arm_linux_processors_count, arm_linux_processors);
|
||||
if (!cpuinfo_arm_linux_detect_core_clusters_by_heuristic(
|
||||
valid_processors, arm_linux_processors_count, arm_linux_processors)) {
|
||||
cpuinfo_arm_linux_detect_core_clusters_by_sequential_scan(
|
||||
arm_linux_processors_count, arm_linux_processors);
|
||||
}
|
||||
}
|
||||
|
||||
cpuinfo_arm_linux_count_cluster_processors(arm_linux_processors_count, arm_linux_processors);
|
||||
|
||||
const uint32_t cluster_count = cpuinfo_arm_linux_detect_cluster_midr(
|
||||
&chipset,
|
||||
arm_linux_processors_count, valid_processors, arm_linux_processors);
|
||||
&chipset, arm_linux_processors_count, valid_processors, arm_linux_processors);
|
||||
|
||||
/* Initialize core vendor, uarch, MIDR, and frequency for every logical processor */
|
||||
/* Initialize core vendor, uarch, MIDR, and frequency for every logical
|
||||
* processor */
|
||||
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
const uint32_t cluster_leader = arm_linux_processors[i].package_leader_id;
|
||||
if (cluster_leader == i) {
|
||||
/* Cluster leader: decode core vendor and uarch */
|
||||
/* Cluster leader: decode core vendor and uarch
|
||||
*/
|
||||
cpuinfo_arm_decode_vendor_uarch(
|
||||
arm_linux_processors[cluster_leader].midr,
|
||||
arm_linux_processors[cluster_leader].midr,
|
||||
#if CPUINFO_ARCH_ARM
|
||||
!!(arm_linux_processors[cluster_leader].features & CPUINFO_ARM_LINUX_FEATURE_VFPV4),
|
||||
!!(arm_linux_processors[cluster_leader].features &
|
||||
CPUINFO_ARM_LINUX_FEATURE_VFPV4),
|
||||
#endif
|
||||
&arm_linux_processors[cluster_leader].vendor,
|
||||
&arm_linux_processors[cluster_leader].uarch);
|
||||
&arm_linux_processors[cluster_leader].vendor,
|
||||
&arm_linux_processors[cluster_leader].uarch);
|
||||
} else {
|
||||
/* Cluster non-leader: copy vendor, uarch, MIDR, and frequency from cluster leader */
|
||||
/* Cluster non-leader: copy vendor, uarch, MIDR,
|
||||
* and frequency from cluster leader */
|
||||
arm_linux_processors[i].flags |= arm_linux_processors[cluster_leader].flags &
|
||||
(CPUINFO_ARM_LINUX_VALID_MIDR | CPUINFO_LINUX_FLAG_MAX_FREQUENCY);
|
||||
arm_linux_processors[i].midr = arm_linux_processors[cluster_leader].midr;
|
||||
arm_linux_processors[i].vendor = arm_linux_processors[cluster_leader].vendor;
|
||||
arm_linux_processors[i].uarch = arm_linux_processors[cluster_leader].uarch;
|
||||
arm_linux_processors[i].max_frequency = arm_linux_processors[cluster_leader].max_frequency;
|
||||
arm_linux_processors[i].max_frequency =
|
||||
arm_linux_processors[cluster_leader].max_frequency;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
cpuinfo_log_debug("post-analysis processor %"PRIu32": MIDR %08"PRIx32" frequency %"PRIu32,
|
||||
i, arm_linux_processors[i].midr, arm_linux_processors[i].max_frequency);
|
||||
cpuinfo_log_debug(
|
||||
"post-analysis processor %" PRIu32 ": MIDR %08" PRIx32 " frequency %" PRIu32,
|
||||
i,
|
||||
arm_linux_processors[i].midr,
|
||||
arm_linux_processors[i].max_frequency);
|
||||
}
|
||||
}
|
||||
|
||||
qsort(arm_linux_processors, arm_linux_processors_count,
|
||||
sizeof(struct cpuinfo_arm_linux_processor), cmp_arm_linux_processor);
|
||||
qsort(arm_linux_processors,
|
||||
arm_linux_processors_count,
|
||||
sizeof(struct cpuinfo_arm_linux_processor),
|
||||
cmp_arm_linux_processor);
|
||||
|
||||
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
cpuinfo_log_debug("post-sort processor %"PRIu32": system id %"PRIu32" MIDR %08"PRIx32" frequency %"PRIu32,
|
||||
i, arm_linux_processors[i].system_processor_id, arm_linux_processors[i].midr, arm_linux_processors[i].max_frequency);
|
||||
cpuinfo_log_debug(
|
||||
"post-sort processor %" PRIu32 ": system id %" PRIu32 " MIDR %08" PRIx32
|
||||
" frequency %" PRIu32,
|
||||
i,
|
||||
arm_linux_processors[i].system_processor_id,
|
||||
arm_linux_processors[i].midr,
|
||||
arm_linux_processors[i].max_frequency);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,8 +469,10 @@ void cpuinfo_arm_linux_init(void) {
|
||||
/*
|
||||
* Assumptions:
|
||||
* - No SMP (i.e. each core supports only one hardware thread).
|
||||
* - Level 1 instruction and data caches are private to the core clusters.
|
||||
* - Level 2 and level 3 cache is shared between cores in the same cluster.
|
||||
* - Level 1 instruction and data caches are private to the core
|
||||
* clusters.
|
||||
* - Level 2 and level 3 cache is shared between cores in the same
|
||||
* cluster.
|
||||
*/
|
||||
cpuinfo_arm_chipset_to_string(&chipset, package.name);
|
||||
package.processor_count = valid_processors;
|
||||
@@ -428,66 +481,84 @@ void cpuinfo_arm_linux_init(void) {
|
||||
|
||||
processors = calloc(valid_processors, sizeof(struct cpuinfo_processor));
|
||||
if (processors == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" logical processors",
|
||||
valid_processors * sizeof(struct cpuinfo_processor), valid_processors);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " logical processors",
|
||||
valid_processors * sizeof(struct cpuinfo_processor),
|
||||
valid_processors);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cores = calloc(valid_processors, sizeof(struct cpuinfo_core));
|
||||
if (cores == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" cores",
|
||||
valid_processors * sizeof(struct cpuinfo_core), valid_processors);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " cores",
|
||||
valid_processors * sizeof(struct cpuinfo_core),
|
||||
valid_processors);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
clusters = calloc(cluster_count, sizeof(struct cpuinfo_cluster));
|
||||
if (clusters == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" core clusters",
|
||||
cluster_count * sizeof(struct cpuinfo_cluster), cluster_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " core clusters",
|
||||
cluster_count * sizeof(struct cpuinfo_cluster),
|
||||
cluster_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
uarchs = calloc(uarchs_count, sizeof(struct cpuinfo_uarch_info));
|
||||
if (uarchs == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" microarchitectures",
|
||||
uarchs_count * sizeof(struct cpuinfo_uarch_info), uarchs_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " microarchitectures",
|
||||
uarchs_count * sizeof(struct cpuinfo_uarch_info),
|
||||
uarchs_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
linux_cpu_to_processor_map = calloc(arm_linux_processors_count, sizeof(struct cpuinfo_processor*));
|
||||
if (linux_cpu_to_processor_map == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %"PRIu32" logical processor mapping entries",
|
||||
arm_linux_processors_count * sizeof(struct cpuinfo_processor*), arm_linux_processors_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for %" PRIu32 " logical processor mapping entries",
|
||||
arm_linux_processors_count * sizeof(struct cpuinfo_processor*),
|
||||
arm_linux_processors_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
linux_cpu_to_core_map = calloc(arm_linux_processors_count, sizeof(struct cpuinfo_core*));
|
||||
if (linux_cpu_to_core_map == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %"PRIu32" core mapping entries",
|
||||
arm_linux_processors_count * sizeof(struct cpuinfo_core*), arm_linux_processors_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for %" PRIu32 " core mapping entries",
|
||||
arm_linux_processors_count * sizeof(struct cpuinfo_core*),
|
||||
arm_linux_processors_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (uarchs_count > 1) {
|
||||
linux_cpu_to_uarch_index_map = calloc(arm_linux_processors_count, sizeof(uint32_t));
|
||||
if (linux_cpu_to_uarch_index_map == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for %"PRIu32" uarch index mapping entries",
|
||||
arm_linux_processors_count * sizeof(uint32_t), arm_linux_processors_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for %" PRIu32 " uarch index mapping entries",
|
||||
arm_linux_processors_count * sizeof(uint32_t),
|
||||
arm_linux_processors_count);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
l1i = calloc(valid_processors, sizeof(struct cpuinfo_cache));
|
||||
if (l1i == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L1I caches",
|
||||
valid_processors * sizeof(struct cpuinfo_cache), valid_processors);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L1I caches",
|
||||
valid_processors * sizeof(struct cpuinfo_cache),
|
||||
valid_processors);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
l1d = calloc(valid_processors, sizeof(struct cpuinfo_cache));
|
||||
if (l1d == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L1D caches",
|
||||
valid_processors * sizeof(struct cpuinfo_cache), valid_processors);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L1D caches",
|
||||
valid_processors * sizeof(struct cpuinfo_cache),
|
||||
valid_processors);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -496,7 +567,7 @@ void cpuinfo_arm_linux_init(void) {
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
|
||||
if (uarchs_index == 0 || arm_linux_processors[i].uarch != last_uarch) {
|
||||
last_uarch = arm_linux_processors[i].uarch;
|
||||
uarchs[uarchs_index] = (struct cpuinfo_uarch_info) {
|
||||
uarchs[uarchs_index] = (struct cpuinfo_uarch_info){
|
||||
.uarch = arm_linux_processors[i].uarch,
|
||||
.midr = arm_linux_processors[i].midr,
|
||||
};
|
||||
@@ -510,11 +581,11 @@ 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;
|
||||
clusters[cluster_id] = (struct cpuinfo_cluster) {
|
||||
clusters[cluster_id] = (struct cpuinfo_cluster){
|
||||
.processor_start = i,
|
||||
.processor_count = arm_linux_processors[i].package_processor_count,
|
||||
.core_start = i,
|
||||
@@ -531,7 +602,7 @@ void cpuinfo_arm_linux_init(void) {
|
||||
processors[i].core = cores + i;
|
||||
processors[i].cluster = clusters + cluster_id;
|
||||
processors[i].package = &package;
|
||||
processors[i].linux_id = (int) arm_linux_processors[i].system_processor_id;
|
||||
processors[i].linux_id = (int)arm_linux_processors[i].system_processor_id;
|
||||
processors[i].cache.l1i = l1i + i;
|
||||
processors[i].cache.l1d = l1d + i;
|
||||
linux_cpu_to_processor_map[arm_linux_processors[i].system_processor_id] = &processors[i];
|
||||
@@ -551,7 +622,7 @@ void cpuinfo_arm_linux_init(void) {
|
||||
arm_linux_processors[i].uarch_index;
|
||||
}
|
||||
|
||||
struct cpuinfo_cache temp_l2 = { 0 }, temp_l3 = { 0 };
|
||||
struct cpuinfo_cache temp_l2 = {0}, temp_l3 = {0};
|
||||
cpuinfo_arm_decode_cache(
|
||||
arm_linux_processors[i].uarch,
|
||||
arm_linux_processors[i].package_processor_count,
|
||||
@@ -559,38 +630,40 @@ void cpuinfo_arm_linux_init(void) {
|
||||
&chipset,
|
||||
cluster_id,
|
||||
arm_linux_processors[i].architecture_version,
|
||||
&l1i[i], &l1d[i], &temp_l2, &temp_l3);
|
||||
&l1i[i],
|
||||
&l1d[i],
|
||||
&temp_l2,
|
||||
&temp_l3);
|
||||
l1i[i].processor_start = l1d[i].processor_start = i;
|
||||
l1i[i].processor_count = l1d[i].processor_count = 1;
|
||||
#if CPUINFO_ARCH_ARM
|
||||
/* L1I reported in /proc/cpuinfo overrides defaults */
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_ARM_LINUX_VALID_ICACHE)) {
|
||||
l1i[i] = (struct cpuinfo_cache) {
|
||||
.size = arm_linux_processors[i].proc_cpuinfo_cache.i_size,
|
||||
.associativity = arm_linux_processors[i].proc_cpuinfo_cache.i_assoc,
|
||||
.sets = arm_linux_processors[i].proc_cpuinfo_cache.i_sets,
|
||||
.partitions = 1,
|
||||
.line_size = arm_linux_processors[i].proc_cpuinfo_cache.i_line_length
|
||||
};
|
||||
}
|
||||
/* L1D reported in /proc/cpuinfo overrides defaults */
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_ARM_LINUX_VALID_DCACHE)) {
|
||||
l1d[i] = (struct cpuinfo_cache) {
|
||||
.size = arm_linux_processors[i].proc_cpuinfo_cache.d_size,
|
||||
.associativity = arm_linux_processors[i].proc_cpuinfo_cache.d_assoc,
|
||||
.sets = arm_linux_processors[i].proc_cpuinfo_cache.d_sets,
|
||||
.partitions = 1,
|
||||
.line_size = arm_linux_processors[i].proc_cpuinfo_cache.d_line_length
|
||||
};
|
||||
}
|
||||
#endif
|
||||
#if CPUINFO_ARCH_ARM
|
||||
/* L1I reported in /proc/cpuinfo overrides defaults */
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_ARM_LINUX_VALID_ICACHE)) {
|
||||
l1i[i] = (struct cpuinfo_cache){
|
||||
.size = arm_linux_processors[i].proc_cpuinfo_cache.i_size,
|
||||
.associativity = arm_linux_processors[i].proc_cpuinfo_cache.i_assoc,
|
||||
.sets = arm_linux_processors[i].proc_cpuinfo_cache.i_sets,
|
||||
.partitions = 1,
|
||||
.line_size = arm_linux_processors[i].proc_cpuinfo_cache.i_line_length};
|
||||
}
|
||||
/* L1D reported in /proc/cpuinfo overrides defaults */
|
||||
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_ARM_LINUX_VALID_DCACHE)) {
|
||||
l1d[i] = (struct cpuinfo_cache){
|
||||
.size = arm_linux_processors[i].proc_cpuinfo_cache.d_size,
|
||||
.associativity = arm_linux_processors[i].proc_cpuinfo_cache.d_assoc,
|
||||
.sets = arm_linux_processors[i].proc_cpuinfo_cache.d_sets,
|
||||
.partitions = 1,
|
||||
.line_size = arm_linux_processors[i].proc_cpuinfo_cache.d_line_length};
|
||||
}
|
||||
#endif
|
||||
|
||||
if (temp_l3.size != 0) {
|
||||
/*
|
||||
* Assumptions:
|
||||
* - L2 is private to each core
|
||||
* - L3 is shared by cores in the same cluster
|
||||
* - If cores in different clusters report the same L3, it is shared between all cores.
|
||||
* - If cores in different clusters report the same L3,
|
||||
* it is shared between all cores.
|
||||
*/
|
||||
l2_count += 1;
|
||||
if (arm_linux_processors[i].package_leader_id == arm_linux_processors[i].system_processor_id) {
|
||||
@@ -598,17 +671,22 @@ void cpuinfo_arm_linux_init(void) {
|
||||
big_l3_size = temp_l3.size;
|
||||
l3_count = 1;
|
||||
} else if (temp_l3.size != big_l3_size) {
|
||||
/* If some cores have different L3 size, L3 is not shared between all cores */
|
||||
/* If some cores have different L3 size,
|
||||
* L3 is not shared between all cores */
|
||||
shared_l3 = false;
|
||||
l3_count += 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* If some cores don't have L3 cache, L3 is not shared between all cores */
|
||||
/* If some cores don't have L3 cache, L3 is not shared
|
||||
* between all cores
|
||||
*/
|
||||
shared_l3 = false;
|
||||
if (temp_l2.size != 0) {
|
||||
/* Assume L2 is shared by cores in the same cluster */
|
||||
if (arm_linux_processors[i].package_leader_id == arm_linux_processors[i].system_processor_id) {
|
||||
/* Assume L2 is shared by cores in the same
|
||||
* cluster */
|
||||
if (arm_linux_processors[i].package_leader_id ==
|
||||
arm_linux_processors[i].system_processor_id) {
|
||||
l2_count += 1;
|
||||
}
|
||||
}
|
||||
@@ -618,16 +696,20 @@ void cpuinfo_arm_linux_init(void) {
|
||||
if (l2_count != 0) {
|
||||
l2 = calloc(l2_count, sizeof(struct cpuinfo_cache));
|
||||
if (l2 == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L2 caches",
|
||||
l2_count * sizeof(struct cpuinfo_cache), l2_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L2 caches",
|
||||
l2_count * sizeof(struct cpuinfo_cache),
|
||||
l2_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (l3_count != 0) {
|
||||
l3 = calloc(l3_count, sizeof(struct cpuinfo_cache));
|
||||
if (l3 == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L3 caches",
|
||||
l3_count * sizeof(struct cpuinfo_cache), l3_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L3 caches",
|
||||
l3_count * sizeof(struct cpuinfo_cache),
|
||||
l3_count);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@@ -640,7 +722,7 @@ void cpuinfo_arm_linux_init(void) {
|
||||
cluster_id++;
|
||||
}
|
||||
|
||||
struct cpuinfo_cache dummy_l1i, dummy_l1d, temp_l2 = { 0 }, temp_l3 = { 0 };
|
||||
struct cpuinfo_cache dummy_l1i, dummy_l1d, temp_l2 = {0}, temp_l3 = {0};
|
||||
cpuinfo_arm_decode_cache(
|
||||
arm_linux_processors[i].uarch,
|
||||
arm_linux_processors[i].package_processor_count,
|
||||
@@ -648,23 +730,27 @@ void cpuinfo_arm_linux_init(void) {
|
||||
&chipset,
|
||||
cluster_id,
|
||||
arm_linux_processors[i].architecture_version,
|
||||
&dummy_l1i, &dummy_l1d, &temp_l2, &temp_l3);
|
||||
&dummy_l1i,
|
||||
&dummy_l1d,
|
||||
&temp_l2,
|
||||
&temp_l3);
|
||||
|
||||
if (temp_l3.size != 0) {
|
||||
/*
|
||||
* Assumptions:
|
||||
* - L2 is private to each core
|
||||
* - L3 is shared by cores in the same cluster
|
||||
* - If cores in different clusters report the same L3, it is shared between all cores.
|
||||
* - If cores in different clusters report the same L3,
|
||||
* it is shared between all cores.
|
||||
*/
|
||||
l2_index += 1;
|
||||
l2[l2_index] = (struct cpuinfo_cache) {
|
||||
.size = temp_l2.size,
|
||||
.associativity = temp_l2.associativity,
|
||||
.sets = temp_l2.sets,
|
||||
.partitions = 1,
|
||||
.line_size = temp_l2.line_size,
|
||||
.flags = temp_l2.flags,
|
||||
l2[l2_index] = (struct cpuinfo_cache){
|
||||
.size = temp_l2.size,
|
||||
.associativity = temp_l2.associativity,
|
||||
.sets = temp_l2.sets,
|
||||
.partitions = 1,
|
||||
.line_size = temp_l2.line_size,
|
||||
.flags = temp_l2.flags,
|
||||
.processor_start = i,
|
||||
.processor_count = 1,
|
||||
};
|
||||
@@ -672,16 +758,17 @@ void cpuinfo_arm_linux_init(void) {
|
||||
if (arm_linux_processors[i].package_leader_id == arm_linux_processors[i].system_processor_id) {
|
||||
l3_index += 1;
|
||||
if (l3_index < l3_count) {
|
||||
l3[l3_index] = (struct cpuinfo_cache) {
|
||||
.size = temp_l3.size,
|
||||
.associativity = temp_l3.associativity,
|
||||
.sets = temp_l3.sets,
|
||||
.partitions = 1,
|
||||
.line_size = temp_l3.line_size,
|
||||
.flags = temp_l3.flags,
|
||||
l3[l3_index] = (struct cpuinfo_cache){
|
||||
.size = temp_l3.size,
|
||||
.associativity = temp_l3.associativity,
|
||||
.sets = temp_l3.sets,
|
||||
.partitions = 1,
|
||||
.line_size = temp_l3.line_size,
|
||||
.flags = temp_l3.flags,
|
||||
.processor_start = i,
|
||||
.processor_count =
|
||||
shared_l3 ? valid_processors : arm_linux_processors[i].package_processor_count,
|
||||
.processor_count = shared_l3
|
||||
? valid_processors
|
||||
: arm_linux_processors[i].package_processor_count,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -694,13 +781,13 @@ void cpuinfo_arm_linux_init(void) {
|
||||
/* Assume L2 is shared by cores in the same cluster */
|
||||
if (arm_linux_processors[i].package_leader_id == arm_linux_processors[i].system_processor_id) {
|
||||
l2_index += 1;
|
||||
l2[l2_index] = (struct cpuinfo_cache) {
|
||||
.size = temp_l2.size,
|
||||
.associativity = temp_l2.associativity,
|
||||
.sets = temp_l2.sets,
|
||||
.partitions = 1,
|
||||
.line_size = temp_l2.line_size,
|
||||
.flags = temp_l2.flags,
|
||||
l2[l2_index] = (struct cpuinfo_cache){
|
||||
.size = temp_l2.size,
|
||||
.associativity = temp_l2.associativity,
|
||||
.sets = temp_l2.sets,
|
||||
.partitions = 1,
|
||||
.line_size = temp_l2.line_size,
|
||||
.flags = temp_l2.flags,
|
||||
.processor_start = i,
|
||||
.processor_count = arm_linux_processors[i].package_processor_count,
|
||||
};
|
||||
@@ -717,8 +804,8 @@ void cpuinfo_arm_linux_init(void) {
|
||||
cpuinfo_uarchs = uarchs;
|
||||
cpuinfo_cache[cpuinfo_cache_level_1i] = l1i;
|
||||
cpuinfo_cache[cpuinfo_cache_level_1d] = l1d;
|
||||
cpuinfo_cache[cpuinfo_cache_level_2] = l2;
|
||||
cpuinfo_cache[cpuinfo_cache_level_3] = l3;
|
||||
cpuinfo_cache[cpuinfo_cache_level_2] = l2;
|
||||
cpuinfo_cache[cpuinfo_cache_level_3] = l3;
|
||||
|
||||
cpuinfo_processors_count = valid_processors;
|
||||
cpuinfo_cores_count = valid_processors;
|
||||
@@ -727,8 +814,8 @@ void cpuinfo_arm_linux_init(void) {
|
||||
cpuinfo_uarchs_count = uarchs_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_1i] = valid_processors;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_1d] = valid_processors;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_2] = l2_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_3] = l3_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_2] = l2_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_3] = l3_count;
|
||||
cpuinfo_max_cache_size = cpuinfo_arm_compute_max_cache_size(&processors[0]);
|
||||
|
||||
cpuinfo_linux_cpu_max = arm_linux_processors_count;
|
||||
|
||||
1239
3rdparty/cpuinfo/src/arm/linux/midr.c
vendored
1239
3rdparty/cpuinfo/src/arm/linux/midr.c
vendored
File diff suppressed because it is too large
Load Diff
405
3rdparty/cpuinfo/src/arm/mach/init.c
vendored
405
3rdparty/cpuinfo/src/arm/mach/init.c
vendored
@@ -1,68 +1,50 @@
|
||||
#include <stdio.h>
|
||||
#include <alloca.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <alloca.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <mach/machine.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#include <mach/api.h>
|
||||
#include <cpuinfo/internal-api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
#include <mach/api.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
|
||||
#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) {
|
||||
size_t size = 0;
|
||||
uint32_t result = 0;
|
||||
int mib[2] = { CTL_HW, type_specifier };
|
||||
int mib[2] = {CTL_HW, type_specifier};
|
||||
if (sysctl(mib, 2, NULL, &size, NULL, 0) != 0) {
|
||||
cpuinfo_log_info("sysctl(\"%s\") failed: %s", name, strerror(errno));
|
||||
} else if (size == sizeof(uint32_t)) {
|
||||
sysctl(mib, 2, &result, &size, NULL, 0);
|
||||
cpuinfo_log_debug("%s: %"PRIu32 ", size = %lu", name, result, size);
|
||||
cpuinfo_log_debug("%s: %" PRIu32 ", size = %lu", name, result, size);
|
||||
} else {
|
||||
cpuinfo_log_info("sysctl does not support non-integer lookup for (\"%s\")", name);
|
||||
}
|
||||
@@ -76,17 +58,15 @@ static uint32_t get_sys_info_by_name(const char* type_specifier) {
|
||||
cpuinfo_log_info("sysctlbyname(\"%s\") failed: %s", type_specifier, strerror(errno));
|
||||
} else if (size == sizeof(uint32_t)) {
|
||||
sysctlbyname(type_specifier, &result, &size, NULL, 0);
|
||||
cpuinfo_log_debug("%s: %"PRIu32 ", size = %lu", type_specifier, result, size);
|
||||
cpuinfo_log_debug("%s: %" PRIu32 ", size = %lu", type_specifier, result, size);
|
||||
} else {
|
||||
cpuinfo_log_info("sysctl does not support non-integer lookup for (\"%s\")", 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:
|
||||
@@ -99,33 +79,26 @@ static enum cpuinfo_uarch decode_uarch(uint32_t cpu_family, uint32_t cpu_subtype
|
||||
/* 2x Monsoon + 4x Mistral cores */
|
||||
return core_index < 2 ? cpuinfo_uarch_monsoon : cpuinfo_uarch_mistral;
|
||||
case CPUFAMILY_ARM_VORTEX_TEMPEST:
|
||||
/* Hexa-core: 2x Vortex + 4x Tempest; Octa-core: 4x Cortex + 4x Tempest */
|
||||
/* Hexa-core: 2x Vortex + 4x Tempest; Octa-core: 4x
|
||||
* Cortex + 4x Tempest */
|
||||
return core_index + 4 < core_count ? cpuinfo_uarch_vortex : cpuinfo_uarch_tempest;
|
||||
case CPUFAMILY_ARM_LIGHTNING_THUNDER:
|
||||
/* Hexa-core: 2x Lightning + 4x Thunder; Octa-core (presumed): 4x Lightning + 4x Thunder */
|
||||
/* Hexa-core: 2x Lightning + 4x Thunder; Octa-core
|
||||
* (presumed): 4x Lightning + 4x Thunder */
|
||||
return core_index + 4 < core_count ? cpuinfo_uarch_lightning : cpuinfo_uarch_thunder;
|
||||
case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
|
||||
/* Hexa-core: 2x Firestorm + 4x Icestorm; Octa-core: 4x Firestorm + 4x 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) {
|
||||
@@ -135,7 +108,7 @@ static void decode_package_name(char* package_name) {
|
||||
return;
|
||||
}
|
||||
|
||||
char *machine_name = alloca(size);
|
||||
char* machine_name = alloca(size);
|
||||
if (sysctlbyname("hw.machine", machine_name, &size, NULL, 0) != 0) {
|
||||
cpuinfo_log_warning("sysctlbyname(\"hw.machine\") failed: %s", strerror(errno));
|
||||
return;
|
||||
@@ -144,7 +117,7 @@ static void decode_package_name(char* package_name) {
|
||||
|
||||
char name[10];
|
||||
uint32_t major = 0, minor = 0;
|
||||
if (sscanf(machine_name, "%9[^,0123456789]%"SCNu32",%"SCNu32, name, &major, &minor) != 3) {
|
||||
if (sscanf(machine_name, "%9[^,0123456789]%" SCNu32 ",%" SCNu32, name, &major, &minor) != 3) {
|
||||
cpuinfo_log_warning("parsing \"hw.machine\" failed: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
@@ -179,8 +152,9 @@ static void decode_package_name(char* package_name) {
|
||||
/* iPad 2 and up are supported */
|
||||
case 2:
|
||||
/*
|
||||
* iPad 2 [A5]: iPad2,1, iPad2,2, iPad2,3, iPad2,4
|
||||
* iPad mini [A5]: iPad2,5, iPad2,6, iPad2,7
|
||||
* iPad 2 [A5]: iPad2,1, iPad2,2, iPad2,3,
|
||||
* iPad2,4 iPad mini [A5]: iPad2,5, iPad2,6,
|
||||
* iPad2,7
|
||||
*/
|
||||
chip_model = major + 3;
|
||||
break;
|
||||
@@ -194,9 +168,10 @@ static void decode_package_name(char* package_name) {
|
||||
break;
|
||||
case 4:
|
||||
/*
|
||||
* iPad Air [A7]: iPad4,1, iPad4,2, iPad4,3
|
||||
* iPad mini Retina [A7]: iPad4,4, iPad4,5, iPad4,6
|
||||
* iPad mini 3 [A7]: iPad4,7, iPad4,8, iPad4,9
|
||||
* iPad Air [A7]: iPad4,1, iPad4,2,
|
||||
* iPad4,3 iPad mini Retina [A7]: iPad4,4,
|
||||
* iPad4,5, iPad4,6 iPad mini 3 [A7]:
|
||||
* iPad4,7, iPad4,8, iPad4,9
|
||||
*/
|
||||
chip_model = major + 3;
|
||||
break;
|
||||
@@ -248,7 +223,7 @@ static void decode_package_name(char* package_name) {
|
||||
cpuinfo_log_info("unknown device: %s", machine_name);
|
||||
}
|
||||
if (chip_model != 0) {
|
||||
snprintf(package_name, CPUINFO_PACKAGE_NAME_MAX, "Apple A%"PRIu32"%c", chip_model, suffix);
|
||||
snprintf(package_name, CPUINFO_PACKAGE_NAME_MAX, "Apple A%" PRIu32 "%c", chip_model, suffix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,20 +241,26 @@ void cpuinfo_arm_mach_init(void) {
|
||||
struct cpuinfo_mach_topology mach_topology = cpuinfo_mach_detect_topology();
|
||||
processors = calloc(mach_topology.threads, sizeof(struct cpuinfo_processor));
|
||||
if (processors == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" logical processors",
|
||||
mach_topology.threads * sizeof(struct cpuinfo_processor), mach_topology.threads);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " logical processors",
|
||||
mach_topology.threads * sizeof(struct cpuinfo_processor),
|
||||
mach_topology.threads);
|
||||
goto cleanup;
|
||||
}
|
||||
cores = calloc(mach_topology.cores, sizeof(struct cpuinfo_core));
|
||||
if (cores == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" cores",
|
||||
mach_topology.cores * sizeof(struct cpuinfo_core), mach_topology.cores);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " cores",
|
||||
mach_topology.cores * sizeof(struct cpuinfo_core),
|
||||
mach_topology.cores);
|
||||
goto cleanup;
|
||||
}
|
||||
packages = calloc(mach_topology.packages, sizeof(struct cpuinfo_package));
|
||||
if (packages == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" packages",
|
||||
mach_topology.packages * sizeof(struct cpuinfo_package), mach_topology.packages);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " packages",
|
||||
mach_topology.packages * sizeof(struct cpuinfo_package),
|
||||
mach_topology.packages);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -288,7 +269,7 @@ void cpuinfo_arm_mach_init(void) {
|
||||
const uint32_t cores_per_package = mach_topology.cores / mach_topology.packages;
|
||||
|
||||
for (uint32_t i = 0; i < mach_topology.packages; i++) {
|
||||
packages[i] = (struct cpuinfo_package) {
|
||||
packages[i] = (struct cpuinfo_package){
|
||||
.processor_start = i * threads_per_package,
|
||||
.processor_count = threads_per_package,
|
||||
.core_start = i * cores_per_package,
|
||||
@@ -297,84 +278,136 @@ void cpuinfo_arm_mach_init(void) {
|
||||
decode_package_name(packages[i].name);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
for (uint32_t i = 0; i < mach_topology.cores; i++) {
|
||||
cores[i] = (struct cpuinfo_core) {
|
||||
cores[i] = (struct cpuinfo_core){
|
||||
.processor_start = i * threads_per_core,
|
||||
.processor_count = threads_per_core,
|
||||
.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++;
|
||||
@@ -393,27 +426,29 @@ void cpuinfo_arm_mach_init(void) {
|
||||
clusters = calloc(num_clusters, sizeof(struct cpuinfo_cluster));
|
||||
if (clusters == NULL) {
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %"PRIu32" clusters",
|
||||
num_clusters * sizeof(struct cpuinfo_cluster), num_clusters);
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " clusters",
|
||||
num_clusters * sizeof(struct cpuinfo_cluster),
|
||||
num_clusters);
|
||||
goto cleanup;
|
||||
}
|
||||
uarchs = calloc(num_clusters, sizeof(struct cpuinfo_uarch_info));
|
||||
if (uarchs == NULL) {
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %"PRIu32" uarchs",
|
||||
num_clusters * sizeof(enum cpuinfo_uarch), num_clusters);
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " uarchs",
|
||||
num_clusters * sizeof(enum cpuinfo_uarch),
|
||||
num_clusters);
|
||||
goto cleanup;
|
||||
}
|
||||
uint32_t cluster_idx = UINT32_MAX;
|
||||
for (uint32_t i = 0; i < mach_topology.cores; i++) {
|
||||
if (i == 0 || cores[i].uarch != cores[i - 1].uarch) {
|
||||
cluster_idx++;
|
||||
uarchs[cluster_idx] = (struct cpuinfo_uarch_info) {
|
||||
uarchs[cluster_idx] = (struct cpuinfo_uarch_info){
|
||||
.uarch = cores[i].uarch,
|
||||
.processor_count = 1,
|
||||
.core_count = 1,
|
||||
};
|
||||
clusters[cluster_idx] = (struct cpuinfo_cluster) {
|
||||
clusters[cluster_idx] = (struct cpuinfo_cluster){
|
||||
.processor_start = i * threads_per_core,
|
||||
.processor_count = 1,
|
||||
.core_start = i,
|
||||
@@ -458,7 +493,7 @@ void cpuinfo_arm_mach_init(void) {
|
||||
/* Assume L1 caches are private to each core */
|
||||
threads_per_l1 = 1;
|
||||
l1_count = mach_topology.threads / threads_per_l1;
|
||||
cpuinfo_log_debug("detected %"PRIu32" L1 caches", l1_count);
|
||||
cpuinfo_log_debug("detected %" PRIu32 " L1 caches", l1_count);
|
||||
}
|
||||
|
||||
uint32_t threads_per_l2 = 0, l2_count = 0;
|
||||
@@ -466,7 +501,7 @@ void cpuinfo_arm_mach_init(void) {
|
||||
/* Assume L2 cache is shared between all cores */
|
||||
threads_per_l2 = mach_topology.cores;
|
||||
l2_count = 1;
|
||||
cpuinfo_log_debug("detected %"PRIu32" L2 caches", l2_count);
|
||||
cpuinfo_log_debug("detected %" PRIu32 " L2 caches", l2_count);
|
||||
}
|
||||
|
||||
uint32_t threads_per_l3 = 0, l3_count = 0;
|
||||
@@ -474,24 +509,26 @@ void cpuinfo_arm_mach_init(void) {
|
||||
/* Assume L3 cache is shared between all cores */
|
||||
threads_per_l3 = mach_topology.cores;
|
||||
l3_count = 1;
|
||||
cpuinfo_log_debug("detected %"PRIu32" L3 caches", l3_count);
|
||||
cpuinfo_log_debug("detected %" PRIu32 " L3 caches", l3_count);
|
||||
}
|
||||
|
||||
if (l1i_cache_size != 0) {
|
||||
l1i = calloc(l1_count, sizeof(struct cpuinfo_cache));
|
||||
if (l1i == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L1I caches",
|
||||
l1_count * sizeof(struct cpuinfo_cache), l1_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L1I caches",
|
||||
l1_count * sizeof(struct cpuinfo_cache),
|
||||
l1_count);
|
||||
goto cleanup;
|
||||
}
|
||||
for (uint32_t c = 0; c < l1_count; c++) {
|
||||
l1i[c] = (struct cpuinfo_cache) {
|
||||
.size = l1i_cache_size,
|
||||
.associativity = l1_cache_associativity,
|
||||
.sets = l1i_cache_size / (l1_cache_associativity * cacheline_size),
|
||||
.partitions = cache_partitions,
|
||||
.line_size = cacheline_size,
|
||||
.flags = cache_flags,
|
||||
l1i[c] = (struct cpuinfo_cache){
|
||||
.size = l1i_cache_size,
|
||||
.associativity = l1_cache_associativity,
|
||||
.sets = l1i_cache_size / (l1_cache_associativity * cacheline_size),
|
||||
.partitions = cache_partitions,
|
||||
.line_size = cacheline_size,
|
||||
.flags = cache_flags,
|
||||
.processor_start = c * threads_per_l1,
|
||||
.processor_count = threads_per_l1,
|
||||
};
|
||||
@@ -504,18 +541,20 @@ void cpuinfo_arm_mach_init(void) {
|
||||
if (l1d_cache_size != 0) {
|
||||
l1d = calloc(l1_count, sizeof(struct cpuinfo_cache));
|
||||
if (l1d == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L1D caches",
|
||||
l1_count * sizeof(struct cpuinfo_cache), l1_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L1D caches",
|
||||
l1_count * sizeof(struct cpuinfo_cache),
|
||||
l1_count);
|
||||
goto cleanup;
|
||||
}
|
||||
for (uint32_t c = 0; c < l1_count; c++) {
|
||||
l1d[c] = (struct cpuinfo_cache) {
|
||||
.size = l1d_cache_size,
|
||||
.associativity = l1_cache_associativity,
|
||||
.sets = l1d_cache_size / (l1_cache_associativity * cacheline_size),
|
||||
.partitions = cache_partitions,
|
||||
.line_size = cacheline_size,
|
||||
.flags = cache_flags,
|
||||
l1d[c] = (struct cpuinfo_cache){
|
||||
.size = l1d_cache_size,
|
||||
.associativity = l1_cache_associativity,
|
||||
.sets = l1d_cache_size / (l1_cache_associativity * cacheline_size),
|
||||
.partitions = cache_partitions,
|
||||
.line_size = cacheline_size,
|
||||
.flags = cache_flags,
|
||||
.processor_start = c * threads_per_l1,
|
||||
.processor_count = threads_per_l1,
|
||||
};
|
||||
@@ -528,18 +567,20 @@ void cpuinfo_arm_mach_init(void) {
|
||||
if (l2_count != 0) {
|
||||
l2 = calloc(l2_count, sizeof(struct cpuinfo_cache));
|
||||
if (l2 == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L2 caches",
|
||||
l2_count * sizeof(struct cpuinfo_cache), l2_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L2 caches",
|
||||
l2_count * sizeof(struct cpuinfo_cache),
|
||||
l2_count);
|
||||
goto cleanup;
|
||||
}
|
||||
for (uint32_t c = 0; c < l2_count; c++) {
|
||||
l2[c] = (struct cpuinfo_cache) {
|
||||
.size = l2_cache_size,
|
||||
.associativity = l2_cache_associativity,
|
||||
.sets = l2_cache_size / (l2_cache_associativity * cacheline_size),
|
||||
.partitions = cache_partitions,
|
||||
.line_size = cacheline_size,
|
||||
.flags = cache_flags,
|
||||
l2[c] = (struct cpuinfo_cache){
|
||||
.size = l2_cache_size,
|
||||
.associativity = l2_cache_associativity,
|
||||
.sets = l2_cache_size / (l2_cache_associativity * cacheline_size),
|
||||
.partitions = cache_partitions,
|
||||
.line_size = cacheline_size,
|
||||
.flags = cache_flags,
|
||||
.processor_start = c * threads_per_l2,
|
||||
.processor_count = threads_per_l2,
|
||||
};
|
||||
@@ -552,18 +593,20 @@ void cpuinfo_arm_mach_init(void) {
|
||||
if (l3_count != 0) {
|
||||
l3 = calloc(l3_count, sizeof(struct cpuinfo_cache));
|
||||
if (l3 == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L3 caches",
|
||||
l3_count * sizeof(struct cpuinfo_cache), l3_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L3 caches",
|
||||
l3_count * sizeof(struct cpuinfo_cache),
|
||||
l3_count);
|
||||
goto cleanup;
|
||||
}
|
||||
for (uint32_t c = 0; c < l3_count; c++) {
|
||||
l3[c] = (struct cpuinfo_cache) {
|
||||
.size = l3_cache_size,
|
||||
.associativity = l3_cache_associativity,
|
||||
.sets = l3_cache_size / (l3_cache_associativity * cacheline_size),
|
||||
.partitions = cache_partitions,
|
||||
.line_size = cacheline_size,
|
||||
.flags = cache_flags,
|
||||
l3[c] = (struct cpuinfo_cache){
|
||||
.size = l3_cache_size,
|
||||
.associativity = l3_cache_associativity,
|
||||
.sets = l3_cache_size / (l3_cache_associativity * cacheline_size),
|
||||
.partitions = cache_partitions,
|
||||
.line_size = cacheline_size,
|
||||
.flags = cache_flags,
|
||||
.processor_start = c * threads_per_l3,
|
||||
.processor_count = threads_per_l3,
|
||||
};
|
||||
@@ -581,8 +624,8 @@ void cpuinfo_arm_mach_init(void) {
|
||||
cpuinfo_uarchs = uarchs;
|
||||
cpuinfo_cache[cpuinfo_cache_level_1i] = l1i;
|
||||
cpuinfo_cache[cpuinfo_cache_level_1d] = l1d;
|
||||
cpuinfo_cache[cpuinfo_cache_level_2] = l2;
|
||||
cpuinfo_cache[cpuinfo_cache_level_3] = l3;
|
||||
cpuinfo_cache[cpuinfo_cache_level_2] = l2;
|
||||
cpuinfo_cache[cpuinfo_cache_level_3] = l3;
|
||||
|
||||
cpuinfo_processors_count = mach_topology.threads;
|
||||
cpuinfo_cores_count = mach_topology.cores;
|
||||
@@ -591,8 +634,8 @@ void cpuinfo_arm_mach_init(void) {
|
||||
cpuinfo_uarchs_count = num_clusters;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_1i] = l1_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_1d] = l1_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_2] = l2_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_3] = l3_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_2] = l2_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_3] = l3_count;
|
||||
cpuinfo_max_cache_size = cpuinfo_compute_max_cache_size(&processors[0]);
|
||||
|
||||
__sync_synchronize();
|
||||
|
||||
108
3rdparty/cpuinfo/src/arm/midr.h
vendored
108
3rdparty/cpuinfo/src/arm/midr.h
vendored
@@ -1,40 +1,39 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#define CPUINFO_ARM_MIDR_IMPLEMENTER_MASK UINT32_C(0xFF000000)
|
||||
#define CPUINFO_ARM_MIDR_VARIANT_MASK UINT32_C(0x00F00000)
|
||||
#define CPUINFO_ARM_MIDR_IMPLEMENTER_MASK UINT32_C(0xFF000000)
|
||||
#define CPUINFO_ARM_MIDR_VARIANT_MASK UINT32_C(0x00F00000)
|
||||
#define CPUINFO_ARM_MIDR_ARCHITECTURE_MASK UINT32_C(0x000F0000)
|
||||
#define CPUINFO_ARM_MIDR_PART_MASK UINT32_C(0x0000FFF0)
|
||||
#define CPUINFO_ARM_MIDR_REVISION_MASK UINT32_C(0x0000000F)
|
||||
#define CPUINFO_ARM_MIDR_PART_MASK UINT32_C(0x0000FFF0)
|
||||
#define CPUINFO_ARM_MIDR_REVISION_MASK UINT32_C(0x0000000F)
|
||||
|
||||
#define CPUINFO_ARM_MIDR_IMPLEMENTER_OFFSET 24
|
||||
#define CPUINFO_ARM_MIDR_VARIANT_OFFSET 20
|
||||
#define CPUINFO_ARM_MIDR_IMPLEMENTER_OFFSET 24
|
||||
#define CPUINFO_ARM_MIDR_VARIANT_OFFSET 20
|
||||
#define CPUINFO_ARM_MIDR_ARCHITECTURE_OFFSET 16
|
||||
#define CPUINFO_ARM_MIDR_PART_OFFSET 4
|
||||
#define CPUINFO_ARM_MIDR_REVISION_OFFSET 0
|
||||
#define CPUINFO_ARM_MIDR_PART_OFFSET 4
|
||||
#define CPUINFO_ARM_MIDR_REVISION_OFFSET 0
|
||||
|
||||
#define CPUINFO_ARM_MIDR_ARM1156 UINT32_C(0x410FB560)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A7 UINT32_C(0x410FC070)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A9 UINT32_C(0x410FC090)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A15 UINT32_C(0x410FC0F0)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A17 UINT32_C(0x410FC0E0)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A35 UINT32_C(0x410FD040)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A53 UINT32_C(0x410FD030)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A55 UINT32_C(0x410FD050)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A57 UINT32_C(0x410FD070)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A72 UINT32_C(0x410FD080)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A73 UINT32_C(0x410FD090)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A75 UINT32_C(0x410FD0A0)
|
||||
#define CPUINFO_ARM_MIDR_KRYO280_GOLD UINT32_C(0x51AF8001)
|
||||
#define CPUINFO_ARM_MIDR_KRYO280_SILVER UINT32_C(0x51AF8014)
|
||||
#define CPUINFO_ARM_MIDR_KRYO385_GOLD UINT32_C(0x518F802D)
|
||||
#define CPUINFO_ARM_MIDR_KRYO385_SILVER UINT32_C(0x518F803C)
|
||||
#define CPUINFO_ARM_MIDR_ARM1156 UINT32_C(0x410FB560)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A7 UINT32_C(0x410FC070)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A9 UINT32_C(0x410FC090)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A15 UINT32_C(0x410FC0F0)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A17 UINT32_C(0x410FC0E0)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A35 UINT32_C(0x410FD040)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A53 UINT32_C(0x410FD030)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A55 UINT32_C(0x410FD050)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A57 UINT32_C(0x410FD070)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A72 UINT32_C(0x410FD080)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A73 UINT32_C(0x410FD090)
|
||||
#define CPUINFO_ARM_MIDR_CORTEX_A75 UINT32_C(0x410FD0A0)
|
||||
#define CPUINFO_ARM_MIDR_KRYO280_GOLD UINT32_C(0x51AF8001)
|
||||
#define CPUINFO_ARM_MIDR_KRYO280_SILVER UINT32_C(0x51AF8014)
|
||||
#define CPUINFO_ARM_MIDR_KRYO385_GOLD UINT32_C(0x518F802D)
|
||||
#define CPUINFO_ARM_MIDR_KRYO385_SILVER UINT32_C(0x518F803C)
|
||||
#define CPUINFO_ARM_MIDR_KRYO_SILVER_821 UINT32_C(0x510F2010)
|
||||
#define CPUINFO_ARM_MIDR_KRYO_GOLD UINT32_C(0x510F2050)
|
||||
#define CPUINFO_ARM_MIDR_KRYO_GOLD UINT32_C(0x510F2050)
|
||||
#define CPUINFO_ARM_MIDR_KRYO_SILVER_820 UINT32_C(0x510F2110)
|
||||
#define CPUINFO_ARM_MIDR_EXYNOS_M1_M2 UINT32_C(0x530F0010)
|
||||
#define CPUINFO_ARM_MIDR_DENVER2 UINT32_C(0x4E0F0030)
|
||||
#define CPUINFO_ARM_MIDR_EXYNOS_M1_M2 UINT32_C(0x530F0010)
|
||||
#define CPUINFO_ARM_MIDR_DENVER2 UINT32_C(0x4E0F0030)
|
||||
|
||||
inline static uint32_t midr_set_implementer(uint32_t midr, uint32_t implementer) {
|
||||
return (midr & ~CPUINFO_ARM_MIDR_IMPLEMENTER_MASK) |
|
||||
@@ -174,23 +173,29 @@ 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 */
|
||||
@@ -200,14 +205,17 @@ inline static uint32_t midr_score_core(uint32_t midr) {
|
||||
/* These cores are always in big role */
|
||||
return 5;
|
||||
case UINT32_C(0x4100D070): /* Cortex-A57 */
|
||||
/* Cortex-A57 can be in LITTLE role w.r.t. Denver 2, or in big role w.r.t. Cortex-A53 */
|
||||
/* Cortex-A57 can be in LITTLE role w.r.t. Denver 2, or
|
||||
* in big role w.r.t. Cortex-A53 */
|
||||
return 4;
|
||||
#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 */
|
||||
/* Cortex-A53 is usually in LITTLE role, but can be in big role w.r.t. Cortex-A35 */
|
||||
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 */
|
||||
#if CPUINFO_ARCH_ARM
|
||||
@@ -222,10 +230,12 @@ inline static uint32_t midr_score_core(uint32_t midr) {
|
||||
return 1;
|
||||
default:
|
||||
/*
|
||||
* Unknown cores, or cores which do not have big/LITTLE roles.
|
||||
* To be future-proof w.r.t. cores not yet recognized in cpuinfo, assume position between
|
||||
* Cortex-A57/A72/A73/A75 and Cortex-A53/A55. Then at least future cores paired with
|
||||
* one of these known cores will be properly scored.
|
||||
* Unknown cores, or cores which do not have big/LITTLE
|
||||
* roles. To be future-proof w.r.t. cores not yet
|
||||
* recognized in cpuinfo, assume position between
|
||||
* Cortex-A57/A72/A73/A75 and Cortex-A53/A55. Then at
|
||||
* least future cores paired with one of these known
|
||||
* cores will be properly scored.
|
||||
*/
|
||||
return 3;
|
||||
}
|
||||
|
||||
163
3rdparty/cpuinfo/src/arm/tlb.c
vendored
163
3rdparty/cpuinfo/src/arm/tlb.c
vendored
@@ -5,23 +5,24 @@ switch (uarch) {
|
||||
/*
|
||||
* Cortex-A5 Technical Reference Manual:
|
||||
* 6.3.1. Micro TLB
|
||||
* The first level of caching for the page table information is a micro TLB of
|
||||
* 10 entries that is implemented on each of the instruction and data sides.
|
||||
* 6.3.2. Main TLB
|
||||
* Misses from the instruction and data micro TLBs are handled by a unified main TLB.
|
||||
* The main TLB is 128-entry two-way set-associative.
|
||||
* The first level of caching for the page table information
|
||||
* is a micro TLB of 10 entries that is implemented on each of
|
||||
* the instruction and data sides. 6.3.2. Main TLB Misses from
|
||||
* the instruction and data micro TLBs are handled by a unified
|
||||
* main TLB. The main TLB is 128-entry two-way set-associative.
|
||||
*/
|
||||
break;
|
||||
case cpuinfo_uarch_cortex_a7:
|
||||
/*
|
||||
* Cortex-A7 MPCore Technical Reference Manual:
|
||||
* 5.3.1. Micro TLB
|
||||
* The first level of caching for the page table information is a micro TLB of
|
||||
* 10 entries that is implemented on each of the instruction and data sides.
|
||||
* 5.3.2. Main TLB
|
||||
* Misses from the micro TLBs are handled by a unified main TLB. This is a 256-entry 2-way
|
||||
* set-associative structure. The main TLB supports all the VMSAv7 page sizes of
|
||||
* 4KB, 64KB, 1MB and 16MB in addition to the LPAE page sizes of 2MB and 1G.
|
||||
* The first level of caching for the page table information
|
||||
* is a micro TLB of 10 entries that is implemented on each of
|
||||
* the instruction and data sides. 5.3.2. Main TLB Misses from
|
||||
* the micro TLBs are handled by a unified main TLB. This is a
|
||||
* 256-entry 2-way set-associative structure. The main TLB
|
||||
* supports all the VMSAv7 page sizes of 4KB, 64KB, 1MB and 16MB
|
||||
* in addition to the LPAE page sizes of 2MB and 1G.
|
||||
*/
|
||||
break;
|
||||
case cpuinfo_uarch_cortex_a8:
|
||||
@@ -29,7 +30,8 @@ switch (uarch) {
|
||||
* Cortex-A8 Technical Reference Manual:
|
||||
* 6.1. About the MMU
|
||||
* The MMU features include the following:
|
||||
* - separate, fully-associative, 32-entry data and instruction TLBs
|
||||
* - separate, fully-associative, 32-entry data and
|
||||
* instruction TLBs
|
||||
* - TLB entries that support 4KB, 64KB, 1MB, and 16MB pages
|
||||
*/
|
||||
break;
|
||||
@@ -37,51 +39,63 @@ switch (uarch) {
|
||||
/*
|
||||
* ARM Cortex‑A9 Technical Reference Manual:
|
||||
* 6.2.1 Micro TLB
|
||||
* The first level of caching for the page table information is a micro TLB of 32 entries on the data side,
|
||||
* and configurable 32 or 64 entries on the instruction side.
|
||||
* 6.2.2 Main TLB
|
||||
* The main TLB is implemented as a combination of:
|
||||
* The first level of caching for the page table information
|
||||
* is a micro TLB of 32 entries on the data side, and
|
||||
* configurable 32 or 64 entries on the instruction side. 6.2.2
|
||||
* Main TLB The main TLB is implemented as a combination of:
|
||||
* - A fully-associative, lockable array of four elements.
|
||||
* - A 2-way associative structure of 2x32, 2x64, 2x128 or 2x256 entries.
|
||||
* - A 2-way associative structure of 2x32, 2x64, 2x128 or
|
||||
* 2x256 entries.
|
||||
*/
|
||||
break;
|
||||
case cpuinfo_uarch_cortex_a15:
|
||||
/*
|
||||
* ARM Cortex-A15 MPCore Processor Technical Reference Manual:
|
||||
* 5.2.1. L1 instruction TLB
|
||||
* The L1 instruction TLB is a 32-entry fully-associative structure. This TLB caches entries at the 4KB
|
||||
* granularity of Virtual Address (VA) to Physical Address (PA) mapping only. If the page tables map the
|
||||
* memory region to a larger granularity than 4K, it only allocates one mapping for the particular 4K region
|
||||
* to which the current access corresponds.
|
||||
* 5.2.2. L1 data TLB
|
||||
* There are two separate 32-entry fully-associative TLBs that are used for data loads and stores,
|
||||
* respectively. Similar to the L1 instruction TLB, both of these cache entries at the 4KB granularity of
|
||||
* VA to PA mappings only. At implementation time, the Cortex-A15 MPCore processor can be configured with
|
||||
* the -l1tlb_1m option, to have the L1 data TLB cache entries at both the 4KB and 1MB granularity.
|
||||
* With this configuration, any translation that results in a 1MB or larger page is cached in the L1 data
|
||||
* TLB as a 1MB entry. Any translation that results in a page smaller than 1MB is cached in the L1 data TLB
|
||||
* as a 4KB entry. By default, all translations are cached in the L1 data TLB as a 4KB entry.
|
||||
* 5.2.3. L2 TLB
|
||||
* Misses from the L1 instruction and data TLBs are handled by a unified L2 TLB. This is a 512-entry 4-way
|
||||
* set-associative structure. The L2 TLB supports all the VMSAv7 page sizes of 4K, 64K, 1MB and 16MB in
|
||||
* addition to the LPAE page sizes of 2MB and 1GB.
|
||||
* The L1 instruction TLB is a 32-entry fully-associative
|
||||
* structure. This TLB caches entries at the 4KB granularity of
|
||||
* Virtual Address (VA) to Physical Address (PA) mapping only.
|
||||
* If the page tables map the memory region to a larger
|
||||
* granularity than 4K, it only allocates one mapping for the
|
||||
* particular 4K region to which the current access
|
||||
* corresponds. 5.2.2. L1 data TLB There are two separate
|
||||
* 32-entry fully-associative TLBs that are used for data loads
|
||||
* and stores, respectively. Similar to the L1 instruction TLB,
|
||||
* both of these cache entries at the 4KB granularity of VA to
|
||||
* PA mappings only. At implementation time, the Cortex-A15
|
||||
* MPCore processor can be configured with the -l1tlb_1m option,
|
||||
* to have the L1 data TLB cache entries at both the 4KB and 1MB
|
||||
* granularity. With this configuration, any translation that
|
||||
* results in a 1MB or larger page is cached in the L1 data TLB
|
||||
* as a 1MB entry. Any translation that results in a page
|
||||
* smaller than 1MB is cached in the L1 data TLB as a 4KB entry.
|
||||
* By default, all translations are cached in the L1 data TLB as
|
||||
* a 4KB entry. 5.2.3. L2 TLB Misses from the L1 instruction and
|
||||
* data TLBs are handled by a unified L2 TLB. This is a
|
||||
* 512-entry 4-way set-associative structure. The L2 TLB
|
||||
* supports all the VMSAv7 page sizes of 4K, 64K, 1MB and 16MB
|
||||
* in addition to the LPAE page sizes of 2MB and 1GB.
|
||||
*/
|
||||
break;
|
||||
case cpuinfo_uarch_cortex_a17:
|
||||
/*
|
||||
* ARM Cortex-A17 MPCore Processor Technical Reference Manual:
|
||||
* 5.2.1. Instruction micro TLB
|
||||
* The instruction micro TLB is implemented as a 32, 48 or 64 entry, fully-associative structure. This TLB
|
||||
* caches entries at the 4KB and 1MB granularity of Virtual Address (VA) to Physical Address (PA) mapping
|
||||
* only. If the translation tables map the memory region to a larger granularity than 4KB or 1MB, it only
|
||||
* allocates one mapping for the particular 4KB region to which the current access corresponds.
|
||||
* 5.2.2. Data micro TLB
|
||||
* The data micro TLB is a 32 entry fully-associative TLB that is used for data loads and stores. The cache
|
||||
* entries have a 4KB and 1MB granularity of VA to PA mappings only.
|
||||
* 5.2.3. Unified main TLB
|
||||
* Misses from the instruction and data micro TLBs are handled by a unified main TLB. This is a 1024 entry
|
||||
* 4-way set-associative structure. The main TLB supports all the VMSAv7 page sizes of 4K, 64K, 1MB and 16MB
|
||||
* in addition to the LPAE page sizes of 2MB and 1GB.
|
||||
* The instruction micro TLB is implemented as a 32, 48 or 64
|
||||
* entry, fully-associative structure. This TLB caches entries
|
||||
* at the 4KB and 1MB granularity of Virtual Address (VA) to
|
||||
* Physical Address (PA) mapping only. If the translation tables
|
||||
* map the memory region to a larger granularity than 4KB or
|
||||
* 1MB, it only allocates one mapping for the particular 4KB
|
||||
* region to which the current access corresponds. 5.2.2. Data
|
||||
* micro TLB The data micro TLB is a 32 entry fully-associative
|
||||
* TLB that is used for data loads and stores. The cache entries
|
||||
* have a 4KB and 1MB granularity of VA to PA mappings
|
||||
* only. 5.2.3. Unified main TLB Misses from the instruction and
|
||||
* data micro TLBs are handled by a unified main TLB. This is a
|
||||
* 1024 entry 4-way set-associative structure. The main TLB
|
||||
* supports all the VMSAv7 page sizes of 4K, 64K, 1MB and 16MB
|
||||
* in addition to the LPAE page sizes of 2MB and 1GB.
|
||||
*/
|
||||
break;
|
||||
case cpuinfo_uarch_cortex_a35:
|
||||
@@ -89,45 +103,52 @@ switch (uarch) {
|
||||
* ARM Cortex‑A35 Processor Technical Reference Manual:
|
||||
* A6.2 TLB Organization
|
||||
* Micro TLB
|
||||
* The first level of caching for the translation table information is a micro TLB of ten entries that
|
||||
* is implemented on each of the instruction and data sides.
|
||||
* Main TLB
|
||||
* A unified main TLB handles misses from the micro TLBs. It has a 512-entry, 2-way, set-associative
|
||||
* structure and supports all VMSAv8 block sizes, except 1GB. If it fetches a 1GB block, the TLB splits
|
||||
* it into 512MB blocks and stores the appropriate block for the lookup.
|
||||
* The first level of caching for the translation table
|
||||
* information is a micro TLB of ten entries that is implemented
|
||||
* on each of the instruction and data sides. Main TLB A unified
|
||||
* main TLB handles misses from the micro TLBs. It has a
|
||||
* 512-entry, 2-way, set-associative structure and supports all
|
||||
* VMSAv8 block sizes, except 1GB. If it fetches a 1GB block,
|
||||
* the TLB splits it into 512MB blocks and stores the
|
||||
* appropriate block for the lookup.
|
||||
*/
|
||||
break;
|
||||
case cpuinfo_uarch_cortex_a53:
|
||||
/*
|
||||
* ARM Cortex-A53 MPCore Processor Technical Reference Manual:
|
||||
* 5.2.1. Micro TLB
|
||||
* The first level of caching for the translation table information is a micro TLB of ten entries that is
|
||||
* implemented on each of the instruction and data sides.
|
||||
* 5.2.2. Main TLB
|
||||
* A unified main TLB handles misses from the micro TLBs. This is a 512-entry, 4-way, set-associative
|
||||
* structure. The main TLB supports all VMSAv8 block sizes, except 1GB. If a 1GB block is fetched, it is
|
||||
* split into 512MB blocks and the appropriate block for the lookup stored.
|
||||
* The first level of caching for the translation table
|
||||
* information is a micro TLB of ten entries that is implemented
|
||||
* on each of the instruction and data sides. 5.2.2. Main TLB A
|
||||
* unified main TLB handles misses from the micro TLBs. This is
|
||||
* a 512-entry, 4-way, set-associative structure. The main TLB
|
||||
* supports all VMSAv8 block sizes, except 1GB. If a 1GB block
|
||||
* is fetched, it is split into 512MB blocks and the appropriate
|
||||
* block for the lookup stored.
|
||||
*/
|
||||
break;
|
||||
case cpuinfo_uarch_cortex_a57:
|
||||
/*
|
||||
* ARM® Cortex-A57 MPCore Processor Technical Reference Manual:
|
||||
* 5.2.1 L1 instruction TLB
|
||||
* The L1 instruction TLB is a 48-entry fully-associative structure. This TLB caches entries of three
|
||||
* different page sizes, natively 4KB, 64KB, and 1MB, of VA to PA mappings. If the page tables map the memory
|
||||
* region to a larger granularity than 1MB, it only allocates one mapping for the particular 1MB region to
|
||||
* which the current access corresponds.
|
||||
* 5.2.2 L1 data TLB
|
||||
* The L1 data TLB is a 32-entry fully-associative TLB that is used for data loads and stores. This TLB
|
||||
* caches entries of three different page sizes, natively 4KB, 64KB, and 1MB, of VA to PA mappings.
|
||||
* 5.2.3 L2 TLB
|
||||
* Misses from the L1 instruction and data TLBs are handled by a unified L2 TLB. This is a 1024-entry 4-way
|
||||
* set-associative structure. The L2 TLB supports the page sizes of 4K, 64K, 1MB and 16MB. It also supports
|
||||
* page sizes of 2MB and 1GB for the long descriptor format translation in AArch32 state and in AArch64 state
|
||||
* when using the 4KB translation granule. In addition, the L2 TLB supports the 512MB page map size defined
|
||||
* for the AArch64 translations that use a 64KB translation granule.
|
||||
* The L1 instruction TLB is a 48-entry fully-associative
|
||||
* structure. This TLB caches entries of three different page
|
||||
* sizes, natively 4KB, 64KB, and 1MB, of VA to PA mappings. If
|
||||
* the page tables map the memory region to a larger granularity
|
||||
* than 1MB, it only allocates one mapping for the particular
|
||||
* 1MB region to which the current access corresponds. 5.2.2 L1
|
||||
* data TLB The L1 data TLB is a 32-entry fully-associative TLB
|
||||
* that is used for data loads and stores. This TLB caches
|
||||
* entries of three different page sizes, natively 4KB, 64KB,
|
||||
* and 1MB, of VA to PA mappings. 5.2.3 L2 TLB Misses from the
|
||||
* L1 instruction and data TLBs are handled by a unified L2 TLB.
|
||||
* This is a 1024-entry 4-way set-associative structure. The L2
|
||||
* TLB supports the page sizes of 4K, 64K, 1MB and 16MB. It also
|
||||
* supports page sizes of 2MB and 1GB for the long descriptor
|
||||
* format translation in AArch32 state and in AArch64 state when
|
||||
* using the 4KB translation granule. In addition, the L2 TLB
|
||||
* supports the 512MB page map size defined for the AArch64
|
||||
* translations that use a 64KB translation granule.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
174
3rdparty/cpuinfo/src/arm/uarch.c
vendored
174
3rdparty/cpuinfo/src/arm/uarch.c
vendored
@@ -4,15 +4,13 @@
|
||||
#include <arm/midr.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
|
||||
void cpuinfo_arm_decode_vendor_uarch(
|
||||
uint32_t midr,
|
||||
#if CPUINFO_ARCH_ARM
|
||||
bool has_vfpv4,
|
||||
#endif /* CPUINFO_ARCH_ARM */
|
||||
enum cpuinfo_vendor vendor[restrict static 1],
|
||||
enum cpuinfo_uarch uarch[restrict static 1])
|
||||
{
|
||||
enum cpuinfo_uarch uarch[restrict static 1]) {
|
||||
switch (midr_get_implementer(midr)) {
|
||||
case 'A':
|
||||
*vendor = cpuinfo_vendor_arm;
|
||||
@@ -39,8 +37,9 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
case 0xC0D:
|
||||
/*
|
||||
* Rockchip RK3288 only.
|
||||
* Core information is ambiguous: some sources specify Cortex-A12, others - Cortex-A17.
|
||||
* Assume it is Cortex-A12.
|
||||
* Core information is ambiguous: some
|
||||
* sources specify Cortex-A12, others -
|
||||
* Cortex-A17. Assume it is Cortex-A12.
|
||||
*/
|
||||
*uarch = cpuinfo_uarch_cortex_a12;
|
||||
break;
|
||||
@@ -58,9 +57,11 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
*uarch = cpuinfo_uarch_cortex_a35;
|
||||
break;
|
||||
case 0xD05:
|
||||
// Note: use Variant, not Revision, field
|
||||
*uarch = (midr & CPUINFO_ARM_MIDR_VARIANT_MASK) == 0 ?
|
||||
cpuinfo_uarch_cortex_a55r0 : cpuinfo_uarch_cortex_a55;
|
||||
// Note: use Variant, not Revision,
|
||||
// field
|
||||
*uarch = (midr & CPUINFO_ARM_MIDR_VARIANT_MASK) == 0
|
||||
? cpuinfo_uarch_cortex_a55r0
|
||||
: cpuinfo_uarch_cortex_a55;
|
||||
break;
|
||||
case 0xD06:
|
||||
*uarch = cpuinfo_uarch_cortex_a65;
|
||||
@@ -80,28 +81,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
|
||||
@@ -116,7 +139,9 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
break;
|
||||
#endif /* CPUINFO_ARCH_ARM */
|
||||
default:
|
||||
cpuinfo_log_warning("unknown ARM CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
cpuinfo_log_warning(
|
||||
"unknown ARM CPU part 0x%03" PRIx32 " ignored",
|
||||
midr_get_part(midr));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -129,18 +154,22 @@ 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 */
|
||||
/* 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));
|
||||
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)) {
|
||||
@@ -154,24 +183,27 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
*uarch = cpuinfo_uarch_thunderx2;
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_warning("unknown Cavium CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
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
|
||||
case 0xD40: /* Kirin 980 Big/Medium cores -> Cortex-A76 */
|
||||
#endif /* CPUINFO_ARCH_ARM64 */
|
||||
case 0xD40: /* Kirin 980 Big/Medium cores ->
|
||||
Cortex-A76 */
|
||||
*vendor = cpuinfo_vendor_arm;
|
||||
*uarch = cpuinfo_uarch_cortex_a76;
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_warning("unknown Huawei CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
cpuinfo_log_warning(
|
||||
"unknown Huawei CPU part 0x%03" PRIx32 " ignored", midr_get_part(midr));
|
||||
}
|
||||
break;
|
||||
#if CPUINFO_ARCH_ARM
|
||||
@@ -184,7 +216,8 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
*uarch = cpuinfo_uarch_xscale;
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_warning("unknown Intel CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
cpuinfo_log_warning(
|
||||
"unknown Intel CPU part 0x%03" PRIx32 " ignored", midr_get_part(midr));
|
||||
}
|
||||
break;
|
||||
#endif /* CPUINFO_ARCH_ARM */
|
||||
@@ -201,10 +234,10 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
*uarch = cpuinfo_uarch_carmel;
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_warning("unknown Nvidia CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
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)) {
|
||||
@@ -212,18 +245,22 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
*uarch = cpuinfo_uarch_xgene;
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_warning("unknown Applied Micro CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
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)) {
|
||||
#if CPUINFO_ARCH_ARM
|
||||
case 0x00F:
|
||||
/* Mostly Scorpions, but some Cortex A5 may report this value as well */
|
||||
/* Mostly Scorpions, but some Cortex A5
|
||||
* may report this value as well
|
||||
*/
|
||||
if (has_vfpv4) {
|
||||
/* Unlike Scorpion, Cortex-A5 comes with VFPv4 */
|
||||
/* Unlike Scorpion, Cortex-A5
|
||||
* comes with VFPv4 */
|
||||
*vendor = cpuinfo_vendor_arm;
|
||||
*uarch = cpuinfo_uarch_cortex_a5;
|
||||
} else {
|
||||
@@ -246,52 +283,66 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
* - r0p1 -> Krait 200
|
||||
* - r0p2 -> Krait 200
|
||||
* - r1p0 -> Krait 300
|
||||
* - r2p0 -> Krait 400 (Snapdragon 800 MSMxxxx)
|
||||
* - r2p1 -> Krait 400 (Snapdragon 801 MSMxxxxPRO)
|
||||
* - r2p0 -> Krait 400 (Snapdragon 800
|
||||
* MSMxxxx)
|
||||
* - r2p1 -> Krait 400 (Snapdragon 801
|
||||
* MSMxxxxPRO)
|
||||
* - r3p1 -> Krait 450
|
||||
*/
|
||||
*uarch = cpuinfo_uarch_krait;
|
||||
break;
|
||||
#endif /* CPUINFO_ARCH_ARM */
|
||||
case 0x201: /* Qualcomm Snapdragon 821: Low-power Kryo "Silver" */
|
||||
case 0x205: /* Qualcomm Snapdragon 820 & 821: High-performance Kryo "Gold" */
|
||||
case 0x211: /* Qualcomm Snapdragon 820: Low-power Kryo "Silver" */
|
||||
case 0x201: /* Qualcomm Snapdragon 821:
|
||||
Low-power Kryo "Silver" */
|
||||
case 0x205: /* Qualcomm Snapdragon 820 & 821:
|
||||
High-performance Kryo "Gold" */
|
||||
case 0x211: /* Qualcomm Snapdragon 820:
|
||||
Low-power Kryo "Silver" */
|
||||
*uarch = cpuinfo_uarch_kryo;
|
||||
break;
|
||||
case 0x800: /* High-performance Kryo 260 (r10p2) / Kryo 280 (r10p1) "Gold" -> Cortex-A73 */
|
||||
case 0x800: /* High-performance Kryo 260 (r10p2)
|
||||
/ Kryo 280 (r10p1) "Gold" ->
|
||||
Cortex-A73 */
|
||||
*vendor = cpuinfo_vendor_arm;
|
||||
*uarch = cpuinfo_uarch_cortex_a73;
|
||||
break;
|
||||
case 0x801: /* Low-power Kryo 260 / 280 "Silver" -> Cortex-A53 */
|
||||
case 0x801: /* Low-power Kryo 260 / 280 "Silver"
|
||||
-> Cortex-A53 */
|
||||
*vendor = cpuinfo_vendor_arm;
|
||||
*uarch = cpuinfo_uarch_cortex_a53;
|
||||
break;
|
||||
case 0x802: /* High-performance Kryo 385 "Gold" -> Cortex-A75 */
|
||||
case 0x802: /* High-performance Kryo 385 "Gold"
|
||||
-> Cortex-A75 */
|
||||
*vendor = cpuinfo_vendor_arm;
|
||||
*uarch = cpuinfo_uarch_cortex_a75;
|
||||
break;
|
||||
case 0x803: /* Low-power Kryo 385 "Silver" -> Cortex-A55r0 */
|
||||
case 0x803: /* Low-power Kryo 385 "Silver" ->
|
||||
Cortex-A55r0 */
|
||||
*vendor = cpuinfo_vendor_arm;
|
||||
*uarch = cpuinfo_uarch_cortex_a55r0;
|
||||
break;
|
||||
case 0x804: /* High-performance Kryo 485 "Gold" / "Gold Prime" -> Cortex-A76 */
|
||||
case 0x804: /* High-performance Kryo 485 "Gold"
|
||||
/ "Gold Prime" -> Cortex-A76 */
|
||||
*vendor = cpuinfo_vendor_arm;
|
||||
*uarch = cpuinfo_uarch_cortex_a76;
|
||||
break;
|
||||
case 0x805: /* Low-performance Kryo 485 "Silver" -> Cortex-A55 */
|
||||
case 0x805: /* Low-performance Kryo 485 "Silver"
|
||||
-> Cortex-A55 */
|
||||
*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));
|
||||
cpuinfo_log_warning(
|
||||
"unknown Qualcomm CPU part 0x%03" PRIx32 " ignored",
|
||||
midr_get_part(midr));
|
||||
}
|
||||
break;
|
||||
case 'S':
|
||||
@@ -299,7 +350,8 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
switch (midr & (CPUINFO_ARM_MIDR_VARIANT_MASK | CPUINFO_ARM_MIDR_PART_MASK)) {
|
||||
case 0x00100010:
|
||||
/*
|
||||
* Exynos 8890 MIDR = 0x531F0011, assume Exynos M1 has:
|
||||
* Exynos 8890 MIDR = 0x531F0011, assume
|
||||
* Exynos M1 has:
|
||||
* - CPU variant 0x1
|
||||
* - CPU part 0x001
|
||||
*/
|
||||
@@ -307,7 +359,8 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
break;
|
||||
case 0x00400010:
|
||||
/*
|
||||
* Exynos 8895 MIDR = 0x534F0010, assume Exynos M2 has:
|
||||
* Exynos 8895 MIDR = 0x534F0010, assume
|
||||
* Exynos M2 has:
|
||||
* - CPU variant 0x4
|
||||
* - CPU part 0x001
|
||||
*/
|
||||
@@ -315,7 +368,8 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
break;
|
||||
case 0x00100020:
|
||||
/*
|
||||
* Exynos 9810 MIDR = 0x531F0020, assume Exynos M3 has:
|
||||
* Exynos 9810 MIDR = 0x531F0020, assume
|
||||
* Exynos M3 has:
|
||||
* - CPU variant 0x1
|
||||
* - CPU part 0x002
|
||||
*/
|
||||
@@ -323,7 +377,8 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
break;
|
||||
case 0x00100030:
|
||||
/*
|
||||
* Exynos 9820 MIDR = 0x531F0030, assume Exynos M4 has:
|
||||
* Exynos 9820 MIDR = 0x531F0030, assume
|
||||
* Exynos M4 has:
|
||||
* - CPU variant 0x1
|
||||
* - CPU part 0x003
|
||||
*/
|
||||
@@ -331,15 +386,19 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
break;
|
||||
case 0x00100040:
|
||||
/*
|
||||
* Exynos 9820 MIDR = 0x531F0040, assume Exynos M5 has:
|
||||
* Exynos 9820 MIDR = 0x531F0040, assume
|
||||
* Exynos M5 has:
|
||||
* - CPU variant 0x1
|
||||
* - CPU part 0x004
|
||||
*/
|
||||
*uarch = cpuinfo_uarch_exynos_m5;
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_warning("unknown Samsung CPU variant 0x%01"PRIx32" part 0x%03"PRIx32" ignored",
|
||||
midr_get_variant(midr), midr_get_part(midr));
|
||||
cpuinfo_log_warning(
|
||||
"unknown Samsung CPU variant 0x%01" PRIx32 " part 0x%03" PRIx32
|
||||
" ignored",
|
||||
midr_get_variant(midr),
|
||||
midr_get_part(midr));
|
||||
}
|
||||
break;
|
||||
#if CPUINFO_ARCH_ARM
|
||||
@@ -351,12 +410,17 @@ void cpuinfo_arm_decode_vendor_uarch(
|
||||
*uarch = cpuinfo_uarch_pj4;
|
||||
break;
|
||||
default:
|
||||
cpuinfo_log_warning("unknown Marvell CPU part 0x%03"PRIx32" ignored", midr_get_part(midr));
|
||||
cpuinfo_log_warning(
|
||||
"unknown Marvell CPU part 0x%03" PRIx32 " ignored",
|
||||
midr_get_part(midr));
|
||||
}
|
||||
break;
|
||||
#endif /* CPUINFO_ARCH_ARM */
|
||||
default:
|
||||
cpuinfo_log_warning("unknown CPU implementer '%c' (0x%02"PRIx32") with CPU part 0x%03"PRIx32" ignored",
|
||||
(char) midr_get_implementer(midr), midr_get_implementer(midr), midr_get_part(midr));
|
||||
cpuinfo_log_warning(
|
||||
"unknown CPU implementer '%c' (0x%02" PRIx32 ") with CPU part 0x%03" PRIx32 " ignored",
|
||||
(char)midr_get_implementer(midr),
|
||||
midr_get_implementer(midr),
|
||||
midr_get_part(midr));
|
||||
}
|
||||
}
|
||||
|
||||
909
3rdparty/cpuinfo/src/arm/windows/init-by-logical-sys-info.c
vendored
Normal file
909
3rdparty/cpuinfo/src/arm/windows/init-by-logical-sys-info.c
vendored
Normal file
@@ -0,0 +1,909 @@
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.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;
|
||||
}
|
||||
219
3rdparty/cpuinfo/src/arm/windows/init.c
vendored
Normal file
219
3rdparty/cpuinfo/src/arm/windows/init.c
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.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[woa_chip_name_last] = {
|
||||
/* Microsoft SQ1 Kryo 495 4 + 4 cores (3 GHz + 1.80 GHz) */
|
||||
[woa_chip_name_microsoft_sq_1] =
|
||||
{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) */
|
||||
[woa_chip_name_microsoft_sq_2] =
|
||||
{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}}},
|
||||
/* Snapdragon (TM) 8cx Gen 3 @ 3.0 GHz */
|
||||
[woa_chip_name_microsoft_sq_3] =
|
||||
{L"Snapdragon (TM) 8cx Gen 3",
|
||||
woa_chip_name_microsoft_sq_3,
|
||||
{{
|
||||
cpuinfo_vendor_arm,
|
||||
cpuinfo_uarch_cortex_a78,
|
||||
2420000000,
|
||||
},
|
||||
{cpuinfo_vendor_arm, cpuinfo_uarch_cortex_x1, 3000000000}}},
|
||||
/* Microsoft Windows Dev Kit 2023 */
|
||||
[woa_chip_name_microsoft_sq_3_devkit] =
|
||||
{L"Snapdragon Compute Platform",
|
||||
woa_chip_name_microsoft_sq_3_devkit,
|
||||
{{
|
||||
cpuinfo_vendor_arm,
|
||||
cpuinfo_uarch_cortex_a78,
|
||||
2420000000,
|
||||
},
|
||||
{cpuinfo_vendor_arm, cpuinfo_uarch_cortex_x1, 3000000000}}},
|
||||
/* Ampere Altra */
|
||||
[woa_chip_name_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;
|
||||
}
|
||||
39
3rdparty/cpuinfo/src/arm/windows/windows-arm-init.h
vendored
Normal file
39
3rdparty/cpuinfo/src/arm/windows/windows-arm-init.h
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
#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_microsoft_sq_3_devkit = 3,
|
||||
woa_chip_name_ampere_altra = 4,
|
||||
woa_chip_name_unknown = 5,
|
||||
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);
|
||||
21
3rdparty/cpuinfo/src/cache.c
vendored
21
3rdparty/cpuinfo/src/cache.c
vendored
@@ -3,16 +3,15 @@
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/internal-api.h>
|
||||
|
||||
|
||||
uint32_t cpuinfo_compute_max_cache_size(const struct cpuinfo_processor* processor) {
|
||||
if (processor->cache.l4 != NULL) {
|
||||
return processor->cache.l4->size;
|
||||
} else if (processor->cache.l3 != NULL) {
|
||||
return processor->cache.l3->size;
|
||||
} else if (processor->cache.l2 != NULL) {
|
||||
return processor->cache.l2->size;
|
||||
} else if (processor->cache.l1d != NULL) {
|
||||
return processor->cache.l1d->size;
|
||||
}
|
||||
return 0;
|
||||
if (processor->cache.l4 != NULL) {
|
||||
return processor->cache.l4->size;
|
||||
} else if (processor->cache.l3 != NULL) {
|
||||
return processor->cache.l3->size;
|
||||
} else if (processor->cache.l2 != NULL) {
|
||||
return processor->cache.l2->size;
|
||||
} else if (processor->cache.l1d != NULL) {
|
||||
return processor->cache.l1d->size;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
39
3rdparty/cpuinfo/src/cpuinfo/common.h
vendored
39
3rdparty/cpuinfo/src/cpuinfo/common.h
vendored
@@ -8,33 +8,32 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#define CPUINFO_COUNT_OF(array) (sizeof(array) / sizeof(0[array]))
|
||||
#define CPUINFO_COUNT_OF(array) (sizeof(array) / sizeof(0 [array]))
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define CPUINFO_LIKELY(condition) (__builtin_expect(!!(condition), 1))
|
||||
#define CPUINFO_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
|
||||
#define CPUINFO_LIKELY(condition) (__builtin_expect(!!(condition), 1))
|
||||
#define CPUINFO_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
|
||||
#else
|
||||
#define CPUINFO_LIKELY(condition) (!!(condition))
|
||||
#define CPUINFO_UNLIKELY(condition) (!!(condition))
|
||||
#define CPUINFO_LIKELY(condition) (!!(condition))
|
||||
#define CPUINFO_UNLIKELY(condition) (!!(condition))
|
||||
#endif
|
||||
|
||||
#ifndef CPUINFO_INTERNAL
|
||||
#if defined(__ELF__)
|
||||
#define CPUINFO_INTERNAL __attribute__((__visibility__("internal")))
|
||||
#elif defined(__MACH__)
|
||||
#define CPUINFO_INTERNAL __attribute__((__visibility__("hidden")))
|
||||
#else
|
||||
#define CPUINFO_INTERNAL
|
||||
#endif
|
||||
#if defined(__ELF__)
|
||||
#define CPUINFO_INTERNAL __attribute__((__visibility__("internal")))
|
||||
#elif defined(__MACH__)
|
||||
#define CPUINFO_INTERNAL __attribute__((__visibility__("hidden")))
|
||||
#else
|
||||
#define CPUINFO_INTERNAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CPUINFO_PRIVATE
|
||||
#if defined(__ELF__)
|
||||
#define CPUINFO_PRIVATE __attribute__((__visibility__("hidden")))
|
||||
#elif defined(__MACH__)
|
||||
#define CPUINFO_PRIVATE __attribute__((__visibility__("hidden")))
|
||||
#else
|
||||
#define CPUINFO_PRIVATE
|
||||
#endif
|
||||
#if defined(__ELF__)
|
||||
#define CPUINFO_PRIVATE __attribute__((__visibility__("hidden")))
|
||||
#elif defined(__MACH__)
|
||||
#define CPUINFO_PRIVATE __attribute__((__visibility__("hidden")))
|
||||
#else
|
||||
#define CPUINFO_PRIVATE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
37
3rdparty/cpuinfo/src/cpuinfo/internal-api.h
vendored
37
3rdparty/cpuinfo/src/cpuinfo/internal-api.h
vendored
@@ -1,22 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/common.h>
|
||||
|
||||
|
||||
enum cpuinfo_cache_level {
|
||||
cpuinfo_cache_level_1i = 0,
|
||||
cpuinfo_cache_level_1d = 1,
|
||||
cpuinfo_cache_level_2 = 2,
|
||||
cpuinfo_cache_level_3 = 3,
|
||||
cpuinfo_cache_level_4 = 4,
|
||||
cpuinfo_cache_level_1i = 0,
|
||||
cpuinfo_cache_level_1d = 1,
|
||||
cpuinfo_cache_level_2 = 2,
|
||||
cpuinfo_cache_level_3 = 3,
|
||||
cpuinfo_cache_level_4 = 4,
|
||||
cpuinfo_cache_level_max = 5,
|
||||
};
|
||||
|
||||
@@ -35,26 +34,32 @@ 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
|
||||
extern CPUINFO_INTERNAL struct cpuinfo_uarch_info* cpuinfo_uarchs;
|
||||
extern CPUINFO_INTERNAL uint32_t cpuinfo_uarchs_count;
|
||||
#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
|
||||
extern CPUINFO_INTERNAL struct cpuinfo_uarch_info cpuinfo_global_uarch;
|
||||
extern CPUINFO_INTERNAL struct cpuinfo_uarch_info cpuinfo_global_uarch;
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
extern CPUINFO_INTERNAL uint32_t cpuinfo_linux_cpu_max;
|
||||
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;
|
||||
extern CPUINFO_INTERNAL uint32_t cpuinfo_linux_cpu_max;
|
||||
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;
|
||||
#endif
|
||||
|
||||
CPUINFO_PRIVATE void cpuinfo_x86_mach_init(void);
|
||||
CPUINFO_PRIVATE void cpuinfo_x86_linux_init(void);
|
||||
CPUINFO_PRIVATE void cpuinfo_x86_freebsd_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);
|
||||
|
||||
105
3rdparty/cpuinfo/src/cpuinfo/log.h
vendored
105
3rdparty/cpuinfo/src/cpuinfo/log.h
vendored
@@ -1,17 +1,102 @@
|
||||
#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();
|
||||
}
|
||||
18
3rdparty/cpuinfo/src/cpuinfo/utils.h
vendored
18
3rdparty/cpuinfo/src/cpuinfo/utils.h
vendored
@@ -1,19 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
inline static uint32_t bit_length(uint32_t n) {
|
||||
const uint32_t n_minus_1 = n - 1;
|
||||
if (n_minus_1 == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
#ifdef _MSC_VER
|
||||
unsigned long bsr;
|
||||
_BitScanReverse(&bsr, n_minus_1);
|
||||
return bsr + 1;
|
||||
#else
|
||||
return 32 - __builtin_clz(n_minus_1);
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
unsigned long bsr;
|
||||
_BitScanReverse(&bsr, n_minus_1);
|
||||
return bsr + 1;
|
||||
#else
|
||||
return 32 - __builtin_clz(n_minus_1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
79
3rdparty/cpuinfo/src/emscripten/init.c
vendored
79
3rdparty/cpuinfo/src/emscripten/init.c
vendored
@@ -1,8 +1,8 @@
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <emscripten/threading.h>
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
#include <cpuinfo/internal-api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
|
||||
static const volatile float infinity = INFINITY;
|
||||
|
||||
static struct cpuinfo_package static_package = { };
|
||||
static struct cpuinfo_package static_package = {};
|
||||
|
||||
static struct cpuinfo_cache static_x86_l3 = {
|
||||
.size = 2 * 1024 * 1024,
|
||||
@@ -37,7 +36,7 @@ void cpuinfo_emscripten_init(void) {
|
||||
if (logical_cores_count <= 0) {
|
||||
logical_cores_count = 1;
|
||||
}
|
||||
uint32_t processor_count = (uint32_t) logical_cores_count;
|
||||
uint32_t processor_count = (uint32_t)logical_cores_count;
|
||||
uint32_t core_count = processor_count;
|
||||
uint32_t cluster_count = 1;
|
||||
uint32_t big_cluster_core_count = core_count;
|
||||
@@ -60,41 +59,53 @@ void cpuinfo_emscripten_init(void) {
|
||||
|
||||
processors = calloc(processor_count, sizeof(struct cpuinfo_processor));
|
||||
if (processors == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" logical processors",
|
||||
processor_count * sizeof(struct cpuinfo_processor), processor_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " logical processors",
|
||||
processor_count * sizeof(struct cpuinfo_processor),
|
||||
processor_count);
|
||||
goto cleanup;
|
||||
}
|
||||
cores = calloc(processor_count, sizeof(struct cpuinfo_core));
|
||||
if (cores == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" cores",
|
||||
processor_count * sizeof(struct cpuinfo_core), processor_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " cores",
|
||||
processor_count * sizeof(struct cpuinfo_core),
|
||||
processor_count);
|
||||
goto cleanup;
|
||||
}
|
||||
clusters = calloc(cluster_count, sizeof(struct cpuinfo_cluster));
|
||||
if (clusters == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" clusters",
|
||||
cluster_count * sizeof(struct cpuinfo_cluster), cluster_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " clusters",
|
||||
cluster_count * sizeof(struct cpuinfo_cluster),
|
||||
cluster_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
l1i = calloc(core_count, sizeof(struct cpuinfo_cache));
|
||||
if (l1i == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L1I caches",
|
||||
core_count * sizeof(struct cpuinfo_cache), core_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L1I caches",
|
||||
core_count * sizeof(struct cpuinfo_cache),
|
||||
core_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
l1d = calloc(core_count, sizeof(struct cpuinfo_cache));
|
||||
if (l1d == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L1D caches",
|
||||
core_count * sizeof(struct cpuinfo_cache), core_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L1D caches",
|
||||
core_count * sizeof(struct cpuinfo_cache),
|
||||
core_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
l2 = calloc(l2_count, sizeof(struct cpuinfo_cache));
|
||||
if (l2 == NULL) {
|
||||
cpuinfo_log_error("failed to allocate %zu bytes for descriptions of %"PRIu32" L2 caches",
|
||||
l2_count * sizeof(struct cpuinfo_cache), l2_count);
|
||||
cpuinfo_log_error(
|
||||
"failed to allocate %zu bytes for descriptions of %" PRIu32 " L2 caches",
|
||||
l2_count * sizeof(struct cpuinfo_cache),
|
||||
l2_count);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -109,30 +120,30 @@ void cpuinfo_emscripten_init(void) {
|
||||
|
||||
for (uint32_t i = 0; i < core_count; i++) {
|
||||
for (uint32_t j = 0; j < processors_per_core; j++) {
|
||||
processors[i * processors_per_core + j] = (struct cpuinfo_processor) {
|
||||
processors[i * processors_per_core + j] = (struct cpuinfo_processor){
|
||||
.smt_id = j,
|
||||
.core = cores + i,
|
||||
.cluster = clusters + (uint32_t) (i >= big_cluster_core_count),
|
||||
.cluster = clusters + (uint32_t)(i >= big_cluster_core_count),
|
||||
.package = &static_package,
|
||||
.cache.l1i = l1i + i,
|
||||
.cache.l1d = l1d + i,
|
||||
.cache.l2 = is_x86 ? l2 + i : l2 + (uint32_t) (i >= big_cluster_core_count),
|
||||
.cache.l2 = is_x86 ? l2 + i : l2 + (uint32_t)(i >= big_cluster_core_count),
|
||||
.cache.l3 = is_x86 ? &static_x86_l3 : NULL,
|
||||
};
|
||||
}
|
||||
|
||||
cores[i] = (struct cpuinfo_core) {
|
||||
cores[i] = (struct cpuinfo_core){
|
||||
.processor_start = i * processors_per_core,
|
||||
.processor_count = processors_per_core,
|
||||
.core_id = i,
|
||||
.cluster = clusters + (uint32_t) (i >= big_cluster_core_count),
|
||||
.cluster = clusters + (uint32_t)(i >= big_cluster_core_count),
|
||||
.package = &static_package,
|
||||
.vendor = cpuinfo_vendor_unknown,
|
||||
.uarch = cpuinfo_uarch_unknown,
|
||||
.frequency = 0,
|
||||
};
|
||||
|
||||
l1i[i] = (struct cpuinfo_cache) {
|
||||
l1i[i] = (struct cpuinfo_cache){
|
||||
.size = 32 * 1024,
|
||||
.associativity = 4,
|
||||
.sets = 128,
|
||||
@@ -142,7 +153,7 @@ void cpuinfo_emscripten_init(void) {
|
||||
.processor_count = processors_per_core,
|
||||
};
|
||||
|
||||
l1d[i] = (struct cpuinfo_cache) {
|
||||
l1d[i] = (struct cpuinfo_cache){
|
||||
.size = 32 * 1024,
|
||||
.associativity = 4,
|
||||
.sets = 128,
|
||||
@@ -153,7 +164,7 @@ void cpuinfo_emscripten_init(void) {
|
||||
};
|
||||
|
||||
if (is_x86) {
|
||||
l2[i] = (struct cpuinfo_cache) {
|
||||
l2[i] = (struct cpuinfo_cache){
|
||||
.size = 256 * 1024,
|
||||
.associativity = 8,
|
||||
.sets = 512,
|
||||
@@ -166,7 +177,7 @@ void cpuinfo_emscripten_init(void) {
|
||||
}
|
||||
|
||||
if (is_x86) {
|
||||
clusters[0] = (struct cpuinfo_cluster) {
|
||||
clusters[0] = (struct cpuinfo_cluster){
|
||||
.processor_start = 0,
|
||||
.processor_count = processor_count,
|
||||
.core_start = 0,
|
||||
@@ -180,7 +191,7 @@ void cpuinfo_emscripten_init(void) {
|
||||
|
||||
static_x86_l3.processor_count = processor_count;
|
||||
} else {
|
||||
clusters[0] = (struct cpuinfo_cluster) {
|
||||
clusters[0] = (struct cpuinfo_cluster){
|
||||
.processor_start = 0,
|
||||
.processor_count = big_cluster_core_count,
|
||||
.core_start = 0,
|
||||
@@ -192,7 +203,7 @@ void cpuinfo_emscripten_init(void) {
|
||||
.frequency = 0,
|
||||
};
|
||||
|
||||
l2[0] = (struct cpuinfo_cache) {
|
||||
l2[0] = (struct cpuinfo_cache){
|
||||
.size = 1024 * 1024,
|
||||
.associativity = 8,
|
||||
.sets = 2048,
|
||||
@@ -203,7 +214,7 @@ void cpuinfo_emscripten_init(void) {
|
||||
};
|
||||
|
||||
if (cluster_count > 1) {
|
||||
l2[1] = (struct cpuinfo_cache) {
|
||||
l2[1] = (struct cpuinfo_cache){
|
||||
.size = 256 * 1024,
|
||||
.associativity = 8,
|
||||
.sets = 512,
|
||||
@@ -213,7 +224,7 @@ void cpuinfo_emscripten_init(void) {
|
||||
.processor_count = processor_count - big_cluster_core_count,
|
||||
};
|
||||
|
||||
clusters[1] = (struct cpuinfo_cluster) {
|
||||
clusters[1] = (struct cpuinfo_cluster){
|
||||
.processor_start = big_cluster_core_count,
|
||||
.processor_count = processor_count - big_cluster_core_count,
|
||||
.core_start = big_cluster_core_count,
|
||||
@@ -230,9 +241,9 @@ void cpuinfo_emscripten_init(void) {
|
||||
/* Commit changes */
|
||||
cpuinfo_cache[cpuinfo_cache_level_1i] = l1i;
|
||||
cpuinfo_cache[cpuinfo_cache_level_1d] = l1d;
|
||||
cpuinfo_cache[cpuinfo_cache_level_2] = l2;
|
||||
cpuinfo_cache[cpuinfo_cache_level_2] = l2;
|
||||
if (is_x86) {
|
||||
cpuinfo_cache[cpuinfo_cache_level_3] = &static_x86_l3;
|
||||
cpuinfo_cache[cpuinfo_cache_level_3] = &static_x86_l3;
|
||||
}
|
||||
|
||||
cpuinfo_processors = processors;
|
||||
@@ -242,12 +253,12 @@ void cpuinfo_emscripten_init(void) {
|
||||
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_1i] = processor_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_1d] = processor_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_2] = l2_count;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_2] = l2_count;
|
||||
if (is_x86) {
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_3] = 1;
|
||||
cpuinfo_cache_count[cpuinfo_cache_level_3] = 1;
|
||||
}
|
||||
|
||||
cpuinfo_global_uarch = (struct cpuinfo_uarch_info) {
|
||||
cpuinfo_global_uarch = (struct cpuinfo_uarch_info){
|
||||
.uarch = cpuinfo_uarch_unknown,
|
||||
.processor_count = processor_count,
|
||||
.core_count = core_count,
|
||||
|
||||
12
3rdparty/cpuinfo/src/freebsd/api.h
vendored
Normal file
12
3rdparty/cpuinfo/src/freebsd/api.h
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct cpuinfo_freebsd_topology {
|
||||
uint32_t packages;
|
||||
uint32_t cores;
|
||||
uint32_t threads;
|
||||
uint32_t threads_per_core;
|
||||
};
|
||||
|
||||
struct cpuinfo_freebsd_topology cpuinfo_freebsd_detect_topology(void);
|
||||
104
3rdparty/cpuinfo/src/freebsd/topology.c
vendored
Normal file
104
3rdparty/cpuinfo/src/freebsd/topology.c
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cpuinfo/log.h>
|
||||
#include <freebsd/api.h>
|
||||
|
||||
static int sysctl_int(const char* name) {
|
||||
int value = 0;
|
||||
size_t value_size = sizeof(value);
|
||||
if (sysctlbyname(name, &value, &value_size, NULL, 0) != 0) {
|
||||
cpuinfo_log_error("sysctlbyname(\"%s\") failed: %s", name, strerror(errno));
|
||||
} else if (value <= 0) {
|
||||
cpuinfo_log_error("sysctlbyname(\"%s\") returned invalid value %d %zu", name, value, value_size);
|
||||
value = 0;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
static char* sysctl_str(const char* name) {
|
||||
size_t value_size = 0;
|
||||
if (sysctlbyname(name, NULL, &value_size, NULL, 0) != 0) {
|
||||
cpuinfo_log_error("sysctlbyname(\"%s\") failed: %s", name, strerror(errno));
|
||||
} else if (value_size <= 0) {
|
||||
cpuinfo_log_error("sysctlbyname(\"%s\") returned invalid value size %zu", name, value_size);
|
||||
}
|
||||
value_size += 1;
|
||||
char* value = calloc(value_size, 1);
|
||||
if (!value) {
|
||||
cpuinfo_log_error("calloc %zu bytes failed", value_size);
|
||||
return NULL;
|
||||
}
|
||||
if (sysctlbyname(name, value, &value_size, NULL, 0) != 0) {
|
||||
cpuinfo_log_error("sysctlbyname(\"%s\") failed: %s", name, strerror(errno));
|
||||
free(value);
|
||||
return NULL;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
struct cpuinfo_freebsd_topology cpuinfo_freebsd_detect_topology(void) {
|
||||
struct cpuinfo_freebsd_topology topology = {
|
||||
.packages = 0,
|
||||
.cores = 0,
|
||||
.threads_per_core = 0,
|
||||
.threads = 0,
|
||||
};
|
||||
char* topology_spec = sysctl_str("kern.sched.topology_spec");
|
||||
if (!topology_spec) {
|
||||
return topology;
|
||||
}
|
||||
const char* group_tag = "<group level=\"1\" cache-level=\"0\">";
|
||||
char* p = strstr(topology_spec, group_tag);
|
||||
while (p) {
|
||||
const char* cpu_tag = "cpu count=\"";
|
||||
char* q = strstr(p, cpu_tag);
|
||||
if (q) {
|
||||
p = q + strlen(cpu_tag);
|
||||
topology.packages += atoi(p);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (topology.packages == 0) {
|
||||
const char* group_tag = "<group level=\"1\"";
|
||||
char* p = strstr(topology_spec, group_tag);
|
||||
while (p) {
|
||||
topology.packages += 1;
|
||||
p++;
|
||||
p = strstr(p, group_tag);
|
||||
}
|
||||
}
|
||||
if (topology.packages == 0) {
|
||||
cpuinfo_log_error("failed to parse topology_spec:%s", topology_spec);
|
||||
free(topology_spec);
|
||||
goto fail;
|
||||
}
|
||||
free(topology_spec);
|
||||
topology.cores = sysctl_int("kern.smp.cores");
|
||||
if (topology.cores == 0) {
|
||||
goto fail;
|
||||
}
|
||||
if (topology.cores < topology.packages) {
|
||||
goto fail;
|
||||
}
|
||||
topology.threads_per_core = sysctl_int("kern.smp.threads_per_core");
|
||||
if (topology.threads_per_core == 0) {
|
||||
goto fail;
|
||||
}
|
||||
cpuinfo_log_debug(
|
||||
"freebsd topology: packages = %d, cores = %d, "
|
||||
"threads_per_core = %d",
|
||||
topology.packages,
|
||||
topology.cores,
|
||||
topology.threads_per_core);
|
||||
topology.threads = topology.threads_per_core * topology.cores;
|
||||
return topology;
|
||||
fail:
|
||||
topology.packages = 0;
|
||||
return topology;
|
||||
}
|
||||
74
3rdparty/cpuinfo/src/init.c
vendored
74
3rdparty/cpuinfo/src/init.c
vendored
@@ -1,7 +1,7 @@
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#elif !defined(__EMSCRIPTEN__) || defined(__EMSCRIPTEN_PTHREADS__)
|
||||
#include <pthread.h>
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#include <cpuinfo.h>
|
||||
@@ -9,51 +9,59 @@
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#include "TargetConditionals.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
static INIT_ONCE init_guard = INIT_ONCE_STATIC_INIT;
|
||||
static INIT_ONCE init_guard = INIT_ONCE_STATIC_INIT;
|
||||
#elif !defined(__EMSCRIPTEN__) || defined(__EMSCRIPTEN_PTHREADS__)
|
||||
static pthread_once_t init_guard = PTHREAD_ONCE_INIT;
|
||||
static pthread_once_t init_guard = PTHREAD_ONCE_INIT;
|
||||
#else
|
||||
static bool init_guard = false;
|
||||
static bool init_guard = false;
|
||||
#endif
|
||||
|
||||
bool CPUINFO_ABI cpuinfo_initialize(void) {
|
||||
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
|
||||
#if defined(__MACH__) && defined(__APPLE__)
|
||||
pthread_once(&init_guard, &cpuinfo_x86_mach_init);
|
||||
#elif defined(__linux__)
|
||||
pthread_once(&init_guard, &cpuinfo_x86_linux_init);
|
||||
#elif defined(_WIN32) || defined(__CYGWIN__)
|
||||
InitOnceExecuteOnce(&init_guard, &cpuinfo_x86_windows_init, NULL, NULL);
|
||||
#else
|
||||
cpuinfo_log_error("operating system is not supported in cpuinfo");
|
||||
#endif
|
||||
#if defined(__MACH__) && defined(__APPLE__)
|
||||
pthread_once(&init_guard, &cpuinfo_x86_mach_init);
|
||||
#elif defined(__FreeBSD__)
|
||||
pthread_once(&init_guard, &cpuinfo_x86_freebsd_init);
|
||||
#elif defined(__linux__)
|
||||
pthread_once(&init_guard, &cpuinfo_x86_linux_init);
|
||||
#elif defined(_WIN32) || defined(__CYGWIN__)
|
||||
InitOnceExecuteOnce(&init_guard, &cpuinfo_x86_windows_init, NULL, NULL);
|
||||
#else
|
||||
cpuinfo_log_error("operating system is not supported in cpuinfo");
|
||||
#endif
|
||||
#elif CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
#if defined(__linux__)
|
||||
pthread_once(&init_guard, &cpuinfo_arm_linux_init);
|
||||
#elif defined(__MACH__) && defined(__APPLE__)
|
||||
pthread_once(&init_guard, &cpuinfo_arm_mach_init);
|
||||
#else
|
||||
cpuinfo_log_error("operating system is not supported in cpuinfo");
|
||||
#endif
|
||||
#if defined(__linux__)
|
||||
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
|
||||
#elif CPUINFO_ARCH_ASMJS || CPUINFO_ARCH_WASM || CPUINFO_ARCH_WASMSIMD
|
||||
#if defined(__EMSCRIPTEN_PTHREADS__)
|
||||
pthread_once(&init_guard, &cpuinfo_emscripten_init);
|
||||
#else
|
||||
if (!init_guard) {
|
||||
cpuinfo_emscripten_init();
|
||||
}
|
||||
init_guard = true;
|
||||
#endif
|
||||
#if defined(__EMSCRIPTEN_PTHREADS__)
|
||||
pthread_once(&init_guard, &cpuinfo_emscripten_init);
|
||||
#else
|
||||
if (!init_guard) {
|
||||
cpuinfo_emscripten_init();
|
||||
}
|
||||
init_guard = true;
|
||||
#endif
|
||||
#else
|
||||
cpuinfo_log_error("processor architecture is not supported in cpuinfo");
|
||||
#endif
|
||||
return cpuinfo_is_initialized;
|
||||
}
|
||||
|
||||
void CPUINFO_ABI cpuinfo_deinitialize(void) {
|
||||
}
|
||||
void CPUINFO_ABI cpuinfo_deinitialize(void) {}
|
||||
|
||||
85
3rdparty/cpuinfo/src/linux/api.h
vendored
85
3rdparty/cpuinfo/src/linux/api.h
vendored
@@ -1,47 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cpuinfo.h>
|
||||
#include <cpuinfo/common.h>
|
||||
|
||||
|
||||
#define CPUINFO_LINUX_FLAG_PRESENT UINT32_C(0x00000001)
|
||||
#define CPUINFO_LINUX_FLAG_POSSIBLE UINT32_C(0x00000002)
|
||||
#define CPUINFO_LINUX_FLAG_MAX_FREQUENCY UINT32_C(0x00000004)
|
||||
#define CPUINFO_LINUX_FLAG_MIN_FREQUENCY UINT32_C(0x00000008)
|
||||
#define CPUINFO_LINUX_FLAG_SMT_ID UINT32_C(0x00000010)
|
||||
#define CPUINFO_LINUX_FLAG_CORE_ID UINT32_C(0x00000020)
|
||||
#define CPUINFO_LINUX_FLAG_PACKAGE_ID UINT32_C(0x00000040)
|
||||
#define CPUINFO_LINUX_FLAG_APIC_ID UINT32_C(0x00000080)
|
||||
#define CPUINFO_LINUX_FLAG_SMT_CLUSTER UINT32_C(0x00000100)
|
||||
#define CPUINFO_LINUX_FLAG_CORE_CLUSTER UINT32_C(0x00000200)
|
||||
#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_PRESENT UINT32_C(0x00000001)
|
||||
#define CPUINFO_LINUX_FLAG_POSSIBLE UINT32_C(0x00000002)
|
||||
#define CPUINFO_LINUX_FLAG_MAX_FREQUENCY UINT32_C(0x00000004)
|
||||
#define CPUINFO_LINUX_FLAG_MIN_FREQUENCY UINT32_C(0x00000008)
|
||||
#define CPUINFO_LINUX_FLAG_SMT_ID UINT32_C(0x00000010)
|
||||
#define CPUINFO_LINUX_FLAG_CORE_ID UINT32_C(0x00000020)
|
||||
#define CPUINFO_LINUX_FLAG_PACKAGE_ID UINT32_C(0x00000040)
|
||||
#define CPUINFO_LINUX_FLAG_APIC_ID UINT32_C(0x00000080)
|
||||
#define CPUINFO_LINUX_FLAG_SMT_CLUSTER UINT32_C(0x00000100)
|
||||
#define CPUINFO_LINUX_FLAG_CORE_CLUSTER UINT32_C(0x00000200)
|
||||
#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);
|
||||
typedef bool (*cpuinfo_smallfile_callback)(const char*, const char*, void*);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_parse_small_file(const char* filename, size_t buffer_size, cpuinfo_smallfile_callback, void* context);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_parse_cpulist(
|
||||
const char* filename,
|
||||
cpuinfo_cpulist_callback callback,
|
||||
void* context);
|
||||
typedef bool (*cpuinfo_smallfile_callback)(const char*, const char*, const char*, void*);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_parse_small_file(
|
||||
const char* filename,
|
||||
size_t buffer_size,
|
||||
cpuinfo_smallfile_callback,
|
||||
void* context);
|
||||
typedef bool (*cpuinfo_line_callback)(const char*, const char*, void*, uint64_t);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_parse_multiline_file(const char* filename, size_t buffer_size, cpuinfo_line_callback, void* context);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_parse_multiline_file(
|
||||
const char* filename,
|
||||
size_t buffer_size,
|
||||
cpuinfo_line_callback,
|
||||
void* context);
|
||||
|
||||
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]);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_get_processor_package_id(
|
||||
uint32_t processor,
|
||||
uint32_t package_id[restrict static 1]);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_get_processor_core_id(uint32_t processor, uint32_t core_id[restrict static 1]);
|
||||
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_detect_possible_processors(uint32_t max_processors_count,
|
||||
uint32_t* processor0_flags, uint32_t processor_struct_size, uint32_t possible_flag);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_detect_present_processors(uint32_t max_processors_count,
|
||||
uint32_t* processor0_flags, uint32_t processor_struct_size, uint32_t present_flag);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_detect_possible_processors(
|
||||
uint32_t max_processors_count,
|
||||
uint32_t* processor0_flags,
|
||||
uint32_t processor_struct_size,
|
||||
uint32_t possible_flag);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_detect_present_processors(
|
||||
uint32_t max_processors_count,
|
||||
uint32_t* processor0_flags,
|
||||
uint32_t processor_struct_size,
|
||||
uint32_t present_flag);
|
||||
|
||||
typedef bool (*cpuinfo_siblings_callback)(uint32_t, uint32_t, uint32_t, void*);
|
||||
CPUINFO_INTERNAL bool cpuinfo_linux_detect_core_siblings(
|
||||
@@ -54,6 +74,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;
|
||||
|
||||
128
3rdparty/cpuinfo/src/linux/cpulist.c
vendored
128
3rdparty/cpuinfo/src/linux/cpulist.c
vendored
@@ -1,21 +1,20 @@
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sched.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
#include <cpuinfo-mock.h>
|
||||
#include <cpuinfo-mock.h>
|
||||
#endif
|
||||
#include <linux/api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
#include <linux/api.h>
|
||||
|
||||
/*
|
||||
* Size, in chars, of the on-stack buffer used for parsing cpu lists.
|
||||
@@ -25,7 +24,6 @@
|
||||
*/
|
||||
#define BUFFER_SIZE 256
|
||||
|
||||
|
||||
/* Locale-independent */
|
||||
inline static bool is_whitespace(char c) {
|
||||
switch (c) {
|
||||
@@ -42,7 +40,7 @@ inline static bool is_whitespace(char c) {
|
||||
inline static const char* parse_number(const char* string, const char* end, uint32_t number_ptr[restrict static 1]) {
|
||||
uint32_t number = 0;
|
||||
while (string != end) {
|
||||
const uint32_t digit = (uint32_t) (*string) - (uint32_t) '0';
|
||||
const uint32_t digit = (uint32_t)(*string) - (uint32_t)'0';
|
||||
if (digit >= 10) {
|
||||
break;
|
||||
}
|
||||
@@ -53,7 +51,11 @@ inline static const char* parse_number(const char* string, const char* end, uint
|
||||
return string;
|
||||
}
|
||||
|
||||
inline static bool parse_entry(const char* entry_start, const char* entry_end, cpuinfo_cpulist_callback callback, void* context) {
|
||||
inline static bool parse_entry(
|
||||
const char* entry_start,
|
||||
const char* entry_end,
|
||||
cpuinfo_cpulist_callback callback,
|
||||
void* context) {
|
||||
/* Skip whitespace at the beginning of an entry */
|
||||
for (; entry_start != entry_end; entry_start++) {
|
||||
if (!is_whitespace(*entry_start)) {
|
||||
@@ -67,36 +69,44 @@ inline static bool parse_entry(const char* entry_start, const char* entry_end, c
|
||||
}
|
||||
}
|
||||
|
||||
const size_t entry_length = (size_t) (entry_end - entry_start);
|
||||
const size_t entry_length = (size_t)(entry_end - entry_start);
|
||||
if (entry_length == 0) {
|
||||
cpuinfo_log_warning("unexpected zero-length cpu list entry ignored");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if CPUINFO_LOG_DEBUG_PARSERS
|
||||
cpuinfo_log_debug("parse cpu list entry \"%.*s\" (%zu chars)", (int) entry_length, entry_start, entry_length);
|
||||
#endif
|
||||
#if CPUINFO_LOG_DEBUG_PARSERS
|
||||
cpuinfo_log_debug("parse cpu list entry \"%.*s\" (%zu chars)", (int)entry_length, entry_start, entry_length);
|
||||
#endif
|
||||
uint32_t first_cpu, last_cpu;
|
||||
|
||||
const char* number_end = parse_number(entry_start, entry_end, &first_cpu);
|
||||
if (number_end == entry_start) {
|
||||
/* Failed to parse the number; ignore the entry */
|
||||
cpuinfo_log_warning("invalid character '%c' in the cpu list entry \"%.*s\": entry is ignored",
|
||||
entry_start[0], (int) entry_length, entry_start);
|
||||
cpuinfo_log_warning(
|
||||
"invalid character '%c' in the cpu list entry \"%.*s\": entry is ignored",
|
||||
entry_start[0],
|
||||
(int)entry_length,
|
||||
entry_start);
|
||||
return false;
|
||||
} else if (number_end == entry_end) {
|
||||
/* Completely parsed the entry */
|
||||
#if CPUINFO_LOG_DEBUG_PARSERS
|
||||
cpuinfo_log_debug("cpulist: call callback with list_start = %"PRIu32", list_end = %"PRIu32,
|
||||
first_cpu, first_cpu + 1);
|
||||
#endif
|
||||
/* Completely parsed the entry */
|
||||
#if CPUINFO_LOG_DEBUG_PARSERS
|
||||
cpuinfo_log_debug(
|
||||
"cpulist: call callback with list_start = %" PRIu32 ", list_end = %" PRIu32,
|
||||
first_cpu,
|
||||
first_cpu + 1);
|
||||
#endif
|
||||
return callback(first_cpu, first_cpu + 1, context);
|
||||
}
|
||||
|
||||
/* Parse the second part of the entry */
|
||||
if (*number_end != '-') {
|
||||
cpuinfo_log_warning("invalid character '%c' in the cpu list entry \"%.*s\": entry is ignored",
|
||||
*number_end, (int) entry_length, entry_start);
|
||||
cpuinfo_log_warning(
|
||||
"invalid character '%c' in the cpu list entry \"%.*s\": entry is ignored",
|
||||
*number_end,
|
||||
(int)entry_length,
|
||||
entry_start);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -104,28 +114,40 @@ inline static bool parse_entry(const char* entry_start, const char* entry_end, c
|
||||
number_end = parse_number(number_start, entry_end, &last_cpu);
|
||||
if (number_end == number_start) {
|
||||
/* Failed to parse the second number; ignore the entry */
|
||||
cpuinfo_log_warning("invalid character '%c' in the cpu list entry \"%.*s\": entry is ignored",
|
||||
*number_start, (int) entry_length, entry_start);
|
||||
cpuinfo_log_warning(
|
||||
"invalid character '%c' in the cpu list entry \"%.*s\": entry is ignored",
|
||||
*number_start,
|
||||
(int)entry_length,
|
||||
entry_start);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (number_end != entry_end) {
|
||||
/* Partially parsed the entry; ignore unparsed characters and continue with the parsed part */
|
||||
cpuinfo_log_warning("ignored invalid characters \"%.*s\" at the end of cpu list entry \"%.*s\"",
|
||||
(int) (entry_end - number_end), number_start, (int) entry_length, entry_start);
|
||||
/* Partially parsed the entry; ignore unparsed characters and
|
||||
* continue with the parsed part */
|
||||
cpuinfo_log_warning(
|
||||
"ignored invalid characters \"%.*s\" at the end of cpu list entry \"%.*s\"",
|
||||
(int)(entry_end - number_end),
|
||||
number_start,
|
||||
(int)entry_length,
|
||||
entry_start);
|
||||
}
|
||||
|
||||
if (last_cpu < first_cpu) {
|
||||
cpuinfo_log_warning("ignored cpu list entry \"%.*s\": invalid range %"PRIu32"-%"PRIu32,
|
||||
(int) entry_length, entry_start, first_cpu, last_cpu);
|
||||
cpuinfo_log_warning(
|
||||
"ignored cpu list entry \"%.*s\": invalid range %" PRIu32 "-%" PRIu32,
|
||||
(int)entry_length,
|
||||
entry_start,
|
||||
first_cpu,
|
||||
last_cpu);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Parsed both parts of the entry; update CPU set */
|
||||
#if CPUINFO_LOG_DEBUG_PARSERS
|
||||
cpuinfo_log_debug("cpulist: call callback with list_start = %"PRIu32", list_end = %"PRIu32,
|
||||
first_cpu, last_cpu + 1);
|
||||
#endif
|
||||
/* Parsed both parts of the entry; update CPU set */
|
||||
#if CPUINFO_LOG_DEBUG_PARSERS
|
||||
cpuinfo_log_debug(
|
||||
"cpulist: call callback with list_start = %" PRIu32 ", list_end = %" PRIu32, first_cpu, last_cpu + 1);
|
||||
#endif
|
||||
return callback(first_cpu, last_cpu + 1, context);
|
||||
}
|
||||
|
||||
@@ -133,9 +155,9 @@ bool cpuinfo_linux_parse_cpulist(const char* filename, cpuinfo_cpulist_callback
|
||||
bool status = true;
|
||||
int file = -1;
|
||||
char buffer[BUFFER_SIZE];
|
||||
#if CPUINFO_LOG_DEBUG_PARSERS
|
||||
cpuinfo_log_debug("parsing cpu list from file %s", filename);
|
||||
#endif
|
||||
#if CPUINFO_LOG_DEBUG_PARSERS
|
||||
cpuinfo_log_debug("parsing cpu list from file %s", filename);
|
||||
#endif
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
file = cpuinfo_mock_open(filename, O_RDONLY);
|
||||
@@ -154,29 +176,32 @@ bool cpuinfo_linux_parse_cpulist(const char* filename, cpuinfo_cpulist_callback
|
||||
ssize_t bytes_read;
|
||||
do {
|
||||
#if CPUINFO_MOCK
|
||||
bytes_read = cpuinfo_mock_read(file, data_start, (size_t) (buffer_end - data_start));
|
||||
bytes_read = cpuinfo_mock_read(file, data_start, (size_t)(buffer_end - data_start));
|
||||
#else
|
||||
bytes_read = read(file, data_start, (size_t) (buffer_end - data_start));
|
||||
bytes_read = read(file, data_start, (size_t)(buffer_end - data_start));
|
||||
#endif
|
||||
if (bytes_read < 0) {
|
||||
cpuinfo_log_info("failed to read file %s at position %zu: %s", filename, position, strerror(errno));
|
||||
cpuinfo_log_info(
|
||||
"failed to read file %s at position %zu: %s", filename, position, strerror(errno));
|
||||
status = false;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
position += (size_t) bytes_read;
|
||||
const char* data_end = data_start + (size_t) bytes_read;
|
||||
position += (size_t)bytes_read;
|
||||
const char* data_end = data_start + (size_t)bytes_read;
|
||||
const char* entry_start = buffer;
|
||||
|
||||
if (bytes_read == 0) {
|
||||
/* No more data in the file: process the remaining text in the buffer as a single entry */
|
||||
/* No more data in the file: process the remaining text
|
||||
* in the buffer as a single entry */
|
||||
const char* entry_end = data_end;
|
||||
const bool entry_status = parse_entry(entry_start, entry_end, callback, context);
|
||||
status &= entry_status;
|
||||
} else {
|
||||
const char* entry_end;
|
||||
do {
|
||||
/* Find the end of the entry, as indicated by a comma (',') */
|
||||
/* Find the end of the entry, as indicated by a
|
||||
* comma (',') */
|
||||
for (entry_end = entry_start; entry_end != data_end; entry_end++) {
|
||||
if (*entry_end == ',') {
|
||||
break;
|
||||
@@ -184,18 +209,21 @@ bool cpuinfo_linux_parse_cpulist(const char* filename, cpuinfo_cpulist_callback
|
||||
}
|
||||
|
||||
/*
|
||||
* If we located separator at the end of the entry, parse it.
|
||||
* Otherwise, there may be more data at the end; read the file once again.
|
||||
* If we located separator at the end of the
|
||||
* entry, parse it. Otherwise, there may be more
|
||||
* data at the end; read the file once again.
|
||||
*/
|
||||
if (entry_end != data_end) {
|
||||
const bool entry_status = parse_entry(entry_start, entry_end, callback, context);
|
||||
const bool entry_status =
|
||||
parse_entry(entry_start, entry_end, callback, context);
|
||||
status &= entry_status;
|
||||
entry_start = entry_end + 1;
|
||||
}
|
||||
} while (entry_end != data_end);
|
||||
|
||||
/* Move remaining partial entry data at the end to the beginning of the buffer */
|
||||
const size_t entry_length = (size_t) (entry_end - entry_start);
|
||||
/* Move remaining partial entry data at the end to the
|
||||
* beginning of the buffer */
|
||||
const size_t entry_length = (size_t)(entry_end - entry_start);
|
||||
memmove(buffer, entry_start, entry_length);
|
||||
data_start = &buffer[entry_length];
|
||||
}
|
||||
|
||||
26
3rdparty/cpuinfo/src/linux/mockfile.c
vendored
26
3rdparty/cpuinfo/src/linux/mockfile.c
vendored
@@ -1,30 +1,28 @@
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sched.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !CPUINFO_MOCK
|
||||
#error This file should be built only in mock mode
|
||||
#error This file should be built only in mock mode
|
||||
#endif
|
||||
|
||||
#include <cpuinfo-mock.h>
|
||||
#include <arm/linux/api.h>
|
||||
#include <arm/midr.h>
|
||||
#include <cpuinfo-mock.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
|
||||
static struct cpuinfo_mock_file* cpuinfo_mock_files = NULL;
|
||||
static uint32_t cpuinfo_mock_file_count = 0;
|
||||
|
||||
|
||||
void CPUINFO_ABI cpuinfo_mock_filesystem(struct cpuinfo_mock_file* files) {
|
||||
cpuinfo_log_info("filesystem mocking enabled");
|
||||
uint32_t file_count = 0;
|
||||
@@ -54,7 +52,7 @@ int CPUINFO_ABI cpuinfo_mock_open(const char* path, int oflag) {
|
||||
return -1;
|
||||
}
|
||||
cpuinfo_mock_files[i].offset = 0;
|
||||
return (int) i;
|
||||
return (int)i;
|
||||
}
|
||||
}
|
||||
errno = ENOENT;
|
||||
@@ -67,7 +65,7 @@ int CPUINFO_ABI cpuinfo_mock_close(int fd) {
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
if ((unsigned int) fd >= cpuinfo_mock_file_count) {
|
||||
if ((unsigned int)fd >= cpuinfo_mock_file_count) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
@@ -85,7 +83,7 @@ ssize_t CPUINFO_ABI cpuinfo_mock_read(int fd, void* buffer, size_t capacity) {
|
||||
return read(fd, buffer, capacity);
|
||||
}
|
||||
|
||||
if ((unsigned int) fd >= cpuinfo_mock_file_count) {
|
||||
if ((unsigned int)fd >= cpuinfo_mock_file_count) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
@@ -99,7 +97,7 @@ ssize_t CPUINFO_ABI cpuinfo_mock_read(int fd, void* buffer, size_t capacity) {
|
||||
if (count > capacity) {
|
||||
count = capacity;
|
||||
}
|
||||
memcpy(buffer, (void*) cpuinfo_mock_files[fd].content + offset, count);
|
||||
memcpy(buffer, (void*)cpuinfo_mock_files[fd].content + offset, count);
|
||||
cpuinfo_mock_files[fd].offset += count;
|
||||
return (ssize_t) count;
|
||||
return (ssize_t)count;
|
||||
}
|
||||
|
||||
53
3rdparty/cpuinfo/src/linux/multiline.c
vendored
53
3rdparty/cpuinfo/src/linux/multiline.c
vendored
@@ -1,27 +1,29 @@
|
||||
#include <alloca.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <alloca.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
#include <cpuinfo-mock.h>
|
||||
#include <cpuinfo-mock.h>
|
||||
#endif
|
||||
#include <linux/api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
#include <linux/api.h>
|
||||
|
||||
|
||||
bool cpuinfo_linux_parse_multiline_file(const char* filename, size_t buffer_size, cpuinfo_line_callback callback, void* context)
|
||||
{
|
||||
bool cpuinfo_linux_parse_multiline_file(
|
||||
const char* filename,
|
||||
size_t buffer_size,
|
||||
cpuinfo_line_callback callback,
|
||||
void* context) {
|
||||
int file = -1;
|
||||
bool status = false;
|
||||
char* buffer = (char*) alloca(buffer_size);
|
||||
char* buffer = (char*)alloca(buffer_size);
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
file = cpuinfo_mock_open(filename, O_RDONLY);
|
||||
@@ -41,22 +43,23 @@ bool cpuinfo_linux_parse_multiline_file(const char* filename, size_t buffer_size
|
||||
ssize_t bytes_read;
|
||||
do {
|
||||
#if CPUINFO_MOCK
|
||||
bytes_read = cpuinfo_mock_read(file, data_start, (size_t) (buffer_end - data_start));
|
||||
bytes_read = cpuinfo_mock_read(file, data_start, (size_t)(buffer_end - data_start));
|
||||
#else
|
||||
bytes_read = read(file, data_start, (size_t) (buffer_end - data_start));
|
||||
bytes_read = read(file, data_start, (size_t)(buffer_end - data_start));
|
||||
#endif
|
||||
if (bytes_read < 0) {
|
||||
cpuinfo_log_info("failed to read file %s at position %zu: %s",
|
||||
filename, position, strerror(errno));
|
||||
cpuinfo_log_info(
|
||||
"failed to read file %s at position %zu: %s", filename, position, strerror(errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
position += (size_t) bytes_read;
|
||||
const char* data_end = data_start + (size_t) bytes_read;
|
||||
position += (size_t)bytes_read;
|
||||
const char* data_end = data_start + (size_t)bytes_read;
|
||||
const char* line_start = buffer;
|
||||
|
||||
if (bytes_read == 0) {
|
||||
/* No more data in the file: process the remaining text in the buffer as a single entry */
|
||||
/* No more data in the file: process the remaining text
|
||||
* in the buffer as a single entry */
|
||||
const char* line_end = data_end;
|
||||
if (!callback(line_start, line_end, context, line_number)) {
|
||||
goto cleanup;
|
||||
@@ -64,7 +67,9 @@ bool cpuinfo_linux_parse_multiline_file(const char* filename, size_t buffer_size
|
||||
} else {
|
||||
const char* line_end;
|
||||
do {
|
||||
/* Find the end of the entry, as indicated by newline character ('\n') */
|
||||
/* Find the end of the entry, as indicated by
|
||||
* newline character ('\n')
|
||||
*/
|
||||
for (line_end = line_start; line_end != data_end; line_end++) {
|
||||
if (*line_end == '\n') {
|
||||
break;
|
||||
@@ -72,8 +77,9 @@ bool cpuinfo_linux_parse_multiline_file(const char* filename, size_t buffer_size
|
||||
}
|
||||
|
||||
/*
|
||||
* If we located separator at the end of the entry, parse it.
|
||||
* Otherwise, there may be more data at the end; read the file once again.
|
||||
* If we located separator at the end of the
|
||||
* entry, parse it. Otherwise, there may be more
|
||||
* data at the end; read the file once again.
|
||||
*/
|
||||
if (line_end != data_end) {
|
||||
if (!callback(line_start, line_end, context, line_number++)) {
|
||||
@@ -83,8 +89,9 @@ bool cpuinfo_linux_parse_multiline_file(const char* filename, size_t buffer_size
|
||||
}
|
||||
} while (line_end != data_end);
|
||||
|
||||
/* Move remaining partial line data at the end to the beginning of the buffer */
|
||||
const size_t line_length = (size_t) (line_end - line_start);
|
||||
/* Move remaining partial line data at the end to the
|
||||
* beginning of the buffer */
|
||||
const size_t line_length = (size_t)(line_end - line_start);
|
||||
memmove(buffer, line_start, line_length);
|
||||
data_start = &buffer[line_length];
|
||||
}
|
||||
|
||||
416
3rdparty/cpuinfo/src/linux/processors.c
vendored
416
3rdparty/cpuinfo/src/linux/processors.c
vendored
@@ -1,50 +1,61 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(__ANDROID__)
|
||||
/*
|
||||
* sched.h is only used for CPU_SETSIZE constant.
|
||||
* Android NDK headers before platform 21 do have this constant in sched.h
|
||||
*/
|
||||
#include <sched.h>
|
||||
/*
|
||||
* sched.h is only used for CPU_SETSIZE constant.
|
||||
* Android NDK headers before platform 21 do have this constant in sched.h
|
||||
*/
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
#include <linux/api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
|
||||
#include <linux/api.h>
|
||||
|
||||
#define STRINGIFY(token) #token
|
||||
|
||||
#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 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
|
||||
#define PACKAGE_ID_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/physical_package_id"))
|
||||
#define PACKAGE_ID_FILENAME_SIZE \
|
||||
(sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/physical_package_id"))
|
||||
#define PACKAGE_ID_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/physical_package_id"
|
||||
#define PACKAGE_ID_FILESIZE 32
|
||||
#define CORE_ID_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/core_id"))
|
||||
#define CORE_ID_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/core_id"
|
||||
#define CORE_ID_FILESIZE 32
|
||||
|
||||
#define CORE_SIBLINGS_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/core_siblings_list"))
|
||||
#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 THREAD_SIBLINGS_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/thread_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"
|
||||
|
||||
#define POSSIBLE_CPULIST_FILENAME "/sys/devices/system/cpu/possible"
|
||||
#define PRESENT_CPULIST_FILENAME "/sys/devices/system/cpu/present"
|
||||
|
||||
|
||||
inline static const char* parse_number(const char* start, const char* end, uint32_t number_ptr[restrict static 1]) {
|
||||
uint32_t number = 0;
|
||||
const char* parsed = start;
|
||||
for (; parsed != end; parsed++) {
|
||||
const uint32_t digit = (uint32_t) (uint8_t) (*parsed) - (uint32_t) '0';
|
||||
const uint32_t digit = (uint32_t)(uint8_t)(*parsed) - (uint32_t)'0';
|
||||
if (digit >= 10) {
|
||||
break;
|
||||
}
|
||||
@@ -68,20 +79,20 @@ inline static bool is_whitespace(char c) {
|
||||
}
|
||||
|
||||
#if defined(__ANDROID__) && !defined(CPU_SETSIZE)
|
||||
/*
|
||||
* Android NDK headers before platform 21 do not define CPU_SETSIZE,
|
||||
* so we hard-code its value, as defined in platform 21 headers
|
||||
*/
|
||||
#if defined(__LP64__)
|
||||
static const uint32_t default_max_processors_count = 1024;
|
||||
#else
|
||||
static const uint32_t default_max_processors_count = 32;
|
||||
#endif
|
||||
/*
|
||||
* Android NDK headers before platform 21 do not define CPU_SETSIZE,
|
||||
* so we hard-code its value, as defined in platform 21 headers
|
||||
*/
|
||||
#if defined(__LP64__)
|
||||
static const uint32_t default_max_processors_count = 1024;
|
||||
#else
|
||||
static const uint32_t default_max_processors_count = CPU_SETSIZE;
|
||||
static const uint32_t default_max_processors_count = 32;
|
||||
#endif
|
||||
#else
|
||||
static const uint32_t default_max_processors_count = CPU_SETSIZE;
|
||||
#endif
|
||||
|
||||
static bool uint32_parser(const char* text_start, const char* text_end, void* context) {
|
||||
static bool uint32_parser(const char* filename, const char* text_start, const char* text_end, void* context) {
|
||||
if (text_start == text_end) {
|
||||
cpuinfo_log_error("failed to parse file %s: file is empty", KERNEL_MAX_FILENAME);
|
||||
return false;
|
||||
@@ -90,20 +101,26 @@ static bool uint32_parser(const char* text_start, const char* text_end, void* co
|
||||
uint32_t kernel_max = 0;
|
||||
const char* parsed_end = parse_number(text_start, text_end, &kernel_max);
|
||||
if (parsed_end == text_start) {
|
||||
cpuinfo_log_error("failed to parse file %s: \"%.*s\" is not an unsigned number",
|
||||
KERNEL_MAX_FILENAME, (int) (text_end - text_start), text_start);
|
||||
cpuinfo_log_error(
|
||||
"failed to parse file %s: \"%.*s\" is not an unsigned number",
|
||||
filename,
|
||||
(int)(text_end - text_start),
|
||||
text_start);
|
||||
return false;
|
||||
} else {
|
||||
for (const char* char_ptr = parsed_end; char_ptr != text_end; char_ptr++) {
|
||||
if (!is_whitespace(*char_ptr)) {
|
||||
cpuinfo_log_warning("non-whitespace characters \"%.*s\" following number in file %s are ignored",
|
||||
(int) (text_end - char_ptr), char_ptr, KERNEL_MAX_FILENAME);
|
||||
cpuinfo_log_warning(
|
||||
"non-whitespace characters \"%.*s\" following number in file %s are ignored",
|
||||
(int)(text_end - char_ptr),
|
||||
char_ptr,
|
||||
filename);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t* kernel_max_ptr = (uint32_t*) context;
|
||||
uint32_t* kernel_max_ptr = (uint32_t*)context;
|
||||
*kernel_max_ptr = kernel_max;
|
||||
return true;
|
||||
}
|
||||
@@ -111,112 +128,160 @@ static bool uint32_parser(const char* text_start, const char* text_end, void* co
|
||||
uint32_t cpuinfo_linux_get_max_processors_count(void) {
|
||||
uint32_t kernel_max;
|
||||
if (cpuinfo_linux_parse_small_file(KERNEL_MAX_FILENAME, KERNEL_MAX_FILESIZE, uint32_parser, &kernel_max)) {
|
||||
cpuinfo_log_debug("parsed kernel_max value of %"PRIu32" from %s", kernel_max, KERNEL_MAX_FILENAME);
|
||||
cpuinfo_log_debug("parsed kernel_max value of %" PRIu32 " from %s", kernel_max, KERNEL_MAX_FILENAME);
|
||||
|
||||
if (kernel_max >= default_max_processors_count) {
|
||||
cpuinfo_log_warning("kernel_max value of %"PRIu32" parsed from %s exceeds platform-default limit %"PRIu32,
|
||||
kernel_max, KERNEL_MAX_FILENAME, default_max_processors_count - 1);
|
||||
cpuinfo_log_warning(
|
||||
"kernel_max value of %" PRIu32
|
||||
" parsed from %s exceeds platform-default limit %" PRIu32,
|
||||
kernel_max,
|
||||
KERNEL_MAX_FILENAME,
|
||||
default_max_processors_count - 1);
|
||||
}
|
||||
|
||||
return kernel_max + 1;
|
||||
} else {
|
||||
cpuinfo_log_warning("using platform-default max processors count = %"PRIu32, default_max_processors_count);
|
||||
cpuinfo_log_warning(
|
||||
"using platform-default max processors count = %" PRIu32, default_max_processors_count);
|
||||
return default_max_processors_count;
|
||||
}
|
||||
}
|
||||
|
||||
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(
|
||||
max_frequency_filename, FREQUENCY_FILENAME_SIZE, MAX_FREQUENCY_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int) chars_formatted >= FREQUENCY_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for max frequency of processor %"PRIu32, processor);
|
||||
const int chars_formatted =
|
||||
snprintf(max_frequency_filename, FREQUENCY_FILENAME_SIZE, MAX_FREQUENCY_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int)chars_formatted >= FREQUENCY_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for max frequency of processor %" PRIu32, processor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t max_frequency;
|
||||
if (cpuinfo_linux_parse_small_file(max_frequency_filename, FREQUENCY_FILESIZE, uint32_parser, &max_frequency)) {
|
||||
cpuinfo_log_debug("parsed max frequency value of %"PRIu32" KHz for logical processor %"PRIu32" from %s",
|
||||
max_frequency, processor, max_frequency_filename);
|
||||
cpuinfo_log_debug(
|
||||
"parsed max frequency value of %" PRIu32 " KHz for logical processor %" PRIu32 " from %s",
|
||||
max_frequency,
|
||||
processor,
|
||||
max_frequency_filename);
|
||||
return max_frequency;
|
||||
} else {
|
||||
cpuinfo_log_warning("failed to parse max frequency for processor %"PRIu32" from %s",
|
||||
processor, max_frequency_filename);
|
||||
cpuinfo_log_warning(
|
||||
"failed to parse max frequency for processor %" PRIu32 " from %s",
|
||||
processor,
|
||||
max_frequency_filename);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t cpuinfo_linux_get_processor_min_frequency(uint32_t processor) {
|
||||
char min_frequency_filename[FREQUENCY_FILENAME_SIZE];
|
||||
const int chars_formatted = snprintf(
|
||||
min_frequency_filename, FREQUENCY_FILENAME_SIZE, MIN_FREQUENCY_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int) chars_formatted >= FREQUENCY_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for min frequency of processor %"PRIu32, processor);
|
||||
const int chars_formatted =
|
||||
snprintf(min_frequency_filename, FREQUENCY_FILENAME_SIZE, MIN_FREQUENCY_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int)chars_formatted >= FREQUENCY_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for min frequency of processor %" PRIu32, processor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t min_frequency;
|
||||
if (cpuinfo_linux_parse_small_file(min_frequency_filename, FREQUENCY_FILESIZE, uint32_parser, &min_frequency)) {
|
||||
cpuinfo_log_debug("parsed min frequency value of %"PRIu32" KHz for logical processor %"PRIu32" from %s",
|
||||
min_frequency, processor, min_frequency_filename);
|
||||
cpuinfo_log_debug(
|
||||
"parsed min frequency value of %" PRIu32 " KHz for logical processor %" PRIu32 " from %s",
|
||||
min_frequency,
|
||||
processor,
|
||||
min_frequency_filename);
|
||||
return min_frequency;
|
||||
} else {
|
||||
/*
|
||||
* This error is less severe than parsing max frequency, because min frequency is only useful for clustering,
|
||||
* while max frequency is also needed for peak FLOPS calculation.
|
||||
* This error is less severe than parsing max frequency, because
|
||||
* min frequency is only useful for clustering, while max
|
||||
* frequency is also needed for peak FLOPS calculation.
|
||||
*/
|
||||
cpuinfo_log_info("failed to parse min frequency for processor %"PRIu32" from %s",
|
||||
processor, min_frequency_filename);
|
||||
cpuinfo_log_info(
|
||||
"failed to parse min frequency for processor %" PRIu32 " from %s",
|
||||
processor,
|
||||
min_frequency_filename);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool cpuinfo_linux_get_processor_core_id(uint32_t processor, uint32_t core_id_ptr[restrict static 1]) {
|
||||
char core_id_filename[PACKAGE_ID_FILENAME_SIZE];
|
||||
const int chars_formatted = snprintf(
|
||||
core_id_filename, CORE_ID_FILENAME_SIZE, CORE_ID_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int) chars_formatted >= CORE_ID_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for core id of processor %"PRIu32, processor);
|
||||
const int chars_formatted =
|
||||
snprintf(core_id_filename, CORE_ID_FILENAME_SIZE, CORE_ID_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int)chars_formatted >= CORE_ID_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for core id of processor %" PRIu32, processor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t core_id;
|
||||
if (cpuinfo_linux_parse_small_file(core_id_filename, CORE_ID_FILESIZE, uint32_parser, &core_id)) {
|
||||
cpuinfo_log_debug("parsed core id value of %"PRIu32" for logical processor %"PRIu32" from %s",
|
||||
core_id, processor, core_id_filename);
|
||||
cpuinfo_log_debug(
|
||||
"parsed core id value of %" PRIu32 " for logical processor %" PRIu32 " from %s",
|
||||
core_id,
|
||||
processor,
|
||||
core_id_filename);
|
||||
*core_id_ptr = core_id;
|
||||
return true;
|
||||
} else {
|
||||
cpuinfo_log_info("failed to parse core id for processor %"PRIu32" from %s",
|
||||
processor, core_id_filename);
|
||||
cpuinfo_log_info(
|
||||
"failed to parse core id for processor %" PRIu32 " from %s", processor, core_id_filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool cpuinfo_linux_get_processor_package_id(uint32_t processor, uint32_t package_id_ptr[restrict static 1]) {
|
||||
char package_id_filename[PACKAGE_ID_FILENAME_SIZE];
|
||||
const int chars_formatted = snprintf(
|
||||
package_id_filename, PACKAGE_ID_FILENAME_SIZE, PACKAGE_ID_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int) chars_formatted >= PACKAGE_ID_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for package id of processor %"PRIu32, processor);
|
||||
const int chars_formatted =
|
||||
snprintf(package_id_filename, PACKAGE_ID_FILENAME_SIZE, PACKAGE_ID_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int)chars_formatted >= PACKAGE_ID_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for package id of processor %" PRIu32, processor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t package_id;
|
||||
if (cpuinfo_linux_parse_small_file(package_id_filename, PACKAGE_ID_FILESIZE, uint32_parser, &package_id)) {
|
||||
cpuinfo_log_debug("parsed package id value of %"PRIu32" for logical processor %"PRIu32" from %s",
|
||||
package_id, processor, package_id_filename);
|
||||
cpuinfo_log_debug(
|
||||
"parsed package id value of %" PRIu32 " for logical processor %" PRIu32 " from %s",
|
||||
package_id,
|
||||
processor,
|
||||
package_id_filename);
|
||||
*package_id_ptr = package_id;
|
||||
return true;
|
||||
} else {
|
||||
cpuinfo_log_info("failed to parse package id for processor %"PRIu32" from %s",
|
||||
processor, package_id_filename);
|
||||
cpuinfo_log_info(
|
||||
"failed to parse package id for processor %" PRIu32 " from %s", processor, package_id_filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool max_processor_number_parser(uint32_t processor_list_start, uint32_t processor_list_end, void* context) {
|
||||
uint32_t* processor_number_ptr = (uint32_t*) context;
|
||||
uint32_t* processor_number_ptr = (uint32_t*)context;
|
||||
const uint32_t processor_list_last = processor_list_end - 1;
|
||||
if (*processor_number_ptr < processor_list_last) {
|
||||
*processor_number_ptr = processor_list_last;
|
||||
@@ -226,18 +291,21 @@ static bool max_processor_number_parser(uint32_t processor_list_start, uint32_t
|
||||
|
||||
uint32_t cpuinfo_linux_get_max_possible_processor(uint32_t max_processors_count) {
|
||||
uint32_t max_possible_processor = 0;
|
||||
if (!cpuinfo_linux_parse_cpulist(POSSIBLE_CPULIST_FILENAME, max_processor_number_parser, &max_possible_processor)) {
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
cpuinfo_log_error("failed to parse the list of possible processors in %s", POSSIBLE_CPULIST_FILENAME);
|
||||
#else
|
||||
cpuinfo_log_warning("failed to parse the list of possible processors in %s", POSSIBLE_CPULIST_FILENAME);
|
||||
#endif
|
||||
if (!cpuinfo_linux_parse_cpulist(
|
||||
POSSIBLE_CPULIST_FILENAME, max_processor_number_parser, &max_possible_processor)) {
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
cpuinfo_log_error("failed to parse the list of possible processors in %s", POSSIBLE_CPULIST_FILENAME);
|
||||
#else
|
||||
cpuinfo_log_warning("failed to parse the list of possible processors in %s", POSSIBLE_CPULIST_FILENAME);
|
||||
#endif
|
||||
return UINT32_MAX;
|
||||
}
|
||||
if (max_possible_processor >= max_processors_count) {
|
||||
cpuinfo_log_warning(
|
||||
"maximum possible processor number %"PRIu32" exceeds system limit %"PRIu32": truncating to the latter",
|
||||
max_possible_processor, max_processors_count - 1);
|
||||
"maximum possible processor number %" PRIu32 " exceeds system limit %" PRIu32
|
||||
": truncating to the latter",
|
||||
max_possible_processor,
|
||||
max_processors_count - 1);
|
||||
max_possible_processor = max_processors_count - 1;
|
||||
}
|
||||
return max_possible_processor;
|
||||
@@ -245,18 +313,21 @@ uint32_t cpuinfo_linux_get_max_possible_processor(uint32_t max_processors_count)
|
||||
|
||||
uint32_t cpuinfo_linux_get_max_present_processor(uint32_t max_processors_count) {
|
||||
uint32_t max_present_processor = 0;
|
||||
if (!cpuinfo_linux_parse_cpulist(PRESENT_CPULIST_FILENAME, max_processor_number_parser, &max_present_processor)) {
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
cpuinfo_log_error("failed to parse the list of present processors in %s", PRESENT_CPULIST_FILENAME);
|
||||
#else
|
||||
cpuinfo_log_warning("failed to parse the list of present processors in %s", PRESENT_CPULIST_FILENAME);
|
||||
#endif
|
||||
if (!cpuinfo_linux_parse_cpulist(
|
||||
PRESENT_CPULIST_FILENAME, max_processor_number_parser, &max_present_processor)) {
|
||||
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
|
||||
cpuinfo_log_error("failed to parse the list of present processors in %s", PRESENT_CPULIST_FILENAME);
|
||||
#else
|
||||
cpuinfo_log_warning("failed to parse the list of present processors in %s", PRESENT_CPULIST_FILENAME);
|
||||
#endif
|
||||
return UINT32_MAX;
|
||||
}
|
||||
if (max_present_processor >= max_processors_count) {
|
||||
cpuinfo_log_warning(
|
||||
"maximum present processor number %"PRIu32" exceeds system limit %"PRIu32": truncating to the latter",
|
||||
max_present_processor, max_processors_count - 1);
|
||||
"maximum present processor number %" PRIu32 " exceeds system limit %" PRIu32
|
||||
": truncating to the latter",
|
||||
max_present_processor,
|
||||
max_processors_count - 1);
|
||||
max_present_processor = max_processors_count - 1;
|
||||
}
|
||||
return max_present_processor;
|
||||
@@ -270,23 +341,25 @@ struct detect_processors_context {
|
||||
};
|
||||
|
||||
static bool detect_processor_parser(uint32_t processor_list_start, uint32_t processor_list_end, void* context) {
|
||||
const uint32_t max_processors_count = ((struct detect_processors_context*) context)->max_processors_count;
|
||||
const uint32_t* processor0_flags = ((struct detect_processors_context*) context)->processor0_flags;
|
||||
const uint32_t processor_struct_size = ((struct detect_processors_context*) context)->processor_struct_size;
|
||||
const uint32_t detected_flag = ((struct detect_processors_context*) context)->detected_flag;
|
||||
const uint32_t max_processors_count = ((struct detect_processors_context*)context)->max_processors_count;
|
||||
const uint32_t* processor0_flags = ((struct detect_processors_context*)context)->processor0_flags;
|
||||
const uint32_t processor_struct_size = ((struct detect_processors_context*)context)->processor_struct_size;
|
||||
const uint32_t detected_flag = ((struct detect_processors_context*)context)->detected_flag;
|
||||
|
||||
for (uint32_t processor = processor_list_start; processor < processor_list_end; processor++) {
|
||||
if (processor >= max_processors_count) {
|
||||
break;
|
||||
}
|
||||
*((uint32_t*) ((uintptr_t) processor0_flags + processor_struct_size * processor)) |= detected_flag;
|
||||
*((uint32_t*)((uintptr_t)processor0_flags + processor_struct_size * processor)) |= detected_flag;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cpuinfo_linux_detect_possible_processors(uint32_t max_processors_count,
|
||||
uint32_t* processor0_flags, uint32_t processor_struct_size, uint32_t possible_flag)
|
||||
{
|
||||
bool cpuinfo_linux_detect_possible_processors(
|
||||
uint32_t max_processors_count,
|
||||
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,
|
||||
@@ -301,9 +374,11 @@ 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)
|
||||
{
|
||||
bool cpuinfo_linux_detect_present_processors(
|
||||
uint32_t max_processors_count,
|
||||
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,
|
||||
@@ -327,30 +402,65 @@ struct siblings_context {
|
||||
};
|
||||
|
||||
static bool siblings_parser(uint32_t sibling_list_start, uint32_t sibling_list_end, struct siblings_context* context) {
|
||||
const char* group_name = context->group_name;
|
||||
const uint32_t max_processors_count = context->max_processors_count;
|
||||
const uint32_t processor = context->processor;
|
||||
const char* group_name = context->group_name;
|
||||
const uint32_t max_processors_count = context->max_processors_count;
|
||||
const uint32_t processor = context->processor;
|
||||
|
||||
if (sibling_list_end > max_processors_count) {
|
||||
cpuinfo_log_warning("ignore %s siblings %"PRIu32"-%"PRIu32" of processor %"PRIu32,
|
||||
group_name, max_processors_count, sibling_list_end - 1, processor);
|
||||
cpuinfo_log_warning(
|
||||
"ignore %s siblings %" PRIu32 "-%" PRIu32 " of processor %" PRIu32,
|
||||
group_name,
|
||||
max_processors_count,
|
||||
sibling_list_end - 1,
|
||||
processor);
|
||||
sibling_list_end = max_processors_count;
|
||||
}
|
||||
|
||||
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);
|
||||
if ((unsigned int) chars_formatted >= CORE_SIBLINGS_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for core siblings of processor %"PRIu32, processor);
|
||||
const int chars_formatted =
|
||||
snprintf(core_siblings_filename, CORE_SIBLINGS_FILENAME_SIZE, CORE_SIBLINGS_FILENAME_FORMAT, processor);
|
||||
if ((unsigned int)chars_formatted >= CORE_SIBLINGS_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for core siblings of processor %" PRIu32, processor);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -361,13 +471,14 @@ bool cpuinfo_linux_detect_core_siblings(
|
||||
.callback = callback,
|
||||
.callback_context = context,
|
||||
};
|
||||
if (cpuinfo_linux_parse_cpulist(core_siblings_filename,
|
||||
(cpuinfo_cpulist_callback) siblings_parser, &siblings_context))
|
||||
{
|
||||
if (cpuinfo_linux_parse_cpulist(
|
||||
core_siblings_filename, (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",
|
||||
processor, core_siblings_filename);
|
||||
cpuinfo_log_info(
|
||||
"failed to parse the list of core siblings for processor %" PRIu32 " from %s",
|
||||
processor,
|
||||
core_siblings_filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -376,13 +487,12 @@ 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);
|
||||
if ((unsigned int) chars_formatted >= THREAD_SIBLINGS_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for thread siblings of processor %"PRIu32, processor);
|
||||
if ((unsigned int)chars_formatted >= THREAD_SIBLINGS_FILENAME_SIZE) {
|
||||
cpuinfo_log_warning("failed to format filename for thread siblings of processor %" PRIu32, processor);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -393,14 +503,78 @@ bool cpuinfo_linux_detect_thread_siblings(
|
||||
.callback = callback,
|
||||
.callback_context = context,
|
||||
};
|
||||
if (cpuinfo_linux_parse_cpulist(thread_siblings_filename,
|
||||
(cpuinfo_cpulist_callback) siblings_parser, &siblings_context))
|
||||
{
|
||||
if (cpuinfo_linux_parse_cpulist(
|
||||
thread_siblings_filename, (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",
|
||||
processor, thread_siblings_filename);
|
||||
cpuinfo_log_info(
|
||||
"failed to parse the list of thread siblings for processor %" PRIu32 " from %s",
|
||||
processor,
|
||||
thread_siblings_filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
42
3rdparty/cpuinfo/src/linux/smallfile.c
vendored
42
3rdparty/cpuinfo/src/linux/smallfile.c
vendored
@@ -1,30 +1,33 @@
|
||||
#include <alloca.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <alloca.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
#include <cpuinfo-mock.h>
|
||||
#include <cpuinfo-mock.h>
|
||||
#endif
|
||||
#include <linux/api.h>
|
||||
#include <cpuinfo/log.h>
|
||||
#include <linux/api.h>
|
||||
|
||||
|
||||
bool cpuinfo_linux_parse_small_file(const char* filename, size_t buffer_size, cpuinfo_smallfile_callback callback, void* context) {
|
||||
bool cpuinfo_linux_parse_small_file(
|
||||
const char* filename,
|
||||
size_t buffer_size,
|
||||
cpuinfo_smallfile_callback callback,
|
||||
void* context) {
|
||||
int file = -1;
|
||||
bool status = false;
|
||||
char* buffer = (char*) alloca(buffer_size);
|
||||
char* buffer = (char*)alloca(buffer_size);
|
||||
|
||||
#if CPUINFO_LOG_DEBUG_PARSERS
|
||||
cpuinfo_log_debug("parsing small file %s", filename);
|
||||
#endif
|
||||
#if CPUINFO_LOG_DEBUG_PARSERS
|
||||
cpuinfo_log_debug("parsing small file %s", filename);
|
||||
#endif
|
||||
|
||||
#if CPUINFO_MOCK
|
||||
file = cpuinfo_mock_open(filename, O_RDONLY);
|
||||
@@ -45,17 +48,22 @@ bool cpuinfo_linux_parse_small_file(const char* filename, size_t buffer_size, cp
|
||||
bytes_read = read(file, &buffer[buffer_position], buffer_size - buffer_position);
|
||||
#endif
|
||||
if (bytes_read < 0) {
|
||||
cpuinfo_log_info("failed to read file %s at position %zu: %s", filename, buffer_position, strerror(errno));
|
||||
cpuinfo_log_info(
|
||||
"failed to read file %s at position %zu: %s",
|
||||
filename,
|
||||
buffer_position,
|
||||
strerror(errno));
|
||||
goto cleanup;
|
||||
}
|
||||
buffer_position += (size_t) bytes_read;
|
||||
buffer_position += (size_t)bytes_read;
|
||||
if (buffer_position >= buffer_size) {
|
||||
cpuinfo_log_error("failed to read file %s: insufficient buffer of size %zu", filename, buffer_size);
|
||||
cpuinfo_log_error(
|
||||
"failed to read file %s: insufficient buffer of size %zu", filename, buffer_size);
|
||||
goto cleanup;
|
||||
}
|
||||
} while (bytes_read != 0);
|
||||
|
||||
status = callback(buffer, &buffer[buffer_position], context);
|
||||
status = callback(filename, buffer, &buffer[buffer_position], context);
|
||||
|
||||
cleanup:
|
||||
if (file != -1) {
|
||||
|
||||
203
3rdparty/cpuinfo/src/log.c
vendored
Normal file
203
3rdparty/cpuinfo/src/log.c
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.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
|
||||
2
3rdparty/cpuinfo/src/mach/api.h
vendored
2
3rdparty/cpuinfo/src/mach/api.h
vendored
@@ -4,7 +4,6 @@
|
||||
|
||||
#define CPUINFO_MACH_MAX_CACHE_LEVELS 8
|
||||
|
||||
|
||||
struct cpuinfo_mach_topology {
|
||||
uint32_t packages;
|
||||
uint32_t cores;
|
||||
@@ -12,5 +11,4 @@ struct cpuinfo_mach_topology {
|
||||
uint32_t threads_per_cache[CPUINFO_MACH_MAX_CACHE_LEVELS];
|
||||
};
|
||||
|
||||
|
||||
struct cpuinfo_mach_topology cpuinfo_mach_detect_topology(void);
|
||||
|
||||
14
3rdparty/cpuinfo/src/mach/topology.c
vendored
14
3rdparty/cpuinfo/src/mach/topology.c
vendored
@@ -1,16 +1,15 @@
|
||||
#include <string.h>
|
||||
#include <alloca.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cpuinfo/log.h>
|
||||
#include <mach/api.h>
|
||||
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
|
||||
struct cpuinfo_mach_topology cpuinfo_mach_detect_topology(void) {
|
||||
int cores = 1;
|
||||
size_t sizeof_cores = sizeof(cores);
|
||||
@@ -41,12 +40,9 @@ struct cpuinfo_mach_topology cpuinfo_mach_detect_topology(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
cpuinfo_log_debug("mach topology: packages = %d, cores = %d, threads = %d", packages, (int) cores, (int) threads);
|
||||
cpuinfo_log_debug("mach topology: packages = %d, cores = %d, threads = %d", packages, (int)cores, (int)threads);
|
||||
struct cpuinfo_mach_topology topology = {
|
||||
.packages = (uint32_t) packages,
|
||||
.cores = (uint32_t) cores,
|
||||
.threads = (uint32_t) threads
|
||||
};
|
||||
.packages = (uint32_t)packages, .cores = (uint32_t)cores, .threads = (uint32_t)threads};
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
size_t cacheconfig_size = 0;
|
||||
@@ -63,7 +59,7 @@ struct cpuinfo_mach_topology cpuinfo_mach_detect_topology(void) {
|
||||
cache_configs = CPUINFO_MACH_MAX_CACHE_LEVELS;
|
||||
}
|
||||
for (size_t i = 0; i < cache_configs; i++) {
|
||||
cpuinfo_log_debug("mach hw.cacheconfig[%zu]: %"PRIu64, i, cacheconfig[i]);
|
||||
cpuinfo_log_debug("mach hw.cacheconfig[%zu]: %" PRIu64, i, cacheconfig[i]);
|
||||
topology.threads_per_cache[i] = cacheconfig[i];
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user