Enable gpusrgb config on bots.

Don't run the config if we can't get a context with srgb support.
Includes a unit test for that logic.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1846603002

Review URL: https://codereview.chromium.org/1846603002
This commit is contained in:
brianosman 2016-03-30 11:19:36 -07:00 committed by Commit bot
parent 6f70d43719
commit 61d3b08138
6 changed files with 108 additions and 3 deletions

View File

@ -819,6 +819,11 @@ static Sink* create_sink(const SkCommandLineConfig* config) {
contextOptions = static_cast<GrContextFactory::GLContextOptions>(
contextOptions | GrContextFactory::kEnableNVPR_GLContextOptions);
}
if (kSRGB_SkColorProfileType == gpuConfig->getProfileType() ||
kRGBA_F16_SkColorType == gpuConfig->getColorType()) {
contextOptions = static_cast<GrContextFactory::GLContextOptions>(
contextOptions | GrContextFactory::kRequireSRGBSupport_GLContextOptions);
}
GrContextFactory testFactory;
if (!testFactory.get(contextType, contextOptions)) {
info("WARNING: can not create GPU context for config '%s'. "

View File

@ -148,6 +148,11 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ
return ContextInfo();
}
}
if (kRequireSRGBSupport_GLContextOptions & options) {
if (!grCtx->caps()->srgbSupport()) {
return ContextInfo();
}
}
Context& context = fContexts.push_back();
context.fGLContext = glCtx.release();

View File

@ -53,6 +53,7 @@ public:
enum GLContextOptions {
kNone_GLContextOptions = 0,
kEnableNVPR_GLContextOptions = 0x1,
kRequireSRGBSupport_GLContextOptions = 0x2,
};
static bool IsRenderingGLContext(GLContextType type) {

View File

@ -46,6 +46,29 @@ DEF_GPUTEST(GrContextFactory_NoPathRenderingUnlessNVPRRequested, reporter, /*fac
}
}
DEF_GPUTEST(GrContextFactory_RequiredSRGBSupport, reporter, /*factory*/) {
// Test that if sRGB support is requested, the context always has that capability
// or the context creation fails. Also test that if the creation fails, a context
// created without that flag would not have had sRGB support.
GrContextFactory testFactory;
// Test that if sRGB is requested, caps are in sync.
for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
GrContextFactory::GLContextType glCtxType = static_cast<GrContextFactory::GLContextType>(i);
GrContext* context =
testFactory.get(glCtxType,
GrContextFactory::kRequireSRGBSupport_GLContextOptions);
if (context) {
REPORTER_ASSERT(reporter, context->caps()->srgbSupport());
} else {
context = testFactory.get(glCtxType);
if (context) {
REPORTER_ASSERT(reporter, !context->caps()->srgbSupport());
}
}
}
}
DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) {
GrContextFactory testFactory;
for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {

View File

@ -4,6 +4,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"pdf",
"pdf_poppler",
"serialize-8888",
@ -26,6 +27,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"gpu",
"skp",
"_",
@ -260,6 +265,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"msaa4",
"serialize-8888",
"tiles_rt-8888",
@ -281,6 +287,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"serialize-8888",
"gm",
"_",
@ -565,6 +575,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"msaa4",
"serialize-8888",
"tiles_rt-8888",
@ -589,6 +600,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"serialize-8888",
"gm",
"_",
@ -873,6 +888,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"serialize-8888",
"tiles_rt-8888",
"pic-8888",
@ -895,6 +911,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"serialize-8888",
"gm",
"_",
@ -1183,6 +1203,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"serialize-8888",
"tiles_rt-8888",
"pic-8888",
@ -1203,6 +1224,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"serialize-8888",
"gm",
"_",
@ -1485,7 +1510,8 @@
"565",
"8888",
"gpu",
"nvprmsaa4",
"gpusrgb",
"nvprdit4",
"msaa4",
"serialize-8888",
"tiles_rt-8888",
@ -1507,6 +1533,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"serialize-8888",
"gm",
"_",
@ -1790,6 +1820,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"--src",
"tests",
"gm",
@ -1807,6 +1838,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"serialize-8888",
"gm",
"_",
@ -2000,6 +2035,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"msaa16",
"pdf",
"pdf_poppler",
@ -2023,6 +2059,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"_",
"image",
"gen_platf",
@ -2341,6 +2381,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"msaa16",
"pdf",
"pdf_poppler",
@ -2364,6 +2405,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"_",
"image",
"gen_platf",
@ -2586,6 +2631,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"f16",
"srgb",
"sp-8888",
@ -2613,6 +2659,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"serialize-8888",
"gm",
"_",
@ -2806,6 +2856,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"f16",
"srgb",
"sp-8888",
@ -2833,6 +2884,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"serialize-8888",
"gm",
"_",
@ -3023,6 +3078,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"f16",
"srgb",
"sp-8888",
@ -3050,6 +3106,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"pdf",
"gm",
"_",
@ -3262,7 +3322,8 @@
"565",
"8888",
"gpu",
"nvprmsaa16",
"gpusrgb",
"nvprdit16",
"msaa16",
"pdf",
"pdf_poppler",
@ -3286,6 +3347,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"pdf",
"gm",
"_",
@ -3592,6 +3657,7 @@
"565",
"8888",
"gpu",
"gpusrgb",
"msaa16",
"pdf",
"pdf_poppler",
@ -3616,6 +3682,10 @@
"image",
"_",
"_",
"gpusrgb",
"image",
"_",
"_",
"msaa16",
"gm",
"_",

View File

@ -34,7 +34,7 @@ def get_args(bot):
if '-x86-' in bot and not 'NexusPlayer' in bot:
args.extend('--threads 4'.split(' '))
configs = ['565', '8888', 'gpu']
configs = ['565', '8888', 'gpu', 'gpusrgb']
if '-GCE-' in bot:
configs.extend(['f16', 'srgb']) # Gamma-correct formats.
@ -93,6 +93,7 @@ def get_args(bot):
blacklist.extend('f16 _ _ dstreadshuffle'.split(' '))
blacklist.extend('f16 image _ _'.split(' '))
blacklist.extend('srgb image _ _'.split(' '))
blacklist.extend('gpusrgb image _ _'.split(' '))
# Certain gm's on win7 gpu and pdf are never finishing and keeping the test
# running forever