ac/gpu_info: add the /dev/dri/ filename into radeon_info

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24759>
This commit is contained in:
Marek Olšák
2023-07-27 12:46:47 -04:00
committed by Marge Bot
parent 1ac379c4a0
commit b02b43eef1
2 changed files with 11 additions and 0 deletions

View File

@@ -324,10 +324,15 @@ static const char *amdgpu_get_marketing_name(amdgpu_device_handle dev)
{
return NULL;
}
static intptr_t readlink(const char *path, char *buf, size_t bufsiz)
{
return -1;
}
#else
#include "drm-uapi/amdgpu_drm.h"
#include <amdgpu.h>
#include <xf86drm.h>
#include <unistd.h>
#endif
#define CIK_TILE_MODE_COLOR_2D 14
@@ -820,6 +825,10 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info)
for (unsigned i = 0; info->name[i] && i < ARRAY_SIZE(info->lowercase_name) - 1; i++)
info->lowercase_name[i] = tolower(info->name[i]);
char proc_fd[64];
snprintf(proc_fd, sizeof(proc_fd), "/proc/self/fd/%u", fd);
UNUSED int _result = readlink(proc_fd, info->dev_filename, sizeof(info->dev_filename));
if (info->ip[AMD_IP_GFX].ver_major == 11)
info->gfx_level = GFX11;
else if (info->ip[AMD_IP_GFX].ver_major == 10 && info->ip[AMD_IP_GFX].ver_minor == 3)
@@ -1593,6 +1602,7 @@ void ac_print_gpu_info(const struct radeon_info *info, FILE *f)
fprintf(f, "Device info:\n");
fprintf(f, " name = %s\n", info->name);
fprintf(f, " marketing_name = %s\n", info->marketing_name);
fprintf(f, " dev_filename = %s\n", info->dev_filename);
fprintf(f, " num_se = %i\n", info->num_se);
fprintf(f, " num_rb = %i\n", info->num_rb);
fprintf(f, " num_cu = %i\n", info->num_cu);

View File

@@ -32,6 +32,7 @@ struct radeon_info {
const char *name;
char lowercase_name[32];
const char *marketing_name;
char dev_filename[32];
uint32_t num_se; /* only enabled SEs */
uint32_t num_rb; /* only enabled RBs */
uint32_t num_cu; /* only enabled CUs */