Repository navigation
linux: show dmabuf frames from another process - #862
Merged
Merged
Conversation
…ure, once per frame; linear ARGB8888 only, checked; bounded imports
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.
adds
NativeSurface::push_dmabufon linux, same shape as the windows shared textures. a producer rendersDRM_FORMAT_ARGB8888into single-plane linear dmabufs on the gpunative_surface::linux::import_target()names (the window device's render node, fromVK_EXT_physical_device_drm). rune imports each buffer once with wgpu-hal'stexture_from_dmabuf_fd, copies a frame into its own texture the first time it draws it and draws that copy from then on, and calls the frame'son_readonce the gpu finished the copy. vulkan devices on linux ask forVULKAN_EXTERNAL_MEMORY_DMA_BUFwhen the driver has it.on_readruns from a small waiter thread (device.poll(Wait { submission_index })), so an idle window that draws nothing more still frees the producer's bufferon_readasErrDmabufper device, so a redraw or a second window never re-reads a buffer the producer may be writing againDmabufBuffer::newtakes aDmabufPlaneand fourcc and checks stride >= width4 and offset + strideheight against the fd's size, so bad input is a clean errorImportTargetis#[non_exhaustive]checked on an amd 8060s (radv) with opencode (rune)'s chromium engine: 60 fps, pixels match the bgra path for css, webgl and webgpu pages, idle-then-update works, engine kill and restart keeps flowing. used by anomalyco/opencode-rune#107.
the imported image starts undefined and stays in copy-source; fine for linear buffers (no compression metadata), noted in the code.
— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊