From 0ccc790fdf26006030ef6622106f7748f7cb470b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Nov 2007 16:55:15 +1000 Subject: [PATCH] --- yaml --- r: 84026 b: refs/heads/master c: 47a184a80800dd69abd1206eea1b961070ce2ca3 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/char/drm/drm_bufs.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 5568c2c8e7f5..956a7f717a25 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ba8bbcf6ff4650712f64c0ef61139c73898e2165 +refs/heads/master: 47a184a80800dd69abd1206eea1b961070ce2ca3 diff --git a/trunk/drivers/char/drm/drm_bufs.c b/trunk/drivers/char/drm/drm_bufs.c index 07b774fa3f38..bde64b84166e 100644 --- a/trunk/drivers/char/drm/drm_bufs.c +++ b/trunk/drivers/char/drm/drm_bufs.c @@ -229,11 +229,17 @@ static int drm_addmap_core(struct drm_device * dev, unsigned int offset, #ifdef __alpha__ map->offset += dev->hose->mem_space->start; #endif - /* Note: dev->agp->base may actually be 0 when the DRM - * is not in control of AGP space. But if user space is - * it should already have added the AGP base itself. + /* In some cases (i810 driver), user space may have already + * added the AGP base itself, because dev->agp->base previously + * only got set during AGP enable. So, only add the base + * address if the map's offset isn't already within the + * aperture. */ - map->offset += dev->agp->base; + if (map->offset < dev->agp->base || + map->offset > dev->agp->base + + dev->agp->agp_info.aper_size * 1024 * 1024 - 1) { + map->offset += dev->agp->base; + } map->mtrr = dev->agp->agp_mtrr; /* for getmap */ /* This assumes the DRM is in total control of AGP space.