aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-10-18 15:44:08 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-20 15:49:25 +0000
commitdbfecd06adeb03e9365f3539e113412c0b18785e (patch)
tree684f43bd5cfdd0c10366679ad21e522315a3263e
parent9480d822f283582aa016ee9ca3f6d618ddcefbbb (diff)
Re-land unit test for clear bug (w/ AMD work-arounds)
Bug: 768134 Change-Id: I76e5e3ff5719b0d2f9c74d49dfa9e187e4da7c1f Reviewed-on: https://skia-review.googlesource.com/60562 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-on: https://skia-review.googlesource.com/61221
-rw-r--r--src/gpu/gl/GrGLCaps.cpp6
-rw-r--r--src/gpu/gl/GrGLUtil.cpp19
-rw-r--r--src/gpu/gl/GrGLUtil.h4
-rw-r--r--tests/ClearTest.cpp7
4 files changed, 32 insertions, 4 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index eb2d2c3a3a..05bb1212b1 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -569,6 +569,12 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fUseDrawToClearColor = true;
}
+ // A lot of GPUs have trouble with full screen clears (skbug.com/7195)
+ if (kAMDRadeonHD7xxx_GrGLRenderer == ctxInfo.renderer() ||
+ kAMDRadeonR9M4xx_GrGLRenderer == ctxInfo.renderer()) {
+ fUseDrawToClearColor = true;
+ }
+
#ifdef SK_BUILD_FOR_MAC
// crbug.com/768134 - On MacBook Pros, the Intel Iris Pro doesn't always perform
// full screen clears
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index 055bc56452..a0ea477e2c 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -350,6 +350,25 @@ GrGLRenderer GrGLGetRendererFromString(const char* rendererString) {
return kIntel6xxx_GrGLRenderer;
}
}
+
+ // The AMD string can have a somewhat arbitrary preamble (see skbug.com/7195)
+ if (const char* amdString = strstr(rendererString, "Radeon")) {
+ char amdGeneration, amdTier, amdRevision;
+ n = sscanf(amdString, "Radeon (TM) R9 M%c%c%c",
+ &amdGeneration, &amdTier, &amdRevision);
+ if (3 == n) {
+ if ('4' == amdGeneration) {
+ return kAMDRadeonR9M4xx_GrGLRenderer;
+ }
+ }
+
+ char amd0, amd1, amd2;
+ n = sscanf(amdString, "Radeon HD 7%c%c%c Series", &amd0, &amd1, &amd2);
+ if (3 == n) {
+ return kAMDRadeonHD7xxx_GrGLRenderer;
+ }
+ }
+
if (0 == strcmp("Mesa Offscreen", rendererString)) {
return kOSMesa_GrGLRenderer;
}
diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h
index f1b339f301..04aa5bc6cc 100644
--- a/src/gpu/gl/GrGLUtil.h
+++ b/src/gpu/gl/GrGLUtil.h
@@ -62,6 +62,10 @@ enum GrGLRenderer {
/** T-6xx, T-7xx, or T-8xx */
kMaliT_GrGLRenderer,
kANGLE_GrGLRenderer,
+
+ kAMDRadeonHD7xxx_GrGLRenderer, // AMD Radeon HD 7000 Series
+ kAMDRadeonR9M4xx_GrGLRenderer, // AMD Radeon R9 M400 Series
+
kOther_GrGLRenderer
};
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index c1c39dc4ea..fca031824c 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -11,6 +11,9 @@
#include "GrContext.h"
#include "GrRenderTargetContext.h"
+#include "SkCanvas.h"
+#include "SkSurface.h"
+
static bool check_rect(GrRenderTargetContext* rtc, const SkIRect& rect, uint32_t expectedValue,
uint32_t* actualValue, int* failX, int* failY) {
int w = rect.width();
@@ -212,8 +215,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearOp, reporter, ctxInfo) {
}
}
-#if 0
-
void fullscreen_clear_with_layer_test(skiatest::Reporter* reporter, GrContext* context) {
const SkImageInfo ii = SkImageInfo::Make(400, 77, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
@@ -280,5 +281,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FullScreenClearWithLayers, reporter, ctxInfo)
}
#endif
-
-#endif