Bug 111635 - [chromium] Stop using WebTransformationMatrix on WebLayer
Summary: [chromium] Stop using WebTransformationMatrix on WebLayer
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: James Robinson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-06 15:43 PST by James Robinson
Modified: 2013-03-07 13:55 PST (History)
10 users (show)

See Also:


Attachments
Patch (8.27 KB, patch)
2013-03-06 15:45 PST, James Robinson
no flags Details | Formatted Diff | Diff
remove unnecessary include from WebLayer (7.10 KB, patch)
2013-03-07 10:57 PST, James Robinson
enne: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Robinson 2013-03-06 15:43:20 PST
[chromium] Stop using WebTransformationMatrix on WebLayer
Comment 1 James Robinson 2013-03-06 15:45:26 PST
Created attachment 191854 [details]
Patch
Comment 2 James Robinson 2013-03-06 15:46:54 PST
This won't compile on clang bots until https://chromiumcodereview.appspot.com/12481008/.  Most of WebTransformationMatrix is already dead code, but it's still being used as a transit type in WebTransformAnimationCurve and WebTransformOperations.  Will have to land more code chromium-side first to get rid of those.
Comment 3 WebKit Review Bot 2013-03-06 15:58:25 PST
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 4 vollick 2013-03-06 18:26:52 PST
Comment on attachment 191854 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=191854&action=review

I like it -- I just have a couple of dumb questions.

> Source/Platform/chromium/public/WebLayer.h:36
> +#include "WebTransformationMatrix.h"

What's this being added for?

> Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp:723
> +    return ret;

Given how Matrix4 is laid out, could you take advantage of SkMatrix44's setColMajord or setRowMajord.
Comment 5 James Robinson 2013-03-07 10:51:51 PST
(In reply to comment #4)
> (From update of attachment 191854 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=191854&action=review
> 
> I like it -- I just have a couple of dumb questions.
> 
> > Source/Platform/chromium/public/WebLayer.h:36
> > +#include "WebTransformationMatrix.h"
> 
> What's this being added for?
> 

No need, will remove.

> > Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp:723
> > +    return ret;
> 
> Given how Matrix4 is laid out, could you take advantage of SkMatrix44's setColMajord or setRowMajord.

Do you have an example of code that does this?  This code is doing the same thing that WebTransformationMatrixUtil::ToTransform() does.
Comment 6 James Robinson 2013-03-07 10:57:42 PST
Created attachment 192047 [details]
remove unnecessary include from WebLayer
Comment 7 Shawn Singh 2013-03-07 11:20:36 PST
> 
> > Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp:723
> > +    return ret;
> 
> Given how Matrix4 is laid out, could you take advantage of SkMatrix44's setColMajord or setRowMajord.

Unfortunately I think doing that would require an extra intermediate float[16] array, and it seems not worth it to cause that extra copy.  So my vote is that we should keep the code the way James has it now - what do you think Ian?
Comment 8 vollick 2013-03-07 12:02:09 PST
(In reply to comment #7)
> > 
> > > Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp:723
> > > +    return ret;
> > 
> > Given how Matrix4 is laid out, could you take advantage of SkMatrix44's setColMajord or setRowMajord.
> 
> Unfortunately I think doing that would require an extra intermediate float[16] array, and it seems not worth it to cause that extra copy.  So my vote is that we should keep the code the way James has it now - what do you think Ian?

Please forgive me if this is dumb, but if we have:
double m[4][4];
and we assign
double *linear = &m[0][0];
then can't we can access linear[0] through linear[15]? This seemed to work in a test program of mine, but perhaps we're not guaranteed that the 2D array will be laid out in such a way to allow this?

If this isn't crazy, then we should be able to pass the Matrix4 owned by the TransformationMatrix directly to SkMatrix44::setColMajord or SkMatrix44::setRowMajord (I'm not sure which, I always get this wrong and end up transposed).
Comment 9 Shawn Singh 2013-03-07 12:07:49 PST
(In reply to comment #8)
> (In reply to comment #7)
> > > 
> > > > Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp:723
> > > > +    return ret;
> > > 
> > > Given how Matrix4 is laid out, could you take advantage of SkMatrix44's setColMajord or setRowMajord.
> > 
> > Unfortunately I think doing that would require an extra intermediate float[16] array, and it seems not worth it to cause that extra copy.  So my vote is that we should keep the code the way James has it now - what do you think Ian?
> 
> Please forgive me if this is dumb, but if we have:
> double m[4][4];
> and we assign
> double *linear = &m[0][0];
> then can't we can access linear[0] through linear[15]? This seemed to work in a test program of mine, but perhaps we're not guaranteed that the 2D array will be laid out in such a way to allow this?
> 
> If this isn't crazy, then we should be able to pass the Matrix4 owned by the TransformationMatrix directly to SkMatrix44::setColMajord or SkMatrix44::setRowMajord (I'm not sure which, I always get this wrong and end up transposed).

I think TransformationMatrix is laid out as column-major.  So if that works, and it's not considered taboo, that's OK with me =)   I was more specifically looking at the toColumnMajorFloatArray() function in TransformationMatrix.
Comment 10 James Robinson 2013-03-07 12:18:21 PST
This is all fine but this patch is just removing dependencies and preserves the existing behavior exactly.  I'd rather not try to do too many things at once.
Comment 11 Shawn Singh 2013-03-07 12:22:24 PST
unofficially this patch LGTM, you might want to remove the "no new tests oops" line in the changelog.

Ian and I can resolve the optimizations later, then.
Comment 12 Adrienne Walker 2013-03-07 12:24:37 PST
Comment on attachment 192047 [details]
remove unnecessary include from WebLayer

R=me.
Comment 13 James Robinson 2013-03-07 13:55:50 PST
Committed r145131: <http://trac.webkit.org/changeset/145131>