-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi, I'm upstreaming a merge of two patches taken from the FreeBSD ports tree & NetBSD's pkgsrc tree so the credit/blame is not mine. :) The FreeBSD part resolves building libdrm on a host which may not have a KMS module loaded hence a sysctl will not be present. The other part adds NetBSD support. Regards Sevan Janiyan -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJVKK39AAoJENE/+DdOy3tCc0YP/2rME7gJJSNT7kpCVCctr8pt 8yjowGkeYYfiVEDFDhB1ZQ+LL7KEmECAWJjBYCB1P1T3Mzl8LBYbaIBcAQ3rLjsE vbcuFWmW/xq+WaqzyK1cqxcOXXYnrpXyPG8IkAj1k66TWGJF1QSG9qtEQ/W5W7IC bVFJtLVCSn3GrY9Kyp1oP0qQW8IHuh+74uDIdXEG1ZMKQtytv0C2AVGBKJIyd37z KP2v38K0hlmZdLcaBubwI6YBE5/02yTm83SvecApuJO0KyhMKG1qrJRQMXepKV2O TVuWDlwRWmSjClAOaAmL8RhUpFF1zFqlDiUlsczXGDRqxDErtvRte8TP9ktV2IcN A61iPZTEDXbPeJxuEX6P4wJSGhqrgd/L7WEXX1FUXKWInohzrKGya2cVi+L8uMjm c65JAmzA9jyMUebluJlrfGNInN0hZ0lRvwyFEW5PvLKJT//N3ybqHqQXFLvoAjI5 PZrnz9gzPWS6gQiMb3fUr8pFsE7Dxxlqc0RqlNQ6yzpKX6CePPmO5MVb+ktY72ad cmdCe1J2EXUDIC9/A2y61/3XuS3jrjFSoZzpw4JOYf2TL3jq1NOnUS8XzXDaySJM ouMV+6ERlcN5DriMvZpx81ZBJWwgP3yyy7nj4CTpivMOU4i1iTbVrLEDv60sMLdY C/dpQFub+sJzWY2y4s2/ =PAg4 -----END PGP SIGNATURE-----
diff --git a/xf86drmMode.c b/xf86drmMode.c index 61d5e01..bb1dcc2 100644 --- a/xf86drmMode.c +++ b/xf86drmMode.c @@ -771,38 +771,20 @@ int drmCheckModesettingSupported(const char *busid) 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 0; +#elif defined(__NetBSD__) + int fd; + static const struct drm_mode_card_res zero_res; + struct drm_mode_card_res res = zero_res; + int ret; + + fd = drmOpen(NULL, busid); + if (fd == -1) 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); - } + ret = drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res); + drmClose(fd); + if (ret == 0) + return 0; #elif defined(__DragonFly__) return 0; #endif @@ -907,7 +889,7 @@ int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id, int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, - int32_t crtc_x, int32_t crtc_y, + uint32_t crtc_x, uint32_t crtc_y, uint32_t crtc_w, uint32_t crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h)
Attachment:
git-drm.txt.sig
Description: Binary data
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel