fix(libkernel,agc): unblock RetroArch Windows select and 8_8 UINT #5795

Closed
mazen320 wants to merge 1 commit from upstream-pr/5795 into main
mazen320 commented 2026-10-14 11:17:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-14T11:17:58Z.


What

Two independent Windows bring-up blockers for RetroArch (PPSA99169), fixed together because each only surfaces after the previous one is cleared:

  1. Windows select on regular files — HostPoll only accepted pipes, so a select on a disk file (FD 5 early in RetroArch startup) threw neither a socket nor a pipe / earlier not a libSceNet socket. Add HostFileReady: FILE_TYPE_DISK is always ready for the requested read/write bits, matching FreeBSD disk semantics already documented for Linux poll. Non-file, non-pipe, non-socket descriptors still throw.

  2. AGC COLOR_8_8 + UINT — once select no longer aborts, menu startup creates an 8_8 color target with number type UINT (format 3, number type 4). DecodeColorFormat case 3 only handled UNORM/SNORM; UINT now maps to VK_FORMAT_R8G8_UINT with the same component-swap mapping as the existing 8 / 8_8_8_8 UINT paths. Covered by new uint8x2TargetTests.

Linux HostPoll is unchanged (#ifndef _WIN32 → host poll). The AGC decode path is shared; the new unit test exercises it on both hosts.

After screenshots use a solid black backdrop (no desktop wallpaper).

Asset gallery (not in-repo): gist

Before → after

Step Before After
1 select on FD 5 aborts disk FD treated ready
2 AGC format 3 / UINT aborts (black window) Ozone Main Menu ~80–97 FPS

Before — select abort

before select

Before — AGC 8_8 UINT (select fixed alone)

before agc

Compare — select

compare select

Compare — AGC

compare agc

After — Ozone menu client

after menu

After — window on black (title-bar FPS)

after desktop

Diff summary

diff summary

Tested

Windows 11, RTX 3080 (driver as installed), WinLibs MinGW-w64 GCC 15.2.0; Ubuntu under WSL2, GCC 13.3.0. Release, BUILD_TESTING=ON. Branch head 79223be9b on current main.

  • ctest --test-dir build-win -R agc_driver_graphics --output-on-failure: Passed (~4.2 s), including new uint8x2TargetTests.
  • Linux WSL2 (Ubuntu, GCC 13.3.0): cmake --build build-linux --target agc_driver_graphics_tests then ctest --test-dir build-linux -R '^agc_driver_graphics$' --output-on-failure: Passed. Select change is Windows-only (#else of HostPoll); Linux still uses host poll.
  • Title run (Windows only): RetroArch PPSA99169 app.exe with rebuilt/patched libkernel + libSceAgcDriver. Negative controls: select-only or AGC-only each still abort with the corresponding message above. With both fixes, Ozone Main Menu stays interactive; title bar FPS ~80–97 idle. After screenshots are the window on a solid black backdrop.
  • Conventions checker / git diff --check on the branch.

Not tested: loading a libretro core / game content, macOS, console hardware. Full PR CI needs a collaborator's manual Build run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA99169 RetroArch (#4793) — reaches Ozone Main Menu on Windows
  • GPUs tested: NVIDIA GeForce RTX 3080, Windows 11 (title run + agc_driver_graphics)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4857052384 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5795). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-14T11:17:58Z. --- ### What Two independent Windows bring-up blockers for RetroArch (PPSA99169), fixed together because each only surfaces after the previous one is cleared: 1. **Windows `select` on regular files** — `HostPoll` only accepted pipes, so a `select` on a disk file (FD 5 early in RetroArch startup) threw `neither a socket nor a pipe` / earlier `not a libSceNet socket`. Add `HostFileReady`: `FILE_TYPE_DISK` is always ready for the requested read/write bits, matching FreeBSD disk semantics already documented for Linux `poll`. Non-file, non-pipe, non-socket descriptors still throw. 2. **AGC `COLOR_8_8` + UINT** — once select no longer aborts, menu startup creates an `8_8` color target with number type UINT (`format 3`, `number type 4`). `DecodeColorFormat` case 3 only handled UNORM/SNORM; UINT now maps to `VK_FORMAT_R8G8_UINT` with the same component-swap mapping as the existing 8 / 8_8_8_8 UINT paths. Covered by new `uint8x2TargetTests`. Linux `HostPoll` is unchanged (`#ifndef _WIN32` → host `poll`). The AGC decode path is shared; the new unit test exercises it on both hosts. After screenshots use a solid black backdrop (no desktop wallpaper). Asset gallery (not in-repo): [gist](https://gist.github.com/mazen320/3911ee2028c238c8b2ed6744f7792fdb) #### Before → after | Step | Before | After | |------|--------|-------| | 1 | `select` on FD 5 aborts | disk FD treated ready | | 2 | AGC `format 3 / UINT` aborts (black window) | Ozone Main Menu ~80–97 FPS | **Before — select abort** ![before select](https://gist.githubusercontent.com/mazen320/3911ee2028c238c8b2ed6744f7792fdb/raw/f2a0a14fc98655bdb9612ae1009c4b068072f2be/01_before_select_crash.png) **Before — AGC 8_8 UINT (select fixed alone)** ![before agc](https://gist.githubusercontent.com/mazen320/3911ee2028c238c8b2ed6744f7792fdb/raw/1641d6caaf5fbd94e067d2e29fe5b184f2d79117/02_before_agc_format_crash.png) **Compare — select** ![compare select](https://gist.githubusercontent.com/mazen320/3911ee2028c238c8b2ed6744f7792fdb/raw/b66ea087e891af7127f30f23c0b4db17a996254e/06_compare_select_before_after.png) **Compare — AGC** ![compare agc](https://gist.githubusercontent.com/mazen320/3911ee2028c238c8b2ed6744f7792fdb/raw/e9abf76030e79d24cb5b818ad5b9e86c25409e65/07_compare_agc_before_after.png) **After — Ozone menu client** ![after menu](https://gist.githubusercontent.com/mazen320/3911ee2028c238c8b2ed6744f7792fdb/raw/ef34cca67574b884095b25b1b0f6a27745913582/03_after_menu_client.png) **After — window on black (title-bar FPS)** ![after desktop](https://gist.githubusercontent.com/mazen320/3911ee2028c238c8b2ed6744f7792fdb/raw/f7ab2af5677f0844f7fdde8d8dc367f33c4aede9/04_after_desktop_fps.png) **Diff summary** ![diff summary](https://gist.githubusercontent.com/mazen320/3911ee2028c238c8b2ed6744f7792fdb/raw/8816dd659443232ec9c8cbb282cac0bb25b9ff1c/08_diff_summary_card.png) ### Tested Windows 11, RTX 3080 (driver as installed), WinLibs MinGW-w64 GCC 15.2.0; Ubuntu under WSL2, GCC 13.3.0. Release, `BUILD_TESTING=ON`. Branch head `79223be9b` on current `main`. - `ctest --test-dir build-win -R agc_driver_graphics --output-on-failure`: **Passed** (~4.2 s), including new `uint8x2TargetTests`. - Linux WSL2 (Ubuntu, GCC 13.3.0): `cmake --build build-linux --target agc_driver_graphics_tests` then `ctest --test-dir build-linux -R '^agc_driver_graphics$' --output-on-failure`: **Passed**. Select change is Windows-only (`#else` of `HostPoll`); Linux still uses host `poll`. - Title run (Windows only): RetroArch PPSA99169 `app.exe` with rebuilt/patched `libkernel` + `libSceAgcDriver`. Negative controls: select-only or AGC-only each still abort with the corresponding message above. With both fixes, Ozone Main Menu stays interactive; title bar FPS ~80–97 idle. After screenshots are the window on a solid black backdrop. - Conventions checker / `git diff --check` on the branch. Not tested: loading a libretro core / game content, macOS, console hardware. Full PR CI needs a collaborator's manual Build run. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA99169 RetroArch (#4793) — reaches Ozone Main Menu on Windows - [x] GPUs tested: NVIDIA GeForce RTX 3080, Windows 11 (title run + `agc_driver_graphics`) - [x] AI-assisted: yes
mazen320 commented 2026-10-14 14:14:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-14T14:14:11Z.


Parking while #5163 stays open for merge (first-contributor 1-PR limit). Branch fix/retroarch-windows-select-and-8_8-uint is unchanged; will reopen after #5163 merges.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6170420230 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5795#issuecomment-6170420230). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-14T14:14:11Z. --- Parking while #5163 stays open for merge (first-contributor 1-PR limit). Branch `fix/retroarch-windows-select-and-8_8-uint` is unchanged; will reopen after #5163 merges.
github-actions[bot] commented 2026-10-14 14:48:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T14:48:34Z.


Thank you for your contribution! Authors with no pull requests merged into main can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6171127005 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5795#issuecomment-6171127005). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T14:48:34Z. --- Thank you for your contribution! Authors with no pull requests merged into `main` can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.
mazen320 commented 2026-10-14 18:44:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-14T18:44:19Z.


Rebased onto latest main after #5163 merged (force-pushed ea74ddd10).

Changes (unchanged intent)

  • libkernel select: Windows HostPoll for HostFileReady; hosts{&HostPoll} so RetroArch is not blocked on the null HostReady stub.
  • Agc 8_8 UINT: R8G8_UINT mapping + Graphics regression test; debt docs updated.

Double-check

  • Conflict markers cleared in Socket.cpp / libkernel.md
  • Diff vs main: 5 files, +52/-7
  • Next: local Graphics/libkernel verify + watch CI
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175721737 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5795#issuecomment-6175721737). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-14T18:44:19Z. --- Rebased onto latest ``main`` after #5163 merged (force-pushed ``ea74ddd10``). ## Changes (unchanged intent) - **libkernel select**: Windows HostPoll for ``HostFileReady``; ``hosts{&HostPoll}`` so RetroArch is not blocked on the null HostReady stub. - **Agc 8_8 UINT**: ``R8G8_UINT`` mapping + Graphics regression test; debt docs updated. ## Double-check - Conflict markers cleared in Socket.cpp / libkernel.md - Diff vs main: 5 files, +52/-7 - Next: local Graphics/libkernel verify + watch CI
mazen320 commented 2026-10-14 18:45:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-14T18:45:18Z.


Cannot reopen after force-push (state cannot be changed. The branch was force-pushed or recreated.). Replacement PR opened from the rebased tip ea74ddd10 — see the newest open PR with the same title from this branch.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175740964 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5795#issuecomment-6175740964). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-14T18:45:18Z. --- Cannot reopen after force-push (state cannot be changed. The branch was force-pushed or recreated.). Replacement PR opened from the rebased tip `ea74ddd10` — see the newest open PR with the same title from this branch.
mazen320 commented 2026-10-14 18:50:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-14T18:50:49Z.


Superseded by https://github.com/boykopovar/AnyPS5/pull/5999 (same change, rebased onto current main — GitHub blocked reopen here after the earlier force-push).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175844584 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5795#issuecomment-6175844584). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-14T18:50:49Z. --- Superseded by https://github.com/boykopovar/AnyPS5/pull/5999 (same change, rebased onto current main — GitHub blocked reopen here after the earlier force-push).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5795
No description provided.