Closed
Bug 887927
Opened 11 years ago
Closed 11 years ago
SourceSurfaceSkia needs to copy the bitmap when DT is destroyed
Categories
(Core :: Graphics: Canvas2D, defect)
Core
Graphics: Canvas2D
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: snorp, Assigned: snorp)
References
Details
Attachments
(1 file, 3 obsolete files)
2.21 KB,
patch
|
Details | Diff | Splinter Review |
If we have an outstanding SourceSurfaceSkia referencing a DT that gets destroyed, we will fail to do the readback later on if GetData() is called. SkBitmap is not really independent like it is with software. It is not surprising that it would need the device to be alive in order to do the readback, and I guess it does not hold a strong reference.
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #768479 -
Flags: review?(matt.woodrow)
Comment 2•11 years ago
|
||
Comment on attachment 768479 [details] [diff] [review] Make a copy of the SkBitmap when DT is destroyed Review of attachment 768479 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/2d/SourceSurfaceSkia.cpp @@ +110,5 @@ > > void > SourceSurfaceSkia::DrawTargetDestroyed() > { > + DrawTargetWillChange(); Can we do this only for SkiaGL? It works fine for software!
Comment 3•11 years ago
|
||
Or even better, can't we just take ownership of the device in the SourceSurfaceSkia? It's a fairly common pattern to create a draw target, draw into it, snapshot and let the DT die. Having to make a copy when that happens could be expensive.
Assignee | ||
Comment 4•11 years ago
|
||
Alright, so I made SourceSurfaceSkia hold a reference to the SkDevice. This made it possible for the SkBitmap to attempt to lock the pixels (where before I assume it just bailed immediately). This doesn't work, though, because the SkDevice relies on the GLContext which is only held in DrawTargetSkia (via a GenericRefPtr member). So once the DrawTargetSkia is gone, the SkDevice (and GrContext, etc) are all effectively busted. I think we'll have to live with a copy when the DT goes away, at least for SkiaGL.
Assignee | ||
Comment 5•11 years ago
|
||
I've also tried having SourceSurfaceSkia hold a reference to the GLContext. This would've worked before, but the code has changed such that GLContextSkia now uses the DT to retrieve the GLContext. So we absolutely must have the originating DT be alive for SourceSurfaceSkia to complete a readback (with current code). We can hold a reference to it in SourceSurfaceSkia, but I think the lifetime of the DT now becomes a little more ambiguous than we would like. I think I would like to just copy the SkBitmap when the DT is destroyed but only when using GL. Unless you are going to just throw the SourceSurface away, you're going to end up doing a readback at some point anyway. For software we can keep it as it is now.
Assignee | ||
Comment 6•11 years ago
|
||
Attachment #768706 -
Flags: review?(matt.woodrow)
Assignee | ||
Updated•11 years ago
|
Attachment #768479 -
Attachment is obsolete: true
Attachment #768479 -
Flags: review?(matt.woodrow)
Assignee | ||
Updated•11 years ago
|
Attachment #768706 -
Flags: review?(matt.woodrow) → review?(gwright)
Updated•11 years ago
|
Attachment #768706 -
Flags: review?(gwright) → review+
Assignee | ||
Comment 7•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #768706 -
Attachment is obsolete: true
Assignee | ||
Comment 8•11 years ago
|
||
Matt and I talked some more and agreed that just refing the DT in the SourceSurfaceSkia is better since the performance remains the same regardless of whether or not the callerd destroys the DT (or rather, tries to, since it will remain alive while any outstanding SourceSurfaceSkias are alive).
Assignee | ||
Comment 9•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #769100 -
Attachment is obsolete: true
Comment 11•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/295946bd016a
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in
before you can comment on or make changes to this bug.
Description
•