Module: Mesa Branch: master Commit: 29f62061d95eabaa925918a493045f91b887a55a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=29f62061d95eabaa925918a493045f91b887a55a
Author: Iago Toral Quiroga <[email protected]> Date: Tue Dec 1 08:50:46 2020 +0100 v3dv: expand the formats that can be handled in the TFU blit path Same as with other TFU paths, we only handle exact copies without conversion, so we can rewrite the format to use a compatible TFU format based on its texel size, which allows us to use this path with more formats. Reviewed-by: Alejandro PiƱeiro <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7845> --- src/broadcom/vulkan/v3dv_meta_copy.c | 50 ++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c b/src/broadcom/vulkan/v3dv_meta_copy.c index cdbfbb56c9e..4eefaa8ce82 100644 --- a/src/broadcom/vulkan/v3dv_meta_copy.c +++ b/src/broadcom/vulkan/v3dv_meta_copy.c @@ -4027,7 +4027,10 @@ blit_tfu(struct v3dv_cmd_buffer *cmd_buffer, const VkImageBlit *region, VkFilter filter) { - /* FIXME? The v3d driver seems to ignore filtering completely! */ + assert(dst->samples == VK_SAMPLE_COUNT_1_BIT); + assert(src->samples == VK_SAMPLE_COUNT_1_BIT); + + /* FIXME: The v3d driver seems to ignore filtering completely! */ if (filter != VK_FILTER_NEAREST) return false; @@ -4035,22 +4038,8 @@ blit_tfu(struct v3dv_cmd_buffer *cmd_buffer, if (src->vk_format != dst->vk_format) return false; - VkFormat vk_format = dst->vk_format; - const struct v3dv_format *format = dst->format; - - /* Format must be supported for texturing */ - if (!v3dv_tfu_supports_tex_format(&cmd_buffer->device->devinfo, - format->tex_type)) { - return false; - } - - /* Only color formats */ - if (vk_format_is_depth_or_stencil(vk_format)) - return false; - /* Destination can't be raster format */ - const uint32_t dst_mip_level = region->dstSubresource.mipLevel; - if (dst->slices[dst_mip_level].tiling == VC5_TILING_RASTER) + if (dst->tiling == VK_IMAGE_TILING_LINEAR) return false; /* Source region must start at (0,0) */ @@ -4061,6 +4050,7 @@ blit_tfu(struct v3dv_cmd_buffer *cmd_buffer, if (region->dstOffsets[0].x != 0 || region->dstOffsets[0].y != 0) return false; + const uint32_t dst_mip_level = region->dstSubresource.mipLevel; const uint32_t dst_width = u_minify(dst->extent.width, dst_mip_level); const uint32_t dst_height = u_minify(dst->extent.height, dst_mip_level); if (region->dstOffsets[1].x < dst_width - 1|| @@ -4079,6 +4069,34 @@ blit_tfu(struct v3dv_cmd_buffer *cmd_buffer, return false; } + /* If the format is D24S8 both aspects need to be copied, since the TFU + * can't be programmed to copy only one aspect of the image. + */ + if (dst->vk_format == VK_FORMAT_D24_UNORM_S8_UINT) { + const VkImageAspectFlags ds_aspects = VK_IMAGE_ASPECT_DEPTH_BIT | + VK_IMAGE_ASPECT_STENCIL_BIT; + if (region->dstSubresource.aspectMask != ds_aspects) + return false; + } + + /* Our TFU blits only handle exact copies (it requires same formats + * on input and output, no scaling, etc), so there is no pixel format + * conversions and we can rewrite the format to use one that is TFU + * compatible based on its texel size. + */ + VkFormat vk_format; + switch (dst->cpp) { + case 16: vk_format = VK_FORMAT_R32G32B32A32_SFLOAT; break; + case 8: vk_format = VK_FORMAT_R16G16B16A16_SFLOAT; break; + case 4: vk_format = VK_FORMAT_R32_SFLOAT; break; + case 2: vk_format = VK_FORMAT_R16_SFLOAT; break; + case 1: vk_format = VK_FORMAT_R8_UNORM; break; + default: unreachable("unsupported format bit-size"); break; + }; + const struct v3dv_format *format = v3dv_get_format(vk_format); + assert(v3dv_tfu_supports_tex_format(&cmd_buffer->device->devinfo, + format->tex_type)); + /* Emit a TFU job for each layer to blit */ assert(region->dstSubresource.layerCount == region->srcSubresource.layerCount); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
