Closed Bug 1170966 Opened 9 years ago Closed 9 years ago

Check quad's effective region before drawing

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: jerry, Assigned: jerry)

References

Details

Attachments

(1 file, 2 obsolete files)

With tiling, I see that we draw a lot of quads which are not shown on screen. This bug will try to check each quad's region and do the culling if needs.
This patch check the quad's effective region with the target buffer size. If there is no overlapping area, we can skip this function. With this, we can improve the layerscope tool and the tiling layer rendering performance slightly.
Attachment #8614701 - Flags: review?(nical.bugzilla)
Comment on attachment 8614701 [details] [diff] [review]
check quad's effective region before drawing. v1

Review of attachment 8614701 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/opengl/CompositorOGL.cpp
@@ +953,5 @@
>      return;
>    }
> +
> +  // XXX: This doesn't handle 3D transforms. It also doesn't handled rotated
> +  //      quads. Fix me.

It's okay that mPixelsFilled has some imprecision in those cases but we should not do this culling optimization if we have a rotation and/or a 3D transform. You should check that !aTransform.HasNonAxisAlignedTransform() before culling out the quad. That should still cover most of the cases you are interested in.
Attachment #8614701 - Flags: review?(nical.bugzilla) → review-
Comment on attachment 8614701 [details] [diff] [review]
check quad's effective region before drawing. v1

Review of attachment 8614701 [details] [diff] [review]:
-----------------------------------------------------------------

Sorry, TransformBounds will give a conservatively big rect, so it's correct.
Attachment #8614701 - Flags: review- → review+
Inflate a small size to avoid the test failed at mac 10.10.
https://treeherder.mozilla.org/logviewer.html#?job_id=10481451&repo=mozilla-inbound
Attachment #8614701 - Attachment is obsolete: true
Comment on attachment 8617066 [details] [diff] [review]
check quad's effective region before drawing. v2

pass the try:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=ec6c0dd55353
Attachment #8617066 - Flags: review?(nical.bugzilla)
Comment on attachment 8617066 [details] [diff] [review]
check quad's effective region before drawing. v2

Review of attachment 8617066 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/opengl/CompositorOGL.cpp
@@ +958,5 @@
> +  Rect destRect = aTransform.TransformBounds(aRect);
> +  mPixelsFilled += destRect.width * destRect.height;
> +
> +  // Do a simple culling if this rect is out of target buffer.
> +  // Inflate a small size to avoid some corner edge hit test.

I think you meant "corner case" or "edge case".
Attachment #8617066 - Flags: review?(nical.bugzilla) → review+
update comment.
Attachment #8617066 - Attachment is obsolete: true
Comment on attachment 8617463 [details] [diff] [review]
check quad's effective region before drawing. v3, r=nical

Please land this patch to m-c.
Attachment #8617463 - Attachment description: check quad's effective region before drawing. v3 → check quad's effective region before drawing. v3, r=nical
Attachment #8617463 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/7674044400c8
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
See Also: → 1186236
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: