v3d,v3dv: stop hardcoding various image limits

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17509>
This commit is contained in:
Iago Toral Quiroga 2022-07-13 08:41:10 +02:00 committed by Marge Bot
parent 25fc388d7e
commit 9b74f4218f
6 changed files with 34 additions and 34 deletions

View File

@ -52,9 +52,6 @@
#define V3D_MAX_TEXTURE_SAMPLERS MAX2(V3D_VULKAN_MAX_TEXTURE_SAMPLERS, \
V3D_OPENGL_MAX_TEXTURE_SAMPLERS)
/* The HW can do 16384 (15), but we run into hangs when we expose that. */
#define V3D_MAX_MIP_LEVELS 13
#define V3D_MAX_SAMPLES 4
#define V3D_MAX_DRAW_BUFFERS 4
@ -70,4 +67,14 @@
/* Size of a cache line */
#define V3D_NON_COHERENT_ATOM_SIZE 256
#define V3D_MAX_IMAGE_DIMENSION 4096
/* The HW can do 16384 (15), but we run into hangs when we expose that. Also,
* since we are only exposing images up to 4096 pixels per dimension 13 is
* all we need.
*/
#define V3D_MAX_MIP_LEVELS 13
#define V3D_MAX_ARRAY_LAYERS 2048
#endif /* V3D_LIMITS_H */

View File

@ -970,17 +970,14 @@ cmd_buffer_begin_render_pass_secondary(
*
* "The application must ensure (using scissor if necessary) that all
* rendering is contained within the render area."
*
* FIXME: setup constants for the max framebuffer dimensions and use them
* here and when filling in VkPhysicalDeviceLimits.
*/
const struct v3dv_framebuffer *framebuffer = cmd_buffer->state.framebuffer;
cmd_buffer->state.render_area.offset.x = 0;
cmd_buffer->state.render_area.offset.y = 0;
cmd_buffer->state.render_area.extent.width =
framebuffer ? framebuffer->width : 4096;
framebuffer ? framebuffer->width : V3D_MAX_IMAGE_DIMENSION;
cmd_buffer->state.render_area.extent.height =
framebuffer ? framebuffer->height : 4096;
framebuffer ? framebuffer->height : V3D_MAX_IMAGE_DIMENSION;
return VK_SUCCESS;
}

View File

@ -1363,7 +1363,7 @@ v3dv_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
const uint32_t max_varying_components = 16 * 4;
const float v3d_point_line_granularity = 2.0f / (1 << V3D_COORD_SHIFT);
const uint32_t max_fb_size = 4096;
const uint32_t max_fb_size = V3D_MAX_IMAGE_DIMENSION;
const VkSampleCountFlags supported_sample_counts =
VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT;
@ -1375,11 +1375,11 @@ v3dv_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
/* FIXME: this will probably require an in-depth review */
VkPhysicalDeviceLimits limits = {
.maxImageDimension1D = 4096,
.maxImageDimension2D = 4096,
.maxImageDimension3D = 4096,
.maxImageDimensionCube = 4096,
.maxImageArrayLayers = 2048,
.maxImageDimension1D = V3D_MAX_IMAGE_DIMENSION,
.maxImageDimension2D = V3D_MAX_IMAGE_DIMENSION,
.maxImageDimension3D = V3D_MAX_IMAGE_DIMENSION,
.maxImageDimensionCube = V3D_MAX_IMAGE_DIMENSION,
.maxImageArrayLayers = V3D_MAX_ARRAY_LAYERS,
.maxTexelBufferElements = (1ul << 28),
.maxUniformBufferRange = V3D_MAX_BUFFER_RANGE,
.maxStorageBufferRange = V3D_MAX_BUFFER_RANGE,

View File

@ -437,31 +437,27 @@ get_image_format_properties(
}
}
/* FIXME: these are taken from VkPhysicalDeviceLimits, we should just put
* these limits available in the physical device and read them from there
* wherever we need them.
*/
switch (info->type) {
case VK_IMAGE_TYPE_1D:
pImageFormatProperties->maxExtent.width = 4096;
pImageFormatProperties->maxExtent.width = V3D_MAX_IMAGE_DIMENSION;
pImageFormatProperties->maxExtent.height = 1;
pImageFormatProperties->maxExtent.depth = 1;
pImageFormatProperties->maxArrayLayers = 2048;
pImageFormatProperties->maxMipLevels = 13; /* log2(maxWidth) + 1 */
pImageFormatProperties->maxArrayLayers = V3D_MAX_ARRAY_LAYERS;
pImageFormatProperties->maxMipLevels = V3D_MAX_MIP_LEVELS;
break;
case VK_IMAGE_TYPE_2D:
pImageFormatProperties->maxExtent.width = 4096;
pImageFormatProperties->maxExtent.height = 4096;
pImageFormatProperties->maxExtent.width = V3D_MAX_IMAGE_DIMENSION;
pImageFormatProperties->maxExtent.height = V3D_MAX_IMAGE_DIMENSION;
pImageFormatProperties->maxExtent.depth = 1;
pImageFormatProperties->maxArrayLayers = 2048;
pImageFormatProperties->maxMipLevels = 13; /* log2(maxWidth) + 1 */
pImageFormatProperties->maxArrayLayers = V3D_MAX_ARRAY_LAYERS;
pImageFormatProperties->maxMipLevels = V3D_MAX_MIP_LEVELS;
break;
case VK_IMAGE_TYPE_3D:
pImageFormatProperties->maxExtent.width = 4096;
pImageFormatProperties->maxExtent.height = 4096;
pImageFormatProperties->maxExtent.depth = 4096;
pImageFormatProperties->maxExtent.width = V3D_MAX_IMAGE_DIMENSION;
pImageFormatProperties->maxExtent.height = V3D_MAX_IMAGE_DIMENSION;
pImageFormatProperties->maxExtent.depth = V3D_MAX_IMAGE_DIMENSION;
pImageFormatProperties->maxArrayLayers = 1;
pImageFormatProperties->maxMipLevels = 13; /* log2(maxWidth) + 1 */
pImageFormatProperties->maxMipLevels = V3D_MAX_MIP_LEVELS;
break;
default:
unreachable("bad VkImageType");

View File

@ -1185,8 +1185,8 @@ v3dX(meta_emit_copy_buffer_to_image_rcl)(struct v3dv_job *job,
}
/* Figure out a TLB size configuration for a number of pixels to process.
* Beware that we can't "render" more than 4096x4096 pixels in a single job,
* if the pixel count is larger than this, the caller might need to split
* Beware that we can't "render" more than MAX_DIMxMAX_DIM pixels in a single
* job, if the pixel count is larger than this, the caller might need to split
* the job and call this function multiple times.
*/
static void
@ -1196,7 +1196,7 @@ framebuffer_size_for_pixel_count(uint32_t num_pixels,
{
assert(num_pixels > 0);
const uint32_t max_dim_pixels = 4096;
const uint32_t max_dim_pixels = V3D_MAX_IMAGE_DIMENSION;
const uint32_t max_pixels = max_dim_pixels * max_dim_pixels;
uint32_t w, h;

View File

@ -243,7 +243,7 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
else if (screen->nonmsaa_texture_size_limit)
return 7680;
else
return 4096;
return V3D_MAX_IMAGE_DIMENSION;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
if (screen->devinfo.ver < 40)
@ -251,7 +251,7 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
else
return V3D_MAX_MIP_LEVELS;
case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
return 2048;
return V3D_MAX_ARRAY_LAYERS;
/* Render targets. */
case PIPE_CAP_MAX_RENDER_TARGETS: