From 886add77645f30211dff4c36fa1c7d29d51f6cc1 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Mon, 28 May 2012 13:55:49 +0000 Subject: [PATCH] Fix calculation of the execution buffer end in the mapped pages when it is spilled into the next page. MFC after: 1 month --- sys/dev/drm2/i915/i915_gem_execbuffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/drm2/i915/i915_gem_execbuffer.c b/sys/dev/drm2/i915/i915_gem_execbuffer.c index 71430455b673..cea69706d52f 100644 --- a/sys/dev/drm2/i915/i915_gem_execbuffer.c +++ b/sys/dev/drm2/i915/i915_gem_execbuffer.c @@ -1069,7 +1069,8 @@ i915_gem_fix_mi_batchbuffer_end(struct drm_i915_gem_object *batch_obj, po_r -= 4; mkva = pmap_mapdev_attr(trunc_page(po_r), 2 * PAGE_SIZE, PAT_WRITE_COMBINING); - cmd = *(uint32_t *)(mkva + (po_r & PAGE_MASK)); + po_r &= PAGE_MASK; + cmd = *(uint32_t *)(mkva + po_r); if (cmd != MI_BATCH_BUFFER_END) { /* @@ -1083,8 +1084,7 @@ i915_gem_fix_mi_batchbuffer_end(struct drm_i915_gem_object *batch_obj, po_w = po_r; DRM_DEBUG("batchbuffer does not end by MI_BATCH_BUFFER_END, overwriting last bo cmd !\n"); } - - *(uint32_t *)(mkva + (po_w & PAGE_MASK)) = MI_BATCH_BUFFER_END; + *(uint32_t *)(mkva + po_w) = MI_BATCH_BUFFER_END; } pmap_unmapdev((vm_offset_t)mkva, 2 * PAGE_SIZE);