summaryrefslogtreecommitdiff
path: root/shared-core
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2007-12-06 15:12:21 -0800
committerKeith Packard <keithp@keithp.com>2007-12-11 20:23:00 -0800
commit4ec8f58d042d7fe0dab570fed35a438759645ca8 (patch)
tree4a58beef2da86945fda8c682245117cff89ea610 /shared-core
parent9ee511d786b1a87944f043c1a16057e8dfc48668 (diff)
i915: wait for buffer idle before writing relocations
When writing a relocation entry, make sure the target buffer is idle, otherwise the GPU may see inconsistent data.
Diffstat (limited to 'shared-core')
-rw-r--r--shared-core/i915_dma.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c
index 090ac80a..18d2482e 100644
--- a/shared-core/i915_dma.c
+++ b/shared-core/i915_dma.c
@@ -751,6 +751,13 @@ int i915_apply_reloc(struct drm_file *file_priv, int num_buffers,
!drm_bo_same_page(relocatee->offset, new_cmd_offset)) {
drm_bo_kunmap(&relocatee->kmap);
relocatee->offset = new_cmd_offset;
+ mutex_lock (&relocatee->buf->mutex);
+ ret = drm_bo_wait (relocatee->buf, 0, 0, FALSE);
+ mutex_unlock (&relocatee->buf->mutex);
+ if (ret) {
+ DRM_ERROR("Could not wait for buffer to apply relocs\n %08lx", new_cmd_offset);
+ return ret;
+ }
ret = drm_bo_kmap(relocatee->buf, new_cmd_offset >> PAGE_SHIFT,
1, &relocatee->kmap);
if (ret) {