Repository navigation
perf(agc): reduce lossless screenshot write latency - #23163
Merged
oneandonlydean merged 1 commit intoNov 20, 2026
Merged
oneandonlydean merged 1 commit into
oneandonlydean merged 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Screenshot capture uses the generic PNG encoder's level 8 default, spending seconds compressing a single 4K image. Select level 1 at the screenshot call site so capture files become available sooner. Decoded RGB is unchanged; the generic encoder default remains8.
One-line change over measured main
6286d364496d41fcff8b032742ba0ace2972b6a1, candidate9ab8b3418949607aa4b5e00e571c449c293ad167. Current upstream7320658048feba88cdaff420333abae16d791ef6merges cleanly and conventions pass against it. Intervening changes are outside AGC/PNG (kernel, other guest libraries and tools). The measured source pins are preserved; this is the single compression-policy line, with no private integration dependencies.Tested
Linux 7.2.14-arch1-1, Ryzen 9 7950X, GCC 16.2.1 Release, RX 6650 XT/RADV Mesa 26.2.7-arch1.1.
Actual screenshot writer, identical input pixels: three 3840x2160 captured RGB frames, five alternating main/change pairs each. Timer covers actual repository
Screenshot::Write, including conversion, PNG compression and file write/close. All 30 PNGs independently decode to byte-exact input RGB with Pillow. Both 835-file frozen SDK banks and fixtures remain unchanged.Native check: Quake PPSA01880 01.009.000, same attract/demo sequence and controller schedule, native 3840x2160, 974x548 window, same machine/settings. Separate warm-up then restarted/private same-head cache copies for each arm. Three timed screenshot requests per measured run. First timed native PNGs directly reviewed: same nailgun pickup room, with slight demo motion/ammo difference. This is not a frame-locked replay or a gameplay FPS claim.
Request-to-output PNG modification timestamps were main 1.266/1.733/1.182s and change 0.341/0.381/0.322s (medians 1.266→0.341s). These timestamps include request/readback/encoding/write work and are a filesystem completion proxy, not instrumented writer timing or fsync durability. The roughly 2s observer tick independently confirms valid PNG arrival but cannot resolve the faster encoding; the identical-input writer benchmark above is the causal comparison.
All 4 native boots exit0. Source/bank/asset/input hashes unchanged, original kernel parameter restored, private overlays unmounted, no remaining native processes. Host FIFO excludes other native/GPU/build jobs during each arm; it releases between arms. Desktop load was not controlled. No player-controlled gameplay, audio or Windows result is claimed.
Matched focused tests: main 5/5, change 5/5:
agc_screenshot,agc_screenshot_trigger,decoder_png,agc_driver_presentation_pass,agc_driver_presentation_fsr. Two real GPU cases/arm,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1, Khronos validation layer 1.4.363 (headers 1.4.335),VK_LOADER_DEBUG=layer. Both logs insert Khronos twice and select physical RADV; no skips, missing-layer messages or VUID errors.Trace context: warm caches,
APS5_TRACE_SECONDS=50:60, same scene/window/settings, inherited realPTY without app log redirection, no other profiling switches. Full actual summary lines, traces andtrace_digestoutputs are attached. Both detailed event buffers overflowed after 15–17s; aggregate totals tables did not overflow. Do not interpret the traces as complete detailed timelines or infer a title FPS gain. The writer timings use identical inputs independently of this trace limitation.Actual main/change summary lines
{"commit":"6286d364496d","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_SCREENSHOT_TRIGGER":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"50:60"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.7-arch1.1","os":"Linux 7.2.14-arch1-1","cpu":"AMD Ryzen 9 7950X 16-Core Processor","cpu_threads":32,"memory_mib":127901,"title_id":"PPSA01880","title":"Quake","content_version":"01.009.000","resolution":"3840x2160","window":{"spec":"seconds 50:60","first_present":1813,"ms":60005.314},"presents":3870,"frame_ms":{"p50":14.695,"p90":22.146,"p99":32.998,"max":108.778},"gpu_busy_ms_per_present":8.616,"worker_busy_pct":{"queue worker 0x0":86.340},"phase_totals_ms":{"Driver.Completion":7.004,"Driver.Dispatch":818.995,"Driver.Draw":15104.491,"Driver.Draw.device_setup":397.500,"Driver.Draw.draw_enqueued":9251.080,"Driver.Draw.post_compile_prepare":204.224,"Driver.Draw.prepare":1006.503,"Driver.Draw.shader_compile_and_link":4130.348,"Driver.EndSubmission":387.670,"Driver.Packet":51413.470,"Driver.Packet.device_lock":102.946,"Driver.Packet.dispatch":827.811,"Driver.Packet.draw":15177.765,"Driver.Packet.execute":5078.055,"Driver.Packet.flip_flush":10.445,"Driver.Packet.flush_between_packets":337.735,"Driver.Packet.memory_wait":5.597,"Driver.Packet.pipeline_drain":22174.378,"Driver.Packet.pipeline_prepare":158.520,"Driver.Packet.prepare_memory":443.228,"Driver.Packet.rendering_wait":21.278,"Driver.Present":10023.323,"Driver.Present.acquire_image":198.090,"Driver.Present.device_setup":2.558,"Driver.Present.gpu_mutex_wait":548.788,"Driver.Present.inflight_wait":8.290,"Driver.Present.present_display_buffer":488.735,"Driver.Present.queue_present":55.470,"Driver.Present.release_and_callback":4.295,"Driver.Present.render_fence_wait":8709.030,"Driver.Present.resize":4.741,"Driver.Present.validate":1.174,"Driver.Suspend":0.510,"GpuMutex.wait.draw":153.768,"GpuMutex.wait.end":42.977,"GpuMutex.wait.fill":106.413,"GpuMutex.wait.flush":32.750,"GpuMutex.wait.hook":118.037,"GpuMutex.wait.label":307.106,"GpuMutex.wait.other":14.611,"GpuMutex.wait.present":542.840,"Graphics.Draw":15187.465,"Graphics.Draw.draw_and_resource_release":12343.057,"Graphics.Draw.index_upload":566.322,"Graphics.Draw.validate":1193.824,"Graphics.Draw.vertex_upload":897.264,"Graphics.DrawWithRecipe":18852.309,"Graphics.DrawWithRecipe.draw_and_resource_release":16079.403,"Graphics.DrawWithRecipe.index_upload":917.445,"Graphics.DrawWithRecipe.validate":653.389,"Graphics.DrawWithRecipe.vertex_upload":1071.418,"Recorder.Reap":1648.954,"Recorder.Submit":7896.147,"Resources.Complete":796.536,"Resources.Prepare":118.591,"Shader.DrawStage":1945.543,"Shader.DrawStage.capture_resources":856.938,"Shader.DrawStage.materialize":766.142,"Shader.DrawStage.prepared_invocation":303.633,"Shader.ResolveAbi":2920.180,"Shader.ResolveGraphicsAbi":744.839,"Shader.ResolveGraphicsStagesAbi":2184.550,"VideoOut.Flip":10240.606,"VideoOut.Flip.completion_mutex_wait":3.016,"VideoOut.Flip.config_mutex_wait":0.182,"VideoOut.Flip.frame_limit":2.029,"VideoOut.Flip.notify_game":58.658,"VideoOut.Flip.present":10030.651,"VideoOut.Flip.validate":3.789,"VideoOut.Flip.vblank_wait":2.417,"VideoOut.Flip.window_prepare":6.001,"VideoOut.Flip.window_title":131.752,"VideoOut.Readiness":6.629,"VideoOut.Readiness.locks_validate":3.216,"Vulkan.Acquire":190.200,"Vulkan.Acquire.acquire_fence_wait":6.793,"Vulkan.Acquire.acquire_image":158.958,"Vulkan.Acquire.fence_reset":22.201,"Vulkan.Acquire.retired_swapchains":1.403,"Vulkan.DrawFromRecipe":19148.095,"Vulkan.Present":359.051,"Vulkan.Present.command_record_scale":84.043,"Vulkan.Present.pixel_upload":95.238,"Vulkan.Present.queue_submit":177.288,"Vulkan.QueuePresent":50.465,"Vulkan.QueuePresent.queue_present":48.068,"Vulkan.Retire":8706.915,"Vulkan.Retire.dump":11.580,"Vulkan.Retire.wait":8670.888},"top_phases_ms_per_frame":{"Driver.Packet":13.285,"Driver.Packet.pipeline_drain":5.730,"Vulkan.DrawFromRecipe":4.948,"Graphics.DrawWithRecipe":4.871,"Graphics.DrawWithRecipe.draw_and_resource_release":4.155,"Graphics.Draw":3.924,"Driver.Packet.draw":3.922,"Driver.Draw":3.903},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":11610,"Graphics.Barrier.draw":95730,"Graphics.Barrier.fill":15474,"Graphics.Barrier.fill-clear":23220,"Graphics.Barrier.label-run":171213,"Graphics.Barrier.present-blit":15480,"Graphics.Barrier.shadow-publish":3870,"Graphics.Barrier.storage-upload":26,"Graphics.Barrier.storage-writeback":11610,"Graphics.BarrierMerged.shadow-publish":3870,"Graphics.RenderPass":49826,"Graphics.RenderPass.Close.command":3879,"Graphics.RenderPass.Close.image":14593,"Graphics.RenderPass.Close.key":13493,"Graphics.RenderPass.Close.new-batch":17861,"Graphics.RenderPass.Continued":366894},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":16.977,"events_lost":598296,"totals_full":false},"draw committer":{"events_full_after_s":15.439,"events_lost":732828,"totals_full":false}},"trace":"aps5-trace-6286d364496d-2375148.json.gz"} {"commit":"9ab8b3418949","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_SCREENSHOT_TRIGGER":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"50:60"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.7-arch1.1","os":"Linux 7.2.14-arch1-1","cpu":"AMD Ryzen 9 7950X 16-Core Processor","cpu_threads":32,"memory_mib":127901,"title_id":"PPSA01880","title":"Quake","content_version":"01.009.000","resolution":"3840x2160","window":{"spec":"seconds 50:60","first_present":1727,"ms":60007.804},"presents":3915,"frame_ms":{"p50":14.281,"p90":22.192,"p99":36.076,"max":58.588},"gpu_busy_ms_per_present":8.559,"worker_busy_pct":{"queue worker 0x0":85.800},"phase_totals_ms":{"Driver.Completion":6.983,"Driver.Dispatch":830.099,"Driver.Draw":14961.980,"Driver.Draw.device_setup":411.235,"Driver.Draw.draw_enqueued":9047.495,"Driver.Draw.post_compile_prepare":201.013,"Driver.Draw.prepare":1036.131,"Driver.Draw.shader_compile_and_link":4143.627,"Driver.EndSubmission":388.567,"Driver.Packet":51090.797,"Driver.Packet.device_lock":104.916,"Driver.Packet.dispatch":838.951,"Driver.Packet.draw":15037.355,"Driver.Packet.execute":5061.964,"Driver.Packet.flip_flush":10.339,"Driver.Packet.flush_between_packets":340.644,"Driver.Packet.memory_wait":5.548,"Driver.Packet.pipeline_drain":22059.033,"Driver.Packet.pipeline_prepare":161.535,"Driver.Packet.prepare_memory":447.041,"Driver.Packet.rendering_wait":22.859,"Driver.Present":9888.742,"Driver.Present.acquire_image":190.770,"Driver.Present.device_setup":2.401,"Driver.Present.gpu_mutex_wait":556.549,"Driver.Present.inflight_wait":8.092,"Driver.Present.present_display_buffer":484.995,"Driver.Present.queue_present":55.022,"Driver.Present.release_and_callback":3.409,"Driver.Present.render_fence_wait":8579.414,"Driver.Present.resize":4.960,"Driver.Present.validate":1.227,"Driver.Suspend":0.518,"GpuMutex.wait.draw":153.801,"GpuMutex.wait.end":33.028,"GpuMutex.wait.fill":103.052,"GpuMutex.wait.flush":31.534,"GpuMutex.wait.hook":129.821,"GpuMutex.wait.label":306.630,"GpuMutex.wait.other":11.858,"GpuMutex.wait.present":550.823,"Graphics.Draw":15236.449,"Graphics.Draw.draw_and_resource_release":12398.978,"Graphics.Draw.index_upload":566.478,"Graphics.Draw.validate":1205.340,"Graphics.Draw.vertex_upload":883.113,"Graphics.DrawWithRecipe":18467.391,"Graphics.DrawWithRecipe.draw_and_resource_release":15767.066,"Graphics.DrawWithRecipe.index_upload":886.331,"Graphics.DrawWithRecipe.validate":637.242,"Graphics.DrawWithRecipe.vertex_upload":1046.766,"Recorder.Reap":1620.629,"Recorder.Submit":7855.505,"Resources.Complete":814.575,"Resources.Prepare":121.225,"Shader.DrawStage":1942.911,"Shader.DrawStage.capture_resources":871.416,"Shader.DrawStage.materialize":737.152,"Shader.DrawStage.prepared_invocation":314.669,"Shader.ResolveAbi":2970.226,"Shader.ResolveGraphicsAbi":735.513,"Shader.ResolveGraphicsStagesAbi":2224.401,"VideoOut.Flip":10107.632,"VideoOut.Flip.completion_mutex_wait":2.590,"VideoOut.Flip.config_mutex_wait":0.243,"VideoOut.Flip.frame_limit":2.246,"VideoOut.Flip.notify_game":54.999,"VideoOut.Flip.present":9895.861,"VideoOut.Flip.validate":3.392,"VideoOut.Flip.vblank_wait":2.503,"VideoOut.Flip.window_prepare":6.235,"VideoOut.Flip.window_title":137.537,"VideoOut.Readiness":5.984,"VideoOut.Readiness.locks_validate":3.228,"Vulkan.Acquire":184.238,"Vulkan.Acquire.acquire_fence_wait":6.772,"Vulkan.Acquire.acquire_image":153.226,"Vulkan.Acquire.fence_reset":22.020,"Vulkan.Acquire.retired_swapchains":1.322,"Vulkan.DrawFromRecipe":18777.879,"Vulkan.Present":351.015,"Vulkan.Present.command_record_scale":85.303,"Vulkan.Present.pixel_upload":86.451,"Vulkan.Present.queue_submit":176.836,"Vulkan.QueuePresent":50.801,"Vulkan.QueuePresent.queue_present":49.304,"Vulkan.Retire":8577.022,"Vulkan.Retire.dump":64.502,"Vulkan.Retire.wait":8484.624},"top_phases_ms_per_frame":{"Driver.Packet":13.050,"Driver.Packet.pipeline_drain":5.634,"Vulkan.DrawFromRecipe":4.796,"Graphics.DrawWithRecipe":4.717,"Graphics.DrawWithRecipe.draw_and_resource_release":4.027,"Graphics.Draw":3.892,"Driver.Packet.draw":3.841,"Driver.Draw":3.822},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":11745,"Graphics.Barrier.draw":96758,"Graphics.Barrier.fill":15656,"Graphics.Barrier.fill-clear":23490,"Graphics.Barrier.label-run":172581,"Graphics.Barrier.present-blit":15660,"Graphics.Barrier.shadow-publish":3915,"Graphics.Barrier.storage-upload":26,"Graphics.Barrier.storage-writeback":11745,"Graphics.BarrierMerged.shadow-publish":3915,"Graphics.RenderPass":50413,"Graphics.RenderPass.Close.command":3925,"Graphics.RenderPass.Close.image":14732,"Graphics.RenderPass.Close.key":13722,"Graphics.RenderPass.Close.new-batch":18034,"Graphics.RenderPass.Continued":377146},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":16.954,"events_lost":613180,"totals_full":false},"draw committer":{"events_full_after_s":15.689,"events_lost":751300,"totals_full":false}},"trace":"aps5-trace-9ab8b3418949-2400262.json.gz"}Report, source patch, reproduction scripts, raw traces, test logs/JUnit, capture receipts and native PNGs, SHA-256
0f54d349f2293d0a998341573c9cbd414f6847fe065ea938d0c51a69ada32a5a. Archive has 56 hash-verified payloads; no SDK/guest binaries, original assets, saves or shader caches.Conventions pass against current upstream main and against the local origin/main reference (the latter also reports 17 inherited debt-length warnings, zero errors). Branch overlap scan covered 1,896 open heads with no open overlap; #20344 changes trigger-file handling rather than compression. No dependency on that PR.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)