From 515bda681177e2bb1c988e3167a95e3d4132bd7f Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 9 Jan 2018 11:21:58 -0500 Subject: support gray8 destinations on CPU - fill in a couple switches to allow software to rasterize gray8 - add a gray8 config to DM so we can test it - enable this config on some bots Today we draw gray8 using SkRasterPipeline, loading it as {g,g,g,1} and storing using the same fixed luma math as SkLumaColorFilter. One day it'd be nice to use the color space's luma vector if present. Can we support this on GPU? Change-Id: I4ee661c8bd5f33f5db2433ffb6e1bc2483af8397 Reviewed-on: https://skia-review.googlesource.com/92681 Reviewed-by: Brian Osman Commit-Queue: Mike Klein --- dm/DM.cpp | 1 + .../Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json | 9 +++++++++ .../Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN.json | 9 +++++++++ ...VX2-x86_64-Debug-All-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json | 9 +++++++++ ...an9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage.json | 9 +++++++++ .../Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN.json | 9 +++++++++ .../Test-Debian9-GCC-GCE-CPU-AVX2-x86-Debug-All.json | 9 +++++++++ .../Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Debug-All.json | 9 +++++++++ infra/bots/recipes/test.expected/failed_dm.json | 9 +++++++++ infra/bots/recipes/test.expected/trybot.json | 9 +++++++++ infra/bots/recipes/test.py | 5 +++++ src/core/SkBitmapDevice.cpp | 3 +++ src/image/SkSurface_Raster.cpp | 6 ++++++ 13 files changed, 96 insertions(+) diff --git a/dm/DM.cpp b/dm/DM.cpp index 4728933f2c..ee9a7f5678 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -894,6 +894,7 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi auto srgbColorSpace = SkColorSpace::MakeSRGB(); auto srgbLinearColorSpace = SkColorSpace::MakeSRGBLinear(); + SINK("g8", RasterSink, kGray_8_SkColorType); SINK("565", RasterSink, kRGB_565_SkColorType); SINK("8888", RasterSink, kN32_SkColorType); SINK("srgb", RasterSink, kN32_SkColorType, srgbColorSpace); diff --git a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json index 8a032f71db..345527cdad 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json @@ -165,6 +165,7 @@ "8888", "srgb", "pdf", + "g8", "565", "f16", "sp-8888", @@ -197,6 +198,14 @@ "colorImage", "_", "_", + "g8", + "image", + "_", + "_", + "g8", + "colorImage", + "_", + "_", "serialize-8888", "gm", "_", diff --git a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN.json b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN.json index ff0a718297..6f673f1abe 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN.json @@ -164,6 +164,7 @@ "8888", "srgb", "pdf", + "g8", "565", "f16", "sp-8888", @@ -191,6 +192,14 @@ "colorImage", "_", "_", + "g8", + "image", + "_", + "_", + "g8", + "colorImage", + "_", + "_", "serialize-8888", "gm", "_", diff --git a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json index d99413def9..8410e0e313 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json @@ -236,6 +236,7 @@ "8888", "srgb", "pdf", + "g8", "565", "f16", "sp-8888", @@ -263,6 +264,14 @@ "colorImage", "_", "_", + "g8", + "image", + "_", + "_", + "g8", + "colorImage", + "_", + "_", "serialize-8888", "gm", "_", diff --git a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage.json b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage.json index cf4ed0aa25..bce495b933 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage.json @@ -170,6 +170,7 @@ "8888", "srgb", "pdf", + "g8", "565", "f16", "sp-8888", @@ -197,6 +198,14 @@ "colorImage", "_", "_", + "g8", + "image", + "_", + "_", + "g8", + "colorImage", + "_", + "_", "serialize-8888", "gm", "_", diff --git a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN.json b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN.json index 559e8374a5..ca76df809a 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN.json @@ -165,6 +165,7 @@ "8888", "srgb", "pdf", + "g8", "565", "f16", "sp-8888", @@ -192,6 +193,14 @@ "colorImage", "_", "_", + "g8", + "image", + "_", + "_", + "g8", + "colorImage", + "_", + "_", "serialize-8888", "gm", "_", diff --git a/infra/bots/recipes/test.expected/Test-Debian9-GCC-GCE-CPU-AVX2-x86-Debug-All.json b/infra/bots/recipes/test.expected/Test-Debian9-GCC-GCE-CPU-AVX2-x86-Debug-All.json index df767c26c5..69191ba1b5 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-GCC-GCE-CPU-AVX2-x86-Debug-All.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-GCC-GCE-CPU-AVX2-x86-Debug-All.json @@ -234,6 +234,7 @@ "8888", "srgb", "pdf", + "g8", "565", "f16", "sp-8888", @@ -261,6 +262,14 @@ "colorImage", "_", "_", + "g8", + "image", + "_", + "_", + "g8", + "colorImage", + "_", + "_", "serialize-8888", "gm", "_", diff --git a/infra/bots/recipes/test.expected/Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Debug-All.json b/infra/bots/recipes/test.expected/Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Debug-All.json index 4bb24649de..360a9a297d 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Debug-All.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Debug-All.json @@ -232,6 +232,7 @@ "8888", "srgb", "pdf", + "g8", "565", "f16", "sp-8888", @@ -259,6 +260,14 @@ "colorImage", "_", "_", + "g8", + "image", + "_", + "_", + "g8", + "colorImage", + "_", + "_", "serialize-8888", "gm", "_", diff --git a/infra/bots/recipes/test.expected/failed_dm.json b/infra/bots/recipes/test.expected/failed_dm.json index c220fd660b..a1c44c9c87 100644 --- a/infra/bots/recipes/test.expected/failed_dm.json +++ b/infra/bots/recipes/test.expected/failed_dm.json @@ -232,6 +232,7 @@ "8888", "srgb", "pdf", + "g8", "565", "f16", "sp-8888", @@ -259,6 +260,14 @@ "colorImage", "_", "_", + "g8", + "image", + "_", + "_", + "g8", + "colorImage", + "_", + "_", "serialize-8888", "gm", "_", diff --git a/infra/bots/recipes/test.expected/trybot.json b/infra/bots/recipes/test.expected/trybot.json index 92c0d66bf2..0b190277d9 100644 --- a/infra/bots/recipes/test.expected/trybot.json +++ b/infra/bots/recipes/test.expected/trybot.json @@ -233,6 +233,7 @@ "8888", "srgb", "pdf", + "g8", "565", "f16", "sp-8888", @@ -260,6 +261,14 @@ "colorImage", "_", "_", + "g8", + "image", + "_", + "_", + "g8", + "colorImage", + "_", + "_", "_", "image", "gen_platf", diff --git a/infra/bots/recipes/test.py b/infra/bots/recipes/test.py index bdfbae925c..bfa5228ffe 100644 --- a/infra/bots/recipes/test.py +++ b/infra/bots/recipes/test.py @@ -94,6 +94,7 @@ def dm_flags(api, bot): configs.remove('pdf') if '-GCE-' in bot: + configs.extend(['g8']) configs.extend(['565']) configs.extend(['f16']) configs.extend(['sp-8888', '2ndpic-8888']) # Test niche uses of SkPicture. @@ -267,6 +268,10 @@ def dm_flags(api, bot): blacklist('gbr-8888 image _ _') blacklist('gbr-8888 colorImage _ _') + # --src image --config g8 means "decode into Gray8", which isn't supported. + blacklist('g8 image _ _') + blacklist('g8 colorImage _ _') + if 'Valgrind' in bot: # These take 18+ hours to run. blacklist('pdf gm _ fontmgr_iter') diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index b3ab7fc03c..1cf644a13b 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -44,6 +44,9 @@ static bool valid_for_bitmap_device(const SkImageInfo& info, switch (info.colorType()) { case kAlpha_8_SkColorType: break; + case kGray_8_SkColorType: + canonicalAlphaType = kOpaque_SkAlphaType; + break; case kRGB_565_SkColorType: canonicalAlphaType = kOpaque_SkAlphaType; break; diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp index e9d14fea7d..3611b30828 100644 --- a/src/image/SkSurface_Raster.cpp +++ b/src/image/SkSurface_Raster.cpp @@ -50,6 +50,12 @@ bool SkSurfaceValidateRasterInfo(const SkImageInfo& info, size_t rowBytes) { } shift = 0; break; + case kGray_8_SkColorType: + if (info.colorSpace()) { + return false; + } + shift = 0; + break; case kRGB_565_SkColorType: if (info.colorSpace()) { return false; -- cgit v1.2.3