RESOLVED FIXED 74183
[Chromium] With the skia port, setting LCD text filtering is causing texture cache invalidations of gpu canvas backing store
https://bugs.webkit.org/show_bug.cgi?id=74183
Summary [Chromium] With the skia port, setting LCD text filtering is causing texture ...
Justin Novosad
Reported 2011-12-09 07:22:50 PST
Function isCanvasMultiLayered in SkiaFontWin.cpp creates a layer iterator for the sole purpose of verifying the existence of multiple layers. The iterator assumes that it is used for drawing, and therefore makes a call to SkDevice::accessBitmap, which triggers a pixels changed notification, resulting in a GPU texture invalidation in Skia's caching system. The unnecessary invalidations are preventing the cache form working properly.
Attachments
Patch (10.50 KB, patch)
2012-04-05 09:37 PDT, Justin Novosad
no flags
Patch (10.50 KB, patch)
2012-04-05 10:50 PDT, Justin Novosad
no flags
Justin Novosad
Comment 1 2011-12-09 07:41:41 PST
The main use case where this causes trouble is with canvas to canvas draws from a software canvas to a GPU accelerated canvas. The backing store of the source canvas gets cached on the GPU.
Jin Yang
Comment 2 2011-12-13 21:13:16 PST
Bug 73186 is also related to the generation id management.
Justin Novosad
Comment 3 2012-04-05 09:37:01 PDT
Justin Novosad
Comment 4 2012-04-05 09:39:54 PDT
(In reply to comment #3) > Created an attachment (id=135840) [details] > Patch In this patch I removed all unnecessary uses of LayerIter that could be replaced with SkCanvas::isDrawingToLayer, not just the one in SkiaFontWin.cpp
Dana Jansens
Comment 5 2012-04-05 09:42:51 PDT
Comment on attachment 135840 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=135840&action=review > Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp:143 > + } else if (m_createdTransparencyLayer || m_platformContext->canvas()->isDrawingToLayer()) { None of these changes are functionally the same, however. The old code checked if there was > 1 layer present. The new code checks if there is > 0 layers present.
Justin Novosad
Comment 6 2012-04-05 10:27:24 PDT
(In reply to comment #5) > (From update of attachment 135840 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=135840&action=review > > > Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp:143 > > + } else if (m_createdTransparencyLayer || m_platformContext->canvas()->isDrawingToLayer()) { > > None of these changes are functionally the same, however. The old code checked if there was > 1 layer present. The new code checks if there is > 0 layers present. Actually, behavior is the same. It is a little confusing, but the fLayerCount in SkCanvas represents the number of saved layers, which does not include the root layer.
Justin Novosad
Comment 7 2012-04-05 10:31:00 PDT
(In reply to comment #6) > Actually, behavior is the same. It is a little confusing, but the fLayerCount in SkCanvas represents the number of saved layers, which does not include the root layer. There is clearly a readability issue here. I think I will rename fLayerCount to fSavedLayerCount, to make things clearer in SkCanvas.
Dana Jansens
Comment 8 2012-04-05 10:37:00 PDT
Comment on attachment 135840 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=135840&action=review >>> Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp:143 >>> + } else if (m_createdTransparencyLayer || m_platformContext->canvas()->isDrawingToLayer()) { >> >> None of these changes are functionally the same, however. The old code checked if there was > 1 layer present. The new code checks if there is > 0 layers present. > > Actually, behavior is the same. It is a little confusing, but the fLayerCount in SkCanvas represents the number of saved layers, which does not include the root layer. I see, thanks for the clarification. Making that more clear in Skia would be great :)
Stephen White
Comment 9 2012-04-05 10:43:52 PDT
Comment on attachment 135840 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=135840&action=review > Source/WebKit/chromium/src/WebFontImpl.cpp:116 > + if (canvasIsOpaque && SkColorGetA(color) == 0xFF && !const_cast<SkCanvas*>(canvas)->isDrawingToLayer()) { Not your fault, but is this const_cast necessary anymore? isDrawingToLayer() is const.
Justin Novosad
Comment 10 2012-04-05 10:50:40 PDT
Stephen White
Comment 11 2012-04-05 10:54:29 PDT
Comment on attachment 135858 [details] Patch Looks good! r=me
WebKit Review Bot
Comment 12 2012-04-05 11:49:33 PDT
Comment on attachment 135858 [details] Patch Clearing flags on attachment: 135858 Committed r113345: <http://trac.webkit.org/changeset/113345>
WebKit Review Bot
Comment 13 2012-04-05 11:49:45 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.