intel/dev: Port intel_dev_info tool to Xe KMD

Only hwconfig was calling i915 specifc function, so it was only
necessary split the function that fetches it from backends and call it
from intel_get_and_print_hwconfig_table() depending on the KMD loaded.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23905>
This commit is contained in:
José Roberto de Souza 2023-06-22 17:36:49 -07:00 committed by Marge Bot
parent 56e0aff530
commit 1174e7412e
7 changed files with 42 additions and 10 deletions

View file

@ -534,12 +534,18 @@ fixup_chv_device_info(struct intel_device_info *devinfo)
memcpy(needle, bsw_model, 3);
}
void *
intel_device_info_i915_query_hwconfig(int fd, int32_t *len)
{
return intel_i915_query_alloc(fd, DRM_I915_QUERY_HWCONFIG_BLOB, len);
}
bool intel_device_info_i915_get_info_from_fd(int fd, struct intel_device_info *devinfo)
{
void *hwconfig_blob;
int32_t len;
hwconfig_blob = intel_i915_query_alloc(fd, DRM_I915_QUERY_HWCONFIG_BLOB, &len);
hwconfig_blob = intel_device_info_i915_query_hwconfig(fd, &len);
if (hwconfig_blob) {
if (intel_hwconfig_process_table(devinfo, hwconfig_blob, len))
intel_device_info_update_after_hwconfig(devinfo);

View file

@ -39,3 +39,6 @@ intel_device_info_i915_update_from_masks(struct intel_device_info *devinfo,
uint32_t slice_mask,
uint32_t subslice_mask,
uint32_t n_eus);
void *
intel_device_info_i915_query_hwconfig(int fd, int32_t *len);

View file

@ -260,7 +260,7 @@ main(int argc, char *argv[])
print_base_devinfo(&devinfo);
print_regions_info(&devinfo);
if (print_hwconfig)
intel_get_and_print_hwconfig_table(fd);
intel_get_and_print_hwconfig_table(fd, &devinfo);
if (print_workarounds)
print_wa_info(&devinfo);
}

View file

@ -24,11 +24,12 @@
#include <stdio.h>
#include <stdlib.h>
#include "drm-uapi/i915_drm.h"
#include "intel_device_info.h"
#include "intel_hwconfig.h"
#include "intel_hwconfig_types.h"
#include "intel/common/intel_gem.h"
#include "i915/intel_device_info.h"
#include "xe/intel_device_info.h"
#include "util/log.h"
@ -298,12 +299,23 @@ intel_print_hwconfig_table(const struct hwconfig *hwconfig,
}
void
intel_get_and_print_hwconfig_table(int fd)
intel_get_and_print_hwconfig_table(int fd, struct intel_device_info *devinfo)
{
struct hwconfig *hwconfig;
int32_t hwconfig_len = 0;
hwconfig = intel_i915_query_alloc(fd, DRM_I915_QUERY_HWCONFIG_BLOB,
&hwconfig_len);
switch (devinfo->kmd_type) {
case INTEL_KMD_TYPE_I915:
hwconfig = intel_device_info_i915_query_hwconfig(fd, &hwconfig_len);
break;
case INTEL_KMD_TYPE_XE:
hwconfig = intel_device_info_xe_query_hwconfig(fd, &hwconfig_len);
break;
default:
unreachable("unknown kmd type");
break;
}
if (hwconfig) {
intel_print_hwconfig_table(hwconfig, hwconfig_len);
free(hwconfig);

View file

@ -38,7 +38,7 @@ bool
intel_hwconfig_process_table(struct intel_device_info *devinfo, void *data,
int32_t len);
void
intel_get_and_print_hwconfig_table(int fd);
intel_get_and_print_hwconfig_table(int fd, struct intel_device_info *devinfo);
#ifdef __cplusplus
}

View file

@ -146,11 +146,18 @@ xe_query_gts(int fd, struct intel_device_info *devinfo)
return true;
}
void *
intel_device_info_xe_query_hwconfig(int fd, int32_t *len)
{
return xe_query_alloc_fetch(fd, DRM_XE_DEVICE_QUERY_HWCONFIG, len);
}
static bool
xe_query_hwconfig(int fd, struct intel_device_info *devinfo)
xe_query_process_hwconfig(int fd, struct intel_device_info *devinfo)
{
int32_t len;
void *data = xe_query_alloc_fetch(fd, DRM_XE_DEVICE_QUERY_HWCONFIG, &len);
void *data = intel_device_info_xe_query_hwconfig(fd, &len);
if (!data)
return false;
@ -306,7 +313,7 @@ intel_device_info_xe_get_info_from_fd(int fd, struct intel_device_info *devinfo)
if (!xe_query_gts(fd, devinfo))
return false;
if (xe_query_hwconfig(fd, devinfo))
if (xe_query_process_hwconfig(fd, devinfo))
intel_device_info_update_after_hwconfig(devinfo);
if (!xe_query_topology(fd, devinfo))

View file

@ -24,6 +24,7 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
struct intel_device_info;
@ -33,3 +34,6 @@ intel_device_info_xe_get_info_from_fd(int fd,
bool
intel_device_info_xe_query_regions(int fd, struct intel_device_info *devinfo,
bool update);
void *
intel_device_info_xe_query_hwconfig(int fd, int32_t *len);