pvr: limit availability of HW defs

To be able to support multiple GPU architectures, we need to thread
carefully with HW defs. So let's limit the availability of the HW defs
to where it's needed. We do this by moving the HW def includes and
helpers to query them to end of the source-files.

In the long run, we probably want something a bit more formal to get
access to HW-dependent values based on the hw-info. But there's some
work in progress to change how that works, so let's kick the can down
the road a bit on that part.

Reviewed-by: Ashish Chauhan <ashish.chauhan@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38423>
This commit is contained in:
Erik Faye-Lund 2025-11-13 12:18:41 +01:00 committed by Marge Bot
parent b8721b7436
commit c3170d11ac
2 changed files with 26 additions and 8 deletions

View file

@ -29,7 +29,6 @@
#include <string.h>
#include "pvr_buffer.h"
#include "pvr_csb.h"
#include "pvr_device.h"
#include "pvr_device_info.h"
#include "pvr_entrypoints.h"
@ -155,11 +154,7 @@ static void pvr_image_setup_mip_levels(struct pvr_image *image)
}
static unsigned
get_pbe_stride_align(const struct pvr_device_info *dev_info)
{
return PVR_HAS_FEATURE(dev_info, pbe_stride_align_1pixel) ?
1 : ROGUE_PBESTATE_REG_WORD0_LINESTRIDE_UNIT_SIZE;
}
get_pbe_stride_align(const struct pvr_device_info *dev_info);
VkResult pvr_CreateImage(VkDevice _device,
const VkImageCreateInfo *pCreateInfo,
@ -587,3 +582,13 @@ void pvr_DestroyBufferView(VkDevice _device,
vk_buffer_view_destroy(&device->vk, pAllocator, &bview->vk);
}
/* Leave this at the very end, to avoid leakage of HW-defs here */
#include "pvr_csb.h"
static unsigned
get_pbe_stride_align(const struct pvr_device_info *dev_info)
{
return PVR_HAS_FEATURE(dev_info, pbe_stride_align_1pixel) ?
1 : ROGUE_PBESTATE_REG_WORD0_LINESTRIDE_UNIT_SIZE;
}

View file

@ -27,7 +27,6 @@
#include "pco/pco.h"
#include "pco_uscgen_programs.h"
#include "pvr_border.h"
#include "pvr_device.h"
#include "pvr_dump_info.h"
#include "pvr_entrypoints.h"
@ -477,6 +476,9 @@ static uint32_t get_api_version(void)
return VK_MAKE_API_VERSION(0, 1, 2, VK_HEADER_VERSION);
}
static unsigned
get_custom_border_color_samplers(const struct pvr_device_info *dev_info);
static bool pvr_physical_device_get_properties(
const struct pvr_physical_device *const pdevice,
struct vk_properties *const properties)
@ -798,7 +800,8 @@ static bool pvr_physical_device_get_properties(
.supportsNonZeroFirstInstance = true,
/* VK_EXT_custom_border_color */
.maxCustomBorderColorSamplers = PVR_BORDER_COLOR_TABLE_NR_CUSTOM_ENTRIES,
.maxCustomBorderColorSamplers =
get_custom_border_color_samplers(&pdevice->dev_info),
/* VkPhysicalDeviceDrmPropertiesEXT */
.drmHasPrimary = true,
@ -1190,3 +1193,13 @@ void pvr_DestroyDevice(VkDevice _device,
pvr_destroy_device(device, pAllocator);
}
/* Leave this at the very end, to avoid leakage of HW-defs here */
#include "pvr_border.h"
static unsigned
get_custom_border_color_samplers(const struct pvr_device_info *dev_info)
{
assert(dev_info->ident.arch == PVR_DEVICE_ARCH_ROGUE);
return PVR_BORDER_COLOR_TABLE_NR_CUSTOM_ENTRIES;
}