Patch 0093: release the HDR uniform buffer on every video free

vulkan_init creates vk->hdr.ubo whenever the build has VULKAN_HDR_SWAPCHAIN,
but vulkan_free destroyed it only when the context reported HDR support,
which this console's surface never does. One 256-byte host-visible buffer
leaked each video init, two per core reload: the two direct-memory mappings a
reload that Profile 9 left unidentified. The patch count goes from 202 to 203
for this one block.

Title 9a84b116, four reloads of Melee: every reload returns to 180 live
mappings and memory:152 (evidence/dolphin-p9-reload-flat).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MihawkandClaude Opus 5.5 committed 2026-09-25 15:26:02 -04:00
1 parent 35c905b6dd
commit 18689a115f
6 files changed
+103 -1

No files matched your search

+19
View File
@@ -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%.
@@ -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"
]
}
@@ -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": ""
}
+5
View File
@@ -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
+1 -1
View File
@@ -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")
+26
View File
@@ -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.