<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO --- - [bisected ivb] Small black box corruption in firefox"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=68410#c40">Comment # 40</a>
              on <a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO --- - [bisected ivb] Small black box corruption in firefox"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=68410">bug 68410</a>
              from <span class="vcard"><a class="email" href="mailto:chris@chris-wilson.co.uk" title="Chris Wilson <chris@chris-wilson.co.uk>"> <span class="fn">Chris Wilson</span></a>
</span></b>
        <pre>How about


diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 4b60f53..5764244 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -801,7 +801,7 @@ gen7_emit_cc(struct sna *sna, uint32_t blend_offset)
     struct gen7_render_state *render = &sna->render_state.gen7;

     if (render->blend == blend_offset)
-        return;
+        return false;

     DBG(("%s: blend = %x\n", __FUNCTION__, blend_offset));

@@ -814,6 +814,7 @@ gen7_emit_cc(struct sna *sna, uint32_t blend_offset)
     OUT_BATCH((render->cc_blend + blend_offset) | 1);

     render->blend = blend_offset;
+    return blend_offset != NO_BLEND;
 }

 static void
@@ -1098,10 +1099,12 @@ gen7_emit_state(struct sna *sna,
         uint16_t wm_binding_table)
 {
     bool need_stall;
+    bool need_flush;

     assert(op->dst.bo->exec);

-    gen7_emit_cc(sna, GEN7_BLEND(op->u.gen7.flags));
+    need_flush = sna->render_state.gen7.emit_flush;
+    need_flush |= gen7_emit_cc(sna, GEN7_BLEND(op->u.gen7.flags));
     gen7_emit_sampler(sna, GEN7_SAMPLER(op->u.gen7.flags));
     gen7_emit_sf(sna, GEN7_VERTEX(op->u.gen7.flags) >> 2);
     gen7_emit_wm(sna, GEN7_KERNEL(op->u.gen7.flags));
@@ -1120,7 +1123,7 @@ gen7_emit_state(struct sna *sna,
         sna->render_state.gen7.emit_flush = false;
         need_stall = false;
     }
-    if (ALWAYS_FLUSH || (sna->render_state.gen7.emit_flush &&
GEN7_READS_DST(op->u.gen7.flags))) {
+    if (ALWAYS_FLUSH || (need_flush && GEN7_READS_DST(op->u.gen7.flags))) {
         gen7_emit_pipe_flush(sna, need_stall);
         need_stall = false;
     }</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>