diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index 6436f8ab5d1..62812083f30 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -1022,56 +1022,6 @@ panvk_GetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, } } -#define MAX_IMAGE_SIZE_PX (1 << 16) - -static VkExtent3D -get_max_2d_image_size(struct panvk_physical_device *phys_dev, VkFormat format) -{ - const unsigned arch = pan_arch(phys_dev->kmod.dev->props.gpu_id); - const uint64_t max_img_size_B = - arch <= 10 ? u_uintN_max(32) : u_uintN_max(48); - const enum pipe_format pfmt = vk_format_to_pipe_format(format); - const uint32_t fmt_blksize = util_format_get_blocksize(pfmt); - /* Evenly split blocks across all axis. */ - const uint32_t max_size_el = floor(sqrt(max_img_size_B / fmt_blksize)); - const VkExtent3D ret = { - .width = MIN2(max_size_el * util_format_get_blockwidth(pfmt), - MAX_IMAGE_SIZE_PX), - .height = MIN2(max_size_el * util_format_get_blockheight(pfmt), - MAX_IMAGE_SIZE_PX), - .depth = 1, - }; - - assert(ret.width >= phys_dev->vk.properties.maxImageDimension2D); - assert(ret.height >= phys_dev->vk.properties.maxImageDimension2D); - return ret; -} - -static VkExtent3D -get_max_3d_image_size(struct panvk_physical_device *phys_dev, VkFormat format) -{ - const unsigned arch = pan_arch(phys_dev->kmod.dev->props.gpu_id); - const uint64_t max_img_size_B = - arch <= 10 ? u_uintN_max(32) : u_uintN_max(48); - enum pipe_format pfmt = vk_format_to_pipe_format(format); - uint32_t fmt_blksize = util_format_get_blocksize(pfmt); - /* Evenly split blocks across each axis. */ - const uint32_t max_size_el = floor(cbrt(max_img_size_B / fmt_blksize)); - const VkExtent3D ret = { - .width = MIN2(max_size_el * util_format_get_blockwidth(pfmt), - MAX_IMAGE_SIZE_PX), - .height = MIN2(max_size_el * util_format_get_blockheight(pfmt), - MAX_IMAGE_SIZE_PX), - .depth = MIN2(max_size_el * util_format_get_blockdepth(pfmt), - MAX_IMAGE_SIZE_PX), - }; - - assert(ret.width >= phys_dev->vk.properties.maxImageDimension3D); - assert(ret.height >= phys_dev->vk.properties.maxImageDimension3D); - assert(ret.depth >= phys_dev->vk.properties.maxImageDimension3D); - return ret; -} - static VkResult get_image_format_properties(struct panvk_physical_device *physical_device, const VkPhysicalDeviceImageFormatInfo2 *info, @@ -1214,13 +1164,17 @@ get_image_format_properties(struct panvk_physical_device *physical_device, maxArraySize = 1 << 16; break; case VK_IMAGE_TYPE_2D: - maxExtent = get_max_2d_image_size(physical_device, info->format); - maxMipLevels = util_logbase2(maxExtent.width) + 1; + maxExtent.width = 1 << 16; + maxExtent.height = 1 << 16; + maxExtent.depth = 1; + maxMipLevels = 17; /* log2(maxWidth) + 1 */ maxArraySize = 1 << 16; break; case VK_IMAGE_TYPE_3D: - maxExtent = get_max_3d_image_size(physical_device, info->format); - maxMipLevels = util_logbase2(maxExtent.width) + 1; + maxExtent.width = 1 << 16; + maxExtent.height = 1 << 16; + maxExtent.depth = 1 << 16; + maxMipLevels = 17; /* log2(maxWidth) + 1 */ maxArraySize = 1; break; default: diff --git a/src/panfrost/vulkan/panvk_vX_physical_device.c b/src/panfrost/vulkan/panvk_vX_physical_device.c index d700a1ed9b2..99a2de05c79 100644 --- a/src/panfrost/vulkan/panvk_vX_physical_device.c +++ b/src/panfrost/vulkan/panvk_vX_physical_device.c @@ -735,19 +735,11 @@ panvk_per_arch(get_physical_device_properties)( .deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, /* Vulkan 1.0 limits */ - /* Maximum texture dimension is 2^16, but we're limited by the - * size/surface-stride fields. The size/surface_stride field is 32-bit - * on v10-, so let's take that as a reference for now. - * The following limits are chosen so we don't overflow these - * size/surface_stride fields. We choose them so they are a power-of-two, - * except for 2D/Cube dimensions where taking a power-of-two would be - * too limiting, so we pick power-of-two-minus-one, which makes things - * fit exactly in our 32-bit budget. - */ + /* Maximum texture dimension is 2^16. */ .maxImageDimension1D = (1 << 16), - .maxImageDimension2D = PAN_ARCH <= 10 ? (1 << 14) - 1 : (1 << 16), - .maxImageDimension3D = PAN_ARCH <= 10 ? (1 << 9) : (1 << 14), - .maxImageDimensionCube = PAN_ARCH <= 10 ? (1 << 14) - 1 : (1 << 16), + .maxImageDimension2D = (1 << 16), + .maxImageDimension3D = (1 << 16), + .maxImageDimensionCube = (1 << 16), .maxImageArrayLayers = (1 << 16), /* Pre-v11 is limited to 2^27 elements of 16 byte formats due to size fields of 32 bits. */