Closed Bug 933030 Opened 11 years ago Closed 11 years ago

eliminate thebes use in CanvasRenderingContext2D.cpp

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: gal, Assigned: gal)

References

Details

(Whiteboard: [qa-])

Attachments

(3 files, 2 obsolete files)

No description provided.
Blocks: 933019
Depends on: 929299
Attached patch GetImageBuffer with Moz2D (obsolete) (deleted) — Splinter Review
Assignee: nobody → gal
Comment on attachment 825242 [details] [diff] [review] GetImageBuffer with Moz2D The whole HOSTARGB business is really fishy. Please take a close look at BGR vs HOSTARGB.
Attachment #825242 - Flags: review?(jwatt)
Comment on attachment 825242 [details] [diff] [review] GetImageBuffer with Moz2D I'm not a Graphics module peer, and after looking into this patch for a bit I'm not comfortable with r+'ing anyway since there are some things I'm not sure about. Sorry. I've preemptively switched the review request to roc since from the hg log of the file he looks to have done the most recent relevant reviews, but feel free to switch it to someone else on the Graphics owners/peers list if you prefer: https://wiki.mozilla.org/Modules/Core#Graphics
Attachment #825242 - Flags: review?(jwatt) → review?(roc)
Comment on attachment 825242 [details] [diff] [review] GetImageBuffer with Moz2D Review of attachment 825242 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/canvas/src/CanvasRenderingContext2D.cpp @@ +1076,5 @@ > + Factory::CreateDrawTargetForData(mTarget->GetType(), > + imageBuffer, > + IntSize(mWidth, mHeight), > + mWidth * 4, > + FORMAT_B8G8R8A8); This is correct according to gfx2DGlue::ImageFormatToSurfaceFormat. @@ +1085,5 @@ > > + IntSize size = snapshot->GetSize(); > + dt->DrawSurface(snapshot, > + mgfx::Rect(0, 0, mWidth, mHeight), > + mgfx::Rect(0, 0, size.width, size.height)); This should use OP_SOURCE for efficiency.
Attachment #825242 - Flags: review?(roc) → review+
roc, I am actually not so sure any more whether this is in general the best approach. Right now I do the following: 1. Wrap a draw target around CPU memory. 2. Draw and possibly scale onto it. The backend may or may not fall back onto a software path here, since its going into CPU memory. A smart backend might render onto a texture and then Flush() forces a readback. This is left to the backend. Maybe what I should do is: 1. Make a draw target that matches mTarget (GetOptimizedDrawTarget). 2. Draw/scale onto it. 3. Snapshot(), and then get the data surface. 4. Copy that. For a software backend this adds an extra copy. Ideally, nothing should use a software backend in the future. On the upside for a GPU backend this should be much faster since scaling happens on the GPU. What do you think? (this is a slow path, it doesn't matter much here, but I think its worth having this discussion).
Flags: needinfo?(roc)
I guess mWidth/mHeight == snapshot->GetSize() so we never scale here. I _think_. I will stick to the current code.
Attached patch Use Moz2D in Canvas2D GetImageBuffer (r=roc). (obsolete) (deleted) — Splinter Review
Attachment #825242 - Attachment is obsolete: true
Keywords: checkin-needed
(In reply to Andreas Gal :gal from comment #6) > I guess mWidth/mHeight == snapshot->GetSize() so we never scale here. I > _think_. I will stick to the current code. Yes, there normally wouldn't be scaling going on here. Also, this is only used for image encoding (toDataURL etc) so performance isn't too big of an issue; minimizing memory usage is probably more important.
Flags: needinfo?(roc)
Thanks for the backout! Will check.
CreateDrawTargetForData only works (and can only work) for some backends. So that is failing, and you're returning early where it worked previously. What I think you should do is: * Call GetDataSurface() on the snapshot to get access to the pixel data or read is back. * Assert that this is BGRA32 or BGR24 formatted (I'm pretty sure this is true for all canvases). * Allocate the memory for the destination * Memcpy from the snapshot to the destination, maybe taking into account differences in stride and setting the alpha channel to 255 if the source is BGR24.
Attachment #825657 - Attachment is obsolete: true
Attachment #825992 - Flags: review?(matt.woodrow)
Attachment #825992 - Flags: review?(matt.woodrow) → review+
Attached patch patch ready for check-in (deleted) — Splinter Review
Attachment #826456 - Flags: review+
Keywords: checkin-needed
Please avoid csets that touch both gfx/2d and other files in a single cset in the future, they make my life harder when merging :).
Also it seems an inclusion of mozalloc slipped in here for fallible_t, mozalloc is not part of MFBT so we can't include it, I'll create a patch to fix this.
Attachment #826519 - Flags: review?(matt.woodrow)
Comment on attachment 826519 [details] [diff] [review] Remove external dependency added to Moz2D. Review of attachment 826519 [details] [diff] [review]: ----------------------------------------------------------------- Ah, sorry, should have caught that.
Attachment #826519 - Flags: review?(matt.woodrow) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
this patch appears to have caused a regression in android tp4m shutdown times: android 2.2: http://graphs.mozilla.org/graph.html#tests=[[87,63,20]]&sel=1383423553000,1383596353000&displayrange=7&datatype=running android 4.0.4: http://graphs.mozilla.org/graph.html#tests=[[87,63,29]]&sel=1383424130000,1383596930000&displayrange=7&datatype=running I am not sure why, but both platforms show a fairly stable reporting value before and after this change, this change just caused the total value to go up about 14%.
(In reply to Joel Maher (:jmaher) from comment #23) > this patch appears to have caused a regression in android tp4m shutdown times: I'm pretty sure this is the annual bug 809190 -- Android tp4m shutdown is dependent on the DST time change.
oh, that actually lines up well with the data, sorry for the confusion in this bug.
Could this have caused bug 935541?
Flags: needinfo?(matt.woodrow)
Flags: needinfo?(gal)
Flags: needinfo?(bas)
It seems extremely unlikely to me (at least my patch wont have caused it, but I also doubt the others did). But others might have a better idea.
Flags: needinfo?(bas)
No, I don't think these are related at all.
Flags: needinfo?(matt.woodrow)
Flags: needinfo?(gal)
We might be using skiaGL where we used software before, increasing texture memory pressure, causing us to die in the pbuffer allocation. Just guessing here.
Whiteboard: [qa-]
This breaks thumbnails on big-endian platforms (please see bug 998749).
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: