expire unused cached double-buffering back surfaces

RESOLVED FIXED

Status

()

Core
Graphics
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: karlt, Assigned: karlt)

Tracking

({footprint})

Trunk
x86
All
footprint
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

7 years ago
roc and I were discussing the value of caching surfaces when their contents
need not be retained.  It seemed to come down to the possibility of
significant overhead with large resource allocations.  For opaque surfaces the
initialization to black is also unnecessary (while
cairo_surface_create_similar initializes to black).
AIUI CONTENT_COLOR_ALPHA surfaces typically need to be initialized before use.

However, there is also significant resource cost in retaining these resources
while they are unused.  If we are going to do this then we should expire on a
timer.

Bug 564991 comment 27 proposes retaining these surfaces.
(This bug is about expiring them.)

I considered sharing surfaces between layer managers but one reason not to do
this is that there is value in keeping the surfaces associated with a single
window so as not to migrate the surfaces from one graphics card to another
when sharing between windows driven by different cards.
(Assignee)

Comment 1

7 years ago
Created attachment 452617 [details] [diff] [review]
patch v0.1

Needs testing, and better documentation.
(In reply to comment #0)
> AIUI CONTENT_COLOR_ALPHA surfaces typically need to be initialized before use.

If we have a layer tree whose layers don't completely fill the window, or whose layers are transparent, we need to clear the backbuffer before drawing the layer tree into it. But that can only happen when the backbuffer is CONTENT_COLOR_ALPHA. If the backbuffer is CONTENT_COLOR, then we know the layers must completely fill the window with opaque pixels so there is no need to clear the backbuffer before drawing the layers into it.
(Matt and I considered an optimization where we avoid clearing the backbuffer if (some subset of) the leaf layers are transparent but completely fill the window without overlapping; then we could use OPERATOR_SOURCE to draw them. But it's totally not worth the complexity.)
(Assignee)

Updated

7 years ago
Depends on: 564991
OS: Linux → All
(Assignee)

Updated

7 years ago
Attachment #452617 - Attachment is obsolete: true
(Assignee)

Comment 4

7 years ago
Created attachment 452873 [details] [diff] [review]
patch
Attachment #452873 - Flags: superreview?(roc)
Attachment #452873 - Flags: review?(joe)
(Assignee)

Updated

7 years ago
Keywords: footprint
(Assignee)

Updated

7 years ago
Blocks: 573626
Comment on attachment 452873 [details] [diff] [review]
patch

+gfxCachedTempSurface::Use(gfxASurface::gfxContentType aContentType,
+                          const gfxIntSize& aSize,
+                          gfxASurface* aSimilarTo)
+{

I think this should be called "Get".
Attachment #452873 - Flags: superreview?(roc) → superreview+
(Assignee)

Updated

7 years ago
Attachment #452873 - Flags: review?(joe) → review?(vladimir)
Attachment #452873 - Flags: review?(vladimir) → review+
(Assignee)

Comment 6

7 years ago
Created attachment 454436 [details] [diff] [review]
addressed review comments
Attachment #452873 - Attachment is obsolete: true
http://hg.mozilla.org/mozilla-central/rev/51dc121aa525
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.