summaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/d3dadapter9/drm.c
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2015-01-10 18:49:16 +0100
committerAxel Davy <[email protected]>2015-02-06 00:07:19 +0100
commit8f50614910c40366d94964fe2c5da5772aff2f96 (patch)
tree076e6684141d055f7b407fda5b7e2dd2b76cf115 /src/gallium/targets/d3dadapter9/drm.c
parent2c54d154e86cd93caed527824166f468a6c24c70 (diff)
gallium/targets/d3dadapter9: Fix device detection for render-nodes
When on a render node the unique ioctl doesn't work. This patch drops the code to detect the device, which relied on an ioctl, and replaces it by the mesa loader function. The mesa loader function is more complete and won't fail for render-nodes. Alternatively we could also have used the pipe cap to determine the vendor and device id from the driver. Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/targets/d3dadapter9/drm.c')
-rw-r--r--src/gallium/targets/d3dadapter9/drm.c59
1 files changed, 14 insertions, 45 deletions
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index dd916f1ea73..bdc402fea24 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -135,53 +135,22 @@ get_bus_info( int fd,
DWORD *subsysid,
DWORD *revision )
{
- drm_unique_t u;
-
- u.unique_len = 0;
- u.unique = NULL;
-
- if (ioctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) { return; }
- u.unique = CALLOC(u.unique_len+1, 1);
-
- if (ioctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) { return; }
- u.unique[u.unique_len] = '\0';
-
- DBG("DRM Device BusID: %s\n", u.unique);
- if (strncmp("pci:", u.unique, 4) == 0) {
- char fname[512]; /* this ought to be enough */
- int l = snprintf(fname, 512, "/sys/bus/pci/devices/%s/", u.unique+4);
-
- /* VendorId */
- snprintf(fname+l, 512-l, "vendor");
- *vendorid = read_file_dword(fname);
- /* DeviceId */
- snprintf(fname+l, 512-l, "device");
- *deviceid = read_file_dword(fname);
- /* SubSysId */
- snprintf(fname+l, 512-l, "subsystem_device");
- *subsysid = (read_file_dword(fname) << 16) & 0xFFFF0000;
- snprintf(fname+l, 512-l, "subsystem_vendor");
- *subsysid |= read_file_dword(fname) & 0x0000FFFF;
- /* Revision */
- {
- int cfgfd;
-
- snprintf(fname+l, 512-l, "config");
- cfgfd = open(fname, O_RDONLY);
- if (cfgfd >= 0) {
- *revision = read_config_dword(cfgfd, 0x8) & 0x000000FF;
- close(cfgfd);
- } else {
- DBG("Unable to get raw PCI information from `%s'\n", fname);
- }
- }
- DBG("PCI info: vendor=0x%04x, device=0x%04x, subsys=0x%08x, rev=%d\n",
- *vendorid, *deviceid, *subsysid, *revision);
+ int vid, did;
+
+ if (loader_get_pci_id_for_fd(fd, &vid, &did)) {
+ DBG("PCI info: vendor=0x%04x, device=0x%04x\n",
+ vid, did);
+ *vendorid = vid;
+ *deviceid = did;
+ *subsysid = 0;
+ *revision = 0;
} else {
- DBG("Unsupported BusID type.\n");
+ DBG("Unable to detect card. Fake GTX 680.\n");
+ *vendorid = 0x10de; /* NV GTX 680 */
+ *deviceid = 0x1180;
+ *subsysid = 0;
+ *revision = 0;
}
-
- FREE(u.unique);
}
static INLINE void