... even though it was disabled. A mistake in the handling of fence reuse
caused us to skip the vital delay of waiting for the object to finish
rendering before changing the register. This resulted in us changing the
fence register whilst the bo was active and so causing the blits to
complete using the wrong stride or even the wrong tiling. (Visually the
effect is that small blocks of the screen look like they have been
interlaced). The fix is to wait for the GPU to finish using the memory
region pointed to by the fence before changing it.

Backported from f48629cff5bf3a0df923ce0314ace584212afbe7.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34584
Cc: Andy Whitcroft <[email protected]>
Cc: Daniel Vetter <[email protected]>
Reviewed-by: Daniel Vetter <[email protected]>
[Note for 2.6.38-stable, we need to reintroduce the interruptible passing]
Signed-off-by: Chris Wilson <[email protected]>
Tested-by: Dave Airlie <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c |   46 ++++++++++++++++----------------------
 1 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 36e66cc..10378a3 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2544,8 +2544,25 @@ i915_gem_object_get_fence(struct drm_i915_gem_object 
*obj,
                reg = &dev_priv->fence_regs[obj->fence_reg];
                list_move_tail(&reg->lru_list, &dev_priv->mm.fence_list);
 
-               if (!obj->fenced_gpu_access && !obj->last_fenced_seqno)
-                       pipelined = NULL;
+               if (obj->tiling_changed) {
+                       ret = i915_gem_object_flush_fence(obj,
+                                                         pipelined,
+                                                         interruptible);
+                       if (ret)
+                               return ret;
+
+                       if (!obj->fenced_gpu_access && !obj->last_fenced_seqno)
+                               pipelined = NULL;
+
+                       if (pipelined) {
+                               reg->setup_seqno =
+                                       i915_gem_next_request_seqno(dev, 
pipelined);
+                               obj->last_fenced_seqno = reg->setup_seqno;
+                               obj->last_fenced_ring = pipelined;
+                       }
+
+                       goto update;
+               }
 
                if (!pipelined) {
                        if (reg->setup_seqno) {
@@ -2568,31 +2585,6 @@ i915_gem_object_get_fence(struct drm_i915_gem_object 
*obj,
                                                          interruptible);
                        if (ret)
                                return ret;
-               } else if (obj->tiling_changed) {
-                       if (obj->fenced_gpu_access) {
-                               if (obj->base.write_domain & 
I915_GEM_GPU_DOMAINS) {
-                                       ret = 
i915_gem_flush_ring(obj->base.dev, obj->ring,
-                                                                 0, 
obj->base.write_domain);
-                                       if (ret)
-                                               return ret;
-                               }
-
-                               obj->fenced_gpu_access = false;
-                       }
-               }
-
-               if (!obj->fenced_gpu_access && !obj->last_fenced_seqno)
-                       pipelined = NULL;
-               BUG_ON(!pipelined && reg->setup_seqno);
-
-               if (obj->tiling_changed) {
-                       if (pipelined) {
-                               reg->setup_seqno =
-                                       i915_gem_next_request_seqno(dev, 
pipelined);
-                               obj->last_fenced_seqno = reg->setup_seqno;
-                               obj->last_fenced_ring = pipelined;
-                       }
-                       goto update;
                }
 
                return 0;
-- 
1.7.4.1

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to