Skip to contentSkip to conversation

xf86drmMode: Implement drmCheckModesettingSupported() for OpenBSD

PATCH In review Jonathan Gray 2 participants 2 messages Jul 18, 2015 – Jul 20, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xf86drmMode: Implement drmCheckModesettingSupported() for OpenBSD

This is implemented with kms ioctls so it could also be used as a generic fallback.

---
 xf86drmMode.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
xf86drmMode.c +18 -1
index 529429e..1a199fa 100644
@@ -822,8 +822,25 @@ int drmCheckModesettingSupported(const char *busid)
 #elif defined(__DragonFly__)
 	return 0;
 #endif
-	return -ENOSYS;
+#ifdef __OpenBSD__
+	int	fd;
+	struct drm_mode_card_res res;
+	drmModeResPtr r = 0;
+
+	if ((fd = drmOpen(NULL, busid)) < 0)
+		return -EINVAL;
+
+	memset(&res, 0, sizeof(struct drm_mode_card_res));
 
+	if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res)) {
+		drmClose(fd);
+		return -errno;
+	}
+
+	drmClose(fd);
+	return 0;
+#endif
+	return -ENOSYS;
 }
 
 int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
Signature · 6 lines
2.4.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Jonathan Gray

This is implemented with kms ioctls so it could also be used as a generic fallback.

---
 xf86drmMode.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
xf86drmMode.c +10 -1
index 529429e..1a199fa 100644
@@ -822,8 +822,25 @@ int drmCheckModesettingSupported(const char *busid)
 #elif defined(__DragonFly__)
        return 0;
 #endif
-       return -ENOSYS;
+#ifdef __OpenBSD__
+       int     fd;
+       struct drm_mode_card_res res;
+       drmModeResPtr r = 0;
+
+       if ((fd = drmOpen(NULL, busid)) < 0)
+               return -EINVAL;
+
+       memset(&res, 0, sizeof(struct drm_mode_card_res));
 
+       if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res)) {

xf86drmMode.c int drmCheckModesettingSupported(const char *busid) · line 845

Quoted 10 lines
xf86drmMode.c +8 -0
+               drmClose(fd);
+               return -errno;
+       }
+
+       drmClose(fd);
+       return 0;
+#endif
+       return -ENOSYS;
 }
 

Not 100% on it yet, but might end up deprecated (there'll be time for everyone can object, of course). Until/if that happens we can use this.

With the minor nitpicks on the other two patches, that whole 3 "set" is

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel