intel/isl: Add a max_buffer_size limit to isl_device

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>
This commit is contained in:
Jason Ekstrand 2021-09-07 10:28:41 -05:00 committed by Marge Bot
parent 9edbd13f81
commit 231653ea35
4 changed files with 23 additions and 16 deletions

View File

@ -265,6 +265,21 @@ isl_device_init(struct isl_device *dev,
dev->ds.hiz_offset = 0;
}
if (ISL_GFX_VER(dev) >= 7) {
/* From the IVB PRM, SURFACE_STATE::Height,
*
* For typed buffer and structured buffer surfaces, the number
* of entries in the buffer ranges from 1 to 2^27. For raw buffer
* surfaces, the number of entries in the buffer is the number of bytes
* which can range from 1 to 2^30.
*
* This limit is only concerned with raw buffers.
*/
dev->max_buffer_size = 1ull << 30;
} else {
dev->max_buffer_size = 1ull << 27;
}
isl_device_setup_mocs(dev);
}

View File

@ -1255,6 +1255,8 @@ struct isl_device {
uint8_t clear_value_offset;
} ss;
uint64_t max_buffer_size;
/**
* Describes the layout of the depth/stencil/hiz commands as emitted by
* isl_emit_depth_stencil_hiz.

View File

@ -875,21 +875,15 @@ isl_genX(buffer_fill_state_s)(const struct isl_device *dev, void *state,
uint32_t num_elements = buffer_size / info->stride_B;
if (GFX_VER >= 7) {
assert(num_elements > 0);
if (info->format == ISL_FORMAT_RAW) {
assert(num_elements <= dev->max_buffer_size);
} else {
/* From the IVB PRM, SURFACE_STATE::Height,
*
* For typed buffer and structured buffer surfaces, the number
* of entries in the buffer ranges from 1 to 2^27. For raw buffer
* surfaces, the number of entries in the buffer is the number of bytes
* which can range from 1 to 2^30.
* of entries in the buffer ranges from 1 to 2^27.
*/
if (info->format == ISL_FORMAT_RAW) {
assert(num_elements <= (1ull << 30));
assert(num_elements > 0);
} else {
assert(num_elements <= (1ull << 27));
}
} else {
assert(num_elements <= (1ull << 27));
}

View File

@ -1775,10 +1775,6 @@ void anv_GetPhysicalDeviceProperties(
ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice);
const struct intel_device_info *devinfo = &pdevice->info;
/* See assertions made when programming the buffer surface state. */
const uint32_t max_raw_buffer_sz = devinfo->ver >= 7 ?
(1ul << 30) : (1ul << 27);
const uint32_t max_ssbos = pdevice->has_a64_buffer_access ? UINT16_MAX : 64;
const uint32_t max_textures =
pdevice->has_bindless_images ? UINT16_MAX : 128;
@ -1809,7 +1805,7 @@ void anv_GetPhysicalDeviceProperties(
.maxImageArrayLayers = (1 << 11),
.maxTexelBufferElements = 128 * 1024 * 1024,
.maxUniformBufferRange = (1ul << 27),
.maxStorageBufferRange = max_raw_buffer_sz,
.maxStorageBufferRange = pdevice->isl_dev.max_buffer_size,
.maxPushConstantsSize = MAX_PUSH_CONSTANTS_SIZE,
.maxMemoryAllocationCount = UINT32_MAX,
.maxSamplerAllocationCount = 64 * 1024,