aboutsummaryrefslogtreecommitdiffstats
path: root/intel
diff options
context:
space:
mode:
authorNeil Roberts2015-11-09 09:27:52 -0600
committerMatt Turner2016-11-14 12:40:58 -0600
commit319108f9475f0165c9b4885efc8cf3b7e042b7fb (patch)
tree169ef1625b77f8a882c867aa1fd6e0843789f5e0 /intel
parent670f1e4fdadc197599cdc61d3104f8c27234765e (diff)
downloadexternal-libdrm-319108f9475f0165c9b4885efc8cf3b7e042b7fb.tar.gz
external-libdrm-319108f9475f0165c9b4885efc8cf3b7e042b7fb.tar.xz
external-libdrm-319108f9475f0165c9b4885efc8cf3b7e042b7fb.zip
intel: Allow some codenames in INTEL_DEVID_OVERRIDE
As well as allowing a hexadecimal PCI ID number, the INTEL_DEVID_OVERRIDE environment variable can now contain one of a few short codenames. The codenames are stored in a small table to map them to a corresponding PCI ID. This makes it easier to use without having to look up the PCI IDs manually. The PCI IDs used are the same as those chosen for the -p option of run.c in shader-db but SKL has been added as well. Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'intel')
-rw-r--r--intel/intel_bufmgr_gem.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 1792796c..15c79b3f 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -3060,6 +3060,34 @@ drm_intel_bufmgr_gem_set_vma_cache_size(drm_intel_bufmgr *bufmgr, int limit)
3060 drm_intel_gem_bo_purge_vma_cache(bufmgr_gem); 3060 drm_intel_gem_bo_purge_vma_cache(bufmgr_gem);
3061} 3061}
3062 3062
3063static int
3064parse_devid_override(const char *devid_override)
3065{
3066 static const struct {
3067 const char *name;
3068 int pci_id;
3069 } name_map[] = {
3070 { "brw", PCI_CHIP_I965_GM },
3071 { "g4x", PCI_CHIP_GM45_GM },
3072 { "ilk", PCI_CHIP_ILD_G },
3073 { "snb", PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS },
3074 { "ivb", PCI_CHIP_IVYBRIDGE_S_GT2 },
3075 { "hsw", PCI_CHIP_HASWELL_CRW_E_GT3 },
3076 { "byt", PCI_CHIP_VALLEYVIEW_3 },
3077 { "bdw", 0x1620 | BDW_ULX },
3078 { "skl", PCI_CHIP_SKYLAKE_DT_GT2 },
3079 { "kbl", PCI_CHIP_KABYLAKE_DT_GT2 },
3080 };
3081 unsigned int i;
3082
3083 for (i = 0; i < ARRAY_SIZE(name_map); i++) {
3084 if (!strcmp(name_map[i].name, devid_override))
3085 return name_map[i].pci_id;
3086 }
3087
3088 return strtod(devid_override, NULL);
3089}
3090
3063/** 3091/**
3064 * Get the PCI ID for the device. This can be overridden by setting the 3092 * Get the PCI ID for the device. This can be overridden by setting the
3065 * INTEL_DEVID_OVERRIDE environment variable to the desired ID. 3093 * INTEL_DEVID_OVERRIDE environment variable to the desired ID.
@@ -3076,7 +3104,7 @@ get_pci_device_id(drm_intel_bufmgr_gem *bufmgr_gem)
3076 devid_override = getenv("INTEL_DEVID_OVERRIDE"); 3104 devid_override = getenv("INTEL_DEVID_OVERRIDE");
3077 if (devid_override) { 3105 if (devid_override) {
3078 bufmgr_gem->no_exec = true; 3106 bufmgr_gem->no_exec = true;
3079 return strtod(devid_override, NULL); 3107 return parse_devid_override(devid_override);
3080 } 3108 }
3081 } 3109 }
3082 3110