Commit 1fbb6ff5 authored by Bas Nieuwenhuizen's avatar Bas Nieuwenhuizen Committed by Marge Bot
Browse files

radv: Add drm format modifier queries.


Reviewed-By: chadversary's avatarChad Versace <chad@kiwitree.net>
Part-of: <mesa/mesa!7667>
parent 6c83e3ea
......@@ -139,6 +139,7 @@ EXTENSIONS = [
Extension('VK_EXT_external_memory_host', 1, 'device->rad_info.has_userptr'),
Extension('VK_EXT_global_priority', 2, 'device->rad_info.has_ctx_priority'),
Extension('VK_EXT_host_query_reset', 1, True),
Extension('VK_EXT_image_drm_format_modifier', 1, False),
Extension('VK_EXT_image_robustness', 1, True),
Extension('VK_EXT_index_type_uint8', 1, 'device->rad_info.chip_class >= GFX8'),
Extension('VK_EXT_inline_uniform_block', 1, True),
......
......@@ -1651,9 +1651,13 @@ radv_plane_from_aspect(VkImageAspectFlags mask)
{
switch(mask) {
case VK_IMAGE_ASPECT_PLANE_1_BIT:
case VK_IMAGE_ASPECT_MEMORY_PLANE_1_BIT_EXT:
return 1;
case VK_IMAGE_ASPECT_PLANE_2_BIT:
case VK_IMAGE_ASPECT_MEMORY_PLANE_2_BIT_EXT:
return 2;
case VK_IMAGE_ASPECT_MEMORY_PLANE_3_BIT_EXT:
return 3;
default:
return 0;
}
......@@ -1988,12 +1992,27 @@ void radv_GetImageSubresourceLayout(
int level = pSubresource->mipLevel;
int layer = pSubresource->arrayLayer;
unsigned plane_id = radv_plane_from_aspect(pSubresource->aspectMask);
unsigned plane_id = 0;
if (vk_format_get_plane_count(image->vk_format) > 1)
plane_id = radv_plane_from_aspect(pSubresource->aspectMask);
struct radv_image_plane *plane = &image->planes[plane_id];
struct radeon_surf *surface = &plane->surface;
if (device->physical_device->rad_info.chip_class >= GFX9) {
if (image->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
unsigned mem_plane_id = radv_plane_from_aspect(pSubresource->aspectMask);
assert(level == 0);
assert(layer == 0);
pLayout->offset = ac_surface_get_plane_offset(device->physical_device->rad_info.chip_class,
surface, mem_plane_id, 0);
pLayout->rowPitch = ac_surface_get_plane_stride(device->physical_device->rad_info.chip_class,
surface, mem_plane_id);
pLayout->arrayPitch = 0;
pLayout->depthPitch = 0;
pLayout->size = ac_surface_get_plane_size(surface, mem_plane_id);
} else if (device->physical_device->rad_info.chip_class >= GFX9) {
uint64_t level_offset = surface->is_linear ? surface->u.gfx9.offset[level] : 0;
pLayout->offset = ac_surface_get_plane_offset(device->physical_device->rad_info.chip_class,
......@@ -2029,6 +2048,16 @@ void radv_GetImageSubresourceLayout(
}
}
VkResult radv_GetImageDrmFormatModifierPropertiesEXT(VkDevice _device,
VkImage _image,
VkImageDrmFormatModifierPropertiesEXT* pProperties)
{
RADV_FROM_HANDLE(radv_image, image, _image);
pProperties->drmFormatModifier = image->planes[0].surface.modifier;
return VK_SUCCESS;
}
VkResult
radv_CreateImageView(VkDevice _device,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment