<div dir="ltr"><div><div><div><div>Hello,<br><br></div>Where does this mapping list come from ? Is this an official map (Vendor or Windows drivers) ? Is that used just for information ?<br></div>Because many of them are not really precise, if not completely wrong at all (eg. the Radeon R400/R500 series names).<br><br></div>Regards.<br><br>--<br></div>Benjamin<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-16 17:27 GMT+02:00 Axel Davy <span dir="ltr"><<a href="mailto:axel.davy@ens.fr" target="_blank">axel.davy@ens.fr</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Patrick Rudolph <<a href="mailto:siro@das-labor.org">siro@das-labor.org</a>><br>
<br>
Add support for multiple cards and fill in Windows like card name, driver name and version info.<br>
Use fallback for unknown vendors and unknown card names.<br>
<br>
Reviewed-by: Axel Davy <<a href="mailto:axel.davy@ens.fr">axel.davy@ens.fr</a>><br>
Signed-off-by: Patrick Rudolph <<a href="mailto:siro@das-labor.org">siro@das-labor.org</a>><br>
---<br>
src/gallium/targets/d3dadapter9/Makefile.am | 1 +<br>
src/gallium/targets/d3dadapter9/description.c | 324 ++++++++++++++++++++++++++<br>
src/gallium/targets/d3dadapter9/drm.c | 76 +++---<br>
3 files changed, 359 insertions(+), 42 deletions(-)<br>
create mode 100644 src/gallium/targets/d3dadapter9/description.c<br>
<br>
diff --git a/src/gallium/targets/d3dadapter9/Makefile.am b/src/gallium/targets/d3dadapter9/Makefile.am<br>
index fe5b0b1..e26ca33 100644<br>
--- a/src/gallium/targets/d3dadapter9/Makefile.am<br>
+++ b/src/gallium/targets/d3dadapter9/Makefile.am<br>
@@ -54,6 +54,7 @@ pkgconfigdir = $(libdir)/pkgconfig<br>
pkgconfig_DATA = d3d.pc<br>
<br>
d3dadapter9_la_SOURCES = \<br>
+ description.c \<br>
getproc.c \<br>
drm.c<br>
<br>
diff --git a/src/gallium/targets/d3dadapter9/description.c b/src/gallium/targets/d3dadapter9/description.c<br>
new file mode 100644<br>
index 0000000..c0a8678<br>
--- /dev/null<br>
+++ b/src/gallium/targets/d3dadapter9/description.c<br>
@@ -0,0 +1,324 @@<br>
+/*<br>
+ * Copyright 2015 Patrick Rudolph <<a href="mailto:siro@das-labor.org">siro@das-labor.org</a>><br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * on the rights to use, copy, modify, merge, publish, distribute, sub<br>
+ * license, and/or sell copies of the Software, and to permit persons to whom<br>
+ * the Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL<br>
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,<br>
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR<br>
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE<br>
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */<br>
+<br>
+#include <string.h><br>
+#include "adapter9.h"<br>
+<br>
+#define DBG_CHANNEL DBG_ADAPTER<br>
+<br>
+/* prototypes */<br>
+void<br>
+d3d_match_vendor_id( D3DADAPTER_IDENTIFIER9* drvid,<br>
+ unsigned fallback_ven,<br>
+ unsigned fallback_dev,<br>
+ const char* fallback_name );<br>
+void d3d_fill_driver_version(D3DADAPTER_IDENTIFIER9* drvid);<br>
+void d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid);<br>
+<br>
+enum d3d_vendor_id<br>
+{<br>
+ HW_VENDOR_SOFTWARE = 0x0000,<br>
+ HW_VENDOR_AMD = 0x1002,<br>
+ HW_VENDOR_NVIDIA = 0x10de,<br>
+ HW_VENDOR_VMWARE = 0x15ad,<br>
+ HW_VENDOR_INTEL = 0x8086,<br>
+};<br>
+<br>
+struct card_lookup_table {<br>
+ const char *mesaname;<br>
+ const char *d3d9name;<br>
+}<br>
+cards_amd[] = {<br>
+ {"HAWAII", "AMD Radeon R9 290"},<br>
+ {"KAVERI", "AMD Radeon(TM) R7 Graphics"},<br>
+ {"KABINI", "AMD Radeon HD 8400 / R3 Series"},<br>
+ {"BONAIRE", "AMD Radeon HD 8770"},<br>
+ {"OLAND", "AMD Radeon HD 8670"},<br>
+ {"HAINAN", "AMD Radeon HD 8600M Series"},<br>
+ {"TAHITI", "AMD Radeon HD 7900 Series"},<br>
+ {"PITCAIRN", "AMD Radeon HD 7800 Series"},<br>
+ {"CAPE VERDE", "AMD Radeon HD 7700 Series"},<br>
+ {"ARUBA", "AMD Radeon HD 7660D"},<br>
+ {"CAYMAN", "AMD Radeon HD 6900 Series"},<br>
+ {"BARTS", "AMD Radeon HD 6800 Series"},<br>
+ {"TURKS", "AMD Radeon HD 6600 Series"},<br>
+ {"SUMO2", "AMD Radeon HD 6410D"},<br>
+ {"SUMO", "AMD Radeon HD 6550D"},<br>
+ {"CAICOS", "AMD Radeon HD 6400 Series"},<br>
+ {"PALM", "AMD Radeon HD 6300 series Graphics"},<br>
+ {"HEMLOCK", "ATI Radeon HD 5900 Series"},<br>
+ {"CYPRESS", "ATI Radeon HD 5800 Series"},<br>
+ {"JUNIPER", "ATI Radeon HD 5700 Series"},<br>
+ {"REDWOOD", "ATI Radeon HD 5600 Series"},<br>
+ {"CEDAR", "ATI Radeon HD 5500 Series"},<br>
+ {"R700", "ATI Radeon HD 4800 Series"},<br>
+ {"RV790", "ATI Radeon HD 4800 Series"},<br>
+ {"RV770", "ATI Radeon HD 4800 Series"},<br>
+ {"RV740", "ATI Radeon HD 4700 Series"},<br>
+ {"RV730", "ATI Radeon HD 4600 Series"},<br>
+ {"RV710", "ATI Radeon HD 4350"},<br>
+ {"RS880", "ATI Mobility Radeon HD 4200"},<br>
+ {"RS780", "ATI Radeon HD 3200 Graphics"},<br>
+ {"R680", "ATI Radeon HD 2900 XT"},<br>
+ {"R600", "ATI Radeon HD 2900 XT"},<br>
+ {"RV670", "ATI Radeon HD 2900 XT"},<br>
+ {"RV635", "ATI Mobility Radeon HD 2600"},<br>
+ {"RV630", "ATI Mobility Radeon HD 2600"},<br>
+ {"RV620", "ATI Mobility Radeon HD 2350"},<br>
+ {"RV610", "ATI Mobility Radeon HD 2350"},<br>
+ {"R580", "ATI Radeon X1600 Series"},<br>
+ {"R520", "ATI Radeon X1600 Series"},<br>
+ {"RV570", "ATI Radeon X1600 Series"},<br>
+ {"RV560", "ATI Radeon X1600 Series"},<br>
+ {"RV535", "ATI Radeon X1600 Series"},<br>
+ {"RV530", "ATI Radeon X1600 Series"},<br>
+ {"RV516", "ATI Radeon X700 SE"},<br>
+ {"RV515", "ATI Radeon X700 SE"},<br>
+ {"R481", "ATI Radeon X700 SE"},<br>
+ {"R480", "ATI Radeon X700 SE"},<br>
+ {"R430", "ATI Radeon X700 SE"},<br>
+ {"R423", "ATI Radeon X700 SE"},<br>
+ {"R420", "ATI Radeon X700 SE"},<br>
+ {"R410", "ATI Radeon X700 SE"},<br>
+ {"RV410", "ATI Radeon X700 SE"},<br>
+ {"RS740", "ATI RADEON XPRESS 200M Series"},<br>
+ {"RS690", "ATI RADEON XPRESS 200M Series"},<br>
+ {"RS600", "ATI RADEON XPRESS 200M Series"},<br>
+ {"RS485", "ATI RADEON XPRESS 200M Series"},<br>
+ {"RS482", "ATI RADEON XPRESS 200M Series"},<br>
+ {"RS480", "ATI RADEON XPRESS 200M Series"},<br>
+ {"RS400", "ATI RADEON XPRESS 200M Series"},<br>
+ {"R360", "ATI Radeon 9500"},<br>
+ {"R350", "ATI Radeon 9500"},<br>
+ {"R300", "ATI Radeon 9500"},<br>
+ {"RV370", "ATI Radeon 9500"},<br>
+ {"RV360", "ATI Radeon 9500"},<br>
+ {"RV351", "ATI Radeon 9500"},<br>
+ {"RV350", "ATI Radeon 9500"},<br>
+},<br>
+cards_nvidia[] =<br>
+{<br>
+ {"NV124", "NVIDIA GeForce GTX 970"},<br>
+ {"NV117", "NVIDIA GeForce GTX 750"},<br>
+ {"NVF1", "NVIDIA GeForce GTX 780 Ti"},<br>
+ {"NVF0", "NVIDIA GeForce GTX 780"},<br>
+ {"NVE6", "NVIDIA GeForce GTX 770M"},<br>
+ {"NVE4", "NVIDIA GeForce GTX 680"},<br>
+ {"NVD9", "NVIDIA GeForce GT 520"},<br>
+ {"NVCF", "NVIDIA GeForce GTX 550 Ti"},<br>
+ {"NVCE", "NVIDIA GeForce GTX 560"},<br>
+ {"NVC8", "NVIDIA GeForce GTX 570"},<br>
+ {"NVC4", "NVIDIA GeForce GTX 460"},<br>
+ {"NVC3", "NVIDIA GeForce GT 440"},<br>
+ {"NVC1", "NVIDIA GeForce GT 420"},<br>
+ {"NVC0", "NVIDIA GeForce GTX 480"},<br>
+ {"NVAF", "NVIDIA GeForce GT 320M"},<br>
+ {"NVAC", "NVIDIA GeForce 8200"},<br>
+ {"NVAA", "NVIDIA GeForce 8200"},<br>
+ {"NVA8", "NVIDIA GeForce 210"},<br>
+ {"NVA5", "NVIDIA GeForce GT 220"},<br>
+ {"NVA3", "NVIDIA GeForce GT 240"},<br>
+ {"NVA0", "NVIDIA GeForce GTX 280"},<br>
+ {"NV98", "NVIDIA GeForce 9200"},<br>
+ {"NV96", "NVIDIA GeForce 9400 GT"},<br>
+ {"NV94", "NVIDIA GeForce 9600 GT"},<br>
+ {"NV92", "NVIDIA GeForce 9800 GT"},<br>
+ {"NV86", "NVIDIA GeForce 8500 GT"},<br>
+ {"NV84", "NVIDIA GeForce 8600 GT"},<br>
+ {"NV50", "NVIDIA GeForce 8800 GTX"},<br>
+ {"NV68", "NVIDIA GeForce 6200"},<br>
+ {"NV67", "NVIDIA GeForce 6200"},<br>
+ {"NV63", "NVIDIA GeForce 6200"},<br>
+ {"NV4E", "NVIDIA GeForce 6200"},<br>
+ {"NV4C", "NVIDIA GeForce 6200"},<br>
+ {"NV4B", "NVIDIA GeForce 7600 GT"},<br>
+ {"NV4A", "NVIDIA GeForce 6200"},<br>
+ {"NV49", "NVIDIA GeForce 7800 GT"},<br>
+ {"NV47", "NVIDIA GeForce 7800 GT"},<br>
+ {"NV46", "NVIDIA GeForce Go 7400",},<br>
+ {"NV45", "NVIDIA GeForce 6800"},<br>
+ {"NV44", "NVIDIA GeForce 6200"},<br>
+ {"NV43", "NVIDIA GeForce 6600 GT"},<br>
+ {"NV42", "NVIDIA GeForce 6800"},<br>
+ {"NV41", "NVIDIA GeForce 6800"},<br>
+ {"NV40", "NVIDIA GeForce 6800"},<br>
+ {"NV38", "NVIDIA GeForce FX 5800"},<br>
+ {"NV36", "NVIDIA GeForce FX 5800"},<br>
+ {"NV35", "NVIDIA GeForce FX 5800"},<br>
+ {"NV34", "NVIDIA GeForce FX 5200"},<br>
+ {"NV31", "NVIDIA GeForce FX 5600"},<br>
+ {"NV30", "NVIDIA GeForce FX 5800"},<br>
+ {"nv28", "NVIDIA GeForce4 Ti 4200"},<br>
+ {"nv25", "NVIDIA GeForce4 Ti 4200"},<br>
+ {"nv20", "NVIDIA GeForce3"},<br>
+ {"nv1F", "NVIDIA GeForce4 MX 460"},<br>
+ {"nv1A", "NVIDIA GeForce2 GTS/GeForce2 Pro"},<br>
+ {"nv18", "NVIDIA GeForce4 MX 460"},<br>
+ {"nv17", "NVIDIA GeForce4 MX 460"},<br>
+ {"nv16", "NVIDIA GeForce2 GTS/GeForce2 Pro"},<br>
+ {"nv15", "NVIDIA GeForce2 GTS/GeForce2 Pro"},<br>
+ {"nv11", "NVIDIA GeForce2 MX/MX 400"},<br>
+ {"nv10", "NVIDIA GeForce 256"},<br>
+},<br>
+cards_vmware[] =<br>
+{<br>
+ {"SVGA3D", "VMware SVGA 3D (Microsoft Corporation - WDDM)"},<br>
+},<br>
+cards_intel[] =<br>
+{<br>
+ {"Haswell Mobile", "Intel(R) Haswell Mobile"},<br>
+ {"Ivybridge Server", "Intel(R) Ivybridge Server"},<br>
+ {"Ivybridge Mobile", "Intel(R) Ivybridge Mobile"},<br>
+ {"Ivybridge Desktop", "Intel(R) Ivybridge Desktop"},<br>
+ {"Sandybridge Server", "Intel(R) Sandybridge Server"},<br>
+ {"Sandybridge Mobile", "Intel(R) Sandybridge Mobile"},<br>
+ {"Sandybridge Desktop", "Intel(R) Sandybridge Desktop"},<br>
+ {"Ironlake Mobile", "Intel(R) Ironlake Mobile"},<br>
+ {"Ironlake Desktop", "Intel(R) Ironlake Desktop"},<br>
+ {"B43", "Intel(R) B43"},<br>
+ {"G41", "Intel(R) G41"},<br>
+ {"G45", "Intel(R) G45/G43"},<br>
+ {"Q45", "Intel(R) Q45/Q43"},<br>
+ {"Integrated Graphics Device", "Intel(R) Integrated Graphics Device"},<br>
+ {"GM45", "Mobile Intel(R) GM45 Express Chipset Family"},<br>
+ {"965GME", "Intel(R) 965GME"},<br>
+ {"965GM", "Mobile Intel(R) 965 Express Chipset Family"},<br>
+ {"946GZ", "Intel(R) 946GZ"},<br>
+ {"965G", "Intel(R) 965G"},<br>
+ {"965Q", "Intel(R) 965Q"},<br>
+ {"Pineview M", "Intel(R) IGD"},<br>
+ {"Pineview G", "Intel(R) IGD"},<br>
+ {"IGD", "Intel(R) IGD"},<br>
+ {"Q33", "Intel(R) Q33"},<br>
+ {"G33", "Intel(R) G33"},<br>
+ {"Q35", "Intel(R) Q35"},<br>
+ {"945GME", "Intel(R) 945GME"},<br>
+ {"945GM", "Mobile Intel(R) 945GM Express Chipset Family"},<br>
+ {"945G", "Intel(R) 945G"},<br>
+ {"915GM", "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family"},<br>
+ {"E7221G", "Intel(R) E7221G"},<br>
+ {"915G", "Intel(R) 82915G/GV/910GL Express Chipset Family"},<br>
+ {"865G", "Intel(R) 82865G Graphics Controller"},<br>
+ {"845G", "Intel(R) 845G"},<br>
+ {"855GM", "Intel(R) 82852/82855 GM/GME Graphics Controller"},<br>
+ {"830M", "Intel(R) 82830M Graphics Controller"},<br>
+};<br>
+<br>
+/* override VendorId, DeviceId and Description for unknown vendors */<br>
+void<br>
+d3d_match_vendor_id( D3DADAPTER_IDENTIFIER9* drvid,<br>
+ unsigned fallback_ven,<br>
+ unsigned fallback_dev,<br>
+ const char* fallback_name )<br>
+{<br>
+ if (drvid->VendorId == HW_VENDOR_INTEL ||<br>
+ drvid->VendorId == HW_VENDOR_VMWARE ||<br>
+ drvid->VendorId == HW_VENDOR_AMD ||<br>
+ drvid->VendorId == HW_VENDOR_NVIDIA)<br>
+ return;<br>
+<br>
+ DBG("unknown vendor 0x4%x, emulating 0x4%x\n", drvid->VendorId, fallback_ven);<br>
+ drvid->VendorId = fallback_ven;<br>
+ drvid->DeviceId = fallback_dev;<br>
+ strncpy(drvid->Description, fallback_name, sizeof(drvid->Description));<br>
+}<br>
+<br>
+/* fill in driver name and version */<br>
+void d3d_fill_driver_version(D3DADAPTER_IDENTIFIER9* drvid) {<br>
+ switch (drvid->VendorId) {<br>
+ case HW_VENDOR_INTEL:<br>
+ drvid->DriverVersionLowPart = 0x000A0682;<br>
+ drvid->DriverVersionHighPart = 0x0006000F;<br>
+ strncpy(drvid->Driver, "igdumd32.dll", sizeof(drvid->Driver));<br>
+ break;<br>
+ case HW_VENDOR_VMWARE:<br>
+ drvid->DriverVersionLowPart = 0x0001046E;<br>
+ drvid->DriverVersionHighPart = 0x0006000E;<br>
+ strncpy(drvid->Driver, "vm3dum.dll", sizeof(drvid->Driver));<br>
+ break;<br>
+ case HW_VENDOR_AMD:<br>
+ drvid->DriverVersionLowPart = 0x000A0500;<br>
+ drvid->DriverVersionHighPart = 0x00060011;<br>
+ strncpy(drvid->Driver, "atiumdag.dll", sizeof(drvid->Driver));<br>
+ break;<br>
+ case HW_VENDOR_NVIDIA:<br>
+ drvid->DriverVersionLowPart = 0x000D0FD4;<br>
+ drvid->DriverVersionHighPart = 0x00060012;<br>
+ strncpy(drvid->Driver, "nvd3dum.dll", sizeof(drvid->Driver));<br>
+ break;<br>
+ default:<br>
+ break;<br>
+ }<br>
+}<br>
+<br>
+/* try to match the device name and override it with Windows like device names */<br>
+void d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid) {<br>
+ unsigned i;<br>
+ switch (drvid->VendorId) {<br>
+ case HW_VENDOR_INTEL:<br>
+ for (i = 0; i < sizeof(cards_intel) / sizeof(cards_intel[0]); i++) {<br>
+ if (strstr(drvid->Description, cards_intel[i].mesaname)) {<br>
+ strncpy(drvid->Description, cards_intel[i].d3d9name, sizeof(drvid->Description));<br>
+ return;<br>
+ }<br>
+ }<br>
+ /* use a fall-back if nothing matches */<br>
+ DBG("Unknown card name %s!\n", drvid->DeviceName);<br>
+ strncpy(drvid->Description, cards_intel[0].d3d9name, sizeof(drvid->Description));<br>
+ break;<br>
+ case HW_VENDOR_VMWARE:<br>
+ for (i = 0; i < sizeof(cards_vmware) / sizeof(cards_vmware[0]); i++) {<br>
+ if (strstr(drvid->Description, cards_vmware[i].mesaname)) {<br>
+ strncpy(drvid->Description, cards_vmware[i].d3d9name, sizeof(drvid->Description));<br>
+ return;<br>
+ }<br>
+ }<br>
+ /* use a fall-back if nothing matches */<br>
+ DBG("Unknown card name %s!\n", drvid->DeviceName);<br>
+ strncpy(drvid->Description, cards_vmware[0].d3d9name, sizeof(drvid->Description));<br>
+ break;<br>
+ case HW_VENDOR_AMD:<br>
+ for (i = 0; i < sizeof(cards_amd) / sizeof(cards_amd[0]); i++) {<br>
+ if (strstr(drvid->Description, cards_amd[i].mesaname)) {<br>
+ strncpy(drvid->Description, cards_amd[i].d3d9name, sizeof(drvid->Description));<br>
+ return;<br>
+ }<br>
+ }<br>
+ /* use a fall-back if nothing matches */<br>
+ DBG("Unknown card name %s!\n", drvid->DeviceName);<br>
+ strncpy(drvid->Description, cards_amd[0].d3d9name, sizeof(drvid->Description));<br>
+ break;<br>
+ case HW_VENDOR_NVIDIA:<br>
+ for (i = 0; i < sizeof(cards_nvidia) / sizeof(cards_nvidia[0]); i++) {<br>
+ if (strstr(drvid->Description, cards_nvidia[i].mesaname)) {<br>
+ strncpy(drvid->Description, cards_nvidia[i].d3d9name, sizeof(drvid->Description));<br>
+ return;<br>
+ }<br>
+ }<br>
+ /* use a fall-back if nothing matches */<br>
+ DBG("Unknown card name %s!\n", drvid->DeviceName);<br>
+ strncpy(drvid->Description, cards_nvidia[0].d3d9name, sizeof(drvid->Description));<br>
+ break;<br>
+ default:<br>
+ break;<br>
+ }<br>
+}<br>
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c<br>
index 680f516..fabc820 100644<br>
--- a/src/gallium/targets/d3dadapter9/drm.c<br>
+++ b/src/gallium/targets/d3dadapter9/drm.c<br>
@@ -46,12 +46,6 @@<br>
<br>
#define DBG_CHANNEL DBG_ADAPTER<br>
<br>
-#define VERSION_DWORD(hi, lo) \<br>
- ((DWORD)( \<br>
- ((DWORD)((hi) & 0xFFFF) << 16) | \<br>
- (DWORD)((lo) & 0xFFFF) \<br>
- ))<br>
-<br>
const char __driConfigOptionsNine[] =<br>
DRI_CONF_BEGIN<br>
DRI_CONF_SECTION_PERFORMANCE<br>
@@ -63,12 +57,21 @@ DRI_CONF_BEGIN<br>
DRI_CONF_SECTION_END<br>
DRI_CONF_END;<br>
<br>
-/* Regarding os versions, we should not define our own as that would simply be<br>
- * weird. Defaulting to Win2k/XP seems sane considering the origin of D3D9. The<br>
- * driver also defaults to being a generic D3D9 driver, which of course only<br>
- * matters if you're actually using the DDI. */<br>
-#define VERSION_HIGH VERSION_DWORD(0x0006, 0x000E) /* winxp, d3d9 */<br>
-#define VERSION_LOW VERSION_DWORD(0x0000, 0x0001) /* version, build */<br>
+/* define fallback value here: NVIDIA GeForce GTX 970 */<br>
+#define FALLBACK_NAME "NV124"<br>
+#define FALLBACK_DEVID 0x13C2<br>
+#define FALLBACK_VENID 0x10de<br>
+<br>
+/* prototypes */<br>
+void<br>
+d3d_match_vendor_id( D3DADAPTER_IDENTIFIER9* drvid,<br>
+ unsigned fallback_ven,<br>
+ unsigned fallback_dev,<br>
+ const char* fallback_name );<br>
+<br>
+void d3d_fill_driver_version(D3DADAPTER_IDENTIFIER9* drvid);<br>
+<br>
+void d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid);<br>
<br>
struct d3dadapter9drm_context<br>
{<br>
@@ -152,9 +155,9 @@ get_bus_info( int fd,<br>
*subsysid = 0;<br>
*revision = 0;<br>
} else {<br>
- DBG("Unable to detect card. Fake GTX 680.\n");<br>
- *vendorid = 0x10de; /* NV GTX 680 */<br>
- *deviceid = 0x1180;<br>
+ DBG("Unable to detect card. Faking %s\n", FALLBACK_NAME);<br>
+ *vendorid = FALLBACK_VENID;<br>
+ *deviceid = FALLBACK_DEVID;<br>
*subsysid = 0;<br>
*revision = 0;<br>
}<br>
@@ -169,33 +172,23 @@ read_descriptor( struct d3dadapter9_context *ctx,<br>
memset(drvid, 0, sizeof(*drvid));<br>
get_bus_info(fd, &drvid->VendorId, &drvid->DeviceId,<br>
&drvid->SubSysId, &drvid->Revision);<br>
+ snprintf(drvid->DeviceName, sizeof(drvid->DeviceName),<br>
+ "Gallium 0.4 with %s", ctx->hal->get_vendor(ctx->hal));<br>
+ strncpy(drvid->Description, ctx->hal->get_name(ctx->hal),<br>
+ sizeof(drvid->Description));<br>
+<br>
+ /* choose fall-back vendor if necessary to allow<br>
+ * the following functions to return sane results */<br>
+ d3d_match_vendor_id(drvid, FALLBACK_VENID, FALLBACK_DEVID, FALLBACK_NAME);<br>
+ /* fill in driver name and version info */<br>
+ d3d_fill_driver_version(drvid);<br>
+ /* override Description field with Windows like names */<br>
+ d3d_fill_cardname(drvid);<br>
+<br>
+ /* this driver isn't WHQL certified */<br>
+ drvid->WHQLLevel = 0;<br>
<br>
- strncpy(drvid->Driver, "libd3dadapter9.so", sizeof(drvid->Driver));<br>
- strncpy(drvid->DeviceName, ctx->hal->get_name(ctx->hal), 32);<br>
- snprintf(drvid->Description, sizeof(drvid->Description),<br>
- "Gallium 0.4 with %s", ctx->hal->get_vendor(ctx->hal));<br>
-<br>
- drvid->DriverVersionLowPart = VERSION_LOW;<br>
- drvid->DriverVersionHighPart = VERSION_HIGH;<br>
-<br>
- /* To make a pseudo-real GUID we use the PCI bus data and some string */<br>
- drvid->DeviceIdentifier.Data1 = drvid->VendorId;<br>
- drvid->DeviceIdentifier.Data2 = drvid->DeviceId;<br>
- drvid->DeviceIdentifier.Data3 = drvid->SubSysId;<br>
- memcpy(drvid->DeviceIdentifier.Data4, "Gallium3D", 8);<br>
-<br>
- drvid->WHQLLevel = 1; /* This fakes WHQL validaion */<br>
-<br>
- /* XXX Fake NVIDIA binary driver on Windows.<br>
- *<br>
- * OS version: 4=95/98/NT4, 5=2000, 6=2000/XP, 7=Vista, 8=Win7<br>
- */<br>
- strncpy(drvid->Driver, "nvd3dum.dll", sizeof(drvid->Driver));<br>
- strncpy(drvid->Description, "NVIDIA GeForce GTX 680", sizeof(drvid->Description));<br>
- drvid->DriverVersionLowPart = VERSION_DWORD(12, 6658); /* minor, build */<br>
- drvid->DriverVersionHighPart = VERSION_DWORD(6, 15); /* OS, major */<br>
- drvid->SubSysId = 0;<br>
- drvid->Revision = 0;<br>
+ /* this value is fixed */<br>
drvid->DeviceIdentifier.Data1 = 0xaeb2cdd4;<br>
drvid->DeviceIdentifier.Data2 = 0x6e41;<br>
drvid->DeviceIdentifier.Data3 = 0x43ea;<br>
@@ -207,7 +200,6 @@ read_descriptor( struct d3dadapter9_context *ctx,<br>
drvid->DeviceIdentifier.Data4[5] = 0x76;<br>
drvid->DeviceIdentifier.Data4[6] = 0x07;<br>
drvid->DeviceIdentifier.Data4[7] = 0x81;<br>
- drvid->WHQLLevel = 0;<br>
}<br>
<br>
static HRESULT WINAPI<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>