radeon/r200/r300: Fix swtcl flushing not to invalidate dma region.
[mesa.git] / src / mesa / drivers / dri / r300 / r300_ioctl.c
index 7ab6928247a769727e4d600d0b88666122fd63fc..3303078e39abfd455f4592c4347412cb4d240871 100644 (file)
@@ -507,7 +507,15 @@ static void r300EmitClearState(GLcontext * ctx)
                        R500_ALU_RGBA_A_SWIZ_0;
 
                r500fp.cmd[7] = 0;
-               emit_r500fp(ctx, &r500fp);
+               if (r300->radeon.radeonScreen->kernel_mm) {
+                       emit_r500fp(ctx, &r500fp);
+               } else {
+                       int dwords = r500fp.check(ctx,&r500fp);
+                       BEGIN_BATCH_NO_AUTOSTATE(dwords);
+                       OUT_BATCH_TABLE(r500fp.cmd, dwords);
+                       END_BATCH();
+               }
+
        }
 
        BEGIN_BATCH(2);
@@ -551,6 +559,7 @@ static void r300EmitClearState(GLcontext * ctx)
         struct radeon_state_atom vpu;
         uint32_t _cmd[10];
                R300_STATECHANGE(r300, pvs);
+               R300_STATECHANGE(r300, vap_flush);
                R300_STATECHANGE(r300, vpi);
 
                BEGIN_BATCH(4);
@@ -592,8 +601,19 @@ static void r300EmitClearState(GLcontext * ctx)
                                       PVS_SRC_REG_INPUT, NEGATE_NONE);
                vpu.cmd[8] = 0x0;
 
-               r300->vap_flush_needed = GL_TRUE;
-               emit_vpu(ctx, &vpu);
+               if (r300->radeon.radeonScreen->kernel_mm) {
+                       int dwords = r300->hw.vap_flush.check(ctx,&r300->hw.vap_flush);
+                       BEGIN_BATCH_NO_AUTOSTATE(dwords);
+                       OUT_BATCH_TABLE(r300->hw.vap_flush.cmd, dwords);
+                       END_BATCH();
+                       emit_vpu(ctx, &vpu);
+               } else {
+                       int dwords = vpu.check(ctx,&vpu);
+                       BEGIN_BATCH_NO_AUTOSTATE(dwords);
+                       OUT_BATCH_TABLE(vpu.cmd, dwords);
+                       END_BATCH();
+               }
+
        }
 }