Newer a6xx devices seem to drop 8b/pixel UBWC support.
The turnip part was adapted from Jonathans patch on !10892
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
*/
bool has_cp_reg_write;
+ bool has_8bpp_ubwc;
+
struct {
uint32_t RB_UNKNOWN_8E04_blit;
uint32_t PC_UNKNOWN_9805;
# Things that earlier gens have and later gens remove, provide
# defaults here and let them be overridden by sub-gen template:
self.a6xx.has_cp_reg_write = True
+ self.a6xx.has_8bpp_ubwc = True
for name, val in template.items():
setattr(self.a6xx, name, val)
/* note: ubwc_possible() argument values to be ignored except for format */
if (pFormatProperties->formatProperties.optimalTilingFeatures &&
- ubwc_possible(format, VK_IMAGE_TYPE_2D, 0, 0, false, VK_SAMPLE_COUNT_1_BIT)) {
+ ubwc_possible(format, VK_IMAGE_TYPE_2D, 0, 0, physical_device->info, VK_SAMPLE_COUNT_1_BIT)) {
vk_outarray_append(&out, mod_props) {
mod_props->drmFormatModifier = DRM_FORMAT_MOD_QCOM_COMPRESSED;
mod_props->drmFormatModifierPlaneCount = 1;
return VK_ERROR_FORMAT_NOT_SUPPORTED;
- if (!ubwc_possible(info->format, info->type, info->usage, info->usage, physical_device->info->a6xx.has_z24uint_s8uint, sampleCounts))
+ if (!ubwc_possible(info->format, info->type, info->usage, info->usage, physical_device->info, sampleCounts))
return VK_ERROR_FORMAT_NOT_SUPPORTED;
format_feature_flags = format_props.optimalTilingFeatures;
bool
ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage,
- VkImageUsageFlags stencil_usage, bool has_z24uint_s8uint,
+ VkImageUsageFlags stencil_usage, const struct fd_dev_info *info,
VkSampleCountFlagBits samples)
{
/* no UBWC with compressed formats, E5B9G9R9, S8_UINT
format == VK_FORMAT_S8_UINT)
return false;
+ if (!info->a6xx.has_8bpp_ubwc &&
+ (format == VK_FORMAT_R8_UNORM ||
+ format == VK_FORMAT_R8_SNORM ||
+ format == VK_FORMAT_R8_UINT ||
+ format == VK_FORMAT_R8_SINT ||
+ format == VK_FORMAT_R8_SRGB))
+ return false;
+
if (type == VK_IMAGE_TYPE_3D) {
tu_finishme("UBWC with 3D textures");
return false;
* Additionally, the special AS_R8G8B8A8 format is broken without UBWC,
* so we have to fallback to 8_8_8_8_UNORM when UBWC is disabled
*/
- if (!has_z24uint_s8uint &&
+ if (!info->a6xx.has_z24uint_s8uint &&
format == VK_FORMAT_D24_UNORM_S8_UINT &&
(stencil_usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)))
return false;
- if (!has_z24uint_s8uint && samples > VK_SAMPLE_COUNT_1_BIT)
+ if (!info->a6xx.has_z24uint_s8uint && samples > VK_SAMPLE_COUNT_1_BIT)
return false;
return true;
if (!ubwc_possible(image->vk_format, pCreateInfo->imageType, pCreateInfo->usage,
stencil_usage_info ? stencil_usage_info->stencilUsage : pCreateInfo->usage,
- device->physical_device->info->a6xx.has_z24uint_s8uint, pCreateInfo->samples))
+ device->physical_device->info, pCreateInfo->samples))
ubwc_enabled = false;
/* expect UBWC enabled if we asked for it */
bool limited_z24s8);
bool
-ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, VkImageUsageFlags stencil_usage, bool limited_z24s8,
- VkSampleCountFlagBits samples);
+ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, VkImageUsageFlags stencil_usage,
+ const struct fd_dev_info *info, VkSampleCountFlagBits samples);
struct tu_buffer_view
{
static bool
ok_ubwc_format(struct pipe_screen *pscreen, enum pipe_format pfmt)
{
+ const struct fd_dev_info *info = fd_screen(pscreen)->info;
+
switch (pfmt) {
case PIPE_FORMAT_X24S8_UINT:
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
* fd_resource_uncompress() at the point of stencil sampling because
* that itself uses stencil sampling in the fd_blitter_blit path.
*/
- return fd_screen(pscreen)->info->a6xx.has_z24uint_s8uint;
+ return info->a6xx.has_z24uint_s8uint;
case PIPE_FORMAT_R8_G8B8_420_UNORM:
return true;
case FMT6_8_8_SINT:
case FMT6_8_8_UINT:
case FMT6_8_8_UNORM:
- case FMT6_8_UNORM:
case FMT6_Z24_UNORM_S8_UINT:
case FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8:
return true;
+ case FMT6_8_UNORM:
+ return info->a6xx.has_8bpp_ubwc;
default:
return false;
}