mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 01:40:08 +01:00
turnip: Move the limited_z24s8 flag to the shared device info.
I want to do the same logic in freedreno, so use the same flag. On suggestion by robclark, rename it to what it specifically means. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8319>
This commit is contained in:
parent
11f32b6a05
commit
1c4613f5d4
7 changed files with 15 additions and 15 deletions
|
|
@ -56,6 +56,7 @@ freedreno_dev_info_init(struct freedreno_dev_info *info, uint32_t gpu_id)
|
|||
info->a6xx.magic.RB_UNKNOWN_8E04_blit = 0x00100000;
|
||||
info->a6xx.magic.PC_UNKNOWN_9805 = 0;
|
||||
info->a6xx.magic.SP_UNKNOWN_A0F8 = 0;
|
||||
info->a6xx.has_z24uint_s8uint = true;
|
||||
break;
|
||||
case 630:
|
||||
info->num_sp_cores = 2;
|
||||
|
|
@ -88,6 +89,7 @@ freedreno_dev_info_init(struct freedreno_dev_info *info, uint32_t gpu_id)
|
|||
info->a6xx.magic.RB_UNKNOWN_8E04_blit = 0x00100000;
|
||||
info->a6xx.magic.PC_UNKNOWN_9805 = 1;
|
||||
info->a6xx.magic.SP_UNKNOWN_A0F8 = 1;
|
||||
info->a6xx.has_z24uint_s8uint = true;
|
||||
break;
|
||||
case 650:
|
||||
info->num_sp_cores = 3;
|
||||
|
|
@ -98,6 +100,7 @@ freedreno_dev_info_init(struct freedreno_dev_info *info, uint32_t gpu_id)
|
|||
info->a6xx.magic.RB_UNKNOWN_8E04_blit = 0x04100000;
|
||||
info->a6xx.magic.PC_UNKNOWN_9805 = 2;
|
||||
info->a6xx.magic.SP_UNKNOWN_A0F8 = 2;
|
||||
info->a6xx.has_z24uint_s8uint = true;
|
||||
break;
|
||||
default:
|
||||
/* Drivers should be doing their own version filtering, so we
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ struct freedreno_dev_info {
|
|||
uint32_t ccu_offset_gmem;
|
||||
uint32_t ccu_offset_bypass;
|
||||
bool ccu_cntl_gmem_unk2;
|
||||
bool has_z24uint_s8uint;
|
||||
|
||||
struct {
|
||||
uint32_t RB_UNKNOWN_8E04_blit;
|
||||
|
|
|
|||
|
|
@ -1048,7 +1048,7 @@ tu_emit_input_attachments(struct tu_cmd_buffer *cmd,
|
|||
dst[0] &= ~(A6XX_TEX_CONST_0_FMT__MASK |
|
||||
A6XX_TEX_CONST_0_SWIZ_X__MASK | A6XX_TEX_CONST_0_SWIZ_Y__MASK |
|
||||
A6XX_TEX_CONST_0_SWIZ_Z__MASK | A6XX_TEX_CONST_0_SWIZ_W__MASK);
|
||||
if (cmd->device->physical_device->limited_z24s8) {
|
||||
if (!cmd->device->physical_device->info.a6xx.has_z24uint_s8uint) {
|
||||
dst[0] |= A6XX_TEX_CONST_0_FMT(FMT6_8_8_8_8_UINT) |
|
||||
A6XX_TEX_CONST_0_SWIZ_X(A6XX_TEX_W) |
|
||||
A6XX_TEX_CONST_0_SWIZ_Y(A6XX_TEX_ZERO) |
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ tu_physical_device_init(struct tu_physical_device *device,
|
|||
memset(device->name, 0, sizeof(device->name));
|
||||
sprintf(device->name, "FD%d", device->gpu_id);
|
||||
|
||||
device->limited_z24s8 = (device->gpu_id == 630);
|
||||
|
||||
switch (device->gpu_id) {
|
||||
case 615:
|
||||
case 618:
|
||||
|
|
|
|||
|
|
@ -547,7 +547,7 @@ tu_get_image_format_properties(
|
|||
if (info->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT)
|
||||
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||
|
||||
if (!ubwc_possible(info->format, info->type, info->usage, physical_device->limited_z24s8))
|
||||
if (!ubwc_possible(info->format, info->type, info->usage, physical_device->info.a6xx.has_z24uint_s8uint))
|
||||
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||
|
||||
format_feature_flags = format_props.optimalTilingFeatures;
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ tu6_texswiz(const VkComponentMapping *comps,
|
|||
const struct tu_sampler_ycbcr_conversion *conversion,
|
||||
VkFormat format,
|
||||
VkImageAspectFlagBits aspect_mask,
|
||||
bool limited_z24s8)
|
||||
bool has_z24uint_s8uint)
|
||||
{
|
||||
unsigned char swiz[4] = {
|
||||
A6XX_TEX_X, A6XX_TEX_Y, A6XX_TEX_Z, A6XX_TEX_W,
|
||||
|
|
@ -135,7 +135,7 @@ tu6_texswiz(const VkComponentMapping *comps,
|
|||
break;
|
||||
case VK_FORMAT_D24_UNORM_S8_UINT:
|
||||
if (aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
if (limited_z24s8) {
|
||||
if (!has_z24uint_s8uint) {
|
||||
/* using FMT6_8_8_8_8_UINT */
|
||||
swiz[0] = A6XX_TEX_W;
|
||||
swiz[1] = A6XX_TEX_ZERO;
|
||||
|
|
@ -193,7 +193,7 @@ tu_cs_image_flag_ref(struct tu_cs *cs, const struct tu_image_view *iview, uint32
|
|||
void
|
||||
tu_image_view_init(struct tu_image_view *iview,
|
||||
const VkImageViewCreateInfo *pCreateInfo,
|
||||
bool limited_z24s8)
|
||||
bool has_z24uint_s8uint)
|
||||
{
|
||||
TU_FROM_HANDLE(tu_image, image, pCreateInfo->image);
|
||||
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
|
||||
|
|
@ -260,7 +260,7 @@ tu_image_view_init(struct tu_image_view *iview,
|
|||
if (aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT)
|
||||
fmt_tex = FMT6_Z24_UNORM_S8_UINT;
|
||||
if (aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT)
|
||||
fmt_tex = limited_z24s8 ? FMT6_8_8_8_8_UINT : FMT6_Z24_UINT_S8_UINT;
|
||||
fmt_tex = has_z24uint_s8uint ? FMT6_Z24_UINT_S8_UINT : FMT6_8_8_8_8_UINT;
|
||||
/* TODO: also use this format with storage descriptor ? */
|
||||
}
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ tu_image_view_init(struct tu_image_view *iview,
|
|||
A6XX_TEX_CONST_0_FMT(fmt_tex) |
|
||||
A6XX_TEX_CONST_0_SAMPLES(tu_msaa_samples(layout->nr_samples)) |
|
||||
A6XX_TEX_CONST_0_SWAP(fmt.swap) |
|
||||
tu6_texswiz(&pCreateInfo->components, conversion, format, aspect_mask, limited_z24s8) |
|
||||
tu6_texswiz(&pCreateInfo->components, conversion, format, aspect_mask, has_z24uint_s8uint) |
|
||||
A6XX_TEX_CONST_0_MIPLVLS(tu_get_levelCount(image, range) - 1);
|
||||
iview->descriptor[1] = A6XX_TEX_CONST_1_WIDTH(width) | A6XX_TEX_CONST_1_HEIGHT(height);
|
||||
iview->descriptor[2] =
|
||||
|
|
@ -447,7 +447,7 @@ tu_image_view_init(struct tu_image_view *iview,
|
|||
}
|
||||
|
||||
bool
|
||||
ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, bool limited_z24s8)
|
||||
ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, bool has_z24uint_s8uint)
|
||||
{
|
||||
/* no UBWC with compressed formats, E5B9G9R9, S8_UINT
|
||||
* (S8_UINT because separate stencil doesn't have UBWC-enable bit)
|
||||
|
|
@ -485,7 +485,7 @@ ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, bool l
|
|||
* 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 (limited_z24s8 &&
|
||||
if (!has_z24uint_s8uint &&
|
||||
format == VK_FORMAT_D24_UNORM_S8_UINT &&
|
||||
(usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)))
|
||||
return false;
|
||||
|
|
@ -595,7 +595,7 @@ tu_CreateImage(VkDevice _device,
|
|||
}
|
||||
|
||||
if (!ubwc_possible(image->vk_format, pCreateInfo->imageType, pCreateInfo->usage,
|
||||
device->physical_device->limited_z24s8))
|
||||
device->physical_device->info.a6xx.has_z24uint_s8uint))
|
||||
ubwc_enabled = false;
|
||||
|
||||
/* expect UBWC enabled if we asked for it */
|
||||
|
|
@ -791,7 +791,7 @@ tu_CreateImageView(VkDevice _device,
|
|||
if (view == NULL)
|
||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
tu_image_view_init(view, pCreateInfo, device->physical_device->limited_z24s8);
|
||||
tu_image_view_init(view, pCreateInfo, device->physical_device->info.a6xx.has_z24uint_s8uint);
|
||||
|
||||
*pView = tu_image_view_to_handle(view);
|
||||
|
||||
|
|
|
|||
|
|
@ -204,8 +204,6 @@ struct tu_physical_device
|
|||
int msm_major_version;
|
||||
int msm_minor_version;
|
||||
|
||||
bool limited_z24s8;
|
||||
|
||||
/* This is the drivers on-disk cache used as a fallback as opposed to
|
||||
* the pipeline cache defined by apps.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue