Commit 56d70ba6 authored by Jason Ekstrand's avatar Jason Ekstrand Committed by Marge Bot
Browse files

intel/dev: Put the device name in intel_device_info


Reviewed-by: Caio Oliveira's avatarCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <mesa/mesa!11861>
parent c24ba6ce
......@@ -127,14 +127,10 @@ static const char *
crocus_get_name(struct pipe_screen *pscreen)
{
struct crocus_screen *screen = (struct crocus_screen *)pscreen;
const struct intel_device_info *devinfo = &screen->devinfo;
static char buf[128];
const char *name = intel_get_device_name(screen->pci_id);
if (!name)
name = "Intel Unknown";
snprintf(buf, sizeof(buf), "Mesa %s", name);
snprintf(buf, sizeof(buf), "Mesa %s", devinfo->name);
return buf;
}
......
......@@ -144,13 +144,10 @@ static const char *
iris_get_name(struct pipe_screen *pscreen)
{
struct iris_screen *screen = (struct iris_screen *)pscreen;
const struct intel_device_info *devinfo = &screen->devinfo;
static char buf[128];
const char *name = intel_get_device_name(screen->pci_id);
if (!name)
name = "Intel Unknown";
snprintf(buf, sizeof(buf), "Mesa %s", name);
snprintf(buf, sizeof(buf), "Mesa %s", devinfo->name);
return buf;
}
......
......@@ -72,7 +72,7 @@ main(int argc, char *argv[])
fprintf(stdout, "%s:\n", path);
fprintf(stdout, " name: %s\n", intel_get_device_name(devinfo.chipset_id));
fprintf(stdout, " name: %s\n", devinfo.name);
fprintf(stdout, " gen: %u\n", devinfo.ver);
fprintf(stdout, " PCI id: 0x%x\n", devinfo.chipset_id);
fprintf(stdout, " revision: %u\n", devinfo.revision);
......
......@@ -1249,6 +1249,21 @@ intel_get_device_info_from_pci_id(int pci_id,
return false;
}
switch (pci_id) {
#undef CHIPSET
#define CHIPSET(_id, _family, _fam_str, _name) \
case _id: \
/* sizeof(str_literal) includes the null */ \
STATIC_ASSERT(sizeof(_name) + sizeof(_fam_str) + 2 <= \
sizeof(devinfo->name)); \
strncpy(devinfo->name, _name " (" _fam_str ")", sizeof(devinfo->name)); \
break;
#include "pci_ids/i965_pci_ids.h"
#include "pci_ids/iris_pci_ids.h"
default:
strncpy(devinfo->name, "Intel Unknown", sizeof(devinfo->name));
}
fill_masks(devinfo);
/* From the Skylake PRM, 3DSTATE_PS::Scratch Space Base Pointer:
......@@ -1291,19 +1306,6 @@ intel_get_device_info_from_pci_id(int pci_id,
return true;
}
const char *
intel_get_device_name(int devid)
{
switch (devid) {
#undef CHIPSET
#define CHIPSET(id, family, fam_str, name) case id: return name " (" fam_str ")"; break;
#include "pci_ids/i965_pci_ids.h"
#include "pci_ids/iris_pci_ids.h"
default:
return NULL;
}
}
/**
* for gfx8/gfx9, SLICE_MASK/SUBSLICE_MASK can be used to compute the topology
* (kernel 4.13+)
......
......@@ -36,6 +36,7 @@ extern "C" {
struct drm_i915_query_topology_info;
#define INTEL_DEVICE_MAX_NAME_SIZE 64
#define INTEL_DEVICE_MAX_SLICES (6) /* Maximum on gfx10 */
#define INTEL_DEVICE_MAX_SUBSLICES (8) /* Maximum on gfx11 */
#define INTEL_DEVICE_MAX_EUS_PER_SUBSLICE (16) /* Maximum on gfx12 */
......@@ -278,6 +279,11 @@ struct intel_device_info
*/
uint32_t chipset_id;
/**
* holds the name of the device
*/
char name[INTEL_DEVICE_MAX_NAME_SIZE];
/**
* no_hw is true when the chipset_id pci device id has been overridden
*/
......@@ -345,7 +351,6 @@ intel_device_info_num_dual_subslices(UNUSED
}
int intel_device_name_to_pci_device_id(const char *name);
const char *intel_get_device_name(int devid);
static inline uint64_t
intel_device_info_timebase_scale(const struct intel_device_info *devinfo,
......
......@@ -122,7 +122,7 @@ aubinator_init(void *user_data, int aub_pci_id, const char *app_name)
fprintf(outfile, "Application name: %s\n", app_name);
fprintf(outfile, "Decoding as: %s\n", intel_get_device_name(pci_id));
fprintf(outfile, "Decoding as: %s\n", devinfo.name);
/* Throw in a new line before the first batch */
fprintf(outfile, "\n");
......
......@@ -1006,7 +1006,7 @@ display_aubfile_window(struct window *win)
ImGui::Text("Execbufs %u", context.file->n_execs);
ImGui::Text("PCI ID: 0x%x", context.file->pci_id);
ImGui::Text("Application name: %s", context.file->app_name);
ImGui::Text("%s", intel_get_device_name(context.file->pci_id));
ImGui::Text("%s", context.file->devinfo.name);
ImGui::SetNextWindowContentWidth(500);
if (ImGui::BeginPopupModal("Help", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
......
......@@ -741,8 +741,6 @@ anv_physical_device_try_create(struct anv_instance *instance,
goto fail_fd;
}
const char *device_name = intel_get_device_name(devinfo.chipset_id);
if (devinfo.is_haswell) {
mesa_logw("Haswell Vulkan support is incomplete");
} else if (devinfo.ver == 7 && !devinfo.is_baytrail) {
......@@ -753,7 +751,7 @@ anv_physical_device_try_create(struct anv_instance *instance,
/* Gfx8-12 fully supported */
} else {
result = vk_errorfi(instance, NULL, VK_ERROR_INCOMPATIBLE_DRIVER,
"Vulkan not yet supported on %s", device_name);
"Vulkan not yet supported on %s", devinfo.name);
goto fail_fd;
}
......@@ -782,7 +780,6 @@ anv_physical_device_try_create(struct anv_instance *instance,
snprintf(device->path, ARRAY_SIZE(device->path), "%s", path);
device->info = devinfo;
device->name = device_name;
device->no_hw = device->info.no_hw;
if (getenv("INTEL_NO_HW") != NULL)
......@@ -2042,7 +2039,7 @@ void anv_GetPhysicalDeviceProperties(
};
snprintf(pProperties->deviceName, sizeof(pProperties->deviceName),
"%s", pdevice->name);
"%s", pdevice->info.name);
memcpy(pProperties->pipelineCacheUUID,
pdevice->pipeline_cache_uuid, VK_UUID_SIZE);
}
......
......@@ -893,7 +893,6 @@ struct anv_physical_device {
struct anv_instance * instance;
bool no_hw;
char path[20];
const char * name;
struct {
uint16_t domain;
uint8_t bus;
......
......@@ -106,7 +106,7 @@ const char *
brw_get_renderer_string(const struct brw_screen *screen)
{
static char buf[128];
const char *name = intel_get_device_name(screen->deviceID);
const char *name = screen->devinfo.name;
if (!name)
name = "Intel Unknown";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment