summaryrefslogtreecommitdiffstats
path: root/sys/dev/drm/drm_drv.c
diff options
context:
space:
mode:
authorrnoland <rnoland@FreeBSD.org>2010-04-22 18:21:25 +0000
committerrnoland <rnoland@FreeBSD.org>2010-04-22 18:21:25 +0000
commitb733ebaa1ccc608f662359519c4712cf384b1360 (patch)
tree4cbae1e0936ed160e9fca32b44038b3450bb6072 /sys/dev/drm/drm_drv.c
parentc0d6a78ddcc9bdcf4f9ee2858efab1abf0db5bdf (diff)
downloadFreeBSD-src-b733ebaa1ccc608f662359519c4712cf384b1360.zip
FreeBSD-src-b733ebaa1ccc608f662359519c4712cf384b1360.tar.gz
Rework how drm maps are handled.
* On 32 bit platforms we steal the upper 4 bits of the map handle to store a unique map id. * On 64 bit platforms we steal the upper 24 bits. Resolves issues where the offsets that are handed to mmap may overlap the VRAM on some cards. Tested on: radeon, intel, mga, and via. This will break nouveau. I will spin new patches shortly.
Diffstat (limited to 'sys/dev/drm/drm_drv.c')
-rw-r--r--sys/dev/drm/drm_drv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/dev/drm/drm_drv.c b/sys/dev/drm/drm_drv.c
index c690c34..8d9bc69 100644
--- a/sys/dev/drm/drm_drv.c
+++ b/sys/dev/drm/drm_drv.c
@@ -434,6 +434,12 @@ static int drm_load(struct drm_device *dev)
DRM_DEBUG("\n");
TAILQ_INIT(&dev->maplist);
+ dev->map_unrhdr = new_unrhdr(1, ((1 << DRM_MAP_HANDLE_BITS) - 1), NULL);
+ if (dev->map_unrhdr == NULL) {
+ DRM_ERROR("Couldn't allocate map number allocator\n");
+ return EINVAL;
+ }
+
drm_mem_init();
drm_sysctl_init(dev);
@@ -565,6 +571,7 @@ static void drm_unload(struct drm_device *dev)
}
delete_unrhdr(dev->drw_unrhdr);
+ delete_unrhdr(dev->map_unrhdr);
drm_mem_uninit();
OpenPOWER on IntegriCloud