Workaround for blacklist KHR_blend_equation_advanced on ARM GPU

ARM driver will check the fragment shader compatiblity for KHR_blend_equation_advanced even if blending is disabled.
Workaround: Set blending equation to any basic equation when we disable blending.
https://code.google.com/p/skia/issues/detail?id=3943

BUG=skia:3943

Review URL: https://codereview.chromium.org/1216963004
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 539212c..22ad057 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -888,8 +888,7 @@
     // for now until its own blacklists can be updated.
     if (kAdreno4xx_GrGLRenderer == ctxInfo.renderer() ||
         kIntel_GrGLDriver == ctxInfo.driver() ||
-        kChromium_GrGLDriver == ctxInfo.driver() ||
-        kARM_GrGLVendor == ctxInfo.vendor()) {
+        kChromium_GrGLDriver == ctxInfo.driver()) {
         return;
     }
 
@@ -922,6 +921,10 @@
         fAdvBlendEqBlacklist |= (1 << kColorDodge_GrBlendEquation) |
                                 (1 << kColorBurn_GrBlendEquation);
     }
+    if (kARM_GrGLVendor == ctxInfo.vendor()) {
+        // Blacklist color-burn on ARM until the fix is released.
+        fAdvBlendEqBlacklist |= (1 << kColorBurn_GrBlendEquation);
+    }
 }
 
 namespace {
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 20669b8..626a72f 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2158,6 +2158,18 @@
     if (blendOff) {
         if (kNo_TriState != fHWBlendState.fEnabled) {
             GL_CALL(Disable(GR_GL_BLEND));
+
+            // Workaround for the ARM KHR_blend_equation_advanced blacklist issue
+            // https://code.google.com/p/skia/issues/detail?id=3943
+            if (kARM_GrGLVendor == this->ctxInfo().vendor() &&
+                GrBlendEquationIsAdvanced(fHWBlendState.fEquation)) {
+                SkASSERT(this->caps()->advancedBlendEquationSupport());
+                // Set to any basic blending equation.
+                GrBlendEquation blend_equation = kAdd_GrBlendEquation;
+                GL_CALL(BlendEquation(gXfermodeEquation2Blend[blend_equation]));
+                fHWBlendState.fEquation = blend_equation;
+            }
+
             fHWBlendState.fEnabled = kNo_TriState;
         }
         return;