* Patch - FreeBSD & NetBSD support
@ 2015-04-11 5:15 Sevan Janiyan
2015-04-12 13:41 ` Emil Velikov
0 siblings, 1 reply; 2+ messages in thread
From: Sevan Janiyan @ 2015-04-11 5:15 UTC (permalink / raw)
To: dri-devel
[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]
-----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-----
[-- Attachment #2: git-drm.txt --]
[-- Type: text/plain, Size: 1952 bytes --]
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 #3: git-drm.txt.sig --]
[-- Type: application/octet-stream, Size: 543 bytes --]
[-- Attachment #4: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: Patch - FreeBSD & NetBSD support
2015-04-11 5:15 Patch - FreeBSD & NetBSD support Sevan Janiyan
@ 2015-04-12 13:41 ` Emil Velikov
0 siblings, 0 replies; 2+ messages in thread
From: Emil Velikov @ 2015-04-12 13:41 UTC (permalink / raw)
To: Sevan Janiyan; +Cc: Emil Velikov, ML dri-devel
Hi Sevan,
Big thanks for going through this. It's always nice to hear back the
BSD folk :-)
On 11 April 2015 at 06:15, Sevan Janiyan <venture37@geeklan.co.uk> wrote:
>
> 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.
>
Can you split this into smaller patches and send them with git
send-email. This will allow you to preserve the authorship of the
individual changes, and will ease review. From a quick looks the
FreeBSD part seems to break existing behaviour, so it would be nice to
get some feedback (acked-by/reviewed-by/etc.) from the original author
or current maintainers.
Thanks
Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-12 13:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-11 5:15 Patch - FreeBSD & NetBSD support Sevan Janiyan
2015-04-12 13:41 ` Emil Velikov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.