⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267382 in webkit


Ignore:
Timestamp:
Sep 21, 2020, 4:25:25 PM (6 years ago)
Author:
Wenson Hsieh
Message:

[GPU Process] Several tests in canvas/philip/tests are failing with text diffs
https://bugs.webkit.org/show_bug.cgi?id=216800

Reviewed by Darin Adler.

When using the GPU process to render canvas elements, we currently fail the 7 tests in canvas/philip/tests
below, due to gradient and pattern fill/stroke styles lingering on the 2D graphics context state after a fill or
stroke color is set, respectively.

This happens when:

  1. The fill color is set to a color C.
  2. A fill pattern or gradient is applied.
  3. The fill color is set to the color C again.

In this case, after step (2), we propagate a graphics context state change indicating that the fill pattern has
changed, but we leave the fill color unchanged (i.e., it remains equal to C). In step (3), we then set the
fill color to C again, which doesn't propagate a state change to the GPU process, since the fill color is the
same (C). As such, the state in the GPU process keeps its fill gradient, and we end up filling with this old
gradient instead of the fill color C.

To fix this, we simply revert fillColor and strokeColor to the invalid color when setting a gradient or
pattern in the same way that we currently clear out the fill/stroke gradient and pattern when setting a fill/
stroke color, which ensures that a state change will be sent to the GPU process during step (3).

Fixes the following canvas-related layout tests when using the GPU process:

  • canvas/philip/tests/2d.gradient.radial.cone.shape2.html
  • canvas/philip/tests/2d.pattern.basic.nocontext.html
  • canvas/philip/tests/2d.pattern.paint.norepeat.coord3.html
  • canvas/philip/tests/2d.pattern.paint.repeatx.coord1.html
  • canvas/philip/tests/2d.pattern.paint.repeatx.outside.html
  • canvas/philip/tests/2d.pattern.paint.repeaty.coord1.html
  • canvas/philip/tests/2d.pattern.paint.repeaty.outside.html

The entire canvas/ directory is currently skipped when enabling the GPU process for canvas rendering, but once
we're down to a smaller number of failures, I intend to unskip these directories for GPU process, and
individually track any remaining test failures.

  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::setStrokePattern):
(WebCore::GraphicsContext::setFillPattern):
(WebCore::GraphicsContext::setStrokeGradient):
(WebCore::GraphicsContext::setFillGradient):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r267381 r267382  
     12020-09-21  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [GPU Process] Several tests in canvas/philip/tests are failing with text diffs
     4        https://bugs.webkit.org/show_bug.cgi?id=216800
     5
     6        Reviewed by Darin Adler.
     7
     8        When using the GPU process to render canvas elements, we currently fail the 7 tests in `canvas/philip/tests`
     9        below, due to gradient and pattern fill/stroke styles lingering on the 2D graphics context state after a fill or
     10        stroke color is set, respectively.
     11
     12        This happens when:
     13        1. The fill color is set to a color `C`.
     14        2. A fill pattern or gradient is applied.
     15        3. The fill color is set to the color `C` again.
     16
     17        In this case, after step (2), we propagate a graphics context state change indicating that the fill pattern has
     18        changed, but we leave the fill color unchanged (i.e., it remains equal to `C`). In step (3), we then set the
     19        fill color to `C` again, which doesn't propagate a state change to the GPU process, since the fill color is the
     20        same (`C`). As such, the state in the GPU process keeps its fill gradient, and we end up filling with this old
     21        gradient instead of the fill color `C`.
     22
     23        To fix this, we simply revert `fillColor` and `strokeColor` to the invalid color when setting a gradient or
     24        pattern in the same way that we currently clear out the fill/stroke gradient and pattern when setting a fill/
     25        stroke color, which ensures that a state change will be sent to the GPU process during step (3).
     26
     27        Fixes the following canvas-related layout tests when using the GPU process:
     28        - canvas/philip/tests/2d.gradient.radial.cone.shape2.html
     29        - canvas/philip/tests/2d.pattern.basic.nocontext.html
     30        - canvas/philip/tests/2d.pattern.paint.norepeat.coord3.html
     31        - canvas/philip/tests/2d.pattern.paint.repeatx.coord1.html
     32        - canvas/philip/tests/2d.pattern.paint.repeatx.outside.html
     33        - canvas/philip/tests/2d.pattern.paint.repeaty.coord1.html
     34        - canvas/philip/tests/2d.pattern.paint.repeaty.outside.html
     35
     36        The entire canvas/ directory is currently skipped when enabling the GPU process for canvas rendering, but once
     37        we're down to a smaller number of failures, I intend to unskip these directories for GPU process, and
     38        individually track any remaining test failures.
     39
     40        * platform/graphics/GraphicsContext.cpp:
     41        (WebCore::GraphicsContext::setStrokePattern):
     42        (WebCore::GraphicsContext::setFillPattern):
     43        (WebCore::GraphicsContext::setStrokeGradient):
     44        (WebCore::GraphicsContext::setFillGradient):
     45
    1462020-09-21  Chris Dumez  <cdumez@apple.com>
    247
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r265261 r267382  
    603603void GraphicsContext::setStrokePattern(Ref<Pattern>&& pattern)
    604604{
     605    m_state.strokeColor = { };
    605606    m_state.strokeGradient = nullptr;
    606607    m_state.strokePattern = WTFMove(pattern);
     
    611612void GraphicsContext::setFillPattern(Ref<Pattern>&& pattern)
    612613{
     614    m_state.fillColor = { };
    613615    m_state.fillGradient = nullptr;
    614616    m_state.fillPattern = WTFMove(pattern);
     
    619621void GraphicsContext::setStrokeGradient(Ref<Gradient>&& gradient)
    620622{
     623    m_state.strokeColor = { };
    621624    m_state.strokeGradient = WTFMove(gradient);
    622625    m_state.strokePattern = nullptr;
     
    634637void GraphicsContext::setFillGradient(Ref<Gradient>&& gradient)
    635638{
     639    m_state.fillColor = { };
    636640    m_state.fillGradient = WTFMove(gradient);
    637641    m_state.fillPattern = nullptr;
Note: See TracChangeset for help on using the changeset viewer.