summaryrefslogtreecommitdiff
path: root/bsd/drm_bufs.h
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2003-12-16 08:57:08 +0000
committerEric Anholt <anholt@freebsd.org>2003-12-16 08:57:08 +0000
commit9fb6986e83a84f6b958e8aba2c20b5988676bd55 (patch)
tree466fa7fd9089d1b7aa4e1257096e177a2c6034c0 /bsd/drm_bufs.h
parent5285b029876a4d3122ae72cc3d81ca8d184ed9ca (diff)
Don't ioremap the framebuffer area. The ioremapped area wasn't used by
anything, and took up valuable KVA. While I'm in the area, clean up BSD MTRR stuff some more. Suggested by: jonsmirl
Diffstat (limited to 'bsd/drm_bufs.h')
-rw-r--r--bsd/drm_bufs.h39
1 files changed, 17 insertions, 22 deletions
diff --git a/bsd/drm_bufs.h b/bsd/drm_bufs.h
index 15d4a3b1..4bcd012a 100644
--- a/bsd/drm_bufs.h
+++ b/bsd/drm_bufs.h
@@ -87,7 +87,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
@@ -104,28 +104,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",
@@ -152,7 +147,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:
@@ -231,12 +226,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);