Closed Bug 1379029 Opened 7 years ago Closed 7 years ago

Implement GuaranteePersistance on SourceSurfaceD2D + SourceSurfaceSkia

Categories

(Core :: Graphics, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: mchang, Assigned: mchang)

References

Details

Attachments

(1 file, 4 obsolete files)

DrawTargetCapture requires source surfaces to stay alive until playback time. It does this by calling SourceSurface::GuaranteePersistance when recording a moz2d command that requires a SourceSurface[1]. What was happening with some source surfaces was that we'd create a temporary draw target (mostly skia), and we'd free the SourceSurface before we could replay the captured contents. This implements GuaranteePersistance by making copies of the source surface and being sad as we just made recording slower :(.

[1] http://searchfox.org/mozilla-central/source/gfx/2d/DrawTargetCapture.cpp#88
Comment on attachment 8884117 [details] [diff] [review]
Implement GuaranteePersistance for SourceSurfaceSKia + SourceSurfaceD2D

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

::: gfx/2d/SourceSurfaceSkia.cpp
@@ +177,5 @@
>  
> +void
> +SourceSurfaceSkia::GuaranteePersistance()
> +{
> +  // Explicitly make a copy of the image since sometimes, SourceSurfaceSkia

Let's open a bug for this, maybe there is a way to transfer the ownership instead of always making a copy?
(In reply to Milan Sreckovic [:milan] from comment #2)
> Comment on attachment 8884117 [details] [diff] [review]
> Implement GuaranteePersistance for SourceSurfaceSKia + SourceSurfaceD2D
> 
> Review of attachment 8884117 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: gfx/2d/SourceSurfaceSkia.cpp
> @@ +177,5 @@
> >  
> > +void
> > +SourceSurfaceSkia::GuaranteePersistance()
> > +{
> > +  // Explicitly make a copy of the image since sometimes, SourceSurfaceSkia
> 
> Let's open a bug for this, maybe there is a way to transfer the ownership
> instead of always making a copy?

This shouldn't be necessary, as SourceSurfaceSkia, when used as a snapshot, contains a RefPtr to the owning DrawTargetSkia. And DrawTargetSkia::MarkChanged will take care of the snapshot being orphaned as well.

So long as you're holding a RefPtr to the SourceSurfaceSkia, it should basically always be safe, in principle. Thus, I don't think this bug is what it seems. It would be nice to know more about the surrounding circumstances so we could ascertain what's going on.
Attachment #8884117 - Attachment is obsolete: true
Attachment #8884117 - Flags: review?(lsalzman)
Attachment #8884404 - Flags: review?(lsalzman)
Attachment #8884404 - Attachment is obsolete: true
Attachment #8884404 - Flags: review?(lsalzman)
Attachment #8884407 - Flags: review?(lsalzman)
Attachment #8884407 - Attachment is obsolete: true
Attachment #8884407 - Flags: review?(lsalzman)
Attachment #8884408 - Flags: review?(lsalzman)
Attachment #8884408 - Attachment is obsolete: true
Attachment #8884408 - Flags: review?(lsalzman)
Attachment #8884410 - Flags: review?(lsalzman)
Attachment #8884410 - Flags: review?(lsalzman) → review+
Blocks: 1379322
Pushed by mchang@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e897b12b2b63
AddUserData to hold onto the calloc blur memory. r=lsalzman
https://hg.mozilla.org/mozilla-central/rev/e897b12b2b63
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: