multigpu: Consider other formats for transfer than the original #1882
+97
−28
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.
This is an attempt to make the multigpu renderer a bit more flexible, if the sets of formats of two gpus just don't align.
Firstly it makes the
dma_shadow_copytry more formats, if the original one isn't available. First it tries to find one with the same bpp (falling back to 8, if it can't be determined, which allows us to finally display something for YUV-formats, even if not accurate) and then it accepts losing precision down to 8-bits per color.Secondly if the
mem_copy-code fails to read from a texture, we currently have no fall back.ExportMem::can_read_textureis meant to prevent that, but on OpenGL ES we can only try to truly see if reading works. Sadly the nvidia driver doesn't allow us to read withGL_RGBAandGL_UNSIGNED_INT_2_10_10_10_REV(it falls withINVALID_OPERATION) even though the spec says it should(?): https://docs.gl/es3/glReadPixels.This is in particular a problem with games not going through PRIME (e.g. via wine-wayland) which like to allocate their framebuffer in
XBGR2101010. So as a fall back we render these into aAbgr8888shadow buffer and copy from there (which works fine in my testing, even though we obviously lose some precision).Ideally we should have a vulkan renderer, where none of this is an issue and we can use dmabuf-sharing even with nvidia with
Linear-modifiers, but in the meantime this is better than a black window.