summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-04-11 06:15:18 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-04-11 06:15:18 +0000
commit67e983d26d1674b10b76bc51fccc7bd3737d5960 (patch)
tree94584c143d4db13796f2d4395ff01178ee59f2ff /lib
parent3cac43ec602c6af9c1ca11a4a3a6a9d39e6f92b7 (diff)
update to libdrm 2.4.53
For us the only code change is some new radeon_drm.h defines as the xf86drmMode.c change is ifdef __FreeBSD__.
Diffstat (limited to 'lib')
-rw-r--r--lib/libdrm/Makefile.inc4
-rw-r--r--lib/libdrm/xf86drmMode.c35
2 files changed, 36 insertions, 3 deletions
diff --git a/lib/libdrm/Makefile.inc b/lib/libdrm/Makefile.inc
index ef70b3937..79ebb708b 100644
--- a/lib/libdrm/Makefile.inc
+++ b/lib/libdrm/Makefile.inc
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile.inc,v 1.10 2014/03/15 05:05:55 jsg Exp $
+# $OpenBSD: Makefile.inc,v 1.11 2014/04/11 06:15:17 jsg Exp $
-PACKAGE_VERSION= 2.4.52
+PACKAGE_VERSION= 2.4.53
NOPROFILE=
diff --git a/lib/libdrm/xf86drmMode.c b/lib/libdrm/xf86drmMode.c
index 5459d6c2c..731e6aceb 100644
--- a/lib/libdrm/xf86drmMode.c
+++ b/lib/libdrm/xf86drmMode.c
@@ -723,7 +723,7 @@ int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property
*/
int drmCheckModesettingSupported(const char *busid)
{
-#ifdef __linux__
+#if defined (__linux__)
char pci_dev_dir[1024];
int domain, bus, dev, func;
DIR *sysdir;
@@ -773,6 +773,39 @@ int drmCheckModesettingSupported(const char *busid)
closedir(sysdir);
if (found)
return 0;
+#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
+ char kbusid[1024], sbusid[1024];
+ char oid[128];
+ int domain, bus, dev, func;
+ int i, modesetting, ret;
+ size_t len;
+
+ ret = sscanf(busid, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev,
+ &func);
+ if (ret != 4)
+ return -EINVAL;
+ snprintf(kbusid, sizeof(kbusid), "pci:%04x:%02x:%02x.%d", domain, bus,
+ dev, func);
+
+ /* How many GPUs do we expect in the machine ? */
+ for (i = 0; i < 16; i++) {
+ snprintf(oid, sizeof(oid), "hw.dri.%d.busid", i);
+ len = sizeof(sbusid);
+ ret = sysctlbyname(oid, sbusid, &len, NULL, 0);
+ if (ret == -1) {
+ if (errno == ENOENT)
+ continue;
+ return -EINVAL;
+ }
+ if (strcmp(sbusid, kbusid) != 0)
+ continue;
+ snprintf(oid, sizeof(oid), "hw.dri.%d.modesetting", i);
+ len = sizeof(modesetting);
+ ret = sysctlbyname(oid, &modesetting, &len, NULL, 0);
+ if (ret == -1 || len != sizeof(modesetting))
+ return -EINVAL;
+ return (modesetting ? 0 : -ENOSYS);
+ }
#endif
#ifdef __OpenBSD__
int fd;