From 0e741e2dea688dce6f80a5c90fc0295938cd8eb6 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Thu, 5 Aug 2021 15:34:15 -0400 Subject: [PATCH] Disable dithering on the PowerVR GE8320 FWIW, our PowerVRGE8320 reports that it has integer shader support. Bug: b/195281495 Change-Id: Ie969d8e978404a5b8963bb5c71dedfa8945b2a2e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436563 Commit-Queue: Robert Phillips Reviewed-by: Brian Salomon --- src/gpu/GrCaps.cpp | 2 ++ src/gpu/GrCaps.h | 5 +++++ src/gpu/SkGr.cpp | 10 +++++++--- src/gpu/gl/GrGLCaps.cpp | 9 +++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp index 258e03818d..47368bd8a9 100644 --- a/src/gpu/GrCaps.cpp +++ b/src/gpu/GrCaps.cpp @@ -83,6 +83,7 @@ GrCaps::GrCaps(const GrContextOptions& options) { fRequiresManualFBBarrierAfterTessellatedStencilDraw = false; fNativeDrawIndexedIndirectIsBroken = false; fAvoidReorderingRenderTasks = false; + fAvoidDithering = false; fPreferVRAMUseOverFlushes = true; @@ -250,6 +251,7 @@ void GrCaps::dumpJSON(SkJSONWriter* writer) const { writer->appendBool("Native draw indexed indirect is broken [workaround]", fNativeDrawIndexedIndirectIsBroken); writer->appendBool("Avoid DAG reordering [workaround]", fAvoidReorderingRenderTasks); + writer->appendBool("Avoid Dithering [workaround]", fAvoidDithering); if (this->advancedBlendEquationSupport()) { writer->appendHexU32("Advanced Blend Equation Disable Flags", fAdvBlendEqDisableFlags); diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h index f51d495588..8baa8258fc 100644 --- a/src/gpu/GrCaps.h +++ b/src/gpu/GrCaps.h @@ -493,6 +493,10 @@ public: return fAvoidReorderingRenderTasks; } + bool avoidDithering() const { + return fAvoidDithering; + } + /** * Checks whether the passed color type is renderable. If so, the same color type is passed * back along with the default format used for the color type. If not, provides an alternative @@ -565,6 +569,7 @@ protected: bool fRequiresManualFBBarrierAfterTessellatedStencilDraw : 1; bool fNativeDrawIndexedIndirectIsBroken : 1; bool fAvoidReorderingRenderTasks : 1; + bool fAvoidDithering : 1; // ANGLE performance workaround bool fPreferVRAMUseOverFlushes : 1; diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 15bb31ade6..13b828d2a3 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -325,12 +325,16 @@ static inline float dither_range_for_config(GrColorType dstColorType) { } static std::unique_ptr make_dither_effect( - std::unique_ptr inputFP, float range, const GrShaderCaps* caps) { + std::unique_ptr inputFP, float range, const GrCaps* caps) { if (range == 0 || inputFP == nullptr) { return inputFP; } - if (caps->integerSupport()) { + if (caps->avoidDithering()) { + return inputFP; + } + + if (caps->shaderCaps()->integerSupport()) { // This ordered-dither code is lifted from the cpu backend. static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"( uniform half range; @@ -500,7 +504,7 @@ static inline bool skpaint_to_grpaint_impl(GrRecordingContext* context, if (SkPaintPriv::ShouldDither(skPaint, GrColorTypeToSkColorType(ct)) && paintFP != nullptr) { float ditherRange = dither_range_for_config(ct); paintFP = make_dither_effect( - std::move(paintFP), ditherRange, context->priv().caps()->shaderCaps()); + std::move(paintFP), ditherRange, context->priv().caps()); } #endif diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 015e2f7562..b9e4560b7c 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -758,6 +758,15 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, fShouldCollapseSrcOverToSrcWhenAble = true; } +#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK + if (ctxInfo.renderer() == GrGLRenderer::kPowerVRRogue) { + // https://b/195281495 + // The TecnoSpark 3 Pro with a PowerVR GE8300 seems to have a steep dithering performance + // cliff in the Android Framework + fAvoidDithering = true; + } +#endif + FormatWorkarounds formatWorkarounds; if (!contextOptions.fDisableDriverCorrectnessWorkarounds) {