r600g: fix userspace fence against lastest kernel
authorJerome Glisse <jglisse@redhat.com>
Tue, 7 Dec 2010 20:15:58 +0000 (15:15 -0500)
committerJerome Glisse <jglisse@redhat.com>
Tue, 7 Dec 2010 22:54:56 +0000 (17:54 -0500)
R6XX GPU doesn't like to have two partial flush writting
back to memory in row without a prior flush of the pipeline.
Add PS_PARTIAL_FLUSH to flush all work between the CP and
the ES, GS, VS, PS shaders.

Thanks a lot to Alban Browaeys (prahal on irc) for investigating
this issue.

Signed-off-by: Alban Browaeys <prahal@yahoo.com>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
src/gallium/winsys/r600/drm/r600_hw_context.c
src/gallium/winsys/r600/drm/r600d.h

index b2da7bf9909fd3463175217c2d38222a2eed01f6..0f2724f61ce16af20bab1faafd3da3d2d8b76513 100644 (file)
@@ -1112,6 +1112,8 @@ void r600_context_flush(struct r600_context *ctx)
        r600_context_queries_suspend(ctx);
 
        /* emit fence */
+       ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0);
+       ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | EVENT_INDEX(4);
        ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE_EOP, 4);
        ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT) | EVENT_INDEX(5);
        ctx->pm4[ctx->pm4_cdwords++] = 0;
index 4a08d504aabfcece687df22f606a90f8a71018e6..1c1ac76fe69d0b5099b1e91353b47e0a7597b3eb 100644 (file)
@@ -91,6 +91,7 @@
 #define PKT3_SET_CTL_CONST                     0x6F
 #define PKT3_SURFACE_BASE_UPDATE               0x73
 
+#define EVENT_TYPE_PS_PARTIAL_FLUSH            0x10
 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT 0x14
 #define EVENT_TYPE_ZPASS_DONE                  0x15
 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT   0x16