diff --git a/src/broadcom/common/v3d_limits.h b/src/broadcom/common/v3d_limits.h index 38993fb60bf..7a35b9a0b6d 100644 --- a/src/broadcom/common/v3d_limits.h +++ b/src/broadcom/common/v3d_limits.h @@ -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 */ diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index e0ad7d917b1..f390a3787a3 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -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; } diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index 5e7907fd44f..10f36ca7031 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -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, diff --git a/src/broadcom/vulkan/v3dv_formats.c b/src/broadcom/vulkan/v3dv_formats.c index 401d233da26..3019ca5fdef 100644 --- a/src/broadcom/vulkan/v3dv_formats.c +++ b/src/broadcom/vulkan/v3dv_formats.c @@ -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"); diff --git a/src/broadcom/vulkan/v3dvx_meta_common.c b/src/broadcom/vulkan/v3dvx_meta_common.c index 2a0d8acebf1..4e685635ed0 100644 --- a/src/broadcom/vulkan/v3dvx_meta_common.c +++ b/src/broadcom/vulkan/v3dvx_meta_common.c @@ -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; diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index a93879d1583..0c74d8e8a86 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -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: