Commit Graph

673 Commits

Author SHA1 Message Date
Kevin Lubick
8f4e560871 Use CommonFlags namespace for other flags/functions
This consolidates tools/flags/CommonFlagsFontMgr.h into
tools/flags/CommonFlags.h and adds all those common
flags into the CommonFlags namespace.

I also cleaned up a few unused includes in DM.cpp

Change-Id: I1d1bf6598dfb87619b6abbb9faa1e24631f76fb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459476
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2021-10-14 14:34:21 +00:00
Kevin Lubick
237dd2d94d Move --nativeFonts to CommonFlags file
Also noticed while trying to build GMs in WASM with
Bazel.

Change-Id: I33d467a0da0893c1a5e376f4fd1a6096dad48af3
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459198
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-10-14 12:57:29 +00:00
Robert Phillips
c005895e76 Name Test struct's member variables consistently
Change-Id: Ie853618fb496a77ffb79d6669f87048260df68b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458979
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-13 17:37:39 +00:00
Robert Phillips
297d096cfb [graphite] More testing infrastructure
With this CL we can run as:

     dm --src gm skp tests --config grmtl -v --nocpu --nogpu

and not get all the non-Graphite unit tests.

Bug: skia:12466
Change-Id: Ib3f04f315fe4b5731a54e4c72979a0c1e00baf24
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457898
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-10-13 15:15:29 +00:00
Robert Phillips
d6bf374c3c Graphite: Improve DM/Graphite connection
This makes "dm --config grgl --src gm skp" generate a lot of green pngs and adds a stub class for Image_Graphite.

Bug: skia:12466
Change-Id: Ia7cf891ad278434f473cf6c9c4673bf8fa085adf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451740
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-09-22 21:34:09 +00:00
Robert Phillips
2af13c135b Reland "Fix compilation w/ "skia_enable_svg = false" (take 2)"
This reverts commit 44b7568c8a.

Reason for revert: Google 3 CL has landed

Original change's description:
> Revert "Fix compilation w/ "skia_enable_svg = false" (take 2)"
>
> This reverts commit 30a6b101f4.
>
> Reason for revert: Maybe blocking G3 roll?
>
> Original change's description:
> > Fix compilation w/ "skia_enable_svg = false" (take 2)
> >
> > Change-Id: I036ae171809af56cc9594704b44705ebd095ec80
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Commit-Queue: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,fmalita@chromium.org,fmalita@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: Ibee3819e073b04efdf9736058c1f9b288249620c
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444216
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

# Not skipping CQ checks because this is a reland.

Change-Id: Idf73d864108067ee1c34e88ee4e5236847abd582
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444501
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-01 17:54:08 +00:00
Robert Phillips
44b7568c8a Revert "Fix compilation w/ "skia_enable_svg = false" (take 2)"
This reverts commit 30a6b101f4.

Reason for revert: Maybe blocking G3 roll?

Original change's description:
> Fix compilation w/ "skia_enable_svg = false" (take 2)
>
> Change-Id: I036ae171809af56cc9594704b44705ebd095ec80
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=robertphillips@google.com,fmalita@chromium.org,fmalita@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: Ibee3819e073b04efdf9736058c1f9b288249620c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444216
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-31 22:31:00 +00:00
Robert Phillips
30a6b101f4 Fix compilation w/ "skia_enable_svg = false" (take 2)
Change-Id: I036ae171809af56cc9594704b44705ebd095ec80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-31 18:28:25 +00:00
Brian Osman
9f1e06aef9 Reland "Add sRGB 8888 colortype"
This is a reland of 0f7c10ef56

Original change's description:
> Add sRGB 8888 colortype
>
> A color type that linearizes just after loading, and re-encodes to sRGB
> just before storing, mimicking the GPU formats that work the same way.
>
> Notes:
>   - No mipmap support
>   - No SkPngEncoder support (HashAndEncode's .pngs are ok, though?)
>   - Needs better testing
>
> This is a re-creation of reviews.skia.org/392990
>
> Change-Id: I4739c2280211e7176aae98ba0a8476a7fe5efa72
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438219
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Change-Id: I5b6bb28c4c1faa6c97fcad7552d12c331535714d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441402
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-24 12:56:32 +00:00
Brian Osman
405eb7b72f Revert "Add sRGB 8888 colortype"
This reverts commit 0f7c10ef56.

Reason for revert: Unhappy rollers

Original change's description:
> Add sRGB 8888 colortype
>
> A color type that linearizes just after loading, and re-encodes to sRGB
> just before storing, mimicking the GPU formats that work the same way.
>
> Notes:
>   - No mipmap support
>   - No SkPngEncoder support (HashAndEncode's .pngs are ok, though?)
>   - Needs better testing
>
> This is a re-creation of reviews.skia.org/392990
>
> Change-Id: I4739c2280211e7176aae98ba0a8476a7fe5efa72
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438219
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com,reed@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: Ie199535b9b65ec7c7fef3c773452ea06bdbd2d9c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441376
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-23 17:38:05 +00:00
Brian Osman
0f7c10ef56 Add sRGB 8888 colortype
A color type that linearizes just after loading, and re-encodes to sRGB
just before storing, mimicking the GPU formats that work the same way.

Notes:
  - No mipmap support
  - No SkPngEncoder support (HashAndEncode's .pngs are ok, though?)
  - Needs better testing

This is a re-creation of reviews.skia.org/392990

Change-Id: I4739c2280211e7176aae98ba0a8476a7fe5efa72
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438219
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-23 15:14:41 +00:00
Brian Osman
fcb5023819 Remove old color space configs from tools
This centralizes the new color-space parsing into SkCommandLineConfig,
and then wires that up in DM, nanobench, and skpbench. It also removes
all of the old config names that encoded both color type and space.

Change-Id: I9a63a97f1d153e7636a1fb974cc4071f5ada3184
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438377
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-18 14:34:44 +00:00
Brian Osman
54ef97c273 Better (orthogonal) color space support in DM
This adds a new set of Via-style config tags for changing the color
space of the underlying Sink. Now, instead of needing to invent more
names for combinations of color types and color spaces, we can just
separate the two concepts:

  f16      -> linear-f16
  srgb     -> srgb-8888
  esrgb    -> srgb-f16
  esgbr    -> spin-f16
  ...

This also makes it easy to test novel combinations that don't currently
exist, and the mechanism works with GPU configs, too (where the
explosion of premade configs is even worse, thanks to multiple
backends).

Next step is to update all of our bots to use the new syntax when
specifying configs (this only applies to the BonusConfigs bots, I
think), then remove all of the previous special config names.

This is ultimately motivated by the addition of an sRGB *color type*,
which was going to make the existing system even more confusing and
untenable.

Change-Id: I66862e97adb3a6131ff2ab35185b1253b80e0656
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438756
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-12 13:23:57 +00:00
John Stiles
b7f2215bbb Fix cases of variable shadowing in test code.
If we manage to fix all the existing cases of variable shadowing, we
could enable -Wshadow.

Change-Id: I571931e01b0b95d85a7b566fc785ac219e8e731f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438697
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-11 20:38:09 +00:00
John Stiles
65ec198696 Add dm via-option rtblend- to test using Runtime Blends.
Change-Id: I46844754a86ae44b61747b7244edf6cc1fd73d61
Bug: skia:12080
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/429102
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-07-20 17:43:50 +00:00
Robert Phillips
1cc7d45f9a Remove ViaDDL
With the removal of promise image texture caching here (https://skia-review.googlesource.com/c/skia/+/375201) we no longer need these configs.

This can't land until after (https://skia-review.googlesource.com/c/skia/+/376221) which removes use of these configs on the bots.

Change-Id: I49e122fc820d5b72498b65933e15bcc74c0f3fa3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376219
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-02-26 15:31:01 +00:00
Mike Klein
627c0022ff support generalized HLG
Same basic deal as skcms.

This new GM tests our treatment of color spaces as sources is consistent
with our treatment of color spaces as destinations.  It looks good to me
now, and I have tested that this GM catches a "well-placed typo" in each
of the three implementations modified here.

Bug: chromium:1144260
Change-Id: I3eabc93bbd65855c60006751f68c171ccdce9d94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/351336
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-07 19:32:03 +00:00
Leon Scroggins
1340dbde91 Reland "SkAndroidCodec: Support decoding all frames"
This is a reland of fc4fdc5b25

Original change's description:
> SkAndroidCodec: Support decoding all frames
>
> Bug: b/160984428
> Bug: b/163595585
>
> Add support to SkAndroidCodec for decoding all frames with an
> fSampleSize, so that an entire animation can be decoded to a smaller
> size.
>
> dm/:
> - Test scaled + animated decodes
>
> SkAndroidCodec:
> - Make AndroidOptions inherit from SkCodec::Options. This allows
>   SkAndroidCodec to use fFrameIndex. (It also combines the two versions
>   of fSubset, which is now const for both.)
> - Respect fFrameIndex, and call SkCodec::handleFrameIndex to decode
>   the required frame.
> - Disallow decoding with kRespect + fFrameIndex > 0 if there is a
>   non-default orientation. As currently written (except without
>   disabling this combination), SkPixmapPriv::Orient would draw the new
>   portion of the frame on top of uninitialized pixels, instead of the
>   prior frame. This could be fixed by
>   - If SkAndroidCodec needs to decode the required frame, it could do so
>     without applying the orientation, then decode fFrameIndex, and then
>     apply the orientation.
>   - If the client provided the required frame, SkAndroidCodec would need
>     to un-apply the orientation to get the proper starting state, then
>     decode and apply.
>   I think it is simpler to force the client to handle the orientation
>   externally.
>
> SkCodec:
> - Allow SkAndroidCodec to call its private method handleFrameIndex. This
>   method handles decoding a required frame, if necessary. When called by
>   SkAndroidCodec, it now uses the SkAndroidCodec to check for/decode the
>   required frame, so that it will scale properly.
> - Call rewindIfNeeded inside handleFrameIndex. handleFrameIndex calls a
>   virtual method which may set some state (e.g. in SkJpegCodec). Without
>   this change, that state would be reset by rewindIfNeeded.
> - Simplify handling a kRestoreBGColor frame. Whether provided or not,
>   take the same path to calling zero_rect.
> - Updates to zero_rect:
>   - Intersect after scaling, which will also check for empty.
>   - Round out instead of in - this ensures we don't under-erase
>   - Use kFill_ScaleToFit, which better matches the intent.
>
> Change-Id: Ibe1951980a0dca8f5b7b1f20192432d395681683
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333225
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>

Bug: b/160984428
Bug: b/163595585
Change-Id: I7c1e79e0f92c75b4840eef65c8fc2b8497189e81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334842
Auto-Submit: Leon Scroggins <scroggo@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-11-16 16:55:48 +00:00
Leon Scroggins III
267a8589d3 Revert "SkAndroidCodec: Support decoding all frames"
This reverts commit fc4fdc5b25.

Reason for revert: Google3 and ASAN failures

Change-Id: I890cd76109c0375391637f879550837d01e650f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334840
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-11-13 16:20:39 +00:00
Leon Scroggins
fc4fdc5b25 SkAndroidCodec: Support decoding all frames
Bug: b/160984428
Bug: b/163595585

Add support to SkAndroidCodec for decoding all frames with an
fSampleSize, so that an entire animation can be decoded to a smaller
size.

dm/:
- Test scaled + animated decodes

SkAndroidCodec:
- Make AndroidOptions inherit from SkCodec::Options. This allows
  SkAndroidCodec to use fFrameIndex. (It also combines the two versions
  of fSubset, which is now const for both.)
- Respect fFrameIndex, and call SkCodec::handleFrameIndex to decode
  the required frame.
- Disallow decoding with kRespect + fFrameIndex > 0 if there is a
  non-default orientation. As currently written (except without
  disabling this combination), SkPixmapPriv::Orient would draw the new
  portion of the frame on top of uninitialized pixels, instead of the
  prior frame. This could be fixed by
  - If SkAndroidCodec needs to decode the required frame, it could do so
    without applying the orientation, then decode fFrameIndex, and then
    apply the orientation.
  - If the client provided the required frame, SkAndroidCodec would need
    to un-apply the orientation to get the proper starting state, then
    decode and apply.
  I think it is simpler to force the client to handle the orientation
  externally.

SkCodec:
- Allow SkAndroidCodec to call its private method handleFrameIndex. This
  method handles decoding a required frame, if necessary. When called by
  SkAndroidCodec, it now uses the SkAndroidCodec to check for/decode the
  required frame, so that it will scale properly.
- Call rewindIfNeeded inside handleFrameIndex. handleFrameIndex calls a
  virtual method which may set some state (e.g. in SkJpegCodec). Without
  this change, that state would be reset by rewindIfNeeded.
- Simplify handling a kRestoreBGColor frame. Whether provided or not,
  take the same path to calling zero_rect.
- Updates to zero_rect:
  - Intersect after scaling, which will also check for empty.
  - Round out instead of in - this ensures we don't under-erase
  - Use kFill_ScaleToFit, which better matches the intent.

Change-Id: Ibe1951980a0dca8f5b7b1f20192432d395681683
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333225
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-11-12 21:31:41 +00:00
John Stiles
ede793a1af Increase stack trace depth from 64 to 128.
64 stack frames is not deep enough when destroying an SkSL program:
http://screen/4RFxPFj7TFXRcTF

Change-Id: I53b151a640a982af7864a17ef0381e231e3fb872
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327338
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-10-15 18:20:46 +00:00
Mike Klein
989f5bfb8f refactor HashAndEncode
Encode as PNG to an SkWStream instead of a path.
It's just as natural at the call sites, if not more so,
and is more flexible for environments without a filesystem.

While here, tweak the method names and add some comments.

Change-Id: I8ce9869471fc7e1a0955d51ecb621e76c2e1d4d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323509
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-10-07 16:13:13 +00:00
John Stiles
a008b0fa8b Enable ClangTidy check readability-redundant-smartptr-get.
To my surprise, this even works with homegrown smart pointers (such as
SkTLazy).

https://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-smartptr-get.html

Find and remove redundant calls to smart pointer’s .get() method.

Examples:

  ptr.get()->Foo()  ==>  ptr->Foo()
  *ptr.get()  ==>  *ptr
  *ptr->get()  ==>  **ptr
  if (ptr.get() == nullptr) ... => if (ptr == nullptr) ...

Change-Id: I8ff541e0229656b4d8e875c8053a7e6138302547
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310976
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-16 15:56:48 +00:00
John Stiles
c1c3c6d70d Enable ClangTidy flag bugprone-suspicious-string-compare.
https://clang.llvm.org/extra/clang-tidy/checks/bugprone-suspicious-string-compare.html

Find suspicious usage of runtime string comparison functions.
This check is valid in C and C++.

Checks for calls with implicit comparator and proposed to
explicitly add it:

  if (strcmp(...))       // Implicitly compare to zero
  if (!strcmp(...))      // Won't warn
  if (strcmp(...) != 0)  // Won't warn

Checks that compare function results (i,e, strcmp) are compared to valid
constant. The resulting value is

  <  0    when lower than,
  >  0    when greater than,
  == 0    when equals.

A common mistake is to compare the result to 1 or -1:

  if (strcmp(...) == -1)  // Incorrect usage of the returned value.

Additionally, the check warns if the results value is implicitly cast
to a suspicious non-integer type. It’s happening when the returned
value is used in a wrong context:

  if (strcmp(...) < 0.)  // Incorrect usage of the returned value.

Change-Id: I001b88d06cc4f3eb5846103885be675f9b78e126
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310761
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-16 03:54:08 +00:00
Leon Scroggins III
326b98981e Add platform image encoder for using NDK APIs
Bug: skia:10369

Add SkEncodeImageWithNDK, mirroring the CG and WIC versions, for
encoding with the NDK APIs added to R.

Rename SK_ENABLE_NDK_DECODING to SK_ENABLE_NDK_IMAGES and use it for
both encoding and decoding.

Move code for converting to/from NDK types into a common location.

Update encode_platform.cpp to use NDK encoding APIs when available and
to use both types of webp (lossy and lossless). Add tests specifically
for the new implementation.

Update NdkDecodeTest to use ToolUtils::equal_pixels for comparing
pixels.

Change-Id: Ic62f89af27372ccce90b8e028e01c388a135a68c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308800
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-13 15:21:41 +00:00
Leon Scroggins III
f21d6b9b71 Reland "Add an SkImageGenerator that uses NDK APIs"
This reverts commit 07438b0cda.

Bug: skia:10369
Bug: skia:10371

This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.

Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.

Add tests and a grayscale png.

Update some test bots running Android R to specify ndk_api so they will
run the new code.

Change-Id: I4ca07d832dbd6a9d8cff0faea975fd70da00718f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308185
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 18:55:30 +00:00
Mike Klein
813e8cc762 add a global may-we-JIT flag
The most interesting part of the CL is that we recheck gSkVMAllowJIT in
Program::eval() even though we've already checked it in the constructor.
This allows Viewer to toggle the JIT on and off without having to worry
about program caching. This is not something that you'd expect to come
up in practice if a program just sets gSkVMAllowJIT at the start of
main(); for real clients I think we can avoid all this with a simple
SkGraphics::allowJIT() that only lets clients opt-in, never back out.

I toyed with making '!' rotate through a tristate in Viewer, until I
realized that these really are independent bits: GMs like threshold_rt
that use both ordinary effects and SkVM-only effects demonstrate
different behavior and performance in all four modes.  So '!' continues
to toggle SkVMBlitter, and now '@' toggles the JIT.

I've left the test program default settings unchanged, with the JIT
enabled unless --nojit is passed.  Where we previously simplified the
command line by conflating --dylib with --skvm, we now conflate --dylib
with --jit.

Change-Id: If86bf524c657298c0846bcd33c706e3c3f91e788
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308184
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-05 16:35:45 +00:00
Leon Scroggins
07438b0cda Revert "Add an SkImageGenerator that uses NDK APIs"
This reverts commit cfef980939.

Reason for revert: Breaking Google3 roll

Original change's description:
> Add an SkImageGenerator that uses NDK APIs
> 
> Bug: skia:10369
> Bug: skia:10371
> 
> This will allow Skia clients developing for Android 11+ to rely on
> Android's NDK APIs for decoding, which will allow them to decode
> without including their own decoding libraries (e.g. libjpeg-turbo).
> Using these APIs also provides support for static HEIF images.
> 
> Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
> visually.
> 
> Add tests and a grayscale png.
> 
> Update some test bots running Android R to specify ndk_api so they will
> run the new code.
> 
> Change-Id: Ica782339b2414d472ede0b61729a127ce41892a5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305689
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>

TBR=djsollen@google.com,mtklein@google.com,scroggo@google.com,brianosman@google.com,reed@google.com

Change-Id: Ifed506a76a0ff5903d101c1bf7330d319b8376a6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10369
Bug: skia:10371
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308180
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 14:42:51 +00:00
Leon Scroggins III
cfef980939 Add an SkImageGenerator that uses NDK APIs
Bug: skia:10369
Bug: skia:10371

This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.

Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.

Add tests and a grayscale png.

Update some test bots running Android R to specify ndk_api so they will
run the new code.

Change-Id: Ica782339b2414d472ede0b61729a127ce41892a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305689
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 13:44:39 +00:00
John Stiles
fbd050bd0b Enable ClangTidy check modernize-make-unique.
The majority of existing call sites were automatically updated using
clang-tidy -fix. A small handful required a manual update,
e.g. CppCodeGen.

This check is a bit lenient, and in particular will not flag cases like
`std::unique_ptr<Base>(new Derived())` which is still pretty common
throughout our codebase. This CL does not attempt to replace all the
cases that ClangTidy does not flag.

Change-Id: I5eba48ef880e25d22de80f321a68c389ba769e36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307459
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-03 17:53:52 +00:00
John Stiles
bd3ffa43d2 Fix range-based for loops which copy the loop variable unnecessarily.
This will allow us to enable the ClangTidy check
performance-for-range-copy.

Change-Id: I11f152ffe458f5f353da8715ffd2fd47cf4e71a7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306946
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-31 01:02:21 +00:00
Leon Scroggins III
1ff07066f9 Remove more references to "master"
Bug: chromium:1101491
Bug: b/161896447

Switch to more inclusive language, like "main", or remove where
simply unnecessary.

Change-Id: I36ef6ec631eb991f54f42b98887333f07c0984c2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306060
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-07-28 13:06:07 +00:00
Mike Klein
a54d380ced remove more blacklists
Switch DM to --skip, and replace a few others I found
with similar skip-related names, or remove names entirely.

This leaves things with just the unavoidable,

    $ git grep blacklist
    gn/BUILD.gn:      "-fsanitize-blacklist=$_suppressions",
    tools/lottie-web-perf/lottie-web-perf.js:
    browser_args.push('--ignore-gpu-blacklist');
    tools/perf-canvaskit-puppeteer/perf-canvaskit-with-puppeteer.js:
    browser_args.push('--ignore-gpu-blacklist');
    tools/skottie-wasm-perf/skottie-wasm-perf.js:
    browser_args.push('--ignore-gpu-blacklist');

Bug: 1101491
Change-Id: I9f60a18df4fd0304e702df4c68333f669a485c7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305760
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-24 18:14:29 +00:00
Robert Phillips
b87b39b7a2 Make GM::onGpuSetup take a GrDirectContext
This should, hopefully, clarify the role of onGpuSetup vis a vis onDraw.

The remaining tools are updated in:
https://skia-review.googlesource.com/c/skia/+/300220/ (Update remaining tools to GrDirectContext)

Change-Id: I19d6eec4d16cb9ebad8924763a18225cc871f0f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300172
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-01 19:25:55 +00:00
Florin Malita
02616ea90b [skrive] Add dm source
Change-Id: I09b8f8bb95dac443b64d85340db12f59f8977654
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299143
Auto-Submit: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-25 21:02:32 +00:00
John Stiles
33e044fb16 Prevent non-trivial destructors from running after exit in DM.
Previously, DM destroyed a large number of non-trivial objects at
shutdown time. Because no shutdown order is promised across translation
units by the standard, this can lead to bugs which only reproduce
capriciously, at the whim of the linker.

http://go/totw/110#the-fix-safe-initialization-no-destruction

"Destruction issues are usually solved by defining your static data
in such a way that the destructor never runs. The most common way to do
this is to heap allocate the static object - pointers don't have
destructors."

http://go/cstyle#decision_on_destruction

"Global and static variables that use dynamic initialization or have
non-trivial destructors create complexity that can easily lead to hard-
to-find bugs. Dynamic initialization is not ordered across translation
units, and neither is destruction (except that destruction happens in
reverse order of initialization). When one initialization refers to
another variable with static storage duration, it is possible that this
causes an object to be accessed before its lifetime has begun (or
after its lifetime has ended). Moreover, when a program starts threads
that are not joined at exit, those threads may attempt to access objects
after their lifetime has ended if their destructor has already run."

Change-Id: I54eedcd813295a23923deb925b0ca2adfff69f7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297872
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-20 00:02:23 +00:00
Robert Phillips
889d613875 Add GM::gpuSetup step
In order to emulate OOP-R's behavior, GM needs to pass GPU-backed resources to a DDL recorder.

This change allows GMs to create GPU resources first (in onGpuSetup w/ a direct context) and then use them in onDraw (with only a GrRecordingContext).


Change-Id: Ifa3002af73eb9926f653fb4c4bf4542c0749d658
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294336
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-06-16 18:31:55 +00:00
Robert Phillips
762cb4ea46 Add option to DDL test harness to better match OOP-R behavior
Change-Id: I043613c127dbfa1ebb7dcf5eab7b996afb676b61
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296449
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-06-16 12:30:41 +00:00
John Stiles
637838d20a Fix compiler warnings on Mac build.
Clang doesn't like it when operator| is applied to two different enum
types.

Additionally, fixed some nearby line wrapping.

Change-Id: I77190c9bc91b53ebc38d184d73a6a244b8f34ce9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295795
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-06-12 18:21:19 +00:00
Leon Scroggins III
87caae61cd Move SkBitmapRegionCodec into client_utils/android
Bug: skia:10154

This will make it clear that these files are for Android use and
avoid compiling them for other clients.

Update testing tools to use android::skia::BitmapRegionDecoder, but
only if SK_ENABLE_ANDROID_UTILS is defined.

Take this opportunity to clean up the class:
- The base class, which was originally designed to allow switching
  amongst different implementations, is no longer needed. Rename
  SkBitmapRegionCodec to android::skia::BitmapRegionDecoder
  (following the new convention and matching the Java API name).
  Continue to inherit from SkBitmapRegionDecoder temporarily, to
  allow Android to switch to the new API.
- Use std::unique_ptr instead of passing raw pointers.

Add a test to verify that we only create a BitmapRegionDecoder if
it is one of the supported types.

Change-Id: Ied13fc8acb105fde042553331846d95ae15d6b57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287498
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-05-20 20:06:48 +00:00
Robert Phillips
273f107a2d Dump out path-mask generation and caching stats
These stats would've helped block https://skia-review.googlesource.com/c/skia/+/286902 (Add path bounds to SW path mask key) from landing.

Change-Id: I684f39de53fb2678c7a679e4e4aafdbb39a154ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287499
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-05-05 18:21:49 +00:00
Ben Wagner
828a7ef39d [infra] Switch iOS to updated libimobiledevice.
Bug: skia:9799
Change-Id: I94069d58bde1762ef19122605147bd75232b6ed8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270446
Commit-Queue: Ben Wagner aka dogben <benjaminwagner@google.com>
Reviewed-by: Weston Tracey <westont@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2020-02-21 16:21:20 +00:00
Robert Phillips
291f3405f3 Add new gpu sink for DDLs
Having this as a sink rather than a Via allows us to do more aggressive things with threads and shared contexts.

Change-Id: I3ca1076686fa4f53387c12a9506e01910c1bc3e4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272016
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-02-20 13:51:07 +00:00
Robert Phillips
45f37c3795 Revert "Carve some helper functions off of GPUSink"
This reverts commit 7b2fcfbc5a.

Reason for revert: Need to loosen up error handling

Original change's description:
> Carve some helper functions off of GPUSink
> 
> I'm adding a new DDL Sink and would like to reuse this functionality.
> 
> Change-Id: I9f4535ca5e0f36925bf896cb0076eab73fe60fd1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270639
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,robertphillips@google.com

Change-Id: I97968834b5719c2061d53caff0dcf08a80917beb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270798
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-02-13 20:27:23 +00:00
Robert Phillips
7b2fcfbc5a Carve some helper functions off of GPUSink
I'm adding a new DDL Sink and would like to reuse this functionality.

Change-Id: I9f4535ca5e0f36925bf896cb0076eab73fe60fd1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270639
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-02-13 19:40:33 +00:00
Ben Wagner
ea25fcf027 Replace DM:Error with DM::Result.
Initially, Error was written with the intent that an empty string meant
Ok and anything else meant Fatal. This made things simple with implicit
constructors from strings. With the introduction of Nonfatal the state
was now tied up with an additional boolean. Now the empty string meant
Ok and causes the new boolean to be ignored, or at least that is the way
it was used since Error didn't actually enforce that itself. This leads
to GMs which return kSkip but don't set the message to not be skipped.
This could be fixed in several ways.

The first would be for the GMSrc to notice that a GM had returned kSkip
with an empty message and create the Error::Nonfatal with a non-empty
message. This has the downside of being some extra unexpected complexity
and doesn't prevent similar issues from arising in the future.

The second would be to change how DM interprets the Error, and if the
non-fatal bit is set treat that as a sign to skip, even if the message
is empty. This fixes the stated issue, but doesn't fix the issue where a
GM can return kFail but also leave the message empty. This could again
be fixed by either modifying GMSrc::draw or GM::drawContent, but this
also seems a bit brittle in not preventing this from happening again in
the future.

So this replaces Error with Result, which makes the status orthogonal to
the message. It does lose the automatic conversion from string, but by
being able to wrap the many uses of SkStringPrintf the explicit nature
doesn't add much additional noise to the more complex failure reports.

Change-Id: Ibf48b67faa09a91a4a9d792d204bd9810b441c6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270362
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-12 19:05:46 +00:00
Mike Klein
f7eb0544a8 basic, untested BGR 1010102 and 101010x
Updated every switch that yelled at me, and added support to dm and fm,
and then founds some more switches that shouldn't have defaults...

The tricky spots outside those were mips and dither,
since they aren't simply exhaustive switches.

_Now_ no diffs between RGB/BGR 1010102 and 101010x.

No GPU support.

Bug: skia:9893
Change-Id: I73ab3fd22bdef0519296dfe4cb84031e23ca0be3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270114
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-11 21:44:57 +00:00
Tyler Denniston
45f94f8344 Reland: Initial checkin of GM verifier framework
The goal of the verifier framework is to enable opt-in checks of the
images produced by individual GMs. The basis of verification will be
comparing the rendered output of a GM against a source-of-truth image,
such as one generated by the CPU backend.

In the short term this can enable coarse-grained sanity checks for a
subset of GMs to catch e.g. egregious rendering bugs. In the longer term
this can provide an SkQP-style suite of tests that can be run across
many/all GMs to provide a vote of confidence in the rendering
correctness of new devices.

Bug: skia:9855
Change-Id: I50f15ecd029b28b69c0f68dc4126df3a4dd61d75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268685
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-02-06 15:01:31 +00:00
Tyler Denniston
14d64afaa8 Revert "Initial checkin of GM verifier framework"
This reverts commit 7e36f0015e.

Reason for revert: breaking google3 roll

Original change's description:
> Initial checkin of GM verifier framework
> 
> The goal of the verifier framework is to enable opt-in checks of the
> images produced by individual GMs. The basis of verification will be
> comparing the rendered output of a GM against a source-of-truth image,
> such as one generated by the CPU backend.
> 
> In the short term this can enable coarse-grained sanity checks for a
> subset of GMs to catch e.g. egregious rendering bugs. In the longer term
> this can provide an SkQP-style suite of tests that can be run across
> many/all GMs to provide a vote of confidence in the rendering
> correctness of new devices.
> 
> Bug: skia:9855
> Change-Id: Id7310de8005ffa7e8eb2fd0e4008f5f8db1419ab
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267761
> Commit-Queue: Derek Sollenberger <djsollen@google.com>
> Auto-Submit: Tyler Denniston <tdenniston@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>

TBR=djsollen@google.com,tdenniston@google.com

Change-Id: Ie3beff447fea406b5ad3c3ca5a98fa2bd73d20fb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9855
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268682
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-02-04 20:54:39 +00:00
Tyler Denniston
7e36f0015e Initial checkin of GM verifier framework
The goal of the verifier framework is to enable opt-in checks of the
images produced by individual GMs. The basis of verification will be
comparing the rendered output of a GM against a source-of-truth image,
such as one generated by the CPU backend.

In the short term this can enable coarse-grained sanity checks for a
subset of GMs to catch e.g. egregious rendering bugs. In the longer term
this can provide an SkQP-style suite of tests that can be run across
many/all GMs to provide a vote of confidence in the rendering
correctness of new devices.

Bug: skia:9855
Change-Id: Id7310de8005ffa7e8eb2fd0e4008f5f8db1419ab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267761
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Auto-Submit: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-02-04 20:11:24 +00:00