Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: fd.o bug #11895: Only add the AGP base to map offset if the caller didn't.

The i830 and newer intel 2D code adds the AGP base to map offsets already,
because it wasn't doing the AGP enable which used to set dev->agp->base.

Credit goes to Zhenyu for finding the issue.

Signed-off-by: Dave Airlie <airlied@linux.ie>

authored by

Eric Anholt and committed by
Dave Airlie
47a184a8 ba8bbcf6

+10 -4
+10 -4
drivers/char/drm/drm_bufs.c
··· 229 229 #ifdef __alpha__ 230 230 map->offset += dev->hose->mem_space->start; 231 231 #endif 232 - /* Note: dev->agp->base may actually be 0 when the DRM 233 - * is not in control of AGP space. But if user space is 234 - * it should already have added the AGP base itself. 232 + /* In some cases (i810 driver), user space may have already 233 + * added the AGP base itself, because dev->agp->base previously 234 + * only got set during AGP enable. So, only add the base 235 + * address if the map's offset isn't already within the 236 + * aperture. 235 237 */ 236 - map->offset += dev->agp->base; 238 + if (map->offset < dev->agp->base || 239 + map->offset > dev->agp->base + 240 + dev->agp->agp_info.aper_size * 1024 * 1024 - 1) { 241 + map->offset += dev->agp->base; 242 + } 237 243 map->mtrr = dev->agp->agp_mtrr; /* for getmap */ 238 244 239 245 /* This assumes the DRM is in total control of AGP space.