i965: upload multisample state for fragment program change
authorZhenyu Wang <zhenyuw@linux.intel.com>
Thu, 23 Dec 2010 08:30:20 +0000 (16:30 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Thu, 23 Dec 2010 09:30:03 +0000 (17:30 +0800)
This makes conformance tests stable on sandybridge D0 to track
multisample state before SF/WM state.

src/mesa/drivers/dri/i965/brw_misc_state.c
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/brw_state_upload.c

index a91b0528fac61394f51b5727ce26fd39a55f2fab..0e629a174768e42fdb314f6ea41cd3819ad1272b 100644 (file)
@@ -488,31 +488,6 @@ static void upload_invarient_state( struct brw_context *brw )
       BRW_BATCH_STRUCT(brw, &gdo);
    }
 
-   if (intel->gen >= 6) {
-      int i;
-
-      BEGIN_BATCH(3);
-      OUT_BATCH(CMD_3D_MULTISAMPLE << 16 | (3 - 2));
-      OUT_BATCH(MS_PIXEL_LOCATION_CENTER |
-               MS_NUMSAMPLES_1);
-      OUT_BATCH(0); /* positions for 4/8-sample */
-      ADVANCE_BATCH();
-
-      BEGIN_BATCH(2);
-      OUT_BATCH(CMD_3D_SAMPLE_MASK << 16 | (2 - 2));
-      OUT_BATCH(1);
-      ADVANCE_BATCH();
-
-      for (i = 0; i < 4; i++) {
-        BEGIN_BATCH(4);
-        OUT_BATCH(CMD_GS_SVB_INDEX << 16 | (4 - 2));
-        OUT_BATCH(i << SVB_INDEX_SHIFT);
-        OUT_BATCH(0);
-        OUT_BATCH(0xffffffff);
-        ADVANCE_BATCH();
-      }
-   }
-
    /* 0x61020000  State Instruction Pointer */
    {
       struct brw_system_instruction_pointer sip;
@@ -547,6 +522,42 @@ const struct brw_tracked_state brw_invarient_state = {
    .emit = upload_invarient_state
 };
 
+static void gen6_upload_multisample_state( struct brw_context *brw )
+{
+   struct intel_context *intel = &brw->intel;
+   int i;
+
+   BEGIN_BATCH(3);
+   OUT_BATCH(CMD_3D_MULTISAMPLE << 16 | (3 - 2));
+   OUT_BATCH(MS_PIXEL_LOCATION_CENTER |
+            MS_NUMSAMPLES_1);
+   OUT_BATCH(0); /* positions for 4/8-sample */
+   ADVANCE_BATCH();
+
+   BEGIN_BATCH(2);
+   OUT_BATCH(CMD_3D_SAMPLE_MASK << 16 | (2 - 2));
+   OUT_BATCH(1);
+   ADVANCE_BATCH();
+
+   for (i = 0; i < 4; i++) {
+      BEGIN_BATCH(4);
+      OUT_BATCH(CMD_GS_SVB_INDEX << 16 | (4 - 2));
+      OUT_BATCH(i << SVB_INDEX_SHIFT);
+      OUT_BATCH(0);
+      OUT_BATCH(0xffffffff);
+      ADVANCE_BATCH();
+   }
+}
+
+const struct brw_tracked_state gen6_multisample_state = {
+   .dirty = {
+      .mesa = 0,
+      .brw = (BRW_NEW_CONTEXT | BRW_NEW_FRAGMENT_PROGRAM),
+      .cache = 0,
+   },
+   .emit = gen6_upload_multisample_state
+};
+
 /**
  * Define the base addresses which some state is referenced from.
  *
index 4bb93e73369ee287c01211dbb313ba81bdd686bf..0ef829e7169e373755498b5882f18d139c1b2b49 100644 (file)
@@ -110,6 +110,7 @@ extern const struct brw_tracked_state gen6_viewport_state;
 extern const struct brw_tracked_state gen6_vs_state;
 extern const struct brw_tracked_state gen6_wm_constants;
 extern const struct brw_tracked_state gen6_wm_state;
+extern const struct brw_tracked_state gen6_multisample_state;
 
 /***********************************************************************
  * brw_state.c
index eba4411ca702a77e369cc80df47b7bd30260dfef..817eaa4148be5b51724eeb74aa06c0ee2c3963d0 100644 (file)
@@ -142,6 +142,7 @@ const struct brw_tracked_state *gen6_atoms[] =
    &gen6_vs_state,
    &gen6_gs_state,
    &gen6_clip_state,
+   &gen6_multisample_state,
    &gen6_sf_state,
    &gen6_wm_state,