Path: blob/21.2-virgl/src/gallium/targets/d3dadapter9/description.c
4565 views
/*1* Copyright 2015 Patrick Rudolph <[email protected]>2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* on the rights to use, copy, modify, merge, publish, distribute, sub7* license, and/or sell copies of the Software, and to permit persons to whom8* the Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL17* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE20* USE OR OTHER DEALINGS IN THE SOFTWARE. */2122#include <stdio.h>23#include <string.h>24#include "adapter9.h"2526#define DBG_CHANNEL DBG_ADAPTER2728/* prototypes */29void30d3d_match_vendor_id( D3DADAPTER_IDENTIFIER9* drvid,31unsigned fallback_ven,32unsigned fallback_dev,33const char* fallback_name );34void d3d_fill_driver_version(D3DADAPTER_IDENTIFIER9* drvid);35void d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid);3637enum d3d_vendor_id38{39HW_VENDOR_SOFTWARE = 0x0000,40HW_VENDOR_AMD = 0x1002,41HW_VENDOR_NVIDIA = 0x10de,42HW_VENDOR_VMWARE = 0x15ad,43HW_VENDOR_INTEL = 0x8086,44};4546struct card_lookup_table {47const char *mesaname;48const char *d3d9name;49}50cards_amd[] = {51{"HAWAII", "AMD Radeon R9 290"},52{"KAVERI", "AMD Radeon(TM) R7 Graphics"},53{"KABINI", "AMD Radeon HD 8400 / R3 Series"},54{"BONAIRE", "AMD Radeon HD 8770"},55{"OLAND", "AMD Radeon HD 8670"},56{"HAINAN", "AMD Radeon HD 8600M Series"},57{"TAHITI", "AMD Radeon HD 7900 Series"},58{"PITCAIRN", "AMD Radeon HD 7800 Series"},59{"CAPE VERDE", "AMD Radeon HD 7700 Series"},60{"ARUBA", "AMD Radeon HD 7660D"},61{"CAYMAN", "AMD Radeon HD 6900 Series"},62{"BARTS", "AMD Radeon HD 6800 Series"},63{"TURKS", "AMD Radeon HD 6600 Series"},64{"SUMO2", "AMD Radeon HD 6410D"},65{"SUMO", "AMD Radeon HD 6550D"},66{"CAICOS", "AMD Radeon HD 6400 Series"},67{"PALM", "AMD Radeon HD 6300 series Graphics"},68{"HEMLOCK", "ATI Radeon HD 5900 Series"},69{"CYPRESS", "ATI Radeon HD 5800 Series"},70{"JUNIPER", "ATI Radeon HD 5700 Series"},71{"REDWOOD", "ATI Radeon HD 5600 Series"},72{"CEDAR", "ATI Radeon HD 5500 Series"},73{"R700", "ATI Radeon HD 4800 Series"},74{"RV790", "ATI Radeon HD 4800 Series"},75{"RV770", "ATI Radeon HD 4800 Series"},76{"RV740", "ATI Radeon HD 4700 Series"},77{"RV730", "ATI Radeon HD 4600 Series"},78{"RV710", "ATI Radeon HD 4350"},79{"RS880", "ATI Mobility Radeon HD 4200"},80{"RS780", "ATI Radeon HD 3200 Graphics"},81{"R680", "ATI Radeon HD 2900 XT"},82{"R600", "ATI Radeon HD 2900 XT"},83{"RV670", "ATI Radeon HD 2900 XT"},84{"RV635", "ATI Mobility Radeon HD 2600"},85{"RV630", "ATI Mobility Radeon HD 2600"},86{"RV620", "ATI Mobility Radeon HD 2350"},87{"RV610", "ATI Mobility Radeon HD 2350"},88{"R580", "ATI Radeon X1600 Series"},89{"R520", "ATI Radeon X1600 Series"},90{"RV570", "ATI Radeon X1600 Series"},91{"RV560", "ATI Radeon X1600 Series"},92{"RV535", "ATI Radeon X1600 Series"},93{"RV530", "ATI Radeon X1600 Series"},94{"RV516", "ATI Radeon X700 SE"},95{"RV515", "ATI Radeon X700 SE"},96{"R481", "ATI Radeon X700 SE"},97{"R480", "ATI Radeon X700 SE"},98{"R430", "ATI Radeon X700 SE"},99{"R423", "ATI Radeon X700 SE"},100{"R420", "ATI Radeon X700 SE"},101{"R410", "ATI Radeon X700 SE"},102{"RV410", "ATI Radeon X700 SE"},103{"RS740", "ATI RADEON XPRESS 200M Series"},104{"RS690", "ATI RADEON XPRESS 200M Series"},105{"RS600", "ATI RADEON XPRESS 200M Series"},106{"RS485", "ATI RADEON XPRESS 200M Series"},107{"RS482", "ATI RADEON XPRESS 200M Series"},108{"RS480", "ATI RADEON XPRESS 200M Series"},109{"RS400", "ATI RADEON XPRESS 200M Series"},110{"R360", "ATI Radeon 9500"},111{"R350", "ATI Radeon 9500"},112{"R300", "ATI Radeon 9500"},113{"RV370", "ATI Radeon 9500"},114{"RV360", "ATI Radeon 9500"},115{"RV351", "ATI Radeon 9500"},116{"RV350", "ATI Radeon 9500"},117},118cards_nvidia[] =119{120{"NV124", "NVIDIA GeForce GTX 970"},121{"NV117", "NVIDIA GeForce GTX 750"},122{"NVF1", "NVIDIA GeForce GTX 780 Ti"},123{"NVF0", "NVIDIA GeForce GTX 780"},124{"NVE6", "NVIDIA GeForce GTX 770M"},125{"NVE4", "NVIDIA GeForce GTX 680"},126{"NVD9", "NVIDIA GeForce GT 520"},127{"NVCF", "NVIDIA GeForce GTX 550 Ti"},128{"NVCE", "NVIDIA GeForce GTX 560"},129{"NVC8", "NVIDIA GeForce GTX 570"},130{"NVC4", "NVIDIA GeForce GTX 460"},131{"NVC3", "NVIDIA GeForce GT 440"},132{"NVC1", "NVIDIA GeForce GT 420"},133{"NVC0", "NVIDIA GeForce GTX 480"},134{"NVAF", "NVIDIA GeForce GT 320M"},135{"NVAC", "NVIDIA GeForce 8200"},136{"NVAA", "NVIDIA GeForce 8200"},137{"NVA8", "NVIDIA GeForce 210"},138{"NVA5", "NVIDIA GeForce GT 220"},139{"NVA3", "NVIDIA GeForce GT 240"},140{"NVA0", "NVIDIA GeForce GTX 280"},141{"NV98", "NVIDIA GeForce 9200"},142{"NV96", "NVIDIA GeForce 9400 GT"},143{"NV94", "NVIDIA GeForce 9600 GT"},144{"NV92", "NVIDIA GeForce 9800 GT"},145{"NV86", "NVIDIA GeForce 8500 GT"},146{"NV84", "NVIDIA GeForce 8600 GT"},147{"NV50", "NVIDIA GeForce 8800 GTX"},148{"NV68", "NVIDIA GeForce 6200"},149{"NV67", "NVIDIA GeForce 6200"},150{"NV63", "NVIDIA GeForce 6200"},151{"NV4E", "NVIDIA GeForce 6200"},152{"NV4C", "NVIDIA GeForce 6200"},153{"NV4B", "NVIDIA GeForce 7600 GT"},154{"NV4A", "NVIDIA GeForce 6200"},155{"NV49", "NVIDIA GeForce 7800 GT"},156{"NV47", "NVIDIA GeForce 7800 GT"},157{"NV46", "NVIDIA GeForce Go 7400",},158{"NV45", "NVIDIA GeForce 6800"},159{"NV44", "NVIDIA GeForce 6200"},160{"NV43", "NVIDIA GeForce 6600 GT"},161{"NV42", "NVIDIA GeForce 6800"},162{"NV41", "NVIDIA GeForce 6800"},163{"NV40", "NVIDIA GeForce 6800"},164{"NV38", "NVIDIA GeForce FX 5800"},165{"NV36", "NVIDIA GeForce FX 5800"},166{"NV35", "NVIDIA GeForce FX 5800"},167{"NV34", "NVIDIA GeForce FX 5200"},168{"NV31", "NVIDIA GeForce FX 5600"},169{"NV30", "NVIDIA GeForce FX 5800"},170{"nv28", "NVIDIA GeForce4 Ti 4200"},171{"nv25", "NVIDIA GeForce4 Ti 4200"},172{"nv20", "NVIDIA GeForce3"},173{"nv1F", "NVIDIA GeForce4 MX 460"},174{"nv1A", "NVIDIA GeForce2 GTS/GeForce2 Pro"},175{"nv18", "NVIDIA GeForce4 MX 460"},176{"nv17", "NVIDIA GeForce4 MX 460"},177{"nv16", "NVIDIA GeForce2 GTS/GeForce2 Pro"},178{"nv15", "NVIDIA GeForce2 GTS/GeForce2 Pro"},179{"nv11", "NVIDIA GeForce2 MX/MX 400"},180{"nv10", "NVIDIA GeForce 256"},181},182cards_vmware[] =183{184{"SVGA3D", "VMware SVGA 3D (Microsoft Corporation - WDDM)"},185},186cards_intel[] =187{188{"Haswell Mobile", "Intel(R) Haswell Mobile"},189{"Ivybridge Server", "Intel(R) Ivybridge Server"},190{"Ivybridge Mobile", "Intel(R) Ivybridge Mobile"},191{"Ivybridge Desktop", "Intel(R) Ivybridge Desktop"},192{"Sandybridge Server", "Intel(R) Sandybridge Server"},193{"Sandybridge Mobile", "Intel(R) Sandybridge Mobile"},194{"Sandybridge Desktop", "Intel(R) Sandybridge Desktop"},195{"Ironlake Mobile", "Intel(R) Ironlake Mobile"},196{"Ironlake Desktop", "Intel(R) Ironlake Desktop"},197{"B43", "Intel(R) B43"},198{"G41", "Intel(R) G41"},199{"G45", "Intel(R) G45/G43"},200{"Q45", "Intel(R) Q45/Q43"},201{"Integrated Graphics Device", "Intel(R) Integrated Graphics Device"},202{"GM45", "Mobile Intel(R) GM45 Express Chipset Family"},203{"965GME", "Intel(R) 965GME"},204{"965GM", "Mobile Intel(R) 965 Express Chipset Family"},205{"946GZ", "Intel(R) 946GZ"},206{"965G", "Intel(R) 965G"},207{"965Q", "Intel(R) 965Q"},208{"Pineview M", "Intel(R) IGD"},209{"Pineview G", "Intel(R) IGD"},210{"IGD", "Intel(R) IGD"},211{"Q33", "Intel(R) Q33"},212{"G33", "Intel(R) G33"},213{"Q35", "Intel(R) Q35"},214{"945GME", "Intel(R) 945GME"},215{"945GM", "Mobile Intel(R) 945GM Express Chipset Family"},216{"945G", "Intel(R) 945G"},217{"915GM", "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family"},218{"E7221G", "Intel(R) E7221G"},219{"915G", "Intel(R) 82915G/GV/910GL Express Chipset Family"},220{"865G", "Intel(R) 82865G Graphics Controller"},221{"845G", "Intel(R) 845G"},222{"855GM", "Intel(R) 82852/82855 GM/GME Graphics Controller"},223{"830M", "Intel(R) 82830M Graphics Controller"},224};225226/* override VendorId, DeviceId and Description for unknown vendors */227void228d3d_match_vendor_id( D3DADAPTER_IDENTIFIER9* drvid,229unsigned fallback_ven,230unsigned fallback_dev,231const char* fallback_name )232{233if (drvid->VendorId == HW_VENDOR_INTEL ||234drvid->VendorId == HW_VENDOR_VMWARE ||235drvid->VendorId == HW_VENDOR_AMD ||236drvid->VendorId == HW_VENDOR_NVIDIA)237return;238239DBG("unknown vendor 0x4%x, emulating 0x4%x\n", drvid->VendorId, fallback_ven);240drvid->VendorId = fallback_ven;241drvid->DeviceId = fallback_dev;242snprintf(drvid->Description, sizeof(drvid->Description), "%s", fallback_name);243}244245/* fill in driver name and version */246void d3d_fill_driver_version(D3DADAPTER_IDENTIFIER9* drvid) {247switch (drvid->VendorId) {248case HW_VENDOR_INTEL:249drvid->DriverVersionLowPart = 0x000A0682;250drvid->DriverVersionHighPart = 0x0006000F;251strncpy(drvid->Driver, "igdumd32.dll", sizeof(drvid->Driver));252break;253case HW_VENDOR_VMWARE:254drvid->DriverVersionLowPart = 0x0001046E;255drvid->DriverVersionHighPart = 0x0006000E;256strncpy(drvid->Driver, "vm3dum.dll", sizeof(drvid->Driver));257break;258case HW_VENDOR_AMD:259drvid->DriverVersionLowPart = 0x000A0500;260drvid->DriverVersionHighPart = 0x00060011;261strncpy(drvid->Driver, "atiumdag.dll", sizeof(drvid->Driver));262break;263case HW_VENDOR_NVIDIA:264drvid->DriverVersionLowPart = 0x000D0FD4;265drvid->DriverVersionHighPart = 0x00060012;266strncpy(drvid->Driver, "nvd3dum.dll", sizeof(drvid->Driver));267break;268default:269break;270}271}272273/* try to match the device name and override it with Windows like device names */274void d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid) {275unsigned i;276switch (drvid->VendorId) {277case HW_VENDOR_INTEL:278for (i = 0; i < sizeof(cards_intel) / sizeof(cards_intel[0]); i++) {279if (strstr(drvid->Description, cards_intel[i].mesaname)) {280snprintf(drvid->Description, sizeof(drvid->Description),281"%s", cards_intel[i].d3d9name);282return;283}284}285/* use a fall-back if nothing matches */286DBG("Unknown card name %s!\n", drvid->DeviceName);287snprintf(drvid->Description, sizeof(drvid->Description),288"%s", cards_intel[0].d3d9name);289break;290case HW_VENDOR_VMWARE:291for (i = 0; i < sizeof(cards_vmware) / sizeof(cards_vmware[0]); i++) {292if (strstr(drvid->Description, cards_vmware[i].mesaname)) {293snprintf(drvid->Description, sizeof(drvid->Description),294"%s", cards_vmware[i].d3d9name);295return;296}297}298/* use a fall-back if nothing matches */299DBG("Unknown card name %s!\n", drvid->DeviceName);300snprintf(drvid->Description, sizeof(drvid->Description),301"%s", cards_vmware[0].d3d9name);302break;303case HW_VENDOR_AMD:304for (i = 0; i < sizeof(cards_amd) / sizeof(cards_amd[0]); i++) {305if (strstr(drvid->Description, cards_amd[i].mesaname)) {306snprintf(drvid->Description, sizeof(drvid->Description),307"%s", cards_amd[i].d3d9name);308return;309}310}311/* use a fall-back if nothing matches */312DBG("Unknown card name %s!\n", drvid->DeviceName);313snprintf(drvid->Description, sizeof(drvid->Description),314"%s", cards_amd[0].d3d9name);315break;316case HW_VENDOR_NVIDIA:317for (i = 0; i < sizeof(cards_nvidia) / sizeof(cards_nvidia[0]); i++) {318if (strstr(drvid->Description, cards_nvidia[i].mesaname)) {319snprintf(drvid->Description, sizeof(drvid->Description),320"%s", cards_nvidia[i].d3d9name);321return;322}323}324/* use a fall-back if nothing matches */325DBG("Unknown card name %s!\n", drvid->DeviceName);326snprintf(drvid->Description, sizeof(drvid->Description),327"%s", cards_nvidia[0].d3d9name);328break;329default:330break;331}332}333334335