ac/gpu_info: Add has_pcie_bandwidth_info.
authorTimur Kristóf <timur.kristof@gmail.com>
Mon, 23 Jan 2023 16:11:36 +0000 (17:11 +0100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 2 Feb 2023 02:13:10 +0000 (02:13 +0000)
This is so that we can tell whether the current kernel
has the PCIe bandwidth info available or not.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20842>

src/amd/common/ac_gpu_info.c
src/amd/common/ac_gpu_info.h

index 5766bcd..14bd478 100644 (file)
@@ -1355,8 +1355,9 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info)
    info->num_rb = util_bitcount(info->enabled_rb_mask);
    info->max_gflops = (info->gfx_level >= GFX11 ? 256 : 128) * info->num_cu * info->max_gpu_freq_mhz / 1000;
    info->memory_bandwidth_gbps = DIV_ROUND_UP(info->memory_freq_mhz_effective * info->memory_bus_width / 8, 1000);
+   info->has_pcie_bandwidth_info = info->drm_minor >= 51;
 
-   if (info->drm_minor >= 51) {
+   if (info->has_pcie_bandwidth_info) {
       info->pcie_gen = device_info.pcie_gen;
       info->pcie_num_lanes = device_info.pcie_num_lanes;
 
index 87aa7da..76aa6b2 100644 (file)
@@ -200,6 +200,7 @@ struct radeon_info {
    bool has_sparse_vm_mappings;
    bool has_scheduled_fence_dependency;
    bool has_gang_submit;
+   bool has_pcie_bandwidth_info;
    bool has_stable_pstate;
    /* Whether SR-IOV is enabled or amdgpu.mcbp=1 was set on the kernel command line. */
    bool mid_command_buffer_preemption_enabled;