Merge branch 'lp-offset-twoside'
[mesa.git] / src / mesa / drivers / dri / i965 / gen6_cc.c
index ba1e3abe83ec206c35958ee7d7dc2963973ad099..800a25552141bb76aae204f02b383d056a08a55e 100644 (file)
 #include "brw_util.h"
 #include "intel_batchbuffer.h"
 #include "main/macros.h"
-#include "main/enums.h"
 
-struct brw_blend_state_key {
+struct gen6_blend_state_key {
    GLboolean color_blend, alpha_enabled;
+   GLboolean dither;
 
    GLenum logic_op;
 
@@ -43,15 +43,13 @@ struct brw_blend_state_key {
    GLenum blend_dst_rgb, blend_dst_a;
 
    GLenum alpha_func;
-
-   GLboolean dither;
 };
 
 static void
 blend_state_populate_key(struct brw_context *brw,
-                        struct brw_blend_state_key *key)
+                        struct gen6_blend_state_key *key)
 {
-   GLcontext *ctx = &brw->intel.ctx;
+   struct gl_context *ctx = &brw->intel.ctx;
 
    memset(key, 0, sizeof(*key));
 
@@ -87,7 +85,7 @@ blend_state_populate_key(struct brw_context *brw,
  */
 static drm_intel_bo *
 blend_state_create_from_key(struct brw_context *brw,
-                           struct brw_blend_state_key *key)
+                           struct gen6_blend_state_key *key)
 {
    struct gen6_blend_state blend;
    drm_intel_bo *bo;
@@ -150,7 +148,7 @@ blend_state_create_from_key(struct brw_context *brw,
 static void
 prepare_blend_state(struct brw_context *brw)
 {
-   struct brw_blend_state_key key;
+   struct gen6_blend_state_key key;
 
    blend_state_populate_key(brw, &key);
 
@@ -173,7 +171,7 @@ const struct brw_tracked_state gen6_blend_state = {
    .prepare = prepare_blend_state,
 };
 
-struct brw_color_calc_state_key {
+struct gen6_color_calc_state_key {
    GLubyte blend_constant_color[4];
    GLclampf alpha_ref;
    GLubyte stencil_ref[2];
@@ -181,9 +179,9 @@ struct brw_color_calc_state_key {
 
 static void
 color_calc_state_populate_key(struct brw_context *brw,
-                             struct brw_color_calc_state_key *key)
+                             struct gen6_color_calc_state_key *key)
 {
-   GLcontext *ctx = &brw->intel.ctx;
+   struct gl_context *ctx = &brw->intel.ctx;
 
    memset(key, 0, sizeof(*key));
 
@@ -211,7 +209,7 @@ color_calc_state_populate_key(struct brw_context *brw,
  */
 static drm_intel_bo *
 color_calc_state_create_from_key(struct brw_context *brw,
-                                struct brw_color_calc_state_key *key)
+                                struct gen6_color_calc_state_key *key)
 {
    struct gen6_color_calc_state cc;
    drm_intel_bo *bo;
@@ -240,7 +238,7 @@ color_calc_state_create_from_key(struct brw_context *brw,
 static void
 prepare_color_calc_state(struct brw_context *brw)
 {
-   struct brw_color_calc_state_key key;
+   struct gen6_color_calc_state_key key;
 
    color_calc_state_populate_key(brw, &key);
 
@@ -256,7 +254,7 @@ prepare_color_calc_state(struct brw_context *brw)
 
 const struct brw_tracked_state gen6_color_calc_state = {
    .dirty = {
-      .mesa = _NEW_COLOR,
+      .mesa = _NEW_COLOR | _NEW_STENCIL,
       .brw = 0,
       .cache = 0,
    },
@@ -269,12 +267,10 @@ static void upload_cc_state_pointers(struct brw_context *brw)
 
    BEGIN_BATCH(4);
    OUT_BATCH(CMD_3D_CC_STATE_POINTERS << 16 | (4 - 2));
-   OUT_RELOC(brw->cc.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
    OUT_RELOC(brw->cc.blend_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
    OUT_RELOC(brw->cc.depth_stencil_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
+   OUT_RELOC(brw->cc.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
    ADVANCE_BATCH();
-
-   intel_batchbuffer_emit_mi_flush(intel->batch);
 }