From b733ebaa1ccc608f662359519c4712cf384b1360 Mon Sep 17 00:00:00 2001 From: rnoland Date: Thu, 22 Apr 2010 18:21:25 +0000 Subject: 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. --- sys/dev/drm/radeon_state.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/dev/drm/radeon_state.c') diff --git a/sys/dev/drm/radeon_state.c b/sys/dev/drm/radeon_state.c index fd8388f..8061501 100644 --- a/sys/dev/drm/radeon_state.c +++ b/sys/dev/drm/radeon_state.c @@ -1420,7 +1420,7 @@ static void radeon_cp_dispatch_swap(struct drm_device *dev) static void radeon_cp_dispatch_flip(struct drm_device *dev) { drm_radeon_private_t *dev_priv = dev->dev_private; - struct drm_sarea *sarea = (struct drm_sarea *)dev_priv->sarea->handle; + struct drm_sarea *sarea = (struct drm_sarea *)dev_priv->sarea->virtual; int offset = (dev_priv->sarea_priv->pfCurrentPage == 1) ? dev_priv->front_offset : dev_priv->back_offset; RING_LOCALS; @@ -1582,7 +1582,7 @@ static void radeon_cp_dispatch_indirect(struct drm_device * dev, */ if (dwords & 1) { u32 *data = (u32 *) - ((char *)dev->agp_buffer_map->handle + ((char *)dev->agp_buffer_map->virtual + buf->offset + start); data[dwords++] = RADEON_CP_PACKET2; } @@ -1629,7 +1629,7 @@ static void radeon_cp_dispatch_indices(struct drm_device *dev, dwords = (prim->finish - prim->start + 3) / sizeof(u32); - data = (u32 *) ((char *)dev->agp_buffer_map->handle + + data = (u32 *) ((char *)dev->agp_buffer_map->virtual + elt_buf->offset + prim->start); data[0] = CP_PACKET3(RADEON_3D_RNDR_GEN_INDX_PRIM, dwords - 2); @@ -1781,7 +1781,7 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, /* Dispatch the indirect buffer. */ buffer = - (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset); + (u32 *) ((char *)dev->agp_buffer_map->virtual + buf->offset); dwords = size / 4; #define RADEON_COPY_MT(_buf, _data, _width) \ -- cgit v1.1