Repository navigation
SCGPU stream ring: GL stream writes no longer wait for the app - #31
Merged
Merged
Conversation
Every write(2) of the GL stream on /dev/vgpu3d was a mailbox command (TRANSFER_TO_HOST_3D of the pipe) and a wait for its reply: a round trip per flush, and under video (YouTube in Safari) 4-10K commands a second with the app's device thread 60% busy. Now, when the app says it takes them (SCGPU_F_RING), the guest puts the bytes into a 4 MiB byte ring in the pool, as records of the context's pipe, and returns at once. It rings the app only if the app sleeps, and waits only for room. The app hands each record to its pipe (transfer_write_iov straight from the ring) and does so with everything in the ring before it runs any mailbox command, so a reply, an upload or a read still follows every byte written before it. bell_ring has a lock of its own now, since both the mailbox and the ring ring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The GL stream's writes go into a 4 MiB byte ring in the SCGPU pool instead of a mailbox round trip each. Records are {resource, context, length} plus payload padded to 16 bytes; the guest advances
ring_head, and the app advancesring_tailand drains the ring before every mailbox command, so ordering holds. The guest only waits for room. Reads still go through the mailbox. The ring is allocated only when the app setsSCGPU_F_RING, so a new kernel with an old app keeps the old path.Measured on the Pixel 10, home-screen page swipes (SurfaceFlinger, overlay layer, two runs each):
App side: Scion-Project/scion (scgpu/ring).
🤖 Generated with Claude Code