From c2d7ff1bf98f92add98fb76b63d2bdb190f3cf2c Mon Sep 17 00:00:00 2001 From: David Dawes Date: Thu, 17 Apr 2003 18:41:28 +0000 Subject: Bring some drm module changes over from the XFree86 trunk: - Reset 'bound' flag for an agp entry after undbind succeeded in drm_agpsupport.h (Egbert Eich). - Ignore hw_lock for drm device if lock was set by a different instance (ie Xserver) to prevent second server from spinning in driver release function (currently only relevant for i8xx drm drivers) (David Dawes). - Use the agpgart "key" for the unique handle for bindings rather than the memory address (the key is guaranteed to be unique) (David Dawes). --- linux-core/drm_agpsupport.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'linux-core/drm_agpsupport.c') diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c index 35dd866f..22790900 100644 --- a/linux-core/drm_agpsupport.c +++ b/linux-core/drm_agpsupport.c @@ -147,7 +147,7 @@ int DRM(agp_alloc)(struct inode *inode, struct file *filp, return -ENOMEM; } - entry->handle = (unsigned long)memory->memory; + entry->handle = (unsigned long)memory->key; entry->memory = memory; entry->bound = 0; entry->pages = pages; @@ -187,6 +187,7 @@ int DRM(agp_unbind)(struct inode *inode, struct file *filp, drm_device_t *dev = priv->dev; drm_agp_binding_t request; drm_agp_mem_t *entry; + int ret; if (!dev->agp || !dev->agp->acquired) return -EINVAL; if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request))) @@ -194,7 +195,10 @@ int DRM(agp_unbind)(struct inode *inode, struct file *filp, if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) return -EINVAL; if (!entry->bound) return -EINVAL; - return DRM(unbind_agp)(entry->memory); + ret = DRM(unbind_agp)(entry->memory); + if (ret == 0) + entry->bound = 0; + return ret; } int DRM(agp_bind)(struct inode *inode, struct file *filp, -- cgit v1.2.3