Bug 91350 - [chromium] Unify compositor quad transforms into content space
Summary: [chromium] Unify compositor quad transforms into content space
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: Adrienne Walker
URL:
Keywords:
Depends on:
Blocks: 91417
  Show dependency treegraph
 
Reported: 2012-07-15 17:26 PDT by Adrienne Walker
Modified: 2012-07-16 16:45 PDT (History)
10 users (show)

See Also:


Attachments
Patch (13.22 KB, patch)
2012-07-15 17:42 PDT, Adrienne Walker
no flags Details | Formatted Diff | Diff
Patch (17.96 KB, patch)
2012-07-16 12:27 PDT, Adrienne Walker
no flags Details | Formatted Diff | Diff
Handle empty bounds in create quad state (17.53 KB, patch)
2012-07-16 12:55 PDT, Adrienne Walker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrienne Walker 2012-07-15 17:26:39 PDT
[chromium] Unify compositor quad transforms into content space
Comment 1 Adrienne Walker 2012-07-15 17:42:39 PDT
Created attachment 152466 [details]
Patch
Comment 2 Adrienne Walker 2012-07-15 17:44:28 PDT
shawnsingh, danakj: Could one or both of y'all unofficially review this patch?
Comment 3 Adrienne Walker 2012-07-16 00:22:04 PDT
Comment on attachment 152466 [details]
Patch

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

> Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp:160
> +    if (contentBounds().isEmpty())
> +        quadTransformation.scale(1 / contentsScale());
> +    else {
> +        quadTransformation.scaleNonUniform(bounds().width() / static_cast<double>(contentBounds().width()),
> +                                  bounds().height() / static_cast<double>(contentBounds().height()));
> +        quadTransformation.translate(-contentBounds().width() / 2.0, -contentBounds().height() / 2.0);
> +    }

In retrospect, I don't think this is always right, but I'm not sure how to reconcile contentsScale which is a single value and the contentBounds/bounds ratio that handles different integer rounding in width and height.
Comment 4 Dana Jansens 2012-07-16 07:57:36 PDT
Comment on attachment 152466 [details]
Patch

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

> Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp:154
> +    if (contentBounds().isEmpty())

Do we even need to return anything other than nullptr in this case?
Comment 5 Shawn Singh 2012-07-16 09:07:26 PDT
Comment on attachment 152466 [details]
Patch

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

>> Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp:160
>> +    }
> 
> In retrospect, I don't think this is always right, but I'm not sure how to reconcile contentsScale which is a single value and the contentBounds/bounds ratio that handles different integer rounding in width and height.

What's an example of a case where this isn't right?  The few times I've encountered this pattern, contentsScale wasn't good enough because of ImageLayers in particular, which have different horizontal and vertical scaling.   But it seemed to me like this code would handle all the cases I was aware of?
Comment 6 Adrienne Walker 2012-07-16 09:21:17 PDT
Comment on attachment 152466 [details]
Patch

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

>> Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp:154
>> +    if (contentBounds().isEmpty())
> 
> Do we even need to return anything other than nullptr in this case?

Yeah.  The gutter quads use the root layer (the real root, not the NCCH) to generate a shared quad state.  Maybe we should just create that manually.

>>> Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp:160
>>> +    }
>> 
>> In retrospect, I don't think this is always right, but I'm not sure how to reconcile contentsScale which is a single value and the contentBounds/bounds ratio that handles different integer rounding in width and height.
> 
> What's an example of a case where this isn't right?  The few times I've encountered this pattern, contentsScale wasn't good enough because of ImageLayers in particular, which have different horizontal and vertical scaling.   But it seemed to me like this code would handle all the cases I was aware of?

It may just be an issue in tests, where contentBounds is not always up to date with contentsScale.  I'll take another look and see if there's something I can clean up.
Comment 7 Adrienne Walker 2012-07-16 12:27:17 PDT
Created attachment 152586 [details]
Patch
Comment 8 Adrienne Walker 2012-07-16 12:55:24 PDT
Created attachment 152593 [details]
Handle empty bounds in create quad state
Comment 9 Dana Jansens 2012-07-16 12:56:26 PDT
Comment on attachment 152593 [details]
Handle empty bounds in create quad state

lgtm!
Comment 10 Adrienne Walker 2012-07-16 15:40:11 PDT
kbr, senorblanco: Would one of you mind taking a look at this compositor patch that has an unofficial lgtm from danakj?

It's just a refactoring that shouldn't cause any change in behavior.  All layers other than tiled layers have bounds == contentBounds, so the extra code in createSharedQuadState generates the same quadTransform that it used to for both tiled layers and non-tiled layers.
Comment 11 Kenneth Russell 2012-07-16 15:56:07 PDT
Comment on attachment 152593 [details]
Handle empty bounds in create quad state

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

Mostly a rubber stamp, though I did look through the code. One question. Go ahead and cq+ if this isn't an issue.

> Source/WebKit/chromium/tests/CCQuadCullerTest.cpp:202
> +    ASSERT_EQ(quadList.size(), 12u);

Will this get run in non-debug builds?
Comment 12 Adrienne Walker 2012-07-16 16:04:39 PDT
(In reply to comment #11)
> (From update of attachment 152593 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=152593&action=review
> 
> Mostly a rubber stamp, though I did look through the code. One question. Go ahead and cq+ if this isn't an issue.

Thanks.  :)

> > Source/WebKit/chromium/tests/CCQuadCullerTest.cpp:202
> > +    ASSERT_EQ(quadList.size(), 12u);
> 
> Will this get run in non-debug builds?

Yeah.  ASSERT_EQ aborts the test if it doesn't pass.  Since later checks reference quadList[i], if that's wrong, then those will assert.  See http://code.google.com/p/googletest/wiki/Primer#Basic_Assertions
Comment 13 WebKit Review Bot 2012-07-16 16:45:50 PDT
Comment on attachment 152593 [details]
Handle empty bounds in create quad state

Clearing flags on attachment: 152593

Committed r122776: <http://trac.webkit.org/changeset/122776>
Comment 14 WebKit Review Bot 2012-07-16 16:45:55 PDT
All reviewed patches have been landed.  Closing bug.