dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libdrm] xf86drmMode: Implement drmCheckModesettingSupported() for OpenBSD
@ 2015-07-18 21:20 Jonathan Gray
  2015-07-20 16:19 ` Emil Velikov
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Gray @ 2015-07-18 21:20 UTC (permalink / raw)
  To: dri-devel; +Cc: emil.l.velikov

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

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
---
 xf86drmMode.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/xf86drmMode.c b/xf86drmMode.c
index 529429e..1a199fa 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -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,
-- 
2.4.5

_______________________________________________
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 libdrm] xf86drmMode: Implement drmCheckModesettingSupported() for OpenBSD
  2015-07-18 21:20 [PATCH libdrm] xf86drmMode: Implement drmCheckModesettingSupported() for OpenBSD Jonathan Gray
@ 2015-07-20 16:19 ` Emil Velikov
  0 siblings, 0 replies; 2+ messages in thread
From: Emil Velikov @ 2015-07-20 16:19 UTC (permalink / raw)
  To: Jonathan Gray; +Cc: ML dri-devel

On 18 July 2015 at 22:20, Jonathan Gray <jsg@jsg.id.au> wrote:
> This is implemented with kms ioctls so it could also be used as a
> generic fallback.
>
> Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
> ---
>  xf86drmMode.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/xf86drmMode.c b/xf86drmMode.c
> index 529429e..1a199fa 100644
> --- a/xf86drmMode.c
> +++ b/xf86drmMode.c
> @@ -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;
>  }
>
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
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>

-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-07-20 16:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-18 21:20 [PATCH libdrm] xf86drmMode: Implement drmCheckModesettingSupported() for OpenBSD Jonathan Gray
2015-07-20 16:19 ` Emil Velikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).