101e04c3fSmrg/*
201e04c3fSmrg * Copyright 2015 Patrick Rudolph <siro@das-labor.org>
301e04c3fSmrg *
401e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
501e04c3fSmrg * copy of this software and associated documentation files (the "Software"),
601e04c3fSmrg * to deal in the Software without restriction, including without limitation
701e04c3fSmrg * on the rights to use, copy, modify, merge, publish, distribute, sub
801e04c3fSmrg * license, and/or sell copies of the Software, and to permit persons to whom
901e04c3fSmrg * the Software is furnished to do so, subject to the following conditions:
1001e04c3fSmrg *
1101e04c3fSmrg * The above copyright notice and this permission notice (including the next
1201e04c3fSmrg * paragraph) shall be included in all copies or substantial portions of the
1301e04c3fSmrg * Software.
1401e04c3fSmrg *
1501e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1601e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1701e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
1801e04c3fSmrg * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
1901e04c3fSmrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2001e04c3fSmrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2101e04c3fSmrg * USE OR OTHER DEALINGS IN THE SOFTWARE. */
2201e04c3fSmrg
239f464c52Smaya#include <stdio.h>
2401e04c3fSmrg#include <string.h>
2501e04c3fSmrg#include "adapter9.h"
2601e04c3fSmrg
2701e04c3fSmrg#define DBG_CHANNEL DBG_ADAPTER
2801e04c3fSmrg
2901e04c3fSmrg/* prototypes */
3001e04c3fSmrgvoid
3101e04c3fSmrgd3d_match_vendor_id( D3DADAPTER_IDENTIFIER9* drvid,
3201e04c3fSmrg        unsigned fallback_ven,
3301e04c3fSmrg        unsigned fallback_dev,
3401e04c3fSmrg        const char* fallback_name );
3501e04c3fSmrgvoid d3d_fill_driver_version(D3DADAPTER_IDENTIFIER9* drvid);
3601e04c3fSmrgvoid d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid);
3701e04c3fSmrg
3801e04c3fSmrgenum d3d_vendor_id
3901e04c3fSmrg{
4001e04c3fSmrg    HW_VENDOR_SOFTWARE              = 0x0000,
4101e04c3fSmrg    HW_VENDOR_AMD                   = 0x1002,
4201e04c3fSmrg    HW_VENDOR_NVIDIA                = 0x10de,
4301e04c3fSmrg    HW_VENDOR_VMWARE                = 0x15ad,
4401e04c3fSmrg    HW_VENDOR_INTEL                 = 0x8086,
4501e04c3fSmrg};
4601e04c3fSmrg
4701e04c3fSmrgstruct card_lookup_table {
4801e04c3fSmrg    const char *mesaname;
4901e04c3fSmrg    const char *d3d9name;
5001e04c3fSmrg}
5101e04c3fSmrgcards_amd[] = {
5201e04c3fSmrg    {"HAWAII",                      "AMD Radeon R9 290"},
5301e04c3fSmrg    {"KAVERI",                      "AMD Radeon(TM) R7 Graphics"},
5401e04c3fSmrg    {"KABINI",                      "AMD Radeon HD 8400 / R3 Series"},
5501e04c3fSmrg    {"BONAIRE",                     "AMD Radeon HD 8770"},
5601e04c3fSmrg    {"OLAND",                       "AMD Radeon HD 8670"},
5701e04c3fSmrg    {"HAINAN",                      "AMD Radeon HD 8600M Series"},
5801e04c3fSmrg    {"TAHITI",                      "AMD Radeon HD 7900 Series"},
5901e04c3fSmrg    {"PITCAIRN",                    "AMD Radeon HD 7800 Series"},
6001e04c3fSmrg    {"CAPE VERDE",                  "AMD Radeon HD 7700 Series"},
6101e04c3fSmrg    {"ARUBA",                       "AMD Radeon HD 7660D"},
6201e04c3fSmrg    {"CAYMAN",                      "AMD Radeon HD 6900 Series"},
6301e04c3fSmrg    {"BARTS",                       "AMD Radeon HD 6800 Series"},
6401e04c3fSmrg    {"TURKS",                       "AMD Radeon HD 6600 Series"},
6501e04c3fSmrg    {"SUMO2",                       "AMD Radeon HD 6410D"},
6601e04c3fSmrg    {"SUMO",                        "AMD Radeon HD 6550D"},
6701e04c3fSmrg    {"CAICOS",                      "AMD Radeon HD 6400 Series"},
6801e04c3fSmrg    {"PALM",                        "AMD Radeon HD 6300 series Graphics"},
6901e04c3fSmrg    {"HEMLOCK",                     "ATI Radeon HD 5900 Series"},
7001e04c3fSmrg    {"CYPRESS",                     "ATI Radeon HD 5800 Series"},
7101e04c3fSmrg    {"JUNIPER",                     "ATI Radeon HD 5700 Series"},
7201e04c3fSmrg    {"REDWOOD",                     "ATI Radeon HD 5600 Series"},
7301e04c3fSmrg    {"CEDAR",                       "ATI Radeon HD 5500 Series"},
7401e04c3fSmrg    {"R700",                        "ATI Radeon HD 4800 Series"},
7501e04c3fSmrg    {"RV790",                       "ATI Radeon HD 4800 Series"},
7601e04c3fSmrg    {"RV770",                       "ATI Radeon HD 4800 Series"},
7701e04c3fSmrg    {"RV740",                       "ATI Radeon HD 4700 Series"},
7801e04c3fSmrg    {"RV730",                       "ATI Radeon HD 4600 Series"},
7901e04c3fSmrg    {"RV710",                       "ATI Radeon HD 4350"},
8001e04c3fSmrg    {"RS880",                       "ATI Mobility Radeon HD 4200"},
8101e04c3fSmrg    {"RS780",                       "ATI Radeon HD 3200 Graphics"},
8201e04c3fSmrg    {"R680",                        "ATI Radeon HD 2900 XT"},
8301e04c3fSmrg    {"R600",                        "ATI Radeon HD 2900 XT"},
8401e04c3fSmrg    {"RV670",                       "ATI Radeon HD 2900 XT"},
8501e04c3fSmrg    {"RV635",                       "ATI Mobility Radeon HD 2600"},
8601e04c3fSmrg    {"RV630",                       "ATI Mobility Radeon HD 2600"},
8701e04c3fSmrg    {"RV620",                       "ATI Mobility Radeon HD 2350"},
8801e04c3fSmrg    {"RV610",                       "ATI Mobility Radeon HD 2350"},
8901e04c3fSmrg    {"R580",                        "ATI Radeon X1600 Series"},
9001e04c3fSmrg    {"R520",                        "ATI Radeon X1600 Series"},
9101e04c3fSmrg    {"RV570",                       "ATI Radeon X1600 Series"},
9201e04c3fSmrg    {"RV560",                       "ATI Radeon X1600 Series"},
9301e04c3fSmrg    {"RV535",                       "ATI Radeon X1600 Series"},
9401e04c3fSmrg    {"RV530",                       "ATI Radeon X1600 Series"},
9501e04c3fSmrg    {"RV516",                       "ATI Radeon X700 SE"},
9601e04c3fSmrg    {"RV515",                       "ATI Radeon X700 SE"},
9701e04c3fSmrg    {"R481",                        "ATI Radeon X700 SE"},
9801e04c3fSmrg    {"R480",                        "ATI Radeon X700 SE"},
9901e04c3fSmrg    {"R430",                        "ATI Radeon X700 SE"},
10001e04c3fSmrg    {"R423",                        "ATI Radeon X700 SE"},
10101e04c3fSmrg    {"R420",                        "ATI Radeon X700 SE"},
10201e04c3fSmrg    {"R410",                        "ATI Radeon X700 SE"},
10301e04c3fSmrg    {"RV410",                       "ATI Radeon X700 SE"},
10401e04c3fSmrg    {"RS740",                       "ATI RADEON XPRESS 200M Series"},
10501e04c3fSmrg    {"RS690",                       "ATI RADEON XPRESS 200M Series"},
10601e04c3fSmrg    {"RS600",                       "ATI RADEON XPRESS 200M Series"},
10701e04c3fSmrg    {"RS485",                       "ATI RADEON XPRESS 200M Series"},
10801e04c3fSmrg    {"RS482",                       "ATI RADEON XPRESS 200M Series"},
10901e04c3fSmrg    {"RS480",                       "ATI RADEON XPRESS 200M Series"},
11001e04c3fSmrg    {"RS400",                       "ATI RADEON XPRESS 200M Series"},
11101e04c3fSmrg    {"R360",                        "ATI Radeon 9500"},
11201e04c3fSmrg    {"R350",                        "ATI Radeon 9500"},
11301e04c3fSmrg    {"R300",                        "ATI Radeon 9500"},
11401e04c3fSmrg    {"RV370",                       "ATI Radeon 9500"},
11501e04c3fSmrg    {"RV360",                       "ATI Radeon 9500"},
11601e04c3fSmrg    {"RV351",                       "ATI Radeon 9500"},
11701e04c3fSmrg    {"RV350",                       "ATI Radeon 9500"},
11801e04c3fSmrg},
11901e04c3fSmrgcards_nvidia[] =
12001e04c3fSmrg{
12101e04c3fSmrg    {"NV124",                       "NVIDIA GeForce GTX 970"},
12201e04c3fSmrg    {"NV117",                       "NVIDIA GeForce GTX 750"},
12301e04c3fSmrg    {"NVF1",                        "NVIDIA GeForce GTX 780 Ti"},
12401e04c3fSmrg    {"NVF0",                        "NVIDIA GeForce GTX 780"},
12501e04c3fSmrg    {"NVE6",                        "NVIDIA GeForce GTX 770M"},
12601e04c3fSmrg    {"NVE4",                        "NVIDIA GeForce GTX 680"},
12701e04c3fSmrg    {"NVD9",                        "NVIDIA GeForce GT 520"},
12801e04c3fSmrg    {"NVCF",                        "NVIDIA GeForce GTX 550 Ti"},
12901e04c3fSmrg    {"NVCE",                        "NVIDIA GeForce GTX 560"},
13001e04c3fSmrg    {"NVC8",                        "NVIDIA GeForce GTX 570"},
13101e04c3fSmrg    {"NVC4",                        "NVIDIA GeForce GTX 460"},
13201e04c3fSmrg    {"NVC3",                        "NVIDIA GeForce GT 440"},
13301e04c3fSmrg    {"NVC1",                        "NVIDIA GeForce GT 420"},
13401e04c3fSmrg    {"NVC0",                        "NVIDIA GeForce GTX 480"},
13501e04c3fSmrg    {"NVAF",                        "NVIDIA GeForce GT 320M"},
13601e04c3fSmrg    {"NVAC",                        "NVIDIA GeForce 8200"},
13701e04c3fSmrg    {"NVAA",                        "NVIDIA GeForce 8200"},
13801e04c3fSmrg    {"NVA8",                        "NVIDIA GeForce 210"},
13901e04c3fSmrg    {"NVA5",                        "NVIDIA GeForce GT 220"},
14001e04c3fSmrg    {"NVA3",                        "NVIDIA GeForce GT 240"},
14101e04c3fSmrg    {"NVA0",                        "NVIDIA GeForce GTX 280"},
14201e04c3fSmrg    {"NV98",                        "NVIDIA GeForce 9200"},
14301e04c3fSmrg    {"NV96",                        "NVIDIA GeForce 9400 GT"},
14401e04c3fSmrg    {"NV94",                        "NVIDIA GeForce 9600 GT"},
14501e04c3fSmrg    {"NV92",                        "NVIDIA GeForce 9800 GT"},
14601e04c3fSmrg    {"NV86",                        "NVIDIA GeForce 8500 GT"},
14701e04c3fSmrg    {"NV84",                        "NVIDIA GeForce 8600 GT"},
14801e04c3fSmrg    {"NV50",                        "NVIDIA GeForce 8800 GTX"},
14901e04c3fSmrg    {"NV68",                        "NVIDIA GeForce 6200"},
15001e04c3fSmrg    {"NV67",                        "NVIDIA GeForce 6200"},
15101e04c3fSmrg    {"NV63",                        "NVIDIA GeForce 6200"},
15201e04c3fSmrg    {"NV4E",                        "NVIDIA GeForce 6200"},
15301e04c3fSmrg    {"NV4C",                        "NVIDIA GeForce 6200"},
15401e04c3fSmrg    {"NV4B",                        "NVIDIA GeForce 7600 GT"},
15501e04c3fSmrg    {"NV4A",                        "NVIDIA GeForce 6200"},
15601e04c3fSmrg    {"NV49",                        "NVIDIA GeForce 7800 GT"},
15701e04c3fSmrg    {"NV47",                        "NVIDIA GeForce 7800 GT"},
15801e04c3fSmrg    {"NV46",                        "NVIDIA GeForce Go 7400",},
15901e04c3fSmrg    {"NV45",                        "NVIDIA GeForce 6800"},
16001e04c3fSmrg    {"NV44",                        "NVIDIA GeForce 6200"},
16101e04c3fSmrg    {"NV43",                        "NVIDIA GeForce 6600 GT"},
16201e04c3fSmrg    {"NV42",                        "NVIDIA GeForce 6800"},
16301e04c3fSmrg    {"NV41",                        "NVIDIA GeForce 6800"},
16401e04c3fSmrg    {"NV40",                        "NVIDIA GeForce 6800"},
16501e04c3fSmrg    {"NV38",                        "NVIDIA GeForce FX 5800"},
16601e04c3fSmrg    {"NV36",                        "NVIDIA GeForce FX 5800"},
16701e04c3fSmrg    {"NV35",                        "NVIDIA GeForce FX 5800"},
16801e04c3fSmrg    {"NV34",                        "NVIDIA GeForce FX 5200"},
16901e04c3fSmrg    {"NV31",                        "NVIDIA GeForce FX 5600"},
17001e04c3fSmrg    {"NV30",                        "NVIDIA GeForce FX 5800"},
17101e04c3fSmrg    {"nv28",                        "NVIDIA GeForce4 Ti 4200"},
17201e04c3fSmrg    {"nv25",                        "NVIDIA GeForce4 Ti 4200"},
17301e04c3fSmrg    {"nv20",                        "NVIDIA GeForce3"},
17401e04c3fSmrg    {"nv1F",                        "NVIDIA GeForce4 MX 460"},
17501e04c3fSmrg    {"nv1A",                        "NVIDIA GeForce2 GTS/GeForce2 Pro"},
17601e04c3fSmrg    {"nv18",                        "NVIDIA GeForce4 MX 460"},
17701e04c3fSmrg    {"nv17",                        "NVIDIA GeForce4 MX 460"},
17801e04c3fSmrg    {"nv16",                        "NVIDIA GeForce2 GTS/GeForce2 Pro"},
17901e04c3fSmrg    {"nv15",                        "NVIDIA GeForce2 GTS/GeForce2 Pro"},
18001e04c3fSmrg    {"nv11",                        "NVIDIA GeForce2 MX/MX 400"},
18101e04c3fSmrg    {"nv10",                        "NVIDIA GeForce 256"},
18201e04c3fSmrg},
18301e04c3fSmrgcards_vmware[] =
18401e04c3fSmrg{
18501e04c3fSmrg    {"SVGA3D",                      "VMware SVGA 3D (Microsoft Corporation - WDDM)"},
18601e04c3fSmrg},
18701e04c3fSmrgcards_intel[] =
18801e04c3fSmrg{
18901e04c3fSmrg    {"Haswell Mobile",              "Intel(R) Haswell Mobile"},
19001e04c3fSmrg    {"Ivybridge Server",            "Intel(R) Ivybridge Server"},
19101e04c3fSmrg    {"Ivybridge Mobile",            "Intel(R) Ivybridge Mobile"},
19201e04c3fSmrg    {"Ivybridge Desktop",           "Intel(R) Ivybridge Desktop"},
19301e04c3fSmrg    {"Sandybridge Server",          "Intel(R) Sandybridge Server"},
19401e04c3fSmrg    {"Sandybridge Mobile",          "Intel(R) Sandybridge Mobile"},
19501e04c3fSmrg    {"Sandybridge Desktop",         "Intel(R) Sandybridge Desktop"},
19601e04c3fSmrg    {"Ironlake Mobile",             "Intel(R) Ironlake Mobile"},
19701e04c3fSmrg    {"Ironlake Desktop",            "Intel(R) Ironlake Desktop"},
19801e04c3fSmrg    {"B43",                         "Intel(R) B43"},
19901e04c3fSmrg    {"G41",                         "Intel(R) G41"},
20001e04c3fSmrg    {"G45",                         "Intel(R) G45/G43"},
20101e04c3fSmrg    {"Q45",                         "Intel(R) Q45/Q43"},
20201e04c3fSmrg    {"Integrated Graphics Device",  "Intel(R) Integrated Graphics Device"},
20301e04c3fSmrg    {"GM45",                        "Mobile Intel(R) GM45 Express Chipset Family"},
20401e04c3fSmrg    {"965GME",                      "Intel(R) 965GME"},
20501e04c3fSmrg    {"965GM",                       "Mobile Intel(R) 965 Express Chipset Family"},
20601e04c3fSmrg    {"946GZ",                       "Intel(R) 946GZ"},
20701e04c3fSmrg    {"965G",                        "Intel(R) 965G"},
20801e04c3fSmrg    {"965Q",                        "Intel(R) 965Q"},
20901e04c3fSmrg    {"Pineview M",                  "Intel(R) IGD"},
21001e04c3fSmrg    {"Pineview G",                  "Intel(R) IGD"},
21101e04c3fSmrg    {"IGD",                         "Intel(R) IGD"},
21201e04c3fSmrg    {"Q33",                         "Intel(R) Q33"},
21301e04c3fSmrg    {"G33",                         "Intel(R) G33"},
21401e04c3fSmrg    {"Q35",                         "Intel(R) Q35"},
21501e04c3fSmrg    {"945GME",                      "Intel(R) 945GME"},
21601e04c3fSmrg    {"945GM",                       "Mobile Intel(R) 945GM Express Chipset Family"},
21701e04c3fSmrg    {"945G",                        "Intel(R) 945G"},
21801e04c3fSmrg    {"915GM",                       "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family"},
21901e04c3fSmrg    {"E7221G",                      "Intel(R) E7221G"},
22001e04c3fSmrg    {"915G",                        "Intel(R) 82915G/GV/910GL Express Chipset Family"},
22101e04c3fSmrg    {"865G",                        "Intel(R) 82865G Graphics Controller"},
22201e04c3fSmrg    {"845G",                        "Intel(R) 845G"},
22301e04c3fSmrg    {"855GM",                       "Intel(R) 82852/82855 GM/GME Graphics Controller"},
22401e04c3fSmrg    {"830M",                        "Intel(R) 82830M Graphics Controller"},
22501e04c3fSmrg};
22601e04c3fSmrg
22701e04c3fSmrg/* override VendorId, DeviceId and Description for unknown vendors */
22801e04c3fSmrgvoid
22901e04c3fSmrgd3d_match_vendor_id( D3DADAPTER_IDENTIFIER9* drvid,
23001e04c3fSmrg        unsigned fallback_ven,
23101e04c3fSmrg        unsigned fallback_dev,
23201e04c3fSmrg        const char* fallback_name )
23301e04c3fSmrg{
23401e04c3fSmrg    if (drvid->VendorId == HW_VENDOR_INTEL ||
23501e04c3fSmrg        drvid->VendorId == HW_VENDOR_VMWARE ||
23601e04c3fSmrg        drvid->VendorId == HW_VENDOR_AMD ||
23701e04c3fSmrg        drvid->VendorId == HW_VENDOR_NVIDIA)
23801e04c3fSmrg        return;
23901e04c3fSmrg
24001e04c3fSmrg    DBG("unknown vendor 0x4%x, emulating 0x4%x\n", drvid->VendorId, fallback_ven);
24101e04c3fSmrg    drvid->VendorId = fallback_ven;
24201e04c3fSmrg    drvid->DeviceId = fallback_dev;
2439f464c52Smaya    snprintf(drvid->Description, sizeof(drvid->Description), "%s", fallback_name);
24401e04c3fSmrg}
24501e04c3fSmrg
24601e04c3fSmrg/* fill in driver name and version */
24701e04c3fSmrgvoid d3d_fill_driver_version(D3DADAPTER_IDENTIFIER9* drvid) {
24801e04c3fSmrg    switch (drvid->VendorId) {
24901e04c3fSmrg    case HW_VENDOR_INTEL:
25001e04c3fSmrg        drvid->DriverVersionLowPart = 0x000A0682;
25101e04c3fSmrg        drvid->DriverVersionHighPart = 0x0006000F;
25201e04c3fSmrg        strncpy(drvid->Driver, "igdumd32.dll", sizeof(drvid->Driver));
25301e04c3fSmrg        break;
25401e04c3fSmrg    case HW_VENDOR_VMWARE:
25501e04c3fSmrg        drvid->DriverVersionLowPart = 0x0001046E;
25601e04c3fSmrg        drvid->DriverVersionHighPart = 0x0006000E;
25701e04c3fSmrg        strncpy(drvid->Driver, "vm3dum.dll", sizeof(drvid->Driver));
25801e04c3fSmrg        break;
25901e04c3fSmrg    case HW_VENDOR_AMD:
26001e04c3fSmrg        drvid->DriverVersionLowPart = 0x000A0500;
26101e04c3fSmrg        drvid->DriverVersionHighPart = 0x00060011;
26201e04c3fSmrg        strncpy(drvid->Driver, "atiumdag.dll", sizeof(drvid->Driver));
26301e04c3fSmrg        break;
26401e04c3fSmrg    case HW_VENDOR_NVIDIA:
26501e04c3fSmrg        drvid->DriverVersionLowPart = 0x000D0FD4;
26601e04c3fSmrg        drvid->DriverVersionHighPart = 0x00060012;
26701e04c3fSmrg        strncpy(drvid->Driver, "nvd3dum.dll", sizeof(drvid->Driver));
26801e04c3fSmrg        break;
26901e04c3fSmrg    default:
27001e04c3fSmrg        break;
27101e04c3fSmrg    }
27201e04c3fSmrg}
27301e04c3fSmrg
27401e04c3fSmrg/* try to match the device name and override it with Windows like device names */
27501e04c3fSmrgvoid d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid) {
27601e04c3fSmrg    unsigned i;
27701e04c3fSmrg    switch (drvid->VendorId) {
27801e04c3fSmrg    case HW_VENDOR_INTEL:
27901e04c3fSmrg        for (i = 0; i < sizeof(cards_intel) / sizeof(cards_intel[0]); i++) {
28001e04c3fSmrg            if (strstr(drvid->Description, cards_intel[i].mesaname)) {
2819f464c52Smaya                snprintf(drvid->Description, sizeof(drvid->Description),
2829f464c52Smaya                         "%s", cards_intel[i].d3d9name);
28301e04c3fSmrg                return;
28401e04c3fSmrg            }
28501e04c3fSmrg        }
28601e04c3fSmrg        /* use a fall-back if nothing matches */
28701e04c3fSmrg        DBG("Unknown card name %s!\n", drvid->DeviceName);
2889f464c52Smaya        snprintf(drvid->Description, sizeof(drvid->Description),
2899f464c52Smaya                 "%s", cards_intel[0].d3d9name);
29001e04c3fSmrg        break;
29101e04c3fSmrg    case HW_VENDOR_VMWARE:
29201e04c3fSmrg        for (i = 0; i < sizeof(cards_vmware) / sizeof(cards_vmware[0]); i++) {
29301e04c3fSmrg            if (strstr(drvid->Description, cards_vmware[i].mesaname)) {
2949f464c52Smaya                snprintf(drvid->Description, sizeof(drvid->Description),
2959f464c52Smaya                         "%s", cards_vmware[i].d3d9name);
29601e04c3fSmrg                return;
29701e04c3fSmrg            }
29801e04c3fSmrg        }
29901e04c3fSmrg        /* use a fall-back if nothing matches */
30001e04c3fSmrg        DBG("Unknown card name %s!\n", drvid->DeviceName);
3019f464c52Smaya        snprintf(drvid->Description, sizeof(drvid->Description),
3029f464c52Smaya                 "%s", cards_vmware[0].d3d9name);
30301e04c3fSmrg        break;
30401e04c3fSmrg    case HW_VENDOR_AMD:
30501e04c3fSmrg        for (i = 0; i < sizeof(cards_amd) / sizeof(cards_amd[0]); i++) {
30601e04c3fSmrg            if (strstr(drvid->Description, cards_amd[i].mesaname)) {
3079f464c52Smaya                snprintf(drvid->Description, sizeof(drvid->Description),
3089f464c52Smaya                         "%s", cards_amd[i].d3d9name);
30901e04c3fSmrg                return;
31001e04c3fSmrg            }
31101e04c3fSmrg        }
31201e04c3fSmrg        /* use a fall-back if nothing matches */
31301e04c3fSmrg        DBG("Unknown card name %s!\n", drvid->DeviceName);
3149f464c52Smaya        snprintf(drvid->Description, sizeof(drvid->Description),
3159f464c52Smaya                 "%s", cards_amd[0].d3d9name);
31601e04c3fSmrg        break;
31701e04c3fSmrg    case HW_VENDOR_NVIDIA:
31801e04c3fSmrg        for (i = 0; i < sizeof(cards_nvidia) / sizeof(cards_nvidia[0]); i++) {
31901e04c3fSmrg            if (strstr(drvid->Description, cards_nvidia[i].mesaname)) {
3209f464c52Smaya                snprintf(drvid->Description, sizeof(drvid->Description),
3219f464c52Smaya                         "%s", cards_nvidia[i].d3d9name);
32201e04c3fSmrg                return;
32301e04c3fSmrg            }
32401e04c3fSmrg        }
32501e04c3fSmrg        /* use a fall-back if nothing matches */
32601e04c3fSmrg        DBG("Unknown card name %s!\n", drvid->DeviceName);
3279f464c52Smaya        snprintf(drvid->Description, sizeof(drvid->Description),
3289f464c52Smaya                 "%s", cards_nvidia[0].d3d9name);
32901e04c3fSmrg        break;
33001e04c3fSmrg    default:
33101e04c3fSmrg        break;
33201e04c3fSmrg    }
33301e04c3fSmrg}
334