commit 66f026ea36d14cedff4c8a386c4ebd9d1fe282ee Author: Pierre Willenbrock Date: Wed Oct 22 21:34:13 2008 +0200 fix i915_gem_gtt_pwrite Signed-off-by: Pierre Willenbrock diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index e9c0155..d1694fb 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -231,7 +231,7 @@ i915_gem_gtt_pwrite(struct drm_device *dev, struct drm_gem_object *obj, goto fail; obj_priv = obj->driver_private; - offset = obj_priv->gtt_offset + args->offset; + offset = dev->agp->base + obj_priv->gtt_offset + args->offset; obj_priv->dirty = 1; /* Try to write the data in a page at a time using ioremap_wc_atomic @@ -251,7 +251,7 @@ i915_gem_gtt_pwrite(struct drm_device *dev, struct drm_gem_object *obj, l = PAGE_SIZE - o; #if WATCH_PWRITE - DRM_INFO("pwrite i %d o %d l %d vaddr %p\n", i, o, l, vaddr); + DRM_INFO("pwrite i %d o %d l %d\n", i, o, l); #endif vaddr = ioremap_wc_atomic(i << PAGE_SHIFT, PAGE_SIZE); @@ -261,6 +261,9 @@ i915_gem_gtt_pwrite(struct drm_device *dev, struct drm_gem_object *obj, unwritten = __copy_from_user_inatomic_nocache(vaddr + o, user_data, l); iounmap_atomic(vaddr); +#if WATCH_PWRITE + DRM_INFO("pwrite vaddr %p\n", vaddr); +#endif if (unwritten) break; @@ -277,7 +280,7 @@ i915_gem_gtt_pwrite(struct drm_device *dev, struct drm_gem_object *obj, o = offset & (PAGE_SIZE-1); l = remain; - vaddr = ioremap_wc(i << PAGE_SHIFT, roundup(l, PAGE_SIZE)); + vaddr = ioremap_wc(i << PAGE_SHIFT, roundup(o + l, PAGE_SIZE)); #if WATCH_PWRITE DRM_INFO("pwrite slow i %d o %d l %d vaddr %p\n", i, o, l, vaddr);