isl: add ability to store buffer size in unused RENDER_SURFACE_STATE fields

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23318>
This commit is contained in:
Lionel Landwerlin 2023-05-30 14:33:05 +03:00 committed by Marge Bot
parent d099e47de0
commit f1f58c3bea
3 changed files with 24 additions and 0 deletions

View file

@ -289,6 +289,7 @@ isl_device_init(struct isl_device *dev,
dev->info = info;
dev->use_separate_stencil = ISL_GFX_VER(dev) >= 6;
dev->has_bit6_swizzling = info->has_bit6_swizzle;
dev->buffer_length_in_aux_addr = false;
/* The ISL_DEV macros may be defined in the CFLAGS, thus hardcoding some
* device properties at buildtime. Verify that the macros with the device

View file

@ -1301,6 +1301,18 @@ struct isl_device {
uint32_t protected_mask;
} mocs;
/* Options to configure by the driver: */
/**
* Write buffer length in the upper dword of the
* RENDER_SURFACE_STATE::AuxilliarySurfaceBaseAddress field.
*
* This field is unused for buffer surfaces so we can reuse it store the
* buffer length. This is useful when you want to load a vec4 with (main
* address, size).
*/
bool buffer_length_in_aux_addr;
void (*surf_fill_state_s)(const struct isl_device *dev, void *state,
const struct isl_surf_fill_state_info *restrict info);

View file

@ -968,6 +968,17 @@ isl_genX(buffer_fill_state_s)(const struct isl_device *dev, void *state,
s.MOCS = info->mocs;
#endif
#if GFX_VER >= 9
/* Store the buffer size in the upper dword of the AUX surface base
* address. Only enabled on Gfx9+ since Gfx8 has an Atom version with only
* 32bits of address space.
*/
if (dev->buffer_length_in_aux_addr)
s.AuxiliarySurfaceBaseAddress = info->size_B << 32;
#else
assert(!dev->buffer_length_in_aux_addr);
#endif
#if GFX_VERx10 >= 125
/* Setting L1 caching policy to Write-back mode. */
s.L1CacheControl = L1CC_WB;