Page MenuHomePhabricator

Bug 1614890 - Implement conic-gradient for WebRender graphics backend.
ClosedPublic

Authored by ntim on Feb 4 2020, 5:28 PM.

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
ntim updated this revision to Diff 226220.Feb 8 2020, 12:08 PM
ntim added Bugzilla Bug ID 1175958.
ntim planned changes to this revision.Feb 8 2020, 12:08 PM
ntim updated this revision to Diff 226221.Feb 8 2020, 12:51 PM

Revision updated.

ntim planned changes to this revision.Feb 8 2020, 12:51 PM
ntim updated this revision to Diff 226228.Feb 8 2020, 5:16 PM
ntim planned changes to this revision.Feb 8 2020, 5:16 PM
ntim updated this revision to Diff 226230.Feb 8 2020, 6:23 PM

Revision updated.

ntim updated this revision to Diff 226257.Feb 9 2020, 9:25 AM

Revision updated.

ntim planned changes to this revision.Feb 9 2020, 9:25 AM

Code analysis found 9 defects in the diff 226257:

  • 7 defects found by clang-format
  • 2 defects found by clang-tidy

You can run this analysis locally with:

  • ./mach clang-format -s -p gfx/webrender_bindings/WebRenderAPI.h gfx/webrender_bindings/WebRenderAPI.cpp (C/C++)
  • ./mach static-analysis check gfx/webrender_bindings/WebRenderAPI.cpp (C/C++)

For your convenience, here is a patch that fixes all the source-test-clang-format defects (use it in your repository with hg import or git apply -p0).

If you see a problem in this automated review, please report it here.

gfx/webrender_bindings/WebRenderAPI.cpp
1206

Warning: Narrowing conversion from 'double' to 'float' [clang-tidy: cppcoreguidelines-narrowing-conversions]
Checker reliability is high, meaning that the false positive ratio is low.

1339

Warning: Narrowing conversion from 'double' to 'float' [clang-tidy: cppcoreguidelines-narrowing-conversions]
Checker reliability is high, meaning that the false positive ratio is low.

In our previous code coverage analysis run, we found some files which had no coverage and are being modified in this patch:

Should they have tests, or are they dead code ?

  • You can file a bug blocking Bug 1415824 for untested files that should be tested.
  • You can file a bug blocking Bug 1415819 for untested files that should be removed.

If you see a problem in this automated review, please report it here.

ntim added a reviewer: gw.Feb 9 2020, 4:07 PM
ntim updated this revision to Diff 226277.Feb 9 2020, 4:16 PM

Code analysis found 9 defects in the diff 226277:

  • 7 defects found by clang-format
  • 2 defects found by clang-tidy

You can run this analysis locally with:

  • ./mach clang-format -s -p gfx/webrender_bindings/WebRenderAPI.cpp gfx/webrender_bindings/WebRenderAPI.h (C/C++)
  • ./mach static-analysis check gfx/webrender_bindings/WebRenderAPI.cpp (C/C++)

For your convenience, here is a patch that fixes all the source-test-clang-format defects (use it in your repository with hg import or git apply -p0).

If you see a problem in this automated review, please report it here.

gfx/webrender_bindings/WebRenderAPI.cpp
1206

Warning: Narrowing conversion from 'double' to 'float' [clang-tidy: cppcoreguidelines-narrowing-conversions]
Checker reliability is high, meaning that the false positive ratio is low.

1339

Warning: Narrowing conversion from 'double' to 'float' [clang-tidy: cppcoreguidelines-narrowing-conversions]
Checker reliability is high, meaning that the false positive ratio is low.

In our previous code coverage analysis run, we found some files which had no coverage and are being modified in this patch:

Should they have tests, or are they dead code ?

  • You can file a bug blocking Bug 1415824 for untested files that should be tested.
  • You can file a bug blocking Bug 1415819 for untested files that should be removed.

If you see a problem in this automated review, please report it here.

ntim requested review of this revision.Feb 9 2020, 8:12 PM
gw added a comment.Feb 9 2020, 9:29 PM

Amazing work, from a quick read this looks pretty good to me! I'll take a detailed look later today, and maybe we'll get Nical to take a quick look over the C++ and brush bits.

Does this result in any Gecko reftests becoming unexpected PASS results?

One thing I'd like to do in future with the gradient code is make them all work like the linear fast path. That is, the gradient is rendered once into the texture cache and persisted there, and then each frame that pre-rendered gradient is drawn with the brush_image shader. This gives us better performance and batching during the scene draw, especially for large gradients. However, we can do that as a follow up in future (when we will also do this for radial gradients etc), there's no need to block an initial implementation because of that.

gw added a reviewer: nical.Feb 9 2020, 10:40 PM

This looks good to me for the rust parts. Added Nical to take a look at the C++ and brush parts. Added a few comments, mostly related to test coverage and future optimization, nothing major.

gfx/wr/webrender/src/scene_builder_thread.rs
20

nit: Seems like this shouldn't be needed, since there's no other changes in the file that reference it?

gfx/wr/wrench/reftests/gradient/conic-simple.yaml
8

Could we extend this test to have multiple gradients, each with a different angle? And perhaps some with multiple stops, just to give us a bit more test coverage here?

It'd be good to have some test cases for the conic gradient + border case too.

If you prefer, extending the test suite as a follow up patch is fine.

gw added 1 blocking reviewer(s): nical.Feb 9 2020, 11:45 PM
nical added a comment.Feb 10 2020, 1:57 PM

Great stuff! just a few nits to fix just like Glenn. r=me otherwise

gfx/webrender_bindings/WebRenderAPI.cpp
1201

Please make aAngle a float to match what's actually happening under the hood.

gfx/wr/webrender/src/renderer.rs
158

nit: let's use another color so that we can differential conic from radial gradients in the builtin profiler.

ntim marked 8 inline comments as done.Feb 10 2020, 2:54 PM
ntim added inline comments.
gfx/wr/webrender/src/scene_builder_thread.rs
20

Seems like it doesn't compile with this import removed, so I'll leave this in for now.

FWIW, LinearGradient and RadialGradient are also not referenced directly in this file. It's possible that another file depends on it ?

gfx/wr/wrench/reftests/gradient/conic-simple.yaml
8

I've added some extra test cases for a different angle and one with multiple stops. I'll file a new bug to extend the test suite further.

ntim updated this revision to Diff 226516.Feb 10 2020, 2:55 PM
ntim marked 2 inline comments as done.

Revision updated.

ntim updated this revision to Diff 226519.Feb 10 2020, 3:00 PM

Revision updated.

Code analysis found 12 defects in the diff 226516:

  • 12 defects found by clang-format

You can run this analysis locally with:

  • ./mach clang-format -s -p gfx/webrender_bindings/WebRenderAPI.cpp gfx/webrender_bindings/WebRenderAPI.h (C/C++)

For your convenience, here is a patch that fixes all the source-test-clang-format defects (use it in your repository with hg import or git apply -p0).

The analysis task source-test-coverity-coverity failed, but we could not detect any issue.
Please check this task manually.

If you see a problem in this automated review, please report it here.

In our previous code coverage analysis run, we found some files which had no coverage and are being modified in this patch:

Should they have tests, or are they dead code ?

  • You can file a bug blocking Bug 1415824 for untested files that should be tested.
  • You can file a bug blocking Bug 1415819 for untested files that should be removed.

If you see a problem in this automated review, please report it here.

Code analysis found 12 defects in the diff 226519:

  • 12 defects found by clang-format

You can run this analysis locally with:

  • ./mach clang-format -s -p gfx/webrender_bindings/WebRenderAPI.h gfx/webrender_bindings/WebRenderAPI.cpp (C/C++)

For your convenience, here is a patch that fixes all the source-test-clang-format defects (use it in your repository with hg import or git apply -p0).

If you see a problem in this automated review, please report it here.

In our previous code coverage analysis run, we found some files which had no coverage and are being modified in this patch:

Should they have tests, or are they dead code ?

  • You can file a bug blocking Bug 1415824 for untested files that should be tested.
  • You can file a bug blocking Bug 1415819 for untested files that should be removed.

If you see a problem in this automated review, please report it here.

gw accepted this revision.Feb 10 2020, 8:28 PM

Looks like this is almost ready to merge. Could you apply the formatting patch referenced in https://phabricator.services.mozilla.com/D61599#1894721, and then this should be good, I think.

ntim updated this revision to Diff 227086.Feb 11 2020, 8:33 AM

Revision updated.

In our previous code coverage analysis run, we found some files which had no coverage and are being modified in this patch:

Should they have tests, or are they dead code ?

  • You can file a bug blocking Bug 1415824 for untested files that should be tested.
  • You can file a bug blocking Bug 1415819 for untested files that should be removed.

If you see a problem in this automated review, please report it here.

nical accepted this revision.Feb 11 2020, 9:59 AM
This revision is now accepted and ready to land.Feb 11 2020, 9:59 AM
ntim retitled this revision from Bug 1175958 - Implement conic-gradient for WebRender graphics backend. to Bug 1614890 - Implement conic-gradient for WebRender graphics backend..Feb 12 2020, 8:49 AM
ntim changed the Bugzilla Bug ID from 1175958 to 1614890.
malexandru reopened this revision.Feb 12 2020, 9:27 AM
This revision is now accepted and ready to land.Feb 12 2020, 9:27 AM
ntim updated this revision to Diff 227749.Feb 12 2020, 10:21 AM

Revision updated.

In our previous code coverage analysis run, we found some files which had no coverage and are being modified in this patch:

Should they have tests, or are they dead code ?

  • You can file a bug blocking Bug 1415824 for untested files that should be tested.
  • You can file a bug blocking Bug 1415819 for untested files that should be removed.

If you see a problem in this automated review, please report it here.

malexandru reopened this revision.Feb 12 2020, 3:18 PM
This revision is now accepted and ready to land.Feb 12 2020, 3:18 PM
emilio added a subscriber: emilio.Feb 12 2020, 3:56 PM
emilio added inline comments.
gfx/wr/webrender/src/prim_store/gradient.rs
572

You should probably comment the unit this angle is in... radians I guess?

emilio requested changes to this revision.Feb 12 2020, 4:00 PM
emilio added inline comments.
gfx/wr/webrender_api/src/api.rs
1162

You forgot this part, this is why your patch is crashing while reporting memory.

This revision now requires changes to proceed.Feb 12 2020, 4:00 PM
ntim updated this revision to Diff 227993.Feb 12 2020, 6:06 PM

Revision updated.

emilio accepted this revision.Feb 12 2020, 6:08 PM

Thanks :)

This revision is now accepted and ready to land.Feb 12 2020, 6:08 PM
ntim marked 2 inline comments as done.Feb 12 2020, 6:23 PM

In our previous code coverage analysis run, we found some files which had no coverage and are being modified in this patch:

Should they have tests, or are they dead code ?

  • You can file a bug blocking Bug 1415824 for untested files that should be tested.
  • You can file a bug blocking Bug 1415819 for untested files that should be removed.

If you see a problem in this automated review, please report it here.