The default bug view has changed. See this FAQ.

render active layers at full scale and transform them on the GPU

RESOLVED FIXED in mozilla15

Status

()

Core
Graphics: Layers
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: gal, Assigned: gal)

Tracking

Trunk
mozilla15
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
If an animation scales content up or down, we currently redraw it at powers of 2 and scale up from there to the actual transform on the GPU. This balances memory use and avoids redrawing every time, which is too slow.

I would like to change this to render active layers at 1.0 scale at all times and do the entire transformation on the GPU. This avoids redrawing completely, but uses more texture memory and initial upload bandwidth. On the other hand, this is applied to active layers only, so we use more memory and bandwidth during the actual animation only. Once the animation stops, the active layer times out and is deleted and we redraw. Also it should be noted that in most cases we use much less total upload bandwidth, since we draw only once. The current patch doesn't try to exclude boundary conditions (e.g. very large textures animated to very small scales 0.1 .. 0.2 etc). The old code wasn't particularly good about that either. When going from 0 to 100% scale we would redraw a bunch of time at small scale which really doesn't make any sense what so ever since it doesn't save memory but it causes redraw churn.

This change provides much smoother scaling animations on desktop and in particular mobile. I discussed this with cjones. He thinks this approach is wrong, so I have my work cut out for me trying to convince him of the opposite.
(Assignee)

Comment 1

5 years ago
Created attachment 619355 [details] [diff] [review]
patch
Assignee: nobody → gal
(Assignee)

Updated

5 years ago
Attachment #619355 - Flags: review?(roc)
Attachment #619355 - Flags: feedback?(jones.chris.g)
When zooming out, I think this makes sense --- crappy downscaling in some cases, but OK. (Maybe it should be mobile-only for that case?) When zooming in, this could lead to arbitrarily bad rendering for vector graphics. So I'm not quite convinced. Maybe if you make the scale a minimum of 1.0 in each direction?

(In reply to Andreas Gal :gal from comment #0)
> The current patch doesn't try to exclude boundary conditions
> (e.g. very large textures animated to very small scales 0.1 .. 0.2 etc). The
> old code wasn't particularly good about that either. When going from 0 to
> 100% scale we would redraw a bunch of time at small scale which really
> doesn't make any sense what so ever since it doesn't save memory but it
> causes redraw churn.

We can tweak our existing heuristics to avoid that, e.g. avoid reducing the scaled texture size to below some minimum threshold.
(Assignee)

Comment 3

5 years ago
Created attachment 619443 [details] [diff] [review]
patch

Below 1.0 scale render at full resolution and scale by transforming the layer.
Attachment #619355 - Attachment is obsolete: true
Attachment #619355 - Flags: review?(roc)
Attachment #619355 - Flags: feedback?(jones.chris.g)
(Assignee)

Comment 4

5 years ago
Comment on attachment 619443 [details] [diff] [review]
patch

roc, this does what you suggested (don't go below 1.0 scale). I tried this with vector content and it doesn't look too bad. This only kicks in while the content is animated. The moment the animation stops we redraw. Above 1.0 scale we stick to the old approach, which should work better for large scale corner cases.
Attachment #619443 - Flags: review?(roc)
Comment on attachment 619443 [details] [diff] [review]
patch

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

OK, let's try this

::: gfx/thebes/gfxUtils.cpp
@@ +549,5 @@
>  
> +  gfxFloat scale = pow(kScaleResolution, power);
> +
> +  if (scale < 1.0)
> +      scale = 1.0;

use NS_MAX
Attachment #619443 - Flags: review?(roc) → review+
(Assignee)

Comment 6

5 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/2e84edabd25b
https://hg.mozilla.org/mozilla-central/rev/2e84edabd25b
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla15
Is this the same thing as bug 711997?
You need to log in before you can comment on or make changes to this bug.