From: Jerome Glisse <jgli...@redhat.com>

The gpu packet prefetcher hates the ugly big nop packet those leads
to prefetching some invalid memory in some case. Apparently hawaii
is particularly sensible to this.

Note this only partialy fix hawaii issues and some zbuffer tiling
issues are still present.

Signed-off-by: Jérôme Glisse <jgli...@redhat.com>
---
 src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c 
b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index a06ecb2..502a550 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -451,8 +451,22 @@ static void radeon_drm_cs_flush(struct radeon_winsys_cs 
*rcs,
             while (rcs->cdw & 7)
                 OUT_CS(&cs->base, 0x80000000); /* type2 nop packet */
         } else {
-            while (rcs->cdw & 7)
-                OUT_CS(&cs->base, 0xffff1000); /* type3 nop packet */
+            switch (rcs->cdw & 7) {
+            case 0:
+                break;
+            case 7:
+                /* FIXME can this be bad if we are at cs[LAST_DW-1] ? Need to
+                 * think of something.
+                 */
+                OUT_CS(&cs->base, 0xc0001000);
+                OUT_CS(&cs->base, 0xcafedead);
+                /* Note we fallthrough as this will add another 7 dwords */
+            default:
+                OUT_CS(&cs->base, 0xc0001000 | (((8 - (rcs->cdw & 7)) - 1) << 
16));
+                while (rcs->cdw & 7) {
+                    OUT_CS(&cs->base, 0xcafedead);
+                }
+            }
         }
         break;
     case RING_UVD:
-- 
1.8.3.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to