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