Skip to content

radv: check VkMemoryDedicatedRequirements before bind image memory

Julia Zhang requested to merge Julia/mesa:upstream-interop into main

Background

Since the bo metadata is not set for un-dedicated images, so the use cases that try to import un-dedicated buffer would fail. For example, Vulkan-Samples test case open_gl_interop create an un-dedicated image in vulkan and radeonsi try to import this image using RADEON_SURF_MODE_LINEAR_ALIGNED tiling mode by default. But the result is incorrect because of the unmatched swizzleMode.

So this MR is more to discuss if this is a possible way to handle this use case.

Implementation

  1. Radv would create VK_IMAGE_TILING_OPTIMAL image by default, but setting the TexParameter TEXTURE_TILING_EXT would change templ->bind, so this call si_choose_tiling to select tiling mode according to templ->bind in si_texture_from_winsys_buffer().
  2. Since for un-dedicated image, surface dcc info can't be synchronized from metadata and vulkan would also disable dcc for both of shareable linear image and optimal image, this set DISABLE_DCC for this imported surface.
  3. get_preferred_swizzle_mode for the surface of imported un-dedicated image.

v1->v2 changes

  1. Add checking dedicate requirements in radv.
  2. Drop previous implementation of choosing tile mode for undedicated memobj.
Edited by Julia Zhang

Merge request reports

Loading