summaryrefslogtreecommitdiff
path: root/bsd-core/drm_drv.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-08-26 00:16:01 +0000
committerEric Anholt <anholt@freebsd.org>2005-08-26 00:16:01 +0000
commit55bea952b326b88f2fa6502321f605f96ee9be66 (patch)
tree9de73f0fa9527d8e3954808e7cb30493f166d1ac /bsd-core/drm_drv.c
parent9942cad1f6078c24bb69a126795635b2f34d65b5 (diff)
[1] Fix BSD DRM for the nonroot changes. [2] Don't attempt to acquire the
DMA lock in a non-DMA driver, as it will be uninitialized. Submitted by: [1] jkim (minor changes by me)
Diffstat (limited to 'bsd-core/drm_drv.c')
-rw-r--r--bsd-core/drm_drv.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index d9784073..c4ee39cb 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -33,6 +33,7 @@
#include "drmP.h"
#include "drm.h"
+#include "drm_sarea.h"
int drm_debug_flag = 0;
@@ -357,10 +358,17 @@ drm_pci_id_list_t *drm_find_description(int vendor, int device,
static int drm_firstopen(drm_device_t *dev)
{
+ drm_local_map_t *map;
int i;
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
+ /* prebuild the SAREA */
+ i = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM,
+ _DRM_CONTAINS_LOCK, &map);
+ if (i != 0)
+ return i;
+
if (dev->driver.firstopen)
dev->driver.firstopen(dev);
@@ -388,7 +396,6 @@ static int drm_firstopen(drm_device_t *dev)
dev->magiclist[i].tail = NULL;
}
- dev->lock.hw_lock = NULL;
dev->lock.lock_queue = 0;
dev->irq_enabled = 0;
dev->context_flag = 0;
@@ -851,9 +858,9 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
/* ioctl->master check should be against something in the filp set up
* for the first opener, but it doesn't matter yet.
*/
- if ((ioctl->root_only && DRM_SUSER(p)) ||
+ if ((ioctl->root_only && !DRM_SUSER(p)) ||
(ioctl->auth_needed && !priv->authenticated) ||
- (ioctl->master && !DRM_SUSER(p)))
+ (ioctl->master && !priv->master))
return EACCES;
if (is_driver_ioctl)