WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
79659
Optimize Canvas fill and drawImage with SourceIn, DestinationIn, SourceOut, and DestinationAtop using transparencyLayer.
https://bugs.webkit.org/show_bug.cgi?id=79659
Summary
Optimize Canvas fill and drawImage with SourceIn, DestinationIn, SourceOut, a...
Dongseong Hwang
Reported
2012-02-27 04:10:50 PST
SourceIn, DestinationIn, SourceOut, and DestinationAtop need to update an entire canvas, and transparencyLayer can handle well if amending little. I represented it using GraphicsContextQt that was easy to change. The previous implementation requires new graphicsContext creation. It is better to delegate jobs like this to each platform. Especially, the previous implementation causes large performance hit to GPU implementation (i.e. ACCELERATED_2D_CANVAS). If other ports implement endTransparencyLayer like Qt, fullCanvasCompositedFill and fullCanvasCompositedDrawImage can be removed. Following test cases cover this patch. fast/canvas/canvas-composite-alpha.html fast/canvas/canvas-composite-canvas.html fast/canvas/canvas-composite-fill-repaint.html fast/canvas/canvas-composite-image.html fast/canvas/canvas-composite-transformclip.html fast/canvas/canvas-composite.html
Attachments
patch
(14.79 KB, patch)
2012-02-27 04:15 PST
,
Dongseong Hwang
no flags
Details
Formatted Diff
Diff
patch v.2
(14.78 KB, patch)
2012-02-27 04:21 PST
,
Dongseong Hwang
simon.fraser
: review-
pnormand
: commit-queue-
Details
Formatted Diff
Diff
patch v.3
(19.57 KB, patch)
2012-02-27 16:16 PST
,
Dongseong Hwang
simon.fraser
: review-
simon.fraser
: commit-queue-
Details
Formatted Diff
Diff
patch v.4
(17.06 KB, patch)
2012-02-27 16:42 PST
,
Dongseong Hwang
darin
: review-
darin
: commit-queue-
Details
Formatted Diff
Diff
Patch
(6.41 KB, patch)
2014-04-07 06:01 PDT
,
Dirk Schulze
kling
: review+
Details
Formatted Diff
Diff
Patch for landing
(4.16 KB, patch)
2014-04-11 05:57 PDT
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Patch
(8.54 KB, patch)
2014-04-14 01:00 PDT
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Dongseong Hwang
Comment 1
2012-02-27 04:15:22 PST
Created
attachment 129010
[details]
patch
WebKit Review Bot
Comment 2
2012-02-27 04:18:54 PST
Attachment 129010
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/platform/graphics/GraphicsContext.h:369: The parameter name "op" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WebCore/platform/graphics/GraphicsContext.h:547: The parameter name "op" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 2 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Dongseong Hwang
Comment 3
2012-02-27 04:21:16 PST
Created
attachment 129011
[details]
patch v.2
Philippe Normand
Comment 4
2012-02-27 04:39:30 PST
Comment on
attachment 129011
[details]
patch v.2
Attachment 129011
[details]
did not pass gtk-ews (gtk): Output:
http://queues.webkit.org/results/11640014
Gyuyoung Kim
Comment 5
2012-02-27 04:40:26 PST
Comment on
attachment 129011
[details]
patch v.2
Attachment 129011
[details]
did not pass efl-ews (efl): Output:
http://queues.webkit.org/results/11628988
Simon Fraser (smfr)
Comment 6
2012-02-27 09:52:34 PST
Comment on
attachment 129011
[details]
patch v.2 View in context:
https://bugs.webkit.org/attachment.cgi?id=129011&action=review
> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:935 > +#if PLATFORM(QT)
We try to discourage platform #ifdefs like this in common code. It would be much better if the #ifdef was something like TRANSPARENCYLAYER_USES_COMPOSITING_OPERATOR or something.
> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:990 > -void GraphicsContext::endPlatformTransparencyLayer() > +void GraphicsContext::endPlatformTransparencyLayer(CompositeOperator)
I think this patch should at least add an assertion that the operator is srcOver on all platforms where you leave it unimplemented.
Dongseong Hwang
Comment 7
2012-02-27 15:41:38 PST
Thank for guide. Can I define guard in wtf/Platform.h ?
Dongseong Hwang
Comment 8
2012-02-27 16:16:46 PST
Created
attachment 129122
[details]
patch v.3
Dongseong Hwang
Comment 9
2012-02-27 16:17:39 PST
Defined ENABLE_TRANSPARENCYLAYER_USES_COMPOSITING_OPERATOR. Build fix for cairo.
Simon Fraser (smfr)
Comment 10
2012-02-27 16:28:38 PST
Comment on
attachment 129122
[details]
patch v.3 View in context:
https://bugs.webkit.org/attachment.cgi?id=129122&action=review
> Source/JavaScriptCore/wtf/Platform.h:824 > +#if !defined(ENABLE_TRANSPARENCYLAYER_USES_COMPOSITING_OPERATOR) > +#define ENABLE_TRANSPARENCYLAYER_USES_COMPOSITING_OPERATOR 0 > +#endif
Ugh, this will force a world rebuild for everyone. Just put this in GraphicsContext.h or somewhere.
Dongseong Hwang
Comment 11
2012-02-27 16:42:06 PST
Created
attachment 129128
[details]
patch v.4
Dongseong Hwang
Comment 12
2012-02-27 16:43:55 PST
I hesitated that it was right, also.
Dongseong Hwang
Comment 13
2012-02-27 17:01:00 PST
This patch is applied to only Qt. However, Qt will do correctly after
Bug 79658
is committed.
Dirk Schulze
Comment 14
2013-02-16 00:30:14 PST
Comment on
attachment 129128
[details]
patch v.4 View in context:
https://bugs.webkit.org/attachment.cgi?id=129128&action=review
> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:943 > fullCanvasCompositedFill(m_path);
Can't this logic go to fullCanvasCompositedFill instead?
> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:1064 > fullCanvasCompositedFill(rect);
Ditto.
> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:1305 > fullCanvasCompositedDrawImage(cachedImage->imageForRenderer(image->renderer()), ColorSpaceDeviceRGB, normalizedDstRect, normalizedSrcRect, op);
fullCanvasCompositedDrawImage here.
> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:1397 > fullCanvasCompositedDrawImage(buffer, ColorSpaceDeviceRGB, bufferSrcRect, srcRect, state().m_globalComposite);
Ditto.
Renata Hodovan
Comment 15
2013-11-04 06:33:11 PST
What is the current status of this bug?
Allan Sandfeld Jensen
Comment 16
2013-11-04 06:52:39 PST
(In reply to
comment #15
)
> What is the current status of this bug?
Does it apply and work on the qt5x2 branch
https://gitorious.org/qtwebkit/qt5x2/
? For webkit trunk I guess it would need one of the other ports to be using the code before it would be accepted.
Darin Adler
Comment 17
2013-11-04 09:41:48 PST
Comment on
attachment 129128
[details]
patch v.4 The current patch is a Qt-only optimization, and that port is no longer in TOT WebKit. It would be OK to do that optimization for some other platform, or for all platforms.
Dirk Schulze
Comment 18
2014-04-07 06:01:31 PDT
Created
attachment 228730
[details]
Patch
Andreas Kling
Comment 19
2014-04-07 10:03:12 PDT
Comment on
attachment 228730
[details]
Patch r=me, awesome! Maybe you could check in the test first and let the bot chew on it for one round, so we can see the needle jump? ;)
Dirk Schulze
Comment 20
2014-04-11 05:37:58 PDT
Committed
r167123
: <
http://trac.webkit.org/changeset/167123
>
WebKit Commit Bot
Comment 21
2014-04-11 05:41:48 PDT
Re-opened since this is blocked by
bug 131538
Dirk Schulze
Comment 22
2014-04-11 05:45:30 PDT
Committed
r167124
: <
http://trac.webkit.org/changeset/167124
>
Dirk Schulze
Comment 23
2014-04-11 05:57:48 PDT
Created
attachment 229128
[details]
Patch for landing
Dirk Schulze
Comment 24
2014-04-14 01:00:58 PDT
Created
attachment 229271
[details]
Patch
Darin Adler
Comment 25
2014-04-14 08:31:51 PDT
Comment on
attachment 229271
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=229271&action=review
> Source/WebCore/ChangeLog:18 > + An inline function will create a transparency layer for CG. Cairo graphics > + does not composite correctly when a transparency layer gets created. > + The inline function is just a NOOP for Cairo.
Why is this OK for Cairo? Does this behave correctly on Cairo?
Dirk Schulze
Comment 26
2014-04-14 08:40:46 PDT
(In reply to
comment #25
)
> (From update of
attachment 229271
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=229271&action=review
> > > Source/WebCore/ChangeLog:18 > > + An inline function will create a transparency layer for CG. Cairo graphics > > + does not composite correctly when a transparency layer gets created. > > + The inline function is just a NOOP for Cairo. > > Why is this OK for Cairo? Does this behave correctly on Cairo?
Yes, I build it with Cairo as well. The existing tests pass now which were skipped before.
WebKit Commit Bot
Comment 27
2014-04-14 09:02:31 PDT
Comment on
attachment 229271
[details]
Patch Clearing flags on attachment: 229271 Committed
r167248
: <
http://trac.webkit.org/changeset/167248
>
WebKit Commit Bot
Comment 28
2014-04-14 09:02: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.
Top of Page
Format For Printing
XML
Clone This Bug