diff --git a/docs/PHASE_LOG.md b/docs/PHASE_LOG.md index d7ef561..064ffd2 100644 --- a/docs/PHASE_LOG.md +++ b/docs/PHASE_LOG.md @@ -3501,3 +3501,22 @@ CPU's values win, as a CPU write does on the hardware; a gather-pipe burst, whic only adds, is retried. Title 08e8ed4c, twice from boot for seven minutes (368 emulated seconds, past the old failure and through a second attract loop): no alert, no unknown opcode, no crash. + +## 2026-09-25 — Profile 9's last two mappings: the HDR uniform buffer + +Profile 9 left two direct-memory mappings a reload unidentified. A bounded +one-shot registry in ../PS5_Vulkan's allocator (removed since; title 1ecbfd3a) +recorded the caller of every live VkDeviceMemory. After each reload, one entry grew +by 2 (1, 3, 5, 7, 9 over four reloads): 256 bytes of host-visible memory from +`vulkan_create_buffer`, called by `vulkan_init` for `vk->hdr.ubo`. RetroArch +creates that uniform buffer whenever the build has `VULKAN_HDR_SWAPCHAIN`, but +`vulkan_free` destroyed it only when the context has HDR support, which this +console's surface never reports. The video driver is initialised twice a reload, +so two buffers leaked each time. + +Patch 0093 releases the buffer whenever it exists; the HDR images stay with the +support flag that creates them. Title 9a84b116, the same four-reload Melee run +(`evidence/dolphin-p9-reload-flat`): every reload returns to `direct_live=180` +and `memory:152`, the count the first boot held. Before 0093, memory grew 152, +154, 156, 158, 160. The stage and table mappings return to the same counts each +cycle. There were no crashes, and each steady window ran at 97-100%. diff --git a/evidence/dolphin-p9-reload-flat/capture.json b/evidence/dolphin-p9-reload-flat/capture.json new file mode 100644 index 0000000..c2a6534 --- /dev/null +++ b/evidence/dolphin-p9-reload-flat/capture.json @@ -0,0 +1,38 @@ +{ + "step": "dolphin-p9-reload-flat", + "recorded": "2026-09-25T19:25:07Z", + "console_run": "", + "revision": "title 9a84b116: driver 2f1e447, RetroArch patch 0093 on 11f5a81", + "command": "tooling/dolphin-profiles/p1-accurate.txt; Melee from my entry state; the pad script's four Quick Menu closes and RELOADs; driver profile armed", + "raw_capture": "klog/p9-0093-reload-excerpt.txt", + "raw_lines": 26, + "raw_bytes": 2900, + "lines": [ + "build identity: 9a84b116b5320eda8bdd2e609a6f1db51d47335d29d9212b5ea0ef01d86a1c61", + "[ps5vk] profile ... direct_live=266/601MiB ... direct_kinds=memory:152,stage:62,compute:11,tables:37,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=271/601MiB ... direct_kinds=memory:152,stage:67,compute:11,tables:37,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=272/601MiB ... direct_kinds=memory:152,stage:68,compute:11,tables:37,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=376/610MiB ... direct_kinds=memory:256,stage:70,compute:11,tables:35,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=298/604MiB ... direct_kinds=memory:152,stage:87,compute:11,tables:44,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=305/605MiB ... direct_kinds=memory:152,stage:94,compute:11,tables:44,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=418/613MiB ... direct_kinds=memory:256,stage:105,compute:11,tables:42,query:1,queue:2,display:1", + "input: pad script RELOAD at 82.66 s: 1", + "[ps5vk] profile ... direct_live=180/592MiB ... direct_kinds=memory:152,stage:10,compute:1,tables:13,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=183/592MiB ... direct_kinds=memory:152,stage:12,compute:2,tables:13,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=272/601MiB ... direct_kinds=memory:152,stage:69,compute:10,tables:37,query:1,queue:2,display:1", + "input: pad script RELOAD at 133.81 s: 1", + "[ps5vk] profile ... direct_live=180/592MiB ... direct_kinds=memory:152,stage:10,compute:1,tables:13,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=183/592MiB ... direct_kinds=memory:152,stage:12,compute:2,tables:13,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=273/601MiB ... direct_kinds=memory:152,stage:70,compute:10,tables:37,query:1,queue:2,display:1", + "input: pad script RELOAD at 184.28 s: 1", + "[ps5vk] profile ... direct_live=180/592MiB ... direct_kinds=memory:152,stage:10,compute:1,tables:13,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=183/592MiB ... direct_kinds=memory:152,stage:12,compute:2,tables:13,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=273/601MiB ... direct_kinds=memory:152,stage:70,compute:10,tables:37,query:1,queue:2,display:1", + "input: pad script RELOAD at 234.68 s: 1", + "[ps5vk] profile ... direct_live=180/592MiB ... direct_kinds=memory:152,stage:10,compute:1,tables:13,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=183/592MiB ... direct_kinds=memory:152,stage:12,compute:2,tables:13,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=273/601MiB ... direct_kinds=memory:152,stage:70,compute:10,tables:37,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=281/602MiB ... direct_kinds=memory:152,stage:78,compute:10,tables:37,query:1,queue:2,display:1", + "[ps5vk] profile ... direct_live=295/603MiB ... direct_kinds=memory:152,stage:92,compute:10,tables:37,query:1,queue:2,display:1" + ] +} diff --git a/evidence/dolphin-p9-reload-flat/expectation.json b/evidence/dolphin-p9-reload-flat/expectation.json new file mode 100644 index 0000000..1db7b85 --- /dev/null +++ b/evidence/dolphin-p9-reload-flat/expectation.json @@ -0,0 +1,14 @@ +{ + "step": "dolphin-p9-reload-flat", + "note": "After 0093: every reload returns to direct_live=180 and memory:152, the same count the first boot held; the stage and table mappings return to 10/12/70 each cycle. Before it, memory grew 152, 154, 156, 158, 160 (two per reload, the HDR uniform buffer). Four reloads, no crash.", + "must_contain": [ + "input: pad script RELOAD at 234.68 s: 1", + "direct_kinds=memory:152,stage:10" + ], + "must_not_contain": [ + "crash:", + "direct_kinds=memory:154", + "direct_kinds=memory:160" + ], + "human_check": "" +} diff --git a/patches/series b/patches/series index 2795c60..2001f1c 100644 --- a/patches/series +++ b/patches/series @@ -168,3 +168,8 @@ # were overwritten by the wide ones and leaked on every re-initialisation # gfx/drivers/vulkan.c 0092-release-replaced-textures + +# 0093 release the HDR uniform buffer whenever vulkan_init created it, not only +# when the context reports HDR support: it leaked on every video init +# gfx/drivers/vulkan.c +0093-release-hdr-uniform-buffer diff --git a/tests/test_frontend.py b/tests/test_frontend.py index 8cb4e9b..76bfb9d 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -342,7 +342,7 @@ class PortPatches(unittest.TestCase): change deliberately, in a commit that says why. """ self.assertEqual( - len(self.blocks()), 202, + len(self.blocks()), 203, "the patch count changed: if a block was added or removed on purpose, " "update this number in the same commit and say why in its message") diff --git a/tools/apply-port-patches.py b/tools/apply-port-patches.py index d9bd7de..5374ed7 100755 --- a/tools/apply-port-patches.py +++ b/tools/apply-port-patches.py @@ -2914,6 +2914,32 @@ EDITS = [ " vulkan_destroy_texture(vk->context->device, &vk->display.blank_texture);\n", "patches/series, 0092): the 4x4 texture", ), + ( + # 0093: vulkan_init creates the HDR uniform buffer whenever the build + # has VULKAN_HDR_SWAPCHAIN, but vulkan_free released it only when the + # context had HDR support, which this console's surface never reports. + # One 256-byte host-visible buffer and its memory leaked on every video + # driver init: two a core reload, seen as caller vulkan_create_buffer + # in the driver's allocation registry after 0092 (2026-09-25). The + # buffer is released whenever it exists; the HDR images stay with the + # support flag that created them. + "gfx/drivers/vulkan.c", + "#ifdef VULKAN_HDR_SWAPCHAIN\n" + " if (vk->context->flags & VK_CTX_FLAG_HDR_SUPPORT)\n" + " {\n" + " vulkan_destroy_buffer(vk->context->device, &vk->hdr.ubo);\n" + " vulkan_destroy_hdr_buffer(vk->context->device, &vk->main_buffer);\n", + "#ifdef VULKAN_HDR_SWAPCHAIN\n" + " /* Changed by this port (patches/series, 0093): vulkan_init creates the\n" + " * uniform buffer with or without HDR support, so it is released the\n" + " * same way. */\n" + " if (vk->hdr.ubo.memory != VK_NULL_HANDLE)\n" + " vulkan_destroy_buffer(vk->context->device, &vk->hdr.ubo);\n" + " if (vk->context->flags & VK_CTX_FLAG_HDR_SUPPORT)\n" + " {\n" + " vulkan_destroy_hdr_buffer(vk->context->device, &vk->main_buffer);\n", + "patches/series, 0093): vulkan_init creates the", + ), ] # Changes that are withdrawn rather than deleted, by marker.