diff options
author | anholt <anholt@FreeBSD.org> | 2004-01-06 04:34:53 +0000 |
---|---|---|
committer | anholt <anholt@FreeBSD.org> | 2004-01-06 04:34:53 +0000 |
commit | 7a30cbbe36c3da10547bc71289118de8e9bf0798 (patch) | |
tree | dc23cbfd6e49f2154d34faf1bfc9e044ed6193d3 /sys/dev/drm/drm_bufs.h | |
parent | 6ecda71663ef14ce4784c7105163615d9178cfb9 (diff) | |
download | FreeBSD-src-7a30cbbe36c3da10547bc71289118de8e9bf0798.zip FreeBSD-src-7a30cbbe36c3da10547bc71289118de8e9bf0798.tar.gz |
Merge from DRI CVS. No longer maps the framebuffer into KVA on radeon, r128,
and mga. MTRR code cleanups. Includes new Radeon and Rage 128 PCI IDs.
Diffstat (limited to 'sys/dev/drm/drm_bufs.h')
-rw-r--r-- | sys/dev/drm/drm_bufs.h | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/sys/dev/drm/drm_bufs.h b/sys/dev/drm/drm_bufs.h index 8b278f8..8b40f98 100644 --- a/sys/dev/drm/drm_bufs.h +++ b/sys/dev/drm/drm_bufs.h @@ -88,7 +88,7 @@ int DRM(addmap)( DRM_IOCTL_ARGS ) map->size = request.size; map->type = request.type; map->flags = request.flags; - map->mtrr = -1; + map->mtrr = 0; map->handle = 0; /* Only allow shared memory to be removable since we only keep enough @@ -105,28 +105,23 @@ int DRM(addmap)( DRM_IOCTL_ARGS ) DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); return DRM_ERR(EINVAL); } + if (map->offset + map->size < map->offset) { + DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); + return DRM_ERR(EINVAL); + } switch ( map->type ) { case _DRM_REGISTERS: + DRM_IOREMAP(map, dev); + if (!(map->flags & _DRM_WRITE_COMBINING)) + break; + /* FALLTHROUGH */ case _DRM_FRAME_BUFFER: - if ( map->offset + map->size < map->offset ) { - DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - return DRM_ERR(EINVAL); - } #if __REALLY_HAVE_MTRR - if ( map->type == _DRM_FRAME_BUFFER || - (map->flags & _DRM_WRITE_COMBINING) ) { - int mtrr; - - mtrr = DRM(mtrr_add)(map->offset, map->size, - DRM_MTRR_WC); - if (mtrr == 0) - map->mtrr = 1; - } -#endif /* __REALLY_HAVE_MTRR */ - DRM_IOREMAP(map, dev); + if (DRM(mtrr_add)(map->offset, map->size, DRM_MTRR_WC) == 0) + map->mtrr = 1; +#endif break; - case _DRM_SHM: map->handle = (void *)DRM(alloc)(map->size, DRM_MEM_SAREA); DRM_DEBUG( "%lu %d %p\n", @@ -153,7 +148,7 @@ int DRM(addmap)( DRM_IOCTL_ARGS ) #if __REALLY_HAVE_AGP case _DRM_AGP: map->offset += dev->agp->base; - map->mtrr = dev->agp->agp_mtrr; /* for getmap */ + map->mtrr = dev->agp->mtrr; /* for getmap */ break; #endif case _DRM_SCATTER_GATHER: @@ -232,12 +227,12 @@ int DRM(rmmap)( DRM_IOCTL_ARGS ) case _DRM_REGISTERS: case _DRM_FRAME_BUFFER: #if __REALLY_HAVE_MTRR - if (map->mtrr >= 0) { - int __unused mtrr; + if (map->mtrr) { + int __unused retcode; - mtrr = DRM(mtrr_del)(map->offset, map->size, + retcode = DRM(mtrr_del)(map->offset, map->size, DRM_MTRR_WC); - DRM_DEBUG("mtrr_del = %d\n", mtrr); + DRM_DEBUG("mtrr_del = %d\n", retcode); } #endif DRM(ioremapfree)(map); |