Compare2: report, screenshots, README (Same area, zoom, Freeze, Flip, GLSL anti-aliasing)

This commit is contained in:
alex committed 2026-11-26 08:25:54 +00:00
1 parent 8cece32e50
commit 345edaca8b
16 files changed
+195

No files matched your search

+23
View File
@@ -109,6 +109,7 @@ What was really run: see [Status](#status) (a real install into a scratch prefix
| Play: a loading screen, then "now playing", and the launcher back when the game closes | **Working on X11; not yet tried on KDE Wayland or with a real Steam game** | Run for real in a private X server: Play on a game Summit starts itself put the loading screen up, then "now playing"; keys pressed in the launcher meanwhile changed nothing; Stop the game ended it; Esc took the launcher back with the game still running; when the game closed the launcher was back with the session counted. A Steam-style start (a stand-in `steam` command that hands the game off and returns, the game's processes marked as Steam marks them) showed Starting until the game's process appeared and the launcher was back about 3 s after it was gone. Not checked: a real Steam, Lutris or Heroic game, a real controller, and bringing the launcher's window to the front through KWin when the game ends. |
| Steam, Lutris, Heroic games started from the launcher | **Experimental** | Command lines are built and unit tested; no Steam, Lutris or Heroic on the test machines. Heroic (new): Epic and GOG games start through `xdg-open heroic://launch?appName=..&runner=..` (the format in Heroic's source), and the Flatpak Heroic's games are now found too. No Enhance for Lutris and Heroic games. Folders found on disk are not started directly: their button is **ADD** (see the Add a game row). |
| Compare settings live (C), anti-aliasing (`--aa`) | **Experimental** | New. Run in the engine's own window on the GPU test machine (RTX 3090 shared with another job, **software OpenGL** for the display) on recorded Voidrunner footage, started with `--compare`: four anti-aliasing strips, frame generation Off against 2x (30 and 61 fps measured), and the upscaler strips fullscreen (RTX VSR shown as unavailable, with why); the overlay's Compare tab was opened with injected keys and seen. Anti-aliasing measured there at 720p, GPU, steady state: FXAA 0.53, SMAA-style 0.69, CAS 0.33 ms a frame on average. Upscaler and look times there are software OpenGL's and mean nothing. **Not run**: a real game (over a game, C stays the game's key), RTX VSR in a strip, the divider drag, Compare in clips, a GPU-rendered display, Windows. |
| Compare: Same area (pick a cell, zoom 1x to 8x, free box, inset map), Freeze, Flip, labels at the bottom, `--compare-area`; FXAA/CAS as an OpenGL pass | **Experimental** | New. Seen live in the engine's window on the GPU test machine (software OpenGL display) on recorded Voidrunner footage, keys and mouse injected: the picker with 4 numbered cells, the arrows and Enter picking cell 4, the quarter shown four times with the inset map, the wheel zooming to 3x and 4x, a drag making a free box, Space freezing (marked FROZEN), holding and letting go of V (A: Off / B: SMAA-style), and the overlay's Compare tab with the Area row and its map, fitting a 1280 px window. Upscaler cells as still frames (`compare_shot.py`, the window's FSR shaders). GLSL FXAA 0.07 ms and CAS 0.02 ms at 1080p on the RTX 3090 (headless EGL bench) against about 1 ms for the torch filters. **Not run**: over a real game (the overlay rows are the way there, untested), the overlay's map clicked with a real mouse, the GLSL pass in a live window on a graphics card (the test display is llvmpipe, where torch keeps doing it), Flip and Freeze for the upscaler live. |
| RTX Video Super Resolution (`rtx-vsr`) | **Experimental** | Wired to the engine, not tested. |
| 90/120 Hz output, choosing a monitor by name | **Experimental** | Wired, one virtual display only. |
| Consoles in the library: PlayStation Remote Play (chiaki-ng with SmoovPlay's frame tap) and capture cards | **Tested** / **Experimental** | New: **+ Add a game or console** opens an in-app chooser: a game on this PC (the file dialog, as before), a capture card (the V4L2 devices, cards before webcams) or PlayStation Remote Play (the consoles linked in chiaki-ng, each one's state from a live network search). The pick becomes a library entry with its own page, profile, Enhance toggle and tracked time. Play on Remote Play finds the console by name, wakes it from rest mode and runs chiaki-ng; with Enhance the engine starts first and chiaki-ng gets `CHIAKI_FRAMETAP=1` (see [packaging/chiaki-ng](packaging/chiaki-ng/README.md), which also has the patch and the PKGBUILD; `install.sh --with-remote-play` builds it). A capture card plays through the engine. **Checked on the owner's desktop**: `summit console list` read two consoles linked in chiaki-ng, found one of them in rest mode on the network (at a different address than chiaki-ng had saved), found the Live Gamer MINI and a webcam, and saw the frame tap in the installed `chiaki`. Unit tests cover chiaki-ng's settings file, the discovery and wake-up packets, the stream command and the launch plans. **Not run**: a stream started from Summit, the wake-up, a capture card session. |
@@ -290,6 +291,28 @@ python engine/devtools/compare_shot.py clip.mp4 --frame 150 --compare scaler:off
More screenshots and the numbers: [docs/agent-reports/compare.md](docs/agent-reports/compare.md).
### Same area, zoom, Freeze and Flip
<p align="center">
<img src="docs/media/compare2/live-aa-quarter-x4.png" width="100%" alt="The engine's window: the bottom-right quarter of the scene shown four times, Off, FXAA, SMAA-style and CAS sharpen, each labelled with its cost and 1x, with a small map of the whole picture in the corner marking the quarter">
</p>
**Same area** (key **A**, or Layout: Same area on the Compare tab) cuts the picture into one cell per strip (2: halves, 3: thirds, 4: a 2x2). Pick a cell (click it, or the arrows and Enter, or 1 to 4; the cells are outlined and numbered while you pick) and every cell shows **that** area of the scene, each with its own choice, in step, with the labels and timings as before. With 4 strips the picked quarter is shown four times, pixel for pixel.
- **Zoom** (mouse wheel, + and -, or the Zoom row): 1x to 8x, by whole pixels (nearest neighbour, never a smoothing filter); the labels say the zoom. Drag on the picture to move the area (a **free box**; the cells are snap positions), or click the small map in the corner, which shows where the area is in the whole picture. A click without a drag, or Enter, goes back to picking; Esc leaves Same area.
- **Freeze** (**Space**): holds one game frame so anti-aliasing, the upscaler or the look can be studied on a still; marked FROZEN on screen. Frame generation can't be frozen (its strips differ only in motion), and says so.
- **Flip** (hold **V**, two strips): the whole picture with strip A while held, B when let go; Esc goes back to the split.
- **Labels at** the top or the bottom (when the game's HUD is at the top).
- Over a game (window capture) these keys are the game's: every Compare action is also on the overlay's Compare tab, including the area (Pick, 1 to 4, Free, and a map of the picture to click).
```sh
python engine/run.py clip.mp4 --display --compare aa:off,fxaa,smaa,cas --compare-area 4 # a quarter, x4
python engine/run.py clip.mp4 --display --compare scaler:off,bilinear,fsr --compare-area 0.4,0.3,0.1,0.1 # a free box, zoomed
python engine/devtools/compare_shot.py clip.mp4 --compare aa:off,fxaa,smaa,cas --compare-area 2 --out shot.png
```
The Anti-aliasing setting's FXAA and CAS now run as an OpenGL pass in the video window when it draws on a graphics card: measured on the test machine's RTX 3090 at 1080p (headless EGL, `devtools/aa_gl_bench.py`), 0.07 ms (FXAA) and 0.02 ms (CAS) against about 1 ms each for the torch filters. SMAA-style, and the anti-aliasing comparison itself, stay on torch. Screenshots and details: [docs/agent-reports/compare2.md](docs/agent-reports/compare2.md).
## Statistics: overlay, summaries and benchmarks
<p align="center">
+172
View File
@@ -0,0 +1,172 @@
# Compare, second step: Same area, zoom, Freeze, Flip, the overlay, GLSL anti-aliasing
Task: compare2 (branch `ap/compare2`). The owner asked for "a toggle when using the comparison feature so that you
can select a chunk of the screen and then you get the comparison showing the same chunk of the screen that you
selected", e.g. with four settings: pick one of four sections, then see that section x4.
## What changed
**`engine/framegen/compare.py`**
- Round 2's "2x2, same crop" layout (locked to the picture's middle) is generalised into **Same area** (the layout
value stays `grid`, so `--compare-layout grid` and the launcher keep working; its name is now "Same area"):
- one cell per strip: 2 halves, 3 thirds, 4 a 2x2 (`cells`, `grid_shape`, `cell_at`);
- picking (`compare_cell = "pick"`): each cell shows its own part, outlined and numbered, the highlighted one in
the accent, with a hint at the bottom;
- picked: every cell shows **that** area (`Area`: centre, zoom, cell), enlarged by a whole number with nearest
neighbour (`compose` scales numpy and torch the same way; the GL path blits with `GL_NEAREST`); a fixed cell at
1x is exactly that cell, pixel for pixel; a zoomed area that doesn't fill its cell to the pixel is centred, the
margin black;
- a **free box** (`compare_cell = "free"`, centre in `Live.free`), kept inside the picture, snapping to a cell's
centre when within 4% (`snap`);
- the **inset map**: the first available strip's whole picture, shrunk, in a bottom corner (top corner when the
labels are at the bottom), with the area marked and a caption ("Area 4 · 1x", "Free box · 3x nearest");
- every label says the zoom ("FXAA · 4x nearest"; 1x is pixel for pixel).
- `draws(plan, w, h)`: one list of (strip, where, which part) used by the pipeline (anti-aliasing and frame
generation strips), the window (upscaler and look strips) and `compare_shot.py`.
- **Freeze**: `Live.source_side` holds the frame it got when Freeze went on and uses it in place of every new one, so
the window's upscaler and look strips get the still too. Marked "FROZEN · one game frame held". Refused for frame
generation, with why (`FREEZE_WHY`). The game goes on underneath; clips get its real frames.
- **Flip** (2 strips): the whole picture with strip A or B; only the strip on screen is computed and timed. Labels
"A: Off" / "B: SMAA-style". More than 2 strips: refused with a message.
- **Labels at** top or bottom.
- `Live.key / press / move / release / wheel / map_click / area_view`: every key and mouse action by name, so the
window is a thin mapping and all of it is unit-tested.
- `allowed()`: an area cell past the number of strips, Flip with more than 2, Freeze for frame generation are greyed
out in the overlay.
- `area_settings()` for `--compare-area`.
- Timings are no longer reset by view-only changes (layout, area, zoom, freeze, flip, labels).
**`engine/framegen/settings.py`** (small local additions in the Compare tab): `compare_cell` (Area: Pick, 1-4,
Free), `compare_zoom` (1, 2, 3, 4, 6, 8), `compare_split` (the 2-strip divider, so it can be set without a mouse),
`compare_freeze`, `compare_flip` (Split / All A / All B), all session-only; `compare_labels_at` (saved). New sub
heading "Labels". The Compare row's help names the new keys.
**`engine/framegen/menu.py`**
- The Area row is a row of buttons (6 short choices are now buttons; checked that no other setting changes kind).
- While the Area row is highlighted the help card shows a **map of the picture**: the cells numbered, the picked one
lit, the area as a box. Clicking it picks the cell there (1x) or puts the box there (zoomed). Hooks:
`Menu.area_view` / `Menu.area_click`, set by the window.
- `render(..., max_w)`: the panel is made narrower (down to 560 px at 1x) when the picture is narrower than it,
never cut. See the 1280 px finding below.
**`engine/framegen/io.py`**
- Keys in the video window: **A** Same area on/off, **Space** Freeze, **V** held = A / let go = B, and while Same
area is on: arrows (move the highlight while picking; nudge the box once picked), Enter (pick / back to picking),
1-4, + and -, Esc (leave Flip, then Same area).
- Mouse: click a cell to pick, drag to pan the area (the scene follows the hand), click without a drag to go back
to picking, drag on the inset map to move the box there, the wheel zooms.
- Over a game the hint on the picture says to use the overlay (keys and clicks are the game's there).
- Upscaler and look cells: each variant drawn whole into the scratch framebuffer, then every draw for it blitted
(nearest; only the inset map is linear, as it is shrunk); the black margin of a zoomed cell is cleared with a
scissor.
- The overlay gets `max_w` = the picture's width less a margin.
- **Anti-aliasing as an OpenGL pass** (`framegen/aa_gl.py`, see below), and `_dev_shot`: with `SUMMIT_SHOT=<prefix>`
set, a `<prefix>.req` file makes the window write the frame it is about to show to `<prefix>-<name>.png`. Off
unless the variable is set; used for this task's live screenshots.
**`engine/framegen/aa_gl.py`** (new): FXAA-style and CAS from `aa.py`, line for line in GLSL (the same thresholds,
search steps and formulas; luma from RGB with the same weights). The window runs the Anti-aliasing setting this way
when the window's OpenGL is a graphics card, or when there is no CUDA (then torch would fall back to numpy, far too
slow to play); `SUMMIT_AA_GL=1/0` forces it. `Live.window_aa` decides who applies it, so it is never applied twice:
the pipeline skips it when the window does it. SMAA-style stays torch (its edge runs use cumulative maxima along whole
rows, which one fragment pass can't do without SMAA's multi-pass lookup-texture design), and so does the
anti-aliasing **comparison** (its strips are composed at the game's size by the pipeline). HDR10: torch.
**`engine/run.py`**: `--compare-area <cell | x,y,w,h>` (fractions; the zoom is the biggest of 1, 2, 3, 4, 6, 8 that
still shows the whole box).
**`engine/devtools/compare_shot.py`**: `--compare-area`, `--freeze`, `--flip a|b`, `--labels-at`; `--layout grid`
without an area draws the picker.
**`engine/devtools/aa_gl_bench.py`** (new): both anti-aliasing paths on the same frame and card: GLSL with GL timer
queries (optionally headless on the NVIDIA card through EGL's device platform), torch with CUDA events and wall time,
and the GLSL output against `aa.py`'s numpy reference.
**README**: "Compare settings live" gets a "Same area, zoom, Freeze and Flip" part with the live screenshot, the keys
and the command lines; a status row (Experimental).
## Verified, and how
- `cd engine && pytest tests -q` here: **238 passed, 3 skipped** (the 2 GLSL tests skip without a display, and the
existing skip). On the VM (`DISPLAY=:0`, llvmpipe), at commit 893cc9e: **240 passed**, the GLSL tests included
(GLSL FXAA and CAS within 1 of the numpy reference on the aliased test scene).
- New tests: `tests/test_compare_area.py` (30: cells, picking, the picked quarter shown four times pixel for pixel,
zoom as exact nearest-neighbour blocks, torch = numpy, centring and the black margin, the free box's clamp and
snap, the inset map, keys, mouse click / drag / missed-motion drag / wheel, the overlay map click, Freeze holding
one frame and refused for frame generation, Flip running only the strip on screen, labels at the bottom, the
picker's marks, timings kept across view changes, `--compare-area`, every action a row in the overlay, the Area
row's buttons and map, greyed cells, the overlay fitting 1280 px at 150% size) and `tests/test_aa_gl.py` (3).
- No Rust was touched.
- **Anti-aliasing cost, both ways** (`aa_gl_bench.py play30.mp4 --egl --runs 300`, frame 120 resized to
**1920x1080**, RTX 3090 shared with the Strata service, OpenGL on the card through EGL, torch compiled):
| Filter | GLSL (GPU time) | torch (GPU time, CUDA events) | torch per call with its sync |
|---|---|---|---|
| FXAA | 0.072 ms (p99 0.074) | 0.988 ms (p99 1.044) | 1.000 ms (worst 1.212) |
| CAS | 0.022 ms (p99 0.023) | 1.026 ms (p99 3.341) | 1.077 ms (worst 3.839) |
| SMAA-style | (not in GLSL) | 1.329 ms (p99 1.409) | 1.351 ms |
GLSL against numpy: CAS max difference 1; FXAA 0.008% of values off by more than 1 (max 38: pixels where a
threshold comparison falls the other way in float). The GLSL numbers are the pass alone; in the window it is the
pass plus a same-size copy back into the frame texture. **The GLSL pass has not run in a live window on a graphics
card**: the test VM's display is llvmpipe, where the window keeps torch (by the rule above).
- **Live, in the engine's own window** on the VM (llvmpipe display, CUDA for AA), on Voidrunner footage
(`play30.mp4` looped 16 times), 1280x720, keys and mouse injected with XTest only while my window had the focus
(`_NET_ACTIVE_WINDOW` checked before every input), frames captured with `SUMMIT_SHOT`:
- `--compare aa:off,fxaa,smaa,cas --compare-layout grid`: the picker; Right, Down moved the highlight to cell 4;
Enter picked it: the bottom-right quarter four times with the inset map, labels "· 1x" and live timings; the
wheel zoomed to 4x; Space froze it (FROZEN mark); Insert, Shift+Tab, Down x8 put the overlay on the Compare tab's
Area row with the map.
- `--compare-area 4`, wheel x2 (3x), a drag: a free box over the HUD at 3x ("Free box · 3x nearest" on the map),
and the overlay's Area row on "Free" with the box on its map.
- `--compare aa:off,smaa`: the split; V held: "A: Off" over the whole picture; let go: "B: SMAA-style".
- The anti-aliasing timings on the live labels (1.5 to 3 ms) include the CPU-GPU round trip these frames need on
llvmpipe, as in round 2.
- **Found and fixed while testing live**: a drag whose motion events the window never saw (only press and release)
counted as a click and went back to picking; `release()` now takes the release position.
- **The overlay "cut off at the right in a 1280 px window" (round 2)**: at 1280x720 the panel is 733 px wide and
placed at x 527, so it ends at 1260, inside the window. My own window captures showed the same black blocks at the
same place on the screen **without the overlay open**: they were KDE's notification popups (the VM keeps "Memory
Shortage Avoided" popups at the right of the screen) over the capture, not the layout. The overlay screenshots
taken from the engine's own frame (`SUMMIT_SHOT`) show the whole panel. `max_w` was added anyway, for narrower
windows and larger overlay sizes (tested: 150% in 1280x720 fits).
## Screenshots (`docs/media/compare2/`)
All from Voidrunner footage (a recording of the real game, `play30.mp4`). "Live" = the engine's real window, the
frame it was about to show, written by the engine (`SUMMIT_SHOT`); "still" = `devtools/compare_shot.py`, a headless
render with the same compose and label code.
| File | What it is |
|---|---|
| `live-picker-4-cells.png` | Live: Same area picker, 4 cells outlined and numbered, cell 1 highlighted, the hint at the bottom. |
| `live-picker-cell4-selected.png` | Live: after Right, Down: cell 4 highlighted. |
| `live-aa-quarter-x4.png` | Live: Enter: the bottom-right quarter shown four times (Off, FXAA, SMAA-style, CAS sharpen), 1x, timings, the inset map. |
| `live-aa-quarter-zoom-4x.png` | Live: the same quarter after three wheel steps: 4x nearest. |
| `live-aa-free-box-3x.png` | Live: a free box dragged over the HUD at 3x, "Free box · 3x nearest" over the inset map. |
| `live-frozen.png` | Live: Space pressed: "FROZEN · one game frame held" (taken while picking: the drag of that run had ended as a click, the bug fixed above). |
| `live-overlay-area-picking.png` | Live: the overlay's Compare tab, Area row on Pick, the map in the help card, the panel whole in a 1280 px window. |
| `live-overlay-area-free.png` | Live: the overlay's Area row on Free, the box on the map. |
| `live-flip-split.png`, `live-flip-a.png`, `live-flip-b.png` | Live: `aa:off,smaa` split; V held ("A: Off"); V let go ("B: SMAA-style"). |
| `still-scaler-quarter-x4.png` | Still: 640x360 frame to 1280x720, Off (nearest), Bilinear, FSR 1, FSR 1 Max with the window's FSR shaders (llvmpipe), cell 1 (the HUD) x4. Timings off (software OpenGL). |
| `still-scaler-free-box-4x.png` | Still: the same, a free box `0.02,0.03,0.12,0.12` at 4x nearest. |
| `still-aa-free-box-4x-labels-bottom.png` | Still: anti-aliasing on CUDA, free box `0.05,0.02,0.1,0.1` (4x: 5x isn't a zoom step), labels at the bottom, the map at the top; timings measured (20 runs). |
## Not done, or not tested
- **Not run over a real game.** The compare keys still don't reach the engine over a game (only the overlay key is
grabbed); everything is on the overlay's Compare tab instead, and that path was tested only in the engine's own
window (keys injected), not over a game.
- In the overlay the free box is placed with the mouse (the map); with the keyboard the overlay offers the cells and
the zoom, not nudging a free box (the video window's arrows do that).
- The overlay's map was clicked only in unit tests, not with a real or injected mouse.
- The GLSL anti-aliasing pass has not run in a live window on a GPU (see above); there is no GLSL variant **inside**
the anti-aliasing comparison, so the two paths can't be compared side by side live, only with `aa_gl_bench.py`.
- Upscaler and look Same area, Freeze and Flip live: only as stills and unit tests (the live sessions compared
anti-aliasing; the 1280x720 footage has nothing to upscale in a 1280x720 window).
- Frame generation in Same area is tested on frames only.
- Session-only settings (area, zoom, freeze, flip, divider) show in the settings file with their defaults, like
`compare` itself already did; their values aren't saved.
- On the shared VM: before I unlocked the session, one injected key reached the lock screen's password field
(cleared by `loginctl unlock-session`); my script raises and focuses only its own window, by title "Summit compare2
test".
Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 KiB