mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
* chore(i18n): translate every missing string in all locales Adds the 87 strings the bottom-screen Dashboard and in-game stats pages introduced to all 32 locales, plus the 51 older settings strings Japanese and the 50 Chinese locales were still missing. Every locale now has all 3456 translatable strings with the same placeholders as English. Also translates 36 entries that were still English where the language does not use the English word, and makes es-419 touch_app_id use the same %1$s placeholder as English. * chore(patches): drop comments from the lines downstream patches add Removes comment lines and trailing comments from lines our patches add, with hunk headers recounted. Lines that a later patch uses as context and the upstream backport 0123 are left as they are. The gamescope, FEX, proot and xodus series still apply to their pinned sources, and the patched trees differ only in those comments. test_hud_frames now finds the HUD writer by its first declaration. * docs: credit Greenlight, Better xCloud, viture-v2, GameNative and DiRTTelemetryErrorFix These were credited only in source headers and NOTICE files. * chore: remove source comments and unused functions Removes explanatory comments from first-party Kotlin, Java, C, C++, Rust, TypeScript, Python, shell, Gradle, CMake and workflow files. License and attribution headers stay, and vendored third-party trees, generated files and license files are untouched. A shellcheck directive is kept, and udevmon's fallthrough comments became fallthrough attributes. Syntax trees and token streams match the previous sources apart from the comments and Python docstrings. Module docstrings that argparse prints are kept, and device-smoke.sh prints the same --help text from a heredoc. Also removes 37 functions and 4 fields that nothing referenced. * chore: remove comments from the Syncthing integration and the latest main sources * docs: credit Syncthing and the syncthing-android fork * chore(i18n): translate the Syncthing strings in all locales The 107 strings the Syncthing integration added are now in all 32 locales. sync_web_path_locked names the Syncthing tab by its label. * docs: credit @xXJSONDeruloXx for the HUD metric readers The CPU, GPU load, thermal and battery readers come from their PerformanceHudView pull requests #777, #877, #991, #1406 and #1573. The FusionHUD credit line is unchanged. * docs: credit the HUD metric readers to @xXJSONDeruloXx's work
142 lines
4.7 KiB
Python
142 lines
4.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Live regression probe; run inside a running Gamescope session.
|
|
|
|
Requires Python 3, WAYLAND_DISPLAY, XDG_RUNTIME_DIR and access to Gamescope's
|
|
/proc/<pid>/fd. Creates only a temporary surface with the cursor role; it does
|
|
not take pointer focus or change game/save files. Affected Gamescope retains all
|
|
20 SHM allocations; fixed Gamescope retains at most the current cursor buffer.
|
|
"""
|
|
import os
|
|
import socket
|
|
import struct
|
|
import time
|
|
import json
|
|
import array
|
|
import argparse
|
|
from pathlib import Path
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--unassigned-control', action='store_true', help='verify that window buffers awaiting association remain queued')
|
|
args = parser.parse_args()
|
|
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
s.settimeout(2)
|
|
s.connect(os.path.join(os.environ['XDG_RUNTIME_DIR'], os.environ['WAYLAND_DISPLAY']))
|
|
U = lambda *v: struct.pack('<' + 'I' * len(v), *v)
|
|
|
|
def string(v):
|
|
b = v.encode() + b'\x00'
|
|
return U(len(b)) + b + b'\x00' * (-len(b) % 4)
|
|
|
|
def send(obj, op, p=b'', fd=None):
|
|
b = U(obj, len(p) + 8 << 16 | op) + p
|
|
if fd is None:
|
|
s.sendall(b)
|
|
else:
|
|
s.sendmsg([b], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array.array('i', [fd]))])
|
|
nextid = 2
|
|
pids = []
|
|
for process in Path('/proc').iterdir():
|
|
if not process.name.isdigit():
|
|
continue
|
|
try:
|
|
if (process / 'comm').read_text().strip() == 'gamescope':
|
|
pids.append(process)
|
|
except (FileNotFoundError, PermissionError):
|
|
pass
|
|
assert len(pids) == 1, f'expected one Gamescope process, found {[p.name for p in pids]}'
|
|
fd_dir = pids[0] / 'fd'
|
|
|
|
def alloc():
|
|
nonlocal nextid
|
|
nextid += 1
|
|
return nextid
|
|
pending = b''
|
|
globals = {}
|
|
|
|
def roundtrip():
|
|
nonlocal pending
|
|
cb = alloc()
|
|
send(1, 0, U(cb))
|
|
while True:
|
|
while len(pending) >= 8:
|
|
obj, h = struct.unpack_from('<II', pending)
|
|
n = h >> 16
|
|
op = h & 65535
|
|
if len(pending) < n:
|
|
break
|
|
p = pending[8:n]
|
|
pending = pending[n:]
|
|
if obj == 1 and op == 0:
|
|
raise RuntimeError('wayland error ' + repr(p))
|
|
if obj == 2 and op == 0:
|
|
name, l = struct.unpack_from('<II', p)
|
|
itf = p[8:8 + l - 1].decode()
|
|
ver = struct.unpack_from('<I', p, 8 + (l + 3) // 4 * 4)[0]
|
|
globals[itf] = (name, ver)
|
|
if obj == cb:
|
|
return
|
|
chunk = s.recv(65536)
|
|
if not chunk:
|
|
raise RuntimeError('Wayland connection closed during roundtrip')
|
|
pending += chunk
|
|
|
|
def bind(itf, version):
|
|
obj = alloc()
|
|
name, ver = globals[itf]
|
|
send(2, 0, U(name) + string(itf) + U(min(ver, version), obj))
|
|
return obj
|
|
|
|
def count():
|
|
n = 0
|
|
for f in fd_dir.iterdir():
|
|
try:
|
|
n += 'dd-shm-probe' in os.readlink(f)
|
|
except FileNotFoundError:
|
|
pass
|
|
return n
|
|
send(1, 1, U(2))
|
|
roundtrip()
|
|
comp = bind('wl_compositor', 4)
|
|
shm = bind('wl_shm', 1)
|
|
seat = bind('wl_seat', 1)
|
|
pointer = alloc()
|
|
send(seat, 0, U(pointer))
|
|
surface = alloc()
|
|
send(comp, 0, U(surface))
|
|
if not args.unassigned_control:
|
|
send(pointer, 0, U(0, surface, 0, 0))
|
|
roundtrip()
|
|
before = count()
|
|
for i in range(20):
|
|
fd = os.memfd_create('dd-shm-probe', os.MFD_CLOEXEC)
|
|
os.ftruncate(fd, 64 * 64 * 4)
|
|
pool = alloc()
|
|
send(shm, 0, U(pool, 64 * 64 * 4), fd)
|
|
os.close(fd)
|
|
buffer = alloc()
|
|
send(pool, 0, U(buffer, 0, 64, 64, 64 * 4, 0))
|
|
send(pool, 1)
|
|
send(surface, 1, U(buffer, 0, 0))
|
|
send(surface, 2, U(0, 0, 64, 64))
|
|
send(surface, 6)
|
|
send(buffer, 0)
|
|
roundtrip()
|
|
after_commits = count()
|
|
send(surface, 0)
|
|
roundtrip()
|
|
time.sleep(0.2)
|
|
after_surface_destroy = count()
|
|
s.close()
|
|
print(json.dumps(dict(before=before, after_commits=after_commits, after_surface_destroy=after_surface_destroy, growth=after_commits - before)))
|
|
if args.unassigned_control:
|
|
assert after_commits - before == 20, 'unassigned window commits were unexpectedly discarded'
|
|
else:
|
|
assert after_commits - before <= 1, f'cursor buffers leaked: {after_commits - before} retained after 20 commits'
|
|
assert after_surface_destroy == before, 'cursor buffers remain after destroying the test surface'
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|