diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2012-12-06 14:46:18 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2012-12-06 14:46:18 +0000 |
commit | 640919dd496ff4311222ad1c5ccad0ee54e5cb1a (patch) | |
tree | a2eba9260bf455814f80e15005e7af16da18556e | |
parent | 80a6adf3ba06aa791ceef8a157d0d3c783fe01f9 (diff) |
Make sure we try to unbind AGP memory regions if the aperture base address
is 0, otherwise we never free the memory region bound at offset 0x00 when
exiting X on macppc.
ok kettenis@ as part of larger diff
-rw-r--r-- | sys/dev/pci/drm/drm_agpsupport.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drm_agpsupport.c b/sys/dev/pci/drm/drm_agpsupport.c index 4539f5070ad..51fe6c88b42 100644 --- a/sys/dev/pci/drm/drm_agpsupport.c +++ b/sys/dev/pci/drm/drm_agpsupport.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_agpsupport.c,v 1.22 2012/09/08 16:42:20 mpi Exp $ */ +/* $OpenBSD: drm_agpsupport.c,v 1.23 2012/12/06 14:46:17 mpi Exp $ */ /*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. @@ -215,7 +215,16 @@ drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request) DRM_LOCK(); entry = drm_agp_lookup_entry(dev, (void *)request->handle); - if (entry == NULL || !entry->bound) { + /* + * If the AGP bridge has an aperture base address of 0 and + * the entry is bound with an offset of 0, entry->bound will + * not reflect the reality. + * + * XXX This means that we may try to unbind unbound entries + * with such an AGP bridge, but it should be safe because + * agp_unbind_memory() has a correct check for bound memory. + */ + if (entry == NULL || (!entry->bound && dev->agp->base)) { DRM_UNLOCK(); return (EINVAL); } |