All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sevan Janiyan <venture37@geeklan.co.uk>
To: dri-devel@lists.freedesktop.org
Subject: Patch - FreeBSD & NetBSD support
Date: Sat, 11 Apr 2015 06:15:41 +0100	[thread overview]
Message-ID: <5528ADFD.1050004@geeklan.co.uk> (raw)

[-- 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

             reply	other threads:[~2015-04-11  5:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-11  5:15 Sevan Janiyan [this message]
2015-04-12 13:41 ` Patch - FreeBSD & NetBSD support Emil Velikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5528ADFD.1050004@geeklan.co.uk \
    --to=venture37@geeklan.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.