From 9a7b785b60155632a678933b6bf552e8b6f537a8 Mon Sep 17 00:00:00 2001 From: Icenowy Zheng Date: Thu, 14 May 2026 01:35:08 +0800 Subject: [PATCH] pvr: implement GetRenderingAreaGranularity As the implementation of GetRenderAreaGranularity does not reference the render pass object, just move it to a new function and use it for both functions. Signed-off-by: Icenowy Zheng Reviewed-by: Luigi Santivetti Reviewed-by: Frank Binns Part-of: --- src/imagination/vulkan/pvr_arch_cmd_buffer.c | 9 +++++++++ src/imagination/vulkan/pvr_arch_pass.c | 11 +---------- src/imagination/vulkan/pvr_physical_device.h | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/imagination/vulkan/pvr_arch_cmd_buffer.c b/src/imagination/vulkan/pvr_arch_cmd_buffer.c index cbc7610d143..49db9169839 100644 --- a/src/imagination/vulkan/pvr_arch_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_arch_cmd_buffer.c @@ -9929,3 +9929,12 @@ VkResult PVR_PER_ARCH(EndCommandBuffer)(VkCommandBuffer commandBuffer) return vk_command_buffer_end(&cmd_buffer->vk); } + +void PVR_PER_ARCH(GetRenderingAreaGranularity)( + VkDevice _device, + const VkRenderingAreaInfoKHR *pRenderingAreaInfo, + VkExtent2D *pGranularity) +{ + VK_FROM_HANDLE(pvr_device, device, _device); + pvr_get_render_area_granularity(device->pdevice, pGranularity); +} diff --git a/src/imagination/vulkan/pvr_arch_pass.c b/src/imagination/vulkan/pvr_arch_pass.c index 0b65de844f7..f0ababe7f50 100644 --- a/src/imagination/vulkan/pvr_arch_pass.c +++ b/src/imagination/vulkan/pvr_arch_pass.c @@ -1107,14 +1107,5 @@ void PVR_PER_ARCH(GetRenderAreaGranularity)(VkDevice _device, VkExtent2D *pGranularity) { VK_FROM_HANDLE(pvr_device, device, _device); - const struct pvr_device_info *dev_info = &device->pdevice->dev_info; - - /* Granularity does not depend on any settings in the render pass, so return - * the tile granularity. - * - * The default value is based on the minimum value found in all existing - * cores. - */ - pGranularity->width = PVR_GET_FEATURE_VALUE(dev_info, tile_size_x, 16); - pGranularity->height = PVR_GET_FEATURE_VALUE(dev_info, tile_size_y, 16); + pvr_get_render_area_granularity(device->pdevice, pGranularity); } diff --git a/src/imagination/vulkan/pvr_physical_device.h b/src/imagination/vulkan/pvr_physical_device.h index c6ce0556463..a0be5850985 100644 --- a/src/imagination/vulkan/pvr_physical_device.h +++ b/src/imagination/vulkan/pvr_physical_device.h @@ -74,6 +74,22 @@ VK_DEFINE_HANDLE_CASTS(pvr_physical_device, VkPhysicalDevice, VK_OBJECT_TYPE_PHYSICAL_DEVICE) +static void +pvr_get_render_area_granularity(struct pvr_physical_device *pdevice, + VkExtent2D *granularity) +{ + const struct pvr_device_info *dev_info = &pdevice->dev_info; + + /* Granularity does not depend on any settings in the render pass, so return + * the tile granularity. + * + * The default value is based on the minimum value found in all existing + * cores. + */ + granularity->width = PVR_GET_FEATURE_VALUE(dev_info, tile_size_x, 16); + granularity->height = PVR_GET_FEATURE_VALUE(dev_info, tile_size_y, 16); +} + VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice, struct pvr_instance *instance, drmDevicePtr drm_render_device,