summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-12-01 01:37:18 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-12-01 01:37:18 +0000
commit92ccf7b4258b5797e7c4007278432e7a454c37f9 (patch)
tree30df494c29eb7c62a9bb4edbc8edb1a3af680952 /sys/dev/pci
parentc7091b0c9c31b89c777d10177de816f0ada6fa06 (diff)
Add noop drm SET_MASTER and DROP_MASTER ioctls. This will allow
reducing the local diff in libdrm. We only handle a single master as xorg privdrop has already occurred at the point where the ioctls are issued.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/drm.h5
-rw-r--r--sys/dev/pci/drm/drm_drv.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drm.h b/sys/dev/pci/drm/drm.h
index 0bde3617efd..ace6168c7b3 100644
--- a/sys/dev/pci/drm/drm.h
+++ b/sys/dev/pci/drm/drm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm.h,v 1.21 2016/11/25 23:33:39 jsg Exp $ */
+/* $OpenBSD: drm.h,v 1.22 2016/12/01 01:37:17 jsg Exp $ */
/**
* \file drm.h
* Header for the Direct Rendering Manager
@@ -764,6 +764,9 @@ struct drm_pciinfo {
#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map)
#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map)
+#define DRM_IOCTL_SET_MASTER DRM_IO(0x1e)
+#define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f)
+
#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx)
#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx)
#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx)
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c
index afd36baf2e5..3660953dc14 100644
--- a/sys/dev/pci/drm/drm_drv.c
+++ b/sys/dev/pci/drm/drm_drv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_drv.c,v 1.150 2016/11/25 23:33:39 jsg Exp $ */
+/* $OpenBSD: drm_drv.c,v 1.151 2016/12/01 01:37:17 jsg Exp $ */
/*-
* Copyright 2007-2009 Owain G. Ainsworth <oga@openbsd.org>
* Copyright © 2008 Intel Corporation
@@ -130,7 +130,13 @@ static struct drm_ioctl_desc drm_ioctls[] = {
#ifdef __linux__
DRM_IOCTL_DEF(DRM_IOCTL_SET_MASTER, drm_setmaster_ioctl, DRM_ROOT_ONLY),
DRM_IOCTL_DEF(DRM_IOCTL_DROP_MASTER, drm_dropmaster_ioctl, DRM_ROOT_ONLY),
+#else
+ /* On OpenBSD xorg privdrop has already occurred before this point */
+ DRM_IOCTL_DEF(DRM_IOCTL_SET_MASTER, drm_noop, DRM_UNLOCKED|DRM_RENDER_ALLOW),
+ DRM_IOCTL_DEF(DRM_IOCTL_DROP_MASTER, drm_noop, DRM_UNLOCKED|DRM_RENDER_ALLOW),
+#endif
+#ifdef __linux__
DRM_IOCTL_DEF(DRM_IOCTL_ADD_CTX, drm_addctx, DRM_AUTH|DRM_ROOT_ONLY),
DRM_IOCTL_DEF(DRM_IOCTL_RM_CTX, drm_rmctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
#endif