turnip: report corresponding drmFormatModifierPlaneCount for planar format
If an image is linear, then the partition is the same for memory planes and for format planes. Therefore, if the returned drmFormatModifier is DRM_FORMAT_MOD_LINEAR, then drmFormatModifierPlaneCount must equal the format planecount, and drmFormatModifierTilingFeatures must be identical to the VkFormatProperties2::linearTilingFeatures returned in the same pNext chain.
Besides what the spec says about above, based on msm_calculate_layout
from minigbm
msm.c
backend, DRM_FORMAT_NV12
and DRM_FORMAT_P010
are indeed allocated with 2 planes no matter tiled or linear. So drmFormatModifierPlaneCount
for the corresponding VK_FORMAT_G8_B8R8_2PLANE_420_UNORM
format, the mod properties should reflect the allocation.
Currently, the image creation with explicit mod info for that would fail with VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT
because tu_GetPhysicalDeviceFormatProperties2
gives constant 1
for the plane count.
Hacking to return corresponding plane count makes external planar image import succeed.