+
+ /* Recommended optimization for Victim Cache eviction in pixel backend. */
+ if (brw->gen >= 9) {
+ BEGIN_BATCH(3);
+ OUT_BATCH(MI_LOAD_REGISTER_IMM | (3 - 2));
+ OUT_BATCH(GEN7_CACHE_MODE_1);
+ OUT_BATCH((GEN9_PARTIAL_RESOLVE_DISABLE_IN_VC << 16) |
+ GEN9_PARTIAL_RESOLVE_DISABLE_IN_VC);
+ ADVANCE_BATCH();
+ }
+
+ if (brw->gen >= 8) {
+ gen8_emit_3dstate_sample_pattern(brw);
+ }
+}
+
+static inline const struct brw_tracked_state *
+brw_get_pipeline_atoms(struct brw_context *brw,
+ enum brw_pipeline pipeline)
+{
+ switch (pipeline) {
+ case BRW_RENDER_PIPELINE:
+ return brw->render_atoms;
+ case BRW_COMPUTE_PIPELINE:
+ return brw->compute_atoms;
+ default:
+ STATIC_ASSERT(BRW_NUM_PIPELINES == 2);
+ unreachable("Unsupported pipeline");
+ return NULL;
+ }
+}
+
+static void
+brw_copy_pipeline_atoms(struct brw_context *brw,
+ enum brw_pipeline pipeline,
+ const struct brw_tracked_state **atoms,
+ int num_atoms)
+{
+ /* This is to work around brw_context::atoms being declared const. We want
+ * it to be const, but it needs to be initialized somehow!
+ */
+ struct brw_tracked_state *context_atoms =
+ (struct brw_tracked_state *) brw_get_pipeline_atoms(brw, pipeline);
+
+ for (int i = 0; i < num_atoms; i++) {
+ context_atoms[i] = *atoms[i];
+ assert(context_atoms[i].dirty.mesa | context_atoms[i].dirty.brw);
+ assert(context_atoms[i].emit);
+ }
+
+ brw->num_atoms[pipeline] = num_atoms;