Hi,
I have external hardware that exports a DMA buffer containing an image in linear RGBA8 format. The physical address of that buffer is determined on import, and may be in host DMA memory, or in prefetchable PCI memory, depending on whether device-to-device transfers are supported. That works reasonably well.
What I’m now trying to do is display this image, full screen.
My current approach is to allocate an external image tied to the DMA buffer, and an internal image of the same size, and in each frame,
- Memory Barrier for external image (undefined → transfer_src_optimal) and internal image (undefined → transfer_dst_optimal)
- Copy data
- Memory Barrier for internal image (transfer_src_optimal → shader_read_only_optimal)
- Start Renderpass
- Draw
- End Renderpass
I think the layout for the internal image is good enough like this, changing before and after the copy. What I’m less sure about is the external image: does the barrier actually do anything if the layout is already transfer_src_optimal? Is there another mechanism by which I can indicate "this image was changed externally, and must be re-read (any caches cleared)?