Closed Bug 718388 Opened 8 years ago Closed 8 years ago

Use viewport 'prediction' to reduce checkerboarding

Categories

(Firefox for Android :: General, defect, P1)

ARM
Android
defect

Tracking

()

RESOLVED DUPLICATE of bug 729528
Tracking Status
blocking-fennec1.0 --- beta+
fennec 11+ ---

People

(Reporter: cwiiis, Assigned: kats)

References

(Blocks 1 open bug)

Details

(Whiteboard: MAPLE mwc-demo)

Attachments

(1 file, 3 obsolete files)

With the tiling capability added in bug #717283, we should be able to 'predict' viewport locations to render more off-screen area and therefore reduce checkerboarding. This would obsolete the viewport offset (bug 710533).
Assignee: nobody → chrislord.net
Status: NEW → ASSIGNED
This patch uses a 'predicted' viewport instead of the actual viewport during flinging, to more intelligently render off-screen content. At least, that's the idea. This patch removes viewport bias and moves setting the viewport offset into LayerController (which has a lot more context to do it). This allows the buffer size to be reduced, which is also done in this patch.

Currently showing signs of being able to work, but quite glitchy and very much work in progress. Uploading for feedback/discussion.
Attachment #588889 - Flags: feedback?(pwalton)
Sorry for spam, forgot to qref.
Attachment #588889 - Attachment is obsolete: true
Attachment #588889 - Flags: feedback?(pwalton)
Attachment #588890 - Flags: feedback?(pwalton)
Just a note, this patch would benefit greatly from tile-by-tile drawing and a tile-map rather than using contiguous memory, as we could prevent the buffer from being entirely locked during drawing (and fit in more texture updates per viewport update). Especially in the gralloc case, where the tile and texture memory will be shared.
This works a lot better than the last one and is less glitchy... Starting to get somewhere.

The main problem I see is gaps between viewport predictions when scrolling, which I think looks too odd, despite showing you more of the page than you would've seen before.
Attachment #588890 - Attachment is obsolete: true
Attachment #588890 - Flags: feedback?(pwalton)
Attachment #588937 - Flags: feedback?(pwalton)
The main reason for these gaps is the asynchronous update - disabling this, I get an almost checkerboard-free scroll on engadget.com (after fully loading, of course). This is heartening, in this case, I think I can work out a nicer heuristic to do the async updating in larger chunks that should make this work better.
After playing around with it a bit, I can't think of a good heuristic for doing off-screen updates that will work with this patch... On the other hand, now that I've reduced the buffer size, I don't actually need async updates to maintain smooth frame updates...

So any thoughts on just disabling them and updating the entire dirty region at once?

With tiles, and the buffer not being much bigger than the screen, this really shouldn't be too different anyway (the async update makes sense with a large buffer though).
Disabled async updates, but left a static boolean flag to enable, along with a comment explanation.

This, and its dependent tiling patch make panning a much nicer experience on my HTC Flyer. Not checkerboard-free, but there's much less of it, and the decreased buffer size improves update performance considerably.

The decreased buffer size does mean that you can now quite easily pan to the checkerboard though, so if this lands, we may want to consider either enabling updates during pan, or having some kind of dynamic buffer size. Given flinging is smooth, I think enabling updates during pan should be a reasonable option.
Attachment #588937 - Attachment is obsolete: true
Attachment #588937 - Flags: feedback?(pwalton)
Attachment #588965 - Flags: review?(pwalton)
Comment on attachment 588965 [details] [diff] [review]
Use viewport prediction to render off-screen content more intelligently

In my haste, I forgot that I haven't made this work for gralloc devices - this will break behaviour in that case.

Rather than add more if/else's all over the place, I'll file a new bug about getting tiling working on gralloc tomorrow and make this patch depend on that.

I'd still like review though, so if this feedback could be treated as review, excepting the issue that this breaks the gralloc path, that'd be appreciated.
Attachment #588965 - Flags: review?(pwalton) → feedback?(pwalton)
I'm a bit confused -- why do we want a small buffer size? It seems to me that this would make checkerboarding worse in some cases, because we have to discard more tiles once they're outside the buffer.

If viewport prediction improves things, then that's fine, but I'm a little wary of decreasing the buffer size if we're about to land tile-by-tile rendering, which should eliminate the penalty associated with a large buffer size.
I'm not sure what you mean about discarding more tiles once they're outside the buffer? Either way, the problem with a large buffer size is that it increases the time it takes Gecko to respond to viewport changes, and increases memory use.

The great thing about having a separate tile store is that we can reduce the Gecko buffer size - this decreases our rendering time/CPU usage/memory pressure and lets us respond much quicker.

The tile pool allows us to move the viewport away from the screen, so during flinging, we have a much larger 'virtual' buffer size. As we have to discard tiles once they're off the screen and not in the buffer, reducing the buffer size improves checkerboarding when you change directions very quickly.

Reducing the buffer size also lets us update textures synchronously again, which the viewport prediction pretty much needs (we could get around this with clever heuristics, but I don't see the point if reducing the buffer size only has positive effects and removes this problem).
(In reply to Chris Lord [:cwiiis] from comment #10)
> I'm not sure what you mean about discarding more tiles once they're outside
> the buffer? Either way, the problem with a large buffer size is that it
> increases the time it takes Gecko to respond to viewport changes, and
> increases memory use.
> 
> The great thing about having a separate tile store is that we can reduce the
> Gecko buffer size - this decreases our rendering time/CPU usage/memory
> pressure and lets us respond much quicker.
> 
> The tile pool allows us to move the viewport away from the screen, so during
> flinging, we have a much larger 'virtual' buffer size. As we have to discard
> tiles once they're off the screen and not in the buffer, reducing the buffer
> size improves checkerboarding when you change directions very quickly.

This is what I'm confused about -- won't reducing the buffer size mean that the maximum distance from the viewport that we're allowed to retain tile contents within decreases? So we could get more checkerboarding...
tracking 11.
tracking-fennec: --- → 11+
Priority: -- → P2
Kats is currently looking at this. I'm morphing this bug into a Maple-specific bug.
Assignee: chrislord.net → bugmail.mozilla
Whiteboard: MAPLE mwc-demo
Priority: P2 → P1
Duping to bug 729528.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 729528
blocking-fennec1.0: --- → beta+
Comment on attachment 588965 [details] [diff] [review]
Use viewport prediction to render off-screen content more intelligently

feedback- to get out of queue.
Attachment #588965 - Flags: feedback?(pwalton) → feedback-
You need to log in before you can comment on or make changes to this bug.