Repository navigation
Fix: add vmap/vunmap callbacks to evdi GEM objects in order to support some multi monitor setups - #604
Open
TigerWolf wants to merge 1 commit into
Open
Fix: add vmap/vunmap callbacks to evdi GEM objects in order to support some multi monitor setups#604TigerWolf wants to merge 1 commit into
TigerWolf wants to merge 1 commit into
Conversation
DMA-BUF importers such as compositors may require the exporting GEM object to expose .vmap/.vunmap. EVDI's GEM objects do not, so mapping an EVDI-exported buffer can fail with -EOPNOTSUPP and leave one of multiple DisplayLink outputs black. Implement evdi_gem_object_vmap()/evdi_gem_object_vunmap() using evdi_pin_pages()/evdi_unpin_pages() and vmap()/vunmap(), and register them in gem_obj_funcs. Balance the page pin on the vmap failure path and in vunmap. Also report the real dma_buf_vmap() error together with the exporter name instead of collapsing it to -ENOMEM. See DisplayLink#591
Author
|
Should I leave the error logging in there or remove it? It was helpful when debugging. |
This branch has not been deployed
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 problem
I use an external monitor through a DisplayLink dock. The monitor stayed black, although the mouse pointer still moved on it.
The kernel log showed errors such as:
Why it happened
EVDI shares its graphics buffers with the rest of the display stack using DMA-BUF. Before another driver or compositor can read one of those buffers, it has to map the buffer into memory and later unmap it.
EVDI's buffers did not provide those map/unmap operations, so the mapping failed and the second output could not be displayed.
How this fixes it
This change adds the missing map and unmap operations to EVDI's graphics buffers and registers them with the DRM subsystem. Another driver can now map an EVDI buffer, read it, and unmap it when finished.
The page pinning is balanced:
vmappins the pages, maps the buffer, and returns the address.vunmapunmaps the buffer and releases the page pin.The error message now includes the real error code and the name of the driver that owns the buffer, which makes future failures easier to diagnose.
What changed
evdi_gem_object_vmap(): new callback that pins the pages and maps the buffer into kernel memory.evdi_gem_object_vunmap(): new callback that unmaps the buffer and releases the page pin.gem_obj_funcs: registers the new callbacks so DRM can use them.evdi_pin_pages()/evdi_unpin_pages(): existing helpers used to keep the pages in place while the buffer is mapped.dma_buf_map/iosys_map: keeps the code building on older (5.11-5.17) and newer (5.18+) kernels.evdi_gem_vmap()error path: logs the actual DMA-BUF error and buffer owner instead of returning a generic-ENOMEM.Testing
make -C module.git diff --checkpasses.I can rebuild and test further changes on this setup.
Refs: #591