aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkScan_DAAPath.cpp
Commit message (Collapse)AuthorAge
* Skip bad line segments inside gen_alpha_deltasGravatar Yuqian Li2018-06-01
| | | | | | | | | Bug: chromium:847386 Change-Id: I5bb3268c27ecfbd66268adbc36be3ea72e0a69ba Reviewed-on: https://skia-review.googlesource.com/131324 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com> Auto-Submit: Yuqian Li <liyuqian@google.com>
* Let SkCoverageDeltaList store width and use it during blittingGravatar Yuqian Li2018-04-16
| | | | | | | | | | | | Otherwise, out/Debug/viewer -m complexclip_bw_invert may crash using the threaded backend because the clip in the initFn may be wider than the clip in the drawFn. Bug: skia: Change-Id: I3b3ddc9a912fcc155bd30a6bc1f87e24739d1ca6 Reviewed-on: https://skia-review.googlesource.com/121327 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* SkBlitter is not thread safe; make one for each thread.Gravatar Yuqian Li2018-04-16
| | | | | | | | | | | | | | | Otherwise, GM fancy_gradients would be drawn incorrectly and TSAN will issue alerts as SkARGB32_Shader_Blitter has its own memory that may be written during blitting. As we make one blitter for each thread, we also don't need to send in a thread-alloc for blitCoverageDeltas Bug: skia: Change-Id: Ie4ee0886b88c797ab57c65674b0b7527501b164f Reviewed-on: https://skia-review.googlesource.com/120641 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Use clippedIR instead of clipBounds to filter coverage deltasGravatar Yuqian Li2018-03-08
| | | | | | | | | | | | | Due to precision limit, some cubics may generate lines exceeding the path's IR. Since we created delta list or delta mask using clippedIR, it's important that we use the stricter clippedIR instead of clipBounds to filter the coverage deltas. Bug: oss-fuzz:6189 Change-Id: I775408282fb45ada41968426c2f32d28bb567af1 Reviewed-on: https://skia-review.googlesource.com/113160 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
* Set SkDAARecord to empty type if the scan converter returns earlyGravatar Yuqian Li2018-03-05
| | | | | | | | | | | | | | Otherwise, ./out/Debug/dm --config t8888 -m bug583299 will crash at SkASSERT(record->fType != SkDAARecord::Type::kToBeComputed) Bug: skia: Change-Id: Ie93221bd6ea7ab9bc9f3d79fd7fe02b315e6a089 Reviewed-on: https://skia-review.googlesource.com/111680 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Add SkDAARecord to prepare for init-onceGravatar Yuqian Li2018-02-14
| | | | | | | | | | | This is just refactoring our code so we can easily bring DAA to init-once. No GMs are expected to change. Bug: skia: Change-Id: I05dd1bdfb68bb40b5393ee854de51795b55ed426 Reviewed-on: https://skia-review.googlesource.com/106480 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Add init-once to threaded backendGravatar Yuqian Li2018-02-12
| | | | | | | | | | | | For the simplicity of this CL, I haven't enabled DAA for init-once yet. The current init-once is only enabled for draw path, and it simply generates the dev path in the init-once phase. Bug: skia: Change-Id: Ie9a9ef9fc453acbdeb48b06b93d578c626961e3f Reviewed-on: https://skia-review.googlesource.com/87784 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Herb Derby <herb@google.com>
* Remove legacy containedInClip codeGravatar Yuqian Li2018-01-09
| | | | | | | | | | | It seems that we've already rebaselined the golden images TBR: reed@google.com Bug: skia:7271 Change-Id: I841dc4933f0cad015c3c6da7bd08ddfb2a35c5a2 Reviewed-on: https://skia-review.googlesource.com/92060 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* GOOGLE3 -> SK_BUILD_FOR_GOOGLE3Gravatar Mike Klein2017-12-19
| | | | | | | | | | | | | This is more consistent with our other SK_BUILD_FOR_... macros, and less likely to collide with other preprocessor logic. (Luckily, this was defined in public.bzl, so we can do this all in one CL in the Skia repo.) Change-Id: I5f232888288c9c53fad445545d983d0fb0b4add8 Reviewed-on: https://skia-review.googlesource.com/86940 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Compute more accurate containedInClipGravatar Yuqian Li2017-11-09
| | | | | | | | | | | | | Eventually, we'll remove containedInClip from the function parameters and just compute it using ir and clipBounds. The current approach is for preparing rebaseline. TBR: reed@google.com Bug: skia:7271 Change-Id: Ife60e173d9f4f1c9ec80d13a2f7a88a0433b61e9 Reviewed-on: https://skia-review.googlesource.com/69220 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* This is a reland of 67340. This CL fixes the broken layout tests byGravatar Yuqian Li2017-11-07
| | | | | | | | | | | preserving the containedInClip boolean. We will eventually remove it and rebaseline the layout tests. Bug: skia:7271 Change-Id: I20e7220340d561ea2c50d30cd5d6ac6d2b4b3743 Reviewed-on: https://skia-review.googlesource.com/68100 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Revert "Simplify fill path call by removing do_fill_path"Gravatar Yuqian Li2017-11-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 12f322b9d4e98619bd128f39b02d3a6f3b78ba79. Reason for revert: Unexpectedly break Chrome layout tests. Will check why. Original change's description: > Simplify fill path call by removing do_fill_path > > The git diff is not very informative for this CL. > Here's a better diff: > > 1. do_fill_path is removed and its content is copied to AntiFillPath > > 2. Any call to do_fill_path is removed. > > 3. std::function FillPathFunc is removed (and replaced by direct > AAAFillPath, DAAFillPath, and SAAFillPath call). > > 4. The old call chain is: > AntiFillPath -> (AAAFillPath/DAAFillPath/...) > -> do_fill_path > -> specific FillPathFunc > The new call chain is: > AntiFillPath -> AAAFillPath/DAAFillPath/SAAFillPath > > This is made possible by the removal of SK_SUPPORT_LEGACY_AA_CHOICE > which makes sure that AntiFillPath is the only function that makes > the choice of AAA/DAA/SAA. > > In the next CL, I'll improve the structure of SkScan::AntiFillPath > to prepare for Threaded Backend's init-once change. > > Bug: skia: > Change-Id: If6ebbdab207cadb7bfe2cb3fcf33ea3d180c3896 > Reviewed-on: https://skia-review.googlesource.com/67340 > Reviewed-by: Mike Reed <reed@google.com> > Reviewed-by: Cary Clark <caryclark@google.com> > Commit-Queue: Yuqian Li <liyuqian@google.com> TBR=caryclark@google.com,liyuqian@google.com,reed@google.com,caryclark@skia.org Change-Id: I7d9517574265db5bc372a5749e6480df8e938f2e No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/67855 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Simplify fill path call by removing do_fill_pathGravatar Yuqian Li2017-11-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The git diff is not very informative for this CL. Here's a better diff: 1. do_fill_path is removed and its content is copied to AntiFillPath 2. Any call to do_fill_path is removed. 3. std::function FillPathFunc is removed (and replaced by direct AAAFillPath, DAAFillPath, and SAAFillPath call). 4. The old call chain is: AntiFillPath -> (AAAFillPath/DAAFillPath/...) -> do_fill_path -> specific FillPathFunc The new call chain is: AntiFillPath -> AAAFillPath/DAAFillPath/SAAFillPath This is made possible by the removal of SK_SUPPORT_LEGACY_AA_CHOICE which makes sure that AntiFillPath is the only function that makes the choice of AAA/DAA/SAA. In the next CL, I'll improve the structure of SkScan::AntiFillPath to prepare for Threaded Backend's init-once change. Bug: skia: Change-Id: If6ebbdab207cadb7bfe2cb3fcf33ea3d180c3896 Reviewed-on: https://skia-review.googlesource.com/67340 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Do not TryBlitFatAntiRect if isInverseGravatar Yuqian Li2017-10-30
| | | | | | | | | | | | | This fixes https://bugs.chromium.org/p/skia/issues/detail?id=7193 That bug only exists in our FDAA (forceDAA) bots (and maybe future threaded backend) because we don't use DAA for convex paths otherwise. Bug: skia:7193 Change-Id: I5e8660012655610417b40d964ee8d21b050a7820 Reviewed-on: https://skia-review.googlesource.com/65061 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Simplify scan converter's argsGravatar Yuqian Li2017-09-28
| | | | | | | | | | | | | | | All scan converters need an SkIRect clipBounds and a bool containedInClip. However, we previously sent in an SkRegion and a SkIRect*, and convert them into clipBounds and containedInClip all over the places. This CL converts them only once inside do_fill_path and change all args to SkIRect and bool. Bug: skia: Change-Id: I05f1d76322942d8817860fd33991f7f7ce918e7c Reviewed-on: https://skia-review.googlesource.com/52741 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Reland blitFatAntiRect with guard to avoid overhead in MaskAdditiveBlitterGravatar Yuqian Li2017-09-25
| | | | | | | | | | | | | | | This results in ~15% (~700ns vs ~600ns) speedup for path_fill_small_rect bench in 8888 config. Some skps have a lot of stroked horizontal/vertical lines (e.g., bar charts) so this improvement could have a great impact there. For example, cereal converts Microsoft word docx to PNGs on server and the sample docx has a big bar chart. That inspired this improvement. Bug: skia: Change-Id: If191b8beca58c5c08b356b64ffef93d51761fd0a Reviewed-on: https://skia-review.googlesource.com/50043 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Yuqian Li <liyuqian@google.com>
* skipRect should only work for lines (not quads or cubics)Gravatar Yuqian Li2017-09-18
| | | | | | | | | | | | | | The added unit test shows that we'll trigger SkASSERT failure if we forgot to check that the edges are lines (instead of quads or cubics). Similar to skia:7015, this bug is not triggered in our production because we don't use DAA for convex paths by default. The skipRect is an optimization just for convex paths. Bug: skia:7051 Change-Id: Id87ce2d452ede0db9a48425541f473af19ee0572 Reviewed-on: https://skia-review.googlesource.com/48045 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Revert "Call blitFatAntiRect to avoid overhead in MaskAdditiveBlitter"Gravatar Mike Klein2017-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6d1aaca8276ff4ae2e10870f7e2c3222907cc4aa. Reason for revert: speculative revert for Google3 diff. Original change's description: > Call blitFatAntiRect to avoid overhead in MaskAdditiveBlitter > > This results in 25% (720ns vs 560ns) speedup for > path_fill_small_rect bench in 8888 config. Some skps have a lot of stroked > horizontal/vertical lines (e.g., bar charts) so this improvement could > have a great impact there. For example, cereal converts Microsoft word docx > to PNGs on server and the sample docx has a big bar chart. That inspired > this improvement. > > Bug: skia: > Change-Id: Icf96c966edf87427b3d1f53da09a49930eda2ac1 > Reviewed-on: https://skia-review.googlesource.com/46584 > Commit-Queue: Yuqian Li <liyuqian@google.com> > Reviewed-by: Mike Klein <mtklein@google.com> TBR=mtklein@google.com,herb@google.com,liyuqian@google.com,reed@google.com Change-Id: Ia30df0be874749c5f8ee0138f3d7d961d5bc3fcf No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/48220 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
* Call blitFatAntiRect to avoid overhead in MaskAdditiveBlitterGravatar Yuqian Li2017-09-18
| | | | | | | | | | | | | | | This results in 25% (720ns vs 560ns) speedup for path_fill_small_rect bench in 8888 config. Some skps have a lot of stroked horizontal/vertical lines (e.g., bar charts) so this improvement could have a great impact there. For example, cereal converts Microsoft word docx to PNGs on server and the sample docx has a big bar chart. That inspired this improvement. Bug: skia: Change-Id: Icf96c966edf87427b3d1f53da09a49930eda2ac1 Reviewed-on: https://skia-review.googlesource.com/46584 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
* Use SkSTArenaAlloc to manage SkCoverageDeltaMask's stack memoryGravatar Yuqian Li2017-09-01
| | | | | | | | | | | | | This way, we could have more stack memory on Google3: if each of the two branche has 12K stack memory, Google3 would believe that it needs 24K stack memory; but using SkSTArenaAlloc, we could use 12K stack memory to handle those two branches. Bug: skia: Change-Id: Ie9234226cd4ba93b5be2ebeb95ab771031354f97 Reviewed-on: https://skia-review.googlesource.com/42101 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Use SkSTArenaAlloc to handle the stack memory of the delta listGravatar Yuqian Li2017-09-01
| | | | | | | | Bug: skia: Change-Id: I5c98220498c71ced4565f492335cef2a372d0765 Reviewed-on: https://skia-review.googlesource.com/41743 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* No chop at y extrema for cubicsGravatar Yuqian Li2017-08-09
| | | | | | | | | | | | | | | | | | The new Delta AA scan converter does not need the edge to be updated with monotonic Y so chopping at y extrema is not necessary. Removing such chopping brings ~10% performance increase to chalkboard.svg which has tons of small cubics (the same is true for many svgs I saw). We didn't remove the chopping for quads because that does not bring a significant speedup. Moreover, dropping those y extremas would make our strokecircle animation look a little more wobbly (because we would have fewer divisions for the quads at the top and bottom of the circle). Bug: skia: Change-Id: I3984d2619f9f77269ed24e8cbfa9f1429ebca4a8 Reviewed-on: https://skia-review.googlesource.com/31940 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Reduce SORT_THRESHOLD to 256Gravatar Yuqian Li2017-08-02
| | | | | | | | | | | | | perf.skia.org showed that reducing the threshold would only harm path_fill_small_sawtooth, but will benefit many many skps and svgs playback. Bug: skia: Change-Id: I38904548206521d78a7c9c5804c0d989b23dc405 TBR: caryclark@google.com, reed@google.com Reviewed-on: https://skia-review.googlesource.com/29882 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Fix flutter and g3 buildGravatar Yuqian Li2017-07-26
| | | | | | | | | | | Replace deprecated function call and reduce stack usage in g3 Bug: skia: Change-Id: Ib49ccecef4711c92ea2e62e772d98c0f5097e30d TBR: reed@google.com, caryclark@google.com Reviewed-on: https://skia-review.googlesource.com/26565 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* New analytic AA scan converter using delta (I call it DAA for now)Gravatar Yuqian Li2017-07-25
DAA is: 1. Much simpler than AAA. SkScan_AAAPath.cpp is about 1700 lines. SkScan_DAAPath.cpp is about 300 lines. The whole DAA CL is only about 800 lines. 2. Much faster than AAA for complicated paths. The speedup applies to GL backend (including ccpr)! Here's the frame time of 'SampleApp --slide Chart' on macbook pro: AAA-raster: 33ms DAA-raster: 21ms AAA-gl: 30ms DAA-gl: 20ms AAA-ccpr: 18ms DAA-ccpr: 12ms My linux desktop doesn't have SSE3 so the speedup is smaller (~25% for Chart). I believe that DAA is so fast that I can enable it for any paths (AAA is not enabled by default for complicated paths because it is slow; hence our older supersampling scan converter is used for stroking on Chart for AAA-xxx config.) 3. The SkCoverageDelta is suitable for threaded backend with out-of-order concurrent scan conversion as commented in the source code. Maybe we can also just send deltas to GPU. 4. Similar to most analytic path renderers, the quality is on the best ground-truth level, unless there are intersections within a pixel. The intersections look good to my eyes although theoretically that could be arbitrary far from the ground truth (see my AAA slides). 5. For simple paths, such as circle, triangle, rrect, etc., DAA is slower than AAA. But DAA is faster than our older supersampling scan converter in most cases. As those simple paths usually don't constitute the bottleneck of a picture (skp or svg), I strongly recommend use DAA. 6. DAA also heavily favors blitMask so it may work quite well with SkRasterPipeline and SkRasterPipelineBlitter. Finally, please check https://skia-review.googlesource.com/c/22420/ which accelerate DAA by specializing blitCoverageDeltas for SkARGB32_Blitter and SkARGB32_Black_Blitter. It brings a little(<5%) speedup. But I couldn't figure out how to reduce the duplicate code so I don't intend to land it. Bug: skia: Change-Id: I3b7ed6a727447922e645b1acb737a506e7c09a4c Reviewed-on: https://skia-review.googlesource.com/19666 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>