Dest color space no longer impacts mipmaps or texture sampling

PS5: Removes SkDestinationSurfaceColorMode, tracking of mipmap
mode on GrTexture, sRGB decode state per-texture. Because we
were often choosing sRGB configs for RGB color types, legacy
rendering would then be incorrect (too dark). So...

PS7: Stops ever using sRGB pixel configs when translating
image info or color type. Also removes a bunch of GrCaps bits
and a GrContextOption that are no longer relevant.

PS9: Adjusts surface creation unit test expectations, and
changes the raster rules accordingly.

At this point, sRGB configs are (obviously) going to be broken.

Locally, I ran 8888, gl, and the gbr- versions of both. Across
all GMs x configs, there are 13 diffs. 12 are GMs that create
surfaces with a color-space attached (and thus, the offscreen
is no longer getting sRGB pixel config). The only remainder
constructs an SkPictureImageGenerator, (with an attached color
space) and renders it to the gbr-gl canvas, which triggers a
a tagged surface inside the generator.

Bug: skia:
Change-Id: Ie5edfa157dd799f3121e8173fc4f97f6c8ed6789
Reviewed-on: https://skia-review.googlesource.com/131282
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 1bb4782..950fe6e 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -611,11 +611,11 @@
                                           GrSamplerState::Filter filter, GrColor color,
                                           const SkRect& srcRect, const SkRect& dstRect,
                                           GrAAType aaType, SkCanvas::SrcRectConstraint constraint,
-                                          const SkMatrix& viewMatrix, sk_sp<GrColorSpaceXform> csxf,
-                                          bool allowSRBInputs) {
+                                          const SkMatrix& viewMatrix,
+                                          sk_sp<GrColorSpaceXform> csxf) {
         return std::unique_ptr<GrDrawOp>(new TextureOp(std::move(proxy), filter, color, srcRect,
                                                        dstRect, aaType, constraint, viewMatrix,
-                                                       std::move(csxf), allowSRBInputs));
+                                                       std::move(csxf)));
     }
 
     ~TextureOp() override {
@@ -644,7 +644,6 @@
 
     SkString dumpInfo() const override {
         SkString str;
-        str.appendf("AllowSRGBInputs: %d\n", fAllowSRGBInputs);
         str.appendf("# draws: %d\n", fDraws.count());
         auto proxies = this->proxies();
         for (int i = 0; i < fProxyCnt; ++i) {
@@ -699,15 +698,14 @@
     TextureOp(sk_sp<GrTextureProxy> proxy, GrSamplerState::Filter filter, GrColor color,
               const SkRect& srcRect, const SkRect& dstRect, GrAAType aaType,
               SkCanvas::SrcRectConstraint constraint, const SkMatrix& viewMatrix,
-              sk_sp<GrColorSpaceXform> csxf, bool allowSRGBInputs)
+              sk_sp<GrColorSpaceXform> csxf)
             : INHERITED(ClassID())
             , fColorSpaceXform(std::move(csxf))
             , fProxy0(proxy.release())
             , fFilter0(filter)
             , fProxyCnt(1)
             , fAAType(static_cast<unsigned>(aaType))
-            , fFinalized(0)
-            , fAllowSRGBInputs(allowSRGBInputs ? 1 : 0) {
+            , fFinalized(0) {
         SkASSERT(aaType != GrAAType::kMixedSamples);
         fPerspective = viewMatrix.hasPerspective();
         auto quad = GrPerspQuad(dstRect, viewMatrix);
@@ -772,9 +770,6 @@
         args.fCaps = &target->caps();
         args.fResourceProvider = target->resourceProvider();
         args.fFlags = 0;
-        if (fAllowSRGBInputs) {
-            args.fFlags |= GrPipeline::kAllowSRGBInputs_Flag;
-        }
         if (GrAAType::kMSAA == this->aaType()) {
             args.fFlags |= GrPipeline::kHWAntialias_Flag;
         }
@@ -1025,7 +1020,6 @@
     unsigned fDomain : 1;
     // Used to track whether fProxy is ref'ed or has a pending IO after finalize() is called.
     unsigned fFinalized : 1;
-    unsigned fAllowSRGBInputs : 1;
 
     typedef GrMeshDrawOp INHERITED;
 };
@@ -1040,10 +1034,9 @@
 std::unique_ptr<GrDrawOp> Make(sk_sp<GrTextureProxy> proxy, GrSamplerState::Filter filter,
                                GrColor color, const SkRect& srcRect, const SkRect& dstRect,
                                GrAAType aaType, SkCanvas::SrcRectConstraint constraint,
-                               const SkMatrix& viewMatrix, sk_sp<GrColorSpaceXform> csxf,
-                               bool allowSRGBInputs) {
+                               const SkMatrix& viewMatrix, sk_sp<GrColorSpaceXform> csxf) {
     return TextureOp::Make(std::move(proxy), filter, color, srcRect, dstRect, aaType, constraint,
-                           viewMatrix, std::move(csxf), allowSRGBInputs);
+                           viewMatrix, std::move(csxf));
 }
 
 }  // namespace GrTextureOp
@@ -1075,7 +1068,6 @@
     GrSamplerState::Filter filter = (GrSamplerState::Filter)random->nextULessThan(
             static_cast<uint32_t>(GrSamplerState::Filter::kMipMap) + 1);
     auto csxf = GrTest::TestColorXform(random);
-    bool allowSRGBInputs = random->nextBool();
     GrAAType aaType = GrAAType::kNone;
     if (random->nextBool()) {
         aaType = (fsaaType == GrFSAAType::kUnifiedMSAA) ? GrAAType::kMSAA : GrAAType::kCoverage;
@@ -1083,7 +1075,7 @@
     auto constraint = random->nextBool() ? SkCanvas::kStrict_SrcRectConstraint
                                          : SkCanvas::kFast_SrcRectConstraint;
     return GrTextureOp::Make(std::move(proxy), filter, color, srcRect, rect, aaType, constraint,
-                             viewMatrix, std::move(csxf), allowSRGBInputs);
+                             viewMatrix, std::move(csxf));
 }
 
 #endif