mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
Merge remote-tracking branch 'origin/main' into review/malibridge-1950
This commit is contained in:
commit
f05e0df39e
135 files changed
+5415
-979
No files matched your search
@@ -3,6 +3,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "kgsl_busy.h"
|
||||
#include "kgsl_layout.h"
|
||||
|
||||
#define ENTRIES 819
|
||||
|
||||
@@ -52,5 +53,61 @@ int main(void) {
|
||||
assert(moved == 0);
|
||||
|
||||
puts("PASS: kgsl memstore busy");
|
||||
|
||||
// Hardware-scheduled kernels: ringbuffer entries stay 0, contexts carry the stamps.
|
||||
memset(memstore, 0, sizeof(memstore));
|
||||
static uint32_t seen[ENTRIES], ctx_last[ENTRIES];
|
||||
int live[KGSL_BUSY_MAX_LIVE];
|
||||
stamp(3, 50, 50);
|
||||
stamp(9, 21, 20);
|
||||
stamp(first - 1, 4, 4);
|
||||
int count = kgsl_busy_scan_contexts(memstore, first, seen, live, KGSL_BUSY_MAX_LIVE);
|
||||
assert(count == 3 && live[0] == 3 && live[1] == 9 && live[2] == first - 1);
|
||||
moved = 0;
|
||||
assert(kgsl_busy_sample_contexts(memstore, live, count, ctx_last, &moved) == 1);
|
||||
assert(moved == 1 && ctx_last[9] == 21);
|
||||
|
||||
// Busy or newly started contexts come first; idle ones that have run work stay in the list.
|
||||
stamp(9, 21, 21);
|
||||
stamp(5, 2, 1);
|
||||
count = kgsl_busy_scan_contexts(memstore, first, seen, live, KGSL_BUSY_MAX_LIVE);
|
||||
assert(count == 4 && live[0] == 5 && live[1] == 3 && live[2] == 9 && live[3] == first - 1);
|
||||
moved = 0;
|
||||
assert(kgsl_busy_sample_contexts(memstore, live, count, ctx_last, &moved) == 1);
|
||||
assert(moved == 1);
|
||||
moved = 0;
|
||||
assert(kgsl_busy_sample_contexts(memstore, live, count, ctx_last, &moved) == 1);
|
||||
assert(moved == 0);
|
||||
stamp(5, 2, 2);
|
||||
assert(kgsl_busy_sample_contexts(memstore, live, count, ctx_last, &moved) == 0);
|
||||
|
||||
// Entry 0 (global) and the ringbuffer entries are not contexts; the live list is capped.
|
||||
memset(memstore, 0, sizeof(memstore));
|
||||
memset(seen, 0, sizeof(seen));
|
||||
stamp(0, 8, 7);
|
||||
stamp(first, 8, 7);
|
||||
assert(kgsl_busy_scan_contexts(memstore, first, seen, live, KGSL_BUSY_MAX_LIVE) == 0);
|
||||
for (int id = 1; id <= KGSL_BUSY_MAX_LIVE + 10; id++) stamp(id, 1, 1);
|
||||
assert(kgsl_busy_scan_contexts(memstore, first, seen, live, KGSL_BUSY_MAX_LIVE) == KGSL_BUSY_MAX_LIVE);
|
||||
assert(kgsl_busy_scan_contexts(memstore, first, seen, live, KGSL_BUSY_MAX_LIVE) == KGSL_BUSY_MAX_LIVE);
|
||||
stamp(KGSL_BUSY_MAX_LIVE + 5, 2, 1);
|
||||
assert(kgsl_busy_scan_contexts(memstore, first, seen, live, KGSL_BUSY_MAX_LIVE) == KGSL_BUSY_MAX_LIVE);
|
||||
assert(live[0] == KGSL_BUSY_MAX_LIVE + 5);
|
||||
stamp(KGSL_BUSY_MAX_LIVE + 5, 0, 0);
|
||||
count = kgsl_busy_scan_contexts(memstore, first, seen, live, KGSL_BUSY_MAX_LIVE);
|
||||
count = kgsl_busy_scan_contexts(memstore, first, seen, live, KGSL_BUSY_MAX_LIVE);
|
||||
for (int i = 0; i < count; i++) assert(live[i] != KGSL_BUSY_MAX_LIVE + 5);
|
||||
puts("PASS: kgsl memstore contexts");
|
||||
|
||||
assert(kgsl_layout_for(0x44050001u) == &KGSL_LAYOUT_A8XX); // Adreno 830
|
||||
assert(kgsl_layout_for(0x44030a20u) == &KGSL_LAYOUT_A8XX); // Adreno 829
|
||||
assert(kgsl_layout_for(0x43020100u) == &KGSL_LAYOUT_A7XX); // Adreno 722
|
||||
assert(kgsl_layout_for(0x43050a01u) == &KGSL_LAYOUT_A7XX); // Adreno 740
|
||||
assert(kgsl_layout_for(0x07010000u) == &KGSL_LAYOUT_A7XX); // Adreno 710
|
||||
assert(kgsl_layout_for(0x06030001u) == &KGSL_LAYOUT_A7XX); // Adreno 630
|
||||
assert(kgsl_layout_for(0x45000000u) == NULL);
|
||||
assert(KGSL_LAYOUT_A8XX.always_on == 0x8e7u && KGSL_LAYOUT_A8XX.cycles == 1u);
|
||||
assert(KGSL_LAYOUT_A7XX.always_on == 0x980u && KGSL_LAYOUT_A7XX.cycles == 0u);
|
||||
puts("PASS: kgsl counter layout");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Exercise the HUD's kgsl memstore busy sampling (app/src/main/cpp/gpuclock/kgsl_busy.h)."""
|
||||
"""Exercise the HUD's kgsl memstore busy sampling and counter layout (app/src/main/cpp/gpuclock)."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
@@ -27,6 +27,8 @@ class KgslBusyTest(unittest.TestCase):
|
||||
result = subprocess.run([str(self.binary)], capture_output=True, text=True)
|
||||
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||
self.assertIn('PASS: kgsl memstore busy', result.stdout)
|
||||
self.assertIn('PASS: kgsl memstore contexts', result.stdout)
|
||||
self.assertIn('PASS: kgsl counter layout', result.stdout)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -438,6 +438,120 @@ class GogRegistry(unittest.TestCase):
|
||||
], entries)
|
||||
self.assertEqual(3, skipped)
|
||||
|
||||
def test_a_game_whose_support_installer_cannot_run_gets_the_install_registry(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='1207658924')
|
||||
(folder / 'goggame-1207658924.info').write_text(json.dumps({'language': 'English', 'languages': ['en-US']}))
|
||||
gog_script(folder, '1207658924', [
|
||||
{'install': {'action': 'Execute', 'arguments': {'executable': 'galaxy_the_witcher_enhanced_edition_2.1.0.15.exe'}}},
|
||||
])
|
||||
entries, skipped = store.gog_registry(folder)
|
||||
app = store.windows_path(str(folder)).replace('\\', '\\\\')
|
||||
self.assertEqual([
|
||||
'[HKEY_LOCAL_MACHINE\\Software\\CD Projekt Red\\The Witcher]\r\n"InstallFolder"="%s\\\\"' % app,
|
||||
'[HKEY_LOCAL_MACHINE\\Software\\CD Projekt Red\\The Witcher]\r\n"RegionVersion"="US"',
|
||||
'[HKEY_LOCAL_MACHINE\\Software\\CD Projekt Red\\The Witcher]\r\n"IsDjinniInstalled"=dword:00000001',
|
||||
'[HKEY_LOCAL_MACHINE\\Software\\CD Projekt Red\\The Witcher]\r\n"Language"="3"',
|
||||
'[HKEY_CURRENT_USER\\Software\\CD Projekt RED\\Witcher\\Settings]\r\n"TextLanguage"="3"',
|
||||
'[HKEY_CURRENT_USER\\Software\\CD Projekt RED\\Witcher\\Settings]\r\n"VoiceLanguage"="3"',
|
||||
], entries)
|
||||
self.assertEqual(0, skipped)
|
||||
|
||||
def test_a_players_language_choice_is_not_overwritten(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='1207658924')
|
||||
(folder / 'goggame-1207658924.info').write_text(json.dumps({'languages': ['en-US']}))
|
||||
proton = Path(root) / 'proton'
|
||||
proton.write_text('selected Proton')
|
||||
data = Path(root) / 'compat'
|
||||
(data / 'pfx').mkdir(parents=True)
|
||||
(data / 'pfx/user.reg').write_text(
|
||||
'[Software\\\\OtherApp] 1\n"InstallFolder"="C:\\\\Other"\n\n'
|
||||
'[Software\\\\CD Projekt RED\\\\Witcher\\\\Settings] 1\n"TextLanguage"="5"\n')
|
||||
imported = []
|
||||
def run(argv, **kwargs):
|
||||
imported.append(Path(argv[4][2:].replace('\\', '/')).read_bytes()[2:].decode('utf-16-le'))
|
||||
(data / 'pfx/system.reg').write_text('Wine registry')
|
||||
return __import__('subprocess').CompletedProcess(argv, 0)
|
||||
with patch.object(store.subprocess, 'run', side_effect=run):
|
||||
store.apply_gog_registry(folder, str(data), str(proton))
|
||||
text = imported[0]
|
||||
self.assertNotIn('"TextLanguage"', text)
|
||||
self.assertIn('"VoiceLanguage"', text)
|
||||
self.assertIn('"InstallFolder"', text)
|
||||
|
||||
def test_malformed_language_metadata_falls_back_to_english(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='1207658924')
|
||||
(folder / 'goggame-1207658924.info').write_text(json.dumps({'languages': 3}))
|
||||
entries, _ = store.gog_registry(folder)
|
||||
self.assertIn('"Language"="3"', entries[3])
|
||||
|
||||
def test_a_native_hklm_value_does_not_replace_the_32_bit_fallback(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='1207658924')
|
||||
(folder / 'goggame-1207658924.info').write_text(json.dumps({'languages': ['en-US']}))
|
||||
pfx = Path(root) / 'pfx'
|
||||
pfx.mkdir()
|
||||
(pfx / 'system.reg').write_text(
|
||||
'[Software\\\\CD Projekt Red\\\\The Witcher] 1\n"InstallFolder"="C:\\\\Native"\n')
|
||||
entries, _ = store.gog_registry(folder, store.gog_registry_values(pfx))
|
||||
self.assertTrue(any('"InstallFolder"' in entry for entry in entries))
|
||||
(pfx / 'system.reg').write_text(
|
||||
'[Software\\\\Wow6432Node\\\\CD Projekt Red\\\\The Witcher] 1\n"InstallFolder"="C:\\\\32bit"\n')
|
||||
entries, _ = store.gog_registry(folder, store.gog_registry_values(pfx))
|
||||
self.assertFalse(any('"InstallFolder"' in entry for entry in entries))
|
||||
|
||||
def test_a_deleted_fallback_value_is_imported_again(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='1207658924')
|
||||
(folder / 'goggame-1207658924.info').write_text(json.dumps({'languages': ['en-US']}))
|
||||
proton = Path(root) / 'proton'
|
||||
proton.write_text('selected Proton')
|
||||
data = Path(root) / 'compat'
|
||||
pfx = data / 'pfx'
|
||||
pfx.mkdir(parents=True)
|
||||
imported = []
|
||||
def run(argv, **kwargs):
|
||||
imported.append(argv)
|
||||
(pfx / 'system.reg').write_text(
|
||||
'[Software\\\\Wow6432Node\\\\CD Projekt Red\\\\The Witcher] 1\n'
|
||||
'"InstallFolder"="C:\\\\Game"\n"RegionVersion"="US"\n'
|
||||
'"IsDjinniInstalled"=dword:00000001\n"Language"="3"\n')
|
||||
(pfx / 'user.reg').write_text(
|
||||
'[Software\\\\CD Projekt RED\\\\Witcher\\\\Settings] 1\n'
|
||||
'"TextLanguage"="3"\n"VoiceLanguage"="3"\n')
|
||||
return __import__('subprocess').CompletedProcess(argv, 0)
|
||||
with patch.object(store.subprocess, 'run', side_effect=run):
|
||||
self.assertEqual('written=6', store.apply_gog_registry(folder, str(data), str(proton)))
|
||||
self.assertEqual('none', store.apply_gog_registry(folder, str(data), str(proton)))
|
||||
(pfx / 'system.reg').write_text(
|
||||
'[Software\\\\Wow6432Node\\\\CD Projekt Red\\\\The Witcher] 1\n'
|
||||
'"RegionVersion"="US"\n"IsDjinniInstalled"=dword:00000001\n"Language"="3"\n')
|
||||
self.assertEqual('written=1', store.apply_gog_registry(folder, str(data), str(proton)))
|
||||
self.assertEqual(2, len(imported))
|
||||
|
||||
def test_the_install_language_selects_the_titles_language_id(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='1207658924')
|
||||
(folder / 'goggame-1207658924.info').write_text(json.dumps({'languages': ['pl-PL']}))
|
||||
entries, _ = store.gog_registry(folder)
|
||||
self.assertIn('"Language"="5"', entries[3])
|
||||
|
||||
def test_a_script_that_sets_registry_keeps_its_own_values(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='1207658924')
|
||||
(folder / 'goggame-1207658924.info').write_text(json.dumps({'languages': ['en-US']}))
|
||||
gog_script(folder, '1207658924', [
|
||||
set_registry(root='HKLM', subkey='Software\\CD Projekt Red\\The Witcher',
|
||||
valueName='InstallFolder', valueData='{app}\\', valueType='string'),
|
||||
])
|
||||
entries, _ = store.gog_registry(folder)
|
||||
app = store.windows_path(str(folder)).replace('\\', '\\\\')
|
||||
self.assertEqual([
|
||||
'[HKEY_LOCAL_MACHINE\\Software\\CD Projekt Red\\The Witcher]\r\n"InstallFolder"="%s\\\\"' % app,
|
||||
], entries)
|
||||
|
||||
def test_a_game_without_a_script_starts_without_proton(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog')
|
||||
|
||||
Reference in new issue
Block a user